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

Subversion Repositories openriscdevboard

[/] [openriscdevboard/] [trunk/] [cyc2-openrisc/] [rtl/] [or1200/] [or1200_cpu.v] - Blame information for rev 3

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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