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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or1200/] [rtl/] [verilog/] [or1200_top.v] - Blame information for rev 679

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

Line No. Rev Author Line
1 10 unneback
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  OR1200 Top Level                                            ////
4
////                                                              ////
5
////  This file is part of the OpenRISC 1200 project              ////
6 258 julius
////  http://opencores.org/project,or1k                           ////
7 10 unneback
////                                                              ////
8
////  Description                                                 ////
9
////  OR1200 Top Level                                            ////
10
////                                                              ////
11
////  To Do:                                                      ////
12
////   - make it smaller and faster                               ////
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 142 marcus.erl
// $Log: or1200_top.v,v $
47
// Revision 2.0  2010/06/30 11:00:00  ORSoC
48
// Major update: 
49
// Structure reordered. 
50
//
51 10 unneback
 
52
// synopsys translate_off
53
`include "timescale.v"
54
// synopsys translate_on
55
`include "or1200_defines.v"
56
 
57
module or1200_top(
58
        // System
59
        clk_i, rst_i, pic_ints_i, clmode_i,
60
 
61
        // Instruction WISHBONE INTERFACE
62
        iwb_clk_i, iwb_rst_i, iwb_ack_i, iwb_err_i, iwb_rty_i, iwb_dat_i,
63
        iwb_cyc_o, iwb_adr_o, iwb_stb_o, iwb_we_o, iwb_sel_o, iwb_dat_o,
64
`ifdef OR1200_WB_CAB
65
        iwb_cab_o,
66
`endif
67
`ifdef OR1200_WB_B3
68
        iwb_cti_o, iwb_bte_o,
69
`endif
70
        // Data WISHBONE INTERFACE
71
        dwb_clk_i, dwb_rst_i, dwb_ack_i, dwb_err_i, dwb_rty_i, dwb_dat_i,
72
        dwb_cyc_o, dwb_adr_o, dwb_stb_o, dwb_we_o, dwb_sel_o, dwb_dat_o,
73
`ifdef OR1200_WB_CAB
74
        dwb_cab_o,
75
`endif
76
`ifdef OR1200_WB_B3
77
        dwb_cti_o, dwb_bte_o,
78
`endif
79
 
80
        // External Debug Interface
81
        dbg_stall_i, dbg_ewt_i, dbg_lss_o, dbg_is_o, dbg_wp_o, dbg_bp_o,
82
        dbg_stb_i, dbg_we_i, dbg_adr_i, dbg_dat_i, dbg_dat_o, dbg_ack_o,
83
 
84
`ifdef OR1200_BIST
85
        // RAM BIST
86
        mbist_si_i, mbist_so_o, mbist_ctrl_i,
87
`endif
88
        // Power Management
89
        pm_cpustall_i,
90
        pm_clksd_o, pm_dc_gate_o, pm_ic_gate_o, pm_dmmu_gate_o,
91
        pm_immu_gate_o, pm_tt_gate_o, pm_cpu_gate_o, pm_wakeup_o, pm_lvolt_o
92
 
93 142 marcus.erl
,sig_tick
94
 
95 10 unneback
);
96
 
97
parameter dw = `OR1200_OPERAND_WIDTH;
98
parameter aw = `OR1200_OPERAND_WIDTH;
99
parameter ppic_ints = `OR1200_PIC_INTS;
100 679 olof
parameter boot_adr = `OR1200_BOOT_ADR;
101 10 unneback
 
102
//
103
// I/O
104
//
105
 
106
//
107
// System
108
//
109
input                   clk_i;
110
input                   rst_i;
111
input   [1:0]            clmode_i;       // 00 WB=RISC, 01 WB=RISC/2, 10 N/A, 11 WB=RISC/4
112
input   [ppic_ints-1:0]  pic_ints_i;
113
 
114
//
115
// Instruction WISHBONE interface
116
//
117
input                   iwb_clk_i;      // clock input
118
input                   iwb_rst_i;      // reset input
119
input                   iwb_ack_i;      // normal termination
120
input                   iwb_err_i;      // termination w/ error
121
input                   iwb_rty_i;      // termination w/ retry
122
input   [dw-1:0] iwb_dat_i;      // input data bus
123
output                  iwb_cyc_o;      // cycle valid output
124
output  [aw-1:0] iwb_adr_o;      // address bus outputs
125
output                  iwb_stb_o;      // strobe output
126
output                  iwb_we_o;       // indicates write transfer
127
output  [3:0]            iwb_sel_o;      // byte select outputs
128
output  [dw-1:0] iwb_dat_o;      // output data bus
129
`ifdef OR1200_WB_CAB
130
output                  iwb_cab_o;      // indicates consecutive address burst
131
`endif
132
`ifdef OR1200_WB_B3
133
output  [2:0]            iwb_cti_o;      // cycle type identifier
134
output  [1:0]            iwb_bte_o;      // burst type extension
135
`endif
136
 
137
//
138
// Data WISHBONE interface
139
//
140
input                   dwb_clk_i;      // clock input
141
input                   dwb_rst_i;      // reset input
142
input                   dwb_ack_i;      // normal termination
143
input                   dwb_err_i;      // termination w/ error
144
input                   dwb_rty_i;      // termination w/ retry
145
input   [dw-1:0] dwb_dat_i;      // input data bus
146
output                  dwb_cyc_o;      // cycle valid output
147
output  [aw-1:0] dwb_adr_o;      // address bus outputs
148
output                  dwb_stb_o;      // strobe output
149
output                  dwb_we_o;       // indicates write transfer
150
output  [3:0]            dwb_sel_o;      // byte select outputs
151
output  [dw-1:0] dwb_dat_o;      // output data bus
152
`ifdef OR1200_WB_CAB
153
output                  dwb_cab_o;      // indicates consecutive address burst
154
`endif
155
`ifdef OR1200_WB_B3
156
output  [2:0]            dwb_cti_o;      // cycle type identifier
157
output  [1:0]            dwb_bte_o;      // burst type extension
158
`endif
159
 
160
//
161
// External Debug Interface
162
//
163
input                   dbg_stall_i;    // External Stall Input
164
input                   dbg_ewt_i;      // External Watchpoint Trigger Input
165
output  [3:0]            dbg_lss_o;      // External Load/Store Unit Status
166
output  [1:0]            dbg_is_o;       // External Insn Fetch Status
167
output  [10:0]           dbg_wp_o;       // Watchpoints Outputs
168
output                  dbg_bp_o;       // Breakpoint Output
169
input                   dbg_stb_i;      // External Address/Data Strobe
170
input                   dbg_we_i;       // External Write Enable
171
input   [aw-1:0] dbg_adr_i;      // External Address Input
172
input   [dw-1:0] dbg_dat_i;      // External Data Input
173
output  [dw-1:0] dbg_dat_o;      // External Data Output
174
output                  dbg_ack_o;      // External Data Acknowledge (not WB compatible)
175
 
176
`ifdef OR1200_BIST
177
//
178
// RAM BIST
179
//
180
input mbist_si_i;
181
input [`OR1200_MBIST_CTRL_WIDTH - 1:0] mbist_ctrl_i;
182
output mbist_so_o;
183
`endif
184
 
185
//
186
// Power Management
187
//
188
input                   pm_cpustall_i;
189
output  [3:0]            pm_clksd_o;
190
output                  pm_dc_gate_o;
191
output                  pm_ic_gate_o;
192
output                  pm_dmmu_gate_o;
193
output                  pm_immu_gate_o;
194
output                  pm_tt_gate_o;
195
output                  pm_cpu_gate_o;
196
output                  pm_wakeup_o;
197
output                  pm_lvolt_o;
198
 
199
 
200
//
201
// Internal wires and regs
202
//
203
 
204
//
205
// DC to SB
206
//
207
wire    [dw-1:0] dcsb_dat_dc;
208
wire    [aw-1:0] dcsb_adr_dc;
209
wire                    dcsb_cyc_dc;
210
wire                    dcsb_stb_dc;
211
wire                    dcsb_we_dc;
212
wire    [3:0]            dcsb_sel_dc;
213
wire                    dcsb_cab_dc;
214
wire    [dw-1:0] dcsb_dat_sb;
215
wire                    dcsb_ack_sb;
216
wire                    dcsb_err_sb;
217
 
218
//
219
// SB to BIU
220
//
221
wire    [dw-1:0] sbbiu_dat_sb;
222
wire    [aw-1:0] sbbiu_adr_sb;
223
wire                    sbbiu_cyc_sb;
224
wire                    sbbiu_stb_sb;
225
wire                    sbbiu_we_sb;
226
wire    [3:0]            sbbiu_sel_sb;
227
wire                    sbbiu_cab_sb;
228
wire    [dw-1:0] sbbiu_dat_biu;
229
wire                    sbbiu_ack_biu;
230
wire                    sbbiu_err_biu;
231
 
232
//
233
// IC to BIU
234
//
235
wire    [dw-1:0] icbiu_dat_ic;
236
wire    [aw-1:0] icbiu_adr_ic;
237 142 marcus.erl
wire    [aw-1:0] icbiu_adr_ic_word;
238 10 unneback
wire                    icbiu_cyc_ic;
239
wire                    icbiu_stb_ic;
240
wire                    icbiu_we_ic;
241
wire    [3:0]            icbiu_sel_ic;
242
wire    [3:0]            icbiu_tag_ic;
243
wire                    icbiu_cab_ic;
244
wire    [dw-1:0] icbiu_dat_biu;
245
wire                    icbiu_ack_biu;
246
wire                    icbiu_err_biu;
247
wire    [3:0]            icbiu_tag_biu;
248
 
249
//
250 142 marcus.erl
// SR Interface (this signal can be connected to the input pin)
251
//
252
wire                    boot_adr_sel = `OR1200_SR_EPH_DEF;
253
 
254
//
255 10 unneback
// CPU's SPR access to various RISC units (shared wires)
256
//
257
wire                    supv;
258
wire    [aw-1:0] spr_addr;
259
wire    [dw-1:0] spr_dat_cpu;
260
wire    [31:0]           spr_cs;
261
wire                    spr_we;
262 364 julius
wire                    mtspr_dc_done;
263
 
264 10 unneback
//
265 142 marcus.erl
// SB
266
//
267
wire                    sb_en;
268
 
269
//
270 10 unneback
// DMMU and CPU
271
//
272
wire                    dmmu_en;
273
wire    [31:0]           spr_dat_dmmu;
274
 
275
//
276
// DMMU and QMEM
277
//
278
wire                    qmemdmmu_err_qmem;
279
wire    [3:0]            qmemdmmu_tag_qmem;
280
wire    [aw-1:0] qmemdmmu_adr_dmmu;
281
wire                    qmemdmmu_cycstb_dmmu;
282
wire                    qmemdmmu_ci_dmmu;
283
 
284
//
285
// CPU and data memory subsystem
286
//
287
wire                    dc_en;
288
wire    [31:0]           dcpu_adr_cpu;
289
wire                    dcpu_cycstb_cpu;
290
wire                    dcpu_we_cpu;
291
wire    [3:0]            dcpu_sel_cpu;
292
wire    [3:0]            dcpu_tag_cpu;
293
wire    [31:0]           dcpu_dat_cpu;
294
wire    [31:0]           dcpu_dat_qmem;
295
wire                    dcpu_ack_qmem;
296
wire                    dcpu_rty_qmem;
297
wire                    dcpu_err_dmmu;
298
wire    [3:0]            dcpu_tag_dmmu;
299 258 julius
wire                    dc_no_writethrough;
300
 
301 10 unneback
//
302
// IMMU and CPU
303
//
304
wire                    immu_en;
305
wire    [31:0]           spr_dat_immu;
306
 
307
//
308
// CPU and insn memory subsystem
309
//
310
wire                    ic_en;
311
wire    [31:0]           icpu_adr_cpu;
312
wire                    icpu_cycstb_cpu;
313
wire    [3:0]            icpu_sel_cpu;
314
wire    [3:0]            icpu_tag_cpu;
315
wire    [31:0]           icpu_dat_qmem;
316
wire                    icpu_ack_qmem;
317
wire    [31:0]           icpu_adr_immu;
318
wire                    icpu_err_immu;
319
wire    [3:0]            icpu_tag_immu;
320
wire                    icpu_rty_immu;
321
 
322
//
323
// IMMU and QMEM
324
//
325
wire    [aw-1:0] qmemimmu_adr_immu;
326
wire                    qmemimmu_rty_qmem;
327
wire                    qmemimmu_err_qmem;
328
wire    [3:0]            qmemimmu_tag_qmem;
329
wire                    qmemimmu_cycstb_immu;
330
wire                    qmemimmu_ci_immu;
331
 
332
//
333
// QMEM and IC
334
//
335
wire    [aw-1:0] icqmem_adr_qmem;
336
wire                    icqmem_rty_ic;
337
wire                    icqmem_err_ic;
338
wire    [3:0]            icqmem_tag_ic;
339
wire                    icqmem_cycstb_qmem;
340
wire                    icqmem_ci_qmem;
341
wire    [31:0]           icqmem_dat_ic;
342
wire                    icqmem_ack_ic;
343
 
344
//
345
// QMEM and DC
346
//
347
wire    [aw-1:0] dcqmem_adr_qmem;
348
wire                    dcqmem_rty_dc;
349
wire                    dcqmem_err_dc;
350
wire    [3:0]            dcqmem_tag_dc;
351
wire                    dcqmem_cycstb_qmem;
352
wire                    dcqmem_ci_qmem;
353
wire    [31:0]           dcqmem_dat_dc;
354
wire    [31:0]           dcqmem_dat_qmem;
355
wire                    dcqmem_we_qmem;
356
wire    [3:0]            dcqmem_sel_qmem;
357
wire                    dcqmem_ack_dc;
358
 
359
//
360
// Connection between CPU and PIC
361
//
362
wire    [dw-1:0] spr_dat_pic;
363
wire                    pic_wakeup;
364
wire                    sig_int;
365
 
366
//
367
// Connection between CPU and PM
368
//
369
wire    [dw-1:0] spr_dat_pm;
370
 
371
//
372
// CPU and TT
373
//
374
wire    [dw-1:0] spr_dat_tt;
375 142 marcus.erl
output wire                     sig_tick; // jb
376 10 unneback
 
377
//
378
// Debug port and caches/MMUs
379
//
380
wire    [dw-1:0] spr_dat_du;
381
wire                    du_stall;
382
wire    [dw-1:0] du_addr;
383
wire    [dw-1:0] du_dat_du;
384
wire                    du_read;
385
wire                    du_write;
386 185 julius
wire    [13:0]           du_except_trig;
387
wire    [13:0]           du_except_stop;
388 10 unneback
wire    [`OR1200_DU_DSR_WIDTH-1:0]     du_dsr;
389 142 marcus.erl
wire    [24:0]           du_dmr1;
390 10 unneback
wire    [dw-1:0] du_dat_cpu;
391 142 marcus.erl
wire    [dw-1:0] du_lsu_store_dat;
392
wire    [dw-1:0] du_lsu_load_dat;
393 10 unneback
wire                    du_hwbkpt;
394 142 marcus.erl
wire                    du_hwbkpt_ls_r = 1'b0;
395
wire                    flushpipe;
396 10 unneback
wire                    ex_freeze;
397 142 marcus.erl
wire                    wb_freeze;
398
wire                    id_void;
399
wire                    ex_void;
400
wire    [31:0]           id_insn;
401 10 unneback
wire    [31:0]           ex_insn;
402 142 marcus.erl
wire    [31:0]           wb_insn;
403 10 unneback
wire    [31:0]           id_pc;
404 142 marcus.erl
wire    [31:0]           ex_pc;
405
wire    [31:0]           wb_pc;
406 10 unneback
wire    [`OR1200_BRANCHOP_WIDTH-1:0]     branch_op;
407
wire    [31:0]           spr_dat_npc;
408
wire    [31:0]           rf_dataw;
409 142 marcus.erl
wire                    abort_ex;
410
wire                    abort_mvspr;
411 10 unneback
 
412
`ifdef OR1200_BIST
413
//
414
// RAM BIST
415
//
416
wire                    mbist_immu_so;
417
wire                    mbist_ic_so;
418
wire                    mbist_dmmu_so;
419
wire                    mbist_dc_so;
420 142 marcus.erl
wire                    mbist_qmem_so;
421 10 unneback
wire                    mbist_immu_si = mbist_si_i;
422
wire                    mbist_ic_si = mbist_immu_so;
423
wire                    mbist_qmem_si = mbist_ic_so;
424
wire                    mbist_dmmu_si = mbist_qmem_so;
425
wire                    mbist_dc_si = mbist_dmmu_so;
426
assign                  mbist_so_o = mbist_dc_so;
427
`endif
428
 
429
wire  [3:0] icqmem_sel_qmem;
430
wire  [3:0] icqmem_tag_qmem;
431
wire  [3:0] dcqmem_tag_qmem;
432
 
433
//
434
// Instantiation of Instruction WISHBONE BIU
435
//
436 481 julius
or1200_wb_biu
437
  #(.bl((1 << (`OR1200_ICLS-2))))
438
  iwb_biu(
439 10 unneback
        // RISC clk, rst and clock control
440
        .clk(clk_i),
441
        .rst(rst_i),
442
        .clmode(clmode_i),
443
 
444
        // WISHBONE interface
445
        .wb_clk_i(iwb_clk_i),
446
        .wb_rst_i(iwb_rst_i),
447
        .wb_ack_i(iwb_ack_i),
448
        .wb_err_i(iwb_err_i),
449
        .wb_rty_i(iwb_rty_i),
450
        .wb_dat_i(iwb_dat_i),
451
        .wb_cyc_o(iwb_cyc_o),
452
        .wb_adr_o(iwb_adr_o),
453
        .wb_stb_o(iwb_stb_o),
454
        .wb_we_o(iwb_we_o),
455
        .wb_sel_o(iwb_sel_o),
456
        .wb_dat_o(iwb_dat_o),
457
`ifdef OR1200_WB_CAB
458
        .wb_cab_o(iwb_cab_o),
459
`endif
460
`ifdef OR1200_WB_B3
461
        .wb_cti_o(iwb_cti_o),
462
        .wb_bte_o(iwb_bte_o),
463
`endif
464
 
465
        // Internal RISC bus
466
        .biu_dat_i(icbiu_dat_ic),
467 142 marcus.erl
        .biu_adr_i(icbiu_adr_ic_word),
468 10 unneback
        .biu_cyc_i(icbiu_cyc_ic),
469
        .biu_stb_i(icbiu_stb_ic),
470
        .biu_we_i(icbiu_we_ic),
471
        .biu_sel_i(icbiu_sel_ic),
472
        .biu_cab_i(icbiu_cab_ic),
473
        .biu_dat_o(icbiu_dat_biu),
474
        .biu_ack_o(icbiu_ack_biu),
475
        .biu_err_o(icbiu_err_biu)
476
);
477 142 marcus.erl
assign icbiu_adr_ic_word = {icbiu_adr_ic[31:2], 2'h0};
478 10 unneback
 
479
//
480
// Instantiation of Data WISHBONE BIU
481
//
482 481 julius
or1200_wb_biu
483
  #(.bl((1 << (`OR1200_DCLS-2))))
484
  dwb_biu(
485 10 unneback
        // RISC clk, rst and clock control
486
        .clk(clk_i),
487
        .rst(rst_i),
488
        .clmode(clmode_i),
489
 
490
        // WISHBONE interface
491
        .wb_clk_i(dwb_clk_i),
492
        .wb_rst_i(dwb_rst_i),
493
        .wb_ack_i(dwb_ack_i),
494
        .wb_err_i(dwb_err_i),
495
        .wb_rty_i(dwb_rty_i),
496
        .wb_dat_i(dwb_dat_i),
497
        .wb_cyc_o(dwb_cyc_o),
498
        .wb_adr_o(dwb_adr_o),
499
        .wb_stb_o(dwb_stb_o),
500
        .wb_we_o(dwb_we_o),
501
        .wb_sel_o(dwb_sel_o),
502
        .wb_dat_o(dwb_dat_o),
503
`ifdef OR1200_WB_CAB
504
        .wb_cab_o(dwb_cab_o),
505
`endif
506
`ifdef OR1200_WB_B3
507
        .wb_cti_o(dwb_cti_o),
508
        .wb_bte_o(dwb_bte_o),
509
`endif
510
 
511
        // Internal RISC bus
512
        .biu_dat_i(sbbiu_dat_sb),
513
        .biu_adr_i(sbbiu_adr_sb),
514
        .biu_cyc_i(sbbiu_cyc_sb),
515
        .biu_stb_i(sbbiu_stb_sb),
516
        .biu_we_i(sbbiu_we_sb),
517
        .biu_sel_i(sbbiu_sel_sb),
518
        .biu_cab_i(sbbiu_cab_sb),
519
        .biu_dat_o(sbbiu_dat_biu),
520
        .biu_ack_o(sbbiu_ack_biu),
521
        .biu_err_o(sbbiu_err_biu)
522
);
523
 
524
//
525
// Instantiation of IMMU
526
//
527 679 olof
or1200_immu_top
528
#(.boot_adr(boot_adr))
529
or1200_immu_top(
530 10 unneback
        // Rst and clk
531
        .clk(clk_i),
532
        .rst(rst_i),
533
 
534
`ifdef OR1200_BIST
535
        // RAM BIST
536
        .mbist_si_i(mbist_immu_si),
537
        .mbist_so_o(mbist_immu_so),
538
        .mbist_ctrl_i(mbist_ctrl_i),
539
`endif
540
 
541
        // CPU and IMMU
542
        .ic_en(ic_en),
543
        .immu_en(immu_en),
544
        .supv(supv),
545
        .icpu_adr_i(icpu_adr_cpu),
546
        .icpu_cycstb_i(icpu_cycstb_cpu),
547
        .icpu_adr_o(icpu_adr_immu),
548
        .icpu_tag_o(icpu_tag_immu),
549
        .icpu_rty_o(icpu_rty_immu),
550
        .icpu_err_o(icpu_err_immu),
551
 
552 142 marcus.erl
        // SR Interface
553
        .boot_adr_sel_i(boot_adr_sel),
554
 
555 10 unneback
        // SPR access
556
        .spr_cs(spr_cs[`OR1200_SPR_GROUP_IMMU]),
557
        .spr_write(spr_we),
558
        .spr_addr(spr_addr),
559
        .spr_dat_i(spr_dat_cpu),
560
        .spr_dat_o(spr_dat_immu),
561
 
562
        // QMEM and IMMU
563
        .qmemimmu_rty_i(qmemimmu_rty_qmem),
564
        .qmemimmu_err_i(qmemimmu_err_qmem),
565
        .qmemimmu_tag_i(qmemimmu_tag_qmem),
566
        .qmemimmu_adr_o(qmemimmu_adr_immu),
567
        .qmemimmu_cycstb_o(qmemimmu_cycstb_immu),
568
        .qmemimmu_ci_o(qmemimmu_ci_immu)
569
);
570
 
571
//
572
// Instantiation of Instruction Cache
573
//
574
or1200_ic_top or1200_ic_top(
575
        .clk(clk_i),
576
        .rst(rst_i),
577
 
578
`ifdef OR1200_BIST
579
        // RAM BIST
580
        .mbist_si_i(mbist_ic_si),
581
        .mbist_so_o(mbist_ic_so),
582
        .mbist_ctrl_i(mbist_ctrl_i),
583
`endif
584
 
585
        // IC and QMEM
586
        .ic_en(ic_en),
587
        .icqmem_adr_i(icqmem_adr_qmem),
588
        .icqmem_cycstb_i(icqmem_cycstb_qmem),
589
        .icqmem_ci_i(icqmem_ci_qmem),
590
        .icqmem_sel_i(icqmem_sel_qmem),
591
        .icqmem_tag_i(icqmem_tag_qmem),
592
        .icqmem_dat_o(icqmem_dat_ic),
593
        .icqmem_ack_o(icqmem_ack_ic),
594
        .icqmem_rty_o(icqmem_rty_ic),
595
        .icqmem_err_o(icqmem_err_ic),
596
        .icqmem_tag_o(icqmem_tag_ic),
597
 
598
        // SPR access
599
        .spr_cs(spr_cs[`OR1200_SPR_GROUP_IC]),
600
        .spr_write(spr_we),
601
        .spr_dat_i(spr_dat_cpu),
602
 
603
        // IC and BIU
604
        .icbiu_dat_o(icbiu_dat_ic),
605
        .icbiu_adr_o(icbiu_adr_ic),
606
        .icbiu_cyc_o(icbiu_cyc_ic),
607
        .icbiu_stb_o(icbiu_stb_ic),
608
        .icbiu_we_o(icbiu_we_ic),
609
        .icbiu_sel_o(icbiu_sel_ic),
610
        .icbiu_cab_o(icbiu_cab_ic),
611
        .icbiu_dat_i(icbiu_dat_biu),
612
        .icbiu_ack_i(icbiu_ack_biu),
613
        .icbiu_err_i(icbiu_err_biu)
614
);
615
 
616
//
617
// Instantiation of Instruction Cache
618
//
619
or1200_cpu or1200_cpu(
620
        .clk(clk_i),
621
        .rst(rst_i),
622
 
623
        // Connection QMEM and IFETCHER inside CPU
624
        .ic_en(ic_en),
625
        .icpu_adr_o(icpu_adr_cpu),
626
        .icpu_cycstb_o(icpu_cycstb_cpu),
627
        .icpu_sel_o(icpu_sel_cpu),
628
        .icpu_tag_o(icpu_tag_cpu),
629
        .icpu_dat_i(icpu_dat_qmem),
630
        .icpu_ack_i(icpu_ack_qmem),
631
        .icpu_rty_i(icpu_rty_immu),
632
        .icpu_adr_i(icpu_adr_immu),
633
        .icpu_err_i(icpu_err_immu),
634
        .icpu_tag_i(icpu_tag_immu),
635
 
636
        // Connection CPU to external Debug port
637 142 marcus.erl
        .id_void(id_void),
638
        .id_insn(id_insn),
639
        .ex_void(ex_void),
640
        .ex_insn(ex_insn),
641 10 unneback
        .ex_freeze(ex_freeze),
642 142 marcus.erl
        .wb_insn(wb_insn),
643
        .wb_freeze(wb_freeze),
644 10 unneback
        .id_pc(id_pc),
645 142 marcus.erl
        .ex_pc(ex_pc),
646
        .wb_pc(wb_pc),
647 10 unneback
        .branch_op(branch_op),
648 142 marcus.erl
        .rf_dataw(rf_dataw),
649
        .ex_flushpipe(flushpipe),
650 10 unneback
        .du_stall(du_stall),
651
        .du_addr(du_addr),
652
        .du_dat_du(du_dat_du),
653
        .du_read(du_read),
654
        .du_write(du_write),
655 142 marcus.erl
        .du_except_trig(du_except_trig),
656
        .du_except_stop(du_except_stop),
657 10 unneback
        .du_dsr(du_dsr),
658 142 marcus.erl
        .du_dmr1(du_dmr1),
659
        .du_hwbkpt(du_hwbkpt),
660
        .du_hwbkpt_ls_r(du_hwbkpt_ls_r),
661 10 unneback
        .du_dat_cpu(du_dat_cpu),
662 142 marcus.erl
        .du_lsu_store_dat(du_lsu_store_dat),
663
        .du_lsu_load_dat(du_lsu_load_dat),
664
        .abort_mvspr(abort_mvspr),
665
        .abort_ex(abort_ex),
666 10 unneback
 
667
        // Connection IMMU and CPU internally
668
        .immu_en(immu_en),
669
 
670
        // Connection QMEM and CPU
671
        .dc_en(dc_en),
672
        .dcpu_adr_o(dcpu_adr_cpu),
673
        .dcpu_cycstb_o(dcpu_cycstb_cpu),
674
        .dcpu_we_o(dcpu_we_cpu),
675
        .dcpu_sel_o(dcpu_sel_cpu),
676
        .dcpu_tag_o(dcpu_tag_cpu),
677
        .dcpu_dat_o(dcpu_dat_cpu),
678
        .dcpu_dat_i(dcpu_dat_qmem),
679
        .dcpu_ack_i(dcpu_ack_qmem),
680
        .dcpu_rty_i(dcpu_rty_qmem),
681
        .dcpu_err_i(dcpu_err_dmmu),
682
        .dcpu_tag_i(dcpu_tag_dmmu),
683 258 julius
        .dc_no_writethrough(dc_no_writethrough),
684 10 unneback
 
685
        // Connection DMMU and CPU internally
686
        .dmmu_en(dmmu_en),
687
 
688 142 marcus.erl
        // SR Interface
689
        .boot_adr_sel_i(boot_adr_sel),
690
 
691
        // SB Enable
692
        .sb_en(sb_en),
693
 
694 10 unneback
        // Connection PIC and CPU's EXCEPT
695
        .sig_int(sig_int),
696
        .sig_tick(sig_tick),
697
 
698
        // SPRs
699
        .supv(supv),
700
        .spr_addr(spr_addr),
701
        .spr_dat_cpu(spr_dat_cpu),
702
        .spr_dat_pic(spr_dat_pic),
703
        .spr_dat_tt(spr_dat_tt),
704
        .spr_dat_pm(spr_dat_pm),
705
        .spr_dat_dmmu(spr_dat_dmmu),
706
        .spr_dat_immu(spr_dat_immu),
707
        .spr_dat_du(spr_dat_du),
708
        .spr_dat_npc(spr_dat_npc),
709
        .spr_cs(spr_cs),
710 258 julius
        .spr_we(spr_we),
711
        .mtspr_dc_done(mtspr_dc_done)
712 10 unneback
);
713
 
714
//
715
// Instantiation of DMMU
716
//
717
or1200_dmmu_top or1200_dmmu_top(
718
        // Rst and clk
719
        .clk(clk_i),
720
        .rst(rst_i),
721
 
722
`ifdef OR1200_BIST
723
        // RAM BIST
724
        .mbist_si_i(mbist_dmmu_si),
725
        .mbist_so_o(mbist_dmmu_so),
726
        .mbist_ctrl_i(mbist_ctrl_i),
727
`endif
728
 
729
        // CPU i/f
730
        .dc_en(dc_en),
731
        .dmmu_en(dmmu_en),
732
        .supv(supv),
733
        .dcpu_adr_i(dcpu_adr_cpu),
734
        .dcpu_cycstb_i(dcpu_cycstb_cpu),
735
        .dcpu_we_i(dcpu_we_cpu),
736
        .dcpu_tag_o(dcpu_tag_dmmu),
737
        .dcpu_err_o(dcpu_err_dmmu),
738
 
739
        // SPR access
740
        .spr_cs(spr_cs[`OR1200_SPR_GROUP_DMMU]),
741
        .spr_write(spr_we),
742
        .spr_addr(spr_addr),
743
        .spr_dat_i(spr_dat_cpu),
744
        .spr_dat_o(spr_dat_dmmu),
745
 
746
        // QMEM and DMMU
747
        .qmemdmmu_err_i(qmemdmmu_err_qmem),
748
        .qmemdmmu_tag_i(qmemdmmu_tag_qmem),
749
        .qmemdmmu_adr_o(qmemdmmu_adr_dmmu),
750
        .qmemdmmu_cycstb_o(qmemdmmu_cycstb_dmmu),
751
        .qmemdmmu_ci_o(qmemdmmu_ci_dmmu)
752
);
753
 
754
//
755
// Instantiation of Data Cache
756
//
757
or1200_dc_top or1200_dc_top(
758
        .clk(clk_i),
759
        .rst(rst_i),
760
 
761
`ifdef OR1200_BIST
762
        // RAM BIST
763
        .mbist_si_i(mbist_dc_si),
764
        .mbist_so_o(mbist_dc_so),
765
        .mbist_ctrl_i(mbist_ctrl_i),
766
`endif
767
 
768
        // DC and QMEM
769
        .dc_en(dc_en),
770
        .dcqmem_adr_i(dcqmem_adr_qmem),
771
        .dcqmem_cycstb_i(dcqmem_cycstb_qmem),
772
        .dcqmem_ci_i(dcqmem_ci_qmem),
773
        .dcqmem_we_i(dcqmem_we_qmem),
774
        .dcqmem_sel_i(dcqmem_sel_qmem),
775
        .dcqmem_tag_i(dcqmem_tag_qmem),
776
        .dcqmem_dat_i(dcqmem_dat_qmem),
777
        .dcqmem_dat_o(dcqmem_dat_dc),
778
        .dcqmem_ack_o(dcqmem_ack_dc),
779
        .dcqmem_rty_o(dcqmem_rty_dc),
780
        .dcqmem_err_o(dcqmem_err_dc),
781
        .dcqmem_tag_o(dcqmem_tag_dc),
782
 
783 258 julius
        .dc_no_writethrough(dc_no_writethrough),
784
 
785 10 unneback
        // SPR access
786
        .spr_cs(spr_cs[`OR1200_SPR_GROUP_DC]),
787 258 julius
        .spr_addr(spr_addr),
788 10 unneback
        .spr_write(spr_we),
789
        .spr_dat_i(spr_dat_cpu),
790 258 julius
        .mtspr_dc_done(mtspr_dc_done),
791 10 unneback
 
792
        // DC and BIU
793
        .dcsb_dat_o(dcsb_dat_dc),
794
        .dcsb_adr_o(dcsb_adr_dc),
795
        .dcsb_cyc_o(dcsb_cyc_dc),
796
        .dcsb_stb_o(dcsb_stb_dc),
797
        .dcsb_we_o(dcsb_we_dc),
798
        .dcsb_sel_o(dcsb_sel_dc),
799
        .dcsb_cab_o(dcsb_cab_dc),
800
        .dcsb_dat_i(dcsb_dat_sb),
801
        .dcsb_ack_i(dcsb_ack_sb),
802
        .dcsb_err_i(dcsb_err_sb)
803
);
804
 
805
//
806
// Instantiation of embedded memory - qmem
807
//
808
or1200_qmem_top or1200_qmem_top(
809
        .clk(clk_i),
810
        .rst(rst_i),
811
 
812
`ifdef OR1200_BIST
813
        // RAM BIST
814
        .mbist_si_i(mbist_qmem_si),
815
        .mbist_so_o(mbist_qmem_so),
816
        .mbist_ctrl_i(mbist_ctrl_i),
817
`endif
818
 
819
        // QMEM and CPU/IMMU
820
        .qmemimmu_adr_i(qmemimmu_adr_immu),
821
        .qmemimmu_cycstb_i(qmemimmu_cycstb_immu),
822
        .qmemimmu_ci_i(qmemimmu_ci_immu),
823
        .qmemicpu_sel_i(icpu_sel_cpu),
824
        .qmemicpu_tag_i(icpu_tag_cpu),
825
        .qmemicpu_dat_o(icpu_dat_qmem),
826
        .qmemicpu_ack_o(icpu_ack_qmem),
827
        .qmemimmu_rty_o(qmemimmu_rty_qmem),
828
        .qmemimmu_err_o(qmemimmu_err_qmem),
829
        .qmemimmu_tag_o(qmemimmu_tag_qmem),
830
 
831
        // QMEM and IC
832
        .icqmem_adr_o(icqmem_adr_qmem),
833
        .icqmem_cycstb_o(icqmem_cycstb_qmem),
834
        .icqmem_ci_o(icqmem_ci_qmem),
835
        .icqmem_sel_o(icqmem_sel_qmem),
836
        .icqmem_tag_o(icqmem_tag_qmem),
837
        .icqmem_dat_i(icqmem_dat_ic),
838
        .icqmem_ack_i(icqmem_ack_ic),
839
        .icqmem_rty_i(icqmem_rty_ic),
840
        .icqmem_err_i(icqmem_err_ic),
841
        .icqmem_tag_i(icqmem_tag_ic),
842
 
843
        // QMEM and CPU/DMMU
844
        .qmemdmmu_adr_i(qmemdmmu_adr_dmmu),
845
        .qmemdmmu_cycstb_i(qmemdmmu_cycstb_dmmu),
846
        .qmemdmmu_ci_i(qmemdmmu_ci_dmmu),
847
        .qmemdcpu_we_i(dcpu_we_cpu),
848
        .qmemdcpu_sel_i(dcpu_sel_cpu),
849
        .qmemdcpu_tag_i(dcpu_tag_cpu),
850
        .qmemdcpu_dat_i(dcpu_dat_cpu),
851
        .qmemdcpu_dat_o(dcpu_dat_qmem),
852
        .qmemdcpu_ack_o(dcpu_ack_qmem),
853
        .qmemdcpu_rty_o(dcpu_rty_qmem),
854
        .qmemdmmu_err_o(qmemdmmu_err_qmem),
855
        .qmemdmmu_tag_o(qmemdmmu_tag_qmem),
856
 
857
        // QMEM and DC
858
        .dcqmem_adr_o(dcqmem_adr_qmem),
859
        .dcqmem_cycstb_o(dcqmem_cycstb_qmem),
860
        .dcqmem_ci_o(dcqmem_ci_qmem),
861
        .dcqmem_we_o(dcqmem_we_qmem),
862
        .dcqmem_sel_o(dcqmem_sel_qmem),
863
        .dcqmem_tag_o(dcqmem_tag_qmem),
864
        .dcqmem_dat_o(dcqmem_dat_qmem),
865
        .dcqmem_dat_i(dcqmem_dat_dc),
866
        .dcqmem_ack_i(dcqmem_ack_dc),
867
        .dcqmem_rty_i(dcqmem_rty_dc),
868
        .dcqmem_err_i(dcqmem_err_dc),
869
        .dcqmem_tag_i(dcqmem_tag_dc)
870
);
871
 
872
//
873
// Instantiation of Store Buffer
874
//
875
or1200_sb or1200_sb(
876
        // RISC clock, reset
877
        .clk(clk_i),
878
        .rst(rst_i),
879
 
880 142 marcus.erl
        // Internal RISC bus (SB)
881
        .sb_en(sb_en),
882
 
883 10 unneback
        // Internal RISC bus (DC<->SB)
884
        .dcsb_dat_i(dcsb_dat_dc),
885
        .dcsb_adr_i(dcsb_adr_dc),
886
        .dcsb_cyc_i(dcsb_cyc_dc),
887
        .dcsb_stb_i(dcsb_stb_dc),
888
        .dcsb_we_i(dcsb_we_dc),
889
        .dcsb_sel_i(dcsb_sel_dc),
890
        .dcsb_cab_i(dcsb_cab_dc),
891
        .dcsb_dat_o(dcsb_dat_sb),
892
        .dcsb_ack_o(dcsb_ack_sb),
893
        .dcsb_err_o(dcsb_err_sb),
894
 
895
        // SB and BIU
896
        .sbbiu_dat_o(sbbiu_dat_sb),
897
        .sbbiu_adr_o(sbbiu_adr_sb),
898
        .sbbiu_cyc_o(sbbiu_cyc_sb),
899
        .sbbiu_stb_o(sbbiu_stb_sb),
900
        .sbbiu_we_o(sbbiu_we_sb),
901
        .sbbiu_sel_o(sbbiu_sel_sb),
902
        .sbbiu_cab_o(sbbiu_cab_sb),
903
        .sbbiu_dat_i(sbbiu_dat_biu),
904
        .sbbiu_ack_i(sbbiu_ack_biu),
905
        .sbbiu_err_i(sbbiu_err_biu)
906
);
907
 
908
//
909
// Instantiation of Debug Unit
910
//
911
or1200_du or1200_du(
912
        // RISC Internal Interface
913
        .clk(clk_i),
914
        .rst(rst_i),
915
        .dcpu_cycstb_i(dcpu_cycstb_cpu),
916
        .dcpu_we_i(dcpu_we_cpu),
917
        .dcpu_adr_i(dcpu_adr_cpu),
918
        .dcpu_dat_lsu(dcpu_dat_cpu),
919
        .dcpu_dat_dc(dcpu_dat_qmem),
920
        .icpu_cycstb_i(icpu_cycstb_cpu),
921
        .ex_freeze(ex_freeze),
922
        .branch_op(branch_op),
923
        .ex_insn(ex_insn),
924
        .id_pc(id_pc),
925
        .du_dsr(du_dsr),
926 142 marcus.erl
        .du_dmr1(du_dmr1),
927 10 unneback
 
928
        // For Trace buffer
929
        .spr_dat_npc(spr_dat_npc),
930
        .rf_dataw(rf_dataw),
931
 
932
        // DU's access to SPR unit
933
        .du_stall(du_stall),
934
        .du_addr(du_addr),
935
        .du_dat_i(du_dat_cpu),
936
        .du_dat_o(du_dat_du),
937
        .du_read(du_read),
938
        .du_write(du_write),
939 142 marcus.erl
        .du_except_stop(du_except_stop),
940 10 unneback
        .du_hwbkpt(du_hwbkpt),
941
 
942
        // Access to DU's SPRs
943
        .spr_cs(spr_cs[`OR1200_SPR_GROUP_DU]),
944
        .spr_write(spr_we),
945
        .spr_addr(spr_addr),
946
        .spr_dat_i(spr_dat_cpu),
947
        .spr_dat_o(spr_dat_du),
948
 
949
        // External Debug Interface
950
        .dbg_stall_i(dbg_stall_i),
951
        .dbg_ewt_i(dbg_ewt_i),
952
        .dbg_lss_o(dbg_lss_o),
953
        .dbg_is_o(dbg_is_o),
954
        .dbg_wp_o(dbg_wp_o),
955
        .dbg_bp_o(dbg_bp_o),
956
        .dbg_stb_i(dbg_stb_i),
957
        .dbg_we_i(dbg_we_i),
958
        .dbg_adr_i(dbg_adr_i),
959
        .dbg_dat_i(dbg_dat_i),
960
        .dbg_dat_o(dbg_dat_o),
961
        .dbg_ack_o(dbg_ack_o)
962
);
963
 
964
//
965
// Programmable interrupt controller
966
//
967
or1200_pic or1200_pic(
968
        // RISC Internal Interface
969
        .clk(clk_i),
970
        .rst(rst_i),
971
        .spr_cs(spr_cs[`OR1200_SPR_GROUP_PIC]),
972
        .spr_write(spr_we),
973
        .spr_addr(spr_addr),
974
        .spr_dat_i(spr_dat_cpu),
975
        .spr_dat_o(spr_dat_pic),
976
        .pic_wakeup(pic_wakeup),
977
        .intr(sig_int),
978
 
979
        // PIC Interface
980
        .pic_int(pic_ints_i)
981
);
982
 
983
//
984
// Instantiation of Tick timer
985
//
986
or1200_tt or1200_tt(
987
        // RISC Internal Interface
988
        .clk(clk_i),
989
        .rst(rst_i),
990
        .du_stall(du_stall),
991
        .spr_cs(spr_cs[`OR1200_SPR_GROUP_TT]),
992
        .spr_write(spr_we),
993
        .spr_addr(spr_addr),
994
        .spr_dat_i(spr_dat_cpu),
995
        .spr_dat_o(spr_dat_tt),
996
        .intr(sig_tick)
997
);
998
 
999
//
1000
// Instantiation of Power Management
1001
//
1002
or1200_pm or1200_pm(
1003
        // RISC Internal Interface
1004
        .clk(clk_i),
1005
        .rst(rst_i),
1006
        .pic_wakeup(pic_wakeup),
1007
        .spr_write(spr_we),
1008
        .spr_addr(spr_addr),
1009
        .spr_dat_i(spr_dat_cpu),
1010
        .spr_dat_o(spr_dat_pm),
1011
 
1012
        // Power Management Interface
1013
        .pm_cpustall(pm_cpustall_i),
1014
        .pm_clksd(pm_clksd_o),
1015
        .pm_dc_gate(pm_dc_gate_o),
1016
        .pm_ic_gate(pm_ic_gate_o),
1017
        .pm_dmmu_gate(pm_dmmu_gate_o),
1018
        .pm_immu_gate(pm_immu_gate_o),
1019
        .pm_tt_gate(pm_tt_gate_o),
1020
        .pm_cpu_gate(pm_cpu_gate_o),
1021
        .pm_wakeup(pm_wakeup_o),
1022
        .pm_lvolt(pm_lvolt_o)
1023
);
1024
 
1025
 
1026
endmodule

powered by: WebSVN 2.1.0

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