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

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [rtl/] [verilog/] [or1200/] [rtl/] [verilog/] [or1200_top.v] - Blame information for rev 1765

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

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

powered by: WebSVN 2.1.0

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