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

Subversion Repositories openrisc

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

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

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

powered by: WebSVN 2.1.0

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