This source file includes following definitions.
- doAppendCycleRTCDOperandFetch_
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 static ALWAYS_INLINE word24 doAppendCycleRTCDOperandFetch_ (cpu_state_t * cpup, word36 * data, uint nWords, const bool full) {
20 DCDstruct * i = & cpu.currentInstruction;
21 DBGAPP ("doAppendCycleRTCDOperandFetch(Entry) thisCycle=RTCD_OPERAND_FETCH\r\n");
22 DBGAPP ("doAppendCycleRTCDOperandFetch(Entry) lastCycle=%s\r\n", str_pct (cpu.apu.lastCycle));
23 DBGAPP ("doAppendCycleRTCDOperandFetch(Entry) CA %06o\r\n", cpu.TPR.CA);
24 DBGAPP ("doAppendCycleRTCDOperandFetch(Entry) n=%2u\r\n", nWords);
25 DBGAPP ("doAppendCycleRTCDOperandFetch(Entry) PPR.PRR=%o PPR.PSR=%05o\r\n", cpu.PPR.PRR, cpu.PPR.PSR);
26 DBGAPP ("doAppendCycleRTCDOperandFetch(Entry) TPR.TRR=%o TPR.TSR=%05o\r\n", cpu.TPR.TRR, cpu.TPR.TSR);
27
28 if (i->b29) {
29 DBGAPP ("doAppendCycleRTCDOperandFetch(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 = RTCD_OPERAND_FETCH;
48
49 DBGAPP ("doAppendCycleRTCDOperandFetch(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
76
77
78
79
80
81
82
83
84
85 if (get_addr_mode(cpup) == ABSOLUTE_mode && ! (cpu.cu.XSF || cpu.currentInstruction.b29)) {
86 cpu.TPR.TSR = 0;
87 DBGAPP ("RTCD_OPERAND_FETCH ABSOLUTE mode set TSR %05o TRR %o\r\n", cpu.TPR.TSR, cpu.TPR.TRR);
88 }
89
90 goto A;
91
92
93
94
95
96
97
98
99
100
101
102 A:;
103
104
105 PNL (cpu.APUMemAddr = cpu.TPR.CA;)
106
107 DBGAPP ("doAppendCycleRTCDOperandFetch(A)\r\n");
108
109
110 if (nomatch || ! fetch_sdw_from_sdwam (cpup, cpu.TPR.TSR)) {
111
112 DBGAPP ("doAppendCycleRTCDOperandFetch(A):SDW for segment %05o not in SDWAM\r\n", cpu.TPR.TSR);
113 DBGAPP ("doAppendCycleRTCDOperandFetch(A):DSBR.U=%o\r\n", cpu.DSBR.U);
114
115 if (cpu.DSBR.U == 0) {
116 fetch_dsptw (cpup, cpu.TPR.TSR);
117
118 if (! cpu.PTW0.DF)
119 doFault (FAULT_DF0 + cpu.PTW0.FC, fst_zero, "doAppendCycleRTCDOperandFetch(A): PTW0.F == 0");
120
121 if (! cpu.PTW0.U)
122 modify_dsptw (cpup, cpu.TPR.TSR);
123
124 fetch_psdw (cpup, cpu.TPR.TSR);
125 } else
126 fetch_nsdw (cpup, cpu.TPR.TSR);
127
128 if (cpu.SDW0.DF == 0) {
129 DBGAPP ("doAppendCycleRTCDOperandFetch(A): SDW0.F == 0! " "Initiating directed fault\r\n");
130
131 doFault (FAULT_DF0 + cpu.SDW0.FC, fst_zero, "SDW0.F == 0");
132 }
133
134 load_sdwam (cpup, cpu.TPR.TSR, nomatch);
135 }
136 DBGAPP ("doAppendCycleRTCDOperandFetch(A) R1 %o R2 %o R3 %o E %o\r\n", cpu.SDW->R1, cpu.SDW->R2, cpu.SDW->R3, cpu.SDW->E);
137
138
139 cpu.RSDWH_R1 = cpu.SDW->R1;
140
141
142
143
144
145
146
147
148
149
150
151 DBGAPP ("doAppendCycleRTCDOperandFetch(B)\r\n");
152
153
154
155
156 if (! (cpu.SDW->R1 <= cpu.SDW->R2 && cpu.SDW->R2 <= cpu.SDW->R3)) {
157
158 cpu.acvFaults |= ACV0;
159 PNL (L68_ (cpu.apu.state |= apu_FLT;))
160 FMSG (acvFaultsMsg = "acvFaults(B) C(SDW.R1) <= C(SDW.R2) <= C(SDW .R3)";)
161 }
162
163 if (lastCycle == RTCD_OPERAND_FETCH)
164 sim_warn ("%s: lastCycle == RTCD_OPERAND_FETCH opcode %0#o\r\n", __func__, i->opcode);
165
166
167
168
169
170
171
172
173
174
175 DBGAPP ("doAppendCycleRTCDOperandFetch(B):!STR-OP\r\n");
176
177
178
179 if (cpu.TPR.TRR > cpu.SDW->R2) {
180 DBGAPP ("ACV3\r\n");
181 DBGAPP ("doAppendCycleRTCDOperandFetch(B) ACV3\r\n");
182
183 cpu.acvFaults |= ACV3;
184 PNL (L68_ (cpu.apu.state |= apu_FLT;))
185 FMSG (acvFaultsMsg = "acvFaults(B) C(TPR.TRR) > C(SDW .R2)";)
186 }
187
188 if (cpu.SDW->R == 0) {
189
190 cpu.TPR.TRR = cpu.PPR.PRR;
191
192
193 if (cpu.PPR.PSR != cpu.TPR.TSR) {
194 DBGAPP ("ACV4\r\n");
195 DBGAPP ("doAppendCycleRTCDOperandFetch(B) ACV4\r\n");
196
197 cpu.acvFaults |= ACV4;
198 PNL (L68_ (cpu.apu.state |= apu_FLT;))
199 FMSG (acvFaultsMsg = "acvFaults(B) C(PPR.PSR) = C(TPR.TSR)";)
200
201
202 }
203 }
204
205 goto G;
206
207
208
209
210
211
212
213 G:;
214
215 DBGAPP ("doAppendCycleRTCDOperandFetch(G)\r\n");
216
217
218 if (((cpu.TPR.CA >> 4) & 037777) > cpu.SDW->BOUND) {
219 DBGAPP ("ACV15\r\n");
220 DBGAPP ("doAppendCycleRTCDOperandFetch(G) ACV15\r\n");
221 cpu.acvFaults |= ACV15;
222 PNL (L68_ (cpu.apu.state |= apu_FLT;))
223 FMSG (acvFaultsMsg = "acvFaults(G) C(TPR.CA)0,13 > SDW.BOUND";)
224 DBGAPP ("acvFaults(G) C(TPR.CA)0,13 > SDW.BOUND\r\n" " CA %06o CA>>4 & 037777 %06o SDW->BOUND %06o",
225 cpu.TPR.CA, ((cpu.TPR.CA >> 4) & 037777), cpu.SDW->BOUND);
226 }
227
228 if (cpu.acvFaults) {
229 DBGAPP ("doAppendCycleRTCDOperandFetch(G) acvFaults\r\n");
230 PNL (L68_ (cpu.apu.state |= apu_FLT;))
231
232 doFault (FAULT_ACV, (_fault_subtype) {.fault_acv_subtype=cpu.acvFaults}, "ACV fault");
233 }
234
235
236 if (cpu.SDW->U)
237 goto H;
238
239
240
241
242 DBGAPP ("doAppendCycleRTCDOperandFetch(G) CA %06o\r\n", cpu.TPR.CA);
243 if (nomatch || ! fetch_ptw_from_ptwam (cpup, cpu.SDW->POINTER, cpu.TPR.CA)) {
244 fetch_ptw (cpup, cpu.SDW, cpu.TPR.CA);
245 if (! cpu.PTW0.DF) {
246
247 doFault (FAULT_DF0 + cpu.PTW0.FC, (_fault_subtype) {.bits=0}, "PTW0.F == 0");
248 }
249 loadPTWAM (cpup, cpu.SDW->POINTER, cpu.TPR.CA, nomatch);
250 }
251
252
253
254
255
256
257 if (i->opcodeX && ((i->opcode & 0770)== 0200|| (i->opcode & 0770) == 0220
258 || (i->opcode & 0770)== 020|| (i->opcode & 0770) == 0300)) {
259 do_ptw2 (cpup, cpu.SDW, cpu.TPR.CA);
260 }
261 goto I;
262
263
264
265
266
267
268
269 H:;
270 DBGAPP ("doAppendCycleRTCDOperandFetch(H): FANP\r\n");
271
272 PNL (L68_ (cpu.apu.state |= apu_FANP;))
273
274
275
276
277
278
279
280 set_apu_status (cpup, apuStatus_FANP);
281
282 DBGAPP ("doAppendCycleRTCDOperandFetch(H): SDW->ADDR=%08o CA=%06o\r\n", cpu.SDW->ADDR, cpu.TPR.CA);
283
284 if (get_addr_mode (cpup) == ABSOLUTE_mode && ! (cpu.cu.XSF || cpu.currentInstruction.b29)) {
285 finalAddress = cpu.TPR.CA;
286 } else {
287 finalAddress = (cpu.SDW->ADDR & 077777760) + cpu.TPR.CA;
288 finalAddress &= 0xffffff;
289 }
290 PNL (cpu.APUMemAddr = finalAddress;)
291
292 DBGAPP ("doAppendCycleRTCDOperandFetch(H:FANP): (%05o:%06o) finalAddress=%08o\r\n", cpu.TPR.TSR, cpu.TPR.CA, finalAddress);
293
294 goto HI;
295
296 I:;
297
298
299
300 DBGAPP ("doAppendCycleRTCDOperandFetch(I): FAP\r\n");
301
302
303 set_apu_status (cpup, apuStatus_FAP);
304 PNL (L68_ (cpu.apu.state |= apu_FAP;))
305
306 word24 y2 = cpu.TPR.CA % 1024;
307
308
309
310 finalAddress = (((word24)cpu.PTW->ADDR & 0777760) << 6) + y2;
311 finalAddress &= 0xffffff;
312 PNL (cpu.APUMemAddr = finalAddress;)
313
314 L68_ (
315 if (cpu.MR_cache.emr && cpu.MR_cache.ihr)
316 add_l68_APU_history (cpup, APUH_FAP);
317 )
318
319 DBGAPP ("doAppendCycleRTCDOperandFetch(H:FAP): (%05o:%06o) finalAddress=%08o\r\n", cpu.TPR.TSR, cpu.TPR.CA, finalAddress);
320
321 goto HI;
322
323 HI:
324 DBGAPP ("doAppendCycleRTCDOperandFetch(HI)\r\n");
325
326
327 cpu.cu.XSF = 1;
328 if (full)
329 cpu.xsfScu = true;
330 sim_debug (DBG_TRACEEXT, & cpu_dev, "loading of cpu.TPR.TSR sets XSF to 1\r\n");
331
332 if (full)
333 cache_readN (cpup, finalAddress, data, nWords, "RTCD_OPERAND_FETCH");
334 else
335 core_readN_fast (cpup, finalAddress, data, nWords, "RTCD_OPERAND_FETCH");
336
337 goto K;
338
339
340
341
342
343
344
345 K:;
346 DBGAPP ("doAppendCycleRTCDOperandFetch(K)\r\n");
347
348 word3 y = GET_ITS_RN (data);
349
350
351
352 cpu.TPR.TSR = GET_ITS_SEGNO (data);
353
354
355
356
357 cpu.PPR.PRR = cpu.TPR.TRR = max3 (y, cpu.TPR.TRR, cpu.RSDWH_R1);
358
359
360
361 cpu.TPR.CA = GET_ITS_WORDNO (data);
362
363
364
365
366
367
368 DBGAPP ("doAppendCycleRTCDOperandFetch(KL)\r\n");
369
370
371 cpu.PPR.PSR = cpu.TPR.TSR;
372
373 cpu.PPR.IC = cpu.TPR.CA;
374
375 goto M;
376
377 M:
378 DBGAPP ("doAppendCycleRTCDOperandFetch(M)\r\n");
379
380
381 if (cpu.TPR.TRR == 0) {
382
383 cpu.PPR.P = cpu.SDW->P;
384 } else {
385
386 cpu.PPR.P = 0;
387 }
388
389
390
391 PNL (cpu.APUDataBusOffset = cpu.TPR.CA;)
392 PNL (cpu.APUDataBusAddr = finalAddress;)
393
394 PNL (L68_ (cpu.apu.state |= apu_FA;))
395
396 DBGAPP ("doAppendCycleRTCDOperandFetch (Exit) PRR %o PSR %05o P %o IC %06o\r\n",
397 cpu.PPR.PRR, cpu.PPR.PSR, cpu.PPR.P, cpu.PPR.IC);
398 DBGAPP ("doAppendCycleRTCDOperandFetch (Exit) TRR %o TSR %05o TBR %02o CA %06o\r\n",
399 cpu.TPR.TRR, cpu.TPR.TSR, cpu.TPR.TBR, cpu.TPR.CA);
400
401 return finalAddress;
402 }