This source file includes following definitions.
- doAppendCycleAPUDataRead_
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 static ALWAYS_INLINE word24 doAppendCycleAPUDataRead_ (cpu_state_t * cpup, word36 * data, uint nWords, const bool full) {
20 DCDstruct * i = & cpu.currentInstruction;
21 DBGAPP ("doAppendCycleAPUDataRead(Entry) thisCycle=APU_DATA_READ\r\n");
22 DBGAPP ("doAppendCycleAPUDataRead(Entry) lastCycle=%s\r\n", str_pct (cpu.apu.lastCycle));
23 DBGAPP ("doAppendCycleAPUDataRead(Entry) CA %06o\r\n", cpu.TPR.CA);
24 DBGAPP ("doAppendCycleAPUDataRead(Entry) n=%2u\r\n", nWords);
25 DBGAPP ("doAppendCycleAPUDataRead(Entry) PPR.PRR=%o PPR.PSR=%05o\r\n", cpu.PPR.PRR, cpu.PPR.PSR);
26 DBGAPP ("doAppendCycleAPUDataRead(Entry) TPR.TRR=%o TPR.TSR=%05o\r\n", cpu.TPR.TRR, cpu.TPR.TSR);
27
28 if (i->b29) {
29 DBGAPP ("doAppendCycleAPUDataRead(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 = APU_DATA_READ;
48
49 DBGAPP ("doAppendCycleAPUDataRead(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 ("doAppendCycleAPUDataRead(A)\r\n");
78
79
80 if (nomatch || ! fetch_sdw_from_sdwam (cpup, cpu.TPR.TSR)) {
81
82 DBGAPP ("doAppendCycleAPUDataRead(A):SDW for segment %05o not in SDWAM\r\n", cpu.TPR.TSR);
83
84 DBGAPP ("doAppendCycleAPUDataRead(A):DSBR.U=%o\r\n", cpu.DSBR.U);
85
86 if (cpu.DSBR.U == 0) {
87 fetch_dsptw (cpup, cpu.TPR.TSR);
88
89 if (! cpu.PTW0.DF)
90 doFault (FAULT_DF0 + cpu.PTW0.FC, fst_zero, "doAppendCycleAPUDataRead(A): PTW0.F == 0");
91
92 if (! cpu.PTW0.U)
93 modify_dsptw (cpup, cpu.TPR.TSR);
94
95 fetch_psdw (cpup, cpu.TPR.TSR);
96 } else
97 fetch_nsdw (cpup, cpu.TPR.TSR);
98
99 if (cpu.SDW0.DF == 0) {
100 DBGAPP ("doAppendCycleAPUDataRead(A): SDW0.F == 0! " "Initiating directed fault\r\n");
101
102 doFault (FAULT_DF0 + cpu.SDW0.FC, fst_zero, "SDW0.F == 0");
103 }
104
105 load_sdwam (cpup, cpu.TPR.TSR, nomatch);
106 }
107 DBGAPP ("doAppendCycleAPUDataRead(A) R1 %o R2 %o R3 %o E %o\r\n", cpu.SDW->R1, cpu.SDW->R2, cpu.SDW->R3, cpu.SDW->E);
108
109
110 cpu.RSDWH_R1 = cpu.SDW->R1;
111
112
113
114
115
116
117
118
119
120
121
122 DBGAPP ("doAppendCycleAPUDataRead(B)\r\n");
123
124
125
126
127 if (! (cpu.SDW->R1 <= cpu.SDW->R2 && cpu.SDW->R2 <= cpu.SDW->R3)) {
128
129 cpu.acvFaults |= ACV0;
130 PNL (L68_ (cpu.apu.state |= apu_FLT;))
131 FMSG (acvFaultsMsg = "acvFaults(B) C(SDW.R1) <= C(SDW.R2) <= " "C(SDW .R3)";)
132 }
133
134 if (lastCycle == RTCD_OPERAND_FETCH)
135 sim_warn ("%s: lastCycle == RTCD_OPERAND_FETCH opcode %0#o\r\n", __func__, i->opcode);
136
137
138
139
140
141
142
143
144
145
146 DBGAPP ("doAppendCycleAPUDataRead(B):!STR-OP\r\n");
147
148
149
150 if (cpu.TPR.TRR > cpu.SDW->R2) {
151 DBGAPP ("ACV3\r\n");
152 DBGAPP ("doAppendCycleAPUDataRead(B) ACV3\r\n");
153
154 cpu.acvFaults |= ACV3;
155 PNL (L68_ (cpu.apu.state |= apu_FLT;))
156 FMSG (acvFaultsMsg = "acvFaults(B) C(TPR.TRR) > C(SDW .R2)";)
157 }
158
159 if (cpu.SDW->R == 0) {
160
161 cpu.TPR.TRR = cpu.PPR.PRR;
162
163
164 if (cpu.PPR.PSR != cpu.TPR.TSR) {
165 DBGAPP ("ACV4\r\n");
166 DBGAPP ("doAppendCycleAPUDataRead(B) ACV4\r\n");
167
168 cpu.acvFaults |= ACV4;
169 PNL (L68_ (cpu.apu.state |= apu_FLT;))
170 FMSG (acvFaultsMsg = "acvFaults(B) C(PPR.PSR) = C(TPR.TSR)";)
171
172
173 }
174 }
175
176
177
178
179
180
181
182 DBGAPP ("doAppendCycleAPUDataRead(G)\r\n");
183
184
185 if (((cpu.TPR.CA >> 4) & 037777) > cpu.SDW->BOUND) {
186 DBGAPP ("ACV15\r\n");
187 DBGAPP ("doAppendCycleAPUDataRead(G) ACV15\r\n");
188 cpu.acvFaults |= ACV15;
189 PNL (L68_ (cpu.apu.state |= apu_FLT;))
190 FMSG (acvFaultsMsg = "acvFaults(G) C(TPR.CA)0,13 > SDW.BOUND";)
191 DBGAPP ("acvFaults(G) C(TPR.CA)0,13 > SDW.BOUND\r\n" " CA %06o CA>>4 & 037777 %06o SDW->BOUND %06o",
192 cpu.TPR.CA, ((cpu.TPR.CA >> 4) & 037777), cpu.SDW->BOUND);
193 }
194
195 if (cpu.acvFaults) {
196 DBGAPP ("doAppendCycleAPUDataRead(G) acvFaults\r\n");
197 PNL (L68_ (cpu.apu.state |= apu_FLT;))
198
199 doFault (FAULT_ACV, (_fault_subtype) {.fault_acv_subtype=cpu.acvFaults}, "ACV fault");
200 }
201
202
203 if (cpu.SDW->U)
204 goto H;
205
206
207
208
209 DBGAPP ("doAppendCycleAPUDataRead(G) CA %06o\r\n", cpu.TPR.CA);
210 if (nomatch || ! fetch_ptw_from_ptwam (cpup, cpu.SDW->POINTER, cpu.TPR.CA)) {
211 fetch_ptw (cpup, cpu.SDW, cpu.TPR.CA);
212 if (! cpu.PTW0.DF)
213
214 doFault (FAULT_DF0 + cpu.PTW0.FC, (_fault_subtype) {.bits=0}, "PTW0.F == 0");
215 loadPTWAM (cpup, cpu.SDW->POINTER, cpu.TPR.CA, nomatch);
216 }
217
218
219
220
221
222
223 if (i->opcodeX && ((i->opcode & 0770)== 0200 || (i->opcode & 0770) == 0220 || \
224 (i->opcode & 0770)== 020 || (i->opcode & 0770) == 0300)) {
225 do_ptw2 (cpup, cpu.SDW, cpu.TPR.CA);
226 }
227 goto I;
228
229
230
231
232
233
234
235 H:;
236 DBGAPP ("doAppendCycleAPUDataRead(H): FANP\r\n");
237
238 PNL (L68_ (cpu.apu.state |= apu_FANP;))
239
240
241
242
243
244
245
246
247 set_apu_status (cpup, apuStatus_FANP);
248
249 DBGAPP ("doAppendCycleAPUDataRead(H): SDW->ADDR=%08o CA=%06o\r\n", cpu.SDW->ADDR, cpu.TPR.CA);
250
251 finalAddress = (cpu.SDW->ADDR & 077777760) + cpu.TPR.CA;
252 finalAddress &= 0xffffff;
253 PNL (cpu.APUMemAddr = finalAddress;)
254
255 DBGAPP ("doAppendCycleAPUDataRead(H:FANP): (%05o:%06o) finalAddress=%08o\r\n", cpu.TPR.TSR, cpu.TPR.CA, finalAddress);
256
257 goto HI;
258
259 I:;
260
261
262
263 DBGAPP ("doAppendCycleAPUDataRead(I): FAP\r\n");
264
265
266 set_apu_status (cpup, apuStatus_FAP);
267 PNL (L68_ (cpu.apu.state |= apu_FAP;))
268
269 word24 y2 = cpu.TPR.CA % 1024;
270
271
272
273 finalAddress = (((word24)cpu.PTW->ADDR & 0777760) << 6) + y2;
274 finalAddress &= 0xffffff;
275 PNL (cpu.APUMemAddr = finalAddress;)
276
277 L68_ (
278 if (cpu.MR_cache.emr && cpu.MR_cache.ihr)
279 add_l68_APU_history (cpup, APUH_FAP);
280 )
281
282 DBGAPP ("doAppendCycleAPUDataRead(H:FAP): (%05o:%06o) finalAddress=%08o\r\n", cpu.TPR.TSR, cpu.TPR.CA, finalAddress);
283
284 HI:
285 DBGAPP ("doAppendCycleAPUDataRead(HI)\r\n");
286
287
288 cpu.cu.XSF = 1;
289 if (full)
290 cpu.xsfScu = true;
291 sim_debug (DBG_TRACEEXT, & cpu_dev, "loading of cpu.TPR.TSR sets XSF to 1\r\n");
292
293 if (full)
294 cache_readN (cpup, finalAddress, data, nWords, "APU_DATA_READ");
295 else
296 core_readN_fast (cpup, finalAddress, data, nWords, "APU_DATA_READ");
297
298
299
300 PNL (cpu.APUDataBusOffset = cpu.TPR.CA;)
301 PNL (cpu.APUDataBusAddr = finalAddress;)
302
303 PNL (L68_ (cpu.apu.state |= apu_FA;))
304
305 DBGAPP ("doAppendCycleAPUDataRead (Exit) PRR %o PSR %05o P %o IC %06o\r\n", cpu.PPR.PRR, cpu.PPR.PSR, cpu.PPR.P, cpu.PPR.IC);
306 DBGAPP ("doAppendCycleAPUDataRead (Exit) TRR %o TSR %05o TBR %02o CA %06o\r\n", cpu.TPR.TRR, cpu.TPR.TSR, cpu.TPR.TBR, cpu.TPR.CA);
307
308 return finalAddress;
309 }