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

Subversion Repositories a-z80

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

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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