This source file includes following definitions.
- doAppendCycleIndirectWordFetch_
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55 static ALWAYS_INLINE word24 doAppendCycleIndirectWordFetch_ (cpu_state_t * cpup, word36 * data, uint nWords, const bool full) {
56 DCDstruct * i = & cpu.currentInstruction;
57 DBGAPP ("doAppendCycleIndirectWordFetch(Entry) thisCycle=INDIRECT_WORD_FETCH\r\n");
58 DBGAPP ("doAppendCycleIndirectWordFetch(Entry) lastCycle=%s\r\n", str_pct (cpu.apu.lastCycle));
59 DBGAPP ("doAppendCycleIndirectWordFetch(Entry) CA %06o\r\n", cpu.TPR.CA);
60 DBGAPP ("doAppendCycleIndirectWordFetch(Entry) n=%2u\r\n", nWords);
61 DBGAPP ("doAppendCycleIndirectWordFetch(Entry) PPR.PRR=%o PPR.PSR=%05o\r\n", cpu.PPR.PRR, cpu.PPR.PSR);
62 DBGAPP ("doAppendCycleIndirectWordFetch(Entry) TPR.TRR=%o TPR.TSR=%05o\r\n", cpu.TPR.TRR, cpu.TPR.TSR);
63
64 if (i->b29) {
65 DBGAPP ("doAppendCycleIndirectWordFetch(Entry) isb29 PRNO %o\r\n", GET_PRN (IWB_IRODD));
66 }
67
68 uint this = UC_INDIRECT_WORD_FETCH;
69
70 word24 finalAddress = 0;
71 word24 pageAddress = 0;
72 word3 RSDWH_R1 = 0;
73 word14 bound = 0;
74 word1 p = 0;
75 bool paged = false;
76
77
78 #undef IDWF_CACHE
79
80 #if defined(IDWF_CACHE)
81
82
83
84
85
86
87
88 if (i->opcodeX && ((i->opcode & 0770)== 0200|| (i->opcode & 0770) == 0220
89 || (i->opcode & 0770)== 020|| (i->opcode & 0770) == 0300)) {
90
91 goto skip_ucache;
92 }
93
94
95 if (! ucCacheCheck (this, cpu.TPR.TSR, cpu.TPR.CA, & bound, & p, & pageAddress, & RSDWH_R1, & paged))
96 goto miss_ucache;
97
98 if (paged) {
99 finalAddress = pageAddress + (cpu.TPR.CA & OS18MASK);
100 } else {
101 finalAddress = pageAddress + cpu.TPR.CA;
102 }
103 cpu.RSDWH_R1 = RSDWH_R1;
104
105
106 if (full)
107 set_apu_status (cpup, paged ? apuStatus_FAP : apuStatus_FANP);
108 cpu.apu.lastCycle = INDIRECT_WORD_FETCH;
109 goto HI;
110
111 skip_ucache:;
112 # if defined(UCACHE_STATS)
113 cpu.uCache.skips[this] ++;
114 # endif
115
116 miss_ucache:;
117
118 #endif
119
120 bool nomatch = true;
121 if (cpu.tweaks.enable_wam) {
122
123
124
125
126
127 nomatch = ((i->opcode == 0232 || i->opcode == 0254 ||
128 i->opcode == 0154 || i->opcode == 0173) &&
129 i->opcodeX ) ||
130 ((i->opcode == 0557 || i->opcode == 0257) &&
131 ! i->opcodeX);
132 }
133
134 processor_cycle_type lastCycle = cpu.apu.lastCycle;
135 cpu.apu.lastCycle = INDIRECT_WORD_FETCH;
136
137 DBGAPP ("doAppendCycleIndirectWordFetch(Entry) XSF %o\r\n", cpu.cu.XSF);
138
139 PNL (L68_ (cpu.apu.state = 0;))
140
141 cpu.RSDWH_R1 = 0;
142
143 cpu.acvFaults = 0;
144
145
146 #define FMSG(x)
147 FMSG (char * acvFaultsMsg = "<unknown>";)
148
149
150
151
152
153
154
155
156 word3 n = 0;
157
158
159
160
161
162
163
164
165
166
167
168
169 PNL (cpu.APUMemAddr = cpu.TPR.CA;)
170
171 DBGAPP ("doAppendCycleIndirectWordFetch(A)\r\n");
172
173
174 if (nomatch || ! fetch_sdw_from_sdwam (cpup, cpu.TPR.TSR)) {
175
176 DBGAPP ("doAppendCycleIndirectWordFetch(A):SDW for segment %05o not in SDWAM\r\n", cpu.TPR.TSR);
177 DBGAPP ("doAppendCycleIndirectWordFetch(A):DSBR.U=%o\r\n", cpu.DSBR.U);
178
179 if (cpu.DSBR.U == 0) {
180 fetch_dsptw (cpup, cpu.TPR.TSR);
181
182 if (! cpu.PTW0.DF)
183 doFault (FAULT_DF0 + cpu.PTW0.FC, fst_zero, "doAppendCycleIndirectWordFetch(A): PTW0.F == 0");
184
185 if (! cpu.PTW0.U)
186 modify_dsptw (cpup, cpu.TPR.TSR);
187
188 fetch_psdw (cpup, cpu.TPR.TSR);
189 } else
190 fetch_nsdw (cpup, cpu.TPR.TSR);
191
192 if (cpu.SDW0.DF == 0) {
193 DBGAPP ("doAppendCycleIndirectWordFetch(A): SDW0.F == 0! " "Initiating directed fault\r\n");
194
195 doFault (FAULT_DF0 + cpu.SDW0.FC, fst_zero, "SDW0.F == 0");
196 }
197
198 load_sdwam (cpup, cpu.TPR.TSR, nomatch);
199 }
200 DBGAPP ("doAppendCycleIndirectWordFetch(A) R1 %o R2 %o R3 %o E %o\r\n", cpu.SDW->R1, cpu.SDW->R2, cpu.SDW->R3, cpu.SDW->E);
201
202
203 RSDWH_R1 = cpu.RSDWH_R1 = cpu.SDW->R1;
204
205
206
207
208
209
210
211
212
213
214
215 DBGAPP ("doAppendCycleIndirectWordFetch(B)\r\n");
216
217
218
219
220 if (! (cpu.SDW->R1 <= cpu.SDW->R2 && cpu.SDW->R2 <= cpu.SDW->R3)) {
221
222 cpu.acvFaults |= ACV0;
223 PNL (L68_ (cpu.apu.state |= apu_FLT;))
224 FMSG (acvFaultsMsg = "acvFaults(B) C(SDW.R1) <= C(SDW.R2) <= " "C(SDW .R3)";)
225 }
226
227
228
229
230
231
232
233 if (lastCycle == RTCD_OPERAND_FETCH)
234 sim_warn ("%s: lastCycle == RTCD_OPERAND_FETCH opcode %0#o\r\n", __func__, i->opcode);
235
236
237
238
239
240
241
242
243
244
245 DBGAPP ("doAppendCycleIndirectWordFetch(B):!STR-OP\r\n");
246
247
248
249 if (cpu.TPR.TRR > cpu.SDW->R2) {
250 DBGAPP ("ACV3\r\n");
251 DBGAPP ("doAppendCycleIndirectWordFetch(B) ACV3\r\n");
252
253 cpu.acvFaults |= ACV3;
254 PNL (L68_ (cpu.apu.state |= apu_FLT;))
255 FMSG (acvFaultsMsg = "acvFaults(B) C(TPR.TRR) > C(SDW .R2)";)
256 }
257
258 if (cpu.SDW->R == 0) {
259
260 cpu.TPR.TRR = cpu.PPR.PRR;
261
262
263 if (cpu.PPR.PSR != cpu.TPR.TSR) {
264 DBGAPP ("ACV4\r\n");
265 DBGAPP ("doAppendCycleIndirectWordFetch(B) ACV4\r\n");
266
267 cpu.acvFaults |= ACV4;
268 PNL (L68_ (cpu.apu.state |= apu_FLT;))
269 FMSG (acvFaultsMsg = "acvFaults(B) C(PPR.PSR) = C(TPR.TSR)";)
270
271
272
273 }
274 }
275
276
277
278
279
280
281
282
283
284
285
286 DBGAPP ("doAppendCycleIndirectWordFetch(G)\r\n");
287
288
289 if (((cpu.TPR.CA >> 4) & 037777) > cpu.SDW->BOUND) {
290 DBGAPP ("ACV15\r\n");
291 DBGAPP ("doAppendCycleIndirectWordFetch(G) ACV15\r\n");
292 cpu.acvFaults |= ACV15;
293 PNL (L68_ (cpu.apu.state |= apu_FLT;))
294 FMSG (acvFaultsMsg = "acvFaults(G) C(TPR.CA)0,13 > SDW.BOUND";)
295 DBGAPP ("acvFaults(G) C(TPR.CA)0,13 > SDW.BOUND\r\n" " CA %06o CA>>4 & 037777 %06o SDW->BOUND %06o",
296 cpu.TPR.CA, ((cpu.TPR.CA >> 4) & 037777), cpu.SDW->BOUND);
297 }
298 bound = cpu.SDW->BOUND;
299 p = cpu.SDW->P;
300
301 if (cpu.acvFaults) {
302 DBGAPP ("doAppendCycleIndirectWordFetch(G) acvFaults\r\n");
303 PNL (L68_ (cpu.apu.state |= apu_FLT;))
304
305 doFault (FAULT_ACV, (_fault_subtype) {.fault_acv_subtype=cpu.acvFaults}, "ACV fault");
306 }
307
308
309 if (cpu.SDW->U)
310 goto H;
311
312
313
314
315 DBGAPP ("doAppendCycleIndirectWordFetch(G) CA %06o\r\n", cpu.TPR.CA);
316 if (nomatch ||
317 ! fetch_ptw_from_ptwam (cpup, cpu.SDW->POINTER, cpu.TPR.CA)) {
318 fetch_ptw (cpup, cpu.SDW, cpu.TPR.CA);
319 if (! cpu.PTW0.DF) {
320
321 doFault (FAULT_DF0 + cpu.PTW0.FC, (_fault_subtype) {.bits=0}, "PTW0.F == 0");
322 }
323 loadPTWAM (cpup, cpu.SDW->POINTER, cpu.TPR.CA, nomatch);
324 }
325
326
327
328
329
330
331 if (i->opcodeX && ((i->opcode & 0770)== 0200|| (i->opcode & 0770) == 0220
332 || (i->opcode & 0770)== 020|| (i->opcode & 0770) == 0300)) {
333 do_ptw2 (cpup, cpu.SDW, cpu.TPR.CA);
334 }
335 goto I;
336
337
338
339
340
341
342
343 H:;
344 DBGAPP ("doAppendCycleIndirectWordFetch(H): FANP\r\n");
345
346 paged = false;
347
348 PNL (L68_ (cpu.apu.state |= apu_FANP;))
349
350
351
352
353
354
355
356
357 set_apu_status (cpup, apuStatus_FANP);
358
359 DBGAPP ("doAppendCycleIndirectWordFetch(H): SDW->ADDR=%08o CA=%06o \r\n", cpu.SDW->ADDR, cpu.TPR.CA);
360
361 pageAddress = (cpu.SDW->ADDR & 077777760);
362 finalAddress = (cpu.SDW->ADDR & 077777760) + cpu.TPR.CA;
363 finalAddress &= 0xffffff;
364 PNL (cpu.APUMemAddr = finalAddress;)
365
366 DBGAPP ("doAppendCycleIndirectWordFetch(H:FANP): (%05o:%06o) finalAddress=%08o\r\n", cpu.TPR.TSR, cpu.TPR.CA, finalAddress);
367
368 goto HI;
369
370 I:;
371
372
373
374 DBGAPP ("doAppendCycleIndirectWordFetch(I): FAP\r\n");
375
376 paged = true;
377
378
379 set_apu_status (cpup, apuStatus_FAP);
380 PNL (L68_ (cpu.apu.state |= apu_FAP;))
381
382 word24 y2 = cpu.TPR.CA % 1024;
383
384 pageAddress = (((word24)cpu.PTW->ADDR & 0777760) << 6);
385
386
387 finalAddress = (((word24)cpu.PTW->ADDR & 0777760) << 6) + y2;
388 finalAddress &= 0xffffff;
389 PNL (cpu.APUMemAddr = finalAddress;)
390
391 L68_ (
392 if (cpu.MR_cache.emr && cpu.MR_cache.ihr)
393 add_l68_APU_history (cpup, APUH_FAP);
394 )
395
396 DBGAPP ("doAppendCycleIndirectWordFetch(H:FAP): (%05o:%06o) finalAddress=%08o\r\n", cpu.TPR.TSR, cpu.TPR.CA, finalAddress);
397
398
399
400 HI:
401 DBGAPP ("doAppendCycleIndirectWordFetch(HI)\r\n");
402
403 ucCacheSave (cpup, this, cpu.TPR.TSR, cpu.TPR.CA, bound, p, pageAddress, RSDWH_R1, paged);
404
405
406 cpu.cu.XSF = 1;
407 if (full)
408 cpu.xsfScu = true;
409 sim_debug (DBG_TRACEEXT, & cpu_dev, "loading of cpu.TPR.TSR sets XSF to 1\r\n");
410
411 if (full)
412 cache_readN (cpup, finalAddress, data, nWords, "INDIRECT_WORD_FETCH");
413 else
414 core_readN_fast (cpup, finalAddress, data, nWords, "INDIRECT_WORD_FETCH");
415
416
417
418
419
420
421
422
423
424 DBGAPP ("doAppendCycleIndirectWordFetch(J)\r\n");
425
426
427 word6 tag = GET_TAG (IWB_IRODD);
428 if ((GET_TM (tag) == TM_IR || GET_TM (tag) == TM_RI) && (cpu.TPR.CA & 1) == 0) {
429 if (ISITS (* data))
430 goto O;
431 if (ISITP (* data))
432 goto P;
433 }
434
435 goto Exit;
436
437
438
439
440
441
442
443 O:;
444 DBGAPP ("doAppendCycleIndirectWordFetch(O)\r\n");
445 word3 its_RNR = GET_ITS_RN (data);
446 DBGAPP ("doAppendCycleIndirectWordFetch(O) TRR %o RSDWH.R1 %o ITS.RNR %o\r\n",
447 cpu.TPR.TRR, cpu.RSDWH_R1, its_RNR);
448
449
450
451 cpu.TPR.TRR = max3 (its_RNR, cpu.TPR.TRR, cpu.RSDWH_R1);
452 DBGAPP ("doAppendCycleIndirectWordFetch(O) Set TRR to %o\r\n", cpu.TPR.TRR);
453
454 goto Exit;
455
456 P:;
457
458 DBGAPP ("doAppendCycleIndirectWordFetch(P)\r\n");
459
460 n = GET_ITP_PRNUM (data);
461 DBGAPP ("doAppendCycleIndirectWordFetch(P) TRR %o RSDWH.R1 %o PR[n].RNR %o\r\n",
462 cpu.TPR.TRR, cpu.RSDWH_R1, cpu.PR[n].RNR);
463
464
465
466 cpu.TPR.TRR = max3 (cpu.PR[n].RNR, cpu.TPR.TRR, cpu.RSDWH_R1);
467 DBGAPP ("doAppendCycleIndirectWordFetch(P) Set TRR to %o\r\n", cpu.TPR.TRR);
468
469 goto Exit;
470
471 Exit:;
472
473 PNL (cpu.APUDataBusOffset = cpu.TPR.CA;)
474 PNL (cpu.APUDataBusAddr = finalAddress;)
475
476 PNL (L68_ (cpu.apu.state |= apu_FA;))
477
478 DBGAPP ("doAppendCycleIndirectWordFetch (Exit) PRR %o PSR %05o P %o IC %06o\r\n",
479 cpu.PPR.PRR, cpu.PPR.PSR, cpu.PPR.P, cpu.PPR.IC);
480 DBGAPP ("doAppendCycleIndirectWordFetch (Exit) TRR %o TSR %05o TBR %02o CA %06o\r\n",
481 cpu.TPR.TRR, cpu.TPR.TSR, cpu.TPR.TBR, cpu.TPR.CA);
482
483 return finalAddress;
484 }