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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or1200/] [rtl/] [verilog/] [or1200_cpu.v] - Blame information for rev 141

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

Line No. Rev Author Line
1 10 unneback
//////////////////////////////////////////////////////////////////////
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 141 marcus.erl
// $Log: or1200_cpu.v,v $
48
// Revision 2.0  2010/06/30 11:00:00  ORSoC
49
// Major update: 
50
// Structure reordered and bugs fixed. 
51
//
52
// Revision 1.16  2005/01/07 09:28:37  andreje
53
// flag for l.cmov instruction added
54
//
55 10 unneback
// Revision 1.15  2004/05/09 19:49:04  lampret
56
// Added some l.cust5 custom instructions as example
57
//
58
// Revision 1.14  2004/04/05 08:29:57  lampret
59
// Merged branch_qmem into main tree.
60
//
61
// Revision 1.12.4.2  2004/02/11 01:40:11  lampret
62
// preliminary HW breakpoints support in debug unit (by default disabled). To enable define OR1200_DU_HWBKPTS.
63
//
64
// Revision 1.12.4.1  2003/12/09 11:46:48  simons
65
// Mbist nameing changed, Artisan ram instance signal names fixed, some synthesis waning fixed.
66
//
67
// Revision 1.12  2002/09/07 05:42:02  lampret
68
// Added optional SR[CY]. Added define to enable additional (compare) flag modifiers. Defines are OR1200_IMPL_ADDC and OR1200_ADDITIONAL_FLAG_MODIFIERS.
69
//
70
// Revision 1.11  2002/08/28 01:44:25  lampret
71
// Removed some commented RTL. Fixed SR/ESR flag bug.
72
//
73
// Revision 1.10  2002/07/14 22:17:17  lampret
74
// Added simple trace buffer [only for Xilinx Virtex target]. Fixed instruction fetch abort when new exception is recognized.
75
//
76
// Revision 1.9  2002/03/29 16:29:37  lampret
77
// Fixed some ports in instnatiations that were removed from the modules
78
//
79
// Revision 1.8  2002/03/29 15:16:54  lampret
80
// Some of the warnings fixed.
81
//
82
// Revision 1.7  2002/02/11 04:33:17  lampret
83
// Speed optimizations (removed duplicate _cyc_ and _stb_). Fixed D/IMMU cache-inhibit attr.
84
//
85
// Revision 1.6  2002/02/01 19:56:54  lampret
86
// Fixed combinational loops.
87
//
88
// Revision 1.5  2002/01/28 01:15:59  lampret
89
// 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.
90
//
91
// Revision 1.4  2002/01/18 14:21:43  lampret
92
// Fixed 'the NPC single-step fix'.
93
//
94
// Revision 1.3  2002/01/18 07:56:00  lampret
95
// No more low/high priority interrupts (PICPR removed). Added tick timer exception. Added exception prefix (SR[EPH]). Fixed single-step bug whenreading NPC.
96
//
97
// Revision 1.2  2002/01/14 06:18:22  lampret
98
// Fixed mem2reg bug in FAST implementation. Updated debug unit to work with new genpc/if.
99
//
100
// Revision 1.1  2002/01/03 08:16:15  lampret
101
// New prefixes for RTL files, prefixed module names. Updated cache controllers and MMUs.
102
//
103
// Revision 1.19  2001/11/30 18:59:47  simons
104
// *** empty log message ***
105
//
106
// Revision 1.18  2001/11/23 21:42:31  simons
107
// Program counter divided to PPC and NPC.
108
//
109
// Revision 1.17  2001/11/23 08:38:51  lampret
110
// Changed DSR/DRR behavior and exception detection.
111
//
112
// Revision 1.16  2001/11/20 00:57:22  lampret
113
// Fixed width of du_except.
114
//
115
// Revision 1.15  2001/11/18 09:58:28  lampret
116
// Fixed some l.trap typos.
117
//
118
// Revision 1.14  2001/11/18 08:36:28  lampret
119
// For GDB changed single stepping and disabled trap exception.
120
//
121
// Revision 1.13  2001/11/13 10:02:21  lampret
122
// Added 'setpc'. Renamed some signals (except_flushpipe into flushpipe etc)
123
//
124
// Revision 1.12  2001/11/12 01:45:40  lampret
125
// Moved flag bit into SR. Changed RF enable from constant enable to dynamic enable for read ports.
126
//
127
// Revision 1.11  2001/11/10 03:43:57  lampret
128
// Fixed exceptions.
129
//
130
// Revision 1.10  2001/10/21 17:57:16  lampret
131
// 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.
132
//
133
// Revision 1.9  2001/10/14 13:12:09  lampret
134
// MP3 version.
135
//
136
// Revision 1.1.1.1  2001/10/06 10:18:35  igorm
137
// no message
138
//
139
// Revision 1.4  2001/08/17 08:01:19  lampret
140
// IC enable/disable.
141
//
142
// Revision 1.3  2001/08/13 03:36:20  lampret
143
// Added cfg regs. Moved all defines into one defines.v file. More cleanup.
144
//
145
// Revision 1.2  2001/08/09 13:39:33  lampret
146
// Major clean-up.
147
//
148
// Revision 1.1  2001/07/20 00:46:03  lampret
149
// Development version of RTL. Libraries are missing.
150
//
151
//
152
 
153
// synopsys translate_off
154
`include "timescale.v"
155
// synopsys translate_on
156
`include "or1200_defines.v"
157
 
158
module or1200_cpu(
159
        // Clk & Rst
160
        clk, rst,
161
 
162
        // Insn interface
163
        ic_en,
164
        icpu_adr_o, icpu_cycstb_o, icpu_sel_o, icpu_tag_o,
165
        icpu_dat_i, icpu_ack_i, icpu_rty_i, icpu_err_i, icpu_adr_i, icpu_tag_i,
166
        immu_en,
167
 
168
        // Debug unit
169 141 marcus.erl
        id_void, id_insn, ex_void,
170
        ex_insn, ex_freeze, wb_insn, wb_freeze, id_pc, ex_pc, wb_pc, branch_op,
171
        spr_dat_npc, rf_dataw, ex_flushpipe,
172
        du_stall, du_addr, du_dat_du, du_read, du_write, du_except_stop, du_except_trig,
173
        du_dsr, du_dmr1, du_hwbkpt, du_hwbkpt_ls_r, du_dat_cpu, du_lsu_store_dat, du_lsu_load_dat,
174
        abort_mvspr, abort_ex,
175 10 unneback
 
176
        // Data interface
177
        dc_en,
178
        dcpu_adr_o, dcpu_cycstb_o, dcpu_we_o, dcpu_sel_o, dcpu_tag_o, dcpu_dat_o,
179
        dcpu_dat_i, dcpu_ack_i, dcpu_rty_i, dcpu_err_i, dcpu_tag_i,
180 141 marcus.erl
        sb_en, dmmu_en,
181 10 unneback
 
182 141 marcus.erl
        // SR Interface
183
        boot_adr_sel_i,
184
 
185 10 unneback
        // Interrupt & tick exceptions
186
        sig_int, sig_tick,
187
 
188
        // SPR interface
189
        supv, spr_addr, spr_dat_cpu, spr_dat_pic, spr_dat_tt, spr_dat_pm,
190
        spr_dat_dmmu, spr_dat_immu, spr_dat_du, spr_cs, spr_we
191
);
192
 
193
parameter dw = `OR1200_OPERAND_WIDTH;
194
parameter aw = `OR1200_REGFILE_ADDR_WIDTH;
195
 
196
//
197
// I/O ports
198
//
199
 
200
//
201
// Clk & Rst
202
//
203
input                           clk;
204
input                           rst;
205
 
206
//
207
// Insn (IC) interface
208
//
209
output                          ic_en;
210
output  [31:0]                   icpu_adr_o;
211
output                          icpu_cycstb_o;
212
output  [3:0]                    icpu_sel_o;
213
output  [3:0]                    icpu_tag_o;
214
input   [31:0]                   icpu_dat_i;
215
input                           icpu_ack_i;
216
input                           icpu_rty_i;
217
input                           icpu_err_i;
218
input   [31:0]                   icpu_adr_i;
219
input   [3:0]                    icpu_tag_i;
220
 
221
//
222
// Insn (IMMU) interface
223
//
224
output                          immu_en;
225
 
226
//
227
// Debug interface
228
//
229 141 marcus.erl
output                          id_void;
230
output  [31:0]                   id_insn;
231
output                          ex_void;
232 10 unneback
output  [31:0]                   ex_insn;
233
output                          ex_freeze;
234 141 marcus.erl
output  [31:0]                   wb_insn;
235
output                          wb_freeze;
236 10 unneback
output  [31:0]                   id_pc;
237 141 marcus.erl
output  [31:0]                   ex_pc;
238
output  [31:0]                   wb_pc;
239
output                          ex_flushpipe;
240 10 unneback
output  [`OR1200_BRANCHOP_WIDTH-1:0]     branch_op;
241
 
242
input                           du_stall;
243
input   [dw-1:0]         du_addr;
244
input   [dw-1:0]         du_dat_du;
245
input                           du_read;
246
input                           du_write;
247
input   [`OR1200_DU_DSR_WIDTH-1:0]       du_dsr;
248 141 marcus.erl
input   [24:0]                   du_dmr1;
249 10 unneback
input                           du_hwbkpt;
250 141 marcus.erl
input                           du_hwbkpt_ls_r;
251
output  [12:0]                   du_except_trig;
252
output  [12:0]                   du_except_stop;
253 10 unneback
output  [dw-1:0]         du_dat_cpu;
254
output  [dw-1:0]         rf_dataw;
255 141 marcus.erl
output  [dw-1:0]         du_lsu_store_dat;
256
output  [dw-1:0]         du_lsu_load_dat;
257 10 unneback
 
258
//
259
// Data (DC) interface
260
//
261
output  [31:0]                   dcpu_adr_o;
262
output                          dcpu_cycstb_o;
263
output                          dcpu_we_o;
264
output  [3:0]                    dcpu_sel_o;
265
output  [3:0]                    dcpu_tag_o;
266
output  [31:0]                   dcpu_dat_o;
267
input   [31:0]                   dcpu_dat_i;
268
input                           dcpu_ack_i;
269
input                           dcpu_rty_i;
270
input                           dcpu_err_i;
271
input   [3:0]                    dcpu_tag_i;
272
output                          dc_en;
273
 
274
//
275
// Data (DMMU) interface
276
//
277 141 marcus.erl
output                          sb_en;
278 10 unneback
output                          dmmu_en;
279 141 marcus.erl
output                          abort_ex;
280
output                          abort_mvspr;
281 10 unneback
 
282
//
283 141 marcus.erl
// SR Interface 
284
//
285
input                           boot_adr_sel_i;
286
 
287
//
288 10 unneback
// SPR interface
289
//
290
output                          supv;
291
input   [dw-1:0]         spr_dat_pic;
292
input   [dw-1:0]         spr_dat_tt;
293
input   [dw-1:0]         spr_dat_pm;
294
input   [dw-1:0]         spr_dat_dmmu;
295
input   [dw-1:0]         spr_dat_immu;
296
input   [dw-1:0]         spr_dat_du;
297
output  [dw-1:0]         spr_addr;
298
output  [dw-1:0]         spr_dat_cpu;
299
output  [dw-1:0]         spr_dat_npc;
300
output  [31:0]                   spr_cs;
301
output                          spr_we;
302
 
303
//
304
// Interrupt exceptions
305
//
306
input                           sig_int;
307
input                           sig_tick;
308
 
309
//
310
// Internal wires
311
//
312
wire    [31:0]                   if_insn;
313 141 marcus.erl
wire                            saving_if_insn;
314 10 unneback
wire    [31:0]                   if_pc;
315
wire    [aw-1:0]         rf_addrw;
316
wire    [aw-1:0]                 rf_addra;
317
wire    [aw-1:0]                 rf_addrb;
318
wire                            rf_rda;
319
wire                            rf_rdb;
320 141 marcus.erl
wire    [dw-1:0]         id_simm;
321
wire    [dw-1:2]                id_branch_addrtarget;
322
wire    [dw-1:2]                ex_branch_addrtarget;
323 10 unneback
wire    [`OR1200_ALUOP_WIDTH-1:0]        alu_op;
324
wire    [`OR1200_SHROTOP_WIDTH-1:0]      shrot_op;
325
wire    [`OR1200_COMPOP_WIDTH-1:0]       comp_op;
326 141 marcus.erl
wire    [`OR1200_BRANCHOP_WIDTH-1:0]     pre_branch_op;
327 10 unneback
wire    [`OR1200_BRANCHOP_WIDTH-1:0]     branch_op;
328 141 marcus.erl
wire    [`OR1200_LSUOP_WIDTH-1:0]        id_lsu_op;
329 10 unneback
wire                            genpc_freeze;
330
wire                            if_freeze;
331
wire                            id_freeze;
332
wire                            ex_freeze;
333
wire                            wb_freeze;
334
wire    [`OR1200_SEL_WIDTH-1:0]  sel_a;
335
wire    [`OR1200_SEL_WIDTH-1:0]  sel_b;
336
wire    [`OR1200_RFWBOP_WIDTH-1:0]       rfwb_op;
337
wire    [dw-1:0]         rf_dataw;
338
wire    [dw-1:0]         rf_dataa;
339
wire    [dw-1:0]         rf_datab;
340 141 marcus.erl
wire    [dw-1:0]         muxed_a;
341 10 unneback
wire    [dw-1:0]         muxed_b;
342
wire    [dw-1:0]         wb_forw;
343
wire                            wbforw_valid;
344
wire    [dw-1:0]         operand_a;
345
wire    [dw-1:0]         operand_b;
346
wire    [dw-1:0]         alu_dataout;
347
wire    [dw-1:0]         lsu_dataout;
348
wire    [dw-1:0]         sprs_dataout;
349 141 marcus.erl
wire    [31:0]                   ex_simm;
350 10 unneback
wire    [`OR1200_MULTICYCLE_WIDTH-1:0]   multicycle;
351
wire    [`OR1200_EXCEPT_WIDTH-1:0]       except_type;
352
wire    [4:0]                    cust5_op;
353
wire    [5:0]                    cust5_limm;
354 141 marcus.erl
wire                            if_flushpipe;
355
wire                            id_flushpipe;
356
wire                            ex_flushpipe;
357
wire                            wb_flushpipe;
358 10 unneback
wire                            extend_flush;
359 141 marcus.erl
wire                            ex_branch_taken;
360 10 unneback
wire                            flag;
361
wire                            flagforw;
362
wire                            flag_we;
363 141 marcus.erl
wire                            flag_we_alu;
364 10 unneback
wire                            carry;
365
wire                            cyforw;
366 141 marcus.erl
wire                            cy_we_alu;
367
wire                            cy_we_rf;
368 10 unneback
wire                            lsu_stall;
369
wire                            epcr_we;
370
wire                            eear_we;
371
wire                            esr_we;
372
wire                            pc_we;
373
wire    [31:0]                   epcr;
374
wire    [31:0]                   eear;
375
wire    [`OR1200_SR_WIDTH-1:0]   esr;
376
wire                            sr_we;
377
wire    [`OR1200_SR_WIDTH-1:0]   to_sr;
378
wire    [`OR1200_SR_WIDTH-1:0]   sr;
379 141 marcus.erl
wire                            except_flushpipe;
380 10 unneback
wire                            except_start;
381
wire                            except_started;
382
wire    [31:0]                   wb_insn;
383
wire                            sig_syscall;
384
wire                            sig_trap;
385
wire    [31:0]                   spr_dat_cfgr;
386
wire    [31:0]                   spr_dat_rf;
387
wire    [31:0]                  spr_dat_npc;
388
wire    [31:0]                   spr_dat_ppc;
389
wire    [31:0]                   spr_dat_mac;
390
wire                            force_dslot_fetch;
391
wire                            no_more_dslot;
392
wire                            ex_void;
393 141 marcus.erl
wire                            ex_spr_read;
394
wire                            ex_spr_write;
395 10 unneback
wire                            if_stall;
396
wire                            id_macrc_op;
397
wire                            ex_macrc_op;
398 141 marcus.erl
wire    [`OR1200_MACOP_WIDTH-1:0] id_mac_op;
399 10 unneback
wire    [`OR1200_MACOP_WIDTH-1:0] mac_op;
400
wire    [31:0]                   mult_mac_result;
401
wire                            mac_stall;
402 141 marcus.erl
wire    [12:0]                   except_trig;
403 10 unneback
wire    [12:0]                   except_stop;
404
wire                            genpc_refetch;
405
wire                            rfe;
406
wire                            lsu_unstall;
407
wire                            except_align;
408
wire                            except_dtlbmiss;
409
wire                            except_dmmufault;
410
wire                            except_illegal;
411
wire                            except_itlbmiss;
412
wire                            except_immufault;
413
wire                            except_ibuserr;
414
wire                            except_dbuserr;
415
wire                            abort_ex;
416 141 marcus.erl
wire                            abort_mvspr;
417 10 unneback
 
418
//
419
// Send exceptions to Debug Unit
420
//
421 141 marcus.erl
assign du_except_trig = except_trig;
422
assign du_except_stop = except_stop;
423
assign du_lsu_store_dat = operand_b;
424
assign du_lsu_load_dat  = lsu_dataout;
425 10 unneback
 
426
//
427
// Data cache enable
428
//
429 141 marcus.erl
`ifdef OR1200_NO_DC
430
assign dc_en = 1'b0;
431
`else
432 10 unneback
assign dc_en = sr[`OR1200_SR_DCE];
433 141 marcus.erl
`endif
434 10 unneback
 
435
//
436
// Instruction cache enable
437
//
438 141 marcus.erl
`ifdef OR1200_NO_IC
439
assign ic_en = 1'b0;
440
`else
441 10 unneback
assign ic_en = sr[`OR1200_SR_ICE];
442 141 marcus.erl
`endif
443 10 unneback
 
444
//
445 141 marcus.erl
// SB enable
446
//
447
`ifdef OR1200_SB_IMPLEMENTED
448
//assign sb_en = sr[`OR1200_SR_SBE]; // SBE not defined  -- jb
449
`else
450
assign sb_en = 1'b0;
451
`endif
452
 
453
//
454 10 unneback
// DMMU enable
455
//
456 141 marcus.erl
`ifdef OR1200_NO_DMMU
457
assign dmmu_en = 1'b0;
458
`else
459 10 unneback
assign dmmu_en = sr[`OR1200_SR_DME];
460 141 marcus.erl
`endif
461 10 unneback
 
462
//
463
// IMMU enable
464
//
465 141 marcus.erl
`ifdef OR1200_NO_IMMU
466
assign immu_en = 1'b0;
467
`else
468
assign immu_en = sr[`OR1200_SR_IME] & ~except_started;
469
`endif
470 10 unneback
 
471
//
472
// SUPV bit
473
//
474
assign supv = sr[`OR1200_SR_SM];
475
 
476
//
477 141 marcus.erl
// FLAG write enable
478
//
479
assign flag_we = flag_we_alu && ~abort_mvspr;
480
 
481
//
482 10 unneback
// Instantiation of instruction fetch block
483
//
484
or1200_genpc or1200_genpc(
485
        .clk(clk),
486
        .rst(rst),
487
        .icpu_adr_o(icpu_adr_o),
488
        .icpu_cycstb_o(icpu_cycstb_o),
489
        .icpu_sel_o(icpu_sel_o),
490
        .icpu_tag_o(icpu_tag_o),
491
        .icpu_rty_i(icpu_rty_i),
492
        .icpu_adr_i(icpu_adr_i),
493
 
494 141 marcus.erl
        .pre_branch_op(pre_branch_op),
495 10 unneback
        .branch_op(branch_op),
496
        .except_type(except_type),
497
        .except_start(except_start),
498
        .except_prefix(sr[`OR1200_SR_EPH]),
499 141 marcus.erl
        .id_branch_addrtarget(id_branch_addrtarget),
500
        .ex_branch_addrtarget(ex_branch_addrtarget),
501
        .muxed_b(muxed_b),
502
        .operand_b(operand_b),
503 10 unneback
        .flag(flag),
504 141 marcus.erl
        .flagforw(flagforw),
505
        .ex_branch_taken(ex_branch_taken),
506 10 unneback
        .epcr(epcr),
507
        .spr_dat_i(spr_dat_cpu),
508
        .spr_pc_we(pc_we),
509
        .genpc_refetch(genpc_refetch),
510
        .genpc_freeze(genpc_freeze),
511
        .no_more_dslot(no_more_dslot)
512
);
513
 
514
//
515
// Instantiation of instruction fetch block
516
//
517
or1200_if or1200_if(
518
        .clk(clk),
519
        .rst(rst),
520
        .icpu_dat_i(icpu_dat_i),
521
        .icpu_ack_i(icpu_ack_i),
522
        .icpu_err_i(icpu_err_i),
523
        .icpu_adr_i(icpu_adr_i),
524
        .icpu_tag_i(icpu_tag_i),
525
 
526
        .if_freeze(if_freeze),
527
        .if_insn(if_insn),
528
        .if_pc(if_pc),
529 141 marcus.erl
        .saving_if_insn(saving_if_insn),
530
        .if_flushpipe(if_flushpipe),
531 10 unneback
        .if_stall(if_stall),
532
        .no_more_dslot(no_more_dslot),
533
        .genpc_refetch(genpc_refetch),
534
        .rfe(rfe),
535
        .except_itlbmiss(except_itlbmiss),
536
        .except_immufault(except_immufault),
537
        .except_ibuserr(except_ibuserr)
538
);
539
 
540
//
541
// Instantiation of instruction decode/control logic
542
//
543
or1200_ctrl or1200_ctrl(
544
        .clk(clk),
545
        .rst(rst),
546
        .id_freeze(id_freeze),
547
        .ex_freeze(ex_freeze),
548
        .wb_freeze(wb_freeze),
549 141 marcus.erl
        .if_flushpipe(if_flushpipe),
550
        .id_flushpipe(id_flushpipe),
551
        .ex_flushpipe(ex_flushpipe),
552
        .wb_flushpipe(wb_flushpipe),
553
        .extend_flush(extend_flush),
554
        .except_flushpipe(except_flushpipe),
555
        .abort_mvspr(abort_mvspr),
556 10 unneback
        .if_insn(if_insn),
557 141 marcus.erl
        .id_insn(id_insn),
558 10 unneback
        .ex_insn(ex_insn),
559 141 marcus.erl
        .id_branch_op(pre_branch_op),
560
        .ex_branch_op(branch_op),
561
        .ex_branch_taken(ex_branch_taken),
562 10 unneback
        .rf_addra(rf_addra),
563
        .rf_addrb(rf_addrb),
564
        .rf_rda(rf_rda),
565
        .rf_rdb(rf_rdb),
566
        .alu_op(alu_op),
567
        .mac_op(mac_op),
568
        .shrot_op(shrot_op),
569
        .comp_op(comp_op),
570
        .rf_addrw(rf_addrw),
571
        .rfwb_op(rfwb_op),
572 141 marcus.erl
        .pc_we(pc_we),
573 10 unneback
        .wb_insn(wb_insn),
574 141 marcus.erl
        .id_simm(id_simm),
575
        .id_branch_addrtarget(id_branch_addrtarget),
576
        .ex_branch_addrtarget(ex_branch_addrtarget),
577
        .ex_simm(ex_simm),
578 10 unneback
        .sel_a(sel_a),
579
        .sel_b(sel_b),
580 141 marcus.erl
        .id_lsu_op(id_lsu_op),
581 10 unneback
        .cust5_op(cust5_op),
582
        .cust5_limm(cust5_limm),
583 141 marcus.erl
        .id_pc(id_pc),
584
        .ex_pc(ex_pc),
585 10 unneback
        .multicycle(multicycle),
586
        .wbforw_valid(wbforw_valid),
587
        .sig_syscall(sig_syscall),
588
        .sig_trap(sig_trap),
589
        .force_dslot_fetch(force_dslot_fetch),
590
        .no_more_dslot(no_more_dslot),
591 141 marcus.erl
        .id_void(id_void),
592 10 unneback
        .ex_void(ex_void),
593 141 marcus.erl
        .ex_spr_read(ex_spr_read),
594
        .ex_spr_write(ex_spr_write),
595
        .id_mac_op(id_mac_op),
596 10 unneback
        .id_macrc_op(id_macrc_op),
597
        .ex_macrc_op(ex_macrc_op),
598
        .rfe(rfe),
599
        .du_hwbkpt(du_hwbkpt),
600
        .except_illegal(except_illegal)
601
);
602
 
603
//
604
// Instantiation of register file
605
//
606
or1200_rf or1200_rf(
607
        .clk(clk),
608
        .rst(rst),
609 141 marcus.erl
        .cy_we_i(cy_we_alu),
610
        .cy_we_o(cy_we_rf),
611 10 unneback
        .supv(sr[`OR1200_SR_SM]),
612
        .wb_freeze(wb_freeze),
613
        .addrw(rf_addrw),
614
        .dataw(rf_dataw),
615
        .id_freeze(id_freeze),
616
        .we(rfwb_op[0]),
617 141 marcus.erl
        .flushpipe(wb_flushpipe),
618 10 unneback
        .addra(rf_addra),
619
        .rda(rf_rda),
620
        .dataa(rf_dataa),
621
        .addrb(rf_addrb),
622
        .rdb(rf_rdb),
623
        .datab(rf_datab),
624
        .spr_cs(spr_cs[`OR1200_SPR_GROUP_SYS]),
625
        .spr_write(spr_we),
626
        .spr_addr(spr_addr),
627
        .spr_dat_i(spr_dat_cpu),
628
        .spr_dat_o(spr_dat_rf)
629
);
630
 
631
//
632
// Instantiation of operand muxes
633
//
634
or1200_operandmuxes or1200_operandmuxes(
635
        .clk(clk),
636
        .rst(rst),
637
        .id_freeze(id_freeze),
638
        .ex_freeze(ex_freeze),
639
        .rf_dataa(rf_dataa),
640
        .rf_datab(rf_datab),
641
        .ex_forw(rf_dataw),
642
        .wb_forw(wb_forw),
643 141 marcus.erl
        .simm(id_simm),
644 10 unneback
        .sel_a(sel_a),
645
        .sel_b(sel_b),
646
        .operand_a(operand_a),
647
        .operand_b(operand_b),
648 141 marcus.erl
        .muxed_a(muxed_a),
649 10 unneback
        .muxed_b(muxed_b)
650
);
651
 
652
//
653
// Instantiation of CPU's ALU
654
//
655
or1200_alu or1200_alu(
656
        .a(operand_a),
657
        .b(operand_b),
658
        .mult_mac_result(mult_mac_result),
659
        .macrc_op(ex_macrc_op),
660
        .alu_op(alu_op),
661
        .shrot_op(shrot_op),
662
        .comp_op(comp_op),
663
        .cust5_op(cust5_op),
664
        .cust5_limm(cust5_limm),
665
        .result(alu_dataout),
666
        .flagforw(flagforw),
667 141 marcus.erl
        .flag_we(flag_we_alu),
668 10 unneback
        .cyforw(cyforw),
669 141 marcus.erl
        .cy_we(cy_we_alu),
670
        .flag(flag),
671 10 unneback
        .carry(carry)
672
);
673
 
674
//
675
// Instantiation of CPU's ALU
676
//
677
or1200_mult_mac or1200_mult_mac(
678
        .clk(clk),
679
        .rst(rst),
680
        .ex_freeze(ex_freeze),
681
        .id_macrc_op(id_macrc_op),
682
        .macrc_op(ex_macrc_op),
683
        .a(operand_a),
684
        .b(operand_b),
685
        .mac_op(mac_op),
686
        .alu_op(alu_op),
687
        .result(mult_mac_result),
688
        .mac_stall_r(mac_stall),
689
        .spr_cs(spr_cs[`OR1200_SPR_GROUP_MAC]),
690
        .spr_write(spr_we),
691
        .spr_addr(spr_addr),
692
        .spr_dat_i(spr_dat_cpu),
693
        .spr_dat_o(spr_dat_mac)
694
);
695
 
696
//
697
// Instantiation of CPU's SPRS block
698
//
699
or1200_sprs or1200_sprs(
700
        .clk(clk),
701
        .rst(rst),
702
        .addrbase(operand_a),
703 141 marcus.erl
        .addrofs(ex_simm[15:0]),
704 10 unneback
        .dat_i(operand_b),
705 141 marcus.erl
        .ex_spr_read(ex_spr_read),
706
        .ex_spr_write(ex_spr_write),
707 10 unneback
        .flagforw(flagforw),
708
        .flag_we(flag_we),
709
        .flag(flag),
710
        .cyforw(cyforw),
711 141 marcus.erl
        .cy_we(cy_we_rf),
712 10 unneback
        .carry(carry),
713
        .to_wbmux(sprs_dataout),
714
 
715
        .du_addr(du_addr),
716
        .du_dat_du(du_dat_du),
717
        .du_read(du_read),
718
        .du_write(du_write),
719
        .du_dat_cpu(du_dat_cpu),
720 141 marcus.erl
        .boot_adr_sel_i(boot_adr_sel_i),
721 10 unneback
        .spr_addr(spr_addr),
722
        .spr_dat_pic(spr_dat_pic),
723
        .spr_dat_tt(spr_dat_tt),
724
        .spr_dat_pm(spr_dat_pm),
725
        .spr_dat_cfgr(spr_dat_cfgr),
726
        .spr_dat_rf(spr_dat_rf),
727
        .spr_dat_npc(spr_dat_npc),
728
        .spr_dat_ppc(spr_dat_ppc),
729
        .spr_dat_mac(spr_dat_mac),
730
        .spr_dat_dmmu(spr_dat_dmmu),
731
        .spr_dat_immu(spr_dat_immu),
732
        .spr_dat_du(spr_dat_du),
733
        .spr_dat_o(spr_dat_cpu),
734
        .spr_cs(spr_cs),
735
        .spr_we(spr_we),
736
 
737
        .epcr_we(epcr_we),
738
        .eear_we(eear_we),
739
        .esr_we(esr_we),
740
        .pc_we(pc_we),
741
        .epcr(epcr),
742
        .eear(eear),
743
        .esr(esr),
744
        .except_started(except_started),
745
 
746
        .sr_we(sr_we),
747
        .to_sr(to_sr),
748
        .sr(sr),
749
        .branch_op(branch_op)
750
);
751
 
752
//
753
// Instantiation of load/store unit
754
//
755
or1200_lsu or1200_lsu(
756 141 marcus.erl
        .clk(clk),
757
        .rst(rst),
758
        .id_addrbase(muxed_a),
759
        .id_addrofs(id_simm),
760
        .ex_addrbase(operand_a),
761
        .ex_addrofs(ex_simm),
762
        .id_lsu_op(id_lsu_op),
763 10 unneback
        .lsu_datain(operand_b),
764
        .lsu_dataout(lsu_dataout),
765
        .lsu_stall(lsu_stall),
766
        .lsu_unstall(lsu_unstall),
767 141 marcus.erl
        .du_stall(du_stall),
768 10 unneback
        .except_align(except_align),
769
        .except_dtlbmiss(except_dtlbmiss),
770
        .except_dmmufault(except_dmmufault),
771
        .except_dbuserr(except_dbuserr),
772 141 marcus.erl
        .id_freeze(id_freeze),
773
        .ex_freeze(ex_freeze),
774
        .flushpipe(ex_flushpipe),
775 10 unneback
 
776
        .dcpu_adr_o(dcpu_adr_o),
777
        .dcpu_cycstb_o(dcpu_cycstb_o),
778
        .dcpu_we_o(dcpu_we_o),
779
        .dcpu_sel_o(dcpu_sel_o),
780
        .dcpu_tag_o(dcpu_tag_o),
781
        .dcpu_dat_o(dcpu_dat_o),
782
        .dcpu_dat_i(dcpu_dat_i),
783
        .dcpu_ack_i(dcpu_ack_i),
784
        .dcpu_rty_i(dcpu_rty_i),
785
        .dcpu_err_i(dcpu_err_i),
786
        .dcpu_tag_i(dcpu_tag_i)
787
);
788
 
789
//
790
// Instantiation of write-back muxes
791
//
792
or1200_wbmux or1200_wbmux(
793
        .clk(clk),
794
        .rst(rst),
795
        .wb_freeze(wb_freeze),
796
        .rfwb_op(rfwb_op),
797
        .muxin_a(alu_dataout),
798
        .muxin_b(lsu_dataout),
799
        .muxin_c(sprs_dataout),
800 141 marcus.erl
        .muxin_d(ex_pc),
801 10 unneback
        .muxout(rf_dataw),
802
        .muxreg(wb_forw),
803
        .muxreg_valid(wbforw_valid)
804
);
805
 
806
//
807
// Instantiation of freeze logic
808
//
809
or1200_freeze or1200_freeze(
810
        .clk(clk),
811
        .rst(rst),
812
        .multicycle(multicycle),
813 141 marcus.erl
        .flushpipe(wb_flushpipe),
814 10 unneback
        .extend_flush(extend_flush),
815
        .lsu_stall(lsu_stall),
816
        .if_stall(if_stall),
817
        .lsu_unstall(lsu_unstall),
818
        .force_dslot_fetch(force_dslot_fetch),
819
        .abort_ex(abort_ex),
820
        .du_stall(du_stall),
821
        .mac_stall(mac_stall),
822 141 marcus.erl
        .saving_if_insn(saving_if_insn),
823 10 unneback
        .genpc_freeze(genpc_freeze),
824
        .if_freeze(if_freeze),
825
        .id_freeze(id_freeze),
826
        .ex_freeze(ex_freeze),
827
        .wb_freeze(wb_freeze),
828
        .icpu_ack_i(icpu_ack_i),
829
        .icpu_err_i(icpu_err_i)
830
);
831
 
832
//
833
// Instantiation of exception block
834
//
835
or1200_except or1200_except(
836
        .clk(clk),
837
        .rst(rst),
838
        .sig_ibuserr(except_ibuserr),
839
        .sig_dbuserr(except_dbuserr),
840
        .sig_illegal(except_illegal),
841
        .sig_align(except_align),
842
        .sig_range(1'b0),
843
        .sig_dtlbmiss(except_dtlbmiss),
844
        .sig_dmmufault(except_dmmufault),
845
        .sig_int(sig_int),
846
        .sig_syscall(sig_syscall),
847
        .sig_trap(sig_trap),
848
        .sig_itlbmiss(except_itlbmiss),
849
        .sig_immufault(except_immufault),
850
        .sig_tick(sig_tick),
851 141 marcus.erl
        .ex_branch_taken(ex_branch_taken),
852 10 unneback
        .icpu_ack_i(icpu_ack_i),
853
        .icpu_err_i(icpu_err_i),
854
        .dcpu_ack_i(dcpu_ack_i),
855
        .dcpu_err_i(dcpu_err_i),
856
        .genpc_freeze(genpc_freeze),
857
        .id_freeze(id_freeze),
858
        .ex_freeze(ex_freeze),
859
        .wb_freeze(wb_freeze),
860
        .if_stall(if_stall),
861
        .if_pc(if_pc),
862
        .id_pc(id_pc),
863 141 marcus.erl
        .ex_pc(ex_pc),
864
        .wb_pc(wb_pc),
865
        .id_flushpipe(id_flushpipe),
866
        .ex_flushpipe(ex_flushpipe),
867 10 unneback
        .extend_flush(extend_flush),
868 141 marcus.erl
        .except_flushpipe(except_flushpipe),
869
        .abort_mvspr(abort_mvspr),
870 10 unneback
        .except_type(except_type),
871
        .except_start(except_start),
872
        .except_started(except_started),
873
        .except_stop(except_stop),
874 141 marcus.erl
        .except_trig(except_trig),
875 10 unneback
        .ex_void(ex_void),
876
        .spr_dat_ppc(spr_dat_ppc),
877
        .spr_dat_npc(spr_dat_npc),
878
 
879 141 marcus.erl
        .datain(spr_dat_cpu),
880
        .branch_op(branch_op),
881 10 unneback
        .du_dsr(du_dsr),
882 141 marcus.erl
        .du_dmr1(du_dmr1),
883
        .du_hwbkpt(du_hwbkpt),
884
        .du_hwbkpt_ls_r(du_hwbkpt_ls_r),
885 10 unneback
        .epcr_we(epcr_we),
886
        .eear_we(eear_we),
887
        .esr_we(esr_we),
888
        .pc_we(pc_we),
889
        .epcr(epcr),
890
        .eear(eear),
891
        .esr(esr),
892
 
893
        .lsu_addr(dcpu_adr_o),
894
        .sr_we(sr_we),
895
        .to_sr(to_sr),
896
        .sr(sr),
897
        .abort_ex(abort_ex)
898
);
899
 
900
//
901
// Instantiation of configuration registers
902
//
903
or1200_cfgr or1200_cfgr(
904
        .spr_addr(spr_addr),
905
        .spr_dat_o(spr_dat_cfgr)
906
);
907
 
908
endmodule

powered by: WebSVN 2.1.0

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