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

Subversion Repositories or1200_hp

[/] [or1200_hp/] [trunk/] [rtl/] [rtl_orig/] [verilog/] [or1200_cpu.v] - Blame information for rev 2

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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