rcp_test_tssi.v
14.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
////////////////////////////////////////////////////////////////////////
//
// Project Reality
//
// module: rcp_test_tssi.v
// description: dumps out rcp tssi file
//
// designer: Tony DeLaurier
// date: 4/25/95
//
////////////////////////////////////////////////////////////////////////
module rcp_test_tssi();
`define RDRAM0 reality.rdram_0.rdram_near_model_0
`define RDRAM1 reality.rdram_1.rdram_near_model_0
`define RDRAM2 reality.rdram_2.rdram_near_model_0
`define RDRAM3 reality.rdram_3.rdram_near_model_0
integer tab_file_ptr; // output file pointer
integer idx; // bus bit counter
integer vector_count; // vector counter
reg smp_clk; // sample clock
reg dly_clk; // delay clock
reg bus_ctrl_rac_oe; // active-high oe for bus_ctrl_rac
reg bus_data_rac_oe[8:0]; // active-high oe's for bus_data_rac
reg freeze_vclk; // freeze_vclk flag
// delayed signals
reg BusCtrl0_drive_curr;
reg [8:0] BusData0_drive_curr;
reg BusCtrl1_drive_curr;
reg [8:0] BusData1_drive_curr;
reg BusCtrl2_drive_curr;
reg [8:0] BusData2_drive_curr;
reg BusCtrl3_drive_curr;
reg [8:0] BusData3_drive_curr;
reg tx_clk_curr;
reg v_ref_curr;
reg pif_clock_curr;
reg clock_curr;
reg reset_l_curr;
reg test_curr;
reg c_ctl_pgm_curr;
reg bus_enable_curr;
reg bus_ctrl_curr;
reg [8:0] bus_data_curr;
reg ad16_aleh_curr;
reg ad16_alel_curr;
reg ad16_read_curr;
reg ad16_write_curr;
reg [15:0] ad16_data_curr;
reg tst_ad16_enable_l_curr;
reg pif_rsp_curr;
reg pif_cmd_curr;
reg abus_data_curr;
reg abus_word_curr;
reg abus_clock_curr;
reg vbus_sync_curr;
reg vbus_clock_curr;
reg vclk_enable_l_curr;
reg [6:0] vbus_data_curr;
reg int_curr;
reg p_valid_curr;
reg e_valid_curr;
reg e_ok_curr;
reg [31:0] sys_ad_curr;
reg sys_ad_enable_l_curr;
reg [4:0] sys_cmd_curr;
initial vector_count = 0;
// freeze vclk
initial
begin
if (!$test$plusargs("freeze_vclk_false") && $test$plusargs("rcp_test_tssi"))
begin
wait(`SYSTEM_READY);
@(posedge reality.vbus_clock);
$display($time," Freezing vclk");
reality.cg_0.freeze_vclk = 1;
end
end
// define sample clock
initial
begin
smp_clk = 0;
#3.8 smp_clk = 1;
forever
begin
#2 smp_clk = ~smp_clk;
end // forever
end // initial
// define delay clock
initial
begin
dly_clk = 1;
#1.9 dly_clk = 0;
forever
begin
#2 dly_clk = ~dly_clk;
end // forever
end // initial
// input write task
task printInput;
input value;
if (value === 0)
$fwrite(tab_file_ptr, "D");
else if (value === 1)
$fwrite(tab_file_ptr, "U");
else
$fwrite(tab_file_ptr, "D");
endtask // printInput
// output write task
task printOutput;
input value;
if (vector_count > 100) begin
if (value === 0)
$fwrite(tab_file_ptr, "L");
else if (value === 1)
$fwrite(tab_file_ptr, "H");
else
$fwrite(tab_file_ptr, "X");
end else
$fwrite(tab_file_ptr, "X");
endtask // printOutput
// bidir write task
task printBidir;
input value;
input curr_oe;
input next_oe;
if (((curr_oe === 0) && (next_oe === 1)) || (curr_oe === 1'bx) || (next_oe === 1'bx))
$fwrite(tab_file_ptr, "Z");
else begin
if (curr_oe === 1) // chip driving
begin
if (value === 0)
$fwrite(tab_file_ptr, "L");
else if (value === 1)
$fwrite(tab_file_ptr, "H");
else
$fwrite(tab_file_ptr, "X");
end
else if (curr_oe === 0) // tester driving
begin
if (value === 0)
$fwrite(tab_file_ptr, "D");
else if (value === 1)
$fwrite(tab_file_ptr, "U");
else
$fwrite(tab_file_ptr, "D");
end
else // curr_oe unknown
$fwrite(tab_file_ptr, "Z");
end // else
endtask // printBidir
// rac bidir write task
task printRacBidir;
input value;
input oe;
if (oe === 1) // tester not driving
begin
if (value === 0)
$fwrite(tab_file_ptr, "L");
else if (value === 1)
$fwrite(tab_file_ptr, "H");
else
$fwrite(tab_file_ptr, "X");
end
else if (oe === 0) // tester driving
begin
if (value === 0)
$fwrite(tab_file_ptr, "D");
else if (value === 1)
$display("ERROR: rdram is driving 1 ????????");
else
$fwrite(tab_file_ptr, "D");
end
else // oe unknown
$fwrite(tab_file_ptr, "Z");
endtask // printRacBidir
initial
begin
`ifdef RDRAM_23_PRESENT
$display("rcp_test_tssi: 8MB SYSTEM Configuration");
`else
`ifdef RDRAM_1_PRESENT
$display("rcp_test_tssi: 4MB SYSTEM Configuration");
`else
$display("rcp_test_tssi: 2MB SYSTEM Configuration");
`endif
`endif
BusCtrl0_drive_curr <= 1'b1;
BusCtrl1_drive_curr <= 1'b1;
BusCtrl2_drive_curr <= 1'b1;
BusCtrl3_drive_curr <= 1'b1;
BusData0_drive_curr <= 9'h1ff;
BusData1_drive_curr <= 9'h1ff;
BusData2_drive_curr <= 9'h1ff;
BusData3_drive_curr <= 9'h1ff;
end
// delay all signals of interest by one cycle
always @(dly_clk)
begin
BusCtrl0_drive_curr <= `RDRAM0.BusCtrl_drive;
BusData0_drive_curr[8] <= `RDRAM0.BusData_drive[8];
BusData0_drive_curr[7] <= `RDRAM0.BusData_drive[7];
BusData0_drive_curr[6] <= `RDRAM0.BusData_drive[6];
BusData0_drive_curr[5] <= `RDRAM0.BusData_drive[5];
BusData0_drive_curr[4] <= `RDRAM0.BusData_drive[4];
BusData0_drive_curr[3] <= `RDRAM0.BusData_drive[3];
BusData0_drive_curr[2] <= `RDRAM0.BusData_drive[2];
BusData0_drive_curr[1] <= `RDRAM0.BusData_drive[1];
BusData0_drive_curr[0] <= `RDRAM0.BusData_drive[0];
`ifdef RDRAM_1_PRESENT
BusCtrl1_drive_curr <= `RDRAM1.BusCtrl_drive;
BusData1_drive_curr[8] <= `RDRAM1.BusData_drive[8];
BusData1_drive_curr[7] <= `RDRAM1.BusData_drive[7];
BusData1_drive_curr[6] <= `RDRAM1.BusData_drive[6];
BusData1_drive_curr[5] <= `RDRAM1.BusData_drive[5];
BusData1_drive_curr[4] <= `RDRAM1.BusData_drive[4];
BusData1_drive_curr[3] <= `RDRAM1.BusData_drive[3];
BusData1_drive_curr[2] <= `RDRAM1.BusData_drive[2];
BusData1_drive_curr[1] <= `RDRAM1.BusData_drive[1];
BusData1_drive_curr[0] <= `RDRAM1.BusData_drive[0];
`endif
`ifdef RDRAM_23_PRESENT
BusCtrl2_drive_curr <= `RDRAM2.BusCtrl_drive;
BusData2_drive_curr[8] <= `RDRAM2.BusData_drive[8];
BusData2_drive_curr[7] <= `RDRAM2.BusData_drive[7];
BusData2_drive_curr[6] <= `RDRAM2.BusData_drive[6];
BusData2_drive_curr[5] <= `RDRAM2.BusData_drive[5];
BusData2_drive_curr[4] <= `RDRAM2.BusData_drive[4];
BusData2_drive_curr[3] <= `RDRAM2.BusData_drive[3];
BusData2_drive_curr[2] <= `RDRAM2.BusData_drive[2];
BusData2_drive_curr[1] <= `RDRAM2.BusData_drive[1];
BusData2_drive_curr[0] <= `RDRAM2.BusData_drive[0];
BusCtrl3_drive_curr <= `RDRAM3.BusCtrl_drive;
BusData3_drive_curr[8] <= `RDRAM3.BusData_drive[8];
BusData3_drive_curr[7] <= `RDRAM3.BusData_drive[7];
BusData3_drive_curr[6] <= `RDRAM3.BusData_drive[6];
BusData3_drive_curr[5] <= `RDRAM3.BusData_drive[5];
BusData3_drive_curr[4] <= `RDRAM3.BusData_drive[4];
BusData3_drive_curr[3] <= `RDRAM3.BusData_drive[3];
BusData3_drive_curr[2] <= `RDRAM3.BusData_drive[2];
BusData3_drive_curr[1] <= `RDRAM3.BusData_drive[1];
BusData3_drive_curr[0] <= `RDRAM3.BusData_drive[0];
`endif
tx_clk_curr <= reality.tx_clk;
v_ref_curr <= reality.v_ref;
pif_clock_curr <= reality.pif_clock;
clock_curr <= reality.clock;
reset_l_curr <= reality.reset_l;
test_curr <= reality.test;
c_ctl_pgm_curr <= reality.c_ctl_pgm;
bus_enable_curr <= reality.bus_enable;
bus_ctrl_curr <= reality.bus_ctrl;
bus_data_curr <= reality.bus_data;
ad16_aleh_curr <= reality.ad16_aleh;
ad16_alel_curr <= reality.ad16_alel;
ad16_read_curr <= reality.ad16_read;
ad16_write_curr <= reality.ad16_write;
ad16_data_curr <= reality.ad16_data;
tst_ad16_enable_l_curr <= reality.rcp_0.tst_ad16_enable_l[0];
pif_rsp_curr <= reality.pif_rsp;
pif_cmd_curr <= reality.pif_cmd;
abus_data_curr <= reality.abus_data;
abus_word_curr <= reality.abus_word;
abus_clock_curr <= reality.abus_clock;
vbus_sync_curr <= reality.vbus_sync;
vbus_clock_curr <= reality.vbus_clock;
vclk_enable_l_curr <= reality.rcp_0.vclk_enable_l;
vbus_data_curr <= reality.vbus_data;
int_curr <= reality.int;
p_valid_curr <= reality.p_valid;
e_valid_curr <= reality.e_valid;
e_ok_curr <= reality.e_ok;
sys_ad_curr <= reality.sys_ad;
sys_ad_enable_l_curr <= reality.rcp_0.sys_ad_enable_l[0];
sys_cmd_curr <= reality.sys_cmd;
end // always
reg [1:256*8] rcp_tssi_fn;
initial
begin
if ($test$plusargs("rcp_test_tssi"))
begin
if ($getstr$plusarg("tssi_name=", rcp_tssi_fn) == 1)
tab_file_ptr = $fopen(rcp_tssi_fn);
else
tab_file_ptr = $fopen("rcp_test_tssi.slf");
forever @(smp_clk)
begin
$fwrite(tab_file_ptr, "%d.0 ", vector_count * 100);
vector_count = vector_count + 1;
`ifdef RDRAM_23_PRESENT
bus_ctrl_rac_oe = BusCtrl0_drive_curr & BusCtrl1_drive_curr & BusCtrl2_drive_curr & BusCtrl3_drive_curr;
bus_data_rac_oe[8] = BusData0_drive_curr[8] & BusData1_drive_curr[8] & BusData2_drive_curr[8] & BusData3_drive_curr[8];
bus_data_rac_oe[7] = BusData0_drive_curr[7] & BusData1_drive_curr[7] & BusData2_drive_curr[7] & BusData3_drive_curr[7];
bus_data_rac_oe[6] = BusData0_drive_curr[6] & BusData1_drive_curr[6] & BusData2_drive_curr[6] & BusData3_drive_curr[6];
bus_data_rac_oe[5] = BusData0_drive_curr[5] & BusData1_drive_curr[5] & BusData2_drive_curr[5] & BusData3_drive_curr[5];
bus_data_rac_oe[4] = BusData0_drive_curr[4] & BusData1_drive_curr[4] & BusData2_drive_curr[4] & BusData3_drive_curr[4];
bus_data_rac_oe[3] = BusData0_drive_curr[3] & BusData1_drive_curr[3] & BusData2_drive_curr[3] & BusData3_drive_curr[3];
bus_data_rac_oe[2] = BusData0_drive_curr[2] & BusData1_drive_curr[2] & BusData2_drive_curr[2] & BusData3_drive_curr[2];
bus_data_rac_oe[1] = BusData0_drive_curr[1] & BusData1_drive_curr[1] & BusData2_drive_curr[1] & BusData3_drive_curr[1];
bus_data_rac_oe[0] = BusData0_drive_curr[0] & BusData1_drive_curr[0] & BusData2_drive_curr[0] & BusData3_drive_curr[0];
`else
`ifdef RDRAM_1_PRESENT
bus_ctrl_rac_oe = BusCtrl0_drive_curr & BusCtrl1_drive_curr;
bus_data_rac_oe[8] = BusData0_drive_curr[8] & BusData1_drive_curr[8];
bus_data_rac_oe[7] = BusData0_drive_curr[7] & BusData1_drive_curr[7];
bus_data_rac_oe[6] = BusData0_drive_curr[6] & BusData1_drive_curr[6];
bus_data_rac_oe[5] = BusData0_drive_curr[5] & BusData1_drive_curr[5];
bus_data_rac_oe[4] = BusData0_drive_curr[4] & BusData1_drive_curr[4];
bus_data_rac_oe[3] = BusData0_drive_curr[3] & BusData1_drive_curr[3];
bus_data_rac_oe[2] = BusData0_drive_curr[2] & BusData1_drive_curr[2];
bus_data_rac_oe[1] = BusData0_drive_curr[1] & BusData1_drive_curr[1];
bus_data_rac_oe[0] = BusData0_drive_curr[0] & BusData1_drive_curr[0];
`else
bus_ctrl_rac_oe = BusCtrl0_drive_curr;
bus_data_rac_oe[8] = BusData0_drive_curr[8];
bus_data_rac_oe[7] = BusData0_drive_curr[7];
bus_data_rac_oe[6] = BusData0_drive_curr[6];
bus_data_rac_oe[5] = BusData0_drive_curr[5];
bus_data_rac_oe[4] = BusData0_drive_curr[4];
bus_data_rac_oe[3] = BusData0_drive_curr[3];
bus_data_rac_oe[2] = BusData0_drive_curr[2];
bus_data_rac_oe[1] = BusData0_drive_curr[1];
bus_data_rac_oe[0] = BusData0_drive_curr[0];
`endif
`endif
printInput(tx_clk_curr); // tx_clk
printInput(v_ref_curr); // v_ref
if ($test$plusargs("dontcare_outputs_false") || !`SYSTEM_READY)
begin
printOutput(pif_clock_curr); // pif_clock_pad
printOutput(clock_curr); // mclock_pad
end else begin
$fwrite(tab_file_ptr, "X");
$fwrite(tab_file_ptr, "X");
end
printInput(reset_l_curr); // reset_l_pad
printInput(test_curr); // test_pad
printInput(c_ctl_pgm_curr); // c_ctl_pgm
printOutput(bus_enable_curr); // bus_enable_rac
printRacBidir(bus_ctrl_curr, bus_ctrl_rac_oe); // bus_ctrl_rac
for (idx = 0; idx < 9; idx = idx + 1)
printRacBidir(bus_data_curr[idx], bus_data_rac_oe[idx]); // bus_data_rac[8:0]
printOutput(ad16_aleh_curr); // ad16_aleh_pad
printOutput(ad16_alel_curr); // ad16_alel_pad
printOutput(ad16_read_curr); // ad16_read_pad
printOutput(ad16_write_curr); // ad16_write_pad
for (idx = 0; idx < 16; idx = idx + 1)
printBidir(ad16_data_curr[idx], (!tst_ad16_enable_l_curr), (!reality.rcp_0.tst_ad16_enable_l[0])); // ad16_data_pad[15:0]
printInput(pif_rsp_curr); // pif_rsp_pad
printOutput(pif_cmd_curr); // pif_cmd_pad
printOutput(abus_data_curr); // abus_data_pad
printOutput(abus_word_curr); // abus_word_pad
printOutput(abus_clock_curr); // abus_clock_pad
printOutput(vbus_sync_curr); // vbus_sync_pad
printBidir(vbus_clock_curr, (!vclk_enable_l_curr), (!reality.rcp_0.vclk_enable_l)); // vclk_pad
for (idx = 0; idx < 7; idx = idx + 1)
printOutput(vbus_data_curr[idx]); // vbus_data_pad[6:0]
printOutput(int_curr); // int_pad
printInput(p_valid_curr); // p_valid_pad
printOutput(e_valid_curr); // e_valid_pad
printOutput(e_ok_curr); // e_ok_pad
for (idx = 0; idx < 32; idx = idx + 1)
printBidir(sys_ad_curr[idx], (!sys_ad_enable_l_curr), (!reality.rcp_0.sys_ad_enable_l[0])); // sys_ad_pad[31:0]
for (idx = 0; idx < 5; idx = idx + 1)
printBidir(sys_cmd_curr[idx], (!sys_ad_enable_l_curr), (!reality.rcp_0.sys_ad_enable_l[0])); // sys_cmd_pad[4:0]
printOutput(tx_clk_curr); // rx_clk
$fdisplay(tab_file_ptr);
end // forever
end // if
end // initial
endmodule // rcp_test_tssi