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;