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

Subversion Repositories or1k

[/] [or1k/] [tags/] [rel_5/] [or1200/] [rtl/] [verilog/] [or1200_cpu.v] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 504 lampret
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  OR1200's CPU                                                ////
4
////                                                              ////
5
////  This file is part of the OpenRISC 1200 project              ////
6
////  http://www.opencores.org/cores/or1k/                        ////
7
////                                                              ////
8
////  Description                                                 ////
9
////  Instantiation of internal CPU blocks. IFETCH, SPRS, FRZ,    ////
10
////  ALU, EXCEPT, ID, WBMUX, OPERANDMUX, RF etc.                 ////
11
////                                                              ////
12
////  To Do:                                                      ////
13
////   - make it smaller and faster                               ////
14
////                                                              ////
15
////  Author(s):                                                  ////
16
////      - Damjan Lampret, lampret@opencores.org                 ////
17
////                                                              ////
18
//////////////////////////////////////////////////////////////////////
19
////                                                              ////
20
//// Copyright (C) 2000 Authors and OPENCORES.ORG                 ////
21
////                                                              ////
22
//// This source file may be used and distributed without         ////
23
//// restriction provided that this copyright statement is not    ////
24
//// removed from the file and that any derivative work contains  ////
25
//// the original copyright notice and the associated disclaimer. ////
26
////                                                              ////
27
//// This source file is free software; you can redistribute it   ////
28
//// and/or modify it under the terms of the GNU Lesser General   ////
29
//// Public License as published by the Free Software Foundation; ////
30
//// either version 2.1 of the License, or (at your option) any   ////
31
//// later version.                                               ////
32
////                                                              ////
33
//// This source is distributed in the hope that it will be       ////
34
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
35
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
36
//// PURPOSE.  See the GNU Lesser General Public License for more ////
37
//// details.                                                     ////
38
////                                                              ////
39
//// You should have received a copy of the GNU Lesser General    ////
40
//// Public License along with this source; if not, download it   ////
41
//// from http://www.opencores.org/lgpl.shtml                     ////
42
////                                                              ////
43
//////////////////////////////////////////////////////////////////////
44
//
45
// CVS Revision History
46
//
47
// $Log: not supported by cvs2svn $
48 1032 lampret
// Revision 1.11  2002/08/28 01:44:25  lampret
49
// Removed some commented RTL. Fixed SR/ESR flag bug.
50
//
51 1011 lampret
// Revision 1.10  2002/07/14 22:17:17  lampret
52
// Added simple trace buffer [only for Xilinx Virtex target]. Fixed instruction fetch abort when new exception is recognized.
53
//
54 895 lampret
// Revision 1.9  2002/03/29 16:29:37  lampret
55
// Fixed some ports in instnatiations that were removed from the modules
56
//
57 791 lampret
// Revision 1.8  2002/03/29 15:16:54  lampret
58
// Some of the warnings fixed.
59
//
60 788 lampret
// Revision 1.7  2002/02/11 04:33:17  lampret
61
// Speed optimizations (removed duplicate _cyc_ and _stb_). Fixed D/IMMU cache-inhibit attr.
62
//
63 660 lampret
// Revision 1.6  2002/02/01 19:56:54  lampret
64
// Fixed combinational loops.
65
//
66 636 lampret
// Revision 1.5  2002/01/28 01:15:59  lampret
67
// 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.
68
//
69 617 lampret
// Revision 1.4  2002/01/18 14:21:43  lampret
70
// Fixed 'the NPC single-step fix'.
71
//
72 595 lampret
// Revision 1.3  2002/01/18 07:56:00  lampret
73
// No more low/high priority interrupts (PICPR removed). Added tick timer exception. Added exception prefix (SR[EPH]). Fixed single-step bug whenreading NPC.
74
//
75 589 lampret
// Revision 1.2  2002/01/14 06:18:22  lampret
76
// Fixed mem2reg bug in FAST implementation. Updated debug unit to work with new genpc/if.
77
//
78 562 lampret
// Revision 1.1  2002/01/03 08:16:15  lampret
79
// New prefixes for RTL files, prefixed module names. Updated cache controllers and MMUs.
80
//
81 504 lampret
// Revision 1.19  2001/11/30 18:59:47  simons
82
// *** empty log message ***
83
//
84
// Revision 1.18  2001/11/23 21:42:31  simons
85
// Program counter divided to PPC and NPC.
86
//
87
// Revision 1.17  2001/11/23 08:38:51  lampret
88
// Changed DSR/DRR behavior and exception detection.
89
//
90
// Revision 1.16  2001/11/20 00:57:22  lampret
91
// Fixed width of du_except.
92
//
93
// Revision 1.15  2001/11/18 09:58:28  lampret
94
// Fixed some l.trap typos.
95
//
96
// Revision 1.14  2001/11/18 08:36:28  lampret
97
// For GDB changed single stepping and disabled trap exception.
98
//
99
// Revision 1.13  2001/11/13 10:02:21  lampret
100
// Added 'setpc'. Renamed some signals (except_flushpipe into flushpipe etc)
101
//
102
// Revision 1.12  2001/11/12 01:45:40  lampret
103
// Moved flag bit into SR. Changed RF enable from constant enable to dynamic enable for read ports.
104
//
105
// Revision 1.11  2001/11/10 03:43:57  lampret
106
// Fixed exceptions.
107
//
108
// Revision 1.10  2001/10/21 17:57:16  lampret
109
// 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.
110
//
111
// Revision 1.9  2001/10/14 13:12:09  lampret
112
// MP3 version.
113
//
114
// Revision 1.1.1.1  2001/10/06 10:18:35  igorm
115
// no message
116
//
117
// Revision 1.4  2001/08/17 08:01:19  lampret
118
// IC enable/disable.
119
//
120
// Revision 1.3  2001/08/13 03:36:20  lampret
121
// Added cfg regs. Moved all defines into one defines.v file. More cleanup.
122
//
123
// Revision 1.2  2001/08/09 13:39:33  lampret
124
// Major clean-up.
125
//
126
// Revision 1.1  2001/07/20 00:46:03  lampret
127
// Development version of RTL. Libraries are missing.
128
//
129
//
130
 
131
// synopsys translate_off
132
`include "timescale.v"
133
// synopsys translate_on
134
`include "or1200_defines.v"
135
 
136
module or1200_cpu(
137
        // Clk & Rst
138
        clk, rst,
139
 
140
        // Insn interface
141
        ic_en,
142 788 lampret
        icpu_adr_o, icpu_cycstb_o, icpu_sel_o, icpu_tag_o,
143 504 lampret
        icpu_dat_i, icpu_ack_i, icpu_rty_i, icpu_err_i, icpu_adr_i, icpu_tag_i,
144
        immu_en,
145
 
146
        // Debug unit
147
        ex_insn, ex_freeze, branch_op,
148 895 lampret
        spr_dat_npc, rf_dataw,
149 636 lampret
        du_stall, du_addr, du_dat_du, du_read, du_write, du_dsr, du_except, du_dat_cpu,
150 504 lampret
 
151
        // Data interface
152
        dc_en,
153 660 lampret
        dcpu_adr_o, dcpu_cycstb_o, dcpu_we_o, dcpu_sel_o, dcpu_tag_o, dcpu_dat_o,
154 504 lampret
        dcpu_dat_i, dcpu_ack_i, dcpu_rty_i, dcpu_err_i, dcpu_tag_i,
155
        dmmu_en,
156
 
157 589 lampret
        // Interrupt & tick exceptions
158
        sig_int, sig_tick,
159 504 lampret
 
160
        // SPR interface
161 636 lampret
        supv, spr_addr, spr_dat_cpu, spr_dat_pic, spr_dat_tt, spr_dat_pm,
162 504 lampret
        spr_dat_dmmu, spr_dat_immu, spr_dat_du, spr_cs, spr_we
163
);
164
 
165
parameter dw = `OR1200_OPERAND_WIDTH;
166
parameter aw = `OR1200_REGFILE_ADDR_WIDTH;
167
 
168
//
169
// I/O ports
170
//
171
 
172
//
173
// Clk & Rst
174
//
175
input                           clk;
176
input                           rst;
177
 
178
//
179
// Insn (IC) interface
180
//
181
output                          ic_en;
182
output  [31:0]                   icpu_adr_o;
183 660 lampret
output                          icpu_cycstb_o;
184 504 lampret
output  [3:0]                    icpu_sel_o;
185
output  [3:0]                    icpu_tag_o;
186
input   [31:0]                   icpu_dat_i;
187
input                           icpu_ack_i;
188
input                           icpu_rty_i;
189
input                           icpu_err_i;
190
input   [31:0]                   icpu_adr_i;
191
input   [3:0]                    icpu_tag_i;
192
 
193
//
194
// Insn (IMMU) interface
195
//
196
output                          immu_en;
197
 
198
//
199
// Debug interface
200
//
201
output  [31:0]                   ex_insn;
202
output                          ex_freeze;
203
output  [`OR1200_BRANCHOP_WIDTH-1:0]     branch_op;
204 895 lampret
 
205 504 lampret
input                           du_stall;
206
input   [dw-1:0]         du_addr;
207
input   [dw-1:0]         du_dat_du;
208
input                           du_read;
209
input                           du_write;
210
input   [`OR1200_DU_DSR_WIDTH-1:0]       du_dsr;
211
output  [12:0]                   du_except;
212 636 lampret
output  [dw-1:0]         du_dat_cpu;
213 895 lampret
output  [dw-1:0]         rf_dataw;
214 504 lampret
 
215
//
216
// Data (DC) interface
217
//
218
output  [31:0]                   dcpu_adr_o;
219 660 lampret
output                          dcpu_cycstb_o;
220 504 lampret
output                          dcpu_we_o;
221
output  [3:0]                    dcpu_sel_o;
222
output  [3:0]                    dcpu_tag_o;
223
output  [31:0]                   dcpu_dat_o;
224
input   [31:0]                   dcpu_dat_i;
225
input                           dcpu_ack_i;
226
input                           dcpu_rty_i;
227
input                           dcpu_err_i;
228
input   [3:0]                    dcpu_tag_i;
229
output                          dc_en;
230
 
231
//
232
// Data (DMMU) interface
233
//
234
output                          dmmu_en;
235
 
236
//
237
// SPR interface
238
//
239
output                          supv;
240
input   [dw-1:0]         spr_dat_pic;
241
input   [dw-1:0]         spr_dat_tt;
242
input   [dw-1:0]         spr_dat_pm;
243
input   [dw-1:0]         spr_dat_dmmu;
244
input   [dw-1:0]         spr_dat_immu;
245
input   [dw-1:0]         spr_dat_du;
246
output  [dw-1:0]         spr_addr;
247 636 lampret
output  [dw-1:0]         spr_dat_cpu;
248 895 lampret
output  [dw-1:0]         spr_dat_npc;
249 504 lampret
output  [31:0]                   spr_cs;
250
output                          spr_we;
251
 
252
//
253
// Interrupt exceptions
254
//
255 589 lampret
input                           sig_int;
256
input                           sig_tick;
257 504 lampret
 
258
//
259
// Internal wires
260
//
261
wire    [31:0]                   if_insn;
262
wire    [31:0]                   if_pc;
263
wire    [31:2]                  lr_sav;
264
wire    [aw-1:0]         rf_addrw;
265
wire    [aw-1:0]                 rf_addra;
266
wire    [aw-1:0]                 rf_addrb;
267
wire                            rf_rda;
268
wire                            rf_rdb;
269
wire    [dw-1:0]         simm;
270
wire    [dw-1:2]                branch_addrofs;
271
wire    [`OR1200_ALUOP_WIDTH-1:0]        alu_op;
272
wire    [`OR1200_SHROTOP_WIDTH-1:0]      shrot_op;
273
wire    [`OR1200_COMPOP_WIDTH-1:0]       comp_op;
274
wire    [`OR1200_BRANCHOP_WIDTH-1:0]     branch_op;
275
wire    [`OR1200_LSUOP_WIDTH-1:0]        lsu_op;
276 562 lampret
wire                            genpc_freeze;
277 504 lampret
wire                            if_freeze;
278
wire                            id_freeze;
279
wire                            ex_freeze;
280
wire                            wb_freeze;
281
wire    [`OR1200_SEL_WIDTH-1:0]  sel_a;
282
wire    [`OR1200_SEL_WIDTH-1:0]  sel_b;
283
wire    [`OR1200_RFWBOP_WIDTH-1:0]       rfwb_op;
284
wire    [dw-1:0]         rf_dataw;
285
wire    [dw-1:0]         rf_dataa;
286
wire    [dw-1:0]         rf_datab;
287
wire    [dw-1:0]         muxed_b;
288
wire    [dw-1:0]         wb_forw;
289
wire                            wbforw_valid;
290
wire    [dw-1:0]         operand_a;
291
wire    [dw-1:0]         operand_b;
292
wire    [dw-1:0]         alu_dataout;
293
wire    [dw-1:0]         lsu_dataout;
294
wire    [dw-1:0]         sprs_dataout;
295
wire    [31:0]                   lsu_addrofs;
296
wire    [`OR1200_MULTICYCLE_WIDTH-1:0]   multicycle;
297
wire    [`OR1200_EXCEPT_WIDTH-1:0]       except_type;
298
wire                            flushpipe;
299
wire                            extend_flush;
300
wire                            branch_taken;
301
wire                            flag;
302
wire                            flagforw;
303
wire                            flag_we;
304 1032 lampret
wire                            carry;
305
wire                            cyforw;
306
wire                            cy_we;
307 504 lampret
wire                            lsu_stall;
308
wire                            epcr_we;
309
wire                            eear_we;
310
wire                            esr_we;
311
wire                            pc_we;
312
wire    [31:0]                   epcr;
313
wire    [31:0]                   eear;
314 1011 lampret
wire    [`OR1200_SR_WIDTH-1:0]   esr;
315
wire                            sr_we;
316
wire    [`OR1200_SR_WIDTH-1:0]   to_sr;
317
wire    [`OR1200_SR_WIDTH-1:0]   sr;
318 504 lampret
wire                            except_start;
319
wire                            except_started;
320
wire    [31:0]                   wb_insn;
321
wire    [15:0]                   spr_addrimm;
322
wire                            sig_syscall;
323
wire                            sig_trap;
324
wire    [31:0]                   spr_dat_cfgr;
325
wire    [31:0]                   spr_dat_rf;
326
wire    [31:0]                  spr_dat_npc;
327
wire    [31:0]                   spr_dat_ppc;
328
wire    [31:0]                   spr_dat_mac;
329
wire                            force_dslot_fetch;
330 617 lampret
wire                            no_more_dslot;
331 595 lampret
wire                            ex_void;
332 504 lampret
wire                            if_stall;
333
wire                            id_macrc_op;
334
wire                            ex_macrc_op;
335
wire    [`OR1200_MACOP_WIDTH-1:0] mac_op;
336
wire    [31:0]                   mult_mac_result;
337
wire                            mac_stall;
338
wire    [12:0]                   except_stop;
339
wire                            genpc_refetch;
340
wire                            rfe;
341
wire                            lsu_unstall;
342
wire                            except_align;
343
wire                            except_dtlbmiss;
344
wire                            except_dmmufault;
345
wire                            except_illegal;
346
wire                            except_itlbmiss;
347
wire                            except_immufault;
348
wire                            except_ibuserr;
349
wire                            except_dbuserr;
350 617 lampret
wire                            abort_ex;
351 504 lampret
 
352
//
353
// Send exceptions to Debug Unit
354
//
355
assign du_except = except_stop;
356
 
357
//
358
// Data cache enable
359
//
360
assign dc_en = sr[`OR1200_SR_DCE];
361
 
362
//
363
// Instruction cache enable
364
//
365
assign ic_en = sr[`OR1200_SR_ICE];
366
 
367
//
368
// DMMU enable
369
//
370
assign dmmu_en = sr[`OR1200_SR_DME];
371
 
372
//
373
// IMMU enable
374
//
375
assign immu_en = sr[`OR1200_SR_IME];
376
 
377
//
378
// SUPV bit
379
//
380 589 lampret
assign supv = sr[`OR1200_SR_SM];
381 504 lampret
 
382
//
383
// Instantiation of instruction fetch block
384
//
385
or1200_genpc or1200_genpc(
386
        .clk(clk),
387
        .rst(rst),
388
        .icpu_adr_o(icpu_adr_o),
389 660 lampret
        .icpu_cycstb_o(icpu_cycstb_o),
390 504 lampret
        .icpu_sel_o(icpu_sel_o),
391
        .icpu_tag_o(icpu_tag_o),
392
        .icpu_rty_i(icpu_rty_i),
393
        .icpu_adr_i(icpu_adr_i),
394
 
395
        .branch_op(branch_op),
396
        .except_type(except_type),
397
        .except_start(except_start),
398 589 lampret
        .except_prefix(sr[`OR1200_SR_EPH]),
399 504 lampret
        .branch_addrofs(branch_addrofs),
400
        .lr_restor(operand_b),
401
        .flag(flag),
402
        .taken(branch_taken),
403
        .binsn_addr(lr_sav),
404
        .epcr(epcr),
405 636 lampret
        .spr_dat_i(spr_dat_cpu),
406 504 lampret
        .spr_pc_we(pc_we),
407 562 lampret
        .genpc_refetch(genpc_refetch),
408
        .genpc_freeze(genpc_freeze),
409 617 lampret
        .no_more_dslot(no_more_dslot)
410 504 lampret
);
411
 
412
//
413
// Instantiation of instruction fetch block
414
//
415
or1200_if or1200_if(
416
        .clk(clk),
417
        .rst(rst),
418
        .icpu_dat_i(icpu_dat_i),
419
        .icpu_ack_i(icpu_ack_i),
420
        .icpu_err_i(icpu_err_i),
421
        .icpu_adr_i(icpu_adr_i),
422
        .icpu_tag_i(icpu_tag_i),
423
 
424
        .if_freeze(if_freeze),
425
        .if_insn(if_insn),
426
        .if_pc(if_pc),
427
        .flushpipe(flushpipe),
428
        .if_stall(if_stall),
429 617 lampret
        .no_more_dslot(no_more_dslot),
430 504 lampret
        .genpc_refetch(genpc_refetch),
431
        .rfe(rfe),
432
        .except_itlbmiss(except_itlbmiss),
433
        .except_immufault(except_immufault),
434
        .except_ibuserr(except_ibuserr)
435
);
436
 
437
//
438
// Instantiation of instruction decode/control logic
439
//
440
or1200_ctrl or1200_ctrl(
441
        .clk(clk),
442
        .rst(rst),
443
        .id_freeze(id_freeze),
444
        .ex_freeze(ex_freeze),
445
        .wb_freeze(wb_freeze),
446
        .flushpipe(flushpipe),
447
        .if_insn(if_insn),
448
        .ex_insn(ex_insn),
449
        .branch_op(branch_op),
450 617 lampret
        .branch_taken(branch_taken),
451 504 lampret
        .rf_addra(rf_addra),
452
        .rf_addrb(rf_addrb),
453
        .rf_rda(rf_rda),
454
        .rf_rdb(rf_rdb),
455
        .alu_op(alu_op),
456
        .mac_op(mac_op),
457
        .shrot_op(shrot_op),
458
        .comp_op(comp_op),
459
        .rf_addrw(rf_addrw),
460
        .rfwb_op(rfwb_op),
461
        .wb_insn(wb_insn),
462
        .simm(simm),
463
        .branch_addrofs(branch_addrofs),
464
        .lsu_addrofs(lsu_addrofs),
465
        .sel_a(sel_a),
466
        .sel_b(sel_b),
467
        .lsu_op(lsu_op),
468
        .multicycle(multicycle),
469
        .spr_addrimm(spr_addrimm),
470
        .wbforw_valid(wbforw_valid),
471
        .sig_syscall(sig_syscall),
472
        .sig_trap(sig_trap),
473
        .force_dslot_fetch(force_dslot_fetch),
474 617 lampret
        .no_more_dslot(no_more_dslot),
475 595 lampret
        .ex_void(ex_void),
476 504 lampret
        .id_macrc_op(id_macrc_op),
477
        .ex_macrc_op(ex_macrc_op),
478
        .rfe(rfe),
479
        .except_illegal(except_illegal)
480
);
481
 
482
//
483
// Instantiation of register file
484
//
485
or1200_rf or1200_rf(
486
        .clk(clk),
487
        .rst(rst),
488 589 lampret
        .supv(sr[`OR1200_SR_SM]),
489 504 lampret
        .wb_freeze(wb_freeze),
490
        .addrw(rf_addrw),
491
        .dataw(rf_dataw),
492
        .id_freeze(id_freeze),
493
        .we(rfwb_op[0]),
494
        .flushpipe(flushpipe),
495
        .addra(rf_addra),
496
        .rda(rf_rda),
497
        .dataa(rf_dataa),
498
        .addrb(rf_addrb),
499
        .rdb(rf_rdb),
500
        .datab(rf_datab),
501
        .spr_cs(spr_cs[`OR1200_SPR_GROUP_SYS]),
502
        .spr_write(spr_we),
503
        .spr_addr(spr_addr),
504 636 lampret
        .spr_dat_i(spr_dat_cpu),
505 504 lampret
        .spr_dat_o(spr_dat_rf)
506
);
507
 
508
//
509
// Instantiation of operand muxes
510
//
511
or1200_operandmuxes or1200_operandmuxes(
512
        .clk(clk),
513
        .rst(rst),
514
        .id_freeze(id_freeze),
515
        .ex_freeze(ex_freeze),
516
        .rf_dataa(rf_dataa),
517
        .rf_datab(rf_datab),
518
        .ex_forw(rf_dataw),
519
        .wb_forw(wb_forw),
520
        .simm(simm),
521
        .sel_a(sel_a),
522
        .sel_b(sel_b),
523
        .operand_a(operand_a),
524
        .operand_b(operand_b),
525
        .muxed_b(muxed_b)
526
);
527
 
528
//
529
// Instantiation of CPU's ALU
530
//
531
or1200_alu or1200_alu(
532
        .a(operand_a),
533
        .b(operand_b),
534
        .mult_mac_result(mult_mac_result),
535
        .macrc_op(ex_macrc_op),
536
        .alu_op(alu_op),
537
        .shrot_op(shrot_op),
538
        .comp_op(comp_op),
539
        .result(alu_dataout),
540
        .flagforw(flagforw),
541 1032 lampret
        .flag_we(flag_we),
542
        .cyforw(cyforw),
543
        .cy_we(cy_we),
544
        .carry(carry)
545 504 lampret
);
546
 
547
//
548
// Instantiation of CPU's ALU
549
//
550
or1200_mult_mac or1200_mult_mac(
551
        .clk(clk),
552
        .rst(rst),
553
        .ex_freeze(ex_freeze),
554
        .id_macrc_op(id_macrc_op),
555
        .macrc_op(ex_macrc_op),
556
        .a(operand_a),
557
        .b(operand_b),
558
        .mac_op(mac_op),
559
        .alu_op(alu_op),
560
        .result(mult_mac_result),
561
        .mac_stall_r(mac_stall),
562
        .spr_cs(spr_cs[`OR1200_SPR_GROUP_MAC]),
563
        .spr_write(spr_we),
564
        .spr_addr(spr_addr),
565 636 lampret
        .spr_dat_i(spr_dat_cpu),
566 504 lampret
        .spr_dat_o(spr_dat_mac)
567
);
568
 
569
//
570
// Instantiation of CPU's SPRS block
571
//
572
or1200_sprs or1200_sprs(
573
        .clk(clk),
574
        .rst(rst),
575
        .addrbase(operand_a),
576
        .addrofs(spr_addrimm),
577
        .dat_i(operand_b),
578
        .alu_op(alu_op),
579
        .flagforw(flagforw),
580
        .flag_we(flag_we),
581
        .flag(flag),
582 1032 lampret
        .cyforw(cyforw),
583
        .cy_we(cy_we),
584
        .carry(carry),
585 504 lampret
        .to_wbmux(sprs_dataout),
586
 
587
        .du_addr(du_addr),
588
        .du_dat_du(du_dat_du),
589
        .du_read(du_read),
590
        .du_write(du_write),
591 636 lampret
        .du_dat_cpu(du_dat_cpu),
592 504 lampret
 
593
        .spr_addr(spr_addr),
594
        .spr_dat_pic(spr_dat_pic),
595
        .spr_dat_tt(spr_dat_tt),
596
        .spr_dat_pm(spr_dat_pm),
597
        .spr_dat_cfgr(spr_dat_cfgr),
598
        .spr_dat_rf(spr_dat_rf),
599
        .spr_dat_npc(spr_dat_npc),
600
        .spr_dat_ppc(spr_dat_ppc),
601
        .spr_dat_mac(spr_dat_mac),
602
        .spr_dat_dmmu(spr_dat_dmmu),
603
        .spr_dat_immu(spr_dat_immu),
604
        .spr_dat_du(spr_dat_du),
605 636 lampret
        .spr_dat_o(spr_dat_cpu),
606 504 lampret
        .spr_cs(spr_cs),
607
        .spr_we(spr_we),
608
 
609
        .epcr_we(epcr_we),
610
        .eear_we(eear_we),
611
        .esr_we(esr_we),
612
        .pc_we(pc_we),
613
        .epcr(epcr),
614
        .eear(eear),
615
        .esr(esr),
616
        .except_started(except_started),
617
 
618 1011 lampret
        .sr_we(sr_we),
619
        .to_sr(to_sr),
620 504 lampret
        .sr(sr),
621
        .branch_op(branch_op)
622
);
623
 
624
//
625
// Instantiation of load/store unit
626
//
627
or1200_lsu or1200_lsu(
628
        .addrbase(operand_a),
629
        .addrofs(lsu_addrofs),
630
        .lsu_op(lsu_op),
631
        .lsu_datain(operand_b),
632
        .lsu_dataout(lsu_dataout),
633
        .lsu_stall(lsu_stall),
634
        .lsu_unstall(lsu_unstall),
635
        .du_stall(du_stall),
636
        .except_align(except_align),
637
        .except_dtlbmiss(except_dtlbmiss),
638
        .except_dmmufault(except_dmmufault),
639
        .except_dbuserr(except_dbuserr),
640
 
641
        .dcpu_adr_o(dcpu_adr_o),
642 660 lampret
        .dcpu_cycstb_o(dcpu_cycstb_o),
643 504 lampret
        .dcpu_we_o(dcpu_we_o),
644
        .dcpu_sel_o(dcpu_sel_o),
645
        .dcpu_tag_o(dcpu_tag_o),
646
        .dcpu_dat_o(dcpu_dat_o),
647
        .dcpu_dat_i(dcpu_dat_i),
648
        .dcpu_ack_i(dcpu_ack_i),
649
        .dcpu_rty_i(dcpu_rty_i),
650
        .dcpu_err_i(dcpu_err_i),
651
        .dcpu_tag_i(dcpu_tag_i)
652
);
653
 
654
//
655
// Instantiation of write-back muxes
656
//
657
or1200_wbmux or1200_wbmux(
658
        .clk(clk),
659
        .rst(rst),
660
        .wb_freeze(wb_freeze),
661
        .rfwb_op(rfwb_op),
662
        .muxin_a(alu_dataout),
663
        .muxin_b(lsu_dataout),
664
        .muxin_c(sprs_dataout),
665
        .muxin_d({lr_sav, 2'b0}),
666
        .muxout(rf_dataw),
667
        .muxreg(wb_forw),
668
        .muxreg_valid(wbforw_valid)
669
);
670
 
671
//
672
// Instantiation of freeze logic
673
//
674
or1200_freeze or1200_freeze(
675
        .clk(clk),
676
        .rst(rst),
677
        .multicycle(multicycle),
678
        .flushpipe(flushpipe),
679
        .extend_flush(extend_flush),
680
        .lsu_stall(lsu_stall),
681
        .if_stall(if_stall),
682
        .lsu_unstall(lsu_unstall),
683
        .force_dslot_fetch(force_dslot_fetch),
684 617 lampret
        .abort_ex(abort_ex),
685 504 lampret
        .du_stall(du_stall),
686
        .mac_stall(mac_stall),
687 562 lampret
        .genpc_freeze(genpc_freeze),
688 504 lampret
        .if_freeze(if_freeze),
689
        .id_freeze(id_freeze),
690
        .ex_freeze(ex_freeze),
691 895 lampret
        .wb_freeze(wb_freeze),
692
        .icpu_ack_i(icpu_ack_i),
693
        .icpu_err_i(icpu_err_i)
694 504 lampret
);
695
 
696
//
697
// Instantiation of exception block
698
//
699
or1200_except or1200_except(
700
        .clk(clk),
701
        .rst(rst),
702
        .sig_ibuserr(except_ibuserr),
703
        .sig_dbuserr(except_dbuserr),
704
        .sig_illegal(except_illegal),
705
        .sig_align(except_align),
706
        .sig_range(1'b0),
707
        .sig_dtlbmiss(except_dtlbmiss),
708
        .sig_dmmufault(except_dmmufault),
709 589 lampret
        .sig_int(sig_int),
710 504 lampret
        .sig_syscall(sig_syscall),
711
        .sig_trap(sig_trap),
712
        .sig_itlbmiss(except_itlbmiss),
713
        .sig_immufault(except_immufault),
714 589 lampret
        .sig_tick(sig_tick),
715 504 lampret
        .branch_taken(branch_taken),
716 895 lampret
        .icpu_ack_i(icpu_ack_i),
717
        .icpu_err_i(icpu_err_i),
718
        .dcpu_ack_i(dcpu_ack_i),
719
        .dcpu_err_i(dcpu_err_i),
720
        .genpc_freeze(genpc_freeze),
721 504 lampret
        .id_freeze(id_freeze),
722
        .ex_freeze(ex_freeze),
723
        .wb_freeze(wb_freeze),
724
        .if_stall(if_stall),
725
        .if_pc(if_pc),
726
        .lr_sav(lr_sav),
727
        .flushpipe(flushpipe),
728
        .extend_flush(extend_flush),
729
        .except_type(except_type),
730
        .except_start(except_start),
731
        .except_started(except_started),
732
        .except_stop(except_stop),
733 595 lampret
        .ex_void(ex_void),
734 589 lampret
        .spr_dat_ppc(spr_dat_ppc),
735
        .spr_dat_npc(spr_dat_npc),
736 504 lampret
 
737
        .datain(operand_b),
738
        .du_dsr(du_dsr),
739
        .epcr_we(epcr_we),
740
        .eear_we(eear_we),
741
        .esr_we(esr_we),
742
        .pc_we(pc_we),
743
        .epcr(epcr),
744
        .eear(eear),
745
        .esr(esr),
746
 
747
        .lsu_addr(dcpu_adr_o),
748 1011 lampret
        .sr_we(sr_we),
749
        .to_sr(to_sr),
750 617 lampret
        .sr(sr),
751
        .abort_ex(abort_ex)
752 504 lampret
);
753
 
754
//
755
// Instantiation of configuration registers
756
//
757
or1200_cfgr or1200_cfgr(
758
        .spr_addr(spr_addr),
759
        .spr_dat_o(spr_dat_cfgr)
760
);
761
 
762
endmodule

powered by: WebSVN 2.1.0

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