OpenCores
URL https://opencores.org/ocsvn/a-z80/a-z80/trunk

Subversion Repositories a-z80

[/] [a-z80/] [trunk/] [cpu/] [toplevel/] [test_fuse.vh] - Blame information for rev 13

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 6 gdevic
// Automatically generated by genfuse.py
2
 
3 8 gdevic
force dut.resets_.clrpc=0;
4 6 gdevic
force dut.reg_file_.reg_gp_we=0;
5
force dut.reg_control_.ctl_reg_sys_we=0;
6
force dut.z80_top_ifc_n.fpga_reset=1;
7 13 gdevic
#2 // Start test loop
8
 
9 8 gdevic
   force dut.ir_.ctl_ir_we=1;
10
   force dut.ir_.db=0;
11
#2 release dut.ir_.ctl_ir_we;
12
   release dut.ir_.db;
13 13 gdevic
   $fdisplay(f,"Testing opcode 00      NOP");
14 6 gdevic
   // Preset af
15
   force dut.reg_file_.b2v_latch_af_lo.we=1;
16
   force dut.reg_file_.b2v_latch_af_hi.we=1;
17
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
18
   force dut.reg_file_.b2v_latch_af_hi.db=8'h00;
19
#2 release dut.reg_file_.b2v_latch_af_lo.we;
20
   release dut.reg_file_.b2v_latch_af_hi.we;
21
   release dut.reg_file_.b2v_latch_af_lo.db;
22
   release dut.reg_file_.b2v_latch_af_hi.db;
23
   // Preset bc
24
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
25
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
26
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h00;
27
   force dut.reg_file_.b2v_latch_bc_hi.db=8'h00;
28
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
29
   release dut.reg_file_.b2v_latch_bc_hi.we;
30
   release dut.reg_file_.b2v_latch_bc_lo.db;
31
   release dut.reg_file_.b2v_latch_bc_hi.db;
32
   // Preset de
33
   force dut.reg_file_.b2v_latch_de_lo.we=1;
34
   force dut.reg_file_.b2v_latch_de_hi.we=1;
35
   force dut.reg_file_.b2v_latch_de_lo.db=8'h00;
36
   force dut.reg_file_.b2v_latch_de_hi.db=8'h00;
37
#2 release dut.reg_file_.b2v_latch_de_lo.we;
38
   release dut.reg_file_.b2v_latch_de_hi.we;
39
   release dut.reg_file_.b2v_latch_de_lo.db;
40
   release dut.reg_file_.b2v_latch_de_hi.db;
41
   // Preset hl
42
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
43
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
44
   force dut.reg_file_.b2v_latch_hl_lo.db=8'h00;
45
   force dut.reg_file_.b2v_latch_hl_hi.db=8'h00;
46
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
47
   release dut.reg_file_.b2v_latch_hl_hi.we;
48
   release dut.reg_file_.b2v_latch_hl_lo.db;
49
   release dut.reg_file_.b2v_latch_hl_hi.db;
50
   // Preset af2
51
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
52
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
53
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
54
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
55
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
56
   release dut.reg_file_.b2v_latch_af2_hi.we;
57
   release dut.reg_file_.b2v_latch_af2_lo.db;
58
   release dut.reg_file_.b2v_latch_af2_hi.db;
59
   // Preset bc2
60
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
61
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
62
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
63
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
64
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
65
   release dut.reg_file_.b2v_latch_bc2_hi.we;
66
   release dut.reg_file_.b2v_latch_bc2_lo.db;
67
   release dut.reg_file_.b2v_latch_bc2_hi.db;
68
   // Preset de2
69
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
70
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
71
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
72
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
73
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
74
   release dut.reg_file_.b2v_latch_de2_hi.we;
75
   release dut.reg_file_.b2v_latch_de2_lo.db;
76
   release dut.reg_file_.b2v_latch_de2_hi.db;
77
   // Preset hl2
78
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
79
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
80
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
81
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
82
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
83
   release dut.reg_file_.b2v_latch_hl2_hi.we;
84
   release dut.reg_file_.b2v_latch_hl2_lo.db;
85
   release dut.reg_file_.b2v_latch_hl2_hi.db;
86
   // Preset ix
87
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
88
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
89
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
90
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
91
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
92
   release dut.reg_file_.b2v_latch_ix_hi.we;
93
   release dut.reg_file_.b2v_latch_ix_lo.db;
94
   release dut.reg_file_.b2v_latch_ix_hi.db;
95
   // Preset iy
96
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
97
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
98
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
99
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
100
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
101
   release dut.reg_file_.b2v_latch_iy_hi.we;
102
   release dut.reg_file_.b2v_latch_iy_lo.db;
103
   release dut.reg_file_.b2v_latch_iy_hi.db;
104
   // Preset sp
105
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
106
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
107
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
108
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
109
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
110
   release dut.reg_file_.b2v_latch_sp_hi.we;
111
   release dut.reg_file_.b2v_latch_sp_lo.db;
112
   release dut.reg_file_.b2v_latch_sp_hi.db;
113
   // Preset wz
114
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
115
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
116
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
117
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
118
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
119
   release dut.reg_file_.b2v_latch_wz_hi.we;
120
   release dut.reg_file_.b2v_latch_wz_lo.db;
121
   release dut.reg_file_.b2v_latch_wz_hi.db;
122
   // Preset pc
123
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
124
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
125
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
126
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
127
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
128
   release dut.reg_file_.b2v_latch_pc_hi.we;
129
   release dut.reg_file_.b2v_latch_pc_lo.db;
130
   release dut.reg_file_.b2v_latch_pc_hi.db;
131
   // Preset ir
132
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
133
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
134
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
135
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
136
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
137
   release dut.reg_file_.b2v_latch_ir_hi.we;
138
   release dut.reg_file_.b2v_latch_ir_lo.db;
139
   release dut.reg_file_.b2v_latch_ir_hi.db;
140
   // Preset memory
141
   ram.Mem[0] = 8'h00;
142
   force dut.z80_top_ifc_n.fpga_reset=0;
143 8 gdevic
   force dut.address_latch_.Q=16'h0000;
144 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
145
   release dut.reg_file_.reg_gp_we;
146 13 gdevic
#2 // Execute: M1/T1 start
147
#1 release dut.address_latch_.Q;
148 6 gdevic
#1
149 13 gdevic
#6 // Wait for opcode end
150 6 gdevic
   force dut.reg_control_.ctl_reg_sys_we=0;
151
#2 pc=z.A;
152
#2
153
#1 force dut.reg_file_.reg_gp_we=0;
154
   force dut.z80_top_ifc_n.fpga_reset=1;
155
   if (dut.reg_file_.b2v_latch_af_lo.latch!==8'h00) $fdisplay(f,"* Reg af f=%h !=00",dut.reg_file_.b2v_latch_af_lo.latch);
156
   if (dut.reg_file_.b2v_latch_af_hi.latch!==8'h00) $fdisplay(f,"* Reg af a=%h !=00",dut.reg_file_.b2v_latch_af_hi.latch);
157
   if (dut.reg_file_.b2v_latch_bc_lo.latch!==8'h00) $fdisplay(f,"* Reg bc c=%h !=00",dut.reg_file_.b2v_latch_bc_lo.latch);
158
   if (dut.reg_file_.b2v_latch_bc_hi.latch!==8'h00) $fdisplay(f,"* Reg bc b=%h !=00",dut.reg_file_.b2v_latch_bc_hi.latch);
159
   if (dut.reg_file_.b2v_latch_de_lo.latch!==8'h00) $fdisplay(f,"* Reg de e=%h !=00",dut.reg_file_.b2v_latch_de_lo.latch);
160
   if (dut.reg_file_.b2v_latch_de_hi.latch!==8'h00) $fdisplay(f,"* Reg de d=%h !=00",dut.reg_file_.b2v_latch_de_hi.latch);
161
   if (dut.reg_file_.b2v_latch_hl_lo.latch!==8'h00) $fdisplay(f,"* Reg hl l=%h !=00",dut.reg_file_.b2v_latch_hl_lo.latch);
162
   if (dut.reg_file_.b2v_latch_hl_hi.latch!==8'h00) $fdisplay(f,"* Reg hl h=%h !=00",dut.reg_file_.b2v_latch_hl_hi.latch);
163
   if (dut.reg_file_.b2v_latch_af2_lo.latch!==8'h00) $fdisplay(f,"* Reg af2 f=%h !=00",dut.reg_file_.b2v_latch_af2_lo.latch);
164
   if (dut.reg_file_.b2v_latch_af2_hi.latch!==8'h00) $fdisplay(f,"* Reg af2 a=%h !=00",dut.reg_file_.b2v_latch_af2_hi.latch);
165
   if (dut.reg_file_.b2v_latch_bc2_lo.latch!==8'h00) $fdisplay(f,"* Reg bc2 c=%h !=00",dut.reg_file_.b2v_latch_bc2_lo.latch);
166
   if (dut.reg_file_.b2v_latch_bc2_hi.latch!==8'h00) $fdisplay(f,"* Reg bc2 b=%h !=00",dut.reg_file_.b2v_latch_bc2_hi.latch);
167
   if (dut.reg_file_.b2v_latch_de2_lo.latch!==8'h00) $fdisplay(f,"* Reg de2 e=%h !=00",dut.reg_file_.b2v_latch_de2_lo.latch);
168
   if (dut.reg_file_.b2v_latch_de2_hi.latch!==8'h00) $fdisplay(f,"* Reg de2 d=%h !=00",dut.reg_file_.b2v_latch_de2_hi.latch);
169
   if (dut.reg_file_.b2v_latch_hl2_lo.latch!==8'h00) $fdisplay(f,"* Reg hl2 l=%h !=00",dut.reg_file_.b2v_latch_hl2_lo.latch);
170
   if (dut.reg_file_.b2v_latch_hl2_hi.latch!==8'h00) $fdisplay(f,"* Reg hl2 h=%h !=00",dut.reg_file_.b2v_latch_hl2_hi.latch);
171
   if (dut.reg_file_.b2v_latch_ix_lo.latch!==8'h00) $fdisplay(f,"* Reg ix x=%h !=00",dut.reg_file_.b2v_latch_ix_lo.latch);
172
   if (dut.reg_file_.b2v_latch_ix_hi.latch!==8'h00) $fdisplay(f,"* Reg ix i=%h !=00",dut.reg_file_.b2v_latch_ix_hi.latch);
173
   if (dut.reg_file_.b2v_latch_iy_lo.latch!==8'h00) $fdisplay(f,"* Reg iy y=%h !=00",dut.reg_file_.b2v_latch_iy_lo.latch);
174
   if (dut.reg_file_.b2v_latch_iy_hi.latch!==8'h00) $fdisplay(f,"* Reg iy i=%h !=00",dut.reg_file_.b2v_latch_iy_hi.latch);
175
   if (dut.reg_file_.b2v_latch_sp_lo.latch!==8'h00) $fdisplay(f,"* Reg sp p=%h !=00",dut.reg_file_.b2v_latch_sp_lo.latch);
176
   if (dut.reg_file_.b2v_latch_sp_hi.latch!==8'h00) $fdisplay(f,"* Reg sp s=%h !=00",dut.reg_file_.b2v_latch_sp_hi.latch);
177
   if (pc!==16'h0001) $fdisplay(f,"* PC=%h !=0001",pc);
178
   if (dut.reg_file_.b2v_latch_ir_lo.latch!==8'h01) $fdisplay(f,"* Reg ir r=%h !=01",dut.reg_file_.b2v_latch_ir_lo.latch);
179
   if (dut.reg_file_.b2v_latch_ir_hi.latch!==8'h00) $fdisplay(f,"* Reg ir i=%h !=00",dut.reg_file_.b2v_latch_ir_hi.latch);
180 13 gdevic
#1 // End opcode
181
 
182 8 gdevic
   force dut.ir_.ctl_ir_we=1;
183
   force dut.ir_.db=0;
184
#2 release dut.ir_.ctl_ir_we;
185
   release dut.ir_.db;
186 13 gdevic
   $fdisplay(f,"Testing opcode ed67    RRD");
187 6 gdevic
   // Preset af
188
   force dut.reg_file_.b2v_latch_af_lo.we=1;
189
   force dut.reg_file_.b2v_latch_af_hi.we=1;
190
   force dut.reg_file_.b2v_latch_af_lo.db=8'h24;
191
   force dut.reg_file_.b2v_latch_af_hi.db=8'h36;
192
#2 release dut.reg_file_.b2v_latch_af_lo.we;
193
   release dut.reg_file_.b2v_latch_af_hi.we;
194
   release dut.reg_file_.b2v_latch_af_lo.db;
195
   release dut.reg_file_.b2v_latch_af_hi.db;
196
   // Preset bc
197
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
198
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
199
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h6a;
200
   force dut.reg_file_.b2v_latch_bc_hi.db=8'hb1;
201
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
202
   release dut.reg_file_.b2v_latch_bc_hi.we;
203
   release dut.reg_file_.b2v_latch_bc_lo.db;
204
   release dut.reg_file_.b2v_latch_bc_hi.db;
205
   // Preset de
206
   force dut.reg_file_.b2v_latch_de_lo.we=1;
207
   force dut.reg_file_.b2v_latch_de_hi.we=1;
208
   force dut.reg_file_.b2v_latch_de_lo.db=8'hdb;
209
   force dut.reg_file_.b2v_latch_de_hi.db=8'ha4;
210
#2 release dut.reg_file_.b2v_latch_de_lo.we;
211
   release dut.reg_file_.b2v_latch_de_hi.we;
212
   release dut.reg_file_.b2v_latch_de_lo.db;
213
   release dut.reg_file_.b2v_latch_de_hi.db;
214
   // Preset hl
215
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
216
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
217
   force dut.reg_file_.b2v_latch_hl_lo.db=8'hde;
218
   force dut.reg_file_.b2v_latch_hl_hi.db=8'hb9;
219
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
220
   release dut.reg_file_.b2v_latch_hl_hi.we;
221
   release dut.reg_file_.b2v_latch_hl_lo.db;
222
   release dut.reg_file_.b2v_latch_hl_hi.db;
223
   // Preset af2
224
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
225
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
226
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
227
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
228
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
229
   release dut.reg_file_.b2v_latch_af2_hi.we;
230
   release dut.reg_file_.b2v_latch_af2_lo.db;
231
   release dut.reg_file_.b2v_latch_af2_hi.db;
232
   // Preset bc2
233
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
234
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
235
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
236
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
237
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
238
   release dut.reg_file_.b2v_latch_bc2_hi.we;
239
   release dut.reg_file_.b2v_latch_bc2_lo.db;
240
   release dut.reg_file_.b2v_latch_bc2_hi.db;
241
   // Preset de2
242
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
243
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
244
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
245
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
246
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
247
   release dut.reg_file_.b2v_latch_de2_hi.we;
248
   release dut.reg_file_.b2v_latch_de2_lo.db;
249
   release dut.reg_file_.b2v_latch_de2_hi.db;
250
   // Preset hl2
251
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
252
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
253
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
254
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
255
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
256
   release dut.reg_file_.b2v_latch_hl2_hi.we;
257
   release dut.reg_file_.b2v_latch_hl2_lo.db;
258
   release dut.reg_file_.b2v_latch_hl2_hi.db;
259
   // Preset ix
260
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
261
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
262
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
263
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
264
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
265
   release dut.reg_file_.b2v_latch_ix_hi.we;
266
   release dut.reg_file_.b2v_latch_ix_lo.db;
267
   release dut.reg_file_.b2v_latch_ix_hi.db;
268
   // Preset iy
269
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
270
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
271
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
272
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
273
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
274
   release dut.reg_file_.b2v_latch_iy_hi.we;
275
   release dut.reg_file_.b2v_latch_iy_lo.db;
276
   release dut.reg_file_.b2v_latch_iy_hi.db;
277
   // Preset sp
278
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
279
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
280
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
281
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
282
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
283
   release dut.reg_file_.b2v_latch_sp_hi.we;
284
   release dut.reg_file_.b2v_latch_sp_lo.db;
285
   release dut.reg_file_.b2v_latch_sp_hi.db;
286
   // Preset wz
287
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
288
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
289
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
290
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
291
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
292
   release dut.reg_file_.b2v_latch_wz_hi.we;
293
   release dut.reg_file_.b2v_latch_wz_lo.db;
294
   release dut.reg_file_.b2v_latch_wz_hi.db;
295
   // Preset pc
296
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
297
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
298
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
299
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
300
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
301
   release dut.reg_file_.b2v_latch_pc_hi.we;
302
   release dut.reg_file_.b2v_latch_pc_lo.db;
303
   release dut.reg_file_.b2v_latch_pc_hi.db;
304
   // Preset ir
305
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
306
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
307
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
308
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
309
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
310
   release dut.reg_file_.b2v_latch_ir_hi.we;
311
   release dut.reg_file_.b2v_latch_ir_lo.db;
312
   release dut.reg_file_.b2v_latch_ir_hi.db;
313
   // Preset memory
314
   ram.Mem[0] = 8'hed;
315
   ram.Mem[1] = 8'h67;
316
   // Preset memory
317
   ram.Mem[47582] = 8'h93;
318
   force dut.z80_top_ifc_n.fpga_reset=0;
319 8 gdevic
   force dut.address_latch_.Q=16'h0000;
320 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
321
   release dut.reg_file_.reg_gp_we;
322 13 gdevic
#2 // Execute: M1/T1 start
323
#1 release dut.address_latch_.Q;
324 6 gdevic
#1
325 13 gdevic
#34 // Wait for opcode end
326 6 gdevic
   force dut.reg_control_.ctl_reg_sys_we=0;
327
#2 pc=z.A;
328
#2
329
#1 force dut.reg_file_.reg_gp_we=0;
330
   force dut.z80_top_ifc_n.fpga_reset=1;
331
   if (dut.reg_file_.b2v_latch_af_lo.latch!==8'h24) $fdisplay(f,"* Reg af f=%h !=24",dut.reg_file_.b2v_latch_af_lo.latch);
332
   if (dut.reg_file_.b2v_latch_af_hi.latch!==8'h33) $fdisplay(f,"* Reg af a=%h !=33",dut.reg_file_.b2v_latch_af_hi.latch);
333
   if (dut.reg_file_.b2v_latch_bc_lo.latch!==8'h6a) $fdisplay(f,"* Reg bc c=%h !=6a",dut.reg_file_.b2v_latch_bc_lo.latch);
334
   if (dut.reg_file_.b2v_latch_bc_hi.latch!==8'hb1) $fdisplay(f,"* Reg bc b=%h !=b1",dut.reg_file_.b2v_latch_bc_hi.latch);
335
   if (dut.reg_file_.b2v_latch_de_lo.latch!==8'hdb) $fdisplay(f,"* Reg de e=%h !=db",dut.reg_file_.b2v_latch_de_lo.latch);
336
   if (dut.reg_file_.b2v_latch_de_hi.latch!==8'ha4) $fdisplay(f,"* Reg de d=%h !=a4",dut.reg_file_.b2v_latch_de_hi.latch);
337
   if (dut.reg_file_.b2v_latch_hl_lo.latch!==8'hde) $fdisplay(f,"* Reg hl l=%h !=de",dut.reg_file_.b2v_latch_hl_lo.latch);
338
   if (dut.reg_file_.b2v_latch_hl_hi.latch!==8'hb9) $fdisplay(f,"* Reg hl h=%h !=b9",dut.reg_file_.b2v_latch_hl_hi.latch);
339
   if (dut.reg_file_.b2v_latch_af2_lo.latch!==8'h00) $fdisplay(f,"* Reg af2 f=%h !=00",dut.reg_file_.b2v_latch_af2_lo.latch);
340
   if (dut.reg_file_.b2v_latch_af2_hi.latch!==8'h00) $fdisplay(f,"* Reg af2 a=%h !=00",dut.reg_file_.b2v_latch_af2_hi.latch);
341
   if (dut.reg_file_.b2v_latch_bc2_lo.latch!==8'h00) $fdisplay(f,"* Reg bc2 c=%h !=00",dut.reg_file_.b2v_latch_bc2_lo.latch);
342
   if (dut.reg_file_.b2v_latch_bc2_hi.latch!==8'h00) $fdisplay(f,"* Reg bc2 b=%h !=00",dut.reg_file_.b2v_latch_bc2_hi.latch);
343
   if (dut.reg_file_.b2v_latch_de2_lo.latch!==8'h00) $fdisplay(f,"* Reg de2 e=%h !=00",dut.reg_file_.b2v_latch_de2_lo.latch);
344
   if (dut.reg_file_.b2v_latch_de2_hi.latch!==8'h00) $fdisplay(f,"* Reg de2 d=%h !=00",dut.reg_file_.b2v_latch_de2_hi.latch);
345
   if (dut.reg_file_.b2v_latch_hl2_lo.latch!==8'h00) $fdisplay(f,"* Reg hl2 l=%h !=00",dut.reg_file_.b2v_latch_hl2_lo.latch);
346
   if (dut.reg_file_.b2v_latch_hl2_hi.latch!==8'h00) $fdisplay(f,"* Reg hl2 h=%h !=00",dut.reg_file_.b2v_latch_hl2_hi.latch);
347
   if (dut.reg_file_.b2v_latch_ix_lo.latch!==8'h00) $fdisplay(f,"* Reg ix x=%h !=00",dut.reg_file_.b2v_latch_ix_lo.latch);
348
   if (dut.reg_file_.b2v_latch_ix_hi.latch!==8'h00) $fdisplay(f,"* Reg ix i=%h !=00",dut.reg_file_.b2v_latch_ix_hi.latch);
349
   if (dut.reg_file_.b2v_latch_iy_lo.latch!==8'h00) $fdisplay(f,"* Reg iy y=%h !=00",dut.reg_file_.b2v_latch_iy_lo.latch);
350
   if (dut.reg_file_.b2v_latch_iy_hi.latch!==8'h00) $fdisplay(f,"* Reg iy i=%h !=00",dut.reg_file_.b2v_latch_iy_hi.latch);
351
   if (dut.reg_file_.b2v_latch_sp_lo.latch!==8'h00) $fdisplay(f,"* Reg sp p=%h !=00",dut.reg_file_.b2v_latch_sp_lo.latch);
352
   if (dut.reg_file_.b2v_latch_sp_hi.latch!==8'h00) $fdisplay(f,"* Reg sp s=%h !=00",dut.reg_file_.b2v_latch_sp_hi.latch);
353
   if (pc!==16'h0002) $fdisplay(f,"* PC=%h !=0002",pc);
354
   if (dut.reg_file_.b2v_latch_ir_lo.latch!==8'h02) $fdisplay(f,"* Reg ir r=%h !=02",dut.reg_file_.b2v_latch_ir_lo.latch);
355
   if (dut.reg_file_.b2v_latch_ir_hi.latch!==8'h00) $fdisplay(f,"* Reg ir i=%h !=00",dut.reg_file_.b2v_latch_ir_hi.latch);
356
   if (ram.Mem[47582]!==8'h69) $fdisplay(f,"* Mem[b9de]=%h !=69",ram.Mem[47582]);
357 13 gdevic
#1 // End opcode
358
 
359 8 gdevic
   force dut.ir_.ctl_ir_we=1;
360
   force dut.ir_.db=0;
361
#2 release dut.ir_.ctl_ir_we;
362
   release dut.ir_.db;
363 13 gdevic
   $fdisplay(f,"Testing opcode ed6f    RLD");
364 6 gdevic
   // Preset af
365
   force dut.reg_file_.b2v_latch_af_lo.we=1;
366
   force dut.reg_file_.b2v_latch_af_hi.we=1;
367
   force dut.reg_file_.b2v_latch_af_lo.db=8'h8b;
368
   force dut.reg_file_.b2v_latch_af_hi.db=8'h65;
369
#2 release dut.reg_file_.b2v_latch_af_lo.we;
370
   release dut.reg_file_.b2v_latch_af_hi.we;
371
   release dut.reg_file_.b2v_latch_af_lo.db;
372
   release dut.reg_file_.b2v_latch_af_hi.db;
373
   // Preset bc
374
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
375
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
376
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h7a;
377
   force dut.reg_file_.b2v_latch_bc_hi.db=8'h7a;
378
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
379
   release dut.reg_file_.b2v_latch_bc_hi.we;
380
   release dut.reg_file_.b2v_latch_bc_lo.db;
381
   release dut.reg_file_.b2v_latch_bc_hi.db;
382
   // Preset de
383
   force dut.reg_file_.b2v_latch_de_lo.we=1;
384
   force dut.reg_file_.b2v_latch_de_hi.we=1;
385
   force dut.reg_file_.b2v_latch_de_lo.db=8'hf0;
386
   force dut.reg_file_.b2v_latch_de_hi.db=8'hec;
387
#2 release dut.reg_file_.b2v_latch_de_lo.we;
388
   release dut.reg_file_.b2v_latch_de_hi.we;
389
   release dut.reg_file_.b2v_latch_de_lo.db;
390
   release dut.reg_file_.b2v_latch_de_hi.db;
391
   // Preset hl
392
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
393
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
394
   force dut.reg_file_.b2v_latch_hl_lo.db=8'h3c;
395
   force dut.reg_file_.b2v_latch_hl_hi.db=8'h40;
396
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
397
   release dut.reg_file_.b2v_latch_hl_hi.we;
398
   release dut.reg_file_.b2v_latch_hl_lo.db;
399
   release dut.reg_file_.b2v_latch_hl_hi.db;
400
   // Preset af2
401
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
402
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
403
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
404
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
405
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
406
   release dut.reg_file_.b2v_latch_af2_hi.we;
407
   release dut.reg_file_.b2v_latch_af2_lo.db;
408
   release dut.reg_file_.b2v_latch_af2_hi.db;
409
   // Preset bc2
410
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
411
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
412
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
413
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
414
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
415
   release dut.reg_file_.b2v_latch_bc2_hi.we;
416
   release dut.reg_file_.b2v_latch_bc2_lo.db;
417
   release dut.reg_file_.b2v_latch_bc2_hi.db;
418
   // Preset de2
419
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
420
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
421
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
422
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
423
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
424
   release dut.reg_file_.b2v_latch_de2_hi.we;
425
   release dut.reg_file_.b2v_latch_de2_lo.db;
426
   release dut.reg_file_.b2v_latch_de2_hi.db;
427
   // Preset hl2
428
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
429
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
430
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
431
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
432
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
433
   release dut.reg_file_.b2v_latch_hl2_hi.we;
434
   release dut.reg_file_.b2v_latch_hl2_lo.db;
435
   release dut.reg_file_.b2v_latch_hl2_hi.db;
436
   // Preset ix
437
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
438
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
439
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
440
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
441
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
442
   release dut.reg_file_.b2v_latch_ix_hi.we;
443
   release dut.reg_file_.b2v_latch_ix_lo.db;
444
   release dut.reg_file_.b2v_latch_ix_hi.db;
445
   // Preset iy
446
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
447
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
448
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
449
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
450
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
451
   release dut.reg_file_.b2v_latch_iy_hi.we;
452
   release dut.reg_file_.b2v_latch_iy_lo.db;
453
   release dut.reg_file_.b2v_latch_iy_hi.db;
454
   // Preset sp
455
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
456
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
457
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
458
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
459
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
460
   release dut.reg_file_.b2v_latch_sp_hi.we;
461
   release dut.reg_file_.b2v_latch_sp_lo.db;
462
   release dut.reg_file_.b2v_latch_sp_hi.db;
463
   // Preset wz
464
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
465
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
466
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
467
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
468
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
469
   release dut.reg_file_.b2v_latch_wz_hi.we;
470
   release dut.reg_file_.b2v_latch_wz_lo.db;
471
   release dut.reg_file_.b2v_latch_wz_hi.db;
472
   // Preset pc
473
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
474
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
475
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
476
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
477
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
478
   release dut.reg_file_.b2v_latch_pc_hi.we;
479
   release dut.reg_file_.b2v_latch_pc_lo.db;
480
   release dut.reg_file_.b2v_latch_pc_hi.db;
481
   // Preset ir
482
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
483
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
484
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
485
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
486
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
487
   release dut.reg_file_.b2v_latch_ir_hi.we;
488
   release dut.reg_file_.b2v_latch_ir_lo.db;
489
   release dut.reg_file_.b2v_latch_ir_hi.db;
490
   // Preset memory
491
   ram.Mem[0] = 8'hed;
492
   ram.Mem[1] = 8'h6f;
493
   // Preset memory
494
   ram.Mem[16444] = 8'hc4;
495
   force dut.z80_top_ifc_n.fpga_reset=0;
496 8 gdevic
   force dut.address_latch_.Q=16'h0000;
497 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
498
   release dut.reg_file_.reg_gp_we;
499 13 gdevic
#2 // Execute: M1/T1 start
500
#1 release dut.address_latch_.Q;
501 6 gdevic
#1
502 13 gdevic
#34 // Wait for opcode end
503 6 gdevic
   force dut.reg_control_.ctl_reg_sys_we=0;
504
#2 pc=z.A;
505
#2
506
#1 force dut.reg_file_.reg_gp_we=0;
507
   force dut.z80_top_ifc_n.fpga_reset=1;
508
   if (dut.reg_file_.b2v_latch_af_lo.latch!==8'h2d) $fdisplay(f,"* Reg af f=%h !=2d",dut.reg_file_.b2v_latch_af_lo.latch);
509
   if (dut.reg_file_.b2v_latch_af_hi.latch!==8'h6c) $fdisplay(f,"* Reg af a=%h !=6c",dut.reg_file_.b2v_latch_af_hi.latch);
510
   if (dut.reg_file_.b2v_latch_bc_lo.latch!==8'h7a) $fdisplay(f,"* Reg bc c=%h !=7a",dut.reg_file_.b2v_latch_bc_lo.latch);
511
   if (dut.reg_file_.b2v_latch_bc_hi.latch!==8'h7a) $fdisplay(f,"* Reg bc b=%h !=7a",dut.reg_file_.b2v_latch_bc_hi.latch);
512
   if (dut.reg_file_.b2v_latch_de_lo.latch!==8'hf0) $fdisplay(f,"* Reg de e=%h !=f0",dut.reg_file_.b2v_latch_de_lo.latch);
513
   if (dut.reg_file_.b2v_latch_de_hi.latch!==8'hec) $fdisplay(f,"* Reg de d=%h !=ec",dut.reg_file_.b2v_latch_de_hi.latch);
514
   if (dut.reg_file_.b2v_latch_hl_lo.latch!==8'h3c) $fdisplay(f,"* Reg hl l=%h !=3c",dut.reg_file_.b2v_latch_hl_lo.latch);
515
   if (dut.reg_file_.b2v_latch_hl_hi.latch!==8'h40) $fdisplay(f,"* Reg hl h=%h !=40",dut.reg_file_.b2v_latch_hl_hi.latch);
516
   if (dut.reg_file_.b2v_latch_af2_lo.latch!==8'h00) $fdisplay(f,"* Reg af2 f=%h !=00",dut.reg_file_.b2v_latch_af2_lo.latch);
517
   if (dut.reg_file_.b2v_latch_af2_hi.latch!==8'h00) $fdisplay(f,"* Reg af2 a=%h !=00",dut.reg_file_.b2v_latch_af2_hi.latch);
518
   if (dut.reg_file_.b2v_latch_bc2_lo.latch!==8'h00) $fdisplay(f,"* Reg bc2 c=%h !=00",dut.reg_file_.b2v_latch_bc2_lo.latch);
519
   if (dut.reg_file_.b2v_latch_bc2_hi.latch!==8'h00) $fdisplay(f,"* Reg bc2 b=%h !=00",dut.reg_file_.b2v_latch_bc2_hi.latch);
520
   if (dut.reg_file_.b2v_latch_de2_lo.latch!==8'h00) $fdisplay(f,"* Reg de2 e=%h !=00",dut.reg_file_.b2v_latch_de2_lo.latch);
521
   if (dut.reg_file_.b2v_latch_de2_hi.latch!==8'h00) $fdisplay(f,"* Reg de2 d=%h !=00",dut.reg_file_.b2v_latch_de2_hi.latch);
522
   if (dut.reg_file_.b2v_latch_hl2_lo.latch!==8'h00) $fdisplay(f,"* Reg hl2 l=%h !=00",dut.reg_file_.b2v_latch_hl2_lo.latch);
523
   if (dut.reg_file_.b2v_latch_hl2_hi.latch!==8'h00) $fdisplay(f,"* Reg hl2 h=%h !=00",dut.reg_file_.b2v_latch_hl2_hi.latch);
524
   if (dut.reg_file_.b2v_latch_ix_lo.latch!==8'h00) $fdisplay(f,"* Reg ix x=%h !=00",dut.reg_file_.b2v_latch_ix_lo.latch);
525
   if (dut.reg_file_.b2v_latch_ix_hi.latch!==8'h00) $fdisplay(f,"* Reg ix i=%h !=00",dut.reg_file_.b2v_latch_ix_hi.latch);
526
   if (dut.reg_file_.b2v_latch_iy_lo.latch!==8'h00) $fdisplay(f,"* Reg iy y=%h !=00",dut.reg_file_.b2v_latch_iy_lo.latch);
527
   if (dut.reg_file_.b2v_latch_iy_hi.latch!==8'h00) $fdisplay(f,"* Reg iy i=%h !=00",dut.reg_file_.b2v_latch_iy_hi.latch);
528
   if (dut.reg_file_.b2v_latch_sp_lo.latch!==8'h00) $fdisplay(f,"* Reg sp p=%h !=00",dut.reg_file_.b2v_latch_sp_lo.latch);
529
   if (dut.reg_file_.b2v_latch_sp_hi.latch!==8'h00) $fdisplay(f,"* Reg sp s=%h !=00",dut.reg_file_.b2v_latch_sp_hi.latch);
530
   if (pc!==16'h0002) $fdisplay(f,"* PC=%h !=0002",pc);
531
   if (dut.reg_file_.b2v_latch_ir_lo.latch!==8'h02) $fdisplay(f,"* Reg ir r=%h !=02",dut.reg_file_.b2v_latch_ir_lo.latch);
532
   if (dut.reg_file_.b2v_latch_ir_hi.latch!==8'h00) $fdisplay(f,"* Reg ir i=%h !=00",dut.reg_file_.b2v_latch_ir_hi.latch);
533
   if (ram.Mem[16444]!==8'h45) $fdisplay(f,"* Mem[403c]=%h !=45",ram.Mem[16444]);
534 13 gdevic
#1 // End opcode
535
 
536 8 gdevic
   force dut.ir_.ctl_ir_we=1;
537
   force dut.ir_.db=0;
538
#2 release dut.ir_.ctl_ir_we;
539
   release dut.ir_.db;
540 13 gdevic
   $fdisplay(f,"Testing opcode 81      ADD A,C");
541 6 gdevic
   // Preset af
542
   force dut.reg_file_.b2v_latch_af_lo.we=1;
543
   force dut.reg_file_.b2v_latch_af_hi.we=1;
544
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
545
   force dut.reg_file_.b2v_latch_af_hi.db=8'hf5;
546
#2 release dut.reg_file_.b2v_latch_af_lo.we;
547
   release dut.reg_file_.b2v_latch_af_hi.we;
548
   release dut.reg_file_.b2v_latch_af_lo.db;
549
   release dut.reg_file_.b2v_latch_af_hi.db;
550
   // Preset bc
551
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
552
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
553
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h3b;
554
   force dut.reg_file_.b2v_latch_bc_hi.db=8'h0f;
555
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
556
   release dut.reg_file_.b2v_latch_bc_hi.we;
557
   release dut.reg_file_.b2v_latch_bc_lo.db;
558
   release dut.reg_file_.b2v_latch_bc_hi.db;
559
   // Preset de
560
   force dut.reg_file_.b2v_latch_de_lo.we=1;
561
   force dut.reg_file_.b2v_latch_de_hi.we=1;
562
   force dut.reg_file_.b2v_latch_de_lo.db=8'h0d;
563
   force dut.reg_file_.b2v_latch_de_hi.db=8'h20;
564
#2 release dut.reg_file_.b2v_latch_de_lo.we;
565
   release dut.reg_file_.b2v_latch_de_hi.we;
566
   release dut.reg_file_.b2v_latch_de_lo.db;
567
   release dut.reg_file_.b2v_latch_de_hi.db;
568
   // Preset hl
569
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
570
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
571
   force dut.reg_file_.b2v_latch_hl_lo.db=8'ha6;
572
   force dut.reg_file_.b2v_latch_hl_hi.db=8'hdc;
573
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
574
   release dut.reg_file_.b2v_latch_hl_hi.we;
575
   release dut.reg_file_.b2v_latch_hl_lo.db;
576
   release dut.reg_file_.b2v_latch_hl_hi.db;
577
   // Preset af2
578
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
579
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
580
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
581
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
582
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
583
   release dut.reg_file_.b2v_latch_af2_hi.we;
584
   release dut.reg_file_.b2v_latch_af2_lo.db;
585
   release dut.reg_file_.b2v_latch_af2_hi.db;
586
   // Preset bc2
587
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
588
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
589
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
590
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
591
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
592
   release dut.reg_file_.b2v_latch_bc2_hi.we;
593
   release dut.reg_file_.b2v_latch_bc2_lo.db;
594
   release dut.reg_file_.b2v_latch_bc2_hi.db;
595
   // Preset de2
596
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
597
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
598
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
599
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
600
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
601
   release dut.reg_file_.b2v_latch_de2_hi.we;
602
   release dut.reg_file_.b2v_latch_de2_lo.db;
603
   release dut.reg_file_.b2v_latch_de2_hi.db;
604
   // Preset hl2
605
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
606
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
607
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
608
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
609
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
610
   release dut.reg_file_.b2v_latch_hl2_hi.we;
611
   release dut.reg_file_.b2v_latch_hl2_lo.db;
612
   release dut.reg_file_.b2v_latch_hl2_hi.db;
613
   // Preset ix
614
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
615
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
616
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
617
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
618
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
619
   release dut.reg_file_.b2v_latch_ix_hi.we;
620
   release dut.reg_file_.b2v_latch_ix_lo.db;
621
   release dut.reg_file_.b2v_latch_ix_hi.db;
622
   // Preset iy
623
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
624
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
625
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
626
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
627
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
628
   release dut.reg_file_.b2v_latch_iy_hi.we;
629
   release dut.reg_file_.b2v_latch_iy_lo.db;
630
   release dut.reg_file_.b2v_latch_iy_hi.db;
631
   // Preset sp
632
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
633
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
634
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
635
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
636
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
637
   release dut.reg_file_.b2v_latch_sp_hi.we;
638
   release dut.reg_file_.b2v_latch_sp_lo.db;
639
   release dut.reg_file_.b2v_latch_sp_hi.db;
640
   // Preset wz
641
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
642
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
643
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
644
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
645
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
646
   release dut.reg_file_.b2v_latch_wz_hi.we;
647
   release dut.reg_file_.b2v_latch_wz_lo.db;
648
   release dut.reg_file_.b2v_latch_wz_hi.db;
649
   // Preset pc
650
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
651
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
652
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
653
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
654
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
655
   release dut.reg_file_.b2v_latch_pc_hi.we;
656
   release dut.reg_file_.b2v_latch_pc_lo.db;
657
   release dut.reg_file_.b2v_latch_pc_hi.db;
658
   // Preset ir
659
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
660
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
661
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
662
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
663
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
664
   release dut.reg_file_.b2v_latch_ir_hi.we;
665
   release dut.reg_file_.b2v_latch_ir_lo.db;
666
   release dut.reg_file_.b2v_latch_ir_hi.db;
667
   // Preset memory
668
   ram.Mem[0] = 8'h81;
669
   // Preset memory
670
   ram.Mem[56486] = 8'h49;
671
   force dut.z80_top_ifc_n.fpga_reset=0;
672 8 gdevic
   force dut.address_latch_.Q=16'h0000;
673 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
674
   release dut.reg_file_.reg_gp_we;
675 13 gdevic
#2 // Execute: M1/T1 start
676
#1 release dut.address_latch_.Q;
677 6 gdevic
#1
678 13 gdevic
#6 // Wait for opcode end
679 6 gdevic
   force dut.reg_control_.ctl_reg_sys_we=0;
680
#2 pc=z.A;
681
#2
682
#1 force dut.reg_file_.reg_gp_we=0;
683
   force dut.z80_top_ifc_n.fpga_reset=1;
684
   if (dut.reg_file_.b2v_latch_af_lo.latch!==8'h31) $fdisplay(f,"* Reg af f=%h !=31",dut.reg_file_.b2v_latch_af_lo.latch);
685
   if (dut.reg_file_.b2v_latch_af_hi.latch!==8'h30) $fdisplay(f,"* Reg af a=%h !=30",dut.reg_file_.b2v_latch_af_hi.latch);
686
   if (dut.reg_file_.b2v_latch_bc_lo.latch!==8'h3b) $fdisplay(f,"* Reg bc c=%h !=3b",dut.reg_file_.b2v_latch_bc_lo.latch);
687
   if (dut.reg_file_.b2v_latch_bc_hi.latch!==8'h0f) $fdisplay(f,"* Reg bc b=%h !=0f",dut.reg_file_.b2v_latch_bc_hi.latch);
688
   if (dut.reg_file_.b2v_latch_de_lo.latch!==8'h0d) $fdisplay(f,"* Reg de e=%h !=0d",dut.reg_file_.b2v_latch_de_lo.latch);
689
   if (dut.reg_file_.b2v_latch_de_hi.latch!==8'h20) $fdisplay(f,"* Reg de d=%h !=20",dut.reg_file_.b2v_latch_de_hi.latch);
690
   if (dut.reg_file_.b2v_latch_hl_lo.latch!==8'ha6) $fdisplay(f,"* Reg hl l=%h !=a6",dut.reg_file_.b2v_latch_hl_lo.latch);
691
   if (dut.reg_file_.b2v_latch_hl_hi.latch!==8'hdc) $fdisplay(f,"* Reg hl h=%h !=dc",dut.reg_file_.b2v_latch_hl_hi.latch);
692
   if (dut.reg_file_.b2v_latch_af2_lo.latch!==8'h00) $fdisplay(f,"* Reg af2 f=%h !=00",dut.reg_file_.b2v_latch_af2_lo.latch);
693
   if (dut.reg_file_.b2v_latch_af2_hi.latch!==8'h00) $fdisplay(f,"* Reg af2 a=%h !=00",dut.reg_file_.b2v_latch_af2_hi.latch);
694
   if (dut.reg_file_.b2v_latch_bc2_lo.latch!==8'h00) $fdisplay(f,"* Reg bc2 c=%h !=00",dut.reg_file_.b2v_latch_bc2_lo.latch);
695
   if (dut.reg_file_.b2v_latch_bc2_hi.latch!==8'h00) $fdisplay(f,"* Reg bc2 b=%h !=00",dut.reg_file_.b2v_latch_bc2_hi.latch);
696
   if (dut.reg_file_.b2v_latch_de2_lo.latch!==8'h00) $fdisplay(f,"* Reg de2 e=%h !=00",dut.reg_file_.b2v_latch_de2_lo.latch);
697
   if (dut.reg_file_.b2v_latch_de2_hi.latch!==8'h00) $fdisplay(f,"* Reg de2 d=%h !=00",dut.reg_file_.b2v_latch_de2_hi.latch);
698
   if (dut.reg_file_.b2v_latch_hl2_lo.latch!==8'h00) $fdisplay(f,"* Reg hl2 l=%h !=00",dut.reg_file_.b2v_latch_hl2_lo.latch);
699
   if (dut.reg_file_.b2v_latch_hl2_hi.latch!==8'h00) $fdisplay(f,"* Reg hl2 h=%h !=00",dut.reg_file_.b2v_latch_hl2_hi.latch);
700
   if (dut.reg_file_.b2v_latch_ix_lo.latch!==8'h00) $fdisplay(f,"* Reg ix x=%h !=00",dut.reg_file_.b2v_latch_ix_lo.latch);
701
   if (dut.reg_file_.b2v_latch_ix_hi.latch!==8'h00) $fdisplay(f,"* Reg ix i=%h !=00",dut.reg_file_.b2v_latch_ix_hi.latch);
702
   if (dut.reg_file_.b2v_latch_iy_lo.latch!==8'h00) $fdisplay(f,"* Reg iy y=%h !=00",dut.reg_file_.b2v_latch_iy_lo.latch);
703
   if (dut.reg_file_.b2v_latch_iy_hi.latch!==8'h00) $fdisplay(f,"* Reg iy i=%h !=00",dut.reg_file_.b2v_latch_iy_hi.latch);
704
   if (dut.reg_file_.b2v_latch_sp_lo.latch!==8'h00) $fdisplay(f,"* Reg sp p=%h !=00",dut.reg_file_.b2v_latch_sp_lo.latch);
705
   if (dut.reg_file_.b2v_latch_sp_hi.latch!==8'h00) $fdisplay(f,"* Reg sp s=%h !=00",dut.reg_file_.b2v_latch_sp_hi.latch);
706
   if (pc!==16'h0001) $fdisplay(f,"* PC=%h !=0001",pc);
707
   if (dut.reg_file_.b2v_latch_ir_lo.latch!==8'h01) $fdisplay(f,"* Reg ir r=%h !=01",dut.reg_file_.b2v_latch_ir_lo.latch);
708
   if (dut.reg_file_.b2v_latch_ir_hi.latch!==8'h00) $fdisplay(f,"* Reg ir i=%h !=00",dut.reg_file_.b2v_latch_ir_hi.latch);
709 13 gdevic
#1 // End opcode
710
 
711 8 gdevic
   force dut.ir_.ctl_ir_we=1;
712
   force dut.ir_.db=0;
713
#2 release dut.ir_.ctl_ir_we;
714
   release dut.ir_.db;
715 13 gdevic
   $fdisplay(f,"Testing opcode cb41    BIT 0,C");
716 6 gdevic
   // Preset af
717
   force dut.reg_file_.b2v_latch_af_lo.we=1;
718
   force dut.reg_file_.b2v_latch_af_hi.we=1;
719
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
720
   force dut.reg_file_.b2v_latch_af_hi.db=8'h9e;
721
#2 release dut.reg_file_.b2v_latch_af_lo.we;
722
   release dut.reg_file_.b2v_latch_af_hi.we;
723
   release dut.reg_file_.b2v_latch_af_lo.db;
724
   release dut.reg_file_.b2v_latch_af_hi.db;
725
   // Preset bc
726
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
727
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
728
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h43;
729
   force dut.reg_file_.b2v_latch_bc_hi.db=8'h1b;
730
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
731
   release dut.reg_file_.b2v_latch_bc_hi.we;
732
   release dut.reg_file_.b2v_latch_bc_lo.db;
733
   release dut.reg_file_.b2v_latch_bc_hi.db;
734
   // Preset de
735
   force dut.reg_file_.b2v_latch_de_lo.we=1;
736
   force dut.reg_file_.b2v_latch_de_hi.we=1;
737
   force dut.reg_file_.b2v_latch_de_lo.db=8'h4e;
738
   force dut.reg_file_.b2v_latch_de_hi.db=8'h95;
739
#2 release dut.reg_file_.b2v_latch_de_lo.we;
740
   release dut.reg_file_.b2v_latch_de_hi.we;
741
   release dut.reg_file_.b2v_latch_de_lo.db;
742
   release dut.reg_file_.b2v_latch_de_hi.db;
743
   // Preset hl
744
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
745
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
746
   force dut.reg_file_.b2v_latch_hl_lo.db=8'he9;
747
   force dut.reg_file_.b2v_latch_hl_hi.db=8'h7b;
748
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
749
   release dut.reg_file_.b2v_latch_hl_hi.we;
750
   release dut.reg_file_.b2v_latch_hl_lo.db;
751
   release dut.reg_file_.b2v_latch_hl_hi.db;
752
   // Preset af2
753
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
754
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
755
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
756
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
757
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
758
   release dut.reg_file_.b2v_latch_af2_hi.we;
759
   release dut.reg_file_.b2v_latch_af2_lo.db;
760
   release dut.reg_file_.b2v_latch_af2_hi.db;
761
   // Preset bc2
762
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
763
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
764
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
765
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
766
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
767
   release dut.reg_file_.b2v_latch_bc2_hi.we;
768
   release dut.reg_file_.b2v_latch_bc2_lo.db;
769
   release dut.reg_file_.b2v_latch_bc2_hi.db;
770
   // Preset de2
771
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
772
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
773
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
774
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
775
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
776
   release dut.reg_file_.b2v_latch_de2_hi.we;
777
   release dut.reg_file_.b2v_latch_de2_lo.db;
778
   release dut.reg_file_.b2v_latch_de2_hi.db;
779
   // Preset hl2
780
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
781
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
782
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
783
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
784
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
785
   release dut.reg_file_.b2v_latch_hl2_hi.we;
786
   release dut.reg_file_.b2v_latch_hl2_lo.db;
787
   release dut.reg_file_.b2v_latch_hl2_hi.db;
788
   // Preset ix
789
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
790
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
791
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
792
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
793
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
794
   release dut.reg_file_.b2v_latch_ix_hi.we;
795
   release dut.reg_file_.b2v_latch_ix_lo.db;
796
   release dut.reg_file_.b2v_latch_ix_hi.db;
797
   // Preset iy
798
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
799
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
800
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
801
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
802
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
803
   release dut.reg_file_.b2v_latch_iy_hi.we;
804
   release dut.reg_file_.b2v_latch_iy_lo.db;
805
   release dut.reg_file_.b2v_latch_iy_hi.db;
806
   // Preset sp
807
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
808
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
809
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
810
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
811
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
812
   release dut.reg_file_.b2v_latch_sp_hi.we;
813
   release dut.reg_file_.b2v_latch_sp_lo.db;
814
   release dut.reg_file_.b2v_latch_sp_hi.db;
815
   // Preset wz
816
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
817
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
818
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
819
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
820
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
821
   release dut.reg_file_.b2v_latch_wz_hi.we;
822
   release dut.reg_file_.b2v_latch_wz_lo.db;
823
   release dut.reg_file_.b2v_latch_wz_hi.db;
824
   // Preset pc
825
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
826
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
827
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
828
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
829
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
830
   release dut.reg_file_.b2v_latch_pc_hi.we;
831
   release dut.reg_file_.b2v_latch_pc_lo.db;
832
   release dut.reg_file_.b2v_latch_pc_hi.db;
833
   // Preset ir
834
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
835
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
836
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
837
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
838
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
839
   release dut.reg_file_.b2v_latch_ir_hi.we;
840
   release dut.reg_file_.b2v_latch_ir_lo.db;
841
   release dut.reg_file_.b2v_latch_ir_hi.db;
842
   // Preset memory
843
   ram.Mem[0] = 8'hcb;
844
   ram.Mem[1] = 8'h41;
845
   // Preset memory
846
   ram.Mem[31721] = 8'hf7;
847
   force dut.z80_top_ifc_n.fpga_reset=0;
848 8 gdevic
   force dut.address_latch_.Q=16'h0000;
849 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
850
   release dut.reg_file_.reg_gp_we;
851 13 gdevic
#2 // Execute: M1/T1 start
852
#1 release dut.address_latch_.Q;
853 6 gdevic
#1
854 13 gdevic
#14 // Wait for opcode end
855 6 gdevic
   force dut.reg_control_.ctl_reg_sys_we=0;
856
#2 pc=z.A;
857
#2
858
#1 force dut.reg_file_.reg_gp_we=0;
859
   force dut.z80_top_ifc_n.fpga_reset=1;
860
   if (dut.reg_file_.b2v_latch_af_lo.latch!==8'h10) $fdisplay(f,"* Reg af f=%h !=10",dut.reg_file_.b2v_latch_af_lo.latch);
861
   if (dut.reg_file_.b2v_latch_af_hi.latch!==8'h9e) $fdisplay(f,"* Reg af a=%h !=9e",dut.reg_file_.b2v_latch_af_hi.latch);
862
   if (dut.reg_file_.b2v_latch_bc_lo.latch!==8'h43) $fdisplay(f,"* Reg bc c=%h !=43",dut.reg_file_.b2v_latch_bc_lo.latch);
863
   if (dut.reg_file_.b2v_latch_bc_hi.latch!==8'h1b) $fdisplay(f,"* Reg bc b=%h !=1b",dut.reg_file_.b2v_latch_bc_hi.latch);
864
   if (dut.reg_file_.b2v_latch_de_lo.latch!==8'h4e) $fdisplay(f,"* Reg de e=%h !=4e",dut.reg_file_.b2v_latch_de_lo.latch);
865
   if (dut.reg_file_.b2v_latch_de_hi.latch!==8'h95) $fdisplay(f,"* Reg de d=%h !=95",dut.reg_file_.b2v_latch_de_hi.latch);
866
   if (dut.reg_file_.b2v_latch_hl_lo.latch!==8'he9) $fdisplay(f,"* Reg hl l=%h !=e9",dut.reg_file_.b2v_latch_hl_lo.latch);
867
   if (dut.reg_file_.b2v_latch_hl_hi.latch!==8'h7b) $fdisplay(f,"* Reg hl h=%h !=7b",dut.reg_file_.b2v_latch_hl_hi.latch);
868
   if (dut.reg_file_.b2v_latch_af2_lo.latch!==8'h00) $fdisplay(f,"* Reg af2 f=%h !=00",dut.reg_file_.b2v_latch_af2_lo.latch);
869
   if (dut.reg_file_.b2v_latch_af2_hi.latch!==8'h00) $fdisplay(f,"* Reg af2 a=%h !=00",dut.reg_file_.b2v_latch_af2_hi.latch);
870
   if (dut.reg_file_.b2v_latch_bc2_lo.latch!==8'h00) $fdisplay(f,"* Reg bc2 c=%h !=00",dut.reg_file_.b2v_latch_bc2_lo.latch);
871
   if (dut.reg_file_.b2v_latch_bc2_hi.latch!==8'h00) $fdisplay(f,"* Reg bc2 b=%h !=00",dut.reg_file_.b2v_latch_bc2_hi.latch);
872
   if (dut.reg_file_.b2v_latch_de2_lo.latch!==8'h00) $fdisplay(f,"* Reg de2 e=%h !=00",dut.reg_file_.b2v_latch_de2_lo.latch);
873
   if (dut.reg_file_.b2v_latch_de2_hi.latch!==8'h00) $fdisplay(f,"* Reg de2 d=%h !=00",dut.reg_file_.b2v_latch_de2_hi.latch);
874
   if (dut.reg_file_.b2v_latch_hl2_lo.latch!==8'h00) $fdisplay(f,"* Reg hl2 l=%h !=00",dut.reg_file_.b2v_latch_hl2_lo.latch);
875
   if (dut.reg_file_.b2v_latch_hl2_hi.latch!==8'h00) $fdisplay(f,"* Reg hl2 h=%h !=00",dut.reg_file_.b2v_latch_hl2_hi.latch);
876
   if (dut.reg_file_.b2v_latch_ix_lo.latch!==8'h00) $fdisplay(f,"* Reg ix x=%h !=00",dut.reg_file_.b2v_latch_ix_lo.latch);
877
   if (dut.reg_file_.b2v_latch_ix_hi.latch!==8'h00) $fdisplay(f,"* Reg ix i=%h !=00",dut.reg_file_.b2v_latch_ix_hi.latch);
878
   if (dut.reg_file_.b2v_latch_iy_lo.latch!==8'h00) $fdisplay(f,"* Reg iy y=%h !=00",dut.reg_file_.b2v_latch_iy_lo.latch);
879
   if (dut.reg_file_.b2v_latch_iy_hi.latch!==8'h00) $fdisplay(f,"* Reg iy i=%h !=00",dut.reg_file_.b2v_latch_iy_hi.latch);
880
   if (dut.reg_file_.b2v_latch_sp_lo.latch!==8'h00) $fdisplay(f,"* Reg sp p=%h !=00",dut.reg_file_.b2v_latch_sp_lo.latch);
881
   if (dut.reg_file_.b2v_latch_sp_hi.latch!==8'h00) $fdisplay(f,"* Reg sp s=%h !=00",dut.reg_file_.b2v_latch_sp_hi.latch);
882
   if (pc!==16'h0002) $fdisplay(f,"* PC=%h !=0002",pc);
883
   if (dut.reg_file_.b2v_latch_ir_lo.latch!==8'h02) $fdisplay(f,"* Reg ir r=%h !=02",dut.reg_file_.b2v_latch_ir_lo.latch);
884
   if (dut.reg_file_.b2v_latch_ir_hi.latch!==8'h00) $fdisplay(f,"* Reg ir i=%h !=00",dut.reg_file_.b2v_latch_ir_hi.latch);
885 13 gdevic
#1 // End opcode
886
 
887 8 gdevic
   force dut.ir_.ctl_ir_we=1;
888
   force dut.ir_.db=0;
889
#2 release dut.ir_.ctl_ir_we;
890
   release dut.ir_.db;
891 13 gdevic
   $fdisplay(f,"Testing opcode cb93    RES 2,E");
892 6 gdevic
   // Preset af
893
   force dut.reg_file_.b2v_latch_af_lo.we=1;
894
   force dut.reg_file_.b2v_latch_af_hi.we=1;
895
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
896
   force dut.reg_file_.b2v_latch_af_hi.db=8'hc2;
897
#2 release dut.reg_file_.b2v_latch_af_lo.we;
898
   release dut.reg_file_.b2v_latch_af_hi.we;
899
   release dut.reg_file_.b2v_latch_af_lo.db;
900
   release dut.reg_file_.b2v_latch_af_hi.db;
901
   // Preset bc
902
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
903
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
904
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h05;
905
   force dut.reg_file_.b2v_latch_bc_hi.db=8'h4e;
906
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
907
   release dut.reg_file_.b2v_latch_bc_hi.we;
908
   release dut.reg_file_.b2v_latch_bc_lo.db;
909
   release dut.reg_file_.b2v_latch_bc_hi.db;
910
   // Preset de
911
   force dut.reg_file_.b2v_latch_de_lo.we=1;
912
   force dut.reg_file_.b2v_latch_de_hi.we=1;
913
   force dut.reg_file_.b2v_latch_de_lo.db=8'hf8;
914
   force dut.reg_file_.b2v_latch_de_hi.db=8'hb3;
915
#2 release dut.reg_file_.b2v_latch_de_lo.we;
916
   release dut.reg_file_.b2v_latch_de_hi.we;
917
   release dut.reg_file_.b2v_latch_de_lo.db;
918
   release dut.reg_file_.b2v_latch_de_hi.db;
919
   // Preset hl
920
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
921
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
922
   force dut.reg_file_.b2v_latch_hl_lo.db=8'h34;
923
   force dut.reg_file_.b2v_latch_hl_hi.db=8'h22;
924
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
925
   release dut.reg_file_.b2v_latch_hl_hi.we;
926
   release dut.reg_file_.b2v_latch_hl_lo.db;
927
   release dut.reg_file_.b2v_latch_hl_hi.db;
928
   // Preset af2
929
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
930
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
931
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
932
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
933
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
934
   release dut.reg_file_.b2v_latch_af2_hi.we;
935
   release dut.reg_file_.b2v_latch_af2_lo.db;
936
   release dut.reg_file_.b2v_latch_af2_hi.db;
937
   // Preset bc2
938
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
939
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
940
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
941
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
942
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
943
   release dut.reg_file_.b2v_latch_bc2_hi.we;
944
   release dut.reg_file_.b2v_latch_bc2_lo.db;
945
   release dut.reg_file_.b2v_latch_bc2_hi.db;
946
   // Preset de2
947
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
948
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
949
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
950
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
951
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
952
   release dut.reg_file_.b2v_latch_de2_hi.we;
953
   release dut.reg_file_.b2v_latch_de2_lo.db;
954
   release dut.reg_file_.b2v_latch_de2_hi.db;
955
   // Preset hl2
956
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
957
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
958
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
959
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
960
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
961
   release dut.reg_file_.b2v_latch_hl2_hi.we;
962
   release dut.reg_file_.b2v_latch_hl2_lo.db;
963
   release dut.reg_file_.b2v_latch_hl2_hi.db;
964
   // Preset ix
965
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
966
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
967
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
968
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
969
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
970
   release dut.reg_file_.b2v_latch_ix_hi.we;
971
   release dut.reg_file_.b2v_latch_ix_lo.db;
972
   release dut.reg_file_.b2v_latch_ix_hi.db;
973
   // Preset iy
974
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
975
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
976
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
977
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
978
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
979
   release dut.reg_file_.b2v_latch_iy_hi.we;
980
   release dut.reg_file_.b2v_latch_iy_lo.db;
981
   release dut.reg_file_.b2v_latch_iy_hi.db;
982
   // Preset sp
983
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
984
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
985
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
986
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
987
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
988
   release dut.reg_file_.b2v_latch_sp_hi.we;
989
   release dut.reg_file_.b2v_latch_sp_lo.db;
990
   release dut.reg_file_.b2v_latch_sp_hi.db;
991
   // Preset wz
992
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
993
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
994
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
995
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
996
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
997
   release dut.reg_file_.b2v_latch_wz_hi.we;
998
   release dut.reg_file_.b2v_latch_wz_lo.db;
999
   release dut.reg_file_.b2v_latch_wz_hi.db;
1000
   // Preset pc
1001
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
1002
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
1003
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
1004
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
1005
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
1006
   release dut.reg_file_.b2v_latch_pc_hi.we;
1007
   release dut.reg_file_.b2v_latch_pc_lo.db;
1008
   release dut.reg_file_.b2v_latch_pc_hi.db;
1009
   // Preset ir
1010
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
1011
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
1012
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
1013
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
1014
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
1015
   release dut.reg_file_.b2v_latch_ir_hi.we;
1016
   release dut.reg_file_.b2v_latch_ir_lo.db;
1017
   release dut.reg_file_.b2v_latch_ir_hi.db;
1018
   // Preset memory
1019
   ram.Mem[0] = 8'hcb;
1020
   ram.Mem[1] = 8'h93;
1021
   // Preset memory
1022
   ram.Mem[8756] = 8'ha0;
1023
   force dut.z80_top_ifc_n.fpga_reset=0;
1024 8 gdevic
   force dut.address_latch_.Q=16'h0000;
1025 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
1026
   release dut.reg_file_.reg_gp_we;
1027 13 gdevic
#2 // Execute: M1/T1 start
1028
#1 release dut.address_latch_.Q;
1029 6 gdevic
#1
1030 13 gdevic
#14 // Wait for opcode end
1031 6 gdevic
   force dut.reg_control_.ctl_reg_sys_we=0;
1032
#2 pc=z.A;
1033
#2
1034
#1 force dut.reg_file_.reg_gp_we=0;
1035
   force dut.z80_top_ifc_n.fpga_reset=1;
1036
   if (dut.reg_file_.b2v_latch_af_lo.latch!==8'h00) $fdisplay(f,"* Reg af f=%h !=00",dut.reg_file_.b2v_latch_af_lo.latch);
1037
   if (dut.reg_file_.b2v_latch_af_hi.latch!==8'hc2) $fdisplay(f,"* Reg af a=%h !=c2",dut.reg_file_.b2v_latch_af_hi.latch);
1038
   if (dut.reg_file_.b2v_latch_bc_lo.latch!==8'h05) $fdisplay(f,"* Reg bc c=%h !=05",dut.reg_file_.b2v_latch_bc_lo.latch);
1039
   if (dut.reg_file_.b2v_latch_bc_hi.latch!==8'h4e) $fdisplay(f,"* Reg bc b=%h !=4e",dut.reg_file_.b2v_latch_bc_hi.latch);
1040
   if (dut.reg_file_.b2v_latch_de_lo.latch!==8'hf8) $fdisplay(f,"* Reg de e=%h !=f8",dut.reg_file_.b2v_latch_de_lo.latch);
1041
   if (dut.reg_file_.b2v_latch_de_hi.latch!==8'hb3) $fdisplay(f,"* Reg de d=%h !=b3",dut.reg_file_.b2v_latch_de_hi.latch);
1042
   if (dut.reg_file_.b2v_latch_hl_lo.latch!==8'h34) $fdisplay(f,"* Reg hl l=%h !=34",dut.reg_file_.b2v_latch_hl_lo.latch);
1043
   if (dut.reg_file_.b2v_latch_hl_hi.latch!==8'h22) $fdisplay(f,"* Reg hl h=%h !=22",dut.reg_file_.b2v_latch_hl_hi.latch);
1044
   if (dut.reg_file_.b2v_latch_af2_lo.latch!==8'h00) $fdisplay(f,"* Reg af2 f=%h !=00",dut.reg_file_.b2v_latch_af2_lo.latch);
1045
   if (dut.reg_file_.b2v_latch_af2_hi.latch!==8'h00) $fdisplay(f,"* Reg af2 a=%h !=00",dut.reg_file_.b2v_latch_af2_hi.latch);
1046
   if (dut.reg_file_.b2v_latch_bc2_lo.latch!==8'h00) $fdisplay(f,"* Reg bc2 c=%h !=00",dut.reg_file_.b2v_latch_bc2_lo.latch);
1047
   if (dut.reg_file_.b2v_latch_bc2_hi.latch!==8'h00) $fdisplay(f,"* Reg bc2 b=%h !=00",dut.reg_file_.b2v_latch_bc2_hi.latch);
1048
   if (dut.reg_file_.b2v_latch_de2_lo.latch!==8'h00) $fdisplay(f,"* Reg de2 e=%h !=00",dut.reg_file_.b2v_latch_de2_lo.latch);
1049
   if (dut.reg_file_.b2v_latch_de2_hi.latch!==8'h00) $fdisplay(f,"* Reg de2 d=%h !=00",dut.reg_file_.b2v_latch_de2_hi.latch);
1050
   if (dut.reg_file_.b2v_latch_hl2_lo.latch!==8'h00) $fdisplay(f,"* Reg hl2 l=%h !=00",dut.reg_file_.b2v_latch_hl2_lo.latch);
1051
   if (dut.reg_file_.b2v_latch_hl2_hi.latch!==8'h00) $fdisplay(f,"* Reg hl2 h=%h !=00",dut.reg_file_.b2v_latch_hl2_hi.latch);
1052
   if (dut.reg_file_.b2v_latch_ix_lo.latch!==8'h00) $fdisplay(f,"* Reg ix x=%h !=00",dut.reg_file_.b2v_latch_ix_lo.latch);
1053
   if (dut.reg_file_.b2v_latch_ix_hi.latch!==8'h00) $fdisplay(f,"* Reg ix i=%h !=00",dut.reg_file_.b2v_latch_ix_hi.latch);
1054
   if (dut.reg_file_.b2v_latch_iy_lo.latch!==8'h00) $fdisplay(f,"* Reg iy y=%h !=00",dut.reg_file_.b2v_latch_iy_lo.latch);
1055
   if (dut.reg_file_.b2v_latch_iy_hi.latch!==8'h00) $fdisplay(f,"* Reg iy i=%h !=00",dut.reg_file_.b2v_latch_iy_hi.latch);
1056
   if (dut.reg_file_.b2v_latch_sp_lo.latch!==8'h00) $fdisplay(f,"* Reg sp p=%h !=00",dut.reg_file_.b2v_latch_sp_lo.latch);
1057
   if (dut.reg_file_.b2v_latch_sp_hi.latch!==8'h00) $fdisplay(f,"* Reg sp s=%h !=00",dut.reg_file_.b2v_latch_sp_hi.latch);
1058
   if (pc!==16'h0002) $fdisplay(f,"* PC=%h !=0002",pc);
1059
   if (dut.reg_file_.b2v_latch_ir_lo.latch!==8'h02) $fdisplay(f,"* Reg ir r=%h !=02",dut.reg_file_.b2v_latch_ir_lo.latch);
1060
   if (dut.reg_file_.b2v_latch_ir_hi.latch!==8'h00) $fdisplay(f,"* Reg ir i=%h !=00",dut.reg_file_.b2v_latch_ir_hi.latch);
1061 13 gdevic
#1 // End opcode
1062
 
1063 8 gdevic
   force dut.ir_.ctl_ir_we=1;
1064
   force dut.ir_.db=0;
1065
#2 release dut.ir_.ctl_ir_we;
1066
   release dut.ir_.db;
1067 13 gdevic
   $fdisplay(f,"Testing opcode cbe5    SET 4,L");
1068 6 gdevic
   // Preset af
1069
   force dut.reg_file_.b2v_latch_af_lo.we=1;
1070
   force dut.reg_file_.b2v_latch_af_hi.we=1;
1071
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
1072
   force dut.reg_file_.b2v_latch_af_hi.db=8'hca;
1073
#2 release dut.reg_file_.b2v_latch_af_lo.we;
1074
   release dut.reg_file_.b2v_latch_af_hi.we;
1075
   release dut.reg_file_.b2v_latch_af_lo.db;
1076
   release dut.reg_file_.b2v_latch_af_hi.db;
1077
   // Preset bc
1078
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
1079
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
1080
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h0d;
1081
   force dut.reg_file_.b2v_latch_bc_hi.db=8'hdf;
1082
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
1083
   release dut.reg_file_.b2v_latch_bc_hi.we;
1084
   release dut.reg_file_.b2v_latch_bc_lo.db;
1085
   release dut.reg_file_.b2v_latch_bc_hi.db;
1086
   // Preset de
1087
   force dut.reg_file_.b2v_latch_de_lo.we=1;
1088
   force dut.reg_file_.b2v_latch_de_hi.we=1;
1089
   force dut.reg_file_.b2v_latch_de_lo.db=8'h88;
1090
   force dut.reg_file_.b2v_latch_de_hi.db=8'hd5;
1091
#2 release dut.reg_file_.b2v_latch_de_lo.we;
1092
   release dut.reg_file_.b2v_latch_de_hi.we;
1093
   release dut.reg_file_.b2v_latch_de_lo.db;
1094
   release dut.reg_file_.b2v_latch_de_hi.db;
1095
   // Preset hl
1096
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
1097
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
1098
   force dut.reg_file_.b2v_latch_hl_lo.db=8'h8f;
1099
   force dut.reg_file_.b2v_latch_hl_hi.db=8'hb4;
1100
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
1101
   release dut.reg_file_.b2v_latch_hl_hi.we;
1102
   release dut.reg_file_.b2v_latch_hl_lo.db;
1103
   release dut.reg_file_.b2v_latch_hl_hi.db;
1104
   // Preset af2
1105
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
1106
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
1107
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
1108
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
1109
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
1110
   release dut.reg_file_.b2v_latch_af2_hi.we;
1111
   release dut.reg_file_.b2v_latch_af2_lo.db;
1112
   release dut.reg_file_.b2v_latch_af2_hi.db;
1113
   // Preset bc2
1114
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
1115
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
1116
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
1117
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
1118
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
1119
   release dut.reg_file_.b2v_latch_bc2_hi.we;
1120
   release dut.reg_file_.b2v_latch_bc2_lo.db;
1121
   release dut.reg_file_.b2v_latch_bc2_hi.db;
1122
   // Preset de2
1123
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
1124
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
1125
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
1126
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
1127
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
1128
   release dut.reg_file_.b2v_latch_de2_hi.we;
1129
   release dut.reg_file_.b2v_latch_de2_lo.db;
1130
   release dut.reg_file_.b2v_latch_de2_hi.db;
1131
   // Preset hl2
1132
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
1133
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
1134
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
1135
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
1136
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
1137
   release dut.reg_file_.b2v_latch_hl2_hi.we;
1138
   release dut.reg_file_.b2v_latch_hl2_lo.db;
1139
   release dut.reg_file_.b2v_latch_hl2_hi.db;
1140
   // Preset ix
1141
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
1142
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
1143
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
1144
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
1145
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
1146
   release dut.reg_file_.b2v_latch_ix_hi.we;
1147
   release dut.reg_file_.b2v_latch_ix_lo.db;
1148
   release dut.reg_file_.b2v_latch_ix_hi.db;
1149
   // Preset iy
1150
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
1151
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
1152
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
1153
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
1154
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
1155
   release dut.reg_file_.b2v_latch_iy_hi.we;
1156
   release dut.reg_file_.b2v_latch_iy_lo.db;
1157
   release dut.reg_file_.b2v_latch_iy_hi.db;
1158
   // Preset sp
1159
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
1160
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
1161
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
1162
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
1163
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
1164
   release dut.reg_file_.b2v_latch_sp_hi.we;
1165
   release dut.reg_file_.b2v_latch_sp_lo.db;
1166
   release dut.reg_file_.b2v_latch_sp_hi.db;
1167
   // Preset wz
1168
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
1169
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
1170
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
1171
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
1172
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
1173
   release dut.reg_file_.b2v_latch_wz_hi.we;
1174
   release dut.reg_file_.b2v_latch_wz_lo.db;
1175
   release dut.reg_file_.b2v_latch_wz_hi.db;
1176
   // Preset pc
1177
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
1178
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
1179
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
1180
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
1181
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
1182
   release dut.reg_file_.b2v_latch_pc_hi.we;
1183
   release dut.reg_file_.b2v_latch_pc_lo.db;
1184
   release dut.reg_file_.b2v_latch_pc_hi.db;
1185
   // Preset ir
1186
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
1187
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
1188
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
1189
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
1190
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
1191
   release dut.reg_file_.b2v_latch_ir_hi.we;
1192
   release dut.reg_file_.b2v_latch_ir_lo.db;
1193
   release dut.reg_file_.b2v_latch_ir_hi.db;
1194
   // Preset memory
1195
   ram.Mem[0] = 8'hcb;
1196
   ram.Mem[1] = 8'he5;
1197
   // Preset memory
1198
   ram.Mem[46223] = 8'hcf;
1199
   force dut.z80_top_ifc_n.fpga_reset=0;
1200 8 gdevic
   force dut.address_latch_.Q=16'h0000;
1201 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
1202
   release dut.reg_file_.reg_gp_we;
1203 13 gdevic
#2 // Execute: M1/T1 start
1204
#1 release dut.address_latch_.Q;
1205 6 gdevic
#1
1206 13 gdevic
#14 // Wait for opcode end
1207 6 gdevic
   force dut.reg_control_.ctl_reg_sys_we=0;
1208
#2 pc=z.A;
1209
#2
1210
#1 force dut.reg_file_.reg_gp_we=0;
1211
   force dut.z80_top_ifc_n.fpga_reset=1;
1212
   if (dut.reg_file_.b2v_latch_af_lo.latch!==8'h00) $fdisplay(f,"* Reg af f=%h !=00",dut.reg_file_.b2v_latch_af_lo.latch);
1213
   if (dut.reg_file_.b2v_latch_af_hi.latch!==8'hca) $fdisplay(f,"* Reg af a=%h !=ca",dut.reg_file_.b2v_latch_af_hi.latch);
1214
   if (dut.reg_file_.b2v_latch_bc_lo.latch!==8'h0d) $fdisplay(f,"* Reg bc c=%h !=0d",dut.reg_file_.b2v_latch_bc_lo.latch);
1215
   if (dut.reg_file_.b2v_latch_bc_hi.latch!==8'hdf) $fdisplay(f,"* Reg bc b=%h !=df",dut.reg_file_.b2v_latch_bc_hi.latch);
1216
   if (dut.reg_file_.b2v_latch_de_lo.latch!==8'h88) $fdisplay(f,"* Reg de e=%h !=88",dut.reg_file_.b2v_latch_de_lo.latch);
1217
   if (dut.reg_file_.b2v_latch_de_hi.latch!==8'hd5) $fdisplay(f,"* Reg de d=%h !=d5",dut.reg_file_.b2v_latch_de_hi.latch);
1218
   if (dut.reg_file_.b2v_latch_hl_lo.latch!==8'h9f) $fdisplay(f,"* Reg hl l=%h !=9f",dut.reg_file_.b2v_latch_hl_lo.latch);
1219
   if (dut.reg_file_.b2v_latch_hl_hi.latch!==8'hb4) $fdisplay(f,"* Reg hl h=%h !=b4",dut.reg_file_.b2v_latch_hl_hi.latch);
1220
   if (dut.reg_file_.b2v_latch_af2_lo.latch!==8'h00) $fdisplay(f,"* Reg af2 f=%h !=00",dut.reg_file_.b2v_latch_af2_lo.latch);
1221
   if (dut.reg_file_.b2v_latch_af2_hi.latch!==8'h00) $fdisplay(f,"* Reg af2 a=%h !=00",dut.reg_file_.b2v_latch_af2_hi.latch);
1222
   if (dut.reg_file_.b2v_latch_bc2_lo.latch!==8'h00) $fdisplay(f,"* Reg bc2 c=%h !=00",dut.reg_file_.b2v_latch_bc2_lo.latch);
1223
   if (dut.reg_file_.b2v_latch_bc2_hi.latch!==8'h00) $fdisplay(f,"* Reg bc2 b=%h !=00",dut.reg_file_.b2v_latch_bc2_hi.latch);
1224
   if (dut.reg_file_.b2v_latch_de2_lo.latch!==8'h00) $fdisplay(f,"* Reg de2 e=%h !=00",dut.reg_file_.b2v_latch_de2_lo.latch);
1225
   if (dut.reg_file_.b2v_latch_de2_hi.latch!==8'h00) $fdisplay(f,"* Reg de2 d=%h !=00",dut.reg_file_.b2v_latch_de2_hi.latch);
1226
   if (dut.reg_file_.b2v_latch_hl2_lo.latch!==8'h00) $fdisplay(f,"* Reg hl2 l=%h !=00",dut.reg_file_.b2v_latch_hl2_lo.latch);
1227
   if (dut.reg_file_.b2v_latch_hl2_hi.latch!==8'h00) $fdisplay(f,"* Reg hl2 h=%h !=00",dut.reg_file_.b2v_latch_hl2_hi.latch);
1228
   if (dut.reg_file_.b2v_latch_ix_lo.latch!==8'h00) $fdisplay(f,"* Reg ix x=%h !=00",dut.reg_file_.b2v_latch_ix_lo.latch);
1229
   if (dut.reg_file_.b2v_latch_ix_hi.latch!==8'h00) $fdisplay(f,"* Reg ix i=%h !=00",dut.reg_file_.b2v_latch_ix_hi.latch);
1230
   if (dut.reg_file_.b2v_latch_iy_lo.latch!==8'h00) $fdisplay(f,"* Reg iy y=%h !=00",dut.reg_file_.b2v_latch_iy_lo.latch);
1231
   if (dut.reg_file_.b2v_latch_iy_hi.latch!==8'h00) $fdisplay(f,"* Reg iy i=%h !=00",dut.reg_file_.b2v_latch_iy_hi.latch);
1232
   if (dut.reg_file_.b2v_latch_sp_lo.latch!==8'h00) $fdisplay(f,"* Reg sp p=%h !=00",dut.reg_file_.b2v_latch_sp_lo.latch);
1233
   if (dut.reg_file_.b2v_latch_sp_hi.latch!==8'h00) $fdisplay(f,"* Reg sp s=%h !=00",dut.reg_file_.b2v_latch_sp_hi.latch);
1234
   if (pc!==16'h0002) $fdisplay(f,"* PC=%h !=0002",pc);
1235
   if (dut.reg_file_.b2v_latch_ir_lo.latch!==8'h02) $fdisplay(f,"* Reg ir r=%h !=02",dut.reg_file_.b2v_latch_ir_lo.latch);
1236
   if (dut.reg_file_.b2v_latch_ir_hi.latch!==8'h00) $fdisplay(f,"* Reg ir i=%h !=00",dut.reg_file_.b2v_latch_ir_hi.latch);
1237 13 gdevic
#1 // End opcode
1238
 
1239 8 gdevic
   force dut.ir_.ctl_ir_we=1;
1240
   force dut.ir_.db=0;
1241
#2 release dut.ir_.ctl_ir_we;
1242
   release dut.ir_.db;
1243 13 gdevic
   $fdisplay(f,"Testing opcode 8c      ADC A,H");
1244 6 gdevic
   // Preset af
1245
   force dut.reg_file_.b2v_latch_af_lo.we=1;
1246
   force dut.reg_file_.b2v_latch_af_hi.we=1;
1247
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
1248
   force dut.reg_file_.b2v_latch_af_hi.db=8'hf5;
1249
#2 release dut.reg_file_.b2v_latch_af_lo.we;
1250
   release dut.reg_file_.b2v_latch_af_hi.we;
1251
   release dut.reg_file_.b2v_latch_af_lo.db;
1252
   release dut.reg_file_.b2v_latch_af_hi.db;
1253
   // Preset bc
1254
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
1255
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
1256
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h3b;
1257
   force dut.reg_file_.b2v_latch_bc_hi.db=8'h0f;
1258
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
1259
   release dut.reg_file_.b2v_latch_bc_hi.we;
1260
   release dut.reg_file_.b2v_latch_bc_lo.db;
1261
   release dut.reg_file_.b2v_latch_bc_hi.db;
1262
   // Preset de
1263
   force dut.reg_file_.b2v_latch_de_lo.we=1;
1264
   force dut.reg_file_.b2v_latch_de_hi.we=1;
1265
   force dut.reg_file_.b2v_latch_de_lo.db=8'h0d;
1266
   force dut.reg_file_.b2v_latch_de_hi.db=8'h20;
1267
#2 release dut.reg_file_.b2v_latch_de_lo.we;
1268
   release dut.reg_file_.b2v_latch_de_hi.we;
1269
   release dut.reg_file_.b2v_latch_de_lo.db;
1270
   release dut.reg_file_.b2v_latch_de_hi.db;
1271
   // Preset hl
1272
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
1273
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
1274
   force dut.reg_file_.b2v_latch_hl_lo.db=8'ha6;
1275
   force dut.reg_file_.b2v_latch_hl_hi.db=8'hdc;
1276
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
1277
   release dut.reg_file_.b2v_latch_hl_hi.we;
1278
   release dut.reg_file_.b2v_latch_hl_lo.db;
1279
   release dut.reg_file_.b2v_latch_hl_hi.db;
1280
   // Preset af2
1281
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
1282
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
1283
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
1284
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
1285
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
1286
   release dut.reg_file_.b2v_latch_af2_hi.we;
1287
   release dut.reg_file_.b2v_latch_af2_lo.db;
1288
   release dut.reg_file_.b2v_latch_af2_hi.db;
1289
   // Preset bc2
1290
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
1291
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
1292
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
1293
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
1294
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
1295
   release dut.reg_file_.b2v_latch_bc2_hi.we;
1296
   release dut.reg_file_.b2v_latch_bc2_lo.db;
1297
   release dut.reg_file_.b2v_latch_bc2_hi.db;
1298
   // Preset de2
1299
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
1300
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
1301
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
1302
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
1303
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
1304
   release dut.reg_file_.b2v_latch_de2_hi.we;
1305
   release dut.reg_file_.b2v_latch_de2_lo.db;
1306
   release dut.reg_file_.b2v_latch_de2_hi.db;
1307
   // Preset hl2
1308
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
1309
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
1310
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
1311
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
1312
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
1313
   release dut.reg_file_.b2v_latch_hl2_hi.we;
1314
   release dut.reg_file_.b2v_latch_hl2_lo.db;
1315
   release dut.reg_file_.b2v_latch_hl2_hi.db;
1316
   // Preset ix
1317
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
1318
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
1319
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
1320
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
1321
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
1322
   release dut.reg_file_.b2v_latch_ix_hi.we;
1323
   release dut.reg_file_.b2v_latch_ix_lo.db;
1324
   release dut.reg_file_.b2v_latch_ix_hi.db;
1325
   // Preset iy
1326
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
1327
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
1328
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
1329
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
1330
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
1331
   release dut.reg_file_.b2v_latch_iy_hi.we;
1332
   release dut.reg_file_.b2v_latch_iy_lo.db;
1333
   release dut.reg_file_.b2v_latch_iy_hi.db;
1334
   // Preset sp
1335
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
1336
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
1337
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
1338
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
1339
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
1340
   release dut.reg_file_.b2v_latch_sp_hi.we;
1341
   release dut.reg_file_.b2v_latch_sp_lo.db;
1342
   release dut.reg_file_.b2v_latch_sp_hi.db;
1343
   // Preset wz
1344
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
1345
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
1346
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
1347
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
1348
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
1349
   release dut.reg_file_.b2v_latch_wz_hi.we;
1350
   release dut.reg_file_.b2v_latch_wz_lo.db;
1351
   release dut.reg_file_.b2v_latch_wz_hi.db;
1352
   // Preset pc
1353
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
1354
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
1355
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
1356
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
1357
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
1358
   release dut.reg_file_.b2v_latch_pc_hi.we;
1359
   release dut.reg_file_.b2v_latch_pc_lo.db;
1360
   release dut.reg_file_.b2v_latch_pc_hi.db;
1361
   // Preset ir
1362
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
1363
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
1364
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
1365
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
1366
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
1367
   release dut.reg_file_.b2v_latch_ir_hi.we;
1368
   release dut.reg_file_.b2v_latch_ir_lo.db;
1369
   release dut.reg_file_.b2v_latch_ir_hi.db;
1370
   // Preset memory
1371
   ram.Mem[0] = 8'h8c;
1372
   // Preset memory
1373
   ram.Mem[56486] = 8'h49;
1374
   force dut.z80_top_ifc_n.fpga_reset=0;
1375 8 gdevic
   force dut.address_latch_.Q=16'h0000;
1376 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
1377
   release dut.reg_file_.reg_gp_we;
1378 13 gdevic
#2 // Execute: M1/T1 start
1379
#1 release dut.address_latch_.Q;
1380 6 gdevic
#1
1381 13 gdevic
#6 // Wait for opcode end
1382 6 gdevic
   force dut.reg_control_.ctl_reg_sys_we=0;
1383
#2 pc=z.A;
1384
#2
1385
#1 force dut.reg_file_.reg_gp_we=0;
1386
   force dut.z80_top_ifc_n.fpga_reset=1;
1387
   if (dut.reg_file_.b2v_latch_af_lo.latch!==8'h91) $fdisplay(f,"* Reg af f=%h !=91",dut.reg_file_.b2v_latch_af_lo.latch);
1388
   if (dut.reg_file_.b2v_latch_af_hi.latch!==8'hd1) $fdisplay(f,"* Reg af a=%h !=d1",dut.reg_file_.b2v_latch_af_hi.latch);
1389
   if (dut.reg_file_.b2v_latch_bc_lo.latch!==8'h3b) $fdisplay(f,"* Reg bc c=%h !=3b",dut.reg_file_.b2v_latch_bc_lo.latch);
1390
   if (dut.reg_file_.b2v_latch_bc_hi.latch!==8'h0f) $fdisplay(f,"* Reg bc b=%h !=0f",dut.reg_file_.b2v_latch_bc_hi.latch);
1391
   if (dut.reg_file_.b2v_latch_de_lo.latch!==8'h0d) $fdisplay(f,"* Reg de e=%h !=0d",dut.reg_file_.b2v_latch_de_lo.latch);
1392
   if (dut.reg_file_.b2v_latch_de_hi.latch!==8'h20) $fdisplay(f,"* Reg de d=%h !=20",dut.reg_file_.b2v_latch_de_hi.latch);
1393
   if (dut.reg_file_.b2v_latch_hl_lo.latch!==8'ha6) $fdisplay(f,"* Reg hl l=%h !=a6",dut.reg_file_.b2v_latch_hl_lo.latch);
1394
   if (dut.reg_file_.b2v_latch_hl_hi.latch!==8'hdc) $fdisplay(f,"* Reg hl h=%h !=dc",dut.reg_file_.b2v_latch_hl_hi.latch);
1395
   if (dut.reg_file_.b2v_latch_af2_lo.latch!==8'h00) $fdisplay(f,"* Reg af2 f=%h !=00",dut.reg_file_.b2v_latch_af2_lo.latch);
1396
   if (dut.reg_file_.b2v_latch_af2_hi.latch!==8'h00) $fdisplay(f,"* Reg af2 a=%h !=00",dut.reg_file_.b2v_latch_af2_hi.latch);
1397
   if (dut.reg_file_.b2v_latch_bc2_lo.latch!==8'h00) $fdisplay(f,"* Reg bc2 c=%h !=00",dut.reg_file_.b2v_latch_bc2_lo.latch);
1398
   if (dut.reg_file_.b2v_latch_bc2_hi.latch!==8'h00) $fdisplay(f,"* Reg bc2 b=%h !=00",dut.reg_file_.b2v_latch_bc2_hi.latch);
1399
   if (dut.reg_file_.b2v_latch_de2_lo.latch!==8'h00) $fdisplay(f,"* Reg de2 e=%h !=00",dut.reg_file_.b2v_latch_de2_lo.latch);
1400
   if (dut.reg_file_.b2v_latch_de2_hi.latch!==8'h00) $fdisplay(f,"* Reg de2 d=%h !=00",dut.reg_file_.b2v_latch_de2_hi.latch);
1401
   if (dut.reg_file_.b2v_latch_hl2_lo.latch!==8'h00) $fdisplay(f,"* Reg hl2 l=%h !=00",dut.reg_file_.b2v_latch_hl2_lo.latch);
1402
   if (dut.reg_file_.b2v_latch_hl2_hi.latch!==8'h00) $fdisplay(f,"* Reg hl2 h=%h !=00",dut.reg_file_.b2v_latch_hl2_hi.latch);
1403
   if (dut.reg_file_.b2v_latch_ix_lo.latch!==8'h00) $fdisplay(f,"* Reg ix x=%h !=00",dut.reg_file_.b2v_latch_ix_lo.latch);
1404
   if (dut.reg_file_.b2v_latch_ix_hi.latch!==8'h00) $fdisplay(f,"* Reg ix i=%h !=00",dut.reg_file_.b2v_latch_ix_hi.latch);
1405
   if (dut.reg_file_.b2v_latch_iy_lo.latch!==8'h00) $fdisplay(f,"* Reg iy y=%h !=00",dut.reg_file_.b2v_latch_iy_lo.latch);
1406
   if (dut.reg_file_.b2v_latch_iy_hi.latch!==8'h00) $fdisplay(f,"* Reg iy i=%h !=00",dut.reg_file_.b2v_latch_iy_hi.latch);
1407
   if (dut.reg_file_.b2v_latch_sp_lo.latch!==8'h00) $fdisplay(f,"* Reg sp p=%h !=00",dut.reg_file_.b2v_latch_sp_lo.latch);
1408
   if (dut.reg_file_.b2v_latch_sp_hi.latch!==8'h00) $fdisplay(f,"* Reg sp s=%h !=00",dut.reg_file_.b2v_latch_sp_hi.latch);
1409
   if (pc!==16'h0001) $fdisplay(f,"* PC=%h !=0001",pc);
1410
   if (dut.reg_file_.b2v_latch_ir_lo.latch!==8'h01) $fdisplay(f,"* Reg ir r=%h !=01",dut.reg_file_.b2v_latch_ir_lo.latch);
1411
   if (dut.reg_file_.b2v_latch_ir_hi.latch!==8'h00) $fdisplay(f,"* Reg ir i=%h !=00",dut.reg_file_.b2v_latch_ir_hi.latch);
1412 13 gdevic
#1 // End opcode
1413
 
1414 8 gdevic
   force dut.ir_.ctl_ir_we=1;
1415
   force dut.ir_.db=0;
1416
#2 release dut.ir_.ctl_ir_we;
1417
   release dut.ir_.db;
1418 13 gdevic
   $fdisplay(f,"Testing opcode 92      SUB D");
1419 6 gdevic
   // Preset af
1420
   force dut.reg_file_.b2v_latch_af_lo.we=1;
1421
   force dut.reg_file_.b2v_latch_af_hi.we=1;
1422
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
1423
   force dut.reg_file_.b2v_latch_af_hi.db=8'hf5;
1424
#2 release dut.reg_file_.b2v_latch_af_lo.we;
1425
   release dut.reg_file_.b2v_latch_af_hi.we;
1426
   release dut.reg_file_.b2v_latch_af_lo.db;
1427
   release dut.reg_file_.b2v_latch_af_hi.db;
1428
   // Preset bc
1429
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
1430
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
1431
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h3b;
1432
   force dut.reg_file_.b2v_latch_bc_hi.db=8'h0f;
1433
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
1434
   release dut.reg_file_.b2v_latch_bc_hi.we;
1435
   release dut.reg_file_.b2v_latch_bc_lo.db;
1436
   release dut.reg_file_.b2v_latch_bc_hi.db;
1437
   // Preset de
1438
   force dut.reg_file_.b2v_latch_de_lo.we=1;
1439
   force dut.reg_file_.b2v_latch_de_hi.we=1;
1440
   force dut.reg_file_.b2v_latch_de_lo.db=8'h0d;
1441
   force dut.reg_file_.b2v_latch_de_hi.db=8'h20;
1442
#2 release dut.reg_file_.b2v_latch_de_lo.we;
1443
   release dut.reg_file_.b2v_latch_de_hi.we;
1444
   release dut.reg_file_.b2v_latch_de_lo.db;
1445
   release dut.reg_file_.b2v_latch_de_hi.db;
1446
   // Preset hl
1447
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
1448
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
1449
   force dut.reg_file_.b2v_latch_hl_lo.db=8'ha6;
1450
   force dut.reg_file_.b2v_latch_hl_hi.db=8'hdc;
1451
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
1452
   release dut.reg_file_.b2v_latch_hl_hi.we;
1453
   release dut.reg_file_.b2v_latch_hl_lo.db;
1454
   release dut.reg_file_.b2v_latch_hl_hi.db;
1455
   // Preset af2
1456
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
1457
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
1458
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
1459
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
1460
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
1461
   release dut.reg_file_.b2v_latch_af2_hi.we;
1462
   release dut.reg_file_.b2v_latch_af2_lo.db;
1463
   release dut.reg_file_.b2v_latch_af2_hi.db;
1464
   // Preset bc2
1465
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
1466
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
1467
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
1468
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
1469
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
1470
   release dut.reg_file_.b2v_latch_bc2_hi.we;
1471
   release dut.reg_file_.b2v_latch_bc2_lo.db;
1472
   release dut.reg_file_.b2v_latch_bc2_hi.db;
1473
   // Preset de2
1474
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
1475
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
1476
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
1477
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
1478
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
1479
   release dut.reg_file_.b2v_latch_de2_hi.we;
1480
   release dut.reg_file_.b2v_latch_de2_lo.db;
1481
   release dut.reg_file_.b2v_latch_de2_hi.db;
1482
   // Preset hl2
1483
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
1484
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
1485
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
1486
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
1487
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
1488
   release dut.reg_file_.b2v_latch_hl2_hi.we;
1489
   release dut.reg_file_.b2v_latch_hl2_lo.db;
1490
   release dut.reg_file_.b2v_latch_hl2_hi.db;
1491
   // Preset ix
1492
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
1493
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
1494
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
1495
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
1496
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
1497
   release dut.reg_file_.b2v_latch_ix_hi.we;
1498
   release dut.reg_file_.b2v_latch_ix_lo.db;
1499
   release dut.reg_file_.b2v_latch_ix_hi.db;
1500
   // Preset iy
1501
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
1502
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
1503
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
1504
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
1505
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
1506
   release dut.reg_file_.b2v_latch_iy_hi.we;
1507
   release dut.reg_file_.b2v_latch_iy_lo.db;
1508
   release dut.reg_file_.b2v_latch_iy_hi.db;
1509
   // Preset sp
1510
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
1511
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
1512
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
1513
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
1514
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
1515
   release dut.reg_file_.b2v_latch_sp_hi.we;
1516
   release dut.reg_file_.b2v_latch_sp_lo.db;
1517
   release dut.reg_file_.b2v_latch_sp_hi.db;
1518
   // Preset wz
1519
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
1520
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
1521
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
1522
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
1523
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
1524
   release dut.reg_file_.b2v_latch_wz_hi.we;
1525
   release dut.reg_file_.b2v_latch_wz_lo.db;
1526
   release dut.reg_file_.b2v_latch_wz_hi.db;
1527
   // Preset pc
1528
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
1529
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
1530
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
1531
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
1532
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
1533
   release dut.reg_file_.b2v_latch_pc_hi.we;
1534
   release dut.reg_file_.b2v_latch_pc_lo.db;
1535
   release dut.reg_file_.b2v_latch_pc_hi.db;
1536
   // Preset ir
1537
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
1538
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
1539
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
1540
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
1541
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
1542
   release dut.reg_file_.b2v_latch_ir_hi.we;
1543
   release dut.reg_file_.b2v_latch_ir_lo.db;
1544
   release dut.reg_file_.b2v_latch_ir_hi.db;
1545
   // Preset memory
1546
   ram.Mem[0] = 8'h92;
1547
   // Preset memory
1548
   ram.Mem[56486] = 8'h49;
1549
   force dut.z80_top_ifc_n.fpga_reset=0;
1550 8 gdevic
   force dut.address_latch_.Q=16'h0000;
1551 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
1552
   release dut.reg_file_.reg_gp_we;
1553 13 gdevic
#2 // Execute: M1/T1 start
1554
#1 release dut.address_latch_.Q;
1555 6 gdevic
#1
1556 13 gdevic
#6 // Wait for opcode end
1557 6 gdevic
   force dut.reg_control_.ctl_reg_sys_we=0;
1558
#2 pc=z.A;
1559
#2
1560
#1 force dut.reg_file_.reg_gp_we=0;
1561
   force dut.z80_top_ifc_n.fpga_reset=1;
1562
   if (dut.reg_file_.b2v_latch_af_lo.latch!==8'h82) $fdisplay(f,"* Reg af f=%h !=82",dut.reg_file_.b2v_latch_af_lo.latch);
1563
   if (dut.reg_file_.b2v_latch_af_hi.latch!==8'hd5) $fdisplay(f,"* Reg af a=%h !=d5",dut.reg_file_.b2v_latch_af_hi.latch);
1564
   if (dut.reg_file_.b2v_latch_bc_lo.latch!==8'h3b) $fdisplay(f,"* Reg bc c=%h !=3b",dut.reg_file_.b2v_latch_bc_lo.latch);
1565
   if (dut.reg_file_.b2v_latch_bc_hi.latch!==8'h0f) $fdisplay(f,"* Reg bc b=%h !=0f",dut.reg_file_.b2v_latch_bc_hi.latch);
1566
   if (dut.reg_file_.b2v_latch_de_lo.latch!==8'h0d) $fdisplay(f,"* Reg de e=%h !=0d",dut.reg_file_.b2v_latch_de_lo.latch);
1567
   if (dut.reg_file_.b2v_latch_de_hi.latch!==8'h20) $fdisplay(f,"* Reg de d=%h !=20",dut.reg_file_.b2v_latch_de_hi.latch);
1568
   if (dut.reg_file_.b2v_latch_hl_lo.latch!==8'ha6) $fdisplay(f,"* Reg hl l=%h !=a6",dut.reg_file_.b2v_latch_hl_lo.latch);
1569
   if (dut.reg_file_.b2v_latch_hl_hi.latch!==8'hdc) $fdisplay(f,"* Reg hl h=%h !=dc",dut.reg_file_.b2v_latch_hl_hi.latch);
1570
   if (dut.reg_file_.b2v_latch_af2_lo.latch!==8'h00) $fdisplay(f,"* Reg af2 f=%h !=00",dut.reg_file_.b2v_latch_af2_lo.latch);
1571
   if (dut.reg_file_.b2v_latch_af2_hi.latch!==8'h00) $fdisplay(f,"* Reg af2 a=%h !=00",dut.reg_file_.b2v_latch_af2_hi.latch);
1572
   if (dut.reg_file_.b2v_latch_bc2_lo.latch!==8'h00) $fdisplay(f,"* Reg bc2 c=%h !=00",dut.reg_file_.b2v_latch_bc2_lo.latch);
1573
   if (dut.reg_file_.b2v_latch_bc2_hi.latch!==8'h00) $fdisplay(f,"* Reg bc2 b=%h !=00",dut.reg_file_.b2v_latch_bc2_hi.latch);
1574
   if (dut.reg_file_.b2v_latch_de2_lo.latch!==8'h00) $fdisplay(f,"* Reg de2 e=%h !=00",dut.reg_file_.b2v_latch_de2_lo.latch);
1575
   if (dut.reg_file_.b2v_latch_de2_hi.latch!==8'h00) $fdisplay(f,"* Reg de2 d=%h !=00",dut.reg_file_.b2v_latch_de2_hi.latch);
1576
   if (dut.reg_file_.b2v_latch_hl2_lo.latch!==8'h00) $fdisplay(f,"* Reg hl2 l=%h !=00",dut.reg_file_.b2v_latch_hl2_lo.latch);
1577
   if (dut.reg_file_.b2v_latch_hl2_hi.latch!==8'h00) $fdisplay(f,"* Reg hl2 h=%h !=00",dut.reg_file_.b2v_latch_hl2_hi.latch);
1578
   if (dut.reg_file_.b2v_latch_ix_lo.latch!==8'h00) $fdisplay(f,"* Reg ix x=%h !=00",dut.reg_file_.b2v_latch_ix_lo.latch);
1579
   if (dut.reg_file_.b2v_latch_ix_hi.latch!==8'h00) $fdisplay(f,"* Reg ix i=%h !=00",dut.reg_file_.b2v_latch_ix_hi.latch);
1580
   if (dut.reg_file_.b2v_latch_iy_lo.latch!==8'h00) $fdisplay(f,"* Reg iy y=%h !=00",dut.reg_file_.b2v_latch_iy_lo.latch);
1581
   if (dut.reg_file_.b2v_latch_iy_hi.latch!==8'h00) $fdisplay(f,"* Reg iy i=%h !=00",dut.reg_file_.b2v_latch_iy_hi.latch);
1582
   if (dut.reg_file_.b2v_latch_sp_lo.latch!==8'h00) $fdisplay(f,"* Reg sp p=%h !=00",dut.reg_file_.b2v_latch_sp_lo.latch);
1583
   if (dut.reg_file_.b2v_latch_sp_hi.latch!==8'h00) $fdisplay(f,"* Reg sp s=%h !=00",dut.reg_file_.b2v_latch_sp_hi.latch);
1584
   if (pc!==16'h0001) $fdisplay(f,"* PC=%h !=0001",pc);
1585
   if (dut.reg_file_.b2v_latch_ir_lo.latch!==8'h01) $fdisplay(f,"* Reg ir r=%h !=01",dut.reg_file_.b2v_latch_ir_lo.latch);
1586
   if (dut.reg_file_.b2v_latch_ir_hi.latch!==8'h00) $fdisplay(f,"* Reg ir i=%h !=00",dut.reg_file_.b2v_latch_ir_hi.latch);
1587 13 gdevic
#1 // End opcode
1588
 
1589 8 gdevic
   force dut.ir_.ctl_ir_we=1;
1590
   force dut.ir_.db=0;
1591
#2 release dut.ir_.ctl_ir_we;
1592
   release dut.ir_.db;
1593 13 gdevic
   $fdisplay(f,"Testing opcode 9d      SBC A,L");
1594 6 gdevic
   // Preset af
1595
   force dut.reg_file_.b2v_latch_af_lo.we=1;
1596
   force dut.reg_file_.b2v_latch_af_hi.we=1;
1597
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
1598
   force dut.reg_file_.b2v_latch_af_hi.db=8'hf5;
1599
#2 release dut.reg_file_.b2v_latch_af_lo.we;
1600
   release dut.reg_file_.b2v_latch_af_hi.we;
1601
   release dut.reg_file_.b2v_latch_af_lo.db;
1602
   release dut.reg_file_.b2v_latch_af_hi.db;
1603
   // Preset bc
1604
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
1605
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
1606
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h3b;
1607
   force dut.reg_file_.b2v_latch_bc_hi.db=8'h0f;
1608
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
1609
   release dut.reg_file_.b2v_latch_bc_hi.we;
1610
   release dut.reg_file_.b2v_latch_bc_lo.db;
1611
   release dut.reg_file_.b2v_latch_bc_hi.db;
1612
   // Preset de
1613
   force dut.reg_file_.b2v_latch_de_lo.we=1;
1614
   force dut.reg_file_.b2v_latch_de_hi.we=1;
1615
   force dut.reg_file_.b2v_latch_de_lo.db=8'h0d;
1616
   force dut.reg_file_.b2v_latch_de_hi.db=8'h20;
1617
#2 release dut.reg_file_.b2v_latch_de_lo.we;
1618
   release dut.reg_file_.b2v_latch_de_hi.we;
1619
   release dut.reg_file_.b2v_latch_de_lo.db;
1620
   release dut.reg_file_.b2v_latch_de_hi.db;
1621
   // Preset hl
1622
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
1623
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
1624
   force dut.reg_file_.b2v_latch_hl_lo.db=8'ha6;
1625
   force dut.reg_file_.b2v_latch_hl_hi.db=8'hdc;
1626
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
1627
   release dut.reg_file_.b2v_latch_hl_hi.we;
1628
   release dut.reg_file_.b2v_latch_hl_lo.db;
1629
   release dut.reg_file_.b2v_latch_hl_hi.db;
1630
   // Preset af2
1631
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
1632
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
1633
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
1634
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
1635
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
1636
   release dut.reg_file_.b2v_latch_af2_hi.we;
1637
   release dut.reg_file_.b2v_latch_af2_lo.db;
1638
   release dut.reg_file_.b2v_latch_af2_hi.db;
1639
   // Preset bc2
1640
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
1641
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
1642
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
1643
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
1644
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
1645
   release dut.reg_file_.b2v_latch_bc2_hi.we;
1646
   release dut.reg_file_.b2v_latch_bc2_lo.db;
1647
   release dut.reg_file_.b2v_latch_bc2_hi.db;
1648
   // Preset de2
1649
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
1650
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
1651
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
1652
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
1653
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
1654
   release dut.reg_file_.b2v_latch_de2_hi.we;
1655
   release dut.reg_file_.b2v_latch_de2_lo.db;
1656
   release dut.reg_file_.b2v_latch_de2_hi.db;
1657
   // Preset hl2
1658
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
1659
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
1660
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
1661
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
1662
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
1663
   release dut.reg_file_.b2v_latch_hl2_hi.we;
1664
   release dut.reg_file_.b2v_latch_hl2_lo.db;
1665
   release dut.reg_file_.b2v_latch_hl2_hi.db;
1666
   // Preset ix
1667
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
1668
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
1669
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
1670
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
1671
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
1672
   release dut.reg_file_.b2v_latch_ix_hi.we;
1673
   release dut.reg_file_.b2v_latch_ix_lo.db;
1674
   release dut.reg_file_.b2v_latch_ix_hi.db;
1675
   // Preset iy
1676
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
1677
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
1678
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
1679
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
1680
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
1681
   release dut.reg_file_.b2v_latch_iy_hi.we;
1682
   release dut.reg_file_.b2v_latch_iy_lo.db;
1683
   release dut.reg_file_.b2v_latch_iy_hi.db;
1684
   // Preset sp
1685
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
1686
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
1687
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
1688
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
1689
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
1690
   release dut.reg_file_.b2v_latch_sp_hi.we;
1691
   release dut.reg_file_.b2v_latch_sp_lo.db;
1692
   release dut.reg_file_.b2v_latch_sp_hi.db;
1693
   // Preset wz
1694
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
1695
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
1696
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
1697
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
1698
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
1699
   release dut.reg_file_.b2v_latch_wz_hi.we;
1700
   release dut.reg_file_.b2v_latch_wz_lo.db;
1701
   release dut.reg_file_.b2v_latch_wz_hi.db;
1702
   // Preset pc
1703
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
1704
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
1705
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
1706
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
1707
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
1708
   release dut.reg_file_.b2v_latch_pc_hi.we;
1709
   release dut.reg_file_.b2v_latch_pc_lo.db;
1710
   release dut.reg_file_.b2v_latch_pc_hi.db;
1711
   // Preset ir
1712
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
1713
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
1714
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
1715
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
1716
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
1717
   release dut.reg_file_.b2v_latch_ir_hi.we;
1718
   release dut.reg_file_.b2v_latch_ir_lo.db;
1719
   release dut.reg_file_.b2v_latch_ir_hi.db;
1720
   // Preset memory
1721
   ram.Mem[0] = 8'h9d;
1722
   // Preset memory
1723
   ram.Mem[56486] = 8'h49;
1724
   force dut.z80_top_ifc_n.fpga_reset=0;
1725 8 gdevic
   force dut.address_latch_.Q=16'h0000;
1726 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
1727
   release dut.reg_file_.reg_gp_we;
1728 13 gdevic
#2 // Execute: M1/T1 start
1729
#1 release dut.address_latch_.Q;
1730 6 gdevic
#1
1731 13 gdevic
#6 // Wait for opcode end
1732 6 gdevic
   force dut.reg_control_.ctl_reg_sys_we=0;
1733
#2 pc=z.A;
1734
#2
1735
#1 force dut.reg_file_.reg_gp_we=0;
1736
   force dut.z80_top_ifc_n.fpga_reset=1;
1737
   if (dut.reg_file_.b2v_latch_af_lo.latch!==8'h1a) $fdisplay(f,"* Reg af f=%h !=1a",dut.reg_file_.b2v_latch_af_lo.latch);
1738
   if (dut.reg_file_.b2v_latch_af_hi.latch!==8'h4f) $fdisplay(f,"* Reg af a=%h !=4f",dut.reg_file_.b2v_latch_af_hi.latch);
1739
   if (dut.reg_file_.b2v_latch_bc_lo.latch!==8'h3b) $fdisplay(f,"* Reg bc c=%h !=3b",dut.reg_file_.b2v_latch_bc_lo.latch);
1740
   if (dut.reg_file_.b2v_latch_bc_hi.latch!==8'h0f) $fdisplay(f,"* Reg bc b=%h !=0f",dut.reg_file_.b2v_latch_bc_hi.latch);
1741
   if (dut.reg_file_.b2v_latch_de_lo.latch!==8'h0d) $fdisplay(f,"* Reg de e=%h !=0d",dut.reg_file_.b2v_latch_de_lo.latch);
1742
   if (dut.reg_file_.b2v_latch_de_hi.latch!==8'h20) $fdisplay(f,"* Reg de d=%h !=20",dut.reg_file_.b2v_latch_de_hi.latch);
1743
   if (dut.reg_file_.b2v_latch_hl_lo.latch!==8'ha6) $fdisplay(f,"* Reg hl l=%h !=a6",dut.reg_file_.b2v_latch_hl_lo.latch);
1744
   if (dut.reg_file_.b2v_latch_hl_hi.latch!==8'hdc) $fdisplay(f,"* Reg hl h=%h !=dc",dut.reg_file_.b2v_latch_hl_hi.latch);
1745
   if (dut.reg_file_.b2v_latch_af2_lo.latch!==8'h00) $fdisplay(f,"* Reg af2 f=%h !=00",dut.reg_file_.b2v_latch_af2_lo.latch);
1746
   if (dut.reg_file_.b2v_latch_af2_hi.latch!==8'h00) $fdisplay(f,"* Reg af2 a=%h !=00",dut.reg_file_.b2v_latch_af2_hi.latch);
1747
   if (dut.reg_file_.b2v_latch_bc2_lo.latch!==8'h00) $fdisplay(f,"* Reg bc2 c=%h !=00",dut.reg_file_.b2v_latch_bc2_lo.latch);
1748
   if (dut.reg_file_.b2v_latch_bc2_hi.latch!==8'h00) $fdisplay(f,"* Reg bc2 b=%h !=00",dut.reg_file_.b2v_latch_bc2_hi.latch);
1749
   if (dut.reg_file_.b2v_latch_de2_lo.latch!==8'h00) $fdisplay(f,"* Reg de2 e=%h !=00",dut.reg_file_.b2v_latch_de2_lo.latch);
1750
   if (dut.reg_file_.b2v_latch_de2_hi.latch!==8'h00) $fdisplay(f,"* Reg de2 d=%h !=00",dut.reg_file_.b2v_latch_de2_hi.latch);
1751
   if (dut.reg_file_.b2v_latch_hl2_lo.latch!==8'h00) $fdisplay(f,"* Reg hl2 l=%h !=00",dut.reg_file_.b2v_latch_hl2_lo.latch);
1752
   if (dut.reg_file_.b2v_latch_hl2_hi.latch!==8'h00) $fdisplay(f,"* Reg hl2 h=%h !=00",dut.reg_file_.b2v_latch_hl2_hi.latch);
1753
   if (dut.reg_file_.b2v_latch_ix_lo.latch!==8'h00) $fdisplay(f,"* Reg ix x=%h !=00",dut.reg_file_.b2v_latch_ix_lo.latch);
1754
   if (dut.reg_file_.b2v_latch_ix_hi.latch!==8'h00) $fdisplay(f,"* Reg ix i=%h !=00",dut.reg_file_.b2v_latch_ix_hi.latch);
1755
   if (dut.reg_file_.b2v_latch_iy_lo.latch!==8'h00) $fdisplay(f,"* Reg iy y=%h !=00",dut.reg_file_.b2v_latch_iy_lo.latch);
1756
   if (dut.reg_file_.b2v_latch_iy_hi.latch!==8'h00) $fdisplay(f,"* Reg iy i=%h !=00",dut.reg_file_.b2v_latch_iy_hi.latch);
1757
   if (dut.reg_file_.b2v_latch_sp_lo.latch!==8'h00) $fdisplay(f,"* Reg sp p=%h !=00",dut.reg_file_.b2v_latch_sp_lo.latch);
1758
   if (dut.reg_file_.b2v_latch_sp_hi.latch!==8'h00) $fdisplay(f,"* Reg sp s=%h !=00",dut.reg_file_.b2v_latch_sp_hi.latch);
1759
   if (pc!==16'h0001) $fdisplay(f,"* PC=%h !=0001",pc);
1760
   if (dut.reg_file_.b2v_latch_ir_lo.latch!==8'h01) $fdisplay(f,"* Reg ir r=%h !=01",dut.reg_file_.b2v_latch_ir_lo.latch);
1761
   if (dut.reg_file_.b2v_latch_ir_hi.latch!==8'h00) $fdisplay(f,"* Reg ir i=%h !=00",dut.reg_file_.b2v_latch_ir_hi.latch);
1762 13 gdevic
#1 // End opcode
1763
 
1764 8 gdevic
   force dut.ir_.ctl_ir_we=1;
1765
   force dut.ir_.db=0;
1766
#2 release dut.ir_.ctl_ir_we;
1767
   release dut.ir_.db;
1768 13 gdevic
   $fdisplay(f,"Testing opcode a3      AND E");
1769 6 gdevic
   // Preset af
1770
   force dut.reg_file_.b2v_latch_af_lo.we=1;
1771
   force dut.reg_file_.b2v_latch_af_hi.we=1;
1772
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
1773
   force dut.reg_file_.b2v_latch_af_hi.db=8'hf5;
1774
#2 release dut.reg_file_.b2v_latch_af_lo.we;
1775
   release dut.reg_file_.b2v_latch_af_hi.we;
1776
   release dut.reg_file_.b2v_latch_af_lo.db;
1777
   release dut.reg_file_.b2v_latch_af_hi.db;
1778
   // Preset bc
1779
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
1780
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
1781
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h3b;
1782
   force dut.reg_file_.b2v_latch_bc_hi.db=8'h0f;
1783
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
1784
   release dut.reg_file_.b2v_latch_bc_hi.we;
1785
   release dut.reg_file_.b2v_latch_bc_lo.db;
1786
   release dut.reg_file_.b2v_latch_bc_hi.db;
1787
   // Preset de
1788
   force dut.reg_file_.b2v_latch_de_lo.we=1;
1789
   force dut.reg_file_.b2v_latch_de_hi.we=1;
1790
   force dut.reg_file_.b2v_latch_de_lo.db=8'h0d;
1791
   force dut.reg_file_.b2v_latch_de_hi.db=8'h20;
1792
#2 release dut.reg_file_.b2v_latch_de_lo.we;
1793
   release dut.reg_file_.b2v_latch_de_hi.we;
1794
   release dut.reg_file_.b2v_latch_de_lo.db;
1795
   release dut.reg_file_.b2v_latch_de_hi.db;
1796
   // Preset hl
1797
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
1798
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
1799
   force dut.reg_file_.b2v_latch_hl_lo.db=8'ha6;
1800
   force dut.reg_file_.b2v_latch_hl_hi.db=8'hdc;
1801
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
1802
   release dut.reg_file_.b2v_latch_hl_hi.we;
1803
   release dut.reg_file_.b2v_latch_hl_lo.db;
1804
   release dut.reg_file_.b2v_latch_hl_hi.db;
1805
   // Preset af2
1806
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
1807
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
1808
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
1809
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
1810
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
1811
   release dut.reg_file_.b2v_latch_af2_hi.we;
1812
   release dut.reg_file_.b2v_latch_af2_lo.db;
1813
   release dut.reg_file_.b2v_latch_af2_hi.db;
1814
   // Preset bc2
1815
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
1816
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
1817
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
1818
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
1819
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
1820
   release dut.reg_file_.b2v_latch_bc2_hi.we;
1821
   release dut.reg_file_.b2v_latch_bc2_lo.db;
1822
   release dut.reg_file_.b2v_latch_bc2_hi.db;
1823
   // Preset de2
1824
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
1825
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
1826
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
1827
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
1828
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
1829
   release dut.reg_file_.b2v_latch_de2_hi.we;
1830
   release dut.reg_file_.b2v_latch_de2_lo.db;
1831
   release dut.reg_file_.b2v_latch_de2_hi.db;
1832
   // Preset hl2
1833
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
1834
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
1835
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
1836
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
1837
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
1838
   release dut.reg_file_.b2v_latch_hl2_hi.we;
1839
   release dut.reg_file_.b2v_latch_hl2_lo.db;
1840
   release dut.reg_file_.b2v_latch_hl2_hi.db;
1841
   // Preset ix
1842
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
1843
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
1844
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
1845
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
1846
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
1847
   release dut.reg_file_.b2v_latch_ix_hi.we;
1848
   release dut.reg_file_.b2v_latch_ix_lo.db;
1849
   release dut.reg_file_.b2v_latch_ix_hi.db;
1850
   // Preset iy
1851
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
1852
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
1853
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
1854
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
1855
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
1856
   release dut.reg_file_.b2v_latch_iy_hi.we;
1857
   release dut.reg_file_.b2v_latch_iy_lo.db;
1858
   release dut.reg_file_.b2v_latch_iy_hi.db;
1859
   // Preset sp
1860
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
1861
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
1862
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
1863
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
1864
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
1865
   release dut.reg_file_.b2v_latch_sp_hi.we;
1866
   release dut.reg_file_.b2v_latch_sp_lo.db;
1867
   release dut.reg_file_.b2v_latch_sp_hi.db;
1868
   // Preset wz
1869
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
1870
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
1871
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
1872
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
1873
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
1874
   release dut.reg_file_.b2v_latch_wz_hi.we;
1875
   release dut.reg_file_.b2v_latch_wz_lo.db;
1876
   release dut.reg_file_.b2v_latch_wz_hi.db;
1877
   // Preset pc
1878
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
1879
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
1880
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
1881
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
1882
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
1883
   release dut.reg_file_.b2v_latch_pc_hi.we;
1884
   release dut.reg_file_.b2v_latch_pc_lo.db;
1885
   release dut.reg_file_.b2v_latch_pc_hi.db;
1886
   // Preset ir
1887
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
1888
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
1889
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
1890
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
1891
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
1892
   release dut.reg_file_.b2v_latch_ir_hi.we;
1893
   release dut.reg_file_.b2v_latch_ir_lo.db;
1894
   release dut.reg_file_.b2v_latch_ir_hi.db;
1895
   // Preset memory
1896
   ram.Mem[0] = 8'ha3;
1897
   // Preset memory
1898
   ram.Mem[56486] = 8'h49;
1899
   force dut.z80_top_ifc_n.fpga_reset=0;
1900 8 gdevic
   force dut.address_latch_.Q=16'h0000;
1901 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
1902
   release dut.reg_file_.reg_gp_we;
1903 13 gdevic
#2 // Execute: M1/T1 start
1904
#1 release dut.address_latch_.Q;
1905 6 gdevic
#1
1906 13 gdevic
#6 // Wait for opcode end
1907 6 gdevic
   force dut.reg_control_.ctl_reg_sys_we=0;
1908
#2 pc=z.A;
1909
#2
1910
#1 force dut.reg_file_.reg_gp_we=0;
1911
   force dut.z80_top_ifc_n.fpga_reset=1;
1912
   if (dut.reg_file_.b2v_latch_af_lo.latch!==8'h14) $fdisplay(f,"* Reg af f=%h !=14",dut.reg_file_.b2v_latch_af_lo.latch);
1913
   if (dut.reg_file_.b2v_latch_af_hi.latch!==8'h05) $fdisplay(f,"* Reg af a=%h !=05",dut.reg_file_.b2v_latch_af_hi.latch);
1914
   if (dut.reg_file_.b2v_latch_bc_lo.latch!==8'h3b) $fdisplay(f,"* Reg bc c=%h !=3b",dut.reg_file_.b2v_latch_bc_lo.latch);
1915
   if (dut.reg_file_.b2v_latch_bc_hi.latch!==8'h0f) $fdisplay(f,"* Reg bc b=%h !=0f",dut.reg_file_.b2v_latch_bc_hi.latch);
1916
   if (dut.reg_file_.b2v_latch_de_lo.latch!==8'h0d) $fdisplay(f,"* Reg de e=%h !=0d",dut.reg_file_.b2v_latch_de_lo.latch);
1917
   if (dut.reg_file_.b2v_latch_de_hi.latch!==8'h20) $fdisplay(f,"* Reg de d=%h !=20",dut.reg_file_.b2v_latch_de_hi.latch);
1918
   if (dut.reg_file_.b2v_latch_hl_lo.latch!==8'ha6) $fdisplay(f,"* Reg hl l=%h !=a6",dut.reg_file_.b2v_latch_hl_lo.latch);
1919
   if (dut.reg_file_.b2v_latch_hl_hi.latch!==8'hdc) $fdisplay(f,"* Reg hl h=%h !=dc",dut.reg_file_.b2v_latch_hl_hi.latch);
1920
   if (dut.reg_file_.b2v_latch_af2_lo.latch!==8'h00) $fdisplay(f,"* Reg af2 f=%h !=00",dut.reg_file_.b2v_latch_af2_lo.latch);
1921
   if (dut.reg_file_.b2v_latch_af2_hi.latch!==8'h00) $fdisplay(f,"* Reg af2 a=%h !=00",dut.reg_file_.b2v_latch_af2_hi.latch);
1922
   if (dut.reg_file_.b2v_latch_bc2_lo.latch!==8'h00) $fdisplay(f,"* Reg bc2 c=%h !=00",dut.reg_file_.b2v_latch_bc2_lo.latch);
1923
   if (dut.reg_file_.b2v_latch_bc2_hi.latch!==8'h00) $fdisplay(f,"* Reg bc2 b=%h !=00",dut.reg_file_.b2v_latch_bc2_hi.latch);
1924
   if (dut.reg_file_.b2v_latch_de2_lo.latch!==8'h00) $fdisplay(f,"* Reg de2 e=%h !=00",dut.reg_file_.b2v_latch_de2_lo.latch);
1925
   if (dut.reg_file_.b2v_latch_de2_hi.latch!==8'h00) $fdisplay(f,"* Reg de2 d=%h !=00",dut.reg_file_.b2v_latch_de2_hi.latch);
1926
   if (dut.reg_file_.b2v_latch_hl2_lo.latch!==8'h00) $fdisplay(f,"* Reg hl2 l=%h !=00",dut.reg_file_.b2v_latch_hl2_lo.latch);
1927
   if (dut.reg_file_.b2v_latch_hl2_hi.latch!==8'h00) $fdisplay(f,"* Reg hl2 h=%h !=00",dut.reg_file_.b2v_latch_hl2_hi.latch);
1928
   if (dut.reg_file_.b2v_latch_ix_lo.latch!==8'h00) $fdisplay(f,"* Reg ix x=%h !=00",dut.reg_file_.b2v_latch_ix_lo.latch);
1929
   if (dut.reg_file_.b2v_latch_ix_hi.latch!==8'h00) $fdisplay(f,"* Reg ix i=%h !=00",dut.reg_file_.b2v_latch_ix_hi.latch);
1930
   if (dut.reg_file_.b2v_latch_iy_lo.latch!==8'h00) $fdisplay(f,"* Reg iy y=%h !=00",dut.reg_file_.b2v_latch_iy_lo.latch);
1931
   if (dut.reg_file_.b2v_latch_iy_hi.latch!==8'h00) $fdisplay(f,"* Reg iy i=%h !=00",dut.reg_file_.b2v_latch_iy_hi.latch);
1932
   if (dut.reg_file_.b2v_latch_sp_lo.latch!==8'h00) $fdisplay(f,"* Reg sp p=%h !=00",dut.reg_file_.b2v_latch_sp_lo.latch);
1933
   if (dut.reg_file_.b2v_latch_sp_hi.latch!==8'h00) $fdisplay(f,"* Reg sp s=%h !=00",dut.reg_file_.b2v_latch_sp_hi.latch);
1934
   if (pc!==16'h0001) $fdisplay(f,"* PC=%h !=0001",pc);
1935
   if (dut.reg_file_.b2v_latch_ir_lo.latch!==8'h01) $fdisplay(f,"* Reg ir r=%h !=01",dut.reg_file_.b2v_latch_ir_lo.latch);
1936
   if (dut.reg_file_.b2v_latch_ir_hi.latch!==8'h00) $fdisplay(f,"* Reg ir i=%h !=00",dut.reg_file_.b2v_latch_ir_hi.latch);
1937 13 gdevic
#1 // End opcode
1938
 
1939 8 gdevic
   force dut.ir_.ctl_ir_we=1;
1940
   force dut.ir_.db=0;
1941
#2 release dut.ir_.ctl_ir_we;
1942
   release dut.ir_.db;
1943 13 gdevic
   $fdisplay(f,"Testing opcode ae      XOR (HL)");
1944 6 gdevic
   // Preset af
1945
   force dut.reg_file_.b2v_latch_af_lo.we=1;
1946
   force dut.reg_file_.b2v_latch_af_hi.we=1;
1947
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
1948
   force dut.reg_file_.b2v_latch_af_hi.db=8'hf5;
1949
#2 release dut.reg_file_.b2v_latch_af_lo.we;
1950
   release dut.reg_file_.b2v_latch_af_hi.we;
1951
   release dut.reg_file_.b2v_latch_af_lo.db;
1952
   release dut.reg_file_.b2v_latch_af_hi.db;
1953
   // Preset bc
1954
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
1955
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
1956
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h3b;
1957
   force dut.reg_file_.b2v_latch_bc_hi.db=8'h0f;
1958
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
1959
   release dut.reg_file_.b2v_latch_bc_hi.we;
1960
   release dut.reg_file_.b2v_latch_bc_lo.db;
1961
   release dut.reg_file_.b2v_latch_bc_hi.db;
1962
   // Preset de
1963
   force dut.reg_file_.b2v_latch_de_lo.we=1;
1964
   force dut.reg_file_.b2v_latch_de_hi.we=1;
1965
   force dut.reg_file_.b2v_latch_de_lo.db=8'h0d;
1966
   force dut.reg_file_.b2v_latch_de_hi.db=8'h20;
1967
#2 release dut.reg_file_.b2v_latch_de_lo.we;
1968
   release dut.reg_file_.b2v_latch_de_hi.we;
1969
   release dut.reg_file_.b2v_latch_de_lo.db;
1970
   release dut.reg_file_.b2v_latch_de_hi.db;
1971
   // Preset hl
1972
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
1973
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
1974
   force dut.reg_file_.b2v_latch_hl_lo.db=8'ha6;
1975
   force dut.reg_file_.b2v_latch_hl_hi.db=8'hdc;
1976
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
1977
   release dut.reg_file_.b2v_latch_hl_hi.we;
1978
   release dut.reg_file_.b2v_latch_hl_lo.db;
1979
   release dut.reg_file_.b2v_latch_hl_hi.db;
1980
   // Preset af2
1981
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
1982
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
1983
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
1984
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
1985
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
1986
   release dut.reg_file_.b2v_latch_af2_hi.we;
1987
   release dut.reg_file_.b2v_latch_af2_lo.db;
1988
   release dut.reg_file_.b2v_latch_af2_hi.db;
1989
   // Preset bc2
1990
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
1991
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
1992
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
1993
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
1994
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
1995
   release dut.reg_file_.b2v_latch_bc2_hi.we;
1996
   release dut.reg_file_.b2v_latch_bc2_lo.db;
1997
   release dut.reg_file_.b2v_latch_bc2_hi.db;
1998
   // Preset de2
1999
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
2000
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
2001
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
2002
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
2003
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
2004
   release dut.reg_file_.b2v_latch_de2_hi.we;
2005
   release dut.reg_file_.b2v_latch_de2_lo.db;
2006
   release dut.reg_file_.b2v_latch_de2_hi.db;
2007
   // Preset hl2
2008
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
2009
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
2010
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
2011
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
2012
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
2013
   release dut.reg_file_.b2v_latch_hl2_hi.we;
2014
   release dut.reg_file_.b2v_latch_hl2_lo.db;
2015
   release dut.reg_file_.b2v_latch_hl2_hi.db;
2016
   // Preset ix
2017
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
2018
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
2019
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
2020
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
2021
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
2022
   release dut.reg_file_.b2v_latch_ix_hi.we;
2023
   release dut.reg_file_.b2v_latch_ix_lo.db;
2024
   release dut.reg_file_.b2v_latch_ix_hi.db;
2025
   // Preset iy
2026
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
2027
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
2028
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
2029
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
2030
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
2031
   release dut.reg_file_.b2v_latch_iy_hi.we;
2032
   release dut.reg_file_.b2v_latch_iy_lo.db;
2033
   release dut.reg_file_.b2v_latch_iy_hi.db;
2034
   // Preset sp
2035
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
2036
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
2037
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
2038
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
2039
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
2040
   release dut.reg_file_.b2v_latch_sp_hi.we;
2041
   release dut.reg_file_.b2v_latch_sp_lo.db;
2042
   release dut.reg_file_.b2v_latch_sp_hi.db;
2043
   // Preset wz
2044
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
2045
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
2046
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
2047
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
2048
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
2049
   release dut.reg_file_.b2v_latch_wz_hi.we;
2050
   release dut.reg_file_.b2v_latch_wz_lo.db;
2051
   release dut.reg_file_.b2v_latch_wz_hi.db;
2052
   // Preset pc
2053
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
2054
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
2055
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
2056
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
2057
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
2058
   release dut.reg_file_.b2v_latch_pc_hi.we;
2059
   release dut.reg_file_.b2v_latch_pc_lo.db;
2060
   release dut.reg_file_.b2v_latch_pc_hi.db;
2061
   // Preset ir
2062
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
2063
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
2064
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
2065
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
2066
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
2067
   release dut.reg_file_.b2v_latch_ir_hi.we;
2068
   release dut.reg_file_.b2v_latch_ir_lo.db;
2069
   release dut.reg_file_.b2v_latch_ir_hi.db;
2070
   // Preset memory
2071
   ram.Mem[0] = 8'hae;
2072
   // Preset memory
2073
   ram.Mem[56486] = 8'h49;
2074
   force dut.z80_top_ifc_n.fpga_reset=0;
2075 8 gdevic
   force dut.address_latch_.Q=16'h0000;
2076 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
2077
   release dut.reg_file_.reg_gp_we;
2078 13 gdevic
#2 // Execute: M1/T1 start
2079
#1 release dut.address_latch_.Q;
2080 6 gdevic
#1
2081 13 gdevic
#12 // Wait for opcode end
2082 6 gdevic
   force dut.reg_control_.ctl_reg_sys_we=0;
2083
#2 pc=z.A;
2084
#2
2085
#1 force dut.reg_file_.reg_gp_we=0;
2086
   force dut.z80_top_ifc_n.fpga_reset=1;
2087
   if (dut.reg_file_.b2v_latch_af_lo.latch!==8'ha8) $fdisplay(f,"* Reg af f=%h !=a8",dut.reg_file_.b2v_latch_af_lo.latch);
2088
   if (dut.reg_file_.b2v_latch_af_hi.latch!==8'hbc) $fdisplay(f,"* Reg af a=%h !=bc",dut.reg_file_.b2v_latch_af_hi.latch);
2089
   if (dut.reg_file_.b2v_latch_bc_lo.latch!==8'h3b) $fdisplay(f,"* Reg bc c=%h !=3b",dut.reg_file_.b2v_latch_bc_lo.latch);
2090
   if (dut.reg_file_.b2v_latch_bc_hi.latch!==8'h0f) $fdisplay(f,"* Reg bc b=%h !=0f",dut.reg_file_.b2v_latch_bc_hi.latch);
2091
   if (dut.reg_file_.b2v_latch_de_lo.latch!==8'h0d) $fdisplay(f,"* Reg de e=%h !=0d",dut.reg_file_.b2v_latch_de_lo.latch);
2092
   if (dut.reg_file_.b2v_latch_de_hi.latch!==8'h20) $fdisplay(f,"* Reg de d=%h !=20",dut.reg_file_.b2v_latch_de_hi.latch);
2093
   if (dut.reg_file_.b2v_latch_hl_lo.latch!==8'ha6) $fdisplay(f,"* Reg hl l=%h !=a6",dut.reg_file_.b2v_latch_hl_lo.latch);
2094
   if (dut.reg_file_.b2v_latch_hl_hi.latch!==8'hdc) $fdisplay(f,"* Reg hl h=%h !=dc",dut.reg_file_.b2v_latch_hl_hi.latch);
2095
   if (dut.reg_file_.b2v_latch_af2_lo.latch!==8'h00) $fdisplay(f,"* Reg af2 f=%h !=00",dut.reg_file_.b2v_latch_af2_lo.latch);
2096
   if (dut.reg_file_.b2v_latch_af2_hi.latch!==8'h00) $fdisplay(f,"* Reg af2 a=%h !=00",dut.reg_file_.b2v_latch_af2_hi.latch);
2097
   if (dut.reg_file_.b2v_latch_bc2_lo.latch!==8'h00) $fdisplay(f,"* Reg bc2 c=%h !=00",dut.reg_file_.b2v_latch_bc2_lo.latch);
2098
   if (dut.reg_file_.b2v_latch_bc2_hi.latch!==8'h00) $fdisplay(f,"* Reg bc2 b=%h !=00",dut.reg_file_.b2v_latch_bc2_hi.latch);
2099
   if (dut.reg_file_.b2v_latch_de2_lo.latch!==8'h00) $fdisplay(f,"* Reg de2 e=%h !=00",dut.reg_file_.b2v_latch_de2_lo.latch);
2100
   if (dut.reg_file_.b2v_latch_de2_hi.latch!==8'h00) $fdisplay(f,"* Reg de2 d=%h !=00",dut.reg_file_.b2v_latch_de2_hi.latch);
2101
   if (dut.reg_file_.b2v_latch_hl2_lo.latch!==8'h00) $fdisplay(f,"* Reg hl2 l=%h !=00",dut.reg_file_.b2v_latch_hl2_lo.latch);
2102
   if (dut.reg_file_.b2v_latch_hl2_hi.latch!==8'h00) $fdisplay(f,"* Reg hl2 h=%h !=00",dut.reg_file_.b2v_latch_hl2_hi.latch);
2103
   if (dut.reg_file_.b2v_latch_ix_lo.latch!==8'h00) $fdisplay(f,"* Reg ix x=%h !=00",dut.reg_file_.b2v_latch_ix_lo.latch);
2104
   if (dut.reg_file_.b2v_latch_ix_hi.latch!==8'h00) $fdisplay(f,"* Reg ix i=%h !=00",dut.reg_file_.b2v_latch_ix_hi.latch);
2105
   if (dut.reg_file_.b2v_latch_iy_lo.latch!==8'h00) $fdisplay(f,"* Reg iy y=%h !=00",dut.reg_file_.b2v_latch_iy_lo.latch);
2106
   if (dut.reg_file_.b2v_latch_iy_hi.latch!==8'h00) $fdisplay(f,"* Reg iy i=%h !=00",dut.reg_file_.b2v_latch_iy_hi.latch);
2107
   if (dut.reg_file_.b2v_latch_sp_lo.latch!==8'h00) $fdisplay(f,"* Reg sp p=%h !=00",dut.reg_file_.b2v_latch_sp_lo.latch);
2108
   if (dut.reg_file_.b2v_latch_sp_hi.latch!==8'h00) $fdisplay(f,"* Reg sp s=%h !=00",dut.reg_file_.b2v_latch_sp_hi.latch);
2109
   if (pc!==16'h0001) $fdisplay(f,"* PC=%h !=0001",pc);
2110
   if (dut.reg_file_.b2v_latch_ir_lo.latch!==8'h01) $fdisplay(f,"* Reg ir r=%h !=01",dut.reg_file_.b2v_latch_ir_lo.latch);
2111
   if (dut.reg_file_.b2v_latch_ir_hi.latch!==8'h00) $fdisplay(f,"* Reg ir i=%h !=00",dut.reg_file_.b2v_latch_ir_hi.latch);
2112 13 gdevic
#1 // End opcode
2113
 
2114 8 gdevic
   force dut.ir_.ctl_ir_we=1;
2115
   force dut.ir_.db=0;
2116
#2 release dut.ir_.ctl_ir_we;
2117
   release dut.ir_.db;
2118 13 gdevic
   $fdisplay(f,"Testing opcode b4      OR H");
2119 6 gdevic
   // Preset af
2120
   force dut.reg_file_.b2v_latch_af_lo.we=1;
2121
   force dut.reg_file_.b2v_latch_af_hi.we=1;
2122
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
2123
   force dut.reg_file_.b2v_latch_af_hi.db=8'hf5;
2124
#2 release dut.reg_file_.b2v_latch_af_lo.we;
2125
   release dut.reg_file_.b2v_latch_af_hi.we;
2126
   release dut.reg_file_.b2v_latch_af_lo.db;
2127
   release dut.reg_file_.b2v_latch_af_hi.db;
2128
   // Preset bc
2129
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
2130
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
2131
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h3b;
2132
   force dut.reg_file_.b2v_latch_bc_hi.db=8'h0f;
2133
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
2134
   release dut.reg_file_.b2v_latch_bc_hi.we;
2135
   release dut.reg_file_.b2v_latch_bc_lo.db;
2136
   release dut.reg_file_.b2v_latch_bc_hi.db;
2137
   // Preset de
2138
   force dut.reg_file_.b2v_latch_de_lo.we=1;
2139
   force dut.reg_file_.b2v_latch_de_hi.we=1;
2140
   force dut.reg_file_.b2v_latch_de_lo.db=8'h0d;
2141
   force dut.reg_file_.b2v_latch_de_hi.db=8'h20;
2142
#2 release dut.reg_file_.b2v_latch_de_lo.we;
2143
   release dut.reg_file_.b2v_latch_de_hi.we;
2144
   release dut.reg_file_.b2v_latch_de_lo.db;
2145
   release dut.reg_file_.b2v_latch_de_hi.db;
2146
   // Preset hl
2147
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
2148
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
2149
   force dut.reg_file_.b2v_latch_hl_lo.db=8'ha6;
2150
   force dut.reg_file_.b2v_latch_hl_hi.db=8'hdc;
2151
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
2152
   release dut.reg_file_.b2v_latch_hl_hi.we;
2153
   release dut.reg_file_.b2v_latch_hl_lo.db;
2154
   release dut.reg_file_.b2v_latch_hl_hi.db;
2155
   // Preset af2
2156
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
2157
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
2158
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
2159
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
2160
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
2161
   release dut.reg_file_.b2v_latch_af2_hi.we;
2162
   release dut.reg_file_.b2v_latch_af2_lo.db;
2163
   release dut.reg_file_.b2v_latch_af2_hi.db;
2164
   // Preset bc2
2165
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
2166
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
2167
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
2168
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
2169
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
2170
   release dut.reg_file_.b2v_latch_bc2_hi.we;
2171
   release dut.reg_file_.b2v_latch_bc2_lo.db;
2172
   release dut.reg_file_.b2v_latch_bc2_hi.db;
2173
   // Preset de2
2174
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
2175
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
2176
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
2177
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
2178
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
2179
   release dut.reg_file_.b2v_latch_de2_hi.we;
2180
   release dut.reg_file_.b2v_latch_de2_lo.db;
2181
   release dut.reg_file_.b2v_latch_de2_hi.db;
2182
   // Preset hl2
2183
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
2184
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
2185
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
2186
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
2187
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
2188
   release dut.reg_file_.b2v_latch_hl2_hi.we;
2189
   release dut.reg_file_.b2v_latch_hl2_lo.db;
2190
   release dut.reg_file_.b2v_latch_hl2_hi.db;
2191
   // Preset ix
2192
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
2193
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
2194
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
2195
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
2196
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
2197
   release dut.reg_file_.b2v_latch_ix_hi.we;
2198
   release dut.reg_file_.b2v_latch_ix_lo.db;
2199
   release dut.reg_file_.b2v_latch_ix_hi.db;
2200
   // Preset iy
2201
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
2202
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
2203
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
2204
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
2205
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
2206
   release dut.reg_file_.b2v_latch_iy_hi.we;
2207
   release dut.reg_file_.b2v_latch_iy_lo.db;
2208
   release dut.reg_file_.b2v_latch_iy_hi.db;
2209
   // Preset sp
2210
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
2211
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
2212
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
2213
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
2214
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
2215
   release dut.reg_file_.b2v_latch_sp_hi.we;
2216
   release dut.reg_file_.b2v_latch_sp_lo.db;
2217
   release dut.reg_file_.b2v_latch_sp_hi.db;
2218
   // Preset wz
2219
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
2220
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
2221
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
2222
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
2223
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
2224
   release dut.reg_file_.b2v_latch_wz_hi.we;
2225
   release dut.reg_file_.b2v_latch_wz_lo.db;
2226
   release dut.reg_file_.b2v_latch_wz_hi.db;
2227
   // Preset pc
2228
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
2229
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
2230
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
2231
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
2232
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
2233
   release dut.reg_file_.b2v_latch_pc_hi.we;
2234
   release dut.reg_file_.b2v_latch_pc_lo.db;
2235
   release dut.reg_file_.b2v_latch_pc_hi.db;
2236
   // Preset ir
2237
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
2238
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
2239
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
2240
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
2241
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
2242
   release dut.reg_file_.b2v_latch_ir_hi.we;
2243
   release dut.reg_file_.b2v_latch_ir_lo.db;
2244
   release dut.reg_file_.b2v_latch_ir_hi.db;
2245
   // Preset memory
2246
   ram.Mem[0] = 8'hb4;
2247
   // Preset memory
2248
   ram.Mem[56486] = 8'h49;
2249
   force dut.z80_top_ifc_n.fpga_reset=0;
2250 8 gdevic
   force dut.address_latch_.Q=16'h0000;
2251 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
2252
   release dut.reg_file_.reg_gp_we;
2253 13 gdevic
#2 // Execute: M1/T1 start
2254
#1 release dut.address_latch_.Q;
2255 6 gdevic
#1
2256 13 gdevic
#6 // Wait for opcode end
2257 6 gdevic
   force dut.reg_control_.ctl_reg_sys_we=0;
2258
#2 pc=z.A;
2259
#2
2260
#1 force dut.reg_file_.reg_gp_we=0;
2261
   force dut.z80_top_ifc_n.fpga_reset=1;
2262
   if (dut.reg_file_.b2v_latch_af_lo.latch!==8'ha8) $fdisplay(f,"* Reg af f=%h !=a8",dut.reg_file_.b2v_latch_af_lo.latch);
2263
   if (dut.reg_file_.b2v_latch_af_hi.latch!==8'hfd) $fdisplay(f,"* Reg af a=%h !=fd",dut.reg_file_.b2v_latch_af_hi.latch);
2264
   if (dut.reg_file_.b2v_latch_bc_lo.latch!==8'h3b) $fdisplay(f,"* Reg bc c=%h !=3b",dut.reg_file_.b2v_latch_bc_lo.latch);
2265
   if (dut.reg_file_.b2v_latch_bc_hi.latch!==8'h0f) $fdisplay(f,"* Reg bc b=%h !=0f",dut.reg_file_.b2v_latch_bc_hi.latch);
2266
   if (dut.reg_file_.b2v_latch_de_lo.latch!==8'h0d) $fdisplay(f,"* Reg de e=%h !=0d",dut.reg_file_.b2v_latch_de_lo.latch);
2267
   if (dut.reg_file_.b2v_latch_de_hi.latch!==8'h20) $fdisplay(f,"* Reg de d=%h !=20",dut.reg_file_.b2v_latch_de_hi.latch);
2268
   if (dut.reg_file_.b2v_latch_hl_lo.latch!==8'ha6) $fdisplay(f,"* Reg hl l=%h !=a6",dut.reg_file_.b2v_latch_hl_lo.latch);
2269
   if (dut.reg_file_.b2v_latch_hl_hi.latch!==8'hdc) $fdisplay(f,"* Reg hl h=%h !=dc",dut.reg_file_.b2v_latch_hl_hi.latch);
2270
   if (dut.reg_file_.b2v_latch_af2_lo.latch!==8'h00) $fdisplay(f,"* Reg af2 f=%h !=00",dut.reg_file_.b2v_latch_af2_lo.latch);
2271
   if (dut.reg_file_.b2v_latch_af2_hi.latch!==8'h00) $fdisplay(f,"* Reg af2 a=%h !=00",dut.reg_file_.b2v_latch_af2_hi.latch);
2272
   if (dut.reg_file_.b2v_latch_bc2_lo.latch!==8'h00) $fdisplay(f,"* Reg bc2 c=%h !=00",dut.reg_file_.b2v_latch_bc2_lo.latch);
2273
   if (dut.reg_file_.b2v_latch_bc2_hi.latch!==8'h00) $fdisplay(f,"* Reg bc2 b=%h !=00",dut.reg_file_.b2v_latch_bc2_hi.latch);
2274
   if (dut.reg_file_.b2v_latch_de2_lo.latch!==8'h00) $fdisplay(f,"* Reg de2 e=%h !=00",dut.reg_file_.b2v_latch_de2_lo.latch);
2275
   if (dut.reg_file_.b2v_latch_de2_hi.latch!==8'h00) $fdisplay(f,"* Reg de2 d=%h !=00",dut.reg_file_.b2v_latch_de2_hi.latch);
2276
   if (dut.reg_file_.b2v_latch_hl2_lo.latch!==8'h00) $fdisplay(f,"* Reg hl2 l=%h !=00",dut.reg_file_.b2v_latch_hl2_lo.latch);
2277
   if (dut.reg_file_.b2v_latch_hl2_hi.latch!==8'h00) $fdisplay(f,"* Reg hl2 h=%h !=00",dut.reg_file_.b2v_latch_hl2_hi.latch);
2278
   if (dut.reg_file_.b2v_latch_ix_lo.latch!==8'h00) $fdisplay(f,"* Reg ix x=%h !=00",dut.reg_file_.b2v_latch_ix_lo.latch);
2279
   if (dut.reg_file_.b2v_latch_ix_hi.latch!==8'h00) $fdisplay(f,"* Reg ix i=%h !=00",dut.reg_file_.b2v_latch_ix_hi.latch);
2280
   if (dut.reg_file_.b2v_latch_iy_lo.latch!==8'h00) $fdisplay(f,"* Reg iy y=%h !=00",dut.reg_file_.b2v_latch_iy_lo.latch);
2281
   if (dut.reg_file_.b2v_latch_iy_hi.latch!==8'h00) $fdisplay(f,"* Reg iy i=%h !=00",dut.reg_file_.b2v_latch_iy_hi.latch);
2282
   if (dut.reg_file_.b2v_latch_sp_lo.latch!==8'h00) $fdisplay(f,"* Reg sp p=%h !=00",dut.reg_file_.b2v_latch_sp_lo.latch);
2283
   if (dut.reg_file_.b2v_latch_sp_hi.latch!==8'h00) $fdisplay(f,"* Reg sp s=%h !=00",dut.reg_file_.b2v_latch_sp_hi.latch);
2284
   if (pc!==16'h0001) $fdisplay(f,"* PC=%h !=0001",pc);
2285
   if (dut.reg_file_.b2v_latch_ir_lo.latch!==8'h01) $fdisplay(f,"* Reg ir r=%h !=01",dut.reg_file_.b2v_latch_ir_lo.latch);
2286
   if (dut.reg_file_.b2v_latch_ir_hi.latch!==8'h00) $fdisplay(f,"* Reg ir i=%h !=00",dut.reg_file_.b2v_latch_ir_hi.latch);
2287 13 gdevic
#1 // End opcode
2288
 
2289 8 gdevic
   force dut.ir_.ctl_ir_we=1;
2290
   force dut.ir_.db=0;
2291
#2 release dut.ir_.ctl_ir_we;
2292
   release dut.ir_.db;
2293 13 gdevic
   $fdisplay(f,"Testing opcode bf      CP A");
2294 6 gdevic
   // Preset af
2295
   force dut.reg_file_.b2v_latch_af_lo.we=1;
2296
   force dut.reg_file_.b2v_latch_af_hi.we=1;
2297
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
2298
   force dut.reg_file_.b2v_latch_af_hi.db=8'hf5;
2299
#2 release dut.reg_file_.b2v_latch_af_lo.we;
2300
   release dut.reg_file_.b2v_latch_af_hi.we;
2301
   release dut.reg_file_.b2v_latch_af_lo.db;
2302
   release dut.reg_file_.b2v_latch_af_hi.db;
2303
   // Preset bc
2304
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
2305
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
2306
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h3b;
2307
   force dut.reg_file_.b2v_latch_bc_hi.db=8'h0f;
2308
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
2309
   release dut.reg_file_.b2v_latch_bc_hi.we;
2310
   release dut.reg_file_.b2v_latch_bc_lo.db;
2311
   release dut.reg_file_.b2v_latch_bc_hi.db;
2312
   // Preset de
2313
   force dut.reg_file_.b2v_latch_de_lo.we=1;
2314
   force dut.reg_file_.b2v_latch_de_hi.we=1;
2315
   force dut.reg_file_.b2v_latch_de_lo.db=8'h0d;
2316
   force dut.reg_file_.b2v_latch_de_hi.db=8'h20;
2317
#2 release dut.reg_file_.b2v_latch_de_lo.we;
2318
   release dut.reg_file_.b2v_latch_de_hi.we;
2319
   release dut.reg_file_.b2v_latch_de_lo.db;
2320
   release dut.reg_file_.b2v_latch_de_hi.db;
2321
   // Preset hl
2322
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
2323
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
2324
   force dut.reg_file_.b2v_latch_hl_lo.db=8'ha6;
2325
   force dut.reg_file_.b2v_latch_hl_hi.db=8'hdc;
2326
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
2327
   release dut.reg_file_.b2v_latch_hl_hi.we;
2328
   release dut.reg_file_.b2v_latch_hl_lo.db;
2329
   release dut.reg_file_.b2v_latch_hl_hi.db;
2330
   // Preset af2
2331
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
2332
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
2333
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
2334
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
2335
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
2336
   release dut.reg_file_.b2v_latch_af2_hi.we;
2337
   release dut.reg_file_.b2v_latch_af2_lo.db;
2338
   release dut.reg_file_.b2v_latch_af2_hi.db;
2339
   // Preset bc2
2340
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
2341
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
2342
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
2343
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
2344
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
2345
   release dut.reg_file_.b2v_latch_bc2_hi.we;
2346
   release dut.reg_file_.b2v_latch_bc2_lo.db;
2347
   release dut.reg_file_.b2v_latch_bc2_hi.db;
2348
   // Preset de2
2349
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
2350
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
2351
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
2352
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
2353
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
2354
   release dut.reg_file_.b2v_latch_de2_hi.we;
2355
   release dut.reg_file_.b2v_latch_de2_lo.db;
2356
   release dut.reg_file_.b2v_latch_de2_hi.db;
2357
   // Preset hl2
2358
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
2359
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
2360
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
2361
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
2362
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
2363
   release dut.reg_file_.b2v_latch_hl2_hi.we;
2364
   release dut.reg_file_.b2v_latch_hl2_lo.db;
2365
   release dut.reg_file_.b2v_latch_hl2_hi.db;
2366
   // Preset ix
2367
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
2368
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
2369
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
2370
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
2371
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
2372
   release dut.reg_file_.b2v_latch_ix_hi.we;
2373
   release dut.reg_file_.b2v_latch_ix_lo.db;
2374
   release dut.reg_file_.b2v_latch_ix_hi.db;
2375
   // Preset iy
2376
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
2377
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
2378
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
2379
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
2380
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
2381
   release dut.reg_file_.b2v_latch_iy_hi.we;
2382
   release dut.reg_file_.b2v_latch_iy_lo.db;
2383
   release dut.reg_file_.b2v_latch_iy_hi.db;
2384
   // Preset sp
2385
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
2386
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
2387
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
2388
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
2389
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
2390
   release dut.reg_file_.b2v_latch_sp_hi.we;
2391
   release dut.reg_file_.b2v_latch_sp_lo.db;
2392
   release dut.reg_file_.b2v_latch_sp_hi.db;
2393
   // Preset wz
2394
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
2395
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
2396
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
2397
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
2398
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
2399
   release dut.reg_file_.b2v_latch_wz_hi.we;
2400
   release dut.reg_file_.b2v_latch_wz_lo.db;
2401
   release dut.reg_file_.b2v_latch_wz_hi.db;
2402
   // Preset pc
2403
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
2404
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
2405
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
2406
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
2407
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
2408
   release dut.reg_file_.b2v_latch_pc_hi.we;
2409
   release dut.reg_file_.b2v_latch_pc_lo.db;
2410
   release dut.reg_file_.b2v_latch_pc_hi.db;
2411
   // Preset ir
2412
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
2413
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
2414
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
2415
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
2416
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
2417
   release dut.reg_file_.b2v_latch_ir_hi.we;
2418
   release dut.reg_file_.b2v_latch_ir_lo.db;
2419
   release dut.reg_file_.b2v_latch_ir_hi.db;
2420
   // Preset memory
2421
   ram.Mem[0] = 8'hbf;
2422
   // Preset memory
2423
   ram.Mem[56486] = 8'h49;
2424
   force dut.z80_top_ifc_n.fpga_reset=0;
2425 8 gdevic
   force dut.address_latch_.Q=16'h0000;
2426 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
2427
   release dut.reg_file_.reg_gp_we;
2428 13 gdevic
#2 // Execute: M1/T1 start
2429
#1 release dut.address_latch_.Q;
2430 6 gdevic
#1
2431 13 gdevic
#6 // Wait for opcode end
2432 6 gdevic
   force dut.reg_control_.ctl_reg_sys_we=0;
2433
#2 pc=z.A;
2434
#2
2435
#1 force dut.reg_file_.reg_gp_we=0;
2436
   force dut.z80_top_ifc_n.fpga_reset=1;
2437
   if (dut.reg_file_.b2v_latch_af_lo.latch!==8'h62) $fdisplay(f,"* Reg af f=%h !=62",dut.reg_file_.b2v_latch_af_lo.latch);
2438
   if (dut.reg_file_.b2v_latch_af_hi.latch!==8'hf5) $fdisplay(f,"* Reg af a=%h !=f5",dut.reg_file_.b2v_latch_af_hi.latch);
2439
   if (dut.reg_file_.b2v_latch_bc_lo.latch!==8'h3b) $fdisplay(f,"* Reg bc c=%h !=3b",dut.reg_file_.b2v_latch_bc_lo.latch);
2440
   if (dut.reg_file_.b2v_latch_bc_hi.latch!==8'h0f) $fdisplay(f,"* Reg bc b=%h !=0f",dut.reg_file_.b2v_latch_bc_hi.latch);
2441
   if (dut.reg_file_.b2v_latch_de_lo.latch!==8'h0d) $fdisplay(f,"* Reg de e=%h !=0d",dut.reg_file_.b2v_latch_de_lo.latch);
2442
   if (dut.reg_file_.b2v_latch_de_hi.latch!==8'h20) $fdisplay(f,"* Reg de d=%h !=20",dut.reg_file_.b2v_latch_de_hi.latch);
2443
   if (dut.reg_file_.b2v_latch_hl_lo.latch!==8'ha6) $fdisplay(f,"* Reg hl l=%h !=a6",dut.reg_file_.b2v_latch_hl_lo.latch);
2444
   if (dut.reg_file_.b2v_latch_hl_hi.latch!==8'hdc) $fdisplay(f,"* Reg hl h=%h !=dc",dut.reg_file_.b2v_latch_hl_hi.latch);
2445
   if (dut.reg_file_.b2v_latch_af2_lo.latch!==8'h00) $fdisplay(f,"* Reg af2 f=%h !=00",dut.reg_file_.b2v_latch_af2_lo.latch);
2446
   if (dut.reg_file_.b2v_latch_af2_hi.latch!==8'h00) $fdisplay(f,"* Reg af2 a=%h !=00",dut.reg_file_.b2v_latch_af2_hi.latch);
2447
   if (dut.reg_file_.b2v_latch_bc2_lo.latch!==8'h00) $fdisplay(f,"* Reg bc2 c=%h !=00",dut.reg_file_.b2v_latch_bc2_lo.latch);
2448
   if (dut.reg_file_.b2v_latch_bc2_hi.latch!==8'h00) $fdisplay(f,"* Reg bc2 b=%h !=00",dut.reg_file_.b2v_latch_bc2_hi.latch);
2449
   if (dut.reg_file_.b2v_latch_de2_lo.latch!==8'h00) $fdisplay(f,"* Reg de2 e=%h !=00",dut.reg_file_.b2v_latch_de2_lo.latch);
2450
   if (dut.reg_file_.b2v_latch_de2_hi.latch!==8'h00) $fdisplay(f,"* Reg de2 d=%h !=00",dut.reg_file_.b2v_latch_de2_hi.latch);
2451
   if (dut.reg_file_.b2v_latch_hl2_lo.latch!==8'h00) $fdisplay(f,"* Reg hl2 l=%h !=00",dut.reg_file_.b2v_latch_hl2_lo.latch);
2452
   if (dut.reg_file_.b2v_latch_hl2_hi.latch!==8'h00) $fdisplay(f,"* Reg hl2 h=%h !=00",dut.reg_file_.b2v_latch_hl2_hi.latch);
2453
   if (dut.reg_file_.b2v_latch_ix_lo.latch!==8'h00) $fdisplay(f,"* Reg ix x=%h !=00",dut.reg_file_.b2v_latch_ix_lo.latch);
2454
   if (dut.reg_file_.b2v_latch_ix_hi.latch!==8'h00) $fdisplay(f,"* Reg ix i=%h !=00",dut.reg_file_.b2v_latch_ix_hi.latch);
2455
   if (dut.reg_file_.b2v_latch_iy_lo.latch!==8'h00) $fdisplay(f,"* Reg iy y=%h !=00",dut.reg_file_.b2v_latch_iy_lo.latch);
2456
   if (dut.reg_file_.b2v_latch_iy_hi.latch!==8'h00) $fdisplay(f,"* Reg iy i=%h !=00",dut.reg_file_.b2v_latch_iy_hi.latch);
2457
   if (dut.reg_file_.b2v_latch_sp_lo.latch!==8'h00) $fdisplay(f,"* Reg sp p=%h !=00",dut.reg_file_.b2v_latch_sp_lo.latch);
2458
   if (dut.reg_file_.b2v_latch_sp_hi.latch!==8'h00) $fdisplay(f,"* Reg sp s=%h !=00",dut.reg_file_.b2v_latch_sp_hi.latch);
2459
   if (pc!==16'h0001) $fdisplay(f,"* PC=%h !=0001",pc);
2460
   if (dut.reg_file_.b2v_latch_ir_lo.latch!==8'h01) $fdisplay(f,"* Reg ir r=%h !=01",dut.reg_file_.b2v_latch_ir_lo.latch);
2461
   if (dut.reg_file_.b2v_latch_ir_hi.latch!==8'h00) $fdisplay(f,"* Reg ir i=%h !=00",dut.reg_file_.b2v_latch_ir_hi.latch);
2462 13 gdevic
#1 // End opcode
2463
 
2464 8 gdevic
   force dut.ir_.ctl_ir_we=1;
2465
   force dut.ir_.db=0;
2466
#2 release dut.ir_.ctl_ir_we;
2467
   release dut.ir_.db;
2468 13 gdevic
   $fdisplay(f,"Testing opcode 43      LD B,E");
2469 6 gdevic
   // Preset af
2470
   force dut.reg_file_.b2v_latch_af_lo.we=1;
2471
   force dut.reg_file_.b2v_latch_af_hi.we=1;
2472
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
2473
   force dut.reg_file_.b2v_latch_af_hi.db=8'h02;
2474
#2 release dut.reg_file_.b2v_latch_af_lo.we;
2475
   release dut.reg_file_.b2v_latch_af_hi.we;
2476
   release dut.reg_file_.b2v_latch_af_lo.db;
2477
   release dut.reg_file_.b2v_latch_af_hi.db;
2478
   // Preset bc
2479
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
2480
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
2481
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h98;
2482
   force dut.reg_file_.b2v_latch_bc_hi.db=8'hcf;
2483
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
2484
   release dut.reg_file_.b2v_latch_bc_hi.we;
2485
   release dut.reg_file_.b2v_latch_bc_lo.db;
2486
   release dut.reg_file_.b2v_latch_bc_hi.db;
2487
   // Preset de
2488
   force dut.reg_file_.b2v_latch_de_lo.we=1;
2489
   force dut.reg_file_.b2v_latch_de_hi.we=1;
2490
   force dut.reg_file_.b2v_latch_de_lo.db=8'hd8;
2491
   force dut.reg_file_.b2v_latch_de_hi.db=8'h90;
2492
#2 release dut.reg_file_.b2v_latch_de_lo.we;
2493
   release dut.reg_file_.b2v_latch_de_hi.we;
2494
   release dut.reg_file_.b2v_latch_de_lo.db;
2495
   release dut.reg_file_.b2v_latch_de_hi.db;
2496
   // Preset hl
2497
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
2498
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
2499
   force dut.reg_file_.b2v_latch_hl_lo.db=8'h69;
2500
   force dut.reg_file_.b2v_latch_hl_hi.db=8'ha1;
2501
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
2502
   release dut.reg_file_.b2v_latch_hl_hi.we;
2503
   release dut.reg_file_.b2v_latch_hl_lo.db;
2504
   release dut.reg_file_.b2v_latch_hl_hi.db;
2505
   // Preset af2
2506
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
2507
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
2508
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
2509
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
2510
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
2511
   release dut.reg_file_.b2v_latch_af2_hi.we;
2512
   release dut.reg_file_.b2v_latch_af2_lo.db;
2513
   release dut.reg_file_.b2v_latch_af2_hi.db;
2514
   // Preset bc2
2515
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
2516
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
2517
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
2518
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
2519
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
2520
   release dut.reg_file_.b2v_latch_bc2_hi.we;
2521
   release dut.reg_file_.b2v_latch_bc2_lo.db;
2522
   release dut.reg_file_.b2v_latch_bc2_hi.db;
2523
   // Preset de2
2524
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
2525
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
2526
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
2527
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
2528
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
2529
   release dut.reg_file_.b2v_latch_de2_hi.we;
2530
   release dut.reg_file_.b2v_latch_de2_lo.db;
2531
   release dut.reg_file_.b2v_latch_de2_hi.db;
2532
   // Preset hl2
2533
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
2534
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
2535
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
2536
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
2537
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
2538
   release dut.reg_file_.b2v_latch_hl2_hi.we;
2539
   release dut.reg_file_.b2v_latch_hl2_lo.db;
2540
   release dut.reg_file_.b2v_latch_hl2_hi.db;
2541
   // Preset ix
2542
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
2543
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
2544
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
2545
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
2546
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
2547
   release dut.reg_file_.b2v_latch_ix_hi.we;
2548
   release dut.reg_file_.b2v_latch_ix_lo.db;
2549
   release dut.reg_file_.b2v_latch_ix_hi.db;
2550
   // Preset iy
2551
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
2552
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
2553
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
2554
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
2555
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
2556
   release dut.reg_file_.b2v_latch_iy_hi.we;
2557
   release dut.reg_file_.b2v_latch_iy_lo.db;
2558
   release dut.reg_file_.b2v_latch_iy_hi.db;
2559
   // Preset sp
2560
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
2561
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
2562
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
2563
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
2564
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
2565
   release dut.reg_file_.b2v_latch_sp_hi.we;
2566
   release dut.reg_file_.b2v_latch_sp_lo.db;
2567
   release dut.reg_file_.b2v_latch_sp_hi.db;
2568
   // Preset wz
2569
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
2570
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
2571
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
2572
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
2573
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
2574
   release dut.reg_file_.b2v_latch_wz_hi.we;
2575
   release dut.reg_file_.b2v_latch_wz_lo.db;
2576
   release dut.reg_file_.b2v_latch_wz_hi.db;
2577
   // Preset pc
2578
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
2579
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
2580
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
2581
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
2582
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
2583
   release dut.reg_file_.b2v_latch_pc_hi.we;
2584
   release dut.reg_file_.b2v_latch_pc_lo.db;
2585
   release dut.reg_file_.b2v_latch_pc_hi.db;
2586
   // Preset ir
2587
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
2588
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
2589
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
2590
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
2591
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
2592
   release dut.reg_file_.b2v_latch_ir_hi.we;
2593
   release dut.reg_file_.b2v_latch_ir_lo.db;
2594
   release dut.reg_file_.b2v_latch_ir_hi.db;
2595
   // Preset memory
2596
   ram.Mem[0] = 8'h43;
2597
   // Preset memory
2598
   ram.Mem[41321] = 8'h50;
2599
   force dut.z80_top_ifc_n.fpga_reset=0;
2600 8 gdevic
   force dut.address_latch_.Q=16'h0000;
2601 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
2602
   release dut.reg_file_.reg_gp_we;
2603 13 gdevic
#2 // Execute: M1/T1 start
2604
#1 release dut.address_latch_.Q;
2605 6 gdevic
#1
2606 13 gdevic
#6 // Wait for opcode end
2607 6 gdevic
   force dut.reg_control_.ctl_reg_sys_we=0;
2608
#2 pc=z.A;
2609
#2
2610
#1 force dut.reg_file_.reg_gp_we=0;
2611
   force dut.z80_top_ifc_n.fpga_reset=1;
2612
   if (dut.reg_file_.b2v_latch_af_lo.latch!==8'h00) $fdisplay(f,"* Reg af f=%h !=00",dut.reg_file_.b2v_latch_af_lo.latch);
2613
   if (dut.reg_file_.b2v_latch_af_hi.latch!==8'h02) $fdisplay(f,"* Reg af a=%h !=02",dut.reg_file_.b2v_latch_af_hi.latch);
2614
   if (dut.reg_file_.b2v_latch_bc_lo.latch!==8'h98) $fdisplay(f,"* Reg bc c=%h !=98",dut.reg_file_.b2v_latch_bc_lo.latch);
2615
   if (dut.reg_file_.b2v_latch_bc_hi.latch!==8'hd8) $fdisplay(f,"* Reg bc b=%h !=d8",dut.reg_file_.b2v_latch_bc_hi.latch);
2616
   if (dut.reg_file_.b2v_latch_de_lo.latch!==8'hd8) $fdisplay(f,"* Reg de e=%h !=d8",dut.reg_file_.b2v_latch_de_lo.latch);
2617
   if (dut.reg_file_.b2v_latch_de_hi.latch!==8'h90) $fdisplay(f,"* Reg de d=%h !=90",dut.reg_file_.b2v_latch_de_hi.latch);
2618
   if (dut.reg_file_.b2v_latch_hl_lo.latch!==8'h69) $fdisplay(f,"* Reg hl l=%h !=69",dut.reg_file_.b2v_latch_hl_lo.latch);
2619
   if (dut.reg_file_.b2v_latch_hl_hi.latch!==8'ha1) $fdisplay(f,"* Reg hl h=%h !=a1",dut.reg_file_.b2v_latch_hl_hi.latch);
2620
   if (dut.reg_file_.b2v_latch_af2_lo.latch!==8'h00) $fdisplay(f,"* Reg af2 f=%h !=00",dut.reg_file_.b2v_latch_af2_lo.latch);
2621
   if (dut.reg_file_.b2v_latch_af2_hi.latch!==8'h00) $fdisplay(f,"* Reg af2 a=%h !=00",dut.reg_file_.b2v_latch_af2_hi.latch);
2622
   if (dut.reg_file_.b2v_latch_bc2_lo.latch!==8'h00) $fdisplay(f,"* Reg bc2 c=%h !=00",dut.reg_file_.b2v_latch_bc2_lo.latch);
2623
   if (dut.reg_file_.b2v_latch_bc2_hi.latch!==8'h00) $fdisplay(f,"* Reg bc2 b=%h !=00",dut.reg_file_.b2v_latch_bc2_hi.latch);
2624
   if (dut.reg_file_.b2v_latch_de2_lo.latch!==8'h00) $fdisplay(f,"* Reg de2 e=%h !=00",dut.reg_file_.b2v_latch_de2_lo.latch);
2625
   if (dut.reg_file_.b2v_latch_de2_hi.latch!==8'h00) $fdisplay(f,"* Reg de2 d=%h !=00",dut.reg_file_.b2v_latch_de2_hi.latch);
2626
   if (dut.reg_file_.b2v_latch_hl2_lo.latch!==8'h00) $fdisplay(f,"* Reg hl2 l=%h !=00",dut.reg_file_.b2v_latch_hl2_lo.latch);
2627
   if (dut.reg_file_.b2v_latch_hl2_hi.latch!==8'h00) $fdisplay(f,"* Reg hl2 h=%h !=00",dut.reg_file_.b2v_latch_hl2_hi.latch);
2628
   if (dut.reg_file_.b2v_latch_ix_lo.latch!==8'h00) $fdisplay(f,"* Reg ix x=%h !=00",dut.reg_file_.b2v_latch_ix_lo.latch);
2629
   if (dut.reg_file_.b2v_latch_ix_hi.latch!==8'h00) $fdisplay(f,"* Reg ix i=%h !=00",dut.reg_file_.b2v_latch_ix_hi.latch);
2630
   if (dut.reg_file_.b2v_latch_iy_lo.latch!==8'h00) $fdisplay(f,"* Reg iy y=%h !=00",dut.reg_file_.b2v_latch_iy_lo.latch);
2631
   if (dut.reg_file_.b2v_latch_iy_hi.latch!==8'h00) $fdisplay(f,"* Reg iy i=%h !=00",dut.reg_file_.b2v_latch_iy_hi.latch);
2632
   if (dut.reg_file_.b2v_latch_sp_lo.latch!==8'h00) $fdisplay(f,"* Reg sp p=%h !=00",dut.reg_file_.b2v_latch_sp_lo.latch);
2633
   if (dut.reg_file_.b2v_latch_sp_hi.latch!==8'h00) $fdisplay(f,"* Reg sp s=%h !=00",dut.reg_file_.b2v_latch_sp_hi.latch);
2634
   if (pc!==16'h0001) $fdisplay(f,"* PC=%h !=0001",pc);
2635
   if (dut.reg_file_.b2v_latch_ir_lo.latch!==8'h01) $fdisplay(f,"* Reg ir r=%h !=01",dut.reg_file_.b2v_latch_ir_lo.latch);
2636
   if (dut.reg_file_.b2v_latch_ir_hi.latch!==8'h00) $fdisplay(f,"* Reg ir i=%h !=00",dut.reg_file_.b2v_latch_ir_hi.latch);
2637 13 gdevic
#1 // End opcode
2638
 
2639 8 gdevic
   force dut.ir_.ctl_ir_we=1;
2640
   force dut.ir_.db=0;
2641
#2 release dut.ir_.ctl_ir_we;
2642
   release dut.ir_.db;
2643 13 gdevic
   $fdisplay(f,"Testing opcode 6e      LD L,(HL)");
2644 6 gdevic
   // Preset af
2645
   force dut.reg_file_.b2v_latch_af_lo.we=1;
2646
   force dut.reg_file_.b2v_latch_af_hi.we=1;
2647
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
2648
   force dut.reg_file_.b2v_latch_af_hi.db=8'h02;
2649
#2 release dut.reg_file_.b2v_latch_af_lo.we;
2650
   release dut.reg_file_.b2v_latch_af_hi.we;
2651
   release dut.reg_file_.b2v_latch_af_lo.db;
2652
   release dut.reg_file_.b2v_latch_af_hi.db;
2653
   // Preset bc
2654
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
2655
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
2656
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h98;
2657
   force dut.reg_file_.b2v_latch_bc_hi.db=8'hcf;
2658
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
2659
   release dut.reg_file_.b2v_latch_bc_hi.we;
2660
   release dut.reg_file_.b2v_latch_bc_lo.db;
2661
   release dut.reg_file_.b2v_latch_bc_hi.db;
2662
   // Preset de
2663
   force dut.reg_file_.b2v_latch_de_lo.we=1;
2664
   force dut.reg_file_.b2v_latch_de_hi.we=1;
2665
   force dut.reg_file_.b2v_latch_de_lo.db=8'hd8;
2666
   force dut.reg_file_.b2v_latch_de_hi.db=8'h90;
2667
#2 release dut.reg_file_.b2v_latch_de_lo.we;
2668
   release dut.reg_file_.b2v_latch_de_hi.we;
2669
   release dut.reg_file_.b2v_latch_de_lo.db;
2670
   release dut.reg_file_.b2v_latch_de_hi.db;
2671
   // Preset hl
2672
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
2673
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
2674
   force dut.reg_file_.b2v_latch_hl_lo.db=8'h69;
2675
   force dut.reg_file_.b2v_latch_hl_hi.db=8'ha1;
2676
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
2677
   release dut.reg_file_.b2v_latch_hl_hi.we;
2678
   release dut.reg_file_.b2v_latch_hl_lo.db;
2679
   release dut.reg_file_.b2v_latch_hl_hi.db;
2680
   // Preset af2
2681
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
2682
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
2683
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
2684
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
2685
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
2686
   release dut.reg_file_.b2v_latch_af2_hi.we;
2687
   release dut.reg_file_.b2v_latch_af2_lo.db;
2688
   release dut.reg_file_.b2v_latch_af2_hi.db;
2689
   // Preset bc2
2690
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
2691
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
2692
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
2693
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
2694
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
2695
   release dut.reg_file_.b2v_latch_bc2_hi.we;
2696
   release dut.reg_file_.b2v_latch_bc2_lo.db;
2697
   release dut.reg_file_.b2v_latch_bc2_hi.db;
2698
   // Preset de2
2699
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
2700
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
2701
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
2702
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
2703
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
2704
   release dut.reg_file_.b2v_latch_de2_hi.we;
2705
   release dut.reg_file_.b2v_latch_de2_lo.db;
2706
   release dut.reg_file_.b2v_latch_de2_hi.db;
2707
   // Preset hl2
2708
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
2709
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
2710
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
2711
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
2712
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
2713
   release dut.reg_file_.b2v_latch_hl2_hi.we;
2714
   release dut.reg_file_.b2v_latch_hl2_lo.db;
2715
   release dut.reg_file_.b2v_latch_hl2_hi.db;
2716
   // Preset ix
2717
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
2718
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
2719
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
2720
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
2721
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
2722
   release dut.reg_file_.b2v_latch_ix_hi.we;
2723
   release dut.reg_file_.b2v_latch_ix_lo.db;
2724
   release dut.reg_file_.b2v_latch_ix_hi.db;
2725
   // Preset iy
2726
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
2727
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
2728
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
2729
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
2730
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
2731
   release dut.reg_file_.b2v_latch_iy_hi.we;
2732
   release dut.reg_file_.b2v_latch_iy_lo.db;
2733
   release dut.reg_file_.b2v_latch_iy_hi.db;
2734
   // Preset sp
2735
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
2736
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
2737
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
2738
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
2739
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
2740
   release dut.reg_file_.b2v_latch_sp_hi.we;
2741
   release dut.reg_file_.b2v_latch_sp_lo.db;
2742
   release dut.reg_file_.b2v_latch_sp_hi.db;
2743
   // Preset wz
2744
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
2745
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
2746
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
2747
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
2748
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
2749
   release dut.reg_file_.b2v_latch_wz_hi.we;
2750
   release dut.reg_file_.b2v_latch_wz_lo.db;
2751
   release dut.reg_file_.b2v_latch_wz_hi.db;
2752
   // Preset pc
2753
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
2754
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
2755
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
2756
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
2757
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
2758
   release dut.reg_file_.b2v_latch_pc_hi.we;
2759
   release dut.reg_file_.b2v_latch_pc_lo.db;
2760
   release dut.reg_file_.b2v_latch_pc_hi.db;
2761
   // Preset ir
2762
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
2763
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
2764
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
2765
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
2766
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
2767
   release dut.reg_file_.b2v_latch_ir_hi.we;
2768
   release dut.reg_file_.b2v_latch_ir_lo.db;
2769
   release dut.reg_file_.b2v_latch_ir_hi.db;
2770
   // Preset memory
2771
   ram.Mem[0] = 8'h6e;
2772
   // Preset memory
2773
   ram.Mem[41321] = 8'h50;
2774
   force dut.z80_top_ifc_n.fpga_reset=0;
2775 8 gdevic
   force dut.address_latch_.Q=16'h0000;
2776 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
2777
   release dut.reg_file_.reg_gp_we;
2778 13 gdevic
#2 // Execute: M1/T1 start
2779
#1 release dut.address_latch_.Q;
2780 6 gdevic
#1
2781 13 gdevic
#12 // Wait for opcode end
2782 6 gdevic
   force dut.reg_control_.ctl_reg_sys_we=0;
2783
#2 pc=z.A;
2784
#2
2785
#1 force dut.reg_file_.reg_gp_we=0;
2786
   force dut.z80_top_ifc_n.fpga_reset=1;
2787
   if (dut.reg_file_.b2v_latch_af_lo.latch!==8'h00) $fdisplay(f,"* Reg af f=%h !=00",dut.reg_file_.b2v_latch_af_lo.latch);
2788
   if (dut.reg_file_.b2v_latch_af_hi.latch!==8'h02) $fdisplay(f,"* Reg af a=%h !=02",dut.reg_file_.b2v_latch_af_hi.latch);
2789
   if (dut.reg_file_.b2v_latch_bc_lo.latch!==8'h98) $fdisplay(f,"* Reg bc c=%h !=98",dut.reg_file_.b2v_latch_bc_lo.latch);
2790
   if (dut.reg_file_.b2v_latch_bc_hi.latch!==8'hcf) $fdisplay(f,"* Reg bc b=%h !=cf",dut.reg_file_.b2v_latch_bc_hi.latch);
2791
   if (dut.reg_file_.b2v_latch_de_lo.latch!==8'hd8) $fdisplay(f,"* Reg de e=%h !=d8",dut.reg_file_.b2v_latch_de_lo.latch);
2792
   if (dut.reg_file_.b2v_latch_de_hi.latch!==8'h90) $fdisplay(f,"* Reg de d=%h !=90",dut.reg_file_.b2v_latch_de_hi.latch);
2793
   if (dut.reg_file_.b2v_latch_hl_lo.latch!==8'h50) $fdisplay(f,"* Reg hl l=%h !=50",dut.reg_file_.b2v_latch_hl_lo.latch);
2794
   if (dut.reg_file_.b2v_latch_hl_hi.latch!==8'ha1) $fdisplay(f,"* Reg hl h=%h !=a1",dut.reg_file_.b2v_latch_hl_hi.latch);
2795
   if (dut.reg_file_.b2v_latch_af2_lo.latch!==8'h00) $fdisplay(f,"* Reg af2 f=%h !=00",dut.reg_file_.b2v_latch_af2_lo.latch);
2796
   if (dut.reg_file_.b2v_latch_af2_hi.latch!==8'h00) $fdisplay(f,"* Reg af2 a=%h !=00",dut.reg_file_.b2v_latch_af2_hi.latch);
2797
   if (dut.reg_file_.b2v_latch_bc2_lo.latch!==8'h00) $fdisplay(f,"* Reg bc2 c=%h !=00",dut.reg_file_.b2v_latch_bc2_lo.latch);
2798
   if (dut.reg_file_.b2v_latch_bc2_hi.latch!==8'h00) $fdisplay(f,"* Reg bc2 b=%h !=00",dut.reg_file_.b2v_latch_bc2_hi.latch);
2799
   if (dut.reg_file_.b2v_latch_de2_lo.latch!==8'h00) $fdisplay(f,"* Reg de2 e=%h !=00",dut.reg_file_.b2v_latch_de2_lo.latch);
2800
   if (dut.reg_file_.b2v_latch_de2_hi.latch!==8'h00) $fdisplay(f,"* Reg de2 d=%h !=00",dut.reg_file_.b2v_latch_de2_hi.latch);
2801
   if (dut.reg_file_.b2v_latch_hl2_lo.latch!==8'h00) $fdisplay(f,"* Reg hl2 l=%h !=00",dut.reg_file_.b2v_latch_hl2_lo.latch);
2802
   if (dut.reg_file_.b2v_latch_hl2_hi.latch!==8'h00) $fdisplay(f,"* Reg hl2 h=%h !=00",dut.reg_file_.b2v_latch_hl2_hi.latch);
2803
   if (dut.reg_file_.b2v_latch_ix_lo.latch!==8'h00) $fdisplay(f,"* Reg ix x=%h !=00",dut.reg_file_.b2v_latch_ix_lo.latch);
2804
   if (dut.reg_file_.b2v_latch_ix_hi.latch!==8'h00) $fdisplay(f,"* Reg ix i=%h !=00",dut.reg_file_.b2v_latch_ix_hi.latch);
2805
   if (dut.reg_file_.b2v_latch_iy_lo.latch!==8'h00) $fdisplay(f,"* Reg iy y=%h !=00",dut.reg_file_.b2v_latch_iy_lo.latch);
2806
   if (dut.reg_file_.b2v_latch_iy_hi.latch!==8'h00) $fdisplay(f,"* Reg iy i=%h !=00",dut.reg_file_.b2v_latch_iy_hi.latch);
2807
   if (dut.reg_file_.b2v_latch_sp_lo.latch!==8'h00) $fdisplay(f,"* Reg sp p=%h !=00",dut.reg_file_.b2v_latch_sp_lo.latch);
2808
   if (dut.reg_file_.b2v_latch_sp_hi.latch!==8'h00) $fdisplay(f,"* Reg sp s=%h !=00",dut.reg_file_.b2v_latch_sp_hi.latch);
2809
   if (pc!==16'h0001) $fdisplay(f,"* PC=%h !=0001",pc);
2810
   if (dut.reg_file_.b2v_latch_ir_lo.latch!==8'h01) $fdisplay(f,"* Reg ir r=%h !=01",dut.reg_file_.b2v_latch_ir_lo.latch);
2811
   if (dut.reg_file_.b2v_latch_ir_hi.latch!==8'h00) $fdisplay(f,"* Reg ir i=%h !=00",dut.reg_file_.b2v_latch_ir_hi.latch);
2812 13 gdevic
#1 // End opcode
2813
 
2814 8 gdevic
   force dut.ir_.ctl_ir_we=1;
2815
   force dut.ir_.db=0;
2816
#2 release dut.ir_.ctl_ir_we;
2817
   release dut.ir_.db;
2818 13 gdevic
   $fdisplay(f,"Testing opcode e3      EX (SP),HL");
2819 6 gdevic
   // Preset af
2820
   force dut.reg_file_.b2v_latch_af_lo.we=1;
2821
   force dut.reg_file_.b2v_latch_af_hi.we=1;
2822
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
2823
   force dut.reg_file_.b2v_latch_af_hi.db=8'h00;
2824
#2 release dut.reg_file_.b2v_latch_af_lo.we;
2825
   release dut.reg_file_.b2v_latch_af_hi.we;
2826
   release dut.reg_file_.b2v_latch_af_lo.db;
2827
   release dut.reg_file_.b2v_latch_af_hi.db;
2828
   // Preset bc
2829
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
2830
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
2831
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h00;
2832
   force dut.reg_file_.b2v_latch_bc_hi.db=8'h00;
2833
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
2834
   release dut.reg_file_.b2v_latch_bc_hi.we;
2835
   release dut.reg_file_.b2v_latch_bc_lo.db;
2836
   release dut.reg_file_.b2v_latch_bc_hi.db;
2837
   // Preset de
2838
   force dut.reg_file_.b2v_latch_de_lo.we=1;
2839
   force dut.reg_file_.b2v_latch_de_hi.we=1;
2840
   force dut.reg_file_.b2v_latch_de_lo.db=8'h00;
2841
   force dut.reg_file_.b2v_latch_de_hi.db=8'h00;
2842
#2 release dut.reg_file_.b2v_latch_de_lo.we;
2843
   release dut.reg_file_.b2v_latch_de_hi.we;
2844
   release dut.reg_file_.b2v_latch_de_lo.db;
2845
   release dut.reg_file_.b2v_latch_de_hi.db;
2846
   // Preset hl
2847
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
2848
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
2849
   force dut.reg_file_.b2v_latch_hl_lo.db=8'h22;
2850
   force dut.reg_file_.b2v_latch_hl_hi.db=8'h4d;
2851
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
2852
   release dut.reg_file_.b2v_latch_hl_hi.we;
2853
   release dut.reg_file_.b2v_latch_hl_lo.db;
2854
   release dut.reg_file_.b2v_latch_hl_hi.db;
2855
   // Preset af2
2856
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
2857
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
2858
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
2859
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
2860
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
2861
   release dut.reg_file_.b2v_latch_af2_hi.we;
2862
   release dut.reg_file_.b2v_latch_af2_lo.db;
2863
   release dut.reg_file_.b2v_latch_af2_hi.db;
2864
   // Preset bc2
2865
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
2866
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
2867
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
2868
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
2869
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
2870
   release dut.reg_file_.b2v_latch_bc2_hi.we;
2871
   release dut.reg_file_.b2v_latch_bc2_lo.db;
2872
   release dut.reg_file_.b2v_latch_bc2_hi.db;
2873
   // Preset de2
2874
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
2875
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
2876
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
2877
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
2878
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
2879
   release dut.reg_file_.b2v_latch_de2_hi.we;
2880
   release dut.reg_file_.b2v_latch_de2_lo.db;
2881
   release dut.reg_file_.b2v_latch_de2_hi.db;
2882
   // Preset hl2
2883
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
2884
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
2885
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
2886
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
2887
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
2888
   release dut.reg_file_.b2v_latch_hl2_hi.we;
2889
   release dut.reg_file_.b2v_latch_hl2_lo.db;
2890
   release dut.reg_file_.b2v_latch_hl2_hi.db;
2891
   // Preset ix
2892
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
2893
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
2894
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
2895
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
2896
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
2897
   release dut.reg_file_.b2v_latch_ix_hi.we;
2898
   release dut.reg_file_.b2v_latch_ix_lo.db;
2899
   release dut.reg_file_.b2v_latch_ix_hi.db;
2900
   // Preset iy
2901
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
2902
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
2903
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
2904
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
2905
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
2906
   release dut.reg_file_.b2v_latch_iy_hi.we;
2907
   release dut.reg_file_.b2v_latch_iy_lo.db;
2908
   release dut.reg_file_.b2v_latch_iy_hi.db;
2909
   // Preset sp
2910
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
2911
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
2912
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h73;
2913
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h03;
2914
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
2915
   release dut.reg_file_.b2v_latch_sp_hi.we;
2916
   release dut.reg_file_.b2v_latch_sp_lo.db;
2917
   release dut.reg_file_.b2v_latch_sp_hi.db;
2918
   // Preset wz
2919
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
2920
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
2921
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
2922
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
2923
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
2924
   release dut.reg_file_.b2v_latch_wz_hi.we;
2925
   release dut.reg_file_.b2v_latch_wz_lo.db;
2926
   release dut.reg_file_.b2v_latch_wz_hi.db;
2927
   // Preset pc
2928
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
2929
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
2930
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
2931
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
2932
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
2933
   release dut.reg_file_.b2v_latch_pc_hi.we;
2934
   release dut.reg_file_.b2v_latch_pc_lo.db;
2935
   release dut.reg_file_.b2v_latch_pc_hi.db;
2936
   // Preset ir
2937
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
2938
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
2939
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
2940
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
2941
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
2942
   release dut.reg_file_.b2v_latch_ir_hi.we;
2943
   release dut.reg_file_.b2v_latch_ir_lo.db;
2944
   release dut.reg_file_.b2v_latch_ir_hi.db;
2945
   // Preset memory
2946
   ram.Mem[0] = 8'he3;
2947
   // Preset memory
2948
   ram.Mem[883] = 8'h8e;
2949
   ram.Mem[884] = 8'he1;
2950
   force dut.z80_top_ifc_n.fpga_reset=0;
2951 8 gdevic
   force dut.address_latch_.Q=16'h0000;
2952 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
2953
   release dut.reg_file_.reg_gp_we;
2954 13 gdevic
#2 // Execute: M1/T1 start
2955
#1 release dut.address_latch_.Q;
2956 6 gdevic
#1
2957 13 gdevic
#36 // Wait for opcode end
2958 6 gdevic
   force dut.reg_control_.ctl_reg_sys_we=0;
2959
#2 pc=z.A;
2960
#2
2961
#1 force dut.reg_file_.reg_gp_we=0;
2962
   force dut.z80_top_ifc_n.fpga_reset=1;
2963
   if (dut.reg_file_.b2v_latch_af_lo.latch!==8'h00) $fdisplay(f,"* Reg af f=%h !=00",dut.reg_file_.b2v_latch_af_lo.latch);
2964
   if (dut.reg_file_.b2v_latch_af_hi.latch!==8'h00) $fdisplay(f,"* Reg af a=%h !=00",dut.reg_file_.b2v_latch_af_hi.latch);
2965
   if (dut.reg_file_.b2v_latch_bc_lo.latch!==8'h00) $fdisplay(f,"* Reg bc c=%h !=00",dut.reg_file_.b2v_latch_bc_lo.latch);
2966
   if (dut.reg_file_.b2v_latch_bc_hi.latch!==8'h00) $fdisplay(f,"* Reg bc b=%h !=00",dut.reg_file_.b2v_latch_bc_hi.latch);
2967
   if (dut.reg_file_.b2v_latch_de_lo.latch!==8'h00) $fdisplay(f,"* Reg de e=%h !=00",dut.reg_file_.b2v_latch_de_lo.latch);
2968
   if (dut.reg_file_.b2v_latch_de_hi.latch!==8'h00) $fdisplay(f,"* Reg de d=%h !=00",dut.reg_file_.b2v_latch_de_hi.latch);
2969
   if (dut.reg_file_.b2v_latch_hl_lo.latch!==8'h8e) $fdisplay(f,"* Reg hl l=%h !=8e",dut.reg_file_.b2v_latch_hl_lo.latch);
2970
   if (dut.reg_file_.b2v_latch_hl_hi.latch!==8'he1) $fdisplay(f,"* Reg hl h=%h !=e1",dut.reg_file_.b2v_latch_hl_hi.latch);
2971
   if (dut.reg_file_.b2v_latch_af2_lo.latch!==8'h00) $fdisplay(f,"* Reg af2 f=%h !=00",dut.reg_file_.b2v_latch_af2_lo.latch);
2972
   if (dut.reg_file_.b2v_latch_af2_hi.latch!==8'h00) $fdisplay(f,"* Reg af2 a=%h !=00",dut.reg_file_.b2v_latch_af2_hi.latch);
2973
   if (dut.reg_file_.b2v_latch_bc2_lo.latch!==8'h00) $fdisplay(f,"* Reg bc2 c=%h !=00",dut.reg_file_.b2v_latch_bc2_lo.latch);
2974
   if (dut.reg_file_.b2v_latch_bc2_hi.latch!==8'h00) $fdisplay(f,"* Reg bc2 b=%h !=00",dut.reg_file_.b2v_latch_bc2_hi.latch);
2975
   if (dut.reg_file_.b2v_latch_de2_lo.latch!==8'h00) $fdisplay(f,"* Reg de2 e=%h !=00",dut.reg_file_.b2v_latch_de2_lo.latch);
2976
   if (dut.reg_file_.b2v_latch_de2_hi.latch!==8'h00) $fdisplay(f,"* Reg de2 d=%h !=00",dut.reg_file_.b2v_latch_de2_hi.latch);
2977
   if (dut.reg_file_.b2v_latch_hl2_lo.latch!==8'h00) $fdisplay(f,"* Reg hl2 l=%h !=00",dut.reg_file_.b2v_latch_hl2_lo.latch);
2978
   if (dut.reg_file_.b2v_latch_hl2_hi.latch!==8'h00) $fdisplay(f,"* Reg hl2 h=%h !=00",dut.reg_file_.b2v_latch_hl2_hi.latch);
2979
   if (dut.reg_file_.b2v_latch_ix_lo.latch!==8'h00) $fdisplay(f,"* Reg ix x=%h !=00",dut.reg_file_.b2v_latch_ix_lo.latch);
2980
   if (dut.reg_file_.b2v_latch_ix_hi.latch!==8'h00) $fdisplay(f,"* Reg ix i=%h !=00",dut.reg_file_.b2v_latch_ix_hi.latch);
2981
   if (dut.reg_file_.b2v_latch_iy_lo.latch!==8'h00) $fdisplay(f,"* Reg iy y=%h !=00",dut.reg_file_.b2v_latch_iy_lo.latch);
2982
   if (dut.reg_file_.b2v_latch_iy_hi.latch!==8'h00) $fdisplay(f,"* Reg iy i=%h !=00",dut.reg_file_.b2v_latch_iy_hi.latch);
2983
   if (dut.reg_file_.b2v_latch_sp_lo.latch!==8'h73) $fdisplay(f,"* Reg sp p=%h !=73",dut.reg_file_.b2v_latch_sp_lo.latch);
2984
   if (dut.reg_file_.b2v_latch_sp_hi.latch!==8'h03) $fdisplay(f,"* Reg sp s=%h !=03",dut.reg_file_.b2v_latch_sp_hi.latch);
2985
   if (pc!==16'h0001) $fdisplay(f,"* PC=%h !=0001",pc);
2986
   if (dut.reg_file_.b2v_latch_ir_lo.latch!==8'h01) $fdisplay(f,"* Reg ir r=%h !=01",dut.reg_file_.b2v_latch_ir_lo.latch);
2987
   if (dut.reg_file_.b2v_latch_ir_hi.latch!==8'h00) $fdisplay(f,"* Reg ir i=%h !=00",dut.reg_file_.b2v_latch_ir_hi.latch);
2988
   if (ram.Mem[883]!==8'h22) $fdisplay(f,"* Mem[373]=%h !=22",ram.Mem[883]);
2989
   if (ram.Mem[884]!==8'h4d) $fdisplay(f,"* Mem[374]=%h !=4d",ram.Mem[884]);
2990 13 gdevic
#1 // End opcode
2991
 
2992 8 gdevic
   force dut.ir_.ctl_ir_we=1;
2993
   force dut.ir_.db=0;
2994
#2 release dut.ir_.ctl_ir_we;
2995
   release dut.ir_.db;
2996 13 gdevic
   $fdisplay(f,"Testing opcode 03      INC BC");
2997 6 gdevic
   // Preset af
2998
   force dut.reg_file_.b2v_latch_af_lo.we=1;
2999
   force dut.reg_file_.b2v_latch_af_hi.we=1;
3000
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
3001
   force dut.reg_file_.b2v_latch_af_hi.db=8'h00;
3002
#2 release dut.reg_file_.b2v_latch_af_lo.we;
3003
   release dut.reg_file_.b2v_latch_af_hi.we;
3004
   release dut.reg_file_.b2v_latch_af_lo.db;
3005
   release dut.reg_file_.b2v_latch_af_hi.db;
3006
   // Preset bc
3007
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
3008
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
3009
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h9a;
3010
   force dut.reg_file_.b2v_latch_bc_hi.db=8'h78;
3011
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
3012
   release dut.reg_file_.b2v_latch_bc_hi.we;
3013
   release dut.reg_file_.b2v_latch_bc_lo.db;
3014
   release dut.reg_file_.b2v_latch_bc_hi.db;
3015
   // Preset de
3016
   force dut.reg_file_.b2v_latch_de_lo.we=1;
3017
   force dut.reg_file_.b2v_latch_de_hi.we=1;
3018
   force dut.reg_file_.b2v_latch_de_lo.db=8'h00;
3019
   force dut.reg_file_.b2v_latch_de_hi.db=8'h00;
3020
#2 release dut.reg_file_.b2v_latch_de_lo.we;
3021
   release dut.reg_file_.b2v_latch_de_hi.we;
3022
   release dut.reg_file_.b2v_latch_de_lo.db;
3023
   release dut.reg_file_.b2v_latch_de_hi.db;
3024
   // Preset hl
3025
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
3026
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
3027
   force dut.reg_file_.b2v_latch_hl_lo.db=8'h00;
3028
   force dut.reg_file_.b2v_latch_hl_hi.db=8'h00;
3029
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
3030
   release dut.reg_file_.b2v_latch_hl_hi.we;
3031
   release dut.reg_file_.b2v_latch_hl_lo.db;
3032
   release dut.reg_file_.b2v_latch_hl_hi.db;
3033
   // Preset af2
3034
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
3035
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
3036
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
3037
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
3038
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
3039
   release dut.reg_file_.b2v_latch_af2_hi.we;
3040
   release dut.reg_file_.b2v_latch_af2_lo.db;
3041
   release dut.reg_file_.b2v_latch_af2_hi.db;
3042
   // Preset bc2
3043
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
3044
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
3045
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
3046
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
3047
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
3048
   release dut.reg_file_.b2v_latch_bc2_hi.we;
3049
   release dut.reg_file_.b2v_latch_bc2_lo.db;
3050
   release dut.reg_file_.b2v_latch_bc2_hi.db;
3051
   // Preset de2
3052
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
3053
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
3054
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
3055
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
3056
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
3057
   release dut.reg_file_.b2v_latch_de2_hi.we;
3058
   release dut.reg_file_.b2v_latch_de2_lo.db;
3059
   release dut.reg_file_.b2v_latch_de2_hi.db;
3060
   // Preset hl2
3061
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
3062
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
3063
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
3064
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
3065
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
3066
   release dut.reg_file_.b2v_latch_hl2_hi.we;
3067
   release dut.reg_file_.b2v_latch_hl2_lo.db;
3068
   release dut.reg_file_.b2v_latch_hl2_hi.db;
3069
   // Preset ix
3070
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
3071
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
3072
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
3073
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
3074
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
3075
   release dut.reg_file_.b2v_latch_ix_hi.we;
3076
   release dut.reg_file_.b2v_latch_ix_lo.db;
3077
   release dut.reg_file_.b2v_latch_ix_hi.db;
3078
   // Preset iy
3079
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
3080
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
3081
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
3082
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
3083
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
3084
   release dut.reg_file_.b2v_latch_iy_hi.we;
3085
   release dut.reg_file_.b2v_latch_iy_lo.db;
3086
   release dut.reg_file_.b2v_latch_iy_hi.db;
3087
   // Preset sp
3088
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
3089
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
3090
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
3091
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
3092
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
3093
   release dut.reg_file_.b2v_latch_sp_hi.we;
3094
   release dut.reg_file_.b2v_latch_sp_lo.db;
3095
   release dut.reg_file_.b2v_latch_sp_hi.db;
3096
   // Preset wz
3097
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
3098
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
3099
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
3100
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
3101
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
3102
   release dut.reg_file_.b2v_latch_wz_hi.we;
3103
   release dut.reg_file_.b2v_latch_wz_lo.db;
3104
   release dut.reg_file_.b2v_latch_wz_hi.db;
3105
   // Preset pc
3106
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
3107
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
3108
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
3109
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
3110
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
3111
   release dut.reg_file_.b2v_latch_pc_hi.we;
3112
   release dut.reg_file_.b2v_latch_pc_lo.db;
3113
   release dut.reg_file_.b2v_latch_pc_hi.db;
3114
   // Preset ir
3115
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
3116
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
3117
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
3118
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
3119
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
3120
   release dut.reg_file_.b2v_latch_ir_hi.we;
3121
   release dut.reg_file_.b2v_latch_ir_lo.db;
3122
   release dut.reg_file_.b2v_latch_ir_hi.db;
3123
   // Preset memory
3124
   ram.Mem[0] = 8'h03;
3125
   force dut.z80_top_ifc_n.fpga_reset=0;
3126 8 gdevic
   force dut.address_latch_.Q=16'h0000;
3127 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
3128
   release dut.reg_file_.reg_gp_we;
3129 13 gdevic
#2 // Execute: M1/T1 start
3130
#1 release dut.address_latch_.Q;
3131 6 gdevic
#1
3132 13 gdevic
#10 // Wait for opcode end
3133 6 gdevic
   force dut.reg_control_.ctl_reg_sys_we=0;
3134
#2 pc=z.A;
3135
#2
3136
#1 force dut.reg_file_.reg_gp_we=0;
3137
   force dut.z80_top_ifc_n.fpga_reset=1;
3138
   if (dut.reg_file_.b2v_latch_af_lo.latch!==8'h00) $fdisplay(f,"* Reg af f=%h !=00",dut.reg_file_.b2v_latch_af_lo.latch);
3139
   if (dut.reg_file_.b2v_latch_af_hi.latch!==8'h00) $fdisplay(f,"* Reg af a=%h !=00",dut.reg_file_.b2v_latch_af_hi.latch);
3140
   if (dut.reg_file_.b2v_latch_bc_lo.latch!==8'h9b) $fdisplay(f,"* Reg bc c=%h !=9b",dut.reg_file_.b2v_latch_bc_lo.latch);
3141
   if (dut.reg_file_.b2v_latch_bc_hi.latch!==8'h78) $fdisplay(f,"* Reg bc b=%h !=78",dut.reg_file_.b2v_latch_bc_hi.latch);
3142
   if (dut.reg_file_.b2v_latch_de_lo.latch!==8'h00) $fdisplay(f,"* Reg de e=%h !=00",dut.reg_file_.b2v_latch_de_lo.latch);
3143
   if (dut.reg_file_.b2v_latch_de_hi.latch!==8'h00) $fdisplay(f,"* Reg de d=%h !=00",dut.reg_file_.b2v_latch_de_hi.latch);
3144
   if (dut.reg_file_.b2v_latch_hl_lo.latch!==8'h00) $fdisplay(f,"* Reg hl l=%h !=00",dut.reg_file_.b2v_latch_hl_lo.latch);
3145
   if (dut.reg_file_.b2v_latch_hl_hi.latch!==8'h00) $fdisplay(f,"* Reg hl h=%h !=00",dut.reg_file_.b2v_latch_hl_hi.latch);
3146
   if (dut.reg_file_.b2v_latch_af2_lo.latch!==8'h00) $fdisplay(f,"* Reg af2 f=%h !=00",dut.reg_file_.b2v_latch_af2_lo.latch);
3147
   if (dut.reg_file_.b2v_latch_af2_hi.latch!==8'h00) $fdisplay(f,"* Reg af2 a=%h !=00",dut.reg_file_.b2v_latch_af2_hi.latch);
3148
   if (dut.reg_file_.b2v_latch_bc2_lo.latch!==8'h00) $fdisplay(f,"* Reg bc2 c=%h !=00",dut.reg_file_.b2v_latch_bc2_lo.latch);
3149
   if (dut.reg_file_.b2v_latch_bc2_hi.latch!==8'h00) $fdisplay(f,"* Reg bc2 b=%h !=00",dut.reg_file_.b2v_latch_bc2_hi.latch);
3150
   if (dut.reg_file_.b2v_latch_de2_lo.latch!==8'h00) $fdisplay(f,"* Reg de2 e=%h !=00",dut.reg_file_.b2v_latch_de2_lo.latch);
3151
   if (dut.reg_file_.b2v_latch_de2_hi.latch!==8'h00) $fdisplay(f,"* Reg de2 d=%h !=00",dut.reg_file_.b2v_latch_de2_hi.latch);
3152
   if (dut.reg_file_.b2v_latch_hl2_lo.latch!==8'h00) $fdisplay(f,"* Reg hl2 l=%h !=00",dut.reg_file_.b2v_latch_hl2_lo.latch);
3153
   if (dut.reg_file_.b2v_latch_hl2_hi.latch!==8'h00) $fdisplay(f,"* Reg hl2 h=%h !=00",dut.reg_file_.b2v_latch_hl2_hi.latch);
3154
   if (dut.reg_file_.b2v_latch_ix_lo.latch!==8'h00) $fdisplay(f,"* Reg ix x=%h !=00",dut.reg_file_.b2v_latch_ix_lo.latch);
3155
   if (dut.reg_file_.b2v_latch_ix_hi.latch!==8'h00) $fdisplay(f,"* Reg ix i=%h !=00",dut.reg_file_.b2v_latch_ix_hi.latch);
3156
   if (dut.reg_file_.b2v_latch_iy_lo.latch!==8'h00) $fdisplay(f,"* Reg iy y=%h !=00",dut.reg_file_.b2v_latch_iy_lo.latch);
3157
   if (dut.reg_file_.b2v_latch_iy_hi.latch!==8'h00) $fdisplay(f,"* Reg iy i=%h !=00",dut.reg_file_.b2v_latch_iy_hi.latch);
3158
   if (dut.reg_file_.b2v_latch_sp_lo.latch!==8'h00) $fdisplay(f,"* Reg sp p=%h !=00",dut.reg_file_.b2v_latch_sp_lo.latch);
3159
   if (dut.reg_file_.b2v_latch_sp_hi.latch!==8'h00) $fdisplay(f,"* Reg sp s=%h !=00",dut.reg_file_.b2v_latch_sp_hi.latch);
3160
   if (pc!==16'h0001) $fdisplay(f,"* PC=%h !=0001",pc);
3161
   if (dut.reg_file_.b2v_latch_ir_lo.latch!==8'h01) $fdisplay(f,"* Reg ir r=%h !=01",dut.reg_file_.b2v_latch_ir_lo.latch);
3162
   if (dut.reg_file_.b2v_latch_ir_hi.latch!==8'h00) $fdisplay(f,"* Reg ir i=%h !=00",dut.reg_file_.b2v_latch_ir_hi.latch);
3163 13 gdevic
#1 // End opcode
3164
 
3165 8 gdevic
   force dut.ir_.ctl_ir_we=1;
3166
   force dut.ir_.db=0;
3167
#2 release dut.ir_.ctl_ir_we;
3168
   release dut.ir_.db;
3169 13 gdevic
   $fdisplay(f,"Testing opcode 3b      DEC SP");
3170 6 gdevic
   // Preset af
3171
   force dut.reg_file_.b2v_latch_af_lo.we=1;
3172
   force dut.reg_file_.b2v_latch_af_hi.we=1;
3173
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
3174
   force dut.reg_file_.b2v_latch_af_hi.db=8'h00;
3175
#2 release dut.reg_file_.b2v_latch_af_lo.we;
3176
   release dut.reg_file_.b2v_latch_af_hi.we;
3177
   release dut.reg_file_.b2v_latch_af_lo.db;
3178
   release dut.reg_file_.b2v_latch_af_hi.db;
3179
   // Preset bc
3180
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
3181
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
3182
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h00;
3183
   force dut.reg_file_.b2v_latch_bc_hi.db=8'h00;
3184
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
3185
   release dut.reg_file_.b2v_latch_bc_hi.we;
3186
   release dut.reg_file_.b2v_latch_bc_lo.db;
3187
   release dut.reg_file_.b2v_latch_bc_hi.db;
3188
   // Preset de
3189
   force dut.reg_file_.b2v_latch_de_lo.we=1;
3190
   force dut.reg_file_.b2v_latch_de_hi.we=1;
3191
   force dut.reg_file_.b2v_latch_de_lo.db=8'h00;
3192
   force dut.reg_file_.b2v_latch_de_hi.db=8'h00;
3193
#2 release dut.reg_file_.b2v_latch_de_lo.we;
3194
   release dut.reg_file_.b2v_latch_de_hi.we;
3195
   release dut.reg_file_.b2v_latch_de_lo.db;
3196
   release dut.reg_file_.b2v_latch_de_hi.db;
3197
   // Preset hl
3198
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
3199
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
3200
   force dut.reg_file_.b2v_latch_hl_lo.db=8'h00;
3201
   force dut.reg_file_.b2v_latch_hl_hi.db=8'h00;
3202
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
3203
   release dut.reg_file_.b2v_latch_hl_hi.we;
3204
   release dut.reg_file_.b2v_latch_hl_lo.db;
3205
   release dut.reg_file_.b2v_latch_hl_hi.db;
3206
   // Preset af2
3207
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
3208
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
3209
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
3210
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
3211
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
3212
   release dut.reg_file_.b2v_latch_af2_hi.we;
3213
   release dut.reg_file_.b2v_latch_af2_lo.db;
3214
   release dut.reg_file_.b2v_latch_af2_hi.db;
3215
   // Preset bc2
3216
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
3217
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
3218
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
3219
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
3220
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
3221
   release dut.reg_file_.b2v_latch_bc2_hi.we;
3222
   release dut.reg_file_.b2v_latch_bc2_lo.db;
3223
   release dut.reg_file_.b2v_latch_bc2_hi.db;
3224
   // Preset de2
3225
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
3226
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
3227
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
3228
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
3229
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
3230
   release dut.reg_file_.b2v_latch_de2_hi.we;
3231
   release dut.reg_file_.b2v_latch_de2_lo.db;
3232
   release dut.reg_file_.b2v_latch_de2_hi.db;
3233
   // Preset hl2
3234
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
3235
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
3236
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
3237
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
3238
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
3239
   release dut.reg_file_.b2v_latch_hl2_hi.we;
3240
   release dut.reg_file_.b2v_latch_hl2_lo.db;
3241
   release dut.reg_file_.b2v_latch_hl2_hi.db;
3242
   // Preset ix
3243
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
3244
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
3245
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
3246
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
3247
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
3248
   release dut.reg_file_.b2v_latch_ix_hi.we;
3249
   release dut.reg_file_.b2v_latch_ix_lo.db;
3250
   release dut.reg_file_.b2v_latch_ix_hi.db;
3251
   // Preset iy
3252
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
3253
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
3254
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
3255
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
3256
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
3257
   release dut.reg_file_.b2v_latch_iy_hi.we;
3258
   release dut.reg_file_.b2v_latch_iy_lo.db;
3259
   release dut.reg_file_.b2v_latch_iy_hi.db;
3260
   // Preset sp
3261
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
3262
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
3263
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h36;
3264
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h9d;
3265
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
3266
   release dut.reg_file_.b2v_latch_sp_hi.we;
3267
   release dut.reg_file_.b2v_latch_sp_lo.db;
3268
   release dut.reg_file_.b2v_latch_sp_hi.db;
3269
   // Preset wz
3270
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
3271
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
3272
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
3273
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
3274
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
3275
   release dut.reg_file_.b2v_latch_wz_hi.we;
3276
   release dut.reg_file_.b2v_latch_wz_lo.db;
3277
   release dut.reg_file_.b2v_latch_wz_hi.db;
3278
   // Preset pc
3279
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
3280
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
3281
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
3282
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
3283
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
3284
   release dut.reg_file_.b2v_latch_pc_hi.we;
3285
   release dut.reg_file_.b2v_latch_pc_lo.db;
3286
   release dut.reg_file_.b2v_latch_pc_hi.db;
3287
   // Preset ir
3288
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
3289
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
3290
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
3291
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
3292
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
3293
   release dut.reg_file_.b2v_latch_ir_hi.we;
3294
   release dut.reg_file_.b2v_latch_ir_lo.db;
3295
   release dut.reg_file_.b2v_latch_ir_hi.db;
3296
   // Preset memory
3297
   ram.Mem[0] = 8'h3b;
3298
   force dut.z80_top_ifc_n.fpga_reset=0;
3299 8 gdevic
   force dut.address_latch_.Q=16'h0000;
3300 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
3301
   release dut.reg_file_.reg_gp_we;
3302 13 gdevic
#2 // Execute: M1/T1 start
3303
#1 release dut.address_latch_.Q;
3304 6 gdevic
#1
3305 13 gdevic
#10 // Wait for opcode end
3306 6 gdevic
   force dut.reg_control_.ctl_reg_sys_we=0;
3307
#2 pc=z.A;
3308
#2
3309
#1 force dut.reg_file_.reg_gp_we=0;
3310
   force dut.z80_top_ifc_n.fpga_reset=1;
3311
   if (dut.reg_file_.b2v_latch_af_lo.latch!==8'h00) $fdisplay(f,"* Reg af f=%h !=00",dut.reg_file_.b2v_latch_af_lo.latch);
3312
   if (dut.reg_file_.b2v_latch_af_hi.latch!==8'h00) $fdisplay(f,"* Reg af a=%h !=00",dut.reg_file_.b2v_latch_af_hi.latch);
3313
   if (dut.reg_file_.b2v_latch_bc_lo.latch!==8'h00) $fdisplay(f,"* Reg bc c=%h !=00",dut.reg_file_.b2v_latch_bc_lo.latch);
3314
   if (dut.reg_file_.b2v_latch_bc_hi.latch!==8'h00) $fdisplay(f,"* Reg bc b=%h !=00",dut.reg_file_.b2v_latch_bc_hi.latch);
3315
   if (dut.reg_file_.b2v_latch_de_lo.latch!==8'h00) $fdisplay(f,"* Reg de e=%h !=00",dut.reg_file_.b2v_latch_de_lo.latch);
3316
   if (dut.reg_file_.b2v_latch_de_hi.latch!==8'h00) $fdisplay(f,"* Reg de d=%h !=00",dut.reg_file_.b2v_latch_de_hi.latch);
3317
   if (dut.reg_file_.b2v_latch_hl_lo.latch!==8'h00) $fdisplay(f,"* Reg hl l=%h !=00",dut.reg_file_.b2v_latch_hl_lo.latch);
3318
   if (dut.reg_file_.b2v_latch_hl_hi.latch!==8'h00) $fdisplay(f,"* Reg hl h=%h !=00",dut.reg_file_.b2v_latch_hl_hi.latch);
3319
   if (dut.reg_file_.b2v_latch_af2_lo.latch!==8'h00) $fdisplay(f,"* Reg af2 f=%h !=00",dut.reg_file_.b2v_latch_af2_lo.latch);
3320
   if (dut.reg_file_.b2v_latch_af2_hi.latch!==8'h00) $fdisplay(f,"* Reg af2 a=%h !=00",dut.reg_file_.b2v_latch_af2_hi.latch);
3321
   if (dut.reg_file_.b2v_latch_bc2_lo.latch!==8'h00) $fdisplay(f,"* Reg bc2 c=%h !=00",dut.reg_file_.b2v_latch_bc2_lo.latch);
3322
   if (dut.reg_file_.b2v_latch_bc2_hi.latch!==8'h00) $fdisplay(f,"* Reg bc2 b=%h !=00",dut.reg_file_.b2v_latch_bc2_hi.latch);
3323
   if (dut.reg_file_.b2v_latch_de2_lo.latch!==8'h00) $fdisplay(f,"* Reg de2 e=%h !=00",dut.reg_file_.b2v_latch_de2_lo.latch);
3324
   if (dut.reg_file_.b2v_latch_de2_hi.latch!==8'h00) $fdisplay(f,"* Reg de2 d=%h !=00",dut.reg_file_.b2v_latch_de2_hi.latch);
3325
   if (dut.reg_file_.b2v_latch_hl2_lo.latch!==8'h00) $fdisplay(f,"* Reg hl2 l=%h !=00",dut.reg_file_.b2v_latch_hl2_lo.latch);
3326
   if (dut.reg_file_.b2v_latch_hl2_hi.latch!==8'h00) $fdisplay(f,"* Reg hl2 h=%h !=00",dut.reg_file_.b2v_latch_hl2_hi.latch);
3327
   if (dut.reg_file_.b2v_latch_ix_lo.latch!==8'h00) $fdisplay(f,"* Reg ix x=%h !=00",dut.reg_file_.b2v_latch_ix_lo.latch);
3328
   if (dut.reg_file_.b2v_latch_ix_hi.latch!==8'h00) $fdisplay(f,"* Reg ix i=%h !=00",dut.reg_file_.b2v_latch_ix_hi.latch);
3329
   if (dut.reg_file_.b2v_latch_iy_lo.latch!==8'h00) $fdisplay(f,"* Reg iy y=%h !=00",dut.reg_file_.b2v_latch_iy_lo.latch);
3330
   if (dut.reg_file_.b2v_latch_iy_hi.latch!==8'h00) $fdisplay(f,"* Reg iy i=%h !=00",dut.reg_file_.b2v_latch_iy_hi.latch);
3331
   if (dut.reg_file_.b2v_latch_sp_lo.latch!==8'h35) $fdisplay(f,"* Reg sp p=%h !=35",dut.reg_file_.b2v_latch_sp_lo.latch);
3332
   if (dut.reg_file_.b2v_latch_sp_hi.latch!==8'h9d) $fdisplay(f,"* Reg sp s=%h !=9d",dut.reg_file_.b2v_latch_sp_hi.latch);
3333
   if (pc!==16'h0001) $fdisplay(f,"* PC=%h !=0001",pc);
3334
   if (dut.reg_file_.b2v_latch_ir_lo.latch!==8'h01) $fdisplay(f,"* Reg ir r=%h !=01",dut.reg_file_.b2v_latch_ir_lo.latch);
3335
   if (dut.reg_file_.b2v_latch_ir_hi.latch!==8'h00) $fdisplay(f,"* Reg ir i=%h !=00",dut.reg_file_.b2v_latch_ir_hi.latch);
3336 13 gdevic
#1 // End opcode
3337
 
3338 8 gdevic
   force dut.ir_.ctl_ir_we=1;
3339
   force dut.ir_.db=0;
3340
#2 release dut.ir_.ctl_ir_we;
3341
   release dut.ir_.db;
3342 13 gdevic
   $fdisplay(f,"Testing opcode 07      RLCA");
3343 6 gdevic
   // Preset af
3344
   force dut.reg_file_.b2v_latch_af_lo.we=1;
3345
   force dut.reg_file_.b2v_latch_af_hi.we=1;
3346
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
3347
   force dut.reg_file_.b2v_latch_af_hi.db=8'h88;
3348
#2 release dut.reg_file_.b2v_latch_af_lo.we;
3349
   release dut.reg_file_.b2v_latch_af_hi.we;
3350
   release dut.reg_file_.b2v_latch_af_lo.db;
3351
   release dut.reg_file_.b2v_latch_af_hi.db;
3352
   // Preset bc
3353
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
3354
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
3355
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h00;
3356
   force dut.reg_file_.b2v_latch_bc_hi.db=8'h00;
3357
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
3358
   release dut.reg_file_.b2v_latch_bc_hi.we;
3359
   release dut.reg_file_.b2v_latch_bc_lo.db;
3360
   release dut.reg_file_.b2v_latch_bc_hi.db;
3361
   // Preset de
3362
   force dut.reg_file_.b2v_latch_de_lo.we=1;
3363
   force dut.reg_file_.b2v_latch_de_hi.we=1;
3364
   force dut.reg_file_.b2v_latch_de_lo.db=8'h00;
3365
   force dut.reg_file_.b2v_latch_de_hi.db=8'h00;
3366
#2 release dut.reg_file_.b2v_latch_de_lo.we;
3367
   release dut.reg_file_.b2v_latch_de_hi.we;
3368
   release dut.reg_file_.b2v_latch_de_lo.db;
3369
   release dut.reg_file_.b2v_latch_de_hi.db;
3370
   // Preset hl
3371
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
3372
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
3373
   force dut.reg_file_.b2v_latch_hl_lo.db=8'h00;
3374
   force dut.reg_file_.b2v_latch_hl_hi.db=8'h00;
3375
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
3376
   release dut.reg_file_.b2v_latch_hl_hi.we;
3377
   release dut.reg_file_.b2v_latch_hl_lo.db;
3378
   release dut.reg_file_.b2v_latch_hl_hi.db;
3379
   // Preset af2
3380
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
3381
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
3382
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
3383
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
3384
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
3385
   release dut.reg_file_.b2v_latch_af2_hi.we;
3386
   release dut.reg_file_.b2v_latch_af2_lo.db;
3387
   release dut.reg_file_.b2v_latch_af2_hi.db;
3388
   // Preset bc2
3389
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
3390
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
3391
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
3392
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
3393
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
3394
   release dut.reg_file_.b2v_latch_bc2_hi.we;
3395
   release dut.reg_file_.b2v_latch_bc2_lo.db;
3396
   release dut.reg_file_.b2v_latch_bc2_hi.db;
3397
   // Preset de2
3398
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
3399
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
3400
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
3401
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
3402
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
3403
   release dut.reg_file_.b2v_latch_de2_hi.we;
3404
   release dut.reg_file_.b2v_latch_de2_lo.db;
3405
   release dut.reg_file_.b2v_latch_de2_hi.db;
3406
   // Preset hl2
3407
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
3408
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
3409
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
3410
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
3411
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
3412
   release dut.reg_file_.b2v_latch_hl2_hi.we;
3413
   release dut.reg_file_.b2v_latch_hl2_lo.db;
3414
   release dut.reg_file_.b2v_latch_hl2_hi.db;
3415
   // Preset ix
3416
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
3417
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
3418
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
3419
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
3420
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
3421
   release dut.reg_file_.b2v_latch_ix_hi.we;
3422
   release dut.reg_file_.b2v_latch_ix_lo.db;
3423
   release dut.reg_file_.b2v_latch_ix_hi.db;
3424
   // Preset iy
3425
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
3426
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
3427
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
3428
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
3429
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
3430
   release dut.reg_file_.b2v_latch_iy_hi.we;
3431
   release dut.reg_file_.b2v_latch_iy_lo.db;
3432
   release dut.reg_file_.b2v_latch_iy_hi.db;
3433
   // Preset sp
3434
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
3435
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
3436
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
3437
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
3438
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
3439
   release dut.reg_file_.b2v_latch_sp_hi.we;
3440
   release dut.reg_file_.b2v_latch_sp_lo.db;
3441
   release dut.reg_file_.b2v_latch_sp_hi.db;
3442
   // Preset wz
3443
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
3444
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
3445
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
3446
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
3447
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
3448
   release dut.reg_file_.b2v_latch_wz_hi.we;
3449
   release dut.reg_file_.b2v_latch_wz_lo.db;
3450
   release dut.reg_file_.b2v_latch_wz_hi.db;
3451
   // Preset pc
3452
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
3453
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
3454
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
3455
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
3456
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
3457
   release dut.reg_file_.b2v_latch_pc_hi.we;
3458
   release dut.reg_file_.b2v_latch_pc_lo.db;
3459
   release dut.reg_file_.b2v_latch_pc_hi.db;
3460
   // Preset ir
3461
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
3462
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
3463
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
3464
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
3465
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
3466
   release dut.reg_file_.b2v_latch_ir_hi.we;
3467
   release dut.reg_file_.b2v_latch_ir_lo.db;
3468
   release dut.reg_file_.b2v_latch_ir_hi.db;
3469
   // Preset memory
3470
   ram.Mem[0] = 8'h07;
3471
   force dut.z80_top_ifc_n.fpga_reset=0;
3472 8 gdevic
   force dut.address_latch_.Q=16'h0000;
3473 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
3474
   release dut.reg_file_.reg_gp_we;
3475 13 gdevic
#2 // Execute: M1/T1 start
3476
#1 release dut.address_latch_.Q;
3477 6 gdevic
#1
3478 13 gdevic
#6 // Wait for opcode end
3479 6 gdevic
   force dut.reg_control_.ctl_reg_sys_we=0;
3480
#2 pc=z.A;
3481
#2
3482
#1 force dut.reg_file_.reg_gp_we=0;
3483
   force dut.z80_top_ifc_n.fpga_reset=1;
3484
   if (dut.reg_file_.b2v_latch_af_lo.latch!==8'h01) $fdisplay(f,"* Reg af f=%h !=01",dut.reg_file_.b2v_latch_af_lo.latch);
3485
   if (dut.reg_file_.b2v_latch_af_hi.latch!==8'h11) $fdisplay(f,"* Reg af a=%h !=11",dut.reg_file_.b2v_latch_af_hi.latch);
3486
   if (dut.reg_file_.b2v_latch_bc_lo.latch!==8'h00) $fdisplay(f,"* Reg bc c=%h !=00",dut.reg_file_.b2v_latch_bc_lo.latch);
3487
   if (dut.reg_file_.b2v_latch_bc_hi.latch!==8'h00) $fdisplay(f,"* Reg bc b=%h !=00",dut.reg_file_.b2v_latch_bc_hi.latch);
3488
   if (dut.reg_file_.b2v_latch_de_lo.latch!==8'h00) $fdisplay(f,"* Reg de e=%h !=00",dut.reg_file_.b2v_latch_de_lo.latch);
3489
   if (dut.reg_file_.b2v_latch_de_hi.latch!==8'h00) $fdisplay(f,"* Reg de d=%h !=00",dut.reg_file_.b2v_latch_de_hi.latch);
3490
   if (dut.reg_file_.b2v_latch_hl_lo.latch!==8'h00) $fdisplay(f,"* Reg hl l=%h !=00",dut.reg_file_.b2v_latch_hl_lo.latch);
3491
   if (dut.reg_file_.b2v_latch_hl_hi.latch!==8'h00) $fdisplay(f,"* Reg hl h=%h !=00",dut.reg_file_.b2v_latch_hl_hi.latch);
3492
   if (dut.reg_file_.b2v_latch_af2_lo.latch!==8'h00) $fdisplay(f,"* Reg af2 f=%h !=00",dut.reg_file_.b2v_latch_af2_lo.latch);
3493
   if (dut.reg_file_.b2v_latch_af2_hi.latch!==8'h00) $fdisplay(f,"* Reg af2 a=%h !=00",dut.reg_file_.b2v_latch_af2_hi.latch);
3494
   if (dut.reg_file_.b2v_latch_bc2_lo.latch!==8'h00) $fdisplay(f,"* Reg bc2 c=%h !=00",dut.reg_file_.b2v_latch_bc2_lo.latch);
3495
   if (dut.reg_file_.b2v_latch_bc2_hi.latch!==8'h00) $fdisplay(f,"* Reg bc2 b=%h !=00",dut.reg_file_.b2v_latch_bc2_hi.latch);
3496
   if (dut.reg_file_.b2v_latch_de2_lo.latch!==8'h00) $fdisplay(f,"* Reg de2 e=%h !=00",dut.reg_file_.b2v_latch_de2_lo.latch);
3497
   if (dut.reg_file_.b2v_latch_de2_hi.latch!==8'h00) $fdisplay(f,"* Reg de2 d=%h !=00",dut.reg_file_.b2v_latch_de2_hi.latch);
3498
   if (dut.reg_file_.b2v_latch_hl2_lo.latch!==8'h00) $fdisplay(f,"* Reg hl2 l=%h !=00",dut.reg_file_.b2v_latch_hl2_lo.latch);
3499
   if (dut.reg_file_.b2v_latch_hl2_hi.latch!==8'h00) $fdisplay(f,"* Reg hl2 h=%h !=00",dut.reg_file_.b2v_latch_hl2_hi.latch);
3500
   if (dut.reg_file_.b2v_latch_ix_lo.latch!==8'h00) $fdisplay(f,"* Reg ix x=%h !=00",dut.reg_file_.b2v_latch_ix_lo.latch);
3501
   if (dut.reg_file_.b2v_latch_ix_hi.latch!==8'h00) $fdisplay(f,"* Reg ix i=%h !=00",dut.reg_file_.b2v_latch_ix_hi.latch);
3502
   if (dut.reg_file_.b2v_latch_iy_lo.latch!==8'h00) $fdisplay(f,"* Reg iy y=%h !=00",dut.reg_file_.b2v_latch_iy_lo.latch);
3503
   if (dut.reg_file_.b2v_latch_iy_hi.latch!==8'h00) $fdisplay(f,"* Reg iy i=%h !=00",dut.reg_file_.b2v_latch_iy_hi.latch);
3504
   if (dut.reg_file_.b2v_latch_sp_lo.latch!==8'h00) $fdisplay(f,"* Reg sp p=%h !=00",dut.reg_file_.b2v_latch_sp_lo.latch);
3505
   if (dut.reg_file_.b2v_latch_sp_hi.latch!==8'h00) $fdisplay(f,"* Reg sp s=%h !=00",dut.reg_file_.b2v_latch_sp_hi.latch);
3506
   if (pc!==16'h0001) $fdisplay(f,"* PC=%h !=0001",pc);
3507
   if (dut.reg_file_.b2v_latch_ir_lo.latch!==8'h01) $fdisplay(f,"* Reg ir r=%h !=01",dut.reg_file_.b2v_latch_ir_lo.latch);
3508
   if (dut.reg_file_.b2v_latch_ir_hi.latch!==8'h00) $fdisplay(f,"* Reg ir i=%h !=00",dut.reg_file_.b2v_latch_ir_hi.latch);
3509 13 gdevic
#1 // End opcode
3510
 
3511 8 gdevic
   force dut.ir_.ctl_ir_we=1;
3512
   force dut.ir_.db=0;
3513
#2 release dut.ir_.ctl_ir_we;
3514
   release dut.ir_.db;
3515 13 gdevic
   $fdisplay(f,"Testing opcode 1f      RRA");
3516 6 gdevic
   // Preset af
3517
   force dut.reg_file_.b2v_latch_af_lo.we=1;
3518
   force dut.reg_file_.b2v_latch_af_hi.we=1;
3519
   force dut.reg_file_.b2v_latch_af_lo.db=8'hc4;
3520
   force dut.reg_file_.b2v_latch_af_hi.db=8'h01;
3521
#2 release dut.reg_file_.b2v_latch_af_lo.we;
3522
   release dut.reg_file_.b2v_latch_af_hi.we;
3523
   release dut.reg_file_.b2v_latch_af_lo.db;
3524
   release dut.reg_file_.b2v_latch_af_hi.db;
3525
   // Preset bc
3526
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
3527
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
3528
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h00;
3529
   force dut.reg_file_.b2v_latch_bc_hi.db=8'h00;
3530
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
3531
   release dut.reg_file_.b2v_latch_bc_hi.we;
3532
   release dut.reg_file_.b2v_latch_bc_lo.db;
3533
   release dut.reg_file_.b2v_latch_bc_hi.db;
3534
   // Preset de
3535
   force dut.reg_file_.b2v_latch_de_lo.we=1;
3536
   force dut.reg_file_.b2v_latch_de_hi.we=1;
3537
   force dut.reg_file_.b2v_latch_de_lo.db=8'h00;
3538
   force dut.reg_file_.b2v_latch_de_hi.db=8'h00;
3539
#2 release dut.reg_file_.b2v_latch_de_lo.we;
3540
   release dut.reg_file_.b2v_latch_de_hi.we;
3541
   release dut.reg_file_.b2v_latch_de_lo.db;
3542
   release dut.reg_file_.b2v_latch_de_hi.db;
3543
   // Preset hl
3544
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
3545
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
3546
   force dut.reg_file_.b2v_latch_hl_lo.db=8'h00;
3547
   force dut.reg_file_.b2v_latch_hl_hi.db=8'h00;
3548
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
3549
   release dut.reg_file_.b2v_latch_hl_hi.we;
3550
   release dut.reg_file_.b2v_latch_hl_lo.db;
3551
   release dut.reg_file_.b2v_latch_hl_hi.db;
3552
   // Preset af2
3553
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
3554
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
3555
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
3556
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
3557
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
3558
   release dut.reg_file_.b2v_latch_af2_hi.we;
3559
   release dut.reg_file_.b2v_latch_af2_lo.db;
3560
   release dut.reg_file_.b2v_latch_af2_hi.db;
3561
   // Preset bc2
3562
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
3563
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
3564
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
3565
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
3566
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
3567
   release dut.reg_file_.b2v_latch_bc2_hi.we;
3568
   release dut.reg_file_.b2v_latch_bc2_lo.db;
3569
   release dut.reg_file_.b2v_latch_bc2_hi.db;
3570
   // Preset de2
3571
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
3572
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
3573
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
3574
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
3575
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
3576
   release dut.reg_file_.b2v_latch_de2_hi.we;
3577
   release dut.reg_file_.b2v_latch_de2_lo.db;
3578
   release dut.reg_file_.b2v_latch_de2_hi.db;
3579
   // Preset hl2
3580
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
3581
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
3582
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
3583
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
3584
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
3585
   release dut.reg_file_.b2v_latch_hl2_hi.we;
3586
   release dut.reg_file_.b2v_latch_hl2_lo.db;
3587
   release dut.reg_file_.b2v_latch_hl2_hi.db;
3588
   // Preset ix
3589
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
3590
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
3591
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
3592
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
3593
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
3594
   release dut.reg_file_.b2v_latch_ix_hi.we;
3595
   release dut.reg_file_.b2v_latch_ix_lo.db;
3596
   release dut.reg_file_.b2v_latch_ix_hi.db;
3597
   // Preset iy
3598
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
3599
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
3600
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
3601
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
3602
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
3603
   release dut.reg_file_.b2v_latch_iy_hi.we;
3604
   release dut.reg_file_.b2v_latch_iy_lo.db;
3605
   release dut.reg_file_.b2v_latch_iy_hi.db;
3606
   // Preset sp
3607
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
3608
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
3609
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
3610
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
3611
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
3612
   release dut.reg_file_.b2v_latch_sp_hi.we;
3613
   release dut.reg_file_.b2v_latch_sp_lo.db;
3614
   release dut.reg_file_.b2v_latch_sp_hi.db;
3615
   // Preset wz
3616
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
3617
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
3618
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
3619
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
3620
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
3621
   release dut.reg_file_.b2v_latch_wz_hi.we;
3622
   release dut.reg_file_.b2v_latch_wz_lo.db;
3623
   release dut.reg_file_.b2v_latch_wz_hi.db;
3624
   // Preset pc
3625
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
3626
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
3627
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
3628
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
3629
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
3630
   release dut.reg_file_.b2v_latch_pc_hi.we;
3631
   release dut.reg_file_.b2v_latch_pc_lo.db;
3632
   release dut.reg_file_.b2v_latch_pc_hi.db;
3633
   // Preset ir
3634
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
3635
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
3636
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
3637
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
3638
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
3639
   release dut.reg_file_.b2v_latch_ir_hi.we;
3640
   release dut.reg_file_.b2v_latch_ir_lo.db;
3641
   release dut.reg_file_.b2v_latch_ir_hi.db;
3642
   // Preset memory
3643
   ram.Mem[0] = 8'h1f;
3644
   force dut.z80_top_ifc_n.fpga_reset=0;
3645 8 gdevic
   force dut.address_latch_.Q=16'h0000;
3646 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
3647
   release dut.reg_file_.reg_gp_we;
3648 13 gdevic
#2 // Execute: M1/T1 start
3649
#1 release dut.address_latch_.Q;
3650 6 gdevic
#1
3651 13 gdevic
#6 // Wait for opcode end
3652 6 gdevic
   force dut.reg_control_.ctl_reg_sys_we=0;
3653
#2 pc=z.A;
3654
#2
3655
#1 force dut.reg_file_.reg_gp_we=0;
3656
   force dut.z80_top_ifc_n.fpga_reset=1;
3657
   if (dut.reg_file_.b2v_latch_af_lo.latch!==8'hc5) $fdisplay(f,"* Reg af f=%h !=c5",dut.reg_file_.b2v_latch_af_lo.latch);
3658
   if (dut.reg_file_.b2v_latch_af_hi.latch!==8'h00) $fdisplay(f,"* Reg af a=%h !=00",dut.reg_file_.b2v_latch_af_hi.latch);
3659
   if (dut.reg_file_.b2v_latch_bc_lo.latch!==8'h00) $fdisplay(f,"* Reg bc c=%h !=00",dut.reg_file_.b2v_latch_bc_lo.latch);
3660
   if (dut.reg_file_.b2v_latch_bc_hi.latch!==8'h00) $fdisplay(f,"* Reg bc b=%h !=00",dut.reg_file_.b2v_latch_bc_hi.latch);
3661
   if (dut.reg_file_.b2v_latch_de_lo.latch!==8'h00) $fdisplay(f,"* Reg de e=%h !=00",dut.reg_file_.b2v_latch_de_lo.latch);
3662
   if (dut.reg_file_.b2v_latch_de_hi.latch!==8'h00) $fdisplay(f,"* Reg de d=%h !=00",dut.reg_file_.b2v_latch_de_hi.latch);
3663
   if (dut.reg_file_.b2v_latch_hl_lo.latch!==8'h00) $fdisplay(f,"* Reg hl l=%h !=00",dut.reg_file_.b2v_latch_hl_lo.latch);
3664
   if (dut.reg_file_.b2v_latch_hl_hi.latch!==8'h00) $fdisplay(f,"* Reg hl h=%h !=00",dut.reg_file_.b2v_latch_hl_hi.latch);
3665
   if (dut.reg_file_.b2v_latch_af2_lo.latch!==8'h00) $fdisplay(f,"* Reg af2 f=%h !=00",dut.reg_file_.b2v_latch_af2_lo.latch);
3666
   if (dut.reg_file_.b2v_latch_af2_hi.latch!==8'h00) $fdisplay(f,"* Reg af2 a=%h !=00",dut.reg_file_.b2v_latch_af2_hi.latch);
3667
   if (dut.reg_file_.b2v_latch_bc2_lo.latch!==8'h00) $fdisplay(f,"* Reg bc2 c=%h !=00",dut.reg_file_.b2v_latch_bc2_lo.latch);
3668
   if (dut.reg_file_.b2v_latch_bc2_hi.latch!==8'h00) $fdisplay(f,"* Reg bc2 b=%h !=00",dut.reg_file_.b2v_latch_bc2_hi.latch);
3669
   if (dut.reg_file_.b2v_latch_de2_lo.latch!==8'h00) $fdisplay(f,"* Reg de2 e=%h !=00",dut.reg_file_.b2v_latch_de2_lo.latch);
3670
   if (dut.reg_file_.b2v_latch_de2_hi.latch!==8'h00) $fdisplay(f,"* Reg de2 d=%h !=00",dut.reg_file_.b2v_latch_de2_hi.latch);
3671
   if (dut.reg_file_.b2v_latch_hl2_lo.latch!==8'h00) $fdisplay(f,"* Reg hl2 l=%h !=00",dut.reg_file_.b2v_latch_hl2_lo.latch);
3672
   if (dut.reg_file_.b2v_latch_hl2_hi.latch!==8'h00) $fdisplay(f,"* Reg hl2 h=%h !=00",dut.reg_file_.b2v_latch_hl2_hi.latch);
3673
   if (dut.reg_file_.b2v_latch_ix_lo.latch!==8'h00) $fdisplay(f,"* Reg ix x=%h !=00",dut.reg_file_.b2v_latch_ix_lo.latch);
3674
   if (dut.reg_file_.b2v_latch_ix_hi.latch!==8'h00) $fdisplay(f,"* Reg ix i=%h !=00",dut.reg_file_.b2v_latch_ix_hi.latch);
3675
   if (dut.reg_file_.b2v_latch_iy_lo.latch!==8'h00) $fdisplay(f,"* Reg iy y=%h !=00",dut.reg_file_.b2v_latch_iy_lo.latch);
3676
   if (dut.reg_file_.b2v_latch_iy_hi.latch!==8'h00) $fdisplay(f,"* Reg iy i=%h !=00",dut.reg_file_.b2v_latch_iy_hi.latch);
3677
   if (dut.reg_file_.b2v_latch_sp_lo.latch!==8'h00) $fdisplay(f,"* Reg sp p=%h !=00",dut.reg_file_.b2v_latch_sp_lo.latch);
3678
   if (dut.reg_file_.b2v_latch_sp_hi.latch!==8'h00) $fdisplay(f,"* Reg sp s=%h !=00",dut.reg_file_.b2v_latch_sp_hi.latch);
3679
   if (pc!==16'h0001) $fdisplay(f,"* PC=%h !=0001",pc);
3680
   if (dut.reg_file_.b2v_latch_ir_lo.latch!==8'h01) $fdisplay(f,"* Reg ir r=%h !=01",dut.reg_file_.b2v_latch_ir_lo.latch);
3681
   if (dut.reg_file_.b2v_latch_ir_hi.latch!==8'h00) $fdisplay(f,"* Reg ir i=%h !=00",dut.reg_file_.b2v_latch_ir_hi.latch);
3682 13 gdevic
#1 // End opcode
3683
 
3684 8 gdevic
   force dut.ir_.ctl_ir_we=1;
3685
   force dut.ir_.db=0;
3686
#2 release dut.ir_.ctl_ir_we;
3687
   release dut.ir_.db;
3688 13 gdevic
   $fdisplay(f,"Testing opcode cb09    RRC C");
3689 6 gdevic
   // Preset af
3690
   force dut.reg_file_.b2v_latch_af_lo.we=1;
3691
   force dut.reg_file_.b2v_latch_af_hi.we=1;
3692
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
3693
   force dut.reg_file_.b2v_latch_af_hi.db=8'h18;
3694
#2 release dut.reg_file_.b2v_latch_af_lo.we;
3695
   release dut.reg_file_.b2v_latch_af_hi.we;
3696
   release dut.reg_file_.b2v_latch_af_lo.db;
3697
   release dut.reg_file_.b2v_latch_af_hi.db;
3698
   // Preset bc
3699
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
3700
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
3701
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h5c;
3702
   force dut.reg_file_.b2v_latch_bc_hi.db=8'h12;
3703
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
3704
   release dut.reg_file_.b2v_latch_bc_hi.we;
3705
   release dut.reg_file_.b2v_latch_bc_lo.db;
3706
   release dut.reg_file_.b2v_latch_bc_hi.db;
3707
   // Preset de
3708
   force dut.reg_file_.b2v_latch_de_lo.we=1;
3709
   force dut.reg_file_.b2v_latch_de_hi.we=1;
3710
   force dut.reg_file_.b2v_latch_de_lo.db=8'h97;
3711
   force dut.reg_file_.b2v_latch_de_hi.db=8'hdd;
3712
#2 release dut.reg_file_.b2v_latch_de_lo.we;
3713
   release dut.reg_file_.b2v_latch_de_hi.we;
3714
   release dut.reg_file_.b2v_latch_de_lo.db;
3715
   release dut.reg_file_.b2v_latch_de_hi.db;
3716
   // Preset hl
3717
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
3718
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
3719
   force dut.reg_file_.b2v_latch_hl_lo.db=8'hc6;
3720
   force dut.reg_file_.b2v_latch_hl_hi.db=8'h59;
3721
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
3722
   release dut.reg_file_.b2v_latch_hl_hi.we;
3723
   release dut.reg_file_.b2v_latch_hl_lo.db;
3724
   release dut.reg_file_.b2v_latch_hl_hi.db;
3725
   // Preset af2
3726
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
3727
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
3728
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
3729
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
3730
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
3731
   release dut.reg_file_.b2v_latch_af2_hi.we;
3732
   release dut.reg_file_.b2v_latch_af2_lo.db;
3733
   release dut.reg_file_.b2v_latch_af2_hi.db;
3734
   // Preset bc2
3735
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
3736
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
3737
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
3738
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
3739
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
3740
   release dut.reg_file_.b2v_latch_bc2_hi.we;
3741
   release dut.reg_file_.b2v_latch_bc2_lo.db;
3742
   release dut.reg_file_.b2v_latch_bc2_hi.db;
3743
   // Preset de2
3744
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
3745
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
3746
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
3747
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
3748
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
3749
   release dut.reg_file_.b2v_latch_de2_hi.we;
3750
   release dut.reg_file_.b2v_latch_de2_lo.db;
3751
   release dut.reg_file_.b2v_latch_de2_hi.db;
3752
   // Preset hl2
3753
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
3754
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
3755
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
3756
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
3757
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
3758
   release dut.reg_file_.b2v_latch_hl2_hi.we;
3759
   release dut.reg_file_.b2v_latch_hl2_lo.db;
3760
   release dut.reg_file_.b2v_latch_hl2_hi.db;
3761
   // Preset ix
3762
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
3763
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
3764
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
3765
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
3766
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
3767
   release dut.reg_file_.b2v_latch_ix_hi.we;
3768
   release dut.reg_file_.b2v_latch_ix_lo.db;
3769
   release dut.reg_file_.b2v_latch_ix_hi.db;
3770
   // Preset iy
3771
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
3772
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
3773
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
3774
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
3775
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
3776
   release dut.reg_file_.b2v_latch_iy_hi.we;
3777
   release dut.reg_file_.b2v_latch_iy_lo.db;
3778
   release dut.reg_file_.b2v_latch_iy_hi.db;
3779
   // Preset sp
3780
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
3781
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
3782
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
3783
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
3784
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
3785
   release dut.reg_file_.b2v_latch_sp_hi.we;
3786
   release dut.reg_file_.b2v_latch_sp_lo.db;
3787
   release dut.reg_file_.b2v_latch_sp_hi.db;
3788
   // Preset wz
3789
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
3790
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
3791
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
3792
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
3793
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
3794
   release dut.reg_file_.b2v_latch_wz_hi.we;
3795
   release dut.reg_file_.b2v_latch_wz_lo.db;
3796
   release dut.reg_file_.b2v_latch_wz_hi.db;
3797
   // Preset pc
3798
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
3799
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
3800
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
3801
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
3802
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
3803
   release dut.reg_file_.b2v_latch_pc_hi.we;
3804
   release dut.reg_file_.b2v_latch_pc_lo.db;
3805
   release dut.reg_file_.b2v_latch_pc_hi.db;
3806
   // Preset ir
3807
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
3808
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
3809
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
3810
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
3811
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
3812
   release dut.reg_file_.b2v_latch_ir_hi.we;
3813
   release dut.reg_file_.b2v_latch_ir_lo.db;
3814
   release dut.reg_file_.b2v_latch_ir_hi.db;
3815
   // Preset memory
3816
   ram.Mem[0] = 8'hcb;
3817
   ram.Mem[1] = 8'h09;
3818
   // Preset memory
3819
   ram.Mem[22982] = 8'h9e;
3820
   force dut.z80_top_ifc_n.fpga_reset=0;
3821 8 gdevic
   force dut.address_latch_.Q=16'h0000;
3822 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
3823
   release dut.reg_file_.reg_gp_we;
3824 13 gdevic
#2 // Execute: M1/T1 start
3825
#1 release dut.address_latch_.Q;
3826 6 gdevic
#1
3827 13 gdevic
#14 // Wait for opcode end
3828 6 gdevic
   force dut.reg_control_.ctl_reg_sys_we=0;
3829
#2 pc=z.A;
3830
#2
3831
#1 force dut.reg_file_.reg_gp_we=0;
3832
   force dut.z80_top_ifc_n.fpga_reset=1;
3833
   if (dut.reg_file_.b2v_latch_af_lo.latch!==8'h2c) $fdisplay(f,"* Reg af f=%h !=2c",dut.reg_file_.b2v_latch_af_lo.latch);
3834
   if (dut.reg_file_.b2v_latch_af_hi.latch!==8'h18) $fdisplay(f,"* Reg af a=%h !=18",dut.reg_file_.b2v_latch_af_hi.latch);
3835
   if (dut.reg_file_.b2v_latch_bc_lo.latch!==8'h2e) $fdisplay(f,"* Reg bc c=%h !=2e",dut.reg_file_.b2v_latch_bc_lo.latch);
3836
   if (dut.reg_file_.b2v_latch_bc_hi.latch!==8'h12) $fdisplay(f,"* Reg bc b=%h !=12",dut.reg_file_.b2v_latch_bc_hi.latch);
3837
   if (dut.reg_file_.b2v_latch_de_lo.latch!==8'h97) $fdisplay(f,"* Reg de e=%h !=97",dut.reg_file_.b2v_latch_de_lo.latch);
3838
   if (dut.reg_file_.b2v_latch_de_hi.latch!==8'hdd) $fdisplay(f,"* Reg de d=%h !=dd",dut.reg_file_.b2v_latch_de_hi.latch);
3839
   if (dut.reg_file_.b2v_latch_hl_lo.latch!==8'hc6) $fdisplay(f,"* Reg hl l=%h !=c6",dut.reg_file_.b2v_latch_hl_lo.latch);
3840
   if (dut.reg_file_.b2v_latch_hl_hi.latch!==8'h59) $fdisplay(f,"* Reg hl h=%h !=59",dut.reg_file_.b2v_latch_hl_hi.latch);
3841
   if (dut.reg_file_.b2v_latch_af2_lo.latch!==8'h00) $fdisplay(f,"* Reg af2 f=%h !=00",dut.reg_file_.b2v_latch_af2_lo.latch);
3842
   if (dut.reg_file_.b2v_latch_af2_hi.latch!==8'h00) $fdisplay(f,"* Reg af2 a=%h !=00",dut.reg_file_.b2v_latch_af2_hi.latch);
3843
   if (dut.reg_file_.b2v_latch_bc2_lo.latch!==8'h00) $fdisplay(f,"* Reg bc2 c=%h !=00",dut.reg_file_.b2v_latch_bc2_lo.latch);
3844
   if (dut.reg_file_.b2v_latch_bc2_hi.latch!==8'h00) $fdisplay(f,"* Reg bc2 b=%h !=00",dut.reg_file_.b2v_latch_bc2_hi.latch);
3845
   if (dut.reg_file_.b2v_latch_de2_lo.latch!==8'h00) $fdisplay(f,"* Reg de2 e=%h !=00",dut.reg_file_.b2v_latch_de2_lo.latch);
3846
   if (dut.reg_file_.b2v_latch_de2_hi.latch!==8'h00) $fdisplay(f,"* Reg de2 d=%h !=00",dut.reg_file_.b2v_latch_de2_hi.latch);
3847
   if (dut.reg_file_.b2v_latch_hl2_lo.latch!==8'h00) $fdisplay(f,"* Reg hl2 l=%h !=00",dut.reg_file_.b2v_latch_hl2_lo.latch);
3848
   if (dut.reg_file_.b2v_latch_hl2_hi.latch!==8'h00) $fdisplay(f,"* Reg hl2 h=%h !=00",dut.reg_file_.b2v_latch_hl2_hi.latch);
3849
   if (dut.reg_file_.b2v_latch_ix_lo.latch!==8'h00) $fdisplay(f,"* Reg ix x=%h !=00",dut.reg_file_.b2v_latch_ix_lo.latch);
3850
   if (dut.reg_file_.b2v_latch_ix_hi.latch!==8'h00) $fdisplay(f,"* Reg ix i=%h !=00",dut.reg_file_.b2v_latch_ix_hi.latch);
3851
   if (dut.reg_file_.b2v_latch_iy_lo.latch!==8'h00) $fdisplay(f,"* Reg iy y=%h !=00",dut.reg_file_.b2v_latch_iy_lo.latch);
3852
   if (dut.reg_file_.b2v_latch_iy_hi.latch!==8'h00) $fdisplay(f,"* Reg iy i=%h !=00",dut.reg_file_.b2v_latch_iy_hi.latch);
3853
   if (dut.reg_file_.b2v_latch_sp_lo.latch!==8'h00) $fdisplay(f,"* Reg sp p=%h !=00",dut.reg_file_.b2v_latch_sp_lo.latch);
3854
   if (dut.reg_file_.b2v_latch_sp_hi.latch!==8'h00) $fdisplay(f,"* Reg sp s=%h !=00",dut.reg_file_.b2v_latch_sp_hi.latch);
3855
   if (pc!==16'h0002) $fdisplay(f,"* PC=%h !=0002",pc);
3856
   if (dut.reg_file_.b2v_latch_ir_lo.latch!==8'h02) $fdisplay(f,"* Reg ir r=%h !=02",dut.reg_file_.b2v_latch_ir_lo.latch);
3857
   if (dut.reg_file_.b2v_latch_ir_hi.latch!==8'h00) $fdisplay(f,"* Reg ir i=%h !=00",dut.reg_file_.b2v_latch_ir_hi.latch);
3858 13 gdevic
#1 // End opcode
3859
 
3860 8 gdevic
   force dut.ir_.ctl_ir_we=1;
3861
   force dut.ir_.db=0;
3862
#2 release dut.ir_.ctl_ir_we;
3863
   release dut.ir_.db;
3864 13 gdevic
   $fdisplay(f,"Testing opcode cb11    RL C");
3865 6 gdevic
   // Preset af
3866
   force dut.reg_file_.b2v_latch_af_lo.we=1;
3867
   force dut.reg_file_.b2v_latch_af_hi.we=1;
3868
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
3869
   force dut.reg_file_.b2v_latch_af_hi.db=8'h65;
3870
#2 release dut.reg_file_.b2v_latch_af_lo.we;
3871
   release dut.reg_file_.b2v_latch_af_hi.we;
3872
   release dut.reg_file_.b2v_latch_af_lo.db;
3873
   release dut.reg_file_.b2v_latch_af_hi.db;
3874
   // Preset bc
3875
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
3876
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
3877
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h5c;
3878
   force dut.reg_file_.b2v_latch_bc_hi.db=8'he2;
3879
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
3880
   release dut.reg_file_.b2v_latch_bc_hi.we;
3881
   release dut.reg_file_.b2v_latch_bc_lo.db;
3882
   release dut.reg_file_.b2v_latch_bc_hi.db;
3883
   // Preset de
3884
   force dut.reg_file_.b2v_latch_de_lo.we=1;
3885
   force dut.reg_file_.b2v_latch_de_hi.we=1;
3886
   force dut.reg_file_.b2v_latch_de_lo.db=8'h8a;
3887
   force dut.reg_file_.b2v_latch_de_hi.db=8'h4b;
3888
#2 release dut.reg_file_.b2v_latch_de_lo.we;
3889
   release dut.reg_file_.b2v_latch_de_hi.we;
3890
   release dut.reg_file_.b2v_latch_de_lo.db;
3891
   release dut.reg_file_.b2v_latch_de_hi.db;
3892
   // Preset hl
3893
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
3894
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
3895
   force dut.reg_file_.b2v_latch_hl_lo.db=8'h42;
3896
   force dut.reg_file_.b2v_latch_hl_hi.db=8'hed;
3897
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
3898
   release dut.reg_file_.b2v_latch_hl_hi.we;
3899
   release dut.reg_file_.b2v_latch_hl_lo.db;
3900
   release dut.reg_file_.b2v_latch_hl_hi.db;
3901
   // Preset af2
3902
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
3903
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
3904
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
3905
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
3906
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
3907
   release dut.reg_file_.b2v_latch_af2_hi.we;
3908
   release dut.reg_file_.b2v_latch_af2_lo.db;
3909
   release dut.reg_file_.b2v_latch_af2_hi.db;
3910
   // Preset bc2
3911
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
3912
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
3913
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
3914
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
3915
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
3916
   release dut.reg_file_.b2v_latch_bc2_hi.we;
3917
   release dut.reg_file_.b2v_latch_bc2_lo.db;
3918
   release dut.reg_file_.b2v_latch_bc2_hi.db;
3919
   // Preset de2
3920
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
3921
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
3922
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
3923
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
3924
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
3925
   release dut.reg_file_.b2v_latch_de2_hi.we;
3926
   release dut.reg_file_.b2v_latch_de2_lo.db;
3927
   release dut.reg_file_.b2v_latch_de2_hi.db;
3928
   // Preset hl2
3929
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
3930
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
3931
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
3932
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
3933
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
3934
   release dut.reg_file_.b2v_latch_hl2_hi.we;
3935
   release dut.reg_file_.b2v_latch_hl2_lo.db;
3936
   release dut.reg_file_.b2v_latch_hl2_hi.db;
3937
   // Preset ix
3938
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
3939
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
3940
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
3941
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
3942
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
3943
   release dut.reg_file_.b2v_latch_ix_hi.we;
3944
   release dut.reg_file_.b2v_latch_ix_lo.db;
3945
   release dut.reg_file_.b2v_latch_ix_hi.db;
3946
   // Preset iy
3947
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
3948
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
3949
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
3950
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
3951
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
3952
   release dut.reg_file_.b2v_latch_iy_hi.we;
3953
   release dut.reg_file_.b2v_latch_iy_lo.db;
3954
   release dut.reg_file_.b2v_latch_iy_hi.db;
3955
   // Preset sp
3956
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
3957
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
3958
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
3959
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
3960
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
3961
   release dut.reg_file_.b2v_latch_sp_hi.we;
3962
   release dut.reg_file_.b2v_latch_sp_lo.db;
3963
   release dut.reg_file_.b2v_latch_sp_hi.db;
3964
   // Preset wz
3965
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
3966
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
3967
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
3968
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
3969
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
3970
   release dut.reg_file_.b2v_latch_wz_hi.we;
3971
   release dut.reg_file_.b2v_latch_wz_lo.db;
3972
   release dut.reg_file_.b2v_latch_wz_hi.db;
3973
   // Preset pc
3974
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
3975
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
3976
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
3977
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
3978
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
3979
   release dut.reg_file_.b2v_latch_pc_hi.we;
3980
   release dut.reg_file_.b2v_latch_pc_lo.db;
3981
   release dut.reg_file_.b2v_latch_pc_hi.db;
3982
   // Preset ir
3983
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
3984
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
3985
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
3986
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
3987
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
3988
   release dut.reg_file_.b2v_latch_ir_hi.we;
3989
   release dut.reg_file_.b2v_latch_ir_lo.db;
3990
   release dut.reg_file_.b2v_latch_ir_hi.db;
3991
   // Preset memory
3992
   ram.Mem[0] = 8'hcb;
3993
   ram.Mem[1] = 8'h11;
3994
   // Preset memory
3995
   ram.Mem[60738] = 8'hb7;
3996
   force dut.z80_top_ifc_n.fpga_reset=0;
3997 8 gdevic
   force dut.address_latch_.Q=16'h0000;
3998 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
3999
   release dut.reg_file_.reg_gp_we;
4000 13 gdevic
#2 // Execute: M1/T1 start
4001
#1 release dut.address_latch_.Q;
4002 6 gdevic
#1
4003 13 gdevic
#14 // Wait for opcode end
4004 6 gdevic
   force dut.reg_control_.ctl_reg_sys_we=0;
4005
#2 pc=z.A;
4006
#2
4007
#1 force dut.reg_file_.reg_gp_we=0;
4008
   force dut.z80_top_ifc_n.fpga_reset=1;
4009
   if (dut.reg_file_.b2v_latch_af_lo.latch!==8'hac) $fdisplay(f,"* Reg af f=%h !=ac",dut.reg_file_.b2v_latch_af_lo.latch);
4010
   if (dut.reg_file_.b2v_latch_af_hi.latch!==8'h65) $fdisplay(f,"* Reg af a=%h !=65",dut.reg_file_.b2v_latch_af_hi.latch);
4011
   if (dut.reg_file_.b2v_latch_bc_lo.latch!==8'hb8) $fdisplay(f,"* Reg bc c=%h !=b8",dut.reg_file_.b2v_latch_bc_lo.latch);
4012
   if (dut.reg_file_.b2v_latch_bc_hi.latch!==8'he2) $fdisplay(f,"* Reg bc b=%h !=e2",dut.reg_file_.b2v_latch_bc_hi.latch);
4013
   if (dut.reg_file_.b2v_latch_de_lo.latch!==8'h8a) $fdisplay(f,"* Reg de e=%h !=8a",dut.reg_file_.b2v_latch_de_lo.latch);
4014
   if (dut.reg_file_.b2v_latch_de_hi.latch!==8'h4b) $fdisplay(f,"* Reg de d=%h !=4b",dut.reg_file_.b2v_latch_de_hi.latch);
4015
   if (dut.reg_file_.b2v_latch_hl_lo.latch!==8'h42) $fdisplay(f,"* Reg hl l=%h !=42",dut.reg_file_.b2v_latch_hl_lo.latch);
4016
   if (dut.reg_file_.b2v_latch_hl_hi.latch!==8'hed) $fdisplay(f,"* Reg hl h=%h !=ed",dut.reg_file_.b2v_latch_hl_hi.latch);
4017
   if (dut.reg_file_.b2v_latch_af2_lo.latch!==8'h00) $fdisplay(f,"* Reg af2 f=%h !=00",dut.reg_file_.b2v_latch_af2_lo.latch);
4018
   if (dut.reg_file_.b2v_latch_af2_hi.latch!==8'h00) $fdisplay(f,"* Reg af2 a=%h !=00",dut.reg_file_.b2v_latch_af2_hi.latch);
4019
   if (dut.reg_file_.b2v_latch_bc2_lo.latch!==8'h00) $fdisplay(f,"* Reg bc2 c=%h !=00",dut.reg_file_.b2v_latch_bc2_lo.latch);
4020
   if (dut.reg_file_.b2v_latch_bc2_hi.latch!==8'h00) $fdisplay(f,"* Reg bc2 b=%h !=00",dut.reg_file_.b2v_latch_bc2_hi.latch);
4021
   if (dut.reg_file_.b2v_latch_de2_lo.latch!==8'h00) $fdisplay(f,"* Reg de2 e=%h !=00",dut.reg_file_.b2v_latch_de2_lo.latch);
4022
   if (dut.reg_file_.b2v_latch_de2_hi.latch!==8'h00) $fdisplay(f,"* Reg de2 d=%h !=00",dut.reg_file_.b2v_latch_de2_hi.latch);
4023
   if (dut.reg_file_.b2v_latch_hl2_lo.latch!==8'h00) $fdisplay(f,"* Reg hl2 l=%h !=00",dut.reg_file_.b2v_latch_hl2_lo.latch);
4024
   if (dut.reg_file_.b2v_latch_hl2_hi.latch!==8'h00) $fdisplay(f,"* Reg hl2 h=%h !=00",dut.reg_file_.b2v_latch_hl2_hi.latch);
4025
   if (dut.reg_file_.b2v_latch_ix_lo.latch!==8'h00) $fdisplay(f,"* Reg ix x=%h !=00",dut.reg_file_.b2v_latch_ix_lo.latch);
4026
   if (dut.reg_file_.b2v_latch_ix_hi.latch!==8'h00) $fdisplay(f,"* Reg ix i=%h !=00",dut.reg_file_.b2v_latch_ix_hi.latch);
4027
   if (dut.reg_file_.b2v_latch_iy_lo.latch!==8'h00) $fdisplay(f,"* Reg iy y=%h !=00",dut.reg_file_.b2v_latch_iy_lo.latch);
4028
   if (dut.reg_file_.b2v_latch_iy_hi.latch!==8'h00) $fdisplay(f,"* Reg iy i=%h !=00",dut.reg_file_.b2v_latch_iy_hi.latch);
4029
   if (dut.reg_file_.b2v_latch_sp_lo.latch!==8'h00) $fdisplay(f,"* Reg sp p=%h !=00",dut.reg_file_.b2v_latch_sp_lo.latch);
4030
   if (dut.reg_file_.b2v_latch_sp_hi.latch!==8'h00) $fdisplay(f,"* Reg sp s=%h !=00",dut.reg_file_.b2v_latch_sp_hi.latch);
4031
   if (pc!==16'h0002) $fdisplay(f,"* PC=%h !=0002",pc);
4032
   if (dut.reg_file_.b2v_latch_ir_lo.latch!==8'h02) $fdisplay(f,"* Reg ir r=%h !=02",dut.reg_file_.b2v_latch_ir_lo.latch);
4033
   if (dut.reg_file_.b2v_latch_ir_hi.latch!==8'h00) $fdisplay(f,"* Reg ir i=%h !=00",dut.reg_file_.b2v_latch_ir_hi.latch);
4034 13 gdevic
#1 // End opcode
4035
 
4036 8 gdevic
   force dut.ir_.ctl_ir_we=1;
4037
   force dut.ir_.db=0;
4038
#2 release dut.ir_.ctl_ir_we;
4039
   release dut.ir_.db;
4040 13 gdevic
   $fdisplay(f,"Testing opcode cb36    SLL (HL)*");
4041 6 gdevic
   // Preset af
4042
   force dut.reg_file_.b2v_latch_af_lo.we=1;
4043
   force dut.reg_file_.b2v_latch_af_hi.we=1;
4044
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
4045
   force dut.reg_file_.b2v_latch_af_hi.db=8'h8a;
4046
#2 release dut.reg_file_.b2v_latch_af_lo.we;
4047
   release dut.reg_file_.b2v_latch_af_hi.we;
4048
   release dut.reg_file_.b2v_latch_af_lo.db;
4049
   release dut.reg_file_.b2v_latch_af_hi.db;
4050
   // Preset bc
4051
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
4052
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
4053
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h85;
4054
   force dut.reg_file_.b2v_latch_bc_hi.db=8'h11;
4055
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
4056
   release dut.reg_file_.b2v_latch_bc_hi.we;
4057
   release dut.reg_file_.b2v_latch_bc_lo.db;
4058
   release dut.reg_file_.b2v_latch_bc_hi.db;
4059
   // Preset de
4060
   force dut.reg_file_.b2v_latch_de_lo.we=1;
4061
   force dut.reg_file_.b2v_latch_de_hi.we=1;
4062
   force dut.reg_file_.b2v_latch_de_lo.db=8'hde;
4063
   force dut.reg_file_.b2v_latch_de_hi.db=8'h1d;
4064
#2 release dut.reg_file_.b2v_latch_de_lo.we;
4065
   release dut.reg_file_.b2v_latch_de_hi.we;
4066
   release dut.reg_file_.b2v_latch_de_lo.db;
4067
   release dut.reg_file_.b2v_latch_de_hi.db;
4068
   // Preset hl
4069
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
4070
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
4071
   force dut.reg_file_.b2v_latch_hl_lo.db=8'h38;
4072
   force dut.reg_file_.b2v_latch_hl_hi.db=8'h6d;
4073
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
4074
   release dut.reg_file_.b2v_latch_hl_hi.we;
4075
   release dut.reg_file_.b2v_latch_hl_lo.db;
4076
   release dut.reg_file_.b2v_latch_hl_hi.db;
4077
   // Preset af2
4078
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
4079
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
4080
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
4081
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
4082
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
4083
   release dut.reg_file_.b2v_latch_af2_hi.we;
4084
   release dut.reg_file_.b2v_latch_af2_lo.db;
4085
   release dut.reg_file_.b2v_latch_af2_hi.db;
4086
   // Preset bc2
4087
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
4088
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
4089
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
4090
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
4091
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
4092
   release dut.reg_file_.b2v_latch_bc2_hi.we;
4093
   release dut.reg_file_.b2v_latch_bc2_lo.db;
4094
   release dut.reg_file_.b2v_latch_bc2_hi.db;
4095
   // Preset de2
4096
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
4097
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
4098
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
4099
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
4100
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
4101
   release dut.reg_file_.b2v_latch_de2_hi.we;
4102
   release dut.reg_file_.b2v_latch_de2_lo.db;
4103
   release dut.reg_file_.b2v_latch_de2_hi.db;
4104
   // Preset hl2
4105
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
4106
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
4107
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
4108
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
4109
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
4110
   release dut.reg_file_.b2v_latch_hl2_hi.we;
4111
   release dut.reg_file_.b2v_latch_hl2_lo.db;
4112
   release dut.reg_file_.b2v_latch_hl2_hi.db;
4113
   // Preset ix
4114
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
4115
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
4116
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
4117
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
4118
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
4119
   release dut.reg_file_.b2v_latch_ix_hi.we;
4120
   release dut.reg_file_.b2v_latch_ix_lo.db;
4121
   release dut.reg_file_.b2v_latch_ix_hi.db;
4122
   // Preset iy
4123
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
4124
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
4125
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
4126
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
4127
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
4128
   release dut.reg_file_.b2v_latch_iy_hi.we;
4129
   release dut.reg_file_.b2v_latch_iy_lo.db;
4130
   release dut.reg_file_.b2v_latch_iy_hi.db;
4131
   // Preset sp
4132
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
4133
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
4134
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
4135
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
4136
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
4137
   release dut.reg_file_.b2v_latch_sp_hi.we;
4138
   release dut.reg_file_.b2v_latch_sp_lo.db;
4139
   release dut.reg_file_.b2v_latch_sp_hi.db;
4140
   // Preset wz
4141
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
4142
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
4143
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
4144
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
4145
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
4146
   release dut.reg_file_.b2v_latch_wz_hi.we;
4147
   release dut.reg_file_.b2v_latch_wz_lo.db;
4148
   release dut.reg_file_.b2v_latch_wz_hi.db;
4149
   // Preset pc
4150
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
4151
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
4152
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
4153
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
4154
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
4155
   release dut.reg_file_.b2v_latch_pc_hi.we;
4156
   release dut.reg_file_.b2v_latch_pc_lo.db;
4157
   release dut.reg_file_.b2v_latch_pc_hi.db;
4158
   // Preset ir
4159
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
4160
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
4161
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
4162
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
4163
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
4164
   release dut.reg_file_.b2v_latch_ir_hi.we;
4165
   release dut.reg_file_.b2v_latch_ir_lo.db;
4166
   release dut.reg_file_.b2v_latch_ir_hi.db;
4167
   // Preset memory
4168
   ram.Mem[0] = 8'hcb;
4169
   ram.Mem[1] = 8'h36;
4170
   // Preset memory
4171
   ram.Mem[27960] = 8'hf1;
4172
   force dut.z80_top_ifc_n.fpga_reset=0;
4173 8 gdevic
   force dut.address_latch_.Q=16'h0000;
4174 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
4175
   release dut.reg_file_.reg_gp_we;
4176 13 gdevic
#2 // Execute: M1/T1 start
4177
#1 release dut.address_latch_.Q;
4178 6 gdevic
#1
4179 13 gdevic
#28 // Wait for opcode end
4180 6 gdevic
   force dut.reg_control_.ctl_reg_sys_we=0;
4181
#2 pc=z.A;
4182
#2
4183
#1 force dut.reg_file_.reg_gp_we=0;
4184
   force dut.z80_top_ifc_n.fpga_reset=1;
4185
   if (dut.reg_file_.b2v_latch_af_lo.latch!==8'ha1) $fdisplay(f,"* Reg af f=%h !=a1",dut.reg_file_.b2v_latch_af_lo.latch);
4186
   if (dut.reg_file_.b2v_latch_af_hi.latch!==8'h8a) $fdisplay(f,"* Reg af a=%h !=8a",dut.reg_file_.b2v_latch_af_hi.latch);
4187
   if (dut.reg_file_.b2v_latch_bc_lo.latch!==8'h85) $fdisplay(f,"* Reg bc c=%h !=85",dut.reg_file_.b2v_latch_bc_lo.latch);
4188
   if (dut.reg_file_.b2v_latch_bc_hi.latch!==8'h11) $fdisplay(f,"* Reg bc b=%h !=11",dut.reg_file_.b2v_latch_bc_hi.latch);
4189
   if (dut.reg_file_.b2v_latch_de_lo.latch!==8'hde) $fdisplay(f,"* Reg de e=%h !=de",dut.reg_file_.b2v_latch_de_lo.latch);
4190
   if (dut.reg_file_.b2v_latch_de_hi.latch!==8'h1d) $fdisplay(f,"* Reg de d=%h !=1d",dut.reg_file_.b2v_latch_de_hi.latch);
4191
   if (dut.reg_file_.b2v_latch_hl_lo.latch!==8'h38) $fdisplay(f,"* Reg hl l=%h !=38",dut.reg_file_.b2v_latch_hl_lo.latch);
4192
   if (dut.reg_file_.b2v_latch_hl_hi.latch!==8'h6d) $fdisplay(f,"* Reg hl h=%h !=6d",dut.reg_file_.b2v_latch_hl_hi.latch);
4193
   if (dut.reg_file_.b2v_latch_af2_lo.latch!==8'h00) $fdisplay(f,"* Reg af2 f=%h !=00",dut.reg_file_.b2v_latch_af2_lo.latch);
4194
   if (dut.reg_file_.b2v_latch_af2_hi.latch!==8'h00) $fdisplay(f,"* Reg af2 a=%h !=00",dut.reg_file_.b2v_latch_af2_hi.latch);
4195
   if (dut.reg_file_.b2v_latch_bc2_lo.latch!==8'h00) $fdisplay(f,"* Reg bc2 c=%h !=00",dut.reg_file_.b2v_latch_bc2_lo.latch);
4196
   if (dut.reg_file_.b2v_latch_bc2_hi.latch!==8'h00) $fdisplay(f,"* Reg bc2 b=%h !=00",dut.reg_file_.b2v_latch_bc2_hi.latch);
4197
   if (dut.reg_file_.b2v_latch_de2_lo.latch!==8'h00) $fdisplay(f,"* Reg de2 e=%h !=00",dut.reg_file_.b2v_latch_de2_lo.latch);
4198
   if (dut.reg_file_.b2v_latch_de2_hi.latch!==8'h00) $fdisplay(f,"* Reg de2 d=%h !=00",dut.reg_file_.b2v_latch_de2_hi.latch);
4199
   if (dut.reg_file_.b2v_latch_hl2_lo.latch!==8'h00) $fdisplay(f,"* Reg hl2 l=%h !=00",dut.reg_file_.b2v_latch_hl2_lo.latch);
4200
   if (dut.reg_file_.b2v_latch_hl2_hi.latch!==8'h00) $fdisplay(f,"* Reg hl2 h=%h !=00",dut.reg_file_.b2v_latch_hl2_hi.latch);
4201
   if (dut.reg_file_.b2v_latch_ix_lo.latch!==8'h00) $fdisplay(f,"* Reg ix x=%h !=00",dut.reg_file_.b2v_latch_ix_lo.latch);
4202
   if (dut.reg_file_.b2v_latch_ix_hi.latch!==8'h00) $fdisplay(f,"* Reg ix i=%h !=00",dut.reg_file_.b2v_latch_ix_hi.latch);
4203
   if (dut.reg_file_.b2v_latch_iy_lo.latch!==8'h00) $fdisplay(f,"* Reg iy y=%h !=00",dut.reg_file_.b2v_latch_iy_lo.latch);
4204
   if (dut.reg_file_.b2v_latch_iy_hi.latch!==8'h00) $fdisplay(f,"* Reg iy i=%h !=00",dut.reg_file_.b2v_latch_iy_hi.latch);
4205
   if (dut.reg_file_.b2v_latch_sp_lo.latch!==8'h00) $fdisplay(f,"* Reg sp p=%h !=00",dut.reg_file_.b2v_latch_sp_lo.latch);
4206
   if (dut.reg_file_.b2v_latch_sp_hi.latch!==8'h00) $fdisplay(f,"* Reg sp s=%h !=00",dut.reg_file_.b2v_latch_sp_hi.latch);
4207
   if (pc!==16'h0002) $fdisplay(f,"* PC=%h !=0002",pc);
4208
   if (dut.reg_file_.b2v_latch_ir_lo.latch!==8'h02) $fdisplay(f,"* Reg ir r=%h !=02",dut.reg_file_.b2v_latch_ir_lo.latch);
4209
   if (dut.reg_file_.b2v_latch_ir_hi.latch!==8'h00) $fdisplay(f,"* Reg ir i=%h !=00",dut.reg_file_.b2v_latch_ir_hi.latch);
4210
   if (ram.Mem[27960]!==8'he3) $fdisplay(f,"* Mem[6d38]=%h !=e3",ram.Mem[27960]);
4211 13 gdevic
#1 // End opcode
4212
 
4213 8 gdevic
   force dut.ir_.ctl_ir_we=1;
4214
   force dut.ir_.db=0;
4215
#2 release dut.ir_.ctl_ir_we;
4216
   release dut.ir_.db;
4217 13 gdevic
   $fdisplay(f,"Testing opcode cb52    BIT 2,D");
4218 6 gdevic
   // Preset af
4219
   force dut.reg_file_.b2v_latch_af_lo.we=1;
4220
   force dut.reg_file_.b2v_latch_af_hi.we=1;
4221
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
4222
   force dut.reg_file_.b2v_latch_af_hi.db=8'h8b;
4223
#2 release dut.reg_file_.b2v_latch_af_lo.we;
4224
   release dut.reg_file_.b2v_latch_af_hi.we;
4225
   release dut.reg_file_.b2v_latch_af_lo.db;
4226
   release dut.reg_file_.b2v_latch_af_hi.db;
4227
   // Preset bc
4228
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
4229
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
4230
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h7a;
4231
   force dut.reg_file_.b2v_latch_bc_hi.db=8'hff;
4232
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
4233
   release dut.reg_file_.b2v_latch_bc_hi.we;
4234
   release dut.reg_file_.b2v_latch_bc_lo.db;
4235
   release dut.reg_file_.b2v_latch_bc_hi.db;
4236
   // Preset de
4237
   force dut.reg_file_.b2v_latch_de_lo.we=1;
4238
   force dut.reg_file_.b2v_latch_de_hi.we=1;
4239
   force dut.reg_file_.b2v_latch_de_lo.db=8'hff;
4240
   force dut.reg_file_.b2v_latch_de_hi.db=8'hb0;
4241
#2 release dut.reg_file_.b2v_latch_de_lo.we;
4242
   release dut.reg_file_.b2v_latch_de_hi.we;
4243
   release dut.reg_file_.b2v_latch_de_lo.db;
4244
   release dut.reg_file_.b2v_latch_de_hi.db;
4245
   // Preset hl
4246
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
4247
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
4248
   force dut.reg_file_.b2v_latch_hl_lo.db=8'h44;
4249
   force dut.reg_file_.b2v_latch_hl_hi.db=8'hac;
4250
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
4251
   release dut.reg_file_.b2v_latch_hl_hi.we;
4252
   release dut.reg_file_.b2v_latch_hl_lo.db;
4253
   release dut.reg_file_.b2v_latch_hl_hi.db;
4254
   // Preset af2
4255
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
4256
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
4257
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
4258
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
4259
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
4260
   release dut.reg_file_.b2v_latch_af2_hi.we;
4261
   release dut.reg_file_.b2v_latch_af2_lo.db;
4262
   release dut.reg_file_.b2v_latch_af2_hi.db;
4263
   // Preset bc2
4264
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
4265
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
4266
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
4267
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
4268
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
4269
   release dut.reg_file_.b2v_latch_bc2_hi.we;
4270
   release dut.reg_file_.b2v_latch_bc2_lo.db;
4271
   release dut.reg_file_.b2v_latch_bc2_hi.db;
4272
   // Preset de2
4273
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
4274
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
4275
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
4276
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
4277
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
4278
   release dut.reg_file_.b2v_latch_de2_hi.we;
4279
   release dut.reg_file_.b2v_latch_de2_lo.db;
4280
   release dut.reg_file_.b2v_latch_de2_hi.db;
4281
   // Preset hl2
4282
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
4283
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
4284
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
4285
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
4286
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
4287
   release dut.reg_file_.b2v_latch_hl2_hi.we;
4288
   release dut.reg_file_.b2v_latch_hl2_lo.db;
4289
   release dut.reg_file_.b2v_latch_hl2_hi.db;
4290
   // Preset ix
4291
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
4292
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
4293
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
4294
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
4295
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
4296
   release dut.reg_file_.b2v_latch_ix_hi.we;
4297
   release dut.reg_file_.b2v_latch_ix_lo.db;
4298
   release dut.reg_file_.b2v_latch_ix_hi.db;
4299
   // Preset iy
4300
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
4301
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
4302
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
4303
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
4304
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
4305
   release dut.reg_file_.b2v_latch_iy_hi.we;
4306
   release dut.reg_file_.b2v_latch_iy_lo.db;
4307
   release dut.reg_file_.b2v_latch_iy_hi.db;
4308
   // Preset sp
4309
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
4310
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
4311
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
4312
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
4313
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
4314
   release dut.reg_file_.b2v_latch_sp_hi.we;
4315
   release dut.reg_file_.b2v_latch_sp_lo.db;
4316
   release dut.reg_file_.b2v_latch_sp_hi.db;
4317
   // Preset wz
4318
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
4319
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
4320
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
4321
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
4322
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
4323
   release dut.reg_file_.b2v_latch_wz_hi.we;
4324
   release dut.reg_file_.b2v_latch_wz_lo.db;
4325
   release dut.reg_file_.b2v_latch_wz_hi.db;
4326
   // Preset pc
4327
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
4328
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
4329
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
4330
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
4331
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
4332
   release dut.reg_file_.b2v_latch_pc_hi.we;
4333
   release dut.reg_file_.b2v_latch_pc_lo.db;
4334
   release dut.reg_file_.b2v_latch_pc_hi.db;
4335
   // Preset ir
4336
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
4337
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
4338
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
4339
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
4340
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
4341
   release dut.reg_file_.b2v_latch_ir_hi.we;
4342
   release dut.reg_file_.b2v_latch_ir_lo.db;
4343
   release dut.reg_file_.b2v_latch_ir_hi.db;
4344
   // Preset memory
4345
   ram.Mem[0] = 8'hcb;
4346
   ram.Mem[1] = 8'h52;
4347
   // Preset memory
4348
   ram.Mem[44100] = 8'h00;
4349
   force dut.z80_top_ifc_n.fpga_reset=0;
4350 8 gdevic
   force dut.address_latch_.Q=16'h0000;
4351 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
4352
   release dut.reg_file_.reg_gp_we;
4353 13 gdevic
#2 // Execute: M1/T1 start
4354
#1 release dut.address_latch_.Q;
4355 6 gdevic
#1
4356 13 gdevic
#14 // Wait for opcode end
4357 6 gdevic
   force dut.reg_control_.ctl_reg_sys_we=0;
4358
#2 pc=z.A;
4359
#2
4360
#1 force dut.reg_file_.reg_gp_we=0;
4361
   force dut.z80_top_ifc_n.fpga_reset=1;
4362
   if (dut.reg_file_.b2v_latch_af_lo.latch!==8'h74) $fdisplay(f,"* Reg af f=%h !=74",dut.reg_file_.b2v_latch_af_lo.latch);
4363
   if (dut.reg_file_.b2v_latch_af_hi.latch!==8'h8b) $fdisplay(f,"* Reg af a=%h !=8b",dut.reg_file_.b2v_latch_af_hi.latch);
4364
   if (dut.reg_file_.b2v_latch_bc_lo.latch!==8'h7a) $fdisplay(f,"* Reg bc c=%h !=7a",dut.reg_file_.b2v_latch_bc_lo.latch);
4365
   if (dut.reg_file_.b2v_latch_bc_hi.latch!==8'hff) $fdisplay(f,"* Reg bc b=%h !=ff",dut.reg_file_.b2v_latch_bc_hi.latch);
4366
   if (dut.reg_file_.b2v_latch_de_lo.latch!==8'hff) $fdisplay(f,"* Reg de e=%h !=ff",dut.reg_file_.b2v_latch_de_lo.latch);
4367
   if (dut.reg_file_.b2v_latch_de_hi.latch!==8'hb0) $fdisplay(f,"* Reg de d=%h !=b0",dut.reg_file_.b2v_latch_de_hi.latch);
4368
   if (dut.reg_file_.b2v_latch_hl_lo.latch!==8'h44) $fdisplay(f,"* Reg hl l=%h !=44",dut.reg_file_.b2v_latch_hl_lo.latch);
4369
   if (dut.reg_file_.b2v_latch_hl_hi.latch!==8'hac) $fdisplay(f,"* Reg hl h=%h !=ac",dut.reg_file_.b2v_latch_hl_hi.latch);
4370
   if (dut.reg_file_.b2v_latch_af2_lo.latch!==8'h00) $fdisplay(f,"* Reg af2 f=%h !=00",dut.reg_file_.b2v_latch_af2_lo.latch);
4371
   if (dut.reg_file_.b2v_latch_af2_hi.latch!==8'h00) $fdisplay(f,"* Reg af2 a=%h !=00",dut.reg_file_.b2v_latch_af2_hi.latch);
4372
   if (dut.reg_file_.b2v_latch_bc2_lo.latch!==8'h00) $fdisplay(f,"* Reg bc2 c=%h !=00",dut.reg_file_.b2v_latch_bc2_lo.latch);
4373
   if (dut.reg_file_.b2v_latch_bc2_hi.latch!==8'h00) $fdisplay(f,"* Reg bc2 b=%h !=00",dut.reg_file_.b2v_latch_bc2_hi.latch);
4374
   if (dut.reg_file_.b2v_latch_de2_lo.latch!==8'h00) $fdisplay(f,"* Reg de2 e=%h !=00",dut.reg_file_.b2v_latch_de2_lo.latch);
4375
   if (dut.reg_file_.b2v_latch_de2_hi.latch!==8'h00) $fdisplay(f,"* Reg de2 d=%h !=00",dut.reg_file_.b2v_latch_de2_hi.latch);
4376
   if (dut.reg_file_.b2v_latch_hl2_lo.latch!==8'h00) $fdisplay(f,"* Reg hl2 l=%h !=00",dut.reg_file_.b2v_latch_hl2_lo.latch);
4377
   if (dut.reg_file_.b2v_latch_hl2_hi.latch!==8'h00) $fdisplay(f,"* Reg hl2 h=%h !=00",dut.reg_file_.b2v_latch_hl2_hi.latch);
4378
   if (dut.reg_file_.b2v_latch_ix_lo.latch!==8'h00) $fdisplay(f,"* Reg ix x=%h !=00",dut.reg_file_.b2v_latch_ix_lo.latch);
4379
   if (dut.reg_file_.b2v_latch_ix_hi.latch!==8'h00) $fdisplay(f,"* Reg ix i=%h !=00",dut.reg_file_.b2v_latch_ix_hi.latch);
4380
   if (dut.reg_file_.b2v_latch_iy_lo.latch!==8'h00) $fdisplay(f,"* Reg iy y=%h !=00",dut.reg_file_.b2v_latch_iy_lo.latch);
4381
   if (dut.reg_file_.b2v_latch_iy_hi.latch!==8'h00) $fdisplay(f,"* Reg iy i=%h !=00",dut.reg_file_.b2v_latch_iy_hi.latch);
4382
   if (dut.reg_file_.b2v_latch_sp_lo.latch!==8'h00) $fdisplay(f,"* Reg sp p=%h !=00",dut.reg_file_.b2v_latch_sp_lo.latch);
4383
   if (dut.reg_file_.b2v_latch_sp_hi.latch!==8'h00) $fdisplay(f,"* Reg sp s=%h !=00",dut.reg_file_.b2v_latch_sp_hi.latch);
4384
   if (pc!==16'h0002) $fdisplay(f,"* PC=%h !=0002",pc);
4385
   if (dut.reg_file_.b2v_latch_ir_lo.latch!==8'h02) $fdisplay(f,"* Reg ir r=%h !=02",dut.reg_file_.b2v_latch_ir_lo.latch);
4386
   if (dut.reg_file_.b2v_latch_ir_hi.latch!==8'h00) $fdisplay(f,"* Reg ir i=%h !=00",dut.reg_file_.b2v_latch_ir_hi.latch);
4387 13 gdevic
#1 // End opcode
4388
 
4389 8 gdevic
   force dut.ir_.ctl_ir_we=1;
4390
   force dut.ir_.db=0;
4391
#2 release dut.ir_.ctl_ir_we;
4392
   release dut.ir_.db;
4393 13 gdevic
   $fdisplay(f,"Testing opcode cb93    RES 2,E");
4394 6 gdevic
   // Preset af
4395
   force dut.reg_file_.b2v_latch_af_lo.we=1;
4396
   force dut.reg_file_.b2v_latch_af_hi.we=1;
4397
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
4398
   force dut.reg_file_.b2v_latch_af_hi.db=8'hc2;
4399
#2 release dut.reg_file_.b2v_latch_af_lo.we;
4400
   release dut.reg_file_.b2v_latch_af_hi.we;
4401
   release dut.reg_file_.b2v_latch_af_lo.db;
4402
   release dut.reg_file_.b2v_latch_af_hi.db;
4403
   // Preset bc
4404
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
4405
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
4406
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h05;
4407
   force dut.reg_file_.b2v_latch_bc_hi.db=8'h4e;
4408
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
4409
   release dut.reg_file_.b2v_latch_bc_hi.we;
4410
   release dut.reg_file_.b2v_latch_bc_lo.db;
4411
   release dut.reg_file_.b2v_latch_bc_hi.db;
4412
   // Preset de
4413
   force dut.reg_file_.b2v_latch_de_lo.we=1;
4414
   force dut.reg_file_.b2v_latch_de_hi.we=1;
4415
   force dut.reg_file_.b2v_latch_de_lo.db=8'hf8;
4416
   force dut.reg_file_.b2v_latch_de_hi.db=8'hb3;
4417
#2 release dut.reg_file_.b2v_latch_de_lo.we;
4418
   release dut.reg_file_.b2v_latch_de_hi.we;
4419
   release dut.reg_file_.b2v_latch_de_lo.db;
4420
   release dut.reg_file_.b2v_latch_de_hi.db;
4421
   // Preset hl
4422
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
4423
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
4424
   force dut.reg_file_.b2v_latch_hl_lo.db=8'h34;
4425
   force dut.reg_file_.b2v_latch_hl_hi.db=8'h22;
4426
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
4427
   release dut.reg_file_.b2v_latch_hl_hi.we;
4428
   release dut.reg_file_.b2v_latch_hl_lo.db;
4429
   release dut.reg_file_.b2v_latch_hl_hi.db;
4430
   // Preset af2
4431
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
4432
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
4433
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
4434
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
4435
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
4436
   release dut.reg_file_.b2v_latch_af2_hi.we;
4437
   release dut.reg_file_.b2v_latch_af2_lo.db;
4438
   release dut.reg_file_.b2v_latch_af2_hi.db;
4439
   // Preset bc2
4440
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
4441
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
4442
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
4443
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
4444
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
4445
   release dut.reg_file_.b2v_latch_bc2_hi.we;
4446
   release dut.reg_file_.b2v_latch_bc2_lo.db;
4447
   release dut.reg_file_.b2v_latch_bc2_hi.db;
4448
   // Preset de2
4449
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
4450
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
4451
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
4452
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
4453
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
4454
   release dut.reg_file_.b2v_latch_de2_hi.we;
4455
   release dut.reg_file_.b2v_latch_de2_lo.db;
4456
   release dut.reg_file_.b2v_latch_de2_hi.db;
4457
   // Preset hl2
4458
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
4459
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
4460
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
4461
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
4462
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
4463
   release dut.reg_file_.b2v_latch_hl2_hi.we;
4464
   release dut.reg_file_.b2v_latch_hl2_lo.db;
4465
   release dut.reg_file_.b2v_latch_hl2_hi.db;
4466
   // Preset ix
4467
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
4468
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
4469
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
4470
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
4471
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
4472
   release dut.reg_file_.b2v_latch_ix_hi.we;
4473
   release dut.reg_file_.b2v_latch_ix_lo.db;
4474
   release dut.reg_file_.b2v_latch_ix_hi.db;
4475
   // Preset iy
4476
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
4477
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
4478
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
4479
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
4480
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
4481
   release dut.reg_file_.b2v_latch_iy_hi.we;
4482
   release dut.reg_file_.b2v_latch_iy_lo.db;
4483
   release dut.reg_file_.b2v_latch_iy_hi.db;
4484
   // Preset sp
4485
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
4486
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
4487
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
4488
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
4489
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
4490
   release dut.reg_file_.b2v_latch_sp_hi.we;
4491
   release dut.reg_file_.b2v_latch_sp_lo.db;
4492
   release dut.reg_file_.b2v_latch_sp_hi.db;
4493
   // Preset wz
4494
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
4495
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
4496
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
4497
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
4498
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
4499
   release dut.reg_file_.b2v_latch_wz_hi.we;
4500
   release dut.reg_file_.b2v_latch_wz_lo.db;
4501
   release dut.reg_file_.b2v_latch_wz_hi.db;
4502
   // Preset pc
4503
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
4504
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
4505
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
4506
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
4507
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
4508
   release dut.reg_file_.b2v_latch_pc_hi.we;
4509
   release dut.reg_file_.b2v_latch_pc_lo.db;
4510
   release dut.reg_file_.b2v_latch_pc_hi.db;
4511
   // Preset ir
4512
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
4513
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
4514
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
4515
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
4516
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
4517
   release dut.reg_file_.b2v_latch_ir_hi.we;
4518
   release dut.reg_file_.b2v_latch_ir_lo.db;
4519
   release dut.reg_file_.b2v_latch_ir_hi.db;
4520
   // Preset memory
4521
   ram.Mem[0] = 8'hcb;
4522
   ram.Mem[1] = 8'h93;
4523
   // Preset memory
4524
   ram.Mem[8756] = 8'ha0;
4525
   force dut.z80_top_ifc_n.fpga_reset=0;
4526 8 gdevic
   force dut.address_latch_.Q=16'h0000;
4527 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
4528
   release dut.reg_file_.reg_gp_we;
4529 13 gdevic
#2 // Execute: M1/T1 start
4530
#1 release dut.address_latch_.Q;
4531 6 gdevic
#1
4532 13 gdevic
#14 // Wait for opcode end
4533 6 gdevic
   force dut.reg_control_.ctl_reg_sys_we=0;
4534
#2 pc=z.A;
4535
#2
4536
#1 force dut.reg_file_.reg_gp_we=0;
4537
   force dut.z80_top_ifc_n.fpga_reset=1;
4538
   if (dut.reg_file_.b2v_latch_af_lo.latch!==8'h00) $fdisplay(f,"* Reg af f=%h !=00",dut.reg_file_.b2v_latch_af_lo.latch);
4539
   if (dut.reg_file_.b2v_latch_af_hi.latch!==8'hc2) $fdisplay(f,"* Reg af a=%h !=c2",dut.reg_file_.b2v_latch_af_hi.latch);
4540
   if (dut.reg_file_.b2v_latch_bc_lo.latch!==8'h05) $fdisplay(f,"* Reg bc c=%h !=05",dut.reg_file_.b2v_latch_bc_lo.latch);
4541
   if (dut.reg_file_.b2v_latch_bc_hi.latch!==8'h4e) $fdisplay(f,"* Reg bc b=%h !=4e",dut.reg_file_.b2v_latch_bc_hi.latch);
4542
   if (dut.reg_file_.b2v_latch_de_lo.latch!==8'hf8) $fdisplay(f,"* Reg de e=%h !=f8",dut.reg_file_.b2v_latch_de_lo.latch);
4543
   if (dut.reg_file_.b2v_latch_de_hi.latch!==8'hb3) $fdisplay(f,"* Reg de d=%h !=b3",dut.reg_file_.b2v_latch_de_hi.latch);
4544
   if (dut.reg_file_.b2v_latch_hl_lo.latch!==8'h34) $fdisplay(f,"* Reg hl l=%h !=34",dut.reg_file_.b2v_latch_hl_lo.latch);
4545
   if (dut.reg_file_.b2v_latch_hl_hi.latch!==8'h22) $fdisplay(f,"* Reg hl h=%h !=22",dut.reg_file_.b2v_latch_hl_hi.latch);
4546
   if (dut.reg_file_.b2v_latch_af2_lo.latch!==8'h00) $fdisplay(f,"* Reg af2 f=%h !=00",dut.reg_file_.b2v_latch_af2_lo.latch);
4547
   if (dut.reg_file_.b2v_latch_af2_hi.latch!==8'h00) $fdisplay(f,"* Reg af2 a=%h !=00",dut.reg_file_.b2v_latch_af2_hi.latch);
4548
   if (dut.reg_file_.b2v_latch_bc2_lo.latch!==8'h00) $fdisplay(f,"* Reg bc2 c=%h !=00",dut.reg_file_.b2v_latch_bc2_lo.latch);
4549
   if (dut.reg_file_.b2v_latch_bc2_hi.latch!==8'h00) $fdisplay(f,"* Reg bc2 b=%h !=00",dut.reg_file_.b2v_latch_bc2_hi.latch);
4550
   if (dut.reg_file_.b2v_latch_de2_lo.latch!==8'h00) $fdisplay(f,"* Reg de2 e=%h !=00",dut.reg_file_.b2v_latch_de2_lo.latch);
4551
   if (dut.reg_file_.b2v_latch_de2_hi.latch!==8'h00) $fdisplay(f,"* Reg de2 d=%h !=00",dut.reg_file_.b2v_latch_de2_hi.latch);
4552
   if (dut.reg_file_.b2v_latch_hl2_lo.latch!==8'h00) $fdisplay(f,"* Reg hl2 l=%h !=00",dut.reg_file_.b2v_latch_hl2_lo.latch);
4553
   if (dut.reg_file_.b2v_latch_hl2_hi.latch!==8'h00) $fdisplay(f,"* Reg hl2 h=%h !=00",dut.reg_file_.b2v_latch_hl2_hi.latch);
4554
   if (dut.reg_file_.b2v_latch_ix_lo.latch!==8'h00) $fdisplay(f,"* Reg ix x=%h !=00",dut.reg_file_.b2v_latch_ix_lo.latch);
4555
   if (dut.reg_file_.b2v_latch_ix_hi.latch!==8'h00) $fdisplay(f,"* Reg ix i=%h !=00",dut.reg_file_.b2v_latch_ix_hi.latch);
4556
   if (dut.reg_file_.b2v_latch_iy_lo.latch!==8'h00) $fdisplay(f,"* Reg iy y=%h !=00",dut.reg_file_.b2v_latch_iy_lo.latch);
4557
   if (dut.reg_file_.b2v_latch_iy_hi.latch!==8'h00) $fdisplay(f,"* Reg iy i=%h !=00",dut.reg_file_.b2v_latch_iy_hi.latch);
4558
   if (dut.reg_file_.b2v_latch_sp_lo.latch!==8'h00) $fdisplay(f,"* Reg sp p=%h !=00",dut.reg_file_.b2v_latch_sp_lo.latch);
4559
   if (dut.reg_file_.b2v_latch_sp_hi.latch!==8'h00) $fdisplay(f,"* Reg sp s=%h !=00",dut.reg_file_.b2v_latch_sp_hi.latch);
4560
   if (pc!==16'h0002) $fdisplay(f,"* PC=%h !=0002",pc);
4561
   if (dut.reg_file_.b2v_latch_ir_lo.latch!==8'h02) $fdisplay(f,"* Reg ir r=%h !=02",dut.reg_file_.b2v_latch_ir_lo.latch);
4562
   if (dut.reg_file_.b2v_latch_ir_hi.latch!==8'h00) $fdisplay(f,"* Reg ir i=%h !=00",dut.reg_file_.b2v_latch_ir_hi.latch);
4563 13 gdevic
#1 // End opcode
4564
 
4565 8 gdevic
   force dut.ir_.ctl_ir_we=1;
4566
   force dut.ir_.db=0;
4567
#2 release dut.ir_.ctl_ir_we;
4568
   release dut.ir_.db;
4569 13 gdevic
   $fdisplay(f,"Testing opcode cbc4    SET 0,H");
4570 6 gdevic
   // Preset af
4571
   force dut.reg_file_.b2v_latch_af_lo.we=1;
4572
   force dut.reg_file_.b2v_latch_af_hi.we=1;
4573
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
4574
   force dut.reg_file_.b2v_latch_af_hi.db=8'h7e;
4575
#2 release dut.reg_file_.b2v_latch_af_lo.we;
4576
   release dut.reg_file_.b2v_latch_af_hi.we;
4577
   release dut.reg_file_.b2v_latch_af_lo.db;
4578
   release dut.reg_file_.b2v_latch_af_hi.db;
4579
   // Preset bc
4580
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
4581
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
4582
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h5a;
4583
   force dut.reg_file_.b2v_latch_bc_hi.db=8'h54;
4584
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
4585
   release dut.reg_file_.b2v_latch_bc_hi.we;
4586
   release dut.reg_file_.b2v_latch_bc_lo.db;
4587
   release dut.reg_file_.b2v_latch_bc_hi.db;
4588
   // Preset de
4589
   force dut.reg_file_.b2v_latch_de_lo.we=1;
4590
   force dut.reg_file_.b2v_latch_de_hi.we=1;
4591
   force dut.reg_file_.b2v_latch_de_lo.db=8'hcf;
4592
   force dut.reg_file_.b2v_latch_de_hi.db=8'h6e;
4593
#2 release dut.reg_file_.b2v_latch_de_lo.we;
4594
   release dut.reg_file_.b2v_latch_de_hi.we;
4595
   release dut.reg_file_.b2v_latch_de_lo.db;
4596
   release dut.reg_file_.b2v_latch_de_hi.db;
4597
   // Preset hl
4598
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
4599
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
4600
   force dut.reg_file_.b2v_latch_hl_lo.db=8'h76;
4601
   force dut.reg_file_.b2v_latch_hl_hi.db=8'h58;
4602
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
4603
   release dut.reg_file_.b2v_latch_hl_hi.we;
4604
   release dut.reg_file_.b2v_latch_hl_lo.db;
4605
   release dut.reg_file_.b2v_latch_hl_hi.db;
4606
   // Preset af2
4607
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
4608
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
4609
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
4610
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
4611
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
4612
   release dut.reg_file_.b2v_latch_af2_hi.we;
4613
   release dut.reg_file_.b2v_latch_af2_lo.db;
4614
   release dut.reg_file_.b2v_latch_af2_hi.db;
4615
   // Preset bc2
4616
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
4617
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
4618
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
4619
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
4620
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
4621
   release dut.reg_file_.b2v_latch_bc2_hi.we;
4622
   release dut.reg_file_.b2v_latch_bc2_lo.db;
4623
   release dut.reg_file_.b2v_latch_bc2_hi.db;
4624
   // Preset de2
4625
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
4626
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
4627
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
4628
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
4629
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
4630
   release dut.reg_file_.b2v_latch_de2_hi.we;
4631
   release dut.reg_file_.b2v_latch_de2_lo.db;
4632
   release dut.reg_file_.b2v_latch_de2_hi.db;
4633
   // Preset hl2
4634
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
4635
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
4636
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
4637
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
4638
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
4639
   release dut.reg_file_.b2v_latch_hl2_hi.we;
4640
   release dut.reg_file_.b2v_latch_hl2_lo.db;
4641
   release dut.reg_file_.b2v_latch_hl2_hi.db;
4642
   // Preset ix
4643
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
4644
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
4645
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
4646
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
4647
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
4648
   release dut.reg_file_.b2v_latch_ix_hi.we;
4649
   release dut.reg_file_.b2v_latch_ix_lo.db;
4650
   release dut.reg_file_.b2v_latch_ix_hi.db;
4651
   // Preset iy
4652
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
4653
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
4654
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
4655
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
4656
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
4657
   release dut.reg_file_.b2v_latch_iy_hi.we;
4658
   release dut.reg_file_.b2v_latch_iy_lo.db;
4659
   release dut.reg_file_.b2v_latch_iy_hi.db;
4660
   // Preset sp
4661
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
4662
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
4663
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
4664
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
4665
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
4666
   release dut.reg_file_.b2v_latch_sp_hi.we;
4667
   release dut.reg_file_.b2v_latch_sp_lo.db;
4668
   release dut.reg_file_.b2v_latch_sp_hi.db;
4669
   // Preset wz
4670
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
4671
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
4672
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
4673
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
4674
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
4675
   release dut.reg_file_.b2v_latch_wz_hi.we;
4676
   release dut.reg_file_.b2v_latch_wz_lo.db;
4677
   release dut.reg_file_.b2v_latch_wz_hi.db;
4678
   // Preset pc
4679
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
4680
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
4681
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
4682
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
4683
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
4684
   release dut.reg_file_.b2v_latch_pc_hi.we;
4685
   release dut.reg_file_.b2v_latch_pc_lo.db;
4686
   release dut.reg_file_.b2v_latch_pc_hi.db;
4687
   // Preset ir
4688
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
4689
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
4690
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
4691
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
4692
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
4693
   release dut.reg_file_.b2v_latch_ir_hi.we;
4694
   release dut.reg_file_.b2v_latch_ir_lo.db;
4695
   release dut.reg_file_.b2v_latch_ir_hi.db;
4696
   // Preset memory
4697
   ram.Mem[0] = 8'hcb;
4698
   ram.Mem[1] = 8'hc4;
4699
   // Preset memory
4700
   ram.Mem[22646] = 8'h9d;
4701
   force dut.z80_top_ifc_n.fpga_reset=0;
4702 8 gdevic
   force dut.address_latch_.Q=16'h0000;
4703 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
4704
   release dut.reg_file_.reg_gp_we;
4705 13 gdevic
#2 // Execute: M1/T1 start
4706
#1 release dut.address_latch_.Q;
4707 6 gdevic
#1
4708 13 gdevic
#14 // Wait for opcode end
4709 6 gdevic
   force dut.reg_control_.ctl_reg_sys_we=0;
4710
#2 pc=z.A;
4711
#2
4712
#1 force dut.reg_file_.reg_gp_we=0;
4713
   force dut.z80_top_ifc_n.fpga_reset=1;
4714
   if (dut.reg_file_.b2v_latch_af_lo.latch!==8'h00) $fdisplay(f,"* Reg af f=%h !=00",dut.reg_file_.b2v_latch_af_lo.latch);
4715
   if (dut.reg_file_.b2v_latch_af_hi.latch!==8'h7e) $fdisplay(f,"* Reg af a=%h !=7e",dut.reg_file_.b2v_latch_af_hi.latch);
4716
   if (dut.reg_file_.b2v_latch_bc_lo.latch!==8'h5a) $fdisplay(f,"* Reg bc c=%h !=5a",dut.reg_file_.b2v_latch_bc_lo.latch);
4717
   if (dut.reg_file_.b2v_latch_bc_hi.latch!==8'h54) $fdisplay(f,"* Reg bc b=%h !=54",dut.reg_file_.b2v_latch_bc_hi.latch);
4718
   if (dut.reg_file_.b2v_latch_de_lo.latch!==8'hcf) $fdisplay(f,"* Reg de e=%h !=cf",dut.reg_file_.b2v_latch_de_lo.latch);
4719
   if (dut.reg_file_.b2v_latch_de_hi.latch!==8'h6e) $fdisplay(f,"* Reg de d=%h !=6e",dut.reg_file_.b2v_latch_de_hi.latch);
4720
   if (dut.reg_file_.b2v_latch_hl_lo.latch!==8'h76) $fdisplay(f,"* Reg hl l=%h !=76",dut.reg_file_.b2v_latch_hl_lo.latch);
4721
   if (dut.reg_file_.b2v_latch_hl_hi.latch!==8'h59) $fdisplay(f,"* Reg hl h=%h !=59",dut.reg_file_.b2v_latch_hl_hi.latch);
4722
   if (dut.reg_file_.b2v_latch_af2_lo.latch!==8'h00) $fdisplay(f,"* Reg af2 f=%h !=00",dut.reg_file_.b2v_latch_af2_lo.latch);
4723
   if (dut.reg_file_.b2v_latch_af2_hi.latch!==8'h00) $fdisplay(f,"* Reg af2 a=%h !=00",dut.reg_file_.b2v_latch_af2_hi.latch);
4724
   if (dut.reg_file_.b2v_latch_bc2_lo.latch!==8'h00) $fdisplay(f,"* Reg bc2 c=%h !=00",dut.reg_file_.b2v_latch_bc2_lo.latch);
4725
   if (dut.reg_file_.b2v_latch_bc2_hi.latch!==8'h00) $fdisplay(f,"* Reg bc2 b=%h !=00",dut.reg_file_.b2v_latch_bc2_hi.latch);
4726
   if (dut.reg_file_.b2v_latch_de2_lo.latch!==8'h00) $fdisplay(f,"* Reg de2 e=%h !=00",dut.reg_file_.b2v_latch_de2_lo.latch);
4727
   if (dut.reg_file_.b2v_latch_de2_hi.latch!==8'h00) $fdisplay(f,"* Reg de2 d=%h !=00",dut.reg_file_.b2v_latch_de2_hi.latch);
4728
   if (dut.reg_file_.b2v_latch_hl2_lo.latch!==8'h00) $fdisplay(f,"* Reg hl2 l=%h !=00",dut.reg_file_.b2v_latch_hl2_lo.latch);
4729
   if (dut.reg_file_.b2v_latch_hl2_hi.latch!==8'h00) $fdisplay(f,"* Reg hl2 h=%h !=00",dut.reg_file_.b2v_latch_hl2_hi.latch);
4730
   if (dut.reg_file_.b2v_latch_ix_lo.latch!==8'h00) $fdisplay(f,"* Reg ix x=%h !=00",dut.reg_file_.b2v_latch_ix_lo.latch);
4731
   if (dut.reg_file_.b2v_latch_ix_hi.latch!==8'h00) $fdisplay(f,"* Reg ix i=%h !=00",dut.reg_file_.b2v_latch_ix_hi.latch);
4732
   if (dut.reg_file_.b2v_latch_iy_lo.latch!==8'h00) $fdisplay(f,"* Reg iy y=%h !=00",dut.reg_file_.b2v_latch_iy_lo.latch);
4733
   if (dut.reg_file_.b2v_latch_iy_hi.latch!==8'h00) $fdisplay(f,"* Reg iy i=%h !=00",dut.reg_file_.b2v_latch_iy_hi.latch);
4734
   if (dut.reg_file_.b2v_latch_sp_lo.latch!==8'h00) $fdisplay(f,"* Reg sp p=%h !=00",dut.reg_file_.b2v_latch_sp_lo.latch);
4735
   if (dut.reg_file_.b2v_latch_sp_hi.latch!==8'h00) $fdisplay(f,"* Reg sp s=%h !=00",dut.reg_file_.b2v_latch_sp_hi.latch);
4736
   if (pc!==16'h0002) $fdisplay(f,"* PC=%h !=0002",pc);
4737
   if (dut.reg_file_.b2v_latch_ir_lo.latch!==8'h02) $fdisplay(f,"* Reg ir r=%h !=02",dut.reg_file_.b2v_latch_ir_lo.latch);
4738
   if (dut.reg_file_.b2v_latch_ir_hi.latch!==8'h00) $fdisplay(f,"* Reg ir i=%h !=00",dut.reg_file_.b2v_latch_ir_hi.latch);
4739 13 gdevic
#1 // End opcode
4740
 
4741 8 gdevic
   force dut.ir_.ctl_ir_we=1;
4742
   force dut.ir_.db=0;
4743
#2 release dut.ir_.ctl_ir_we;
4744
   release dut.ir_.db;
4745 13 gdevic
   $fdisplay(f,"Testing opcode dd75    LD (IX+d),L");
4746 6 gdevic
   // Preset af
4747
   force dut.reg_file_.b2v_latch_af_lo.we=1;
4748
   force dut.reg_file_.b2v_latch_af_hi.we=1;
4749
   force dut.reg_file_.b2v_latch_af_lo.db=8'h72;
4750
   force dut.reg_file_.b2v_latch_af_hi.db=8'h57;
4751
#2 release dut.reg_file_.b2v_latch_af_lo.we;
4752
   release dut.reg_file_.b2v_latch_af_hi.we;
4753
   release dut.reg_file_.b2v_latch_af_lo.db;
4754
   release dut.reg_file_.b2v_latch_af_hi.db;
4755
   // Preset bc
4756
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
4757
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
4758
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h33;
4759
   force dut.reg_file_.b2v_latch_bc_hi.db=8'he8;
4760
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
4761
   release dut.reg_file_.b2v_latch_bc_hi.we;
4762
   release dut.reg_file_.b2v_latch_bc_lo.db;
4763
   release dut.reg_file_.b2v_latch_bc_hi.db;
4764
   // Preset de
4765
   force dut.reg_file_.b2v_latch_de_lo.we=1;
4766
   force dut.reg_file_.b2v_latch_de_hi.we=1;
4767
   force dut.reg_file_.b2v_latch_de_lo.db=8'h3e;
4768
   force dut.reg_file_.b2v_latch_de_hi.db=8'hb6;
4769
#2 release dut.reg_file_.b2v_latch_de_lo.we;
4770
   release dut.reg_file_.b2v_latch_de_hi.we;
4771
   release dut.reg_file_.b2v_latch_de_lo.db;
4772
   release dut.reg_file_.b2v_latch_de_hi.db;
4773
   // Preset hl
4774
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
4775
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
4776
   force dut.reg_file_.b2v_latch_hl_lo.db=8'h4f;
4777
   force dut.reg_file_.b2v_latch_hl_hi.db=8'h73;
4778
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
4779
   release dut.reg_file_.b2v_latch_hl_hi.we;
4780
   release dut.reg_file_.b2v_latch_hl_lo.db;
4781
   release dut.reg_file_.b2v_latch_hl_hi.db;
4782
   // Preset af2
4783
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
4784
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
4785
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
4786
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
4787
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
4788
   release dut.reg_file_.b2v_latch_af2_hi.we;
4789
   release dut.reg_file_.b2v_latch_af2_lo.db;
4790
   release dut.reg_file_.b2v_latch_af2_hi.db;
4791
   // Preset bc2
4792
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
4793
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
4794
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
4795
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
4796
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
4797
   release dut.reg_file_.b2v_latch_bc2_hi.we;
4798
   release dut.reg_file_.b2v_latch_bc2_lo.db;
4799
   release dut.reg_file_.b2v_latch_bc2_hi.db;
4800
   // Preset de2
4801
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
4802
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
4803
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
4804
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
4805
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
4806
   release dut.reg_file_.b2v_latch_de2_hi.we;
4807
   release dut.reg_file_.b2v_latch_de2_lo.db;
4808
   release dut.reg_file_.b2v_latch_de2_hi.db;
4809
   // Preset hl2
4810
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
4811
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
4812
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
4813
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
4814
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
4815
   release dut.reg_file_.b2v_latch_hl2_hi.we;
4816
   release dut.reg_file_.b2v_latch_hl2_lo.db;
4817
   release dut.reg_file_.b2v_latch_hl2_hi.db;
4818
   // Preset ix
4819
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
4820
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
4821
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h4c;
4822
   force dut.reg_file_.b2v_latch_ix_hi.db=8'hae;
4823
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
4824
   release dut.reg_file_.b2v_latch_ix_hi.we;
4825
   release dut.reg_file_.b2v_latch_ix_lo.db;
4826
   release dut.reg_file_.b2v_latch_ix_hi.db;
4827
   // Preset iy
4828
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
4829
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
4830
   force dut.reg_file_.b2v_latch_iy_lo.db=8'hc2;
4831
   force dut.reg_file_.b2v_latch_iy_hi.db=8'he8;
4832
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
4833
   release dut.reg_file_.b2v_latch_iy_hi.we;
4834
   release dut.reg_file_.b2v_latch_iy_lo.db;
4835
   release dut.reg_file_.b2v_latch_iy_hi.db;
4836
   // Preset sp
4837
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
4838
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
4839
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
4840
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
4841
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
4842
   release dut.reg_file_.b2v_latch_sp_hi.we;
4843
   release dut.reg_file_.b2v_latch_sp_lo.db;
4844
   release dut.reg_file_.b2v_latch_sp_hi.db;
4845
   // Preset wz
4846
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
4847
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
4848
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
4849
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
4850
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
4851
   release dut.reg_file_.b2v_latch_wz_hi.we;
4852
   release dut.reg_file_.b2v_latch_wz_lo.db;
4853
   release dut.reg_file_.b2v_latch_wz_hi.db;
4854
   // Preset pc
4855
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
4856
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
4857
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
4858
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
4859
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
4860
   release dut.reg_file_.b2v_latch_pc_hi.we;
4861
   release dut.reg_file_.b2v_latch_pc_lo.db;
4862
   release dut.reg_file_.b2v_latch_pc_hi.db;
4863
   // Preset ir
4864
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
4865
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
4866
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
4867
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
4868
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
4869
   release dut.reg_file_.b2v_latch_ir_hi.we;
4870
   release dut.reg_file_.b2v_latch_ir_lo.db;
4871
   release dut.reg_file_.b2v_latch_ir_hi.db;
4872
   // Preset memory
4873
   ram.Mem[0] = 8'hdd;
4874
   ram.Mem[1] = 8'h75;
4875
   ram.Mem[2] = 8'h30;
4876
   force dut.z80_top_ifc_n.fpga_reset=0;
4877 8 gdevic
   force dut.address_latch_.Q=16'h0000;
4878 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
4879
   release dut.reg_file_.reg_gp_we;
4880 13 gdevic
#2 // Execute: M1/T1 start
4881
#1 release dut.address_latch_.Q;
4882 6 gdevic
#1
4883 13 gdevic
#36 // Wait for opcode end
4884 6 gdevic
   force dut.reg_control_.ctl_reg_sys_we=0;
4885
#2 pc=z.A;
4886
#2
4887
#1 force dut.reg_file_.reg_gp_we=0;
4888
   force dut.z80_top_ifc_n.fpga_reset=1;
4889
   if (dut.reg_file_.b2v_latch_af_lo.latch!==8'h72) $fdisplay(f,"* Reg af f=%h !=72",dut.reg_file_.b2v_latch_af_lo.latch);
4890
   if (dut.reg_file_.b2v_latch_af_hi.latch!==8'h57) $fdisplay(f,"* Reg af a=%h !=57",dut.reg_file_.b2v_latch_af_hi.latch);
4891
   if (dut.reg_file_.b2v_latch_bc_lo.latch!==8'h33) $fdisplay(f,"* Reg bc c=%h !=33",dut.reg_file_.b2v_latch_bc_lo.latch);
4892
   if (dut.reg_file_.b2v_latch_bc_hi.latch!==8'he8) $fdisplay(f,"* Reg bc b=%h !=e8",dut.reg_file_.b2v_latch_bc_hi.latch);
4893
   if (dut.reg_file_.b2v_latch_de_lo.latch!==8'h3e) $fdisplay(f,"* Reg de e=%h !=3e",dut.reg_file_.b2v_latch_de_lo.latch);
4894
   if (dut.reg_file_.b2v_latch_de_hi.latch!==8'hb6) $fdisplay(f,"* Reg de d=%h !=b6",dut.reg_file_.b2v_latch_de_hi.latch);
4895
   if (dut.reg_file_.b2v_latch_hl_lo.latch!==8'h4f) $fdisplay(f,"* Reg hl l=%h !=4f",dut.reg_file_.b2v_latch_hl_lo.latch);
4896
   if (dut.reg_file_.b2v_latch_hl_hi.latch!==8'h73) $fdisplay(f,"* Reg hl h=%h !=73",dut.reg_file_.b2v_latch_hl_hi.latch);
4897
   if (dut.reg_file_.b2v_latch_af2_lo.latch!==8'h00) $fdisplay(f,"* Reg af2 f=%h !=00",dut.reg_file_.b2v_latch_af2_lo.latch);
4898
   if (dut.reg_file_.b2v_latch_af2_hi.latch!==8'h00) $fdisplay(f,"* Reg af2 a=%h !=00",dut.reg_file_.b2v_latch_af2_hi.latch);
4899
   if (dut.reg_file_.b2v_latch_bc2_lo.latch!==8'h00) $fdisplay(f,"* Reg bc2 c=%h !=00",dut.reg_file_.b2v_latch_bc2_lo.latch);
4900
   if (dut.reg_file_.b2v_latch_bc2_hi.latch!==8'h00) $fdisplay(f,"* Reg bc2 b=%h !=00",dut.reg_file_.b2v_latch_bc2_hi.latch);
4901
   if (dut.reg_file_.b2v_latch_de2_lo.latch!==8'h00) $fdisplay(f,"* Reg de2 e=%h !=00",dut.reg_file_.b2v_latch_de2_lo.latch);
4902
   if (dut.reg_file_.b2v_latch_de2_hi.latch!==8'h00) $fdisplay(f,"* Reg de2 d=%h !=00",dut.reg_file_.b2v_latch_de2_hi.latch);
4903
   if (dut.reg_file_.b2v_latch_hl2_lo.latch!==8'h00) $fdisplay(f,"* Reg hl2 l=%h !=00",dut.reg_file_.b2v_latch_hl2_lo.latch);
4904
   if (dut.reg_file_.b2v_latch_hl2_hi.latch!==8'h00) $fdisplay(f,"* Reg hl2 h=%h !=00",dut.reg_file_.b2v_latch_hl2_hi.latch);
4905
   if (dut.reg_file_.b2v_latch_ix_lo.latch!==8'h4c) $fdisplay(f,"* Reg ix x=%h !=4c",dut.reg_file_.b2v_latch_ix_lo.latch);
4906
   if (dut.reg_file_.b2v_latch_ix_hi.latch!==8'hae) $fdisplay(f,"* Reg ix i=%h !=ae",dut.reg_file_.b2v_latch_ix_hi.latch);
4907
   if (dut.reg_file_.b2v_latch_iy_lo.latch!==8'hc2) $fdisplay(f,"* Reg iy y=%h !=c2",dut.reg_file_.b2v_latch_iy_lo.latch);
4908
   if (dut.reg_file_.b2v_latch_iy_hi.latch!==8'he8) $fdisplay(f,"* Reg iy i=%h !=e8",dut.reg_file_.b2v_latch_iy_hi.latch);
4909
   if (dut.reg_file_.b2v_latch_sp_lo.latch!==8'h00) $fdisplay(f,"* Reg sp p=%h !=00",dut.reg_file_.b2v_latch_sp_lo.latch);
4910
   if (dut.reg_file_.b2v_latch_sp_hi.latch!==8'h00) $fdisplay(f,"* Reg sp s=%h !=00",dut.reg_file_.b2v_latch_sp_hi.latch);
4911
   if (pc!==16'h0003) $fdisplay(f,"* PC=%h !=0003",pc);
4912
   if (dut.reg_file_.b2v_latch_ir_lo.latch!==8'h02) $fdisplay(f,"* Reg ir r=%h !=02",dut.reg_file_.b2v_latch_ir_lo.latch);
4913
   if (dut.reg_file_.b2v_latch_ir_hi.latch!==8'h00) $fdisplay(f,"* Reg ir i=%h !=00",dut.reg_file_.b2v_latch_ir_hi.latch);
4914
   if (ram.Mem[44668]!==8'h4f) $fdisplay(f,"* Mem[ae7c]=%h !=4f",ram.Mem[44668]);
4915 13 gdevic
#1 // End opcode
4916
 
4917 8 gdevic
   force dut.ir_.ctl_ir_we=1;
4918
   force dut.ir_.db=0;
4919
#2 release dut.ir_.ctl_ir_we;
4920
   release dut.ir_.db;
4921 13 gdevic
   $fdisplay(f,"Testing opcode dd4e    LD C,(IX+d)");
4922 6 gdevic
   // Preset af
4923
   force dut.reg_file_.b2v_latch_af_lo.we=1;
4924
   force dut.reg_file_.b2v_latch_af_hi.we=1;
4925
   force dut.reg_file_.b2v_latch_af_lo.db=8'hf7;
4926
   force dut.reg_file_.b2v_latch_af_hi.db=8'h7b;
4927
#2 release dut.reg_file_.b2v_latch_af_lo.we;
4928
   release dut.reg_file_.b2v_latch_af_hi.we;
4929
   release dut.reg_file_.b2v_latch_af_lo.db;
4930
   release dut.reg_file_.b2v_latch_af_hi.db;
4931
   // Preset bc
4932
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
4933
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
4934
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h05;
4935
   force dut.reg_file_.b2v_latch_bc_hi.db=8'h66;
4936
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
4937
   release dut.reg_file_.b2v_latch_bc_hi.we;
4938
   release dut.reg_file_.b2v_latch_bc_lo.db;
4939
   release dut.reg_file_.b2v_latch_bc_hi.db;
4940
   // Preset de
4941
   force dut.reg_file_.b2v_latch_de_lo.we=1;
4942
   force dut.reg_file_.b2v_latch_de_hi.we=1;
4943
   force dut.reg_file_.b2v_latch_de_lo.db=8'h55;
4944
   force dut.reg_file_.b2v_latch_de_hi.db=8'h8d;
4945
#2 release dut.reg_file_.b2v_latch_de_lo.we;
4946
   release dut.reg_file_.b2v_latch_de_hi.we;
4947
   release dut.reg_file_.b2v_latch_de_lo.db;
4948
   release dut.reg_file_.b2v_latch_de_hi.db;
4949
   // Preset hl
4950
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
4951
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
4952
   force dut.reg_file_.b2v_latch_hl_lo.db=8'hf2;
4953
   force dut.reg_file_.b2v_latch_hl_hi.db=8'hde;
4954
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
4955
   release dut.reg_file_.b2v_latch_hl_hi.we;
4956
   release dut.reg_file_.b2v_latch_hl_lo.db;
4957
   release dut.reg_file_.b2v_latch_hl_hi.db;
4958
   // Preset af2
4959
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
4960
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
4961
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
4962
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
4963
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
4964
   release dut.reg_file_.b2v_latch_af2_hi.we;
4965
   release dut.reg_file_.b2v_latch_af2_lo.db;
4966
   release dut.reg_file_.b2v_latch_af2_hi.db;
4967
   // Preset bc2
4968
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
4969
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
4970
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
4971
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
4972
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
4973
   release dut.reg_file_.b2v_latch_bc2_hi.we;
4974
   release dut.reg_file_.b2v_latch_bc2_lo.db;
4975
   release dut.reg_file_.b2v_latch_bc2_hi.db;
4976
   // Preset de2
4977
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
4978
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
4979
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
4980
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
4981
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
4982
   release dut.reg_file_.b2v_latch_de2_hi.we;
4983
   release dut.reg_file_.b2v_latch_de2_lo.db;
4984
   release dut.reg_file_.b2v_latch_de2_hi.db;
4985
   // Preset hl2
4986
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
4987
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
4988
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
4989
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
4990
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
4991
   release dut.reg_file_.b2v_latch_hl2_hi.we;
4992
   release dut.reg_file_.b2v_latch_hl2_lo.db;
4993
   release dut.reg_file_.b2v_latch_hl2_hi.db;
4994
   // Preset ix
4995
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
4996
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
4997
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h4b;
4998
   force dut.reg_file_.b2v_latch_ix_hi.db=8'hd9;
4999
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
5000
   release dut.reg_file_.b2v_latch_ix_hi.we;
5001
   release dut.reg_file_.b2v_latch_ix_lo.db;
5002
   release dut.reg_file_.b2v_latch_ix_hi.db;
5003
   // Preset iy
5004
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
5005
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
5006
   force dut.reg_file_.b2v_latch_iy_lo.db=8'hfb;
5007
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h17;
5008
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
5009
   release dut.reg_file_.b2v_latch_iy_hi.we;
5010
   release dut.reg_file_.b2v_latch_iy_lo.db;
5011
   release dut.reg_file_.b2v_latch_iy_hi.db;
5012
   // Preset sp
5013
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
5014
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
5015
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
5016
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
5017
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
5018
   release dut.reg_file_.b2v_latch_sp_hi.we;
5019
   release dut.reg_file_.b2v_latch_sp_lo.db;
5020
   release dut.reg_file_.b2v_latch_sp_hi.db;
5021
   // Preset wz
5022
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
5023
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
5024
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
5025
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
5026
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
5027
   release dut.reg_file_.b2v_latch_wz_hi.we;
5028
   release dut.reg_file_.b2v_latch_wz_lo.db;
5029
   release dut.reg_file_.b2v_latch_wz_hi.db;
5030
   // Preset pc
5031
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
5032
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
5033
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
5034
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
5035
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
5036
   release dut.reg_file_.b2v_latch_pc_hi.we;
5037
   release dut.reg_file_.b2v_latch_pc_lo.db;
5038
   release dut.reg_file_.b2v_latch_pc_hi.db;
5039
   // Preset ir
5040
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
5041
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
5042
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
5043
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
5044
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
5045
   release dut.reg_file_.b2v_latch_ir_hi.we;
5046
   release dut.reg_file_.b2v_latch_ir_lo.db;
5047
   release dut.reg_file_.b2v_latch_ir_hi.db;
5048
   // Preset memory
5049
   ram.Mem[0] = 8'hdd;
5050
   ram.Mem[1] = 8'h4e;
5051
   ram.Mem[2] = 8'h2e;
5052
   // Preset memory
5053
   ram.Mem[55673] = 8'h76;
5054
   force dut.z80_top_ifc_n.fpga_reset=0;
5055 8 gdevic
   force dut.address_latch_.Q=16'h0000;
5056 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
5057
   release dut.reg_file_.reg_gp_we;
5058 13 gdevic
#2 // Execute: M1/T1 start
5059
#1 release dut.address_latch_.Q;
5060 6 gdevic
#1
5061 13 gdevic
#36 // Wait for opcode end
5062 6 gdevic
   force dut.reg_control_.ctl_reg_sys_we=0;
5063
#2 pc=z.A;
5064
#2
5065
#1 force dut.reg_file_.reg_gp_we=0;
5066
   force dut.z80_top_ifc_n.fpga_reset=1;
5067
   if (dut.reg_file_.b2v_latch_af_lo.latch!==8'hf7) $fdisplay(f,"* Reg af f=%h !=f7",dut.reg_file_.b2v_latch_af_lo.latch);
5068
   if (dut.reg_file_.b2v_latch_af_hi.latch!==8'h7b) $fdisplay(f,"* Reg af a=%h !=7b",dut.reg_file_.b2v_latch_af_hi.latch);
5069
   if (dut.reg_file_.b2v_latch_bc_lo.latch!==8'h76) $fdisplay(f,"* Reg bc c=%h !=76",dut.reg_file_.b2v_latch_bc_lo.latch);
5070
   if (dut.reg_file_.b2v_latch_bc_hi.latch!==8'h66) $fdisplay(f,"* Reg bc b=%h !=66",dut.reg_file_.b2v_latch_bc_hi.latch);
5071
   if (dut.reg_file_.b2v_latch_de_lo.latch!==8'h55) $fdisplay(f,"* Reg de e=%h !=55",dut.reg_file_.b2v_latch_de_lo.latch);
5072
   if (dut.reg_file_.b2v_latch_de_hi.latch!==8'h8d) $fdisplay(f,"* Reg de d=%h !=8d",dut.reg_file_.b2v_latch_de_hi.latch);
5073
   if (dut.reg_file_.b2v_latch_hl_lo.latch!==8'hf2) $fdisplay(f,"* Reg hl l=%h !=f2",dut.reg_file_.b2v_latch_hl_lo.latch);
5074
   if (dut.reg_file_.b2v_latch_hl_hi.latch!==8'hde) $fdisplay(f,"* Reg hl h=%h !=de",dut.reg_file_.b2v_latch_hl_hi.latch);
5075
   if (dut.reg_file_.b2v_latch_af2_lo.latch!==8'h00) $fdisplay(f,"* Reg af2 f=%h !=00",dut.reg_file_.b2v_latch_af2_lo.latch);
5076
   if (dut.reg_file_.b2v_latch_af2_hi.latch!==8'h00) $fdisplay(f,"* Reg af2 a=%h !=00",dut.reg_file_.b2v_latch_af2_hi.latch);
5077
   if (dut.reg_file_.b2v_latch_bc2_lo.latch!==8'h00) $fdisplay(f,"* Reg bc2 c=%h !=00",dut.reg_file_.b2v_latch_bc2_lo.latch);
5078
   if (dut.reg_file_.b2v_latch_bc2_hi.latch!==8'h00) $fdisplay(f,"* Reg bc2 b=%h !=00",dut.reg_file_.b2v_latch_bc2_hi.latch);
5079
   if (dut.reg_file_.b2v_latch_de2_lo.latch!==8'h00) $fdisplay(f,"* Reg de2 e=%h !=00",dut.reg_file_.b2v_latch_de2_lo.latch);
5080
   if (dut.reg_file_.b2v_latch_de2_hi.latch!==8'h00) $fdisplay(f,"* Reg de2 d=%h !=00",dut.reg_file_.b2v_latch_de2_hi.latch);
5081
   if (dut.reg_file_.b2v_latch_hl2_lo.latch!==8'h00) $fdisplay(f,"* Reg hl2 l=%h !=00",dut.reg_file_.b2v_latch_hl2_lo.latch);
5082
   if (dut.reg_file_.b2v_latch_hl2_hi.latch!==8'h00) $fdisplay(f,"* Reg hl2 h=%h !=00",dut.reg_file_.b2v_latch_hl2_hi.latch);
5083
   if (dut.reg_file_.b2v_latch_ix_lo.latch!==8'h4b) $fdisplay(f,"* Reg ix x=%h !=4b",dut.reg_file_.b2v_latch_ix_lo.latch);
5084
   if (dut.reg_file_.b2v_latch_ix_hi.latch!==8'hd9) $fdisplay(f,"* Reg ix i=%h !=d9",dut.reg_file_.b2v_latch_ix_hi.latch);
5085
   if (dut.reg_file_.b2v_latch_iy_lo.latch!==8'hfb) $fdisplay(f,"* Reg iy y=%h !=fb",dut.reg_file_.b2v_latch_iy_lo.latch);
5086
   if (dut.reg_file_.b2v_latch_iy_hi.latch!==8'h17) $fdisplay(f,"* Reg iy i=%h !=17",dut.reg_file_.b2v_latch_iy_hi.latch);
5087
   if (dut.reg_file_.b2v_latch_sp_lo.latch!==8'h00) $fdisplay(f,"* Reg sp p=%h !=00",dut.reg_file_.b2v_latch_sp_lo.latch);
5088
   if (dut.reg_file_.b2v_latch_sp_hi.latch!==8'h00) $fdisplay(f,"* Reg sp s=%h !=00",dut.reg_file_.b2v_latch_sp_hi.latch);
5089
   if (pc!==16'h0003) $fdisplay(f,"* PC=%h !=0003",pc);
5090
   if (dut.reg_file_.b2v_latch_ir_lo.latch!==8'h02) $fdisplay(f,"* Reg ir r=%h !=02",dut.reg_file_.b2v_latch_ir_lo.latch);
5091
   if (dut.reg_file_.b2v_latch_ir_hi.latch!==8'h00) $fdisplay(f,"* Reg ir i=%h !=00",dut.reg_file_.b2v_latch_ir_hi.latch);
5092 13 gdevic
#1 // End opcode
5093
 
5094
`define TOTAL_CLKS 1588
5095 6 gdevic
$fdisplay(f,"=== Tests completed ===");

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.