This source file includes following definitions.
- doAppendCycleOperandRMW_
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 static ALWAYS_INLINE word24 doAppendCycleOperandRMW_ (cpu_state_t * cpup, word36 * data, uint nWords, const bool full) {
20 DCDstruct * i = & cpu.currentInstruction;
21 DBGAPP ("doAppendCycleOperandRMW(Entry) thisCycle=OPERAND_RMW\r\n");
22 DBGAPP ("doAppendCycleOperandRMW(Entry) lastCycle=%s\r\n", str_pct (cpu.apu.lastCycle));
23 DBGAPP ("doAppendCycleOperandRMW(Entry) CA %06o\r\n", cpu.TPR.CA);
24 DBGAPP ("doAppendCycleOperandRMW(Entry) n=%2u\r\n", nWords);
25 DBGAPP ("doAppendCycleOperandRMW(Entry) PPR.PRR=%o PPR.PSR=%05o\r\n", cpu.PPR.PRR, cpu.PPR.PSR);
26 DBGAPP ("doAppendCycleOperandRMW(Entry) TPR.TRR=%o TPR.TSR=%05o\r\n", cpu.TPR.TRR, cpu.TPR.TSR);
27
28 if (i->b29) {
29 DBGAPP ("doAppendCycleOperandRMW(Entry) isb29 PRNO %o\r\n", GET_PRN (IWB_IRODD));
30 }
31
32 bool nomatch = true;
33 if (cpu.tweaks.enable_wam) {
34
35
36
37
38
39 nomatch = ((i->opcode == 0232 || i->opcode == 0254 ||
40 i->opcode == 0154 || i->opcode == 0173) &&
41 i->opcodeX ) ||
42 ((i->opcode == 0557 || i->opcode == 0257) &&
43 ! i->opcodeX);
44 }
45
46 processor_cycle_type lastCycle = cpu.apu.lastCycle;
47 cpu.apu.lastCycle = OPERAND_RMW;
48
49 DBGAPP ("doAppendCycleOperandRMW(Entry) XSF %o\r\n", cpu.cu.XSF);
50
51 PNL (L68_ (cpu.apu.state = 0;))
52
53 cpu.RSDWH_R1 = 0;
54
55 cpu.acvFaults = 0;
56
57
58 #define FMSG(x)
59 FMSG (char * acvFaultsMsg = "<unknown>";)
60
61 word24 finalAddress = (word24) -1;
62
63
64
65
66
67
68
69
70
71
72
73
74
75 PNL (cpu.APUMemAddr = cpu.TPR.CA;)
76
77 DBGAPP ("doAppendCycleOperandRMW(A)\r\n");
78
79
80 if (nomatch || ! fetch_sdw_from_sdwam (cpup, cpu.TPR.TSR)) {
81
82 DBGAPP ("doAppendCycleOperandRMW(A):SDW for segment %05o not in SDWAM\r\n", cpu.TPR.TSR);
83 DBGAPP ("doAppendCycleOperandRMW(A):DSBR.U=%o\r\n", cpu.DSBR.U);
84
85 if (cpu.DSBR.U == 0) {
86 fetch_dsptw (cpup, cpu.TPR.TSR);
87
88 if (! cpu.PTW0.DF)
89 doFault (FAULT_DF0 + cpu.PTW0.FC, fst_zero, "doAppendCycleOperandRMW(A): PTW0.F == 0");
90
91 if (! cpu.PTW0.U)
92 modify_dsptw (cpup, cpu.TPR.TSR);
93
94 fetch_psdw (cpup, cpu.TPR.TSR);
95 } else
96 fetch_nsdw (cpup, cpu.TPR.TSR);
97
98 if (cpu.SDW0.DF == 0) {
99 DBGAPP ("doAppendCycleOperandRMW(A): SDW0.F == 0! Initiating directed fault\r\n");
100
101 doFault (FAULT_DF0 + cpu.SDW0.FC, fst_zero, "SDW0.F == 0");
102 }
103
104 load_sdwam (cpup, cpu.TPR.TSR, nomatch);
105 }
106 DBGAPP ("doAppendCycleOperandRMW(A) R1 %o R2 %o R3 %o E %o\r\n", cpu.SDW->R1, cpu.SDW->R2, cpu.SDW->R3, cpu.SDW->E);
107
108
109 cpu.RSDWH_R1 = cpu.SDW->R1;
110
111
112
113
114
115
116
117
118
119
120
121 DBGAPP ("doAppendCycleOperandRMW(B)\r\n");
122
123
124
125
126 if (! (cpu.SDW->R1 <= cpu.SDW->R2 && cpu.SDW->R2 <= cpu.SDW->R3)) {
127
128 cpu.acvFaults |= ACV0;
129 PNL (L68_ (cpu.apu.state |= apu_FLT;))
130 FMSG (acvFaultsMsg = "acvFaults(B) C(SDW.R1) <= C(SDW.R2) <= " "C(SDW .R3)";)
131 }
132
133
134
135
136
137
138
139 if (lastCycle == RTCD_OPERAND_FETCH)
140 sim_warn ("%s: lastCycle == RTCD_OPERAND_FETCH opcode %0#o\r\n", __func__, i->opcode);
141
142
143
144
145
146
147
148
149
150
151 DBGAPP ("doAppendCycleOperandRMW(B):!STR-OP\r\n");
152
153
154
155 if (cpu.TPR.TRR > cpu.SDW->R2) {
156 DBGAPP ("ACV3\r\n");
157 DBGAPP ("doAppendCycleOperandRMW(B) ACV3\r\n");
158
159 cpu.acvFaults |= ACV3;
160 PNL (L68_ (cpu.apu.state |= apu_FLT;))
161 FMSG (acvFaultsMsg = "acvFaults(B) C(TPR.TRR) > C(SDW .R2)";)
162 }
163
164 if (cpu.SDW->R == 0) {
165
166 cpu.TPR.TRR = cpu.PPR.PRR;
167
168
169 if (cpu.PPR.PSR != cpu.TPR.TSR) {
170 DBGAPP ("ACV4\r\n");
171 DBGAPP ("doAppendCycleOperandRMW(B) ACV4\r\n");
172
173 cpu.acvFaults |= ACV4;
174 PNL (L68_ (cpu.apu.state |= apu_FLT;))
175 FMSG (acvFaultsMsg = "acvFaults(B) C(PPR.PSR) = C(TPR.TSR)";)
176
177
178 }
179 }
180
181
182
183
184 DBGAPP ("doAppendCycleOperandRMW(B):STR-OP\r\n");
185
186
187 if (cpu.TPR.TSR == cpu.PPR.PSR)
188 cpu.TPR.TRR = cpu.PPR.PRR;
189
190
191 if (cpu.TPR.TRR > cpu.SDW->R1) {
192 DBGAPP ("ACV5 TRR %o R1 %o\r\n", cpu.TPR.TRR, cpu.SDW->R1);
193
194 cpu.acvFaults |= ACV5;
195 PNL (L68_ (cpu.apu.state |= apu_FLT;))
196 FMSG (acvFaultsMsg = "acvFaults(B) C(TPR.TRR) > C(SDW .R1)";)
197 }
198
199 if (! cpu.SDW->W) {
200
201 cpu.TPR.TRR = cpu.PPR.PRR;
202
203 DBGAPP ("ACV6\r\n");
204
205 cpu.acvFaults |= ACV6;
206 PNL (L68_ (cpu.apu.state |= apu_FLT;))
207 FMSG (acvFaultsMsg = "acvFaults(B) ACV6 = W-OFF";)
208 }
209
210 goto G;
211
212
213
214
215
216
217
218 G:;
219
220 DBGAPP ("doAppendCycleOperandRMW(G)\r\n");
221
222
223 if (((cpu.TPR.CA >> 4) & 037777) > cpu.SDW->BOUND) {
224 DBGAPP ("ACV15\r\n");
225 DBGAPP ("doAppendCycleOperandRMW(G) ACV15\r\n");
226 cpu.acvFaults |= ACV15;
227 PNL (L68_ (cpu.apu.state |= apu_FLT;))
228 FMSG (acvFaultsMsg = "acvFaults(G) C(TPR.CA)0,13 > SDW.BOUND";)
229 DBGAPP ("acvFaults(G) C(TPR.CA)0,13 > SDW.BOUND\r\n" " CA %06o CA>>4 & 037777 %06o SDW->BOUND %06o",
230 cpu.TPR.CA, ((cpu.TPR.CA >> 4) & 037777), cpu.SDW->BOUND);
231 }
232
233 if (cpu.acvFaults) {
234 DBGAPP ("doAppendCycleOperandRMW(G) acvFaults\r\n");
235 PNL (L68_ (cpu.apu.state |= apu_FLT;))
236
237 doFault (FAULT_ACV, (_fault_subtype) {.fault_acv_subtype=cpu.acvFaults}, "ACV fault");
238 }
239
240
241 if (cpu.SDW->U)
242 goto H;
243
244
245
246
247 DBGAPP ("doAppendCycleOperandRMW(G) CA %06o\r\n", cpu.TPR.CA);
248 if (nomatch || ! fetch_ptw_from_ptwam (cpup, cpu.SDW->POINTER, cpu.TPR.CA)) {
249 fetch_ptw (cpup, cpu.SDW, cpu.TPR.CA);
250 if (! cpu.PTW0.DF) {
251
252 doFault (FAULT_DF0 + cpu.PTW0.FC, (_fault_subtype) {.bits=0}, "PTW0.F == 0");
253 }
254 loadPTWAM (cpup, cpu.SDW->POINTER, cpu.TPR.CA, nomatch);
255 }
256
257
258
259
260
261
262 if (i->opcodeX && ((i->opcode & 0770)== 0200|| (i->opcode & 0770) == 0220
263 || (i->opcode & 0770)== 020|| (i->opcode & 0770) == 0300)) {
264 do_ptw2 (cpup, cpu.SDW, cpu.TPR.CA);
265 }
266 goto I;
267
268
269
270
271
272
273
274 H:;
275 DBGAPP ("doAppendCycleOperandRMW(H): FANP\r\n");
276
277 PNL (L68_ (cpu.apu.state |= apu_FANP;))
278
279
280
281
282
283
284
285 set_apu_status (cpup, apuStatus_FANP);
286
287 DBGAPP ("doAppendCycleOperandRMW(H): SDW->ADDR=%08o CA=%06o\r\n", cpu.SDW->ADDR, cpu.TPR.CA);
288
289 finalAddress = (cpu.SDW->ADDR & 077777760) + cpu.TPR.CA;
290 finalAddress &= 0xffffff;
291 PNL (cpu.APUMemAddr = finalAddress;)
292
293 DBGAPP ("doAppendCycleOperandRMW(H:FANP): (%05o:%06o) finalAddress=%08o\r\n", cpu.TPR.TSR, cpu.TPR.CA, finalAddress);
294
295 goto HI;
296
297 I:;
298
299
300
301 DBGAPP ("doAppendCycleOperandRMW(I): FAP\r\n");
302 if (cpu.PTW->M == 0)
303 modify_ptw (cpup, cpu.SDW, cpu.TPR.CA);
304
305
306 set_apu_status (cpup, apuStatus_FAP);
307 PNL (L68_ (cpu.apu.state |= apu_FAP;))
308
309 word24 y2 = cpu.TPR.CA % 1024;
310
311
312
313 finalAddress = (((word24)cpu.PTW->ADDR & 0777760) << 6) + y2;
314 finalAddress &= 0xffffff;
315 PNL (cpu.APUMemAddr = finalAddress;)
316
317 L68_ (
318 if (cpu.MR_cache.emr && cpu.MR_cache.ihr)
319 add_l68_APU_history (cpup, APUH_FAP);
320 )
321
322 DBGAPP ("doAppendCycleOperandRMW(H:FAP): (%05o:%06o) finalAddress=%08o\r\n", cpu.TPR.TSR, cpu.TPR.CA, finalAddress);
323
324 goto HI;
325
326 HI:
327 DBGAPP ("doAppendCycleOperandRMW(HI)\r\n");
328
329
330 cpu.cu.XSF = 1;
331 if (full && cpu.currentInstruction.b29)
332 cpu.xsfScu = true;
333 sim_debug (DBG_TRACEEXT, & cpu_dev, "loading of cpu.TPR.TSR sets XSF to 1\r\n");
334
335 if (nWords == 1) {
336 if (full)
337 cache_read_lock (cpup, finalAddress, data, "OPERAND_RMW");
338 else
339 core_read_lock (cpup, finalAddress, data, "OPERAND_RMW");
340 } else {
341 sim_warn("doAppendCycleOperandRMW: RMW nWords %d != 1\r\n", nWords);
342 if (full)
343 cache_readN (cpup, finalAddress, data, nWords, "OPERAND_RMW");
344 else
345 core_readN (cpup, finalAddress, data, nWords, "OPERAND_RMW");
346 }
347
348
349
350
351
352
353
354
355
356 PNL (cpu.APUDataBusOffset = cpu.TPR.CA;)
357 PNL (cpu.APUDataBusAddr = finalAddress;)
358
359 PNL (L68_ (cpu.apu.state |= apu_FA;))
360
361 DBGAPP ("doAppendCycleOperandRMW (Exit) PRR %o PSR %05o P %o IC %06o\r\n", cpu.PPR.PRR, cpu.PPR.PSR, cpu.PPR.P, cpu.PPR.IC);
362 DBGAPP ("doAppendCycleOperandRMW (Exit) TRR %o TSR %05o TBR %02o CA %06o\r\n", cpu.TPR.TRR, cpu.TPR.TSR, cpu.TPR.TBR, cpu.TPR.CA);
363
364 return finalAddress;
365 }