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

Subversion Repositories or1200_hp

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

powered by: WebSVN 2.1.0

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