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

Subversion Repositories openrisc

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

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
// $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
or1200_genpc or1200_genpc(
406
        .clk(clk),
407
        .rst(rst),
408
        .icpu_adr_o(icpu_adr_o),
409
        .icpu_cycstb_o(icpu_cycstb_o),
410
        .icpu_sel_o(icpu_sel_o),
411
        .icpu_tag_o(icpu_tag_o),
412
        .icpu_rty_i(icpu_rty_i),
413
        .icpu_adr_i(icpu_adr_i),
414
 
415
        .branch_op(branch_op),
416
        .except_type(except_type),
417
        .except_start(except_start),
418
        .except_prefix(sr[`OR1200_SR_EPH]),
419
        .branch_addrofs(branch_addrofs),
420
        .lr_restor(operand_b),
421
        .flag(flag),
422
        .taken(branch_taken),
423
        .binsn_addr(lr_sav),
424
        .epcr(epcr),
425
        .spr_dat_i(spr_dat_cpu),
426
        .spr_pc_we(pc_we),
427
        .genpc_refetch(genpc_refetch),
428
        .genpc_freeze(genpc_freeze),
429
  .genpc_stop_prefetch(1'b0),
430
        .no_more_dslot(no_more_dslot)
431
);
432
 
433
//
434
// Instantiation of instruction fetch block
435
//
436
or1200_if or1200_if(
437
        .clk(clk),
438
        .rst(rst),
439
        .icpu_dat_i(icpu_dat_i),
440
        .icpu_ack_i(icpu_ack_i),
441
        .icpu_err_i(icpu_err_i),
442
        .icpu_adr_i(icpu_adr_i),
443
        .icpu_tag_i(icpu_tag_i),
444
 
445
        .if_freeze(if_freeze),
446
        .if_insn(if_insn),
447
        .if_pc(if_pc),
448
        .flushpipe(flushpipe),
449
        .if_stall(if_stall),
450
        .no_more_dslot(no_more_dslot),
451
        .genpc_refetch(genpc_refetch),
452
        .rfe(rfe),
453
        .except_itlbmiss(except_itlbmiss),
454
        .except_immufault(except_immufault),
455
        .except_ibuserr(except_ibuserr)
456
);
457
 
458
//
459
// Instantiation of instruction decode/control logic
460
//
461
or1200_ctrl or1200_ctrl(
462
        .clk(clk),
463
        .rst(rst),
464
        .id_freeze(id_freeze),
465
        .ex_freeze(ex_freeze),
466
        .wb_freeze(wb_freeze),
467
        .flushpipe(flushpipe),
468
        .if_insn(if_insn),
469
        .ex_insn(ex_insn),
470
        .branch_op(branch_op),
471
        .branch_taken(branch_taken),
472
        .rf_addra(rf_addra),
473
        .rf_addrb(rf_addrb),
474
        .rf_rda(rf_rda),
475
        .rf_rdb(rf_rdb),
476
        .alu_op(alu_op),
477
        .mac_op(mac_op),
478
        .shrot_op(shrot_op),
479
        .comp_op(comp_op),
480
        .rf_addrw(rf_addrw),
481
        .rfwb_op(rfwb_op),
482
        .wb_insn(wb_insn),
483
        .simm(simm),
484
        .branch_addrofs(branch_addrofs),
485
        .lsu_addrofs(lsu_addrofs),
486
        .sel_a(sel_a),
487
        .sel_b(sel_b),
488
        .lsu_op(lsu_op),
489
        .cust5_op(cust5_op),
490
        .cust5_limm(cust5_limm),
491
        .multicycle(multicycle),
492
        .spr_addrimm(spr_addrimm),
493
        .wbforw_valid(wbforw_valid),
494
        .sig_syscall(sig_syscall),
495
        .sig_trap(sig_trap),
496
        .force_dslot_fetch(force_dslot_fetch),
497
        .no_more_dslot(no_more_dslot),
498
        .ex_void(ex_void),
499
        .id_macrc_op(id_macrc_op),
500
        .ex_macrc_op(ex_macrc_op),
501
        .rfe(rfe),
502
        .du_hwbkpt(du_hwbkpt),
503
        .except_illegal(except_illegal)
504
);
505
 
506
//
507
// Instantiation of register file
508
//
509
or1200_rf or1200_rf(
510
        .clk(clk),
511
        .rst(rst),
512
        .supv(sr[`OR1200_SR_SM]),
513
        .wb_freeze(wb_freeze),
514
        .addrw(rf_addrw),
515
        .dataw(rf_dataw),
516
        .id_freeze(id_freeze),
517
        .we(rfwb_op[0]),
518
        .flushpipe(flushpipe),
519
        .addra(rf_addra),
520
        .rda(rf_rda),
521
        .dataa(rf_dataa),
522
        .addrb(rf_addrb),
523
        .rdb(rf_rdb),
524
        .datab(rf_datab),
525
        .spr_cs(spr_cs[`OR1200_SPR_GROUP_SYS]),
526
        .spr_write(spr_we),
527
        .spr_addr(spr_addr),
528
        .spr_dat_i(spr_dat_cpu),
529
        .spr_dat_o(spr_dat_rf)
530
);
531
 
532
//
533
// Instantiation of operand muxes
534
//
535
or1200_operandmuxes or1200_operandmuxes(
536
        .clk(clk),
537
        .rst(rst),
538
        .id_freeze(id_freeze),
539
        .ex_freeze(ex_freeze),
540
        .rf_dataa(rf_dataa),
541
        .rf_datab(rf_datab),
542
        .ex_forw(rf_dataw),
543
        .wb_forw(wb_forw),
544
        .simm(simm),
545
        .sel_a(sel_a),
546
        .sel_b(sel_b),
547
        .operand_a(operand_a),
548
        .operand_b(operand_b),
549
        .muxed_b(muxed_b)
550
);
551
 
552
//
553
// Instantiation of CPU's ALU
554
//
555
or1200_alu or1200_alu(
556
        .a(operand_a),
557
        .b(operand_b),
558
        .mult_mac_result(mult_mac_result),
559
        .macrc_op(ex_macrc_op),
560
        .alu_op(alu_op),
561
        .shrot_op(shrot_op),
562
        .comp_op(comp_op),
563
        .cust5_op(cust5_op),
564
        .cust5_limm(cust5_limm),
565
        .result(alu_dataout),
566
        .flagforw(flagforw),
567
        .flag_we(flag_we),
568
        .cyforw(cyforw),
569
        .cy_we(cy_we),
570
  .flag(flag),
571
        .carry(carry)
572
);
573
 
574
//
575
// Instantiation of CPU's ALU
576
//
577
or1200_mult_mac or1200_mult_mac(
578
        .clk(clk),
579
        .rst(rst),
580
        .ex_freeze(ex_freeze),
581
        .id_macrc_op(id_macrc_op),
582
        .macrc_op(ex_macrc_op),
583
        .a(operand_a),
584
        .b(operand_b),
585
        .mac_op(mac_op),
586
        .alu_op(alu_op),
587
        .result(mult_mac_result),
588
        .mac_stall_r(mac_stall),
589
        .spr_cs(spr_cs[`OR1200_SPR_GROUP_MAC]),
590
        .spr_write(spr_we),
591
        .spr_addr(spr_addr),
592
        .spr_dat_i(spr_dat_cpu),
593
        .spr_dat_o(spr_dat_mac)
594
);
595
 
596
//
597
// Instantiation of CPU's SPRS block
598
//
599
or1200_sprs or1200_sprs(
600
        .clk(clk),
601
        .rst(rst),
602
        .addrbase(operand_a),
603
        .addrofs(spr_addrimm),
604
        .dat_i(operand_b),
605
        .alu_op(alu_op),
606
        .flagforw(flagforw),
607
        .flag_we(flag_we),
608
        .flag(flag),
609
        .cyforw(cyforw),
610
        .cy_we(cy_we),
611
        .carry(carry),
612
        .to_wbmux(sprs_dataout),
613
 
614
        .du_addr(du_addr),
615
        .du_dat_du(du_dat_du),
616
        .du_read(du_read),
617
        .du_write(du_write),
618
        .du_dat_cpu(du_dat_cpu),
619
 
620
        .spr_addr(spr_addr),
621
        .spr_dat_pic(spr_dat_pic),
622
        .spr_dat_tt(spr_dat_tt),
623
        .spr_dat_pm(spr_dat_pm),
624
        .spr_dat_cfgr(spr_dat_cfgr),
625
        .spr_dat_rf(spr_dat_rf),
626
        .spr_dat_npc(spr_dat_npc),
627
        .spr_dat_ppc(spr_dat_ppc),
628
        .spr_dat_mac(spr_dat_mac),
629
        .spr_dat_dmmu(spr_dat_dmmu),
630
        .spr_dat_immu(spr_dat_immu),
631
        .spr_dat_du(spr_dat_du),
632
        .spr_dat_o(spr_dat_cpu),
633
        .spr_cs(spr_cs),
634
        .spr_we(spr_we),
635
 
636
        .epcr_we(epcr_we),
637
        .eear_we(eear_we),
638
        .esr_we(esr_we),
639
        .pc_we(pc_we),
640
        .epcr(epcr),
641
        .eear(eear),
642
        .esr(esr),
643
        .except_started(except_started),
644
 
645
        .sr_we(sr_we),
646
        .to_sr(to_sr),
647
        .sr(sr),
648
        .branch_op(branch_op)
649
);
650
 
651
//
652
// Instantiation of load/store unit
653
//
654
or1200_lsu or1200_lsu(
655
        .addrbase(operand_a),
656
        .addrofs(lsu_addrofs),
657
        .lsu_op(lsu_op),
658
        .lsu_datain(operand_b),
659
        .lsu_dataout(lsu_dataout),
660
        .lsu_stall(lsu_stall),
661
        .lsu_unstall(lsu_unstall),
662
        .du_stall(du_stall),
663
        .except_align(except_align),
664
        .except_dtlbmiss(except_dtlbmiss),
665
        .except_dmmufault(except_dmmufault),
666
        .except_dbuserr(except_dbuserr),
667
 
668
        .dcpu_adr_o(dcpu_adr_o),
669
        .dcpu_cycstb_o(dcpu_cycstb_o),
670
        .dcpu_we_o(dcpu_we_o),
671
        .dcpu_sel_o(dcpu_sel_o),
672
        .dcpu_tag_o(dcpu_tag_o),
673
        .dcpu_dat_o(dcpu_dat_o),
674
        .dcpu_dat_i(dcpu_dat_i),
675
        .dcpu_ack_i(dcpu_ack_i),
676
        .dcpu_rty_i(dcpu_rty_i),
677
        .dcpu_err_i(dcpu_err_i),
678
        .dcpu_tag_i(dcpu_tag_i)
679
);
680
 
681
//
682
// Instantiation of write-back muxes
683
//
684
or1200_wbmux or1200_wbmux(
685
        .clk(clk),
686
        .rst(rst),
687
        .wb_freeze(wb_freeze),
688
        .rfwb_op(rfwb_op),
689
        .muxin_a(alu_dataout),
690
        .muxin_b(lsu_dataout),
691
        .muxin_c(sprs_dataout),
692
        .muxin_d({lr_sav, 2'b0}),
693
        .muxout(rf_dataw),
694
        .muxreg(wb_forw),
695
        .muxreg_valid(wbforw_valid)
696
);
697
 
698
//
699
// Instantiation of freeze logic
700
//
701
or1200_freeze or1200_freeze(
702
        .clk(clk),
703
        .rst(rst),
704
        .multicycle(multicycle),
705
        .flushpipe(flushpipe),
706
        .extend_flush(extend_flush),
707
        .lsu_stall(lsu_stall),
708
        .if_stall(if_stall),
709
        .lsu_unstall(lsu_unstall),
710
        .force_dslot_fetch(force_dslot_fetch),
711
        .abort_ex(abort_ex),
712
        .du_stall(du_stall),
713
        .mac_stall(mac_stall),
714
        .genpc_freeze(genpc_freeze),
715
        .if_freeze(if_freeze),
716
        .id_freeze(id_freeze),
717
        .ex_freeze(ex_freeze),
718
        .wb_freeze(wb_freeze),
719
        .icpu_ack_i(icpu_ack_i),
720
        .icpu_err_i(icpu_err_i)
721
);
722
 
723
//
724
// Instantiation of exception block
725
//
726
or1200_except or1200_except(
727
        .clk(clk),
728
        .rst(rst),
729
        .sig_ibuserr(except_ibuserr),
730
        .sig_dbuserr(except_dbuserr),
731
        .sig_illegal(except_illegal),
732
        .sig_align(except_align),
733
        .sig_range(1'b0),
734
        .sig_dtlbmiss(except_dtlbmiss),
735
        .sig_dmmufault(except_dmmufault),
736
        .sig_int(sig_int),
737
        .sig_syscall(sig_syscall),
738
        .sig_trap(sig_trap),
739
        .sig_itlbmiss(except_itlbmiss),
740
        .sig_immufault(except_immufault),
741
        .sig_tick(sig_tick),
742
        .branch_taken(branch_taken),
743
        .icpu_ack_i(icpu_ack_i),
744
        .icpu_err_i(icpu_err_i),
745
        .dcpu_ack_i(dcpu_ack_i),
746
        .dcpu_err_i(dcpu_err_i),
747
        .genpc_freeze(genpc_freeze),
748
        .id_freeze(id_freeze),
749
        .ex_freeze(ex_freeze),
750
        .wb_freeze(wb_freeze),
751
        .if_stall(if_stall),
752
        .if_pc(if_pc),
753
        .id_pc(id_pc),
754
        .lr_sav(lr_sav),
755
        .flushpipe(flushpipe),
756
        .extend_flush(extend_flush),
757
        .except_type(except_type),
758
        .except_start(except_start),
759
        .except_started(except_started),
760
        .except_stop(except_stop),
761
        .ex_void(ex_void),
762
        .spr_dat_ppc(spr_dat_ppc),
763
        .spr_dat_npc(spr_dat_npc),
764
 
765
        .datain(operand_b),
766
        .du_dsr(du_dsr),
767
        .epcr_we(epcr_we),
768
        .eear_we(eear_we),
769
        .esr_we(esr_we),
770
        .pc_we(pc_we),
771
        .epcr(epcr),
772
        .eear(eear),
773
        .esr(esr),
774
 
775
        .lsu_addr(dcpu_adr_o),
776
        .sr_we(sr_we),
777
        .to_sr(to_sr),
778
        .sr(sr),
779
        .abort_ex(abort_ex)
780
);
781
 
782
//
783
// Instantiation of configuration registers
784
//
785
or1200_cfgr or1200_cfgr(
786
        .spr_addr(spr_addr),
787
        .spr_dat_o(spr_dat_cfgr)
788
);
789
 
790
endmodule

powered by: WebSVN 2.1.0

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