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 8

Go to most recent revision | 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
#2
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 6 gdevic
$fdisplay(f,"Testing opcode 00      NOP");
14
   // 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
#3
147 8 gdevic
   release dut.address_latch_.Q;
148 6 gdevic
#1
149
#6 // Execute
150
   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
//--------------------------------------------------------------------------------
181 8 gdevic
   force dut.ir_.ctl_ir_we=1;
182
   force dut.ir_.db=0;
183
#2 release dut.ir_.ctl_ir_we;
184
   release dut.ir_.db;
185 6 gdevic
$fdisplay(f,"Testing opcode ed67    RRD");
186
   // Preset af
187
   force dut.reg_file_.b2v_latch_af_lo.we=1;
188
   force dut.reg_file_.b2v_latch_af_hi.we=1;
189
   force dut.reg_file_.b2v_latch_af_lo.db=8'h24;
190
   force dut.reg_file_.b2v_latch_af_hi.db=8'h36;
191
#2 release dut.reg_file_.b2v_latch_af_lo.we;
192
   release dut.reg_file_.b2v_latch_af_hi.we;
193
   release dut.reg_file_.b2v_latch_af_lo.db;
194
   release dut.reg_file_.b2v_latch_af_hi.db;
195
   // Preset bc
196
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
197
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
198
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h6a;
199
   force dut.reg_file_.b2v_latch_bc_hi.db=8'hb1;
200
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
201
   release dut.reg_file_.b2v_latch_bc_hi.we;
202
   release dut.reg_file_.b2v_latch_bc_lo.db;
203
   release dut.reg_file_.b2v_latch_bc_hi.db;
204
   // Preset de
205
   force dut.reg_file_.b2v_latch_de_lo.we=1;
206
   force dut.reg_file_.b2v_latch_de_hi.we=1;
207
   force dut.reg_file_.b2v_latch_de_lo.db=8'hdb;
208
   force dut.reg_file_.b2v_latch_de_hi.db=8'ha4;
209
#2 release dut.reg_file_.b2v_latch_de_lo.we;
210
   release dut.reg_file_.b2v_latch_de_hi.we;
211
   release dut.reg_file_.b2v_latch_de_lo.db;
212
   release dut.reg_file_.b2v_latch_de_hi.db;
213
   // Preset hl
214
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
215
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
216
   force dut.reg_file_.b2v_latch_hl_lo.db=8'hde;
217
   force dut.reg_file_.b2v_latch_hl_hi.db=8'hb9;
218
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
219
   release dut.reg_file_.b2v_latch_hl_hi.we;
220
   release dut.reg_file_.b2v_latch_hl_lo.db;
221
   release dut.reg_file_.b2v_latch_hl_hi.db;
222
   // Preset af2
223
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
224
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
225
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
226
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
227
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
228
   release dut.reg_file_.b2v_latch_af2_hi.we;
229
   release dut.reg_file_.b2v_latch_af2_lo.db;
230
   release dut.reg_file_.b2v_latch_af2_hi.db;
231
   // Preset bc2
232
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
233
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
234
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
235
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
236
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
237
   release dut.reg_file_.b2v_latch_bc2_hi.we;
238
   release dut.reg_file_.b2v_latch_bc2_lo.db;
239
   release dut.reg_file_.b2v_latch_bc2_hi.db;
240
   // Preset de2
241
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
242
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
243
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
244
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
245
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
246
   release dut.reg_file_.b2v_latch_de2_hi.we;
247
   release dut.reg_file_.b2v_latch_de2_lo.db;
248
   release dut.reg_file_.b2v_latch_de2_hi.db;
249
   // Preset hl2
250
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
251
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
252
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
253
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
254
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
255
   release dut.reg_file_.b2v_latch_hl2_hi.we;
256
   release dut.reg_file_.b2v_latch_hl2_lo.db;
257
   release dut.reg_file_.b2v_latch_hl2_hi.db;
258
   // Preset ix
259
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
260
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
261
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
262
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
263
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
264
   release dut.reg_file_.b2v_latch_ix_hi.we;
265
   release dut.reg_file_.b2v_latch_ix_lo.db;
266
   release dut.reg_file_.b2v_latch_ix_hi.db;
267
   // Preset iy
268
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
269
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
270
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
271
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
272
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
273
   release dut.reg_file_.b2v_latch_iy_hi.we;
274
   release dut.reg_file_.b2v_latch_iy_lo.db;
275
   release dut.reg_file_.b2v_latch_iy_hi.db;
276
   // Preset sp
277
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
278
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
279
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
280
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
281
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
282
   release dut.reg_file_.b2v_latch_sp_hi.we;
283
   release dut.reg_file_.b2v_latch_sp_lo.db;
284
   release dut.reg_file_.b2v_latch_sp_hi.db;
285
   // Preset wz
286
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
287
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
288
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
289
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
290
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
291
   release dut.reg_file_.b2v_latch_wz_hi.we;
292
   release dut.reg_file_.b2v_latch_wz_lo.db;
293
   release dut.reg_file_.b2v_latch_wz_hi.db;
294
   // Preset pc
295
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
296
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
297
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
298
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
299
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
300
   release dut.reg_file_.b2v_latch_pc_hi.we;
301
   release dut.reg_file_.b2v_latch_pc_lo.db;
302
   release dut.reg_file_.b2v_latch_pc_hi.db;
303
   // Preset ir
304
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
305
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
306
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
307
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
308
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
309
   release dut.reg_file_.b2v_latch_ir_hi.we;
310
   release dut.reg_file_.b2v_latch_ir_lo.db;
311
   release dut.reg_file_.b2v_latch_ir_hi.db;
312
   // Preset memory
313
   ram.Mem[0] = 8'hed;
314
   ram.Mem[1] = 8'h67;
315
   // Preset memory
316
   ram.Mem[47582] = 8'h93;
317
   force dut.z80_top_ifc_n.fpga_reset=0;
318 8 gdevic
   force dut.address_latch_.Q=16'h0000;
319 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
320
   release dut.reg_file_.reg_gp_we;
321
#3
322 8 gdevic
   release dut.address_latch_.Q;
323 6 gdevic
#1
324
#34 // Execute
325
   force dut.reg_control_.ctl_reg_sys_we=0;
326
#2 pc=z.A;
327
#2
328
#1 force dut.reg_file_.reg_gp_we=0;
329
   force dut.z80_top_ifc_n.fpga_reset=1;
330
   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);
331
   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);
332
   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);
333
   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);
334
   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);
335
   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);
336
   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);
337
   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);
338
   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);
339
   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);
340
   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);
341
   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);
342
   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);
343
   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);
344
   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);
345
   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);
346
   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);
347
   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);
348
   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);
349
   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);
350
   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);
351
   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);
352
   if (pc!==16'h0002) $fdisplay(f,"* PC=%h !=0002",pc);
353
   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);
354
   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);
355
   if (ram.Mem[47582]!==8'h69) $fdisplay(f,"* Mem[b9de]=%h !=69",ram.Mem[47582]);
356
//--------------------------------------------------------------------------------
357 8 gdevic
   force dut.ir_.ctl_ir_we=1;
358
   force dut.ir_.db=0;
359
#2 release dut.ir_.ctl_ir_we;
360
   release dut.ir_.db;
361 6 gdevic
$fdisplay(f,"Testing opcode ed6f    RLD");
362
   // Preset af
363
   force dut.reg_file_.b2v_latch_af_lo.we=1;
364
   force dut.reg_file_.b2v_latch_af_hi.we=1;
365
   force dut.reg_file_.b2v_latch_af_lo.db=8'h8b;
366
   force dut.reg_file_.b2v_latch_af_hi.db=8'h65;
367
#2 release dut.reg_file_.b2v_latch_af_lo.we;
368
   release dut.reg_file_.b2v_latch_af_hi.we;
369
   release dut.reg_file_.b2v_latch_af_lo.db;
370
   release dut.reg_file_.b2v_latch_af_hi.db;
371
   // Preset bc
372
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
373
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
374
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h7a;
375
   force dut.reg_file_.b2v_latch_bc_hi.db=8'h7a;
376
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
377
   release dut.reg_file_.b2v_latch_bc_hi.we;
378
   release dut.reg_file_.b2v_latch_bc_lo.db;
379
   release dut.reg_file_.b2v_latch_bc_hi.db;
380
   // Preset de
381
   force dut.reg_file_.b2v_latch_de_lo.we=1;
382
   force dut.reg_file_.b2v_latch_de_hi.we=1;
383
   force dut.reg_file_.b2v_latch_de_lo.db=8'hf0;
384
   force dut.reg_file_.b2v_latch_de_hi.db=8'hec;
385
#2 release dut.reg_file_.b2v_latch_de_lo.we;
386
   release dut.reg_file_.b2v_latch_de_hi.we;
387
   release dut.reg_file_.b2v_latch_de_lo.db;
388
   release dut.reg_file_.b2v_latch_de_hi.db;
389
   // Preset hl
390
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
391
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
392
   force dut.reg_file_.b2v_latch_hl_lo.db=8'h3c;
393
   force dut.reg_file_.b2v_latch_hl_hi.db=8'h40;
394
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
395
   release dut.reg_file_.b2v_latch_hl_hi.we;
396
   release dut.reg_file_.b2v_latch_hl_lo.db;
397
   release dut.reg_file_.b2v_latch_hl_hi.db;
398
   // Preset af2
399
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
400
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
401
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
402
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
403
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
404
   release dut.reg_file_.b2v_latch_af2_hi.we;
405
   release dut.reg_file_.b2v_latch_af2_lo.db;
406
   release dut.reg_file_.b2v_latch_af2_hi.db;
407
   // Preset bc2
408
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
409
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
410
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
411
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
412
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
413
   release dut.reg_file_.b2v_latch_bc2_hi.we;
414
   release dut.reg_file_.b2v_latch_bc2_lo.db;
415
   release dut.reg_file_.b2v_latch_bc2_hi.db;
416
   // Preset de2
417
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
418
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
419
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
420
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
421
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
422
   release dut.reg_file_.b2v_latch_de2_hi.we;
423
   release dut.reg_file_.b2v_latch_de2_lo.db;
424
   release dut.reg_file_.b2v_latch_de2_hi.db;
425
   // Preset hl2
426
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
427
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
428
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
429
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
430
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
431
   release dut.reg_file_.b2v_latch_hl2_hi.we;
432
   release dut.reg_file_.b2v_latch_hl2_lo.db;
433
   release dut.reg_file_.b2v_latch_hl2_hi.db;
434
   // Preset ix
435
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
436
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
437
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
438
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
439
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
440
   release dut.reg_file_.b2v_latch_ix_hi.we;
441
   release dut.reg_file_.b2v_latch_ix_lo.db;
442
   release dut.reg_file_.b2v_latch_ix_hi.db;
443
   // Preset iy
444
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
445
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
446
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
447
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
448
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
449
   release dut.reg_file_.b2v_latch_iy_hi.we;
450
   release dut.reg_file_.b2v_latch_iy_lo.db;
451
   release dut.reg_file_.b2v_latch_iy_hi.db;
452
   // Preset sp
453
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
454
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
455
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
456
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
457
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
458
   release dut.reg_file_.b2v_latch_sp_hi.we;
459
   release dut.reg_file_.b2v_latch_sp_lo.db;
460
   release dut.reg_file_.b2v_latch_sp_hi.db;
461
   // Preset wz
462
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
463
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
464
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
465
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
466
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
467
   release dut.reg_file_.b2v_latch_wz_hi.we;
468
   release dut.reg_file_.b2v_latch_wz_lo.db;
469
   release dut.reg_file_.b2v_latch_wz_hi.db;
470
   // Preset pc
471
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
472
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
473
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
474
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
475
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
476
   release dut.reg_file_.b2v_latch_pc_hi.we;
477
   release dut.reg_file_.b2v_latch_pc_lo.db;
478
   release dut.reg_file_.b2v_latch_pc_hi.db;
479
   // Preset ir
480
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
481
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
482
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
483
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
484
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
485
   release dut.reg_file_.b2v_latch_ir_hi.we;
486
   release dut.reg_file_.b2v_latch_ir_lo.db;
487
   release dut.reg_file_.b2v_latch_ir_hi.db;
488
   // Preset memory
489
   ram.Mem[0] = 8'hed;
490
   ram.Mem[1] = 8'h6f;
491
   // Preset memory
492
   ram.Mem[16444] = 8'hc4;
493
   force dut.z80_top_ifc_n.fpga_reset=0;
494 8 gdevic
   force dut.address_latch_.Q=16'h0000;
495 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
496
   release dut.reg_file_.reg_gp_we;
497
#3
498 8 gdevic
   release dut.address_latch_.Q;
499 6 gdevic
#1
500
#34 // Execute
501
   force dut.reg_control_.ctl_reg_sys_we=0;
502
#2 pc=z.A;
503
#2
504
#1 force dut.reg_file_.reg_gp_we=0;
505
   force dut.z80_top_ifc_n.fpga_reset=1;
506
   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);
507
   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);
508
   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);
509
   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);
510
   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);
511
   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);
512
   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);
513
   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);
514
   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);
515
   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);
516
   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);
517
   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);
518
   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);
519
   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);
520
   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);
521
   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);
522
   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);
523
   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);
524
   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);
525
   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);
526
   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);
527
   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);
528
   if (pc!==16'h0002) $fdisplay(f,"* PC=%h !=0002",pc);
529
   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);
530
   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);
531
   if (ram.Mem[16444]!==8'h45) $fdisplay(f,"* Mem[403c]=%h !=45",ram.Mem[16444]);
532
//--------------------------------------------------------------------------------
533 8 gdevic
   force dut.ir_.ctl_ir_we=1;
534
   force dut.ir_.db=0;
535
#2 release dut.ir_.ctl_ir_we;
536
   release dut.ir_.db;
537 6 gdevic
$fdisplay(f,"Testing opcode 81      ADD A,C");
538
   // Preset af
539
   force dut.reg_file_.b2v_latch_af_lo.we=1;
540
   force dut.reg_file_.b2v_latch_af_hi.we=1;
541
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
542
   force dut.reg_file_.b2v_latch_af_hi.db=8'hf5;
543
#2 release dut.reg_file_.b2v_latch_af_lo.we;
544
   release dut.reg_file_.b2v_latch_af_hi.we;
545
   release dut.reg_file_.b2v_latch_af_lo.db;
546
   release dut.reg_file_.b2v_latch_af_hi.db;
547
   // Preset bc
548
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
549
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
550
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h3b;
551
   force dut.reg_file_.b2v_latch_bc_hi.db=8'h0f;
552
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
553
   release dut.reg_file_.b2v_latch_bc_hi.we;
554
   release dut.reg_file_.b2v_latch_bc_lo.db;
555
   release dut.reg_file_.b2v_latch_bc_hi.db;
556
   // Preset de
557
   force dut.reg_file_.b2v_latch_de_lo.we=1;
558
   force dut.reg_file_.b2v_latch_de_hi.we=1;
559
   force dut.reg_file_.b2v_latch_de_lo.db=8'h0d;
560
   force dut.reg_file_.b2v_latch_de_hi.db=8'h20;
561
#2 release dut.reg_file_.b2v_latch_de_lo.we;
562
   release dut.reg_file_.b2v_latch_de_hi.we;
563
   release dut.reg_file_.b2v_latch_de_lo.db;
564
   release dut.reg_file_.b2v_latch_de_hi.db;
565
   // Preset hl
566
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
567
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
568
   force dut.reg_file_.b2v_latch_hl_lo.db=8'ha6;
569
   force dut.reg_file_.b2v_latch_hl_hi.db=8'hdc;
570
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
571
   release dut.reg_file_.b2v_latch_hl_hi.we;
572
   release dut.reg_file_.b2v_latch_hl_lo.db;
573
   release dut.reg_file_.b2v_latch_hl_hi.db;
574
   // Preset af2
575
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
576
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
577
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
578
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
579
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
580
   release dut.reg_file_.b2v_latch_af2_hi.we;
581
   release dut.reg_file_.b2v_latch_af2_lo.db;
582
   release dut.reg_file_.b2v_latch_af2_hi.db;
583
   // Preset bc2
584
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
585
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
586
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
587
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
588
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
589
   release dut.reg_file_.b2v_latch_bc2_hi.we;
590
   release dut.reg_file_.b2v_latch_bc2_lo.db;
591
   release dut.reg_file_.b2v_latch_bc2_hi.db;
592
   // Preset de2
593
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
594
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
595
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
596
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
597
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
598
   release dut.reg_file_.b2v_latch_de2_hi.we;
599
   release dut.reg_file_.b2v_latch_de2_lo.db;
600
   release dut.reg_file_.b2v_latch_de2_hi.db;
601
   // Preset hl2
602
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
603
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
604
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
605
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
606
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
607
   release dut.reg_file_.b2v_latch_hl2_hi.we;
608
   release dut.reg_file_.b2v_latch_hl2_lo.db;
609
   release dut.reg_file_.b2v_latch_hl2_hi.db;
610
   // Preset ix
611
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
612
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
613
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
614
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
615
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
616
   release dut.reg_file_.b2v_latch_ix_hi.we;
617
   release dut.reg_file_.b2v_latch_ix_lo.db;
618
   release dut.reg_file_.b2v_latch_ix_hi.db;
619
   // Preset iy
620
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
621
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
622
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
623
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
624
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
625
   release dut.reg_file_.b2v_latch_iy_hi.we;
626
   release dut.reg_file_.b2v_latch_iy_lo.db;
627
   release dut.reg_file_.b2v_latch_iy_hi.db;
628
   // Preset sp
629
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
630
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
631
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
632
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
633
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
634
   release dut.reg_file_.b2v_latch_sp_hi.we;
635
   release dut.reg_file_.b2v_latch_sp_lo.db;
636
   release dut.reg_file_.b2v_latch_sp_hi.db;
637
   // Preset wz
638
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
639
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
640
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
641
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
642
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
643
   release dut.reg_file_.b2v_latch_wz_hi.we;
644
   release dut.reg_file_.b2v_latch_wz_lo.db;
645
   release dut.reg_file_.b2v_latch_wz_hi.db;
646
   // Preset pc
647
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
648
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
649
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
650
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
651
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
652
   release dut.reg_file_.b2v_latch_pc_hi.we;
653
   release dut.reg_file_.b2v_latch_pc_lo.db;
654
   release dut.reg_file_.b2v_latch_pc_hi.db;
655
   // Preset ir
656
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
657
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
658
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
659
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
660
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
661
   release dut.reg_file_.b2v_latch_ir_hi.we;
662
   release dut.reg_file_.b2v_latch_ir_lo.db;
663
   release dut.reg_file_.b2v_latch_ir_hi.db;
664
   // Preset memory
665
   ram.Mem[0] = 8'h81;
666
   // Preset memory
667
   ram.Mem[56486] = 8'h49;
668
   force dut.z80_top_ifc_n.fpga_reset=0;
669 8 gdevic
   force dut.address_latch_.Q=16'h0000;
670 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
671
   release dut.reg_file_.reg_gp_we;
672
#3
673 8 gdevic
   release dut.address_latch_.Q;
674 6 gdevic
#1
675
#6 // Execute
676
   force dut.reg_control_.ctl_reg_sys_we=0;
677
#2 pc=z.A;
678
#2
679
#1 force dut.reg_file_.reg_gp_we=0;
680
   force dut.z80_top_ifc_n.fpga_reset=1;
681
   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);
682
   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);
683
   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);
684
   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);
685
   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);
686
   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);
687
   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);
688
   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);
689
   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);
690
   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);
691
   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);
692
   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);
693
   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);
694
   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);
695
   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);
696
   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);
697
   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);
698
   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);
699
   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);
700
   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);
701
   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);
702
   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);
703
   if (pc!==16'h0001) $fdisplay(f,"* PC=%h !=0001",pc);
704
   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);
705
   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);
706
//--------------------------------------------------------------------------------
707 8 gdevic
   force dut.ir_.ctl_ir_we=1;
708
   force dut.ir_.db=0;
709
#2 release dut.ir_.ctl_ir_we;
710
   release dut.ir_.db;
711 6 gdevic
$fdisplay(f,"Testing opcode cb41    BIT 0,C");
712
   // Preset af
713
   force dut.reg_file_.b2v_latch_af_lo.we=1;
714
   force dut.reg_file_.b2v_latch_af_hi.we=1;
715
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
716
   force dut.reg_file_.b2v_latch_af_hi.db=8'h9e;
717
#2 release dut.reg_file_.b2v_latch_af_lo.we;
718
   release dut.reg_file_.b2v_latch_af_hi.we;
719
   release dut.reg_file_.b2v_latch_af_lo.db;
720
   release dut.reg_file_.b2v_latch_af_hi.db;
721
   // Preset bc
722
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
723
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
724
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h43;
725
   force dut.reg_file_.b2v_latch_bc_hi.db=8'h1b;
726
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
727
   release dut.reg_file_.b2v_latch_bc_hi.we;
728
   release dut.reg_file_.b2v_latch_bc_lo.db;
729
   release dut.reg_file_.b2v_latch_bc_hi.db;
730
   // Preset de
731
   force dut.reg_file_.b2v_latch_de_lo.we=1;
732
   force dut.reg_file_.b2v_latch_de_hi.we=1;
733
   force dut.reg_file_.b2v_latch_de_lo.db=8'h4e;
734
   force dut.reg_file_.b2v_latch_de_hi.db=8'h95;
735
#2 release dut.reg_file_.b2v_latch_de_lo.we;
736
   release dut.reg_file_.b2v_latch_de_hi.we;
737
   release dut.reg_file_.b2v_latch_de_lo.db;
738
   release dut.reg_file_.b2v_latch_de_hi.db;
739
   // Preset hl
740
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
741
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
742
   force dut.reg_file_.b2v_latch_hl_lo.db=8'he9;
743
   force dut.reg_file_.b2v_latch_hl_hi.db=8'h7b;
744
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
745
   release dut.reg_file_.b2v_latch_hl_hi.we;
746
   release dut.reg_file_.b2v_latch_hl_lo.db;
747
   release dut.reg_file_.b2v_latch_hl_hi.db;
748
   // Preset af2
749
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
750
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
751
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
752
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
753
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
754
   release dut.reg_file_.b2v_latch_af2_hi.we;
755
   release dut.reg_file_.b2v_latch_af2_lo.db;
756
   release dut.reg_file_.b2v_latch_af2_hi.db;
757
   // Preset bc2
758
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
759
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
760
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
761
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
762
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
763
   release dut.reg_file_.b2v_latch_bc2_hi.we;
764
   release dut.reg_file_.b2v_latch_bc2_lo.db;
765
   release dut.reg_file_.b2v_latch_bc2_hi.db;
766
   // Preset de2
767
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
768
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
769
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
770
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
771
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
772
   release dut.reg_file_.b2v_latch_de2_hi.we;
773
   release dut.reg_file_.b2v_latch_de2_lo.db;
774
   release dut.reg_file_.b2v_latch_de2_hi.db;
775
   // Preset hl2
776
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
777
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
778
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
779
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
780
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
781
   release dut.reg_file_.b2v_latch_hl2_hi.we;
782
   release dut.reg_file_.b2v_latch_hl2_lo.db;
783
   release dut.reg_file_.b2v_latch_hl2_hi.db;
784
   // Preset ix
785
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
786
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
787
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
788
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
789
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
790
   release dut.reg_file_.b2v_latch_ix_hi.we;
791
   release dut.reg_file_.b2v_latch_ix_lo.db;
792
   release dut.reg_file_.b2v_latch_ix_hi.db;
793
   // Preset iy
794
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
795
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
796
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
797
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
798
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
799
   release dut.reg_file_.b2v_latch_iy_hi.we;
800
   release dut.reg_file_.b2v_latch_iy_lo.db;
801
   release dut.reg_file_.b2v_latch_iy_hi.db;
802
   // Preset sp
803
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
804
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
805
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
806
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
807
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
808
   release dut.reg_file_.b2v_latch_sp_hi.we;
809
   release dut.reg_file_.b2v_latch_sp_lo.db;
810
   release dut.reg_file_.b2v_latch_sp_hi.db;
811
   // Preset wz
812
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
813
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
814
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
815
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
816
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
817
   release dut.reg_file_.b2v_latch_wz_hi.we;
818
   release dut.reg_file_.b2v_latch_wz_lo.db;
819
   release dut.reg_file_.b2v_latch_wz_hi.db;
820
   // Preset pc
821
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
822
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
823
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
824
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
825
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
826
   release dut.reg_file_.b2v_latch_pc_hi.we;
827
   release dut.reg_file_.b2v_latch_pc_lo.db;
828
   release dut.reg_file_.b2v_latch_pc_hi.db;
829
   // Preset ir
830
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
831
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
832
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
833
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
834
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
835
   release dut.reg_file_.b2v_latch_ir_hi.we;
836
   release dut.reg_file_.b2v_latch_ir_lo.db;
837
   release dut.reg_file_.b2v_latch_ir_hi.db;
838
   // Preset memory
839
   ram.Mem[0] = 8'hcb;
840
   ram.Mem[1] = 8'h41;
841
   // Preset memory
842
   ram.Mem[31721] = 8'hf7;
843
   force dut.z80_top_ifc_n.fpga_reset=0;
844 8 gdevic
   force dut.address_latch_.Q=16'h0000;
845 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
846
   release dut.reg_file_.reg_gp_we;
847
#3
848 8 gdevic
   release dut.address_latch_.Q;
849 6 gdevic
#1
850
#14 // Execute
851
   force dut.reg_control_.ctl_reg_sys_we=0;
852
#2 pc=z.A;
853
#2
854
#1 force dut.reg_file_.reg_gp_we=0;
855
   force dut.z80_top_ifc_n.fpga_reset=1;
856
   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);
857
   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);
858
   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);
859
   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);
860
   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);
861
   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);
862
   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);
863
   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);
864
   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);
865
   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);
866
   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);
867
   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);
868
   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);
869
   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);
870
   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);
871
   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);
872
   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);
873
   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);
874
   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);
875
   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);
876
   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);
877
   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);
878
   if (pc!==16'h0002) $fdisplay(f,"* PC=%h !=0002",pc);
879
   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);
880
   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);
881
//--------------------------------------------------------------------------------
882 8 gdevic
   force dut.ir_.ctl_ir_we=1;
883
   force dut.ir_.db=0;
884
#2 release dut.ir_.ctl_ir_we;
885
   release dut.ir_.db;
886 6 gdevic
$fdisplay(f,"Testing opcode cb93    RES 2,E");
887
   // Preset af
888
   force dut.reg_file_.b2v_latch_af_lo.we=1;
889
   force dut.reg_file_.b2v_latch_af_hi.we=1;
890
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
891
   force dut.reg_file_.b2v_latch_af_hi.db=8'hc2;
892
#2 release dut.reg_file_.b2v_latch_af_lo.we;
893
   release dut.reg_file_.b2v_latch_af_hi.we;
894
   release dut.reg_file_.b2v_latch_af_lo.db;
895
   release dut.reg_file_.b2v_latch_af_hi.db;
896
   // Preset bc
897
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
898
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
899
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h05;
900
   force dut.reg_file_.b2v_latch_bc_hi.db=8'h4e;
901
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
902
   release dut.reg_file_.b2v_latch_bc_hi.we;
903
   release dut.reg_file_.b2v_latch_bc_lo.db;
904
   release dut.reg_file_.b2v_latch_bc_hi.db;
905
   // Preset de
906
   force dut.reg_file_.b2v_latch_de_lo.we=1;
907
   force dut.reg_file_.b2v_latch_de_hi.we=1;
908
   force dut.reg_file_.b2v_latch_de_lo.db=8'hf8;
909
   force dut.reg_file_.b2v_latch_de_hi.db=8'hb3;
910
#2 release dut.reg_file_.b2v_latch_de_lo.we;
911
   release dut.reg_file_.b2v_latch_de_hi.we;
912
   release dut.reg_file_.b2v_latch_de_lo.db;
913
   release dut.reg_file_.b2v_latch_de_hi.db;
914
   // Preset hl
915
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
916
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
917
   force dut.reg_file_.b2v_latch_hl_lo.db=8'h34;
918
   force dut.reg_file_.b2v_latch_hl_hi.db=8'h22;
919
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
920
   release dut.reg_file_.b2v_latch_hl_hi.we;
921
   release dut.reg_file_.b2v_latch_hl_lo.db;
922
   release dut.reg_file_.b2v_latch_hl_hi.db;
923
   // Preset af2
924
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
925
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
926
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
927
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
928
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
929
   release dut.reg_file_.b2v_latch_af2_hi.we;
930
   release dut.reg_file_.b2v_latch_af2_lo.db;
931
   release dut.reg_file_.b2v_latch_af2_hi.db;
932
   // Preset bc2
933
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
934
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
935
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
936
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
937
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
938
   release dut.reg_file_.b2v_latch_bc2_hi.we;
939
   release dut.reg_file_.b2v_latch_bc2_lo.db;
940
   release dut.reg_file_.b2v_latch_bc2_hi.db;
941
   // Preset de2
942
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
943
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
944
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
945
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
946
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
947
   release dut.reg_file_.b2v_latch_de2_hi.we;
948
   release dut.reg_file_.b2v_latch_de2_lo.db;
949
   release dut.reg_file_.b2v_latch_de2_hi.db;
950
   // Preset hl2
951
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
952
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
953
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
954
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
955
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
956
   release dut.reg_file_.b2v_latch_hl2_hi.we;
957
   release dut.reg_file_.b2v_latch_hl2_lo.db;
958
   release dut.reg_file_.b2v_latch_hl2_hi.db;
959
   // Preset ix
960
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
961
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
962
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
963
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
964
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
965
   release dut.reg_file_.b2v_latch_ix_hi.we;
966
   release dut.reg_file_.b2v_latch_ix_lo.db;
967
   release dut.reg_file_.b2v_latch_ix_hi.db;
968
   // Preset iy
969
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
970
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
971
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
972
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
973
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
974
   release dut.reg_file_.b2v_latch_iy_hi.we;
975
   release dut.reg_file_.b2v_latch_iy_lo.db;
976
   release dut.reg_file_.b2v_latch_iy_hi.db;
977
   // Preset sp
978
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
979
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
980
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
981
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
982
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
983
   release dut.reg_file_.b2v_latch_sp_hi.we;
984
   release dut.reg_file_.b2v_latch_sp_lo.db;
985
   release dut.reg_file_.b2v_latch_sp_hi.db;
986
   // Preset wz
987
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
988
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
989
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
990
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
991
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
992
   release dut.reg_file_.b2v_latch_wz_hi.we;
993
   release dut.reg_file_.b2v_latch_wz_lo.db;
994
   release dut.reg_file_.b2v_latch_wz_hi.db;
995
   // Preset pc
996
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
997
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
998
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
999
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
1000
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
1001
   release dut.reg_file_.b2v_latch_pc_hi.we;
1002
   release dut.reg_file_.b2v_latch_pc_lo.db;
1003
   release dut.reg_file_.b2v_latch_pc_hi.db;
1004
   // Preset ir
1005
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
1006
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
1007
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
1008
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
1009
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
1010
   release dut.reg_file_.b2v_latch_ir_hi.we;
1011
   release dut.reg_file_.b2v_latch_ir_lo.db;
1012
   release dut.reg_file_.b2v_latch_ir_hi.db;
1013
   // Preset memory
1014
   ram.Mem[0] = 8'hcb;
1015
   ram.Mem[1] = 8'h93;
1016
   // Preset memory
1017
   ram.Mem[8756] = 8'ha0;
1018
   force dut.z80_top_ifc_n.fpga_reset=0;
1019 8 gdevic
   force dut.address_latch_.Q=16'h0000;
1020 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
1021
   release dut.reg_file_.reg_gp_we;
1022
#3
1023 8 gdevic
   release dut.address_latch_.Q;
1024 6 gdevic
#1
1025
#14 // Execute
1026
   force dut.reg_control_.ctl_reg_sys_we=0;
1027
#2 pc=z.A;
1028
#2
1029
#1 force dut.reg_file_.reg_gp_we=0;
1030
   force dut.z80_top_ifc_n.fpga_reset=1;
1031
   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);
1032
   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);
1033
   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);
1034
   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);
1035
   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);
1036
   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);
1037
   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);
1038
   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);
1039
   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);
1040
   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);
1041
   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);
1042
   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);
1043
   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);
1044
   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);
1045
   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);
1046
   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);
1047
   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);
1048
   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);
1049
   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);
1050
   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);
1051
   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);
1052
   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);
1053
   if (pc!==16'h0002) $fdisplay(f,"* PC=%h !=0002",pc);
1054
   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);
1055
   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);
1056
//--------------------------------------------------------------------------------
1057 8 gdevic
   force dut.ir_.ctl_ir_we=1;
1058
   force dut.ir_.db=0;
1059
#2 release dut.ir_.ctl_ir_we;
1060
   release dut.ir_.db;
1061 6 gdevic
$fdisplay(f,"Testing opcode cbe5    SET 4,L");
1062
   // Preset af
1063
   force dut.reg_file_.b2v_latch_af_lo.we=1;
1064
   force dut.reg_file_.b2v_latch_af_hi.we=1;
1065
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
1066
   force dut.reg_file_.b2v_latch_af_hi.db=8'hca;
1067
#2 release dut.reg_file_.b2v_latch_af_lo.we;
1068
   release dut.reg_file_.b2v_latch_af_hi.we;
1069
   release dut.reg_file_.b2v_latch_af_lo.db;
1070
   release dut.reg_file_.b2v_latch_af_hi.db;
1071
   // Preset bc
1072
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
1073
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
1074
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h0d;
1075
   force dut.reg_file_.b2v_latch_bc_hi.db=8'hdf;
1076
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
1077
   release dut.reg_file_.b2v_latch_bc_hi.we;
1078
   release dut.reg_file_.b2v_latch_bc_lo.db;
1079
   release dut.reg_file_.b2v_latch_bc_hi.db;
1080
   // Preset de
1081
   force dut.reg_file_.b2v_latch_de_lo.we=1;
1082
   force dut.reg_file_.b2v_latch_de_hi.we=1;
1083
   force dut.reg_file_.b2v_latch_de_lo.db=8'h88;
1084
   force dut.reg_file_.b2v_latch_de_hi.db=8'hd5;
1085
#2 release dut.reg_file_.b2v_latch_de_lo.we;
1086
   release dut.reg_file_.b2v_latch_de_hi.we;
1087
   release dut.reg_file_.b2v_latch_de_lo.db;
1088
   release dut.reg_file_.b2v_latch_de_hi.db;
1089
   // Preset hl
1090
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
1091
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
1092
   force dut.reg_file_.b2v_latch_hl_lo.db=8'h8f;
1093
   force dut.reg_file_.b2v_latch_hl_hi.db=8'hb4;
1094
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
1095
   release dut.reg_file_.b2v_latch_hl_hi.we;
1096
   release dut.reg_file_.b2v_latch_hl_lo.db;
1097
   release dut.reg_file_.b2v_latch_hl_hi.db;
1098
   // Preset af2
1099
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
1100
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
1101
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
1102
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
1103
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
1104
   release dut.reg_file_.b2v_latch_af2_hi.we;
1105
   release dut.reg_file_.b2v_latch_af2_lo.db;
1106
   release dut.reg_file_.b2v_latch_af2_hi.db;
1107
   // Preset bc2
1108
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
1109
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
1110
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
1111
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
1112
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
1113
   release dut.reg_file_.b2v_latch_bc2_hi.we;
1114
   release dut.reg_file_.b2v_latch_bc2_lo.db;
1115
   release dut.reg_file_.b2v_latch_bc2_hi.db;
1116
   // Preset de2
1117
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
1118
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
1119
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
1120
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
1121
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
1122
   release dut.reg_file_.b2v_latch_de2_hi.we;
1123
   release dut.reg_file_.b2v_latch_de2_lo.db;
1124
   release dut.reg_file_.b2v_latch_de2_hi.db;
1125
   // Preset hl2
1126
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
1127
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
1128
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
1129
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
1130
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
1131
   release dut.reg_file_.b2v_latch_hl2_hi.we;
1132
   release dut.reg_file_.b2v_latch_hl2_lo.db;
1133
   release dut.reg_file_.b2v_latch_hl2_hi.db;
1134
   // Preset ix
1135
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
1136
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
1137
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
1138
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
1139
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
1140
   release dut.reg_file_.b2v_latch_ix_hi.we;
1141
   release dut.reg_file_.b2v_latch_ix_lo.db;
1142
   release dut.reg_file_.b2v_latch_ix_hi.db;
1143
   // Preset iy
1144
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
1145
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
1146
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
1147
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
1148
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
1149
   release dut.reg_file_.b2v_latch_iy_hi.we;
1150
   release dut.reg_file_.b2v_latch_iy_lo.db;
1151
   release dut.reg_file_.b2v_latch_iy_hi.db;
1152
   // Preset sp
1153
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
1154
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
1155
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
1156
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
1157
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
1158
   release dut.reg_file_.b2v_latch_sp_hi.we;
1159
   release dut.reg_file_.b2v_latch_sp_lo.db;
1160
   release dut.reg_file_.b2v_latch_sp_hi.db;
1161
   // Preset wz
1162
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
1163
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
1164
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
1165
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
1166
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
1167
   release dut.reg_file_.b2v_latch_wz_hi.we;
1168
   release dut.reg_file_.b2v_latch_wz_lo.db;
1169
   release dut.reg_file_.b2v_latch_wz_hi.db;
1170
   // Preset pc
1171
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
1172
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
1173
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
1174
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
1175
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
1176
   release dut.reg_file_.b2v_latch_pc_hi.we;
1177
   release dut.reg_file_.b2v_latch_pc_lo.db;
1178
   release dut.reg_file_.b2v_latch_pc_hi.db;
1179
   // Preset ir
1180
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
1181
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
1182
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
1183
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
1184
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
1185
   release dut.reg_file_.b2v_latch_ir_hi.we;
1186
   release dut.reg_file_.b2v_latch_ir_lo.db;
1187
   release dut.reg_file_.b2v_latch_ir_hi.db;
1188
   // Preset memory
1189
   ram.Mem[0] = 8'hcb;
1190
   ram.Mem[1] = 8'he5;
1191
   // Preset memory
1192
   ram.Mem[46223] = 8'hcf;
1193
   force dut.z80_top_ifc_n.fpga_reset=0;
1194 8 gdevic
   force dut.address_latch_.Q=16'h0000;
1195 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
1196
   release dut.reg_file_.reg_gp_we;
1197
#3
1198 8 gdevic
   release dut.address_latch_.Q;
1199 6 gdevic
#1
1200
#14 // Execute
1201
   force dut.reg_control_.ctl_reg_sys_we=0;
1202
#2 pc=z.A;
1203
#2
1204
#1 force dut.reg_file_.reg_gp_we=0;
1205
   force dut.z80_top_ifc_n.fpga_reset=1;
1206
   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);
1207
   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);
1208
   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);
1209
   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);
1210
   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);
1211
   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);
1212
   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);
1213
   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);
1214
   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);
1215
   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);
1216
   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);
1217
   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);
1218
   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);
1219
   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);
1220
   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);
1221
   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);
1222
   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);
1223
   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);
1224
   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);
1225
   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);
1226
   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);
1227
   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);
1228
   if (pc!==16'h0002) $fdisplay(f,"* PC=%h !=0002",pc);
1229
   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);
1230
   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);
1231
//--------------------------------------------------------------------------------
1232 8 gdevic
   force dut.ir_.ctl_ir_we=1;
1233
   force dut.ir_.db=0;
1234
#2 release dut.ir_.ctl_ir_we;
1235
   release dut.ir_.db;
1236 6 gdevic
$fdisplay(f,"Testing opcode 8c      ADC A,H");
1237
   // Preset af
1238
   force dut.reg_file_.b2v_latch_af_lo.we=1;
1239
   force dut.reg_file_.b2v_latch_af_hi.we=1;
1240
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
1241
   force dut.reg_file_.b2v_latch_af_hi.db=8'hf5;
1242
#2 release dut.reg_file_.b2v_latch_af_lo.we;
1243
   release dut.reg_file_.b2v_latch_af_hi.we;
1244
   release dut.reg_file_.b2v_latch_af_lo.db;
1245
   release dut.reg_file_.b2v_latch_af_hi.db;
1246
   // Preset bc
1247
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
1248
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
1249
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h3b;
1250
   force dut.reg_file_.b2v_latch_bc_hi.db=8'h0f;
1251
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
1252
   release dut.reg_file_.b2v_latch_bc_hi.we;
1253
   release dut.reg_file_.b2v_latch_bc_lo.db;
1254
   release dut.reg_file_.b2v_latch_bc_hi.db;
1255
   // Preset de
1256
   force dut.reg_file_.b2v_latch_de_lo.we=1;
1257
   force dut.reg_file_.b2v_latch_de_hi.we=1;
1258
   force dut.reg_file_.b2v_latch_de_lo.db=8'h0d;
1259
   force dut.reg_file_.b2v_latch_de_hi.db=8'h20;
1260
#2 release dut.reg_file_.b2v_latch_de_lo.we;
1261
   release dut.reg_file_.b2v_latch_de_hi.we;
1262
   release dut.reg_file_.b2v_latch_de_lo.db;
1263
   release dut.reg_file_.b2v_latch_de_hi.db;
1264
   // Preset hl
1265
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
1266
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
1267
   force dut.reg_file_.b2v_latch_hl_lo.db=8'ha6;
1268
   force dut.reg_file_.b2v_latch_hl_hi.db=8'hdc;
1269
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
1270
   release dut.reg_file_.b2v_latch_hl_hi.we;
1271
   release dut.reg_file_.b2v_latch_hl_lo.db;
1272
   release dut.reg_file_.b2v_latch_hl_hi.db;
1273
   // Preset af2
1274
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
1275
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
1276
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
1277
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
1278
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
1279
   release dut.reg_file_.b2v_latch_af2_hi.we;
1280
   release dut.reg_file_.b2v_latch_af2_lo.db;
1281
   release dut.reg_file_.b2v_latch_af2_hi.db;
1282
   // Preset bc2
1283
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
1284
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
1285
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
1286
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
1287
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
1288
   release dut.reg_file_.b2v_latch_bc2_hi.we;
1289
   release dut.reg_file_.b2v_latch_bc2_lo.db;
1290
   release dut.reg_file_.b2v_latch_bc2_hi.db;
1291
   // Preset de2
1292
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
1293
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
1294
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
1295
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
1296
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
1297
   release dut.reg_file_.b2v_latch_de2_hi.we;
1298
   release dut.reg_file_.b2v_latch_de2_lo.db;
1299
   release dut.reg_file_.b2v_latch_de2_hi.db;
1300
   // Preset hl2
1301
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
1302
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
1303
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
1304
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
1305
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
1306
   release dut.reg_file_.b2v_latch_hl2_hi.we;
1307
   release dut.reg_file_.b2v_latch_hl2_lo.db;
1308
   release dut.reg_file_.b2v_latch_hl2_hi.db;
1309
   // Preset ix
1310
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
1311
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
1312
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
1313
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
1314
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
1315
   release dut.reg_file_.b2v_latch_ix_hi.we;
1316
   release dut.reg_file_.b2v_latch_ix_lo.db;
1317
   release dut.reg_file_.b2v_latch_ix_hi.db;
1318
   // Preset iy
1319
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
1320
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
1321
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
1322
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
1323
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
1324
   release dut.reg_file_.b2v_latch_iy_hi.we;
1325
   release dut.reg_file_.b2v_latch_iy_lo.db;
1326
   release dut.reg_file_.b2v_latch_iy_hi.db;
1327
   // Preset sp
1328
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
1329
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
1330
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
1331
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
1332
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
1333
   release dut.reg_file_.b2v_latch_sp_hi.we;
1334
   release dut.reg_file_.b2v_latch_sp_lo.db;
1335
   release dut.reg_file_.b2v_latch_sp_hi.db;
1336
   // Preset wz
1337
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
1338
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
1339
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
1340
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
1341
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
1342
   release dut.reg_file_.b2v_latch_wz_hi.we;
1343
   release dut.reg_file_.b2v_latch_wz_lo.db;
1344
   release dut.reg_file_.b2v_latch_wz_hi.db;
1345
   // Preset pc
1346
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
1347
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
1348
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
1349
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
1350
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
1351
   release dut.reg_file_.b2v_latch_pc_hi.we;
1352
   release dut.reg_file_.b2v_latch_pc_lo.db;
1353
   release dut.reg_file_.b2v_latch_pc_hi.db;
1354
   // Preset ir
1355
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
1356
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
1357
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
1358
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
1359
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
1360
   release dut.reg_file_.b2v_latch_ir_hi.we;
1361
   release dut.reg_file_.b2v_latch_ir_lo.db;
1362
   release dut.reg_file_.b2v_latch_ir_hi.db;
1363
   // Preset memory
1364
   ram.Mem[0] = 8'h8c;
1365
   // Preset memory
1366
   ram.Mem[56486] = 8'h49;
1367
   force dut.z80_top_ifc_n.fpga_reset=0;
1368 8 gdevic
   force dut.address_latch_.Q=16'h0000;
1369 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
1370
   release dut.reg_file_.reg_gp_we;
1371
#3
1372 8 gdevic
   release dut.address_latch_.Q;
1373 6 gdevic
#1
1374
#6 // Execute
1375
   force dut.reg_control_.ctl_reg_sys_we=0;
1376
#2 pc=z.A;
1377
#2
1378
#1 force dut.reg_file_.reg_gp_we=0;
1379
   force dut.z80_top_ifc_n.fpga_reset=1;
1380
   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);
1381
   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);
1382
   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);
1383
   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);
1384
   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);
1385
   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);
1386
   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);
1387
   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);
1388
   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);
1389
   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);
1390
   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);
1391
   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);
1392
   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);
1393
   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);
1394
   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);
1395
   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);
1396
   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);
1397
   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);
1398
   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);
1399
   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);
1400
   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);
1401
   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);
1402
   if (pc!==16'h0001) $fdisplay(f,"* PC=%h !=0001",pc);
1403
   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);
1404
   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);
1405
//--------------------------------------------------------------------------------
1406 8 gdevic
   force dut.ir_.ctl_ir_we=1;
1407
   force dut.ir_.db=0;
1408
#2 release dut.ir_.ctl_ir_we;
1409
   release dut.ir_.db;
1410 6 gdevic
$fdisplay(f,"Testing opcode 92      SUB D");
1411
   // Preset af
1412
   force dut.reg_file_.b2v_latch_af_lo.we=1;
1413
   force dut.reg_file_.b2v_latch_af_hi.we=1;
1414
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
1415
   force dut.reg_file_.b2v_latch_af_hi.db=8'hf5;
1416
#2 release dut.reg_file_.b2v_latch_af_lo.we;
1417
   release dut.reg_file_.b2v_latch_af_hi.we;
1418
   release dut.reg_file_.b2v_latch_af_lo.db;
1419
   release dut.reg_file_.b2v_latch_af_hi.db;
1420
   // Preset bc
1421
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
1422
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
1423
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h3b;
1424
   force dut.reg_file_.b2v_latch_bc_hi.db=8'h0f;
1425
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
1426
   release dut.reg_file_.b2v_latch_bc_hi.we;
1427
   release dut.reg_file_.b2v_latch_bc_lo.db;
1428
   release dut.reg_file_.b2v_latch_bc_hi.db;
1429
   // Preset de
1430
   force dut.reg_file_.b2v_latch_de_lo.we=1;
1431
   force dut.reg_file_.b2v_latch_de_hi.we=1;
1432
   force dut.reg_file_.b2v_latch_de_lo.db=8'h0d;
1433
   force dut.reg_file_.b2v_latch_de_hi.db=8'h20;
1434
#2 release dut.reg_file_.b2v_latch_de_lo.we;
1435
   release dut.reg_file_.b2v_latch_de_hi.we;
1436
   release dut.reg_file_.b2v_latch_de_lo.db;
1437
   release dut.reg_file_.b2v_latch_de_hi.db;
1438
   // Preset hl
1439
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
1440
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
1441
   force dut.reg_file_.b2v_latch_hl_lo.db=8'ha6;
1442
   force dut.reg_file_.b2v_latch_hl_hi.db=8'hdc;
1443
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
1444
   release dut.reg_file_.b2v_latch_hl_hi.we;
1445
   release dut.reg_file_.b2v_latch_hl_lo.db;
1446
   release dut.reg_file_.b2v_latch_hl_hi.db;
1447
   // Preset af2
1448
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
1449
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
1450
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
1451
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
1452
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
1453
   release dut.reg_file_.b2v_latch_af2_hi.we;
1454
   release dut.reg_file_.b2v_latch_af2_lo.db;
1455
   release dut.reg_file_.b2v_latch_af2_hi.db;
1456
   // Preset bc2
1457
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
1458
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
1459
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
1460
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
1461
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
1462
   release dut.reg_file_.b2v_latch_bc2_hi.we;
1463
   release dut.reg_file_.b2v_latch_bc2_lo.db;
1464
   release dut.reg_file_.b2v_latch_bc2_hi.db;
1465
   // Preset de2
1466
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
1467
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
1468
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
1469
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
1470
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
1471
   release dut.reg_file_.b2v_latch_de2_hi.we;
1472
   release dut.reg_file_.b2v_latch_de2_lo.db;
1473
   release dut.reg_file_.b2v_latch_de2_hi.db;
1474
   // Preset hl2
1475
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
1476
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
1477
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
1478
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
1479
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
1480
   release dut.reg_file_.b2v_latch_hl2_hi.we;
1481
   release dut.reg_file_.b2v_latch_hl2_lo.db;
1482
   release dut.reg_file_.b2v_latch_hl2_hi.db;
1483
   // Preset ix
1484
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
1485
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
1486
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
1487
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
1488
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
1489
   release dut.reg_file_.b2v_latch_ix_hi.we;
1490
   release dut.reg_file_.b2v_latch_ix_lo.db;
1491
   release dut.reg_file_.b2v_latch_ix_hi.db;
1492
   // Preset iy
1493
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
1494
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
1495
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
1496
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
1497
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
1498
   release dut.reg_file_.b2v_latch_iy_hi.we;
1499
   release dut.reg_file_.b2v_latch_iy_lo.db;
1500
   release dut.reg_file_.b2v_latch_iy_hi.db;
1501
   // Preset sp
1502
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
1503
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
1504
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
1505
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
1506
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
1507
   release dut.reg_file_.b2v_latch_sp_hi.we;
1508
   release dut.reg_file_.b2v_latch_sp_lo.db;
1509
   release dut.reg_file_.b2v_latch_sp_hi.db;
1510
   // Preset wz
1511
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
1512
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
1513
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
1514
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
1515
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
1516
   release dut.reg_file_.b2v_latch_wz_hi.we;
1517
   release dut.reg_file_.b2v_latch_wz_lo.db;
1518
   release dut.reg_file_.b2v_latch_wz_hi.db;
1519
   // Preset pc
1520
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
1521
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
1522
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
1523
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
1524
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
1525
   release dut.reg_file_.b2v_latch_pc_hi.we;
1526
   release dut.reg_file_.b2v_latch_pc_lo.db;
1527
   release dut.reg_file_.b2v_latch_pc_hi.db;
1528
   // Preset ir
1529
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
1530
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
1531
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
1532
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
1533
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
1534
   release dut.reg_file_.b2v_latch_ir_hi.we;
1535
   release dut.reg_file_.b2v_latch_ir_lo.db;
1536
   release dut.reg_file_.b2v_latch_ir_hi.db;
1537
   // Preset memory
1538
   ram.Mem[0] = 8'h92;
1539
   // Preset memory
1540
   ram.Mem[56486] = 8'h49;
1541
   force dut.z80_top_ifc_n.fpga_reset=0;
1542 8 gdevic
   force dut.address_latch_.Q=16'h0000;
1543 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
1544
   release dut.reg_file_.reg_gp_we;
1545
#3
1546 8 gdevic
   release dut.address_latch_.Q;
1547 6 gdevic
#1
1548
#6 // Execute
1549
   force dut.reg_control_.ctl_reg_sys_we=0;
1550
#2 pc=z.A;
1551
#2
1552
#1 force dut.reg_file_.reg_gp_we=0;
1553
   force dut.z80_top_ifc_n.fpga_reset=1;
1554
   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);
1555
   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);
1556
   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);
1557
   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);
1558
   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);
1559
   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);
1560
   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);
1561
   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);
1562
   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);
1563
   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);
1564
   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);
1565
   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);
1566
   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);
1567
   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);
1568
   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);
1569
   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);
1570
   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);
1571
   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);
1572
   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);
1573
   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);
1574
   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);
1575
   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);
1576
   if (pc!==16'h0001) $fdisplay(f,"* PC=%h !=0001",pc);
1577
   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);
1578
   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);
1579
//--------------------------------------------------------------------------------
1580 8 gdevic
   force dut.ir_.ctl_ir_we=1;
1581
   force dut.ir_.db=0;
1582
#2 release dut.ir_.ctl_ir_we;
1583
   release dut.ir_.db;
1584 6 gdevic
$fdisplay(f,"Testing opcode 9d      SBC A,L");
1585
   // Preset af
1586
   force dut.reg_file_.b2v_latch_af_lo.we=1;
1587
   force dut.reg_file_.b2v_latch_af_hi.we=1;
1588
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
1589
   force dut.reg_file_.b2v_latch_af_hi.db=8'hf5;
1590
#2 release dut.reg_file_.b2v_latch_af_lo.we;
1591
   release dut.reg_file_.b2v_latch_af_hi.we;
1592
   release dut.reg_file_.b2v_latch_af_lo.db;
1593
   release dut.reg_file_.b2v_latch_af_hi.db;
1594
   // Preset bc
1595
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
1596
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
1597
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h3b;
1598
   force dut.reg_file_.b2v_latch_bc_hi.db=8'h0f;
1599
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
1600
   release dut.reg_file_.b2v_latch_bc_hi.we;
1601
   release dut.reg_file_.b2v_latch_bc_lo.db;
1602
   release dut.reg_file_.b2v_latch_bc_hi.db;
1603
   // Preset de
1604
   force dut.reg_file_.b2v_latch_de_lo.we=1;
1605
   force dut.reg_file_.b2v_latch_de_hi.we=1;
1606
   force dut.reg_file_.b2v_latch_de_lo.db=8'h0d;
1607
   force dut.reg_file_.b2v_latch_de_hi.db=8'h20;
1608
#2 release dut.reg_file_.b2v_latch_de_lo.we;
1609
   release dut.reg_file_.b2v_latch_de_hi.we;
1610
   release dut.reg_file_.b2v_latch_de_lo.db;
1611
   release dut.reg_file_.b2v_latch_de_hi.db;
1612
   // Preset hl
1613
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
1614
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
1615
   force dut.reg_file_.b2v_latch_hl_lo.db=8'ha6;
1616
   force dut.reg_file_.b2v_latch_hl_hi.db=8'hdc;
1617
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
1618
   release dut.reg_file_.b2v_latch_hl_hi.we;
1619
   release dut.reg_file_.b2v_latch_hl_lo.db;
1620
   release dut.reg_file_.b2v_latch_hl_hi.db;
1621
   // Preset af2
1622
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
1623
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
1624
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
1625
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
1626
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
1627
   release dut.reg_file_.b2v_latch_af2_hi.we;
1628
   release dut.reg_file_.b2v_latch_af2_lo.db;
1629
   release dut.reg_file_.b2v_latch_af2_hi.db;
1630
   // Preset bc2
1631
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
1632
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
1633
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
1634
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
1635
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
1636
   release dut.reg_file_.b2v_latch_bc2_hi.we;
1637
   release dut.reg_file_.b2v_latch_bc2_lo.db;
1638
   release dut.reg_file_.b2v_latch_bc2_hi.db;
1639
   // Preset de2
1640
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
1641
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
1642
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
1643
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
1644
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
1645
   release dut.reg_file_.b2v_latch_de2_hi.we;
1646
   release dut.reg_file_.b2v_latch_de2_lo.db;
1647
   release dut.reg_file_.b2v_latch_de2_hi.db;
1648
   // Preset hl2
1649
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
1650
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
1651
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
1652
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
1653
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
1654
   release dut.reg_file_.b2v_latch_hl2_hi.we;
1655
   release dut.reg_file_.b2v_latch_hl2_lo.db;
1656
   release dut.reg_file_.b2v_latch_hl2_hi.db;
1657
   // Preset ix
1658
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
1659
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
1660
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
1661
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
1662
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
1663
   release dut.reg_file_.b2v_latch_ix_hi.we;
1664
   release dut.reg_file_.b2v_latch_ix_lo.db;
1665
   release dut.reg_file_.b2v_latch_ix_hi.db;
1666
   // Preset iy
1667
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
1668
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
1669
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
1670
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
1671
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
1672
   release dut.reg_file_.b2v_latch_iy_hi.we;
1673
   release dut.reg_file_.b2v_latch_iy_lo.db;
1674
   release dut.reg_file_.b2v_latch_iy_hi.db;
1675
   // Preset sp
1676
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
1677
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
1678
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
1679
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
1680
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
1681
   release dut.reg_file_.b2v_latch_sp_hi.we;
1682
   release dut.reg_file_.b2v_latch_sp_lo.db;
1683
   release dut.reg_file_.b2v_latch_sp_hi.db;
1684
   // Preset wz
1685
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
1686
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
1687
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
1688
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
1689
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
1690
   release dut.reg_file_.b2v_latch_wz_hi.we;
1691
   release dut.reg_file_.b2v_latch_wz_lo.db;
1692
   release dut.reg_file_.b2v_latch_wz_hi.db;
1693
   // Preset pc
1694
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
1695
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
1696
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
1697
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
1698
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
1699
   release dut.reg_file_.b2v_latch_pc_hi.we;
1700
   release dut.reg_file_.b2v_latch_pc_lo.db;
1701
   release dut.reg_file_.b2v_latch_pc_hi.db;
1702
   // Preset ir
1703
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
1704
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
1705
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
1706
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
1707
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
1708
   release dut.reg_file_.b2v_latch_ir_hi.we;
1709
   release dut.reg_file_.b2v_latch_ir_lo.db;
1710
   release dut.reg_file_.b2v_latch_ir_hi.db;
1711
   // Preset memory
1712
   ram.Mem[0] = 8'h9d;
1713
   // Preset memory
1714
   ram.Mem[56486] = 8'h49;
1715
   force dut.z80_top_ifc_n.fpga_reset=0;
1716 8 gdevic
   force dut.address_latch_.Q=16'h0000;
1717 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
1718
   release dut.reg_file_.reg_gp_we;
1719
#3
1720 8 gdevic
   release dut.address_latch_.Q;
1721 6 gdevic
#1
1722
#6 // Execute
1723
   force dut.reg_control_.ctl_reg_sys_we=0;
1724
#2 pc=z.A;
1725
#2
1726
#1 force dut.reg_file_.reg_gp_we=0;
1727
   force dut.z80_top_ifc_n.fpga_reset=1;
1728
   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);
1729
   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);
1730
   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);
1731
   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);
1732
   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);
1733
   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);
1734
   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);
1735
   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);
1736
   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);
1737
   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);
1738
   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);
1739
   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);
1740
   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);
1741
   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);
1742
   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);
1743
   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);
1744
   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);
1745
   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);
1746
   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);
1747
   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);
1748
   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);
1749
   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);
1750
   if (pc!==16'h0001) $fdisplay(f,"* PC=%h !=0001",pc);
1751
   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);
1752
   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);
1753
//--------------------------------------------------------------------------------
1754 8 gdevic
   force dut.ir_.ctl_ir_we=1;
1755
   force dut.ir_.db=0;
1756
#2 release dut.ir_.ctl_ir_we;
1757
   release dut.ir_.db;
1758 6 gdevic
$fdisplay(f,"Testing opcode a3      AND E");
1759
   // Preset af
1760
   force dut.reg_file_.b2v_latch_af_lo.we=1;
1761
   force dut.reg_file_.b2v_latch_af_hi.we=1;
1762
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
1763
   force dut.reg_file_.b2v_latch_af_hi.db=8'hf5;
1764
#2 release dut.reg_file_.b2v_latch_af_lo.we;
1765
   release dut.reg_file_.b2v_latch_af_hi.we;
1766
   release dut.reg_file_.b2v_latch_af_lo.db;
1767
   release dut.reg_file_.b2v_latch_af_hi.db;
1768
   // Preset bc
1769
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
1770
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
1771
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h3b;
1772
   force dut.reg_file_.b2v_latch_bc_hi.db=8'h0f;
1773
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
1774
   release dut.reg_file_.b2v_latch_bc_hi.we;
1775
   release dut.reg_file_.b2v_latch_bc_lo.db;
1776
   release dut.reg_file_.b2v_latch_bc_hi.db;
1777
   // Preset de
1778
   force dut.reg_file_.b2v_latch_de_lo.we=1;
1779
   force dut.reg_file_.b2v_latch_de_hi.we=1;
1780
   force dut.reg_file_.b2v_latch_de_lo.db=8'h0d;
1781
   force dut.reg_file_.b2v_latch_de_hi.db=8'h20;
1782
#2 release dut.reg_file_.b2v_latch_de_lo.we;
1783
   release dut.reg_file_.b2v_latch_de_hi.we;
1784
   release dut.reg_file_.b2v_latch_de_lo.db;
1785
   release dut.reg_file_.b2v_latch_de_hi.db;
1786
   // Preset hl
1787
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
1788
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
1789
   force dut.reg_file_.b2v_latch_hl_lo.db=8'ha6;
1790
   force dut.reg_file_.b2v_latch_hl_hi.db=8'hdc;
1791
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
1792
   release dut.reg_file_.b2v_latch_hl_hi.we;
1793
   release dut.reg_file_.b2v_latch_hl_lo.db;
1794
   release dut.reg_file_.b2v_latch_hl_hi.db;
1795
   // Preset af2
1796
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
1797
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
1798
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
1799
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
1800
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
1801
   release dut.reg_file_.b2v_latch_af2_hi.we;
1802
   release dut.reg_file_.b2v_latch_af2_lo.db;
1803
   release dut.reg_file_.b2v_latch_af2_hi.db;
1804
   // Preset bc2
1805
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
1806
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
1807
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
1808
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
1809
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
1810
   release dut.reg_file_.b2v_latch_bc2_hi.we;
1811
   release dut.reg_file_.b2v_latch_bc2_lo.db;
1812
   release dut.reg_file_.b2v_latch_bc2_hi.db;
1813
   // Preset de2
1814
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
1815
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
1816
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
1817
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
1818
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
1819
   release dut.reg_file_.b2v_latch_de2_hi.we;
1820
   release dut.reg_file_.b2v_latch_de2_lo.db;
1821
   release dut.reg_file_.b2v_latch_de2_hi.db;
1822
   // Preset hl2
1823
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
1824
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
1825
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
1826
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
1827
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
1828
   release dut.reg_file_.b2v_latch_hl2_hi.we;
1829
   release dut.reg_file_.b2v_latch_hl2_lo.db;
1830
   release dut.reg_file_.b2v_latch_hl2_hi.db;
1831
   // Preset ix
1832
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
1833
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
1834
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
1835
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
1836
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
1837
   release dut.reg_file_.b2v_latch_ix_hi.we;
1838
   release dut.reg_file_.b2v_latch_ix_lo.db;
1839
   release dut.reg_file_.b2v_latch_ix_hi.db;
1840
   // Preset iy
1841
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
1842
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
1843
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
1844
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
1845
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
1846
   release dut.reg_file_.b2v_latch_iy_hi.we;
1847
   release dut.reg_file_.b2v_latch_iy_lo.db;
1848
   release dut.reg_file_.b2v_latch_iy_hi.db;
1849
   // Preset sp
1850
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
1851
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
1852
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
1853
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
1854
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
1855
   release dut.reg_file_.b2v_latch_sp_hi.we;
1856
   release dut.reg_file_.b2v_latch_sp_lo.db;
1857
   release dut.reg_file_.b2v_latch_sp_hi.db;
1858
   // Preset wz
1859
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
1860
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
1861
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
1862
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
1863
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
1864
   release dut.reg_file_.b2v_latch_wz_hi.we;
1865
   release dut.reg_file_.b2v_latch_wz_lo.db;
1866
   release dut.reg_file_.b2v_latch_wz_hi.db;
1867
   // Preset pc
1868
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
1869
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
1870
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
1871
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
1872
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
1873
   release dut.reg_file_.b2v_latch_pc_hi.we;
1874
   release dut.reg_file_.b2v_latch_pc_lo.db;
1875
   release dut.reg_file_.b2v_latch_pc_hi.db;
1876
   // Preset ir
1877
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
1878
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
1879
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
1880
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
1881
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
1882
   release dut.reg_file_.b2v_latch_ir_hi.we;
1883
   release dut.reg_file_.b2v_latch_ir_lo.db;
1884
   release dut.reg_file_.b2v_latch_ir_hi.db;
1885
   // Preset memory
1886
   ram.Mem[0] = 8'ha3;
1887
   // Preset memory
1888
   ram.Mem[56486] = 8'h49;
1889
   force dut.z80_top_ifc_n.fpga_reset=0;
1890 8 gdevic
   force dut.address_latch_.Q=16'h0000;
1891 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
1892
   release dut.reg_file_.reg_gp_we;
1893
#3
1894 8 gdevic
   release dut.address_latch_.Q;
1895 6 gdevic
#1
1896
#6 // Execute
1897
   force dut.reg_control_.ctl_reg_sys_we=0;
1898
#2 pc=z.A;
1899
#2
1900
#1 force dut.reg_file_.reg_gp_we=0;
1901
   force dut.z80_top_ifc_n.fpga_reset=1;
1902
   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);
1903
   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);
1904
   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);
1905
   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);
1906
   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);
1907
   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);
1908
   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);
1909
   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);
1910
   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);
1911
   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);
1912
   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);
1913
   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);
1914
   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);
1915
   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);
1916
   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);
1917
   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);
1918
   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);
1919
   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);
1920
   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);
1921
   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);
1922
   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);
1923
   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);
1924
   if (pc!==16'h0001) $fdisplay(f,"* PC=%h !=0001",pc);
1925
   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);
1926
   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);
1927
//--------------------------------------------------------------------------------
1928 8 gdevic
   force dut.ir_.ctl_ir_we=1;
1929
   force dut.ir_.db=0;
1930
#2 release dut.ir_.ctl_ir_we;
1931
   release dut.ir_.db;
1932 6 gdevic
$fdisplay(f,"Testing opcode ae      XOR (HL)");
1933
   // Preset af
1934
   force dut.reg_file_.b2v_latch_af_lo.we=1;
1935
   force dut.reg_file_.b2v_latch_af_hi.we=1;
1936
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
1937
   force dut.reg_file_.b2v_latch_af_hi.db=8'hf5;
1938
#2 release dut.reg_file_.b2v_latch_af_lo.we;
1939
   release dut.reg_file_.b2v_latch_af_hi.we;
1940
   release dut.reg_file_.b2v_latch_af_lo.db;
1941
   release dut.reg_file_.b2v_latch_af_hi.db;
1942
   // Preset bc
1943
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
1944
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
1945
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h3b;
1946
   force dut.reg_file_.b2v_latch_bc_hi.db=8'h0f;
1947
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
1948
   release dut.reg_file_.b2v_latch_bc_hi.we;
1949
   release dut.reg_file_.b2v_latch_bc_lo.db;
1950
   release dut.reg_file_.b2v_latch_bc_hi.db;
1951
   // Preset de
1952
   force dut.reg_file_.b2v_latch_de_lo.we=1;
1953
   force dut.reg_file_.b2v_latch_de_hi.we=1;
1954
   force dut.reg_file_.b2v_latch_de_lo.db=8'h0d;
1955
   force dut.reg_file_.b2v_latch_de_hi.db=8'h20;
1956
#2 release dut.reg_file_.b2v_latch_de_lo.we;
1957
   release dut.reg_file_.b2v_latch_de_hi.we;
1958
   release dut.reg_file_.b2v_latch_de_lo.db;
1959
   release dut.reg_file_.b2v_latch_de_hi.db;
1960
   // Preset hl
1961
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
1962
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
1963
   force dut.reg_file_.b2v_latch_hl_lo.db=8'ha6;
1964
   force dut.reg_file_.b2v_latch_hl_hi.db=8'hdc;
1965
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
1966
   release dut.reg_file_.b2v_latch_hl_hi.we;
1967
   release dut.reg_file_.b2v_latch_hl_lo.db;
1968
   release dut.reg_file_.b2v_latch_hl_hi.db;
1969
   // Preset af2
1970
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
1971
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
1972
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
1973
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
1974
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
1975
   release dut.reg_file_.b2v_latch_af2_hi.we;
1976
   release dut.reg_file_.b2v_latch_af2_lo.db;
1977
   release dut.reg_file_.b2v_latch_af2_hi.db;
1978
   // Preset bc2
1979
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
1980
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
1981
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
1982
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
1983
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
1984
   release dut.reg_file_.b2v_latch_bc2_hi.we;
1985
   release dut.reg_file_.b2v_latch_bc2_lo.db;
1986
   release dut.reg_file_.b2v_latch_bc2_hi.db;
1987
   // Preset de2
1988
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
1989
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
1990
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
1991
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
1992
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
1993
   release dut.reg_file_.b2v_latch_de2_hi.we;
1994
   release dut.reg_file_.b2v_latch_de2_lo.db;
1995
   release dut.reg_file_.b2v_latch_de2_hi.db;
1996
   // Preset hl2
1997
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
1998
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
1999
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
2000
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
2001
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
2002
   release dut.reg_file_.b2v_latch_hl2_hi.we;
2003
   release dut.reg_file_.b2v_latch_hl2_lo.db;
2004
   release dut.reg_file_.b2v_latch_hl2_hi.db;
2005
   // Preset ix
2006
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
2007
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
2008
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
2009
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
2010
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
2011
   release dut.reg_file_.b2v_latch_ix_hi.we;
2012
   release dut.reg_file_.b2v_latch_ix_lo.db;
2013
   release dut.reg_file_.b2v_latch_ix_hi.db;
2014
   // Preset iy
2015
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
2016
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
2017
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
2018
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
2019
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
2020
   release dut.reg_file_.b2v_latch_iy_hi.we;
2021
   release dut.reg_file_.b2v_latch_iy_lo.db;
2022
   release dut.reg_file_.b2v_latch_iy_hi.db;
2023
   // Preset sp
2024
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
2025
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
2026
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
2027
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
2028
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
2029
   release dut.reg_file_.b2v_latch_sp_hi.we;
2030
   release dut.reg_file_.b2v_latch_sp_lo.db;
2031
   release dut.reg_file_.b2v_latch_sp_hi.db;
2032
   // Preset wz
2033
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
2034
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
2035
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
2036
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
2037
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
2038
   release dut.reg_file_.b2v_latch_wz_hi.we;
2039
   release dut.reg_file_.b2v_latch_wz_lo.db;
2040
   release dut.reg_file_.b2v_latch_wz_hi.db;
2041
   // Preset pc
2042
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
2043
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
2044
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
2045
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
2046
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
2047
   release dut.reg_file_.b2v_latch_pc_hi.we;
2048
   release dut.reg_file_.b2v_latch_pc_lo.db;
2049
   release dut.reg_file_.b2v_latch_pc_hi.db;
2050
   // Preset ir
2051
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
2052
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
2053
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
2054
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
2055
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
2056
   release dut.reg_file_.b2v_latch_ir_hi.we;
2057
   release dut.reg_file_.b2v_latch_ir_lo.db;
2058
   release dut.reg_file_.b2v_latch_ir_hi.db;
2059
   // Preset memory
2060
   ram.Mem[0] = 8'hae;
2061
   // Preset memory
2062
   ram.Mem[56486] = 8'h49;
2063
   force dut.z80_top_ifc_n.fpga_reset=0;
2064 8 gdevic
   force dut.address_latch_.Q=16'h0000;
2065 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
2066
   release dut.reg_file_.reg_gp_we;
2067
#3
2068 8 gdevic
   release dut.address_latch_.Q;
2069 6 gdevic
#1
2070
#12 // Execute
2071
   force dut.reg_control_.ctl_reg_sys_we=0;
2072
#2 pc=z.A;
2073
#2
2074
#1 force dut.reg_file_.reg_gp_we=0;
2075
   force dut.z80_top_ifc_n.fpga_reset=1;
2076
   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);
2077
   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);
2078
   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);
2079
   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);
2080
   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);
2081
   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);
2082
   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);
2083
   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);
2084
   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);
2085
   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);
2086
   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);
2087
   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);
2088
   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);
2089
   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);
2090
   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);
2091
   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);
2092
   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);
2093
   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);
2094
   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);
2095
   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);
2096
   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);
2097
   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);
2098
   if (pc!==16'h0001) $fdisplay(f,"* PC=%h !=0001",pc);
2099
   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);
2100
   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);
2101
//--------------------------------------------------------------------------------
2102 8 gdevic
   force dut.ir_.ctl_ir_we=1;
2103
   force dut.ir_.db=0;
2104
#2 release dut.ir_.ctl_ir_we;
2105
   release dut.ir_.db;
2106 6 gdevic
$fdisplay(f,"Testing opcode b4      OR H");
2107
   // Preset af
2108
   force dut.reg_file_.b2v_latch_af_lo.we=1;
2109
   force dut.reg_file_.b2v_latch_af_hi.we=1;
2110
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
2111
   force dut.reg_file_.b2v_latch_af_hi.db=8'hf5;
2112
#2 release dut.reg_file_.b2v_latch_af_lo.we;
2113
   release dut.reg_file_.b2v_latch_af_hi.we;
2114
   release dut.reg_file_.b2v_latch_af_lo.db;
2115
   release dut.reg_file_.b2v_latch_af_hi.db;
2116
   // Preset bc
2117
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
2118
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
2119
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h3b;
2120
   force dut.reg_file_.b2v_latch_bc_hi.db=8'h0f;
2121
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
2122
   release dut.reg_file_.b2v_latch_bc_hi.we;
2123
   release dut.reg_file_.b2v_latch_bc_lo.db;
2124
   release dut.reg_file_.b2v_latch_bc_hi.db;
2125
   // Preset de
2126
   force dut.reg_file_.b2v_latch_de_lo.we=1;
2127
   force dut.reg_file_.b2v_latch_de_hi.we=1;
2128
   force dut.reg_file_.b2v_latch_de_lo.db=8'h0d;
2129
   force dut.reg_file_.b2v_latch_de_hi.db=8'h20;
2130
#2 release dut.reg_file_.b2v_latch_de_lo.we;
2131
   release dut.reg_file_.b2v_latch_de_hi.we;
2132
   release dut.reg_file_.b2v_latch_de_lo.db;
2133
   release dut.reg_file_.b2v_latch_de_hi.db;
2134
   // Preset hl
2135
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
2136
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
2137
   force dut.reg_file_.b2v_latch_hl_lo.db=8'ha6;
2138
   force dut.reg_file_.b2v_latch_hl_hi.db=8'hdc;
2139
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
2140
   release dut.reg_file_.b2v_latch_hl_hi.we;
2141
   release dut.reg_file_.b2v_latch_hl_lo.db;
2142
   release dut.reg_file_.b2v_latch_hl_hi.db;
2143
   // Preset af2
2144
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
2145
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
2146
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
2147
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
2148
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
2149
   release dut.reg_file_.b2v_latch_af2_hi.we;
2150
   release dut.reg_file_.b2v_latch_af2_lo.db;
2151
   release dut.reg_file_.b2v_latch_af2_hi.db;
2152
   // Preset bc2
2153
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
2154
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
2155
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
2156
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
2157
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
2158
   release dut.reg_file_.b2v_latch_bc2_hi.we;
2159
   release dut.reg_file_.b2v_latch_bc2_lo.db;
2160
   release dut.reg_file_.b2v_latch_bc2_hi.db;
2161
   // Preset de2
2162
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
2163
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
2164
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
2165
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
2166
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
2167
   release dut.reg_file_.b2v_latch_de2_hi.we;
2168
   release dut.reg_file_.b2v_latch_de2_lo.db;
2169
   release dut.reg_file_.b2v_latch_de2_hi.db;
2170
   // Preset hl2
2171
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
2172
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
2173
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
2174
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
2175
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
2176
   release dut.reg_file_.b2v_latch_hl2_hi.we;
2177
   release dut.reg_file_.b2v_latch_hl2_lo.db;
2178
   release dut.reg_file_.b2v_latch_hl2_hi.db;
2179
   // Preset ix
2180
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
2181
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
2182
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
2183
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
2184
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
2185
   release dut.reg_file_.b2v_latch_ix_hi.we;
2186
   release dut.reg_file_.b2v_latch_ix_lo.db;
2187
   release dut.reg_file_.b2v_latch_ix_hi.db;
2188
   // Preset iy
2189
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
2190
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
2191
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
2192
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
2193
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
2194
   release dut.reg_file_.b2v_latch_iy_hi.we;
2195
   release dut.reg_file_.b2v_latch_iy_lo.db;
2196
   release dut.reg_file_.b2v_latch_iy_hi.db;
2197
   // Preset sp
2198
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
2199
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
2200
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
2201
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
2202
#2 release dut.reg_file_.b2v_latch_sp_lo.we;
2203
   release dut.reg_file_.b2v_latch_sp_hi.we;
2204
   release dut.reg_file_.b2v_latch_sp_lo.db;
2205
   release dut.reg_file_.b2v_latch_sp_hi.db;
2206
   // Preset wz
2207
   force dut.reg_file_.b2v_latch_wz_lo.we=1;
2208
   force dut.reg_file_.b2v_latch_wz_hi.we=1;
2209
   force dut.reg_file_.b2v_latch_wz_lo.db=8'h00;
2210
   force dut.reg_file_.b2v_latch_wz_hi.db=8'h00;
2211
#2 release dut.reg_file_.b2v_latch_wz_lo.we;
2212
   release dut.reg_file_.b2v_latch_wz_hi.we;
2213
   release dut.reg_file_.b2v_latch_wz_lo.db;
2214
   release dut.reg_file_.b2v_latch_wz_hi.db;
2215
   // Preset pc
2216
   force dut.reg_file_.b2v_latch_pc_lo.we=1;
2217
   force dut.reg_file_.b2v_latch_pc_hi.we=1;
2218
   force dut.reg_file_.b2v_latch_pc_lo.db=8'h00;
2219
   force dut.reg_file_.b2v_latch_pc_hi.db=8'h00;
2220
#2 release dut.reg_file_.b2v_latch_pc_lo.we;
2221
   release dut.reg_file_.b2v_latch_pc_hi.we;
2222
   release dut.reg_file_.b2v_latch_pc_lo.db;
2223
   release dut.reg_file_.b2v_latch_pc_hi.db;
2224
   // Preset ir
2225
   force dut.reg_file_.b2v_latch_ir_lo.we=1;
2226
   force dut.reg_file_.b2v_latch_ir_hi.we=1;
2227
   force dut.reg_file_.b2v_latch_ir_lo.db=8'h00;
2228
   force dut.reg_file_.b2v_latch_ir_hi.db=8'h00;
2229
#2 release dut.reg_file_.b2v_latch_ir_lo.we;
2230
   release dut.reg_file_.b2v_latch_ir_hi.we;
2231
   release dut.reg_file_.b2v_latch_ir_lo.db;
2232
   release dut.reg_file_.b2v_latch_ir_hi.db;
2233
   // Preset memory
2234
   ram.Mem[0] = 8'hb4;
2235
   // Preset memory
2236
   ram.Mem[56486] = 8'h49;
2237
   force dut.z80_top_ifc_n.fpga_reset=0;
2238 8 gdevic
   force dut.address_latch_.Q=16'h0000;
2239 6 gdevic
   release dut.reg_control_.ctl_reg_sys_we;
2240
   release dut.reg_file_.reg_gp_we;
2241
#3
2242 8 gdevic
   release dut.address_latch_.Q;
2243 6 gdevic
#1
2244
#6 // Execute
2245
   force dut.reg_control_.ctl_reg_sys_we=0;
2246
#2 pc=z.A;
2247
#2
2248
#1 force dut.reg_file_.reg_gp_we=0;
2249
   force dut.z80_top_ifc_n.fpga_reset=1;
2250
   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);
2251
   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);
2252
   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);
2253
   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);
2254
   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);
2255
   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);
2256
   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);
2257
   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);
2258
   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);
2259
   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);
2260
   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);
2261
   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);
2262
   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);
2263
   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);
2264
   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);
2265
   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);
2266
   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);
2267
   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);
2268
   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);
2269
   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);
2270
   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);
2271
   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);
2272
   if (pc!==16'h0001) $fdisplay(f,"* PC=%h !=0001",pc);
2273
   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);
2274
   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);
2275
//--------------------------------------------------------------------------------
2276 8 gdevic
   force dut.ir_.ctl_ir_we=1;
2277
   force dut.ir_.db=0;
2278
#2 release dut.ir_.ctl_ir_we;
2279
   release dut.ir_.db;
2280 6 gdevic
$fdisplay(f,"Testing opcode bf      CP A");
2281
   // Preset af
2282
   force dut.reg_file_.b2v_latch_af_lo.we=1;
2283
   force dut.reg_file_.b2v_latch_af_hi.we=1;
2284
   force dut.reg_file_.b2v_latch_af_lo.db=8'h00;
2285
   force dut.reg_file_.b2v_latch_af_hi.db=8'hf5;
2286
#2 release dut.reg_file_.b2v_latch_af_lo.we;
2287
   release dut.reg_file_.b2v_latch_af_hi.we;
2288
   release dut.reg_file_.b2v_latch_af_lo.db;
2289
   release dut.reg_file_.b2v_latch_af_hi.db;
2290
   // Preset bc
2291
   force dut.reg_file_.b2v_latch_bc_lo.we=1;
2292
   force dut.reg_file_.b2v_latch_bc_hi.we=1;
2293
   force dut.reg_file_.b2v_latch_bc_lo.db=8'h3b;
2294
   force dut.reg_file_.b2v_latch_bc_hi.db=8'h0f;
2295
#2 release dut.reg_file_.b2v_latch_bc_lo.we;
2296
   release dut.reg_file_.b2v_latch_bc_hi.we;
2297
   release dut.reg_file_.b2v_latch_bc_lo.db;
2298
   release dut.reg_file_.b2v_latch_bc_hi.db;
2299
   // Preset de
2300
   force dut.reg_file_.b2v_latch_de_lo.we=1;
2301
   force dut.reg_file_.b2v_latch_de_hi.we=1;
2302
   force dut.reg_file_.b2v_latch_de_lo.db=8'h0d;
2303
   force dut.reg_file_.b2v_latch_de_hi.db=8'h20;
2304
#2 release dut.reg_file_.b2v_latch_de_lo.we;
2305
   release dut.reg_file_.b2v_latch_de_hi.we;
2306
   release dut.reg_file_.b2v_latch_de_lo.db;
2307
   release dut.reg_file_.b2v_latch_de_hi.db;
2308
   // Preset hl
2309
   force dut.reg_file_.b2v_latch_hl_lo.we=1;
2310
   force dut.reg_file_.b2v_latch_hl_hi.we=1;
2311
   force dut.reg_file_.b2v_latch_hl_lo.db=8'ha6;
2312
   force dut.reg_file_.b2v_latch_hl_hi.db=8'hdc;
2313
#2 release dut.reg_file_.b2v_latch_hl_lo.we;
2314
   release dut.reg_file_.b2v_latch_hl_hi.we;
2315
   release dut.reg_file_.b2v_latch_hl_lo.db;
2316
   release dut.reg_file_.b2v_latch_hl_hi.db;
2317
   // Preset af2
2318
   force dut.reg_file_.b2v_latch_af2_lo.we=1;
2319
   force dut.reg_file_.b2v_latch_af2_hi.we=1;
2320
   force dut.reg_file_.b2v_latch_af2_lo.db=8'h00;
2321
   force dut.reg_file_.b2v_latch_af2_hi.db=8'h00;
2322
#2 release dut.reg_file_.b2v_latch_af2_lo.we;
2323
   release dut.reg_file_.b2v_latch_af2_hi.we;
2324
   release dut.reg_file_.b2v_latch_af2_lo.db;
2325
   release dut.reg_file_.b2v_latch_af2_hi.db;
2326
   // Preset bc2
2327
   force dut.reg_file_.b2v_latch_bc2_lo.we=1;
2328
   force dut.reg_file_.b2v_latch_bc2_hi.we=1;
2329
   force dut.reg_file_.b2v_latch_bc2_lo.db=8'h00;
2330
   force dut.reg_file_.b2v_latch_bc2_hi.db=8'h00;
2331
#2 release dut.reg_file_.b2v_latch_bc2_lo.we;
2332
   release dut.reg_file_.b2v_latch_bc2_hi.we;
2333
   release dut.reg_file_.b2v_latch_bc2_lo.db;
2334
   release dut.reg_file_.b2v_latch_bc2_hi.db;
2335
   // Preset de2
2336
   force dut.reg_file_.b2v_latch_de2_lo.we=1;
2337
   force dut.reg_file_.b2v_latch_de2_hi.we=1;
2338
   force dut.reg_file_.b2v_latch_de2_lo.db=8'h00;
2339
   force dut.reg_file_.b2v_latch_de2_hi.db=8'h00;
2340
#2 release dut.reg_file_.b2v_latch_de2_lo.we;
2341
   release dut.reg_file_.b2v_latch_de2_hi.we;
2342
   release dut.reg_file_.b2v_latch_de2_lo.db;
2343
   release dut.reg_file_.b2v_latch_de2_hi.db;
2344
   // Preset hl2
2345
   force dut.reg_file_.b2v_latch_hl2_lo.we=1;
2346
   force dut.reg_file_.b2v_latch_hl2_hi.we=1;
2347
   force dut.reg_file_.b2v_latch_hl2_lo.db=8'h00;
2348
   force dut.reg_file_.b2v_latch_hl2_hi.db=8'h00;
2349
#2 release dut.reg_file_.b2v_latch_hl2_lo.we;
2350
   release dut.reg_file_.b2v_latch_hl2_hi.we;
2351
   release dut.reg_file_.b2v_latch_hl2_lo.db;
2352
   release dut.reg_file_.b2v_latch_hl2_hi.db;
2353
   // Preset ix
2354
   force dut.reg_file_.b2v_latch_ix_lo.we=1;
2355
   force dut.reg_file_.b2v_latch_ix_hi.we=1;
2356
   force dut.reg_file_.b2v_latch_ix_lo.db=8'h00;
2357
   force dut.reg_file_.b2v_latch_ix_hi.db=8'h00;
2358
#2 release dut.reg_file_.b2v_latch_ix_lo.we;
2359
   release dut.reg_file_.b2v_latch_ix_hi.we;
2360
   release dut.reg_file_.b2v_latch_ix_lo.db;
2361
   release dut.reg_file_.b2v_latch_ix_hi.db;
2362
   // Preset iy
2363
   force dut.reg_file_.b2v_latch_iy_lo.we=1;
2364
   force dut.reg_file_.b2v_latch_iy_hi.we=1;
2365
   force dut.reg_file_.b2v_latch_iy_lo.db=8'h00;
2366
   force dut.reg_file_.b2v_latch_iy_hi.db=8'h00;
2367
#2 release dut.reg_file_.b2v_latch_iy_lo.we;
2368
   release dut.reg_file_.b2v_latch_iy_hi.we;
2369
   release dut.reg_file_.b2v_latch_iy_lo.db;
2370
   release dut.reg_file_.b2v_latch_iy_hi.db;
2371
   // Preset sp
2372
   force dut.reg_file_.b2v_latch_sp_lo.we=1;
2373
   force dut.reg_file_.b2v_latch_sp_hi.we=1;
2374
   force dut.reg_file_.b2v_latch_sp_lo.db=8'h00;
2375
   force dut.reg_file_.b2v_latch_sp_hi.db=8'h00;
2376
#2 release dut.reg_file_.b2v_latch_sp_lo.w