rspWrap_regression.v
7 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
/**************************************************************************
* *
* Copyright (C) 1994, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
*************************************************************************/
// $Id: rspWrap_regression.v,v 1.4 2002/11/17 19:55:48 berndt Exp $
// rspWrap_regression.v: the world outside the rsp, for regression tests
`timescale 1ns / 10ps
`include "rsp_regr.h"
module clock(clk);
output clk;
reg clk;
initial
#2 clk = 1;
always
#8 clk = ~ clk;
endmodule
module rspWrap();
reg reset_l;
wire clk;
integer cycleCount;
integer i;
// DMA-related IO
reg frozen;
reg sp_cbus_read_enable;
reg sp_cbus_write_enable;
reg mem_cbus_write_enable; // *** Use for CPU read of mems
reg cmd_cbus_read_enable;
reg cmd_cbus_write_enable;
reg [1:0] cbus_select;
reg [2:0] cbus_command;
reg dma_start;
reg dma_last;
reg sp_dma_grant;
reg sp_read_grant;
reg cmd_dma_grant;
reg cmd_read_grant;
reg sp_dbus_read_enable;
reg sp_dbus_write_enable;
reg cbuf_ready;
reg cmd_busy; // DP CMDBUF is not empty
reg pipe_busy; // DP pipeline is active
reg tmem_busy; // DP TMEM is loading
wire [31:0] cbus_din;
wire [63:0] dbus_din;
wire [31:0] cbus_dout;
wire [63:0] dbus_dout;
wire [63:0] xbus_data;
wire sp_dma_request;
wire cmd_dma_request;
wire cmd_read_request;
wire sp_read_request;
wire mem_read_request;
wire cbuf_write;
task initDMA;
begin
frozen = 1'b0;
sp_cbus_read_enable = 1'b1;
sp_cbus_write_enable = 1'b0;
mem_cbus_write_enable = 1'b0;
cmd_cbus_read_enable = 1'b1;
cmd_cbus_write_enable = 1'b0;
cbus_select = 2'b0;
cbus_command = 3'b0;
dma_start = 0;
dma_last = 0;
sp_dma_grant = 0;
sp_read_grant = 0;
cmd_dma_grant = 0;
cmd_read_grant = 0;
sp_dbus_read_enable = 0;
sp_dbus_write_enable = 0;
cbuf_ready = 0;
cmd_busy = 0;
pipe_busy = 0;
tmem_busy = 0;
end
endtask
task initSURFile;
begin
/*
for (i=0; i<32; i=i+1) begin
rsp.su.sudp.suRFile_i.mem[i] = i;
end
rsp.su.sudp.suRFile_i.mem[0] = 32'hb00b0094;
*/
end
endtask
task initVURFile;
begin
`ifdef NEWVU
`else
for (i=0; i<32; i=i+1) begin
`VR0path.mem[i] = i*16;
`VR1path.mem[i] = (i*16)+1;
`VR2path.mem[i] = (i*16)+2;
`VR3path.mem[i] = (i*16)+3;
`VR4path.mem[i] = (i*16)+4;
`VR5path.mem[i] = (i*16)+5;
`VR6path.mem[i] = (i*16)+6;
`VR7path.mem[i] = (i*16)+7;
end
`endif
end
endtask
task initIMem;
begin
$readmemh("idata", rsp.imem.sram.memory, 0);
end
endtask
// ddata 16 byte word is numbered MSB to LSB: ddata0, ddata1, ... ddata15
// dmem model 16 byte word is numbered MSB to LSB:
// high.prim7, high.prim6, ... high.prim0, low.prim7, ... low.prim0
task initDMem;
begin
/*$readmemh("d_0.dhex", rsp.dmemx2.dmemHigh.ram_prim7, 0);
$readmemh("d_1.dhex", rsp.dmemx2.dmemHigh.ram_prim6, 0);
$readmemh("d_2.dhex", rsp.dmemx2.dmemHigh.ram_prim5, 0);
$readmemh("d_3.dhex", rsp.dmemx2.dmemHigh.ram_prim4, 0);
$readmemh("d_4.dhex", rsp.dmemx2.dmemHigh.ram_prim3, 0);
$readmemh("d_5.dhex", rsp.dmemx2.dmemHigh.ram_prim2, 0);
$readmemh("d_6.dhex", rsp.dmemx2.dmemHigh.ram_prim1, 0);
$readmemh("d_7.dhex", rsp.dmemx2.dmemHigh.ram_prim0, 0);
$readmemh("d_8.dhex", rsp.dmemx2.dmemLow.ram_prim7, 0);
$readmemh("d_9.dhex", rsp.dmemx2.dmemLow.ram_prim6, 0);
$readmemh("d_a.dhex", rsp.dmemx2.dmemLow.ram_prim5, 0);
$readmemh("d_b.dhex", rsp.dmemx2.dmemLow.ram_prim4, 0);
$readmemh("d_c.dhex", rsp.dmemx2.dmemLow.ram_prim3, 0);
$readmemh("d_d.dhex", rsp.dmemx2.dmemLow.ram_prim2, 0);
$readmemh("d_e.dhex", rsp.dmemx2.dmemLow.ram_prim1, 0);
$readmemh("d_f.dhex", rsp.dmemx2.dmemLow.ram_prim0, 0);*/
end
endtask
clock clock(clk);
rsp rsp(
.clk (clk),
.reset_l (reset_l),
// DMA-related IO
.frozen (frozen),
.sp_cbus_read_enable (sp_cbus_read_enable),
.sp_cbus_write_enable (sp_cbus_write_enable),
.mem_cbus_write_enable (mem_cbus_write_enable),
.cmd_cbus_read_enable (cmd_cbus_read_enable),
.cmd_cbus_write_enable (cmd_cbus_write_enable),
.cbus_select (cbus_select),
.cbus_command (cbus_command),
.dma_start (dma_start),
.dma_last (dma_last),
.sp_dma_grant (sp_dma_grant),
.sp_read_grant (sp_read_grant),
.cmd_dma_grant (cmd_dma_grant),
.cmd_read_grant (cmd_read_grant),
.cbuf_ready (cbuf_ready),
.sp_dma_request (sp_dma_request),
.sp_read_request (sp_read_request),
.mem_read_request (mem_read_request),
.cmd_dma_request (cmd_dma_request),
.cmd_read_request (cmd_read_request),
.sp_dbus_read_enable (sp_dbus_read_enable),
.sp_dbus_write_enable (sp_dbus_write_enable),
.cbuf_write (cbuf_write),
.cbus_din (cbus_din),
.dbus_din (dbus_din),
.cbus_dout (cbus_dout),
.dbus_dout (dbus_dout),
.xbus_data (xbus_data)
);
initial begin
initDMA;
initSURFile;
initVURFile;
// initDMem;
// initIMem;
// $dumpvars;
reset_l = 0;
repeat (10) @(negedge clk);
reset_l = 1; // *** need setup time on reset_l!
end // initial
always @(posedge clk) begin
if (!reset_l) begin
cycleCount = 0;
end
else begin
cycleCount = cycleCount+1;
end
end
wire [11:0] su_rd_pc;
wire [11:0] vu_rd_pc;
`ifdef RSP_GATE
`else
assign su_rd_pc =
rsp.su.suctl.issue.su_inst_sel[0] ? {rsp.su.suctl.issue.sav_pc, 2'b00} :
rsp.su.suctl.issue.su_inst_sel[1] ? {rsp.su.suctl.issue.cur_rd_pc[11:3], 3'b000} :
rsp.su.suctl.issue.su_inst_sel[2] ? {rsp.su.suctl.issue.cur_rd_pc[11:3], 3'b100} :
/* rsp.su.suctl.issue.su_inst_sel[3] ? */ 12'b0;
assign vu_rd_pc =
rsp.su.suctl.issue.vu_inst_sel[0] ? {rsp.su.suctl.issue.sav_pc, 2'b00} :
rsp.su.suctl.issue.vu_inst_sel[1] ? {rsp.su.suctl.issue.cur_rd_pc[11:3], 3'b000} :
rsp.su.suctl.issue.vu_inst_sel[2] ? {rsp.su.suctl.issue.cur_rd_pc[11:3], 3'b100} :
/* rsp.su.suctl.issue.vu_inst_sel[3] ? */ 12'b0;
/*
always @(negedge clk) begin
$write("time: %0t, pc: %h, broke: %h, kill: %h\n",
$time, {rsp.su.suctl.pc, 2'b0}, rsp.su.suctl.rd_broke,
rsp.su.suctl.kill_re_l);
if (rsp.su.suctl.rd_broke_k) begin
$write("time: %0t, su_inst: %h\n", $time, rsp.su.suctl.su_inst);
#100;
$write("later time: %0t, su_inst: %h\n",$time,rsp.su.suctl.su_inst);
$finish(2);
end
end
*/
`endif
endmodule