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

Subversion Repositories or1200_hp

[/] [or1200_hp/] [trunk/] [bench/] [rtl_orig/] [verilog/] [or1200_tb.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 tobil
///////////////////////////////////////////////
2
//      OR1200 Testbench Top Level for
3
//      Random Instruction Code Generator
4
//      and OR1200 Core 
5
///////////////////////////////////////////////
6
 
7
// synopsys translate_off
8
`include "timescale.v"
9
// synopsys translate_on
10
`include "or1200_defines.v"
11
 
12
module or1200_testbench();
13
 
14
 
15
parameter dw = `OR1200_OPERAND_WIDTH;
16
parameter aw = `OR1200_OPERAND_WIDTH;
17
parameter ppic_ints = `OR1200_PIC_INTS;
18
 
19
//
20
// I/O
21
//
22
 
23
//
24
// System
25
//
26
//reg                   clk_i;
27
//reg                   rst_i;
28
reg     [1:0]            clmode_i;       // 00 WB=RISC, 01 WB=RISC/2, 10 N/A, 11 WB=RISC/4
29
reg     [ppic_ints-1:0]  pic_ints_i;
30
 
31
//
32
// Instruction WISHBONE interface
33
//
34
//reg                   iwb_clk_i;      // clock input
35
//reg                   iwb_rst_i;      // reset input
36
wire                    iwb_ack_i;      // normal termination
37
reg                     iwb_err_i;      // termination w/ error
38
reg                     iwb_rty_i;      // termination w/ retry
39
wire    [dw-1:0] iwb_dat_i;      // input data bus
40
wire                    iwb_cyc_o;      // cycle valid output
41
wire    [aw-1:0] iwb_adr_o;      // address bus outputs
42
wire                    iwb_stb_o;      // strobe output
43
wire                    iwb_we_o;       // indicates write transfer
44
wire    [3:0]            iwb_sel_o;      // byte select outputs
45
wire    [dw-1:0] iwb_dat_o;      // output data bus
46
`ifdef OR1200_WB_CAB
47
wire                    iwb_cab_o;      // indicates consecutive address burst
48
`endif
49
`ifdef OR1200_WB_B3
50
wire    [2:0]            iwb_cti_o;      // cycle type identifier
51
wire    [1:0]            iwb_bte_o;      // burst type extension
52
`endif
53
 
54
//
55
// Data WISHBONE interface
56
//
57
//reg                   dwb_clk_i;      // clock input
58
//reg                   dwb_rst_i;      // reset input
59
reg                     dwb_ack_i;      // normal termination
60
reg                     dwb_err_i;      // termination w/ error
61
reg                     dwb_rty_i;      // termination w/ retry
62
reg     [dw-1:0] dwb_dat_i;      // input data bus
63
wire                    dwb_cyc_o;      // cycle valid output
64
wire    [aw-1:0] dwb_adr_o;      // address bus outputs
65
wire                    dwb_stb_o;      // strobe output
66
wire                    dwb_we_o;       // indicates write transfer
67
wire    [3:0]            dwb_sel_o;      // byte select outputs
68
wire    [dw-1:0] dwb_dat_o;      // output data bus
69
`ifdef OR1200_WB_CAB
70
wire                    dwb_cab_o;      // indicates consecutive address burst
71
`endif
72
`ifdef OR1200_WB_B3
73
wire    [2:0]            dwb_cti_o;      // cycle type identifier
74
wire    [1:0]            dwb_bte_o;      // burst type extension
75
`endif
76
 
77
//
78
// External Debug Interface
79
//
80
reg                     dbg_stall_i;    // External Stall Input
81
reg                     dbg_ewt_i;      // External Watchpoint Trigger Input
82
wire    [3:0]            dbg_lss_o;      // External Load/Store Unit Status
83
wire    [1:0]            dbg_is_o;       // External Insn Fetch Status
84
wire    [10:0]           dbg_wp_o;       // Watchpoints Outputs
85
wire                    dbg_bp_o;       // Breakpoint Output
86
reg                     dbg_stb_i;      // External Address/Data Strobe
87
reg                     dbg_we_i;       // External Write Enable
88
reg     [aw-1:0] dbg_adr_i;      // External Address Input
89
reg     [dw-1:0] dbg_dat_i;      // External Data Input
90
wire    [dw-1:0] dbg_dat_o;      // External Data Output
91
wire                    dbg_ack_o;      // External Data Acknowledge (not WB compatible)
92
 
93
`ifdef OR1200_BIST
94
//
95
// RAM BIST
96
//
97
reg mbist_si_i;
98
reg [`OR1200_MBIST_CTRL_WIDTH - 1:0] mbist_ctrl_i;
99
wire mbist_so_o;
100
`endif
101
 
102
//
103
// Power Management
104
//
105
reg                     pm_cpustall_i;
106
wire    [3:0]            pm_clksd_o;
107
wire                    pm_dc_gate_o;
108
wire                    pm_ic_gate_o;
109
wire                    pm_dmmu_gate_o;
110
wire                    pm_immu_gate_o;
111
wire                    pm_tt_gate_o;
112
wire                    pm_cpu_gate_o;
113
wire                    pm_wakeup_o;
114
wire                    pm_lvolt_o;
115
 
116
 
117
 
118
/////////////////////////////////////////////////
119
//      Top Level Clocks, Reset 
120
/////////////////////////////////////////////////
121
 
122
reg clk;
123
reg rst;
124
 
125
/////////////////////////////////////////////////
126
//      Initial
127
/////////////////////////////////////////////////
128
 
129
initial
130
begin
131
        clk <= 0;
132
        rst <= 1;
133
        clmode_i <= 0;   // 00 WB=RISC, 01 WB=RISC/2, 10 N/A, 11 WB=RISC/4
134
        pic_ints_i = 0;
135
        iwb_err_i = 0;   // termination w/ error
136
        iwb_rty_i = 0;   // termination w/ retry
137
        dwb_ack_i = 0;   // normal termination
138
        dwb_err_i = 0;   // termination w/ error
139
        dwb_rty_i = 0;   // termination w/ retry
140
        dwb_dat_i = 0;   // input data bus
141
        dbg_stall_i = 0; // External Stall Input
142
        dbg_ewt_i = 0;   // External Watchpoint Trigger Input
143
        dbg_stb_i = 0;      // External Address/Data Strobe
144
        dbg_we_i = 0;       // External Write Enable
145
        dbg_adr_i = 0;   // External Address Input
146
        dbg_dat_i = 0;   // External Data Input
147
        pm_cpustall_i = 0;
148
end
149
 
150
/////////////////////////////////////////////////
151
//      Clock Generator
152
/////////////////////////////////////////////////
153
 
154
always
155
begin
156
        #(50) clk <= ~clk;
157
end
158
 
159
/////////////////////////////////////////////////
160
//      Reset Generator
161
/////////////////////////////////////////////////
162
 
163
initial
164
begin
165
        repeat (20) @(negedge clk);
166
        rst <= 0;
167
end
168
 
169
/////////////////////////////////////////////////
170
//      Count and Stop after 20000 Cycles
171
/////////////////////////////////////////////////
172
 
173
integer cnt = 0;
174
always @ (posedge clk)
175
begin
176
        cnt <= cnt + 1;
177
        if (cnt == 20000) begin
178
                $stop;
179
        end
180
end
181
 
182
 
183
/////////////////////////////////////////////////
184
//      Random Instruction Code Generator OR1200
185
/////////////////////////////////////////////////
186
 
187
random_rom_wb random_rom_wb_i
188
        (
189
        .dat_o(iwb_dat_i),
190
        .adr_i(iwb_adr_o[25:2]),
191
        .sel_i(iwb_sel_o),
192
        .cyc_i(iwb_cyc_o),
193
        .stb_i(iwb_stb_o),
194
        .ack_o(iwb_ack_i),
195
        .clk_i(clk),
196
        .rst_i(rst) );
197
 
198
/////////////////////////////////////////////////
199
//      Instantiation of OR1200
200
/////////////////////////////////////////////////
201
 
202
or1200_top or1200_top_i
203
     (
204
        // System
205
        .clk_i(clk),
206
        .rst_i(rst),
207
        .pic_ints_i(pic_ints_i),
208
        .clmode_i(clmode_i),
209
 
210
        // Instruction WISHBONE INTERFACE
211
        //.iwb_clk_i(clk), 
212
        //.iwb_rst_i(rst), 
213
        .iwb_ack_i(iwb_ack_i),
214
        .iwb_err_i(iwb_err_i),
215
        .iwb_rty_i(iwb_rty_i),
216
        .iwb_dat_i(iwb_dat_i),
217
        .iwb_cyc_o(iwb_cyc_o),
218
        .iwb_adr_o(iwb_adr_o),
219
        .iwb_stb_o(iwb_stb_o),
220
        .iwb_we_o(iwb_we_o),
221
        .iwb_sel_o(iwb_sel_o),
222
        .iwb_dat_o(iwb_dat_o),
223
`ifdef OR1200_WB_CAB
224
        .iwb_cab_o(iwb_cab_o),
225
`endif
226
`ifdef OR1200_WB_B3
227
        .iwb_cti_o(iwb_cti_o),
228
        .iwb_bte_o(iwb_bte_o),
229
`endif
230
        // Data WISHBONE INTERFACE
231
        //.dwb_clk_i(clk), 
232
        //.dwb_rst_i(rst), 
233
        .dwb_ack_i(dwb_ack_i),
234
        .dwb_err_i(dwb_err_i),
235
        .dwb_rty_i(dwb_rty_i),
236
        .dwb_dat_i(dwb_dat_i),
237
        .dwb_cyc_o(dwb_cyc_o),
238
        .dwb_adr_o(dwb_adr_o),
239
        .dwb_stb_o(dwb_stb_o),
240
        .dwb_we_o(dwb_we_o),
241
        .dwb_sel_o(dwb_sel_o),
242
        .dwb_dat_o(dwb_dat_o),
243
`ifdef OR1200_WB_CAB
244
        .dwb_cab_o(dwb_cab_o),
245
`endif
246
`ifdef OR1200_WB_B3
247
        .dwb_cti_o(dwb_cti_o),
248
        .dwb_bte_o(dwb_bte_o),
249
`endif
250
 
251
        // External Debug Interface
252
        .dbg_stall_i(dbg_stall_i),
253
        .dbg_ewt_i(dbg_ewt_i),
254
        .dbg_lss_o(dbg_lss_o),
255
        .dbg_is_o(dbg_is_o),
256
        .dbg_wp_o(dbg_wp_o),
257
        .dbg_bp_o(dbg_bp_o),
258
        .dbg_stb_i(dbg_stb_i),
259
        .dbg_we_i(dbg_we_i),
260
        .dbg_adr_i(dbg_adr_i),
261
        .dbg_dat_i(dbg_dat_i),
262
        .dbg_dat_o(dbg_dat_o),
263
        .dbg_ack_o(dbg_ack_o),
264
 
265
`ifdef OR1200_BIST
266
        // RAM BIST
267
        .mbist_si_i(mbist_si_i),
268
        .mbist_so_o(mbist_so_o),
269
        .mbist_ctrl_i(mbist_ctrl_i),
270
`endif
271
        // Power Management
272
        .pm_cpustall_i(pm_cpustall_i),
273
        .pm_clksd_o(pm_clksd_o),
274
        .pm_dc_gate_o(pm_dc_gate_o),
275
        .pm_ic_gate_o(pm_ic_gate_o),
276
        .pm_dmmu_gate_o(pm_dmmu_gate_o),
277
        .pm_immu_gate_o(pm_immu_gate_o),
278
        .pm_tt_gate_o(pm_tt_gate_o),
279
        .pm_cpu_gate_o(pm_cpu_gate_o),
280
        .pm_wakeup_o(pm_wakeup_o),
281
        .pm_lvolt_o(pm_lvolt_o)
282
 
283
);
284
 
285
 
286
 
287
 
288
endmodule

powered by: WebSVN 2.1.0

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