OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

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

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

powered by: WebSVN 2.1.0

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