OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [rel_1/] [or1200/] [bench/] [tb_or1200.v] - Blame information for rev 896

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

Line No. Rev Author Line
1 162 lampret
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  Test bench                                                  ////
4
////                                                              ////
5
////  This file is part of the OpenRISC 1200 project              ////
6
////  http://www.opencores.org/cores/or1k/                        ////
7
////                                                              ////
8
////  Description                                                 ////
9
////  Test bench using on OR1200 and wb_sram.                     ////
10
////                                                              ////
11
////  To Do:                                                      ////
12
////   None.                                                      ////
13
////                                                              ////
14
////  Author(s):                                                  ////
15
////      - Damjan Lampret, lampret@opencores.org                 ////
16
////                                                              ////
17
//////////////////////////////////////////////////////////////////////
18
////                                                              ////
19
//// Copyright (C) 2000 Authors and OPENCORES.ORG                 ////
20
////                                                              ////
21
//// This source file may be used and distributed without         ////
22
//// restriction provided that this copyright statement is not    ////
23
//// removed from the file and that any derivative work contains  ////
24
//// the original copyright notice and the associated disclaimer. ////
25
////                                                              ////
26
//// This source file is free software; you can redistribute it   ////
27
//// and/or modify it under the terms of the GNU Lesser General   ////
28
//// Public License as published by the Free Software Foundation; ////
29
//// either version 2.1 of the License, or (at your option) any   ////
30
//// later version.                                               ////
31
////                                                              ////
32
//// This source is distributed in the hope that it will be       ////
33
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
34
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
35
//// PURPOSE.  See the GNU Lesser General Public License for more ////
36
//// details.                                                     ////
37
////                                                              ////
38
//// You should have received a copy of the GNU Lesser General    ////
39
//// Public License along with this source; if not, download it   ////
40
//// from http://www.opencores.org/lgpl.shtml                     ////
41
////                                                              ////
42
//////////////////////////////////////////////////////////////////////
43
//
44
// CVS Revision History
45
//
46
// $Log: not supported by cvs2svn $
47 169 lampret
// Revision 1.1  2001/07/20 00:49:34  lampret
48
// Benches (under development).
49 162 lampret
//
50 169 lampret
//
51 162 lampret
 
52 169 lampret
`include "timescale.v"
53 162 lampret
 
54
module tb_or1200;
55
 
56
//
57
// System connections
58
//
59
reg     clk;
60 169 lampret
reg     risc_clk;
61 162 lampret
reg     rst;
62
 
63
//
64
// Interconnect between OR1200 and iwb_ram
65
//
66
wire            iwb_ack;
67
wire            iwb_cyc;
68
wire    [17:0]  iwb_adr;
69
wire    [31:0]  iwb_dat_risc;
70
wire    [31:0]  iwb_dat_mem;
71
wire            iwb_err;
72
wire            iwb_rty;
73
wire    [3:0]   iwb_sel;
74
wire            iwb_stb;
75
wire            iwb_we;
76
 
77
//
78
// Interconnect between OR1200 and dwb_ram
79
//
80
wire            dwb_ack;
81
wire            dwb_cyc;
82
wire    [17:0]  dwb_adr;
83
wire    [31:0]  dwb_dat_risc;
84
wire    [31:0]  dwb_dat_mem;
85
wire            dwb_err;
86
wire            dwb_rty;
87
wire    [3:0]   dwb_sel;
88
wire            dwb_stb;
89
wire            dwb_we;
90
 
91
integer i;
92
 
93
//
94
// Initial state
95
//
96
initial
97
begin
98
        clk = 1'b0;
99 169 lampret
        risc_clk = 1'b0;
100 162 lampret
end
101
 
102
//
103
// Reset interval
104
//
105
initial
106
begin
107
        for(i = 0; i < 32; i = i + 1) begin
108
                risc.cpu.rf.rf_a.mem[i] = 0;
109
                risc.cpu.rf.rf_b.mem[i] = 0;
110
        end
111
        for(i = 0; i < 512; i = i + 1) begin
112 169 lampret
`ifdef ARTISAN_SSP
113
                risc.ic.ic_tag.ic_tag0.artisan_ssp.mem[i] = 19'h1234;
114
`else
115 162 lampret
                risc.ic.ic_tag.ic_tag0.mem[i] = 19'h1234;
116 169 lampret
`endif
117 162 lampret
        end
118
        for(i = 0; i < 2048; i = i + 1) begin
119 169 lampret
`ifdef ARTISAN_SSP
120
                risc.ic.ic_ram.ic_ram0.artisan_ssp.mem[i] = 32'b0;
121
`else
122 162 lampret
                risc.ic.ic_ram.ic_ram0.mem[i] = 32'b0;
123 169 lampret
`endif
124 162 lampret
        end
125
        for(i = 0; i < 512; i = i + 1) begin
126 169 lampret
`ifdef ARTISAN_SSP
127
                risc.dc.dc_tag.dc_tag0.artisan_ssp.mem[i] = 19'h1234;
128
`else
129 162 lampret
                risc.dc.dc_tag.dc_tag0.mem[i] = 19'h1234;
130 169 lampret
`endif
131 162 lampret
        end
132
        for(i = 0; i < 2048; i = i + 1) begin
133 169 lampret
`ifdef ARTISAN_SSP
134
                risc.dc.dc_ram.dc_ram0.artisan_ssp.mem[i] = 8'b0;
135
                risc.dc.dc_ram.dc_ram1.artisan_ssp.mem[i] = 8'b0;
136
                risc.dc.dc_ram.dc_ram2.artisan_ssp.mem[i] = 8'b0;
137
                risc.dc.dc_ram.dc_ram3.artisan_ssp.mem[i] = 8'b0;
138
`else
139 162 lampret
                risc.dc.dc_ram.dc_ram0.mem[i] = 8'b0;
140
                risc.dc.dc_ram.dc_ram1.mem[i] = 8'b0;
141
                risc.dc.dc_ram.dc_ram2.mem[i] = 8'b0;
142
                risc.dc.dc_ram.dc_ram3.mem[i] = 8'b0;
143 169 lampret
`endif
144 162 lampret
        end
145 169 lampret
`ifdef ARTISAN_SSP
146
        risc.ic.ic_tag.ic_tag0.artisan_ssp.LAST_qi = 19'h1234;
147
        risc.dc.dc_tag.dc_tag0.artisan_ssp.LAST_qi = 19'h1234;
148
`else
149
        risc.ic.ic_tag.ic_tag0.do_reg = 19'h1234;
150
        risc.dc.dc_tag.dc_tag0.do_reg = 19'h1234;
151
`endif
152 162 lampret
//      risc.ic.ic_tag.ic_tag0.d_reg = 19'h1234;
153
//      risc.dc.dc_tag.dc_tag0.d_reg = 19'h1234;
154 169 lampret
//      risc.ic.ic_tag.ic_tag0.do_reg = 19'h1234;
155
//      risc.dc.dc_tag.dc_tag0.do_reg = 19'h1234;
156
`ifdef ARTISAN_SSP
157
        risc.ic.ic_tag.ic_tag0.artisan_ssp.di = 19'h1234;
158
        risc.dc.dc_tag.dc_tag0.artisan_ssp.di = 19'h1234;
159
        risc.ic.ic_tag.ic_tag0.artisan_ssp.qi = 19'h1234;
160
        risc.dc.dc_tag.dc_tag0.artisan_ssp.qi = 19'h1234;
161
`endif
162 162 lampret
`ifdef VCD_DUMP
163
        $dumpfile("dump.vcd");
164
        $dumpvars(20,tb_or1200);
165
`endif
166
        rst = 1'b0;
167
        #1 rst = 1'b1;
168
        #25 rst = 1'b0;
169
        #5765 for(i = 0; i < 32; i = i + 1) begin
170 169 lampret
//              $display("%d %h", i, risc.cpu.rf.rf_b.mem[i]);
171 162 lampret
        end
172
//        #1000 $finish;
173
end
174
 
175
//
176
// Clock generation
177
//
178
always
179 169 lampret
        #10 risc_clk = ~risc_clk;
180 162 lampret
 
181 169 lampret
//
182
// WB Clock generation
183
//
184
always
185
        #20 clk = ~clk;
186 162 lampret
 
187 169 lampret
 
188 162 lampret
or1200 risc(
189 169 lampret
        .clk(risc_clk),
190 162 lampret
        .rst(rst),
191
        .pic_ints(0),
192 169 lampret
        .clkdiv_by_2(1'b1),
193 162 lampret
 
194
        // Instruction WISHBONE interface
195
        .iwb_clk_i(clk),
196
        .iwb_rst_i(rst),
197
        .iwb_ack_i(iwb_ack),
198
        .iwb_err_i(iwb_err),
199
        .iwb_rty_i(iwb_rty),
200
        .iwb_dat_i(iwb_dat_risc),
201
        .iwb_cyc_o(iwb_cyc),
202
        .iwb_adr_o(iwb_adr),
203
        .iwb_stb_o(iwb_stb),
204
        .iwb_we_o(iwb_we),
205
        .iwb_sel_o(iwb_sel),
206
        .iwb_dat_o(iwb_dat_mem),
207
 
208
        // Data WISHBONE interface
209
        .dwb_clk_i(clk),
210
        .dwb_rst_i(rst),
211
        .dwb_ack_i(dwb_ack),
212
        .dwb_err_i(dwb_err),
213
        .dwb_rty_i(dwb_rty),
214
        .dwb_dat_i(dwb_dat_risc),
215
        .dwb_cyc_o(dwb_cyc),
216
        .dwb_adr_o(dwb_adr),
217
        .dwb_stb_o(dwb_stb),
218
        .dwb_we_o(dwb_we),
219
        .dwb_sel_o(dwb_sel),
220
        .dwb_dat_o(dwb_dat_mem),
221
 
222
        // These connect RISC's Trace port to external Trace port pads
223
        .tp_dir_in(1'b0),
224
        .tp_sel(2'b0),
225
        .tp_in(32'b0),
226
        .tp_out(),
227
 
228
        // Power management interface
229
        .pm_cpustall(1'b0),
230
        .pm_clksd(),
231
        .pm_dc_gate(),
232
        .pm_ic_gate(),
233
        .pm_dmmu_gate(),
234
        .pm_immu_gate(),
235
        .pm_tt_gate(),
236
        .pm_cpu_gate(),
237
        .pm_wakeup(),
238
        .pm_lvolt()
239
);
240
 
241
//
242
// Instatiation of Slave WISHBONE Dual-port Synchronous SRAM
243
//
244
wb_sram wb_sram(
245
        // WISHBONE interface 1
246
        .wb1_clk_i(clk),
247
        .wb1_rst_i(rst),
248
 
249
        .wb1_cyc_i(iwb_cyc),
250
        .wb1_adr_i(iwb_adr),
251
        .wb1_dat_i(iwb_dat_mem),
252
        .wb1_stb_i(iwb_stb),
253
        .wb1_we_i(iwb_we),
254
        .wb1_sel_i(iwb_sel),
255
 
256
        .wb1_ack_o(iwb_ack),
257
        .wb1_err_o(iwb_err),
258
        .wb1_rty_o(iwb_rty),
259
        .wb1_dat_o(iwb_dat_risc),
260
 
261
        // WISHBONE interface 2
262
        .wb2_clk_i(clk),
263
        .wb2_rst_i(rst),
264
 
265
        .wb2_cyc_i(dwb_cyc),
266
        .wb2_adr_i(dwb_adr),
267
        .wb2_dat_i(dwb_dat_mem),
268
        .wb2_stb_i(dwb_stb),
269
        .wb2_we_i(dwb_we),
270
        .wb2_sel_i(dwb_sel),
271
 
272
        .wb2_ack_o(dwb_ack),
273
        .wb2_err_o(dwb_err),
274
        .wb2_rty_o(dwb_rty),
275
        .wb2_dat_o(dwb_dat_risc)
276
);
277
 
278
endmodule

powered by: WebSVN 2.1.0

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