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

Subversion Repositories openrisc

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

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

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

powered by: WebSVN 2.1.0

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