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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [or1200/] [rtl/] [verilog/] [or1200_top.v] - Blame information for rev 1267

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

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

powered by: WebSVN 2.1.0

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