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 6

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

powered by: WebSVN 2.1.0

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