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

Subversion Repositories test_project

[/] [test_project/] [trunk/] [rtl/] [verilog/] [components/] [or1200r2/] [or1200_cpu.v] - Blame information for rev 42

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

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

powered by: WebSVN 2.1.0

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