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