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

Subversion Repositories or1k

[/] [or1k/] [branches/] [branch_qmem/] [or1200/] [rtl/] [verilog/] [or1200_top.v] - Blame information for rev 1171

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

powered by: WebSVN 2.1.0

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