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

Subversion Repositories or1k_soc_on_altera_embedded_dev_kit

[/] [or1k_soc_on_altera_embedded_dev_kit/] [trunk/] [soc/] [rtl/] [or1200/] [rtl/] [verilog/] [or1200_cpu.v] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 xianfeng
//////////////////////////////////////////////////////////////////////
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
        // Interrupt & tick exceptions
177
        sig_int, sig_tick,
178
 
179
        // SPR interface
180
        supv, spr_addr, spr_dat_cpu, spr_dat_pic, spr_dat_tt, spr_dat_pm,
181
        spr_dat_dmmu, spr_dat_immu, spr_dat_du, spr_cs, spr_we
182
);
183
 
184
parameter dw = `OR1200_OPERAND_WIDTH;
185
parameter aw = `OR1200_REGFILE_ADDR_WIDTH;
186
 
187
//
188
// I/O ports
189
//
190
 
191
//
192
// Clk & Rst
193
//
194
input                           clk;
195
input                           rst;
196
 
197
//
198
// Insn (IC) interface
199
//
200
output                          ic_en;
201
output  [31:0]                   icpu_adr_o;
202
output                          icpu_cycstb_o;
203
output  [3:0]                    icpu_sel_o;
204
output  [3:0]                    icpu_tag_o;
205
input   [31:0]                   icpu_dat_i;
206
input                           icpu_ack_i;
207
input                           icpu_rty_i;
208
input                           icpu_err_i;
209
input   [31:0]                   icpu_adr_i;
210
input   [3:0]                    icpu_tag_i;
211
 
212
//
213
// Insn (IMMU) interface
214
//
215
output                          immu_en;
216
 
217
//
218
// Debug interface
219
//
220
output  [31:0]                   ex_insn;
221
output                          ex_freeze;
222
output  [31:0]                   id_pc;
223
output  [`OR1200_BRANCHOP_WIDTH-1:0]     branch_op;
224
 
225
input                           du_stall;
226
input   [dw-1:0]         du_addr;
227
input   [dw-1:0]         du_dat_du;
228
input                           du_read;
229
input                           du_write;
230
input   [`OR1200_DU_DSR_WIDTH-1:0]       du_dsr;
231
input                           du_hwbkpt;
232
output  [12:0]                   du_except;
233
output  [dw-1:0]         du_dat_cpu;
234
output  [dw-1:0]         rf_dataw;
235
 
236
//
237
// Data (DC) interface
238
//
239
output  [31:0]                   dcpu_adr_o;
240
output                          dcpu_cycstb_o;
241
output                          dcpu_we_o;
242
output  [3:0]                    dcpu_sel_o;
243
output  [3:0]                    dcpu_tag_o;
244
output  [31:0]                   dcpu_dat_o;
245
input   [31:0]                   dcpu_dat_i;
246
input                           dcpu_ack_i;
247
input                           dcpu_rty_i;
248
input                           dcpu_err_i;
249
input   [3:0]                    dcpu_tag_i;
250
output                          dc_en;
251
 
252
//
253
// Data (DMMU) interface
254
//
255
output                          dmmu_en;
256
 
257
//
258
// SPR interface
259
//
260
output                          supv;
261
input   [dw-1:0]         spr_dat_pic;
262
input   [dw-1:0]         spr_dat_tt;
263
input   [dw-1:0]         spr_dat_pm;
264
input   [dw-1:0]         spr_dat_dmmu;
265
input   [dw-1:0]         spr_dat_immu;
266
input   [dw-1:0]         spr_dat_du;
267
output  [dw-1:0]         spr_addr;
268
output  [dw-1:0]         spr_dat_cpu;
269
output  [dw-1:0]         spr_dat_npc;
270
output  [31:0]                   spr_cs;
271
output                          spr_we;
272
 
273
//
274
// Interrupt exceptions
275
//
276
input                           sig_int;
277
input                           sig_tick;
278
 
279
//
280
// Internal wires
281
//
282
wire    [31:0]                   if_insn;
283
wire    [31:0]                   if_pc;
284
wire    [31:2]                  lr_sav;
285
wire    [aw-1:0]         rf_addrw;
286
wire    [aw-1:0]                 rf_addra;
287
wire    [aw-1:0]                 rf_addrb;
288
wire                            rf_rda;
289
wire                            rf_rdb;
290
wire    [dw-1:0]         simm;
291
wire    [dw-1:2]                branch_addrofs;
292
wire    [`OR1200_ALUOP_WIDTH-1:0]        alu_op;
293
wire    [`OR1200_SHROTOP_WIDTH-1:0]      shrot_op;
294
wire    [`OR1200_COMPOP_WIDTH-1:0]       comp_op;
295
wire    [`OR1200_BRANCHOP_WIDTH-1:0]     branch_op;
296
wire    [`OR1200_LSUOP_WIDTH-1:0]        lsu_op;
297
wire                            genpc_freeze;
298
wire                            if_freeze;
299
wire                            id_freeze;
300
wire                            ex_freeze;
301
wire                            wb_freeze;
302
wire    [`OR1200_SEL_WIDTH-1:0]  sel_a;
303
wire    [`OR1200_SEL_WIDTH-1:0]  sel_b;
304
wire    [`OR1200_RFWBOP_WIDTH-1:0]       rfwb_op;
305
wire    [dw-1:0]         rf_dataw;
306
wire    [dw-1:0]         rf_dataa;
307
wire    [dw-1:0]         rf_datab;
308
wire    [dw-1:0]         muxed_b;
309
wire    [dw-1:0]         wb_forw;
310
wire                            wbforw_valid;
311
wire    [dw-1:0]         operand_a;
312
wire    [dw-1:0]         operand_b;
313
wire    [dw-1:0]         alu_dataout;
314
wire    [dw-1:0]         lsu_dataout;
315
wire    [dw-1:0]         sprs_dataout;
316
wire    [31:0]                   lsu_addrofs;
317
wire    [`OR1200_MULTICYCLE_WIDTH-1:0]   multicycle;
318
wire    [`OR1200_EXCEPT_WIDTH-1:0]       except_type;
319
wire    [4:0]                    cust5_op;
320
wire    [5:0]                    cust5_limm;
321
wire                            flushpipe;
322
wire                            extend_flush;
323
wire                            branch_taken;
324
wire                            flag;
325
wire                            flagforw;
326
wire                            flag_we;
327
wire                            carry;
328
wire                            cyforw;
329
wire                            cy_we;
330
wire                            lsu_stall;
331
wire                            epcr_we;
332
wire                            eear_we;
333
wire                            esr_we;
334
wire                            pc_we;
335
wire    [31:0]                   epcr;
336
wire    [31:0]                   eear;
337
wire    [`OR1200_SR_WIDTH-1:0]   esr;
338
wire                            sr_we;
339
wire    [`OR1200_SR_WIDTH-1:0]   to_sr;
340
wire    [`OR1200_SR_WIDTH-1:0]   sr;
341
wire                            except_start;
342
wire                            except_started;
343
wire    [31:0]                   wb_insn;
344
wire    [15:0]                   spr_addrimm;
345
wire                            sig_syscall;
346
wire                            sig_trap;
347
wire    [31:0]                   spr_dat_cfgr;
348
wire    [31:0]                   spr_dat_rf;
349
wire    [31:0]                  spr_dat_npc;
350
wire    [31:0]                   spr_dat_ppc;
351
wire    [31:0]                   spr_dat_mac;
352
wire                            force_dslot_fetch;
353
wire                            no_more_dslot;
354
wire                            ex_void;
355
wire                            if_stall;
356
wire                            id_macrc_op;
357
wire                            ex_macrc_op;
358
wire    [`OR1200_MACOP_WIDTH-1:0] mac_op;
359
wire    [31:0]                   mult_mac_result;
360
wire                            mac_stall;
361
wire    [12:0]                   except_stop;
362
wire                            genpc_refetch;
363
wire                            rfe;
364
wire                            lsu_unstall;
365
wire                            except_align;
366
wire                            except_dtlbmiss;
367
wire                            except_dmmufault;
368
wire                            except_illegal;
369
wire                            except_itlbmiss;
370
wire                            except_immufault;
371
wire                            except_ibuserr;
372
wire                            except_dbuserr;
373
wire                            abort_ex;
374
 
375
//
376
// Send exceptions to Debug Unit
377
//
378
assign du_except = except_stop;
379
 
380
//
381
// Data cache enable
382
//
383
assign dc_en = sr[`OR1200_SR_DCE];
384
 
385
//
386
// Instruction cache enable
387
//
388
assign ic_en = sr[`OR1200_SR_ICE];
389
 
390
//
391
// DMMU enable
392
//
393
assign dmmu_en = sr[`OR1200_SR_DME];
394
 
395
//
396
// IMMU enable
397
//
398
assign immu_en = sr[`OR1200_SR_IME];
399
 
400
//
401
// SUPV bit
402
//
403
assign supv = sr[`OR1200_SR_SM];
404
 
405
//
406
// Instantiation of instruction fetch block
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(sr[`OR1200_SR_EPH]),
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
or1200_rf or1200_rf(
513
        .clk(clk),
514
        .rst(rst),
515
        .supv(sr[`OR1200_SR_SM]),
516
        .wb_freeze(wb_freeze),
517
        .addrw(rf_addrw),
518
        .dataw(rf_dataw),
519
        .id_freeze(id_freeze),
520
        .we(rfwb_op[0]),
521
        .flushpipe(flushpipe),
522
        .addra(rf_addra),
523
        .rda(rf_rda),
524
        .dataa(rf_dataa),
525
        .addrb(rf_addrb),
526
        .rdb(rf_rdb),
527
        .datab(rf_datab),
528
        .spr_cs(spr_cs[`OR1200_SPR_GROUP_SYS]),
529
        .spr_write(spr_we),
530
        .spr_addr(spr_addr),
531
        .spr_dat_i(spr_dat_cpu),
532
        .spr_dat_o(spr_dat_rf)
533
);
534
 
535
//
536
// Instantiation of operand muxes
537
//
538
or1200_operandmuxes or1200_operandmuxes(
539
        .clk(clk),
540
        .rst(rst),
541
        .id_freeze(id_freeze),
542
        .ex_freeze(ex_freeze),
543
        .rf_dataa(rf_dataa),
544
        .rf_datab(rf_datab),
545
        .ex_forw(rf_dataw),
546
        .wb_forw(wb_forw),
547
        .simm(simm),
548
        .sel_a(sel_a),
549
        .sel_b(sel_b),
550
        .operand_a(operand_a),
551
        .operand_b(operand_b),
552
        .muxed_b(muxed_b)
553
);
554
 
555
//
556
// Instantiation of CPU's ALU
557
//
558
or1200_alu or1200_alu(
559
        .a(operand_a),
560
        .b(operand_b),
561
        .mult_mac_result(mult_mac_result),
562
        .macrc_op(ex_macrc_op),
563
        .alu_op(alu_op),
564
        .shrot_op(shrot_op),
565
        .comp_op(comp_op),
566
        .cust5_op(cust5_op),
567
        .cust5_limm(cust5_limm),
568
        .result(alu_dataout),
569
        .flagforw(flagforw),
570
        .flag_we(flag_we),
571
        .cyforw(cyforw),
572
        .cy_we(cy_we),
573
  .flag(flag),
574
        .carry(carry)
575
);
576
 
577
//
578
// Instantiation of CPU's ALU
579
//
580
or1200_mult_mac or1200_mult_mac(
581
        .clk(clk),
582
        .rst(rst),
583
        .ex_freeze(ex_freeze),
584
        .id_macrc_op(id_macrc_op),
585
        .macrc_op(ex_macrc_op),
586
        .a(operand_a),
587
        .b(operand_b),
588
        .mac_op(mac_op),
589
        .alu_op(alu_op),
590
        .result(mult_mac_result),
591
        .mac_stall_r(mac_stall),
592
        .spr_cs(spr_cs[`OR1200_SPR_GROUP_MAC]),
593
        .spr_write(spr_we),
594
        .spr_addr(spr_addr),
595
        .spr_dat_i(spr_dat_cpu),
596
        .spr_dat_o(spr_dat_mac)
597
);
598
 
599
//
600
// Instantiation of CPU's SPRS block
601
//
602
or1200_sprs or1200_sprs(
603
        .clk(clk),
604
        .rst(rst),
605
        .addrbase(operand_a),
606
        .addrofs(spr_addrimm),
607
        .dat_i(operand_b),
608
        .alu_op(alu_op),
609
        .flagforw(flagforw),
610
        .flag_we(flag_we),
611
        .flag(flag),
612
        .cyforw(cyforw),
613
        .cy_we(cy_we),
614
        .carry(carry),
615
        .to_wbmux(sprs_dataout),
616
 
617
        .du_addr(du_addr),
618
        .du_dat_du(du_dat_du),
619
        .du_read(du_read),
620
        .du_write(du_write),
621
        .du_dat_cpu(du_dat_cpu),
622
 
623
        .spr_addr(spr_addr),
624
        .spr_dat_pic(spr_dat_pic),
625
        .spr_dat_tt(spr_dat_tt),
626
        .spr_dat_pm(spr_dat_pm),
627
        .spr_dat_cfgr(spr_dat_cfgr),
628
        .spr_dat_rf(spr_dat_rf),
629
        .spr_dat_npc(spr_dat_npc),
630
        .spr_dat_ppc(spr_dat_ppc),
631
        .spr_dat_mac(spr_dat_mac),
632
        .spr_dat_dmmu(spr_dat_dmmu),
633
        .spr_dat_immu(spr_dat_immu),
634
        .spr_dat_du(spr_dat_du),
635
        .spr_dat_o(spr_dat_cpu),
636
        .spr_cs(spr_cs),
637
        .spr_we(spr_we),
638
 
639
        .epcr_we(epcr_we),
640
        .eear_we(eear_we),
641
        .esr_we(esr_we),
642
        .pc_we(pc_we),
643
        .epcr(epcr),
644
        .eear(eear),
645
        .esr(esr),
646
        .except_started(except_started),
647
 
648
        .sr_we(sr_we),
649
        .to_sr(to_sr),
650
        .sr(sr),
651
        .branch_op(branch_op)
652
);
653
 
654
//
655
// Instantiation of load/store unit
656
//
657
or1200_lsu or1200_lsu(
658
        .addrbase(operand_a),
659
        .addrofs(lsu_addrofs),
660
        .lsu_op(lsu_op),
661
        .lsu_datain(operand_b),
662
        .lsu_dataout(lsu_dataout),
663
        .lsu_stall(lsu_stall),
664
        .lsu_unstall(lsu_unstall),
665
        .du_stall(du_stall),
666
        .except_align(except_align),
667
        .except_dtlbmiss(except_dtlbmiss),
668
        .except_dmmufault(except_dmmufault),
669
        .except_dbuserr(except_dbuserr),
670
 
671
        .dcpu_adr_o(dcpu_adr_o),
672
        .dcpu_cycstb_o(dcpu_cycstb_o),
673
        .dcpu_we_o(dcpu_we_o),
674
        .dcpu_sel_o(dcpu_sel_o),
675
        .dcpu_tag_o(dcpu_tag_o),
676
        .dcpu_dat_o(dcpu_dat_o),
677
        .dcpu_dat_i(dcpu_dat_i),
678
        .dcpu_ack_i(dcpu_ack_i),
679
        .dcpu_rty_i(dcpu_rty_i),
680
        .dcpu_err_i(dcpu_err_i),
681
        .dcpu_tag_i(dcpu_tag_i)
682
);
683
 
684
//
685
// Instantiation of write-back muxes
686
//
687
or1200_wbmux or1200_wbmux(
688
        .clk(clk),
689
        .rst(rst),
690
        .wb_freeze(wb_freeze),
691
        .rfwb_op(rfwb_op),
692
        .muxin_a(alu_dataout),
693
        .muxin_b(lsu_dataout),
694
        .muxin_c(sprs_dataout),
695
        .muxin_d({lr_sav, 2'b0}),
696
        .muxout(rf_dataw),
697
        .muxreg(wb_forw),
698
        .muxreg_valid(wbforw_valid)
699
);
700
 
701
//
702
// Instantiation of freeze logic
703
//
704
or1200_freeze or1200_freeze(
705
        .clk(clk),
706
        .rst(rst),
707
        .multicycle(multicycle),
708
        .flushpipe(flushpipe),
709
        .extend_flush(extend_flush),
710
        .lsu_stall(lsu_stall),
711
        .if_stall(if_stall),
712
        .lsu_unstall(lsu_unstall),
713
        .force_dslot_fetch(force_dslot_fetch),
714
        .abort_ex(abort_ex),
715
        .du_stall(du_stall),
716
        .mac_stall(mac_stall),
717
        .genpc_freeze(genpc_freeze),
718
        .if_freeze(if_freeze),
719
        .id_freeze(id_freeze),
720
        .ex_freeze(ex_freeze),
721
        .wb_freeze(wb_freeze),
722
        .icpu_ack_i(icpu_ack_i),
723
        .icpu_err_i(icpu_err_i)
724
);
725
 
726
//
727
// Instantiation of exception block
728
//
729
or1200_except or1200_except(
730
        .clk(clk),
731
        .rst(rst),
732
        .sig_ibuserr(except_ibuserr),
733
        .sig_dbuserr(except_dbuserr),
734
        .sig_illegal(except_illegal),
735
        .sig_align(except_align),
736
        .sig_range(1'b0),
737
        .sig_dtlbmiss(except_dtlbmiss),
738
        .sig_dmmufault(except_dmmufault),
739
        .sig_int(sig_int),
740
        .sig_syscall(sig_syscall),
741
        .sig_trap(sig_trap),
742
        .sig_itlbmiss(except_itlbmiss),
743
        .sig_immufault(except_immufault),
744
        .sig_tick(sig_tick),
745
        .branch_taken(branch_taken),
746
        .icpu_ack_i(icpu_ack_i),
747
        .icpu_err_i(icpu_err_i),
748
        .dcpu_ack_i(dcpu_ack_i),
749
        .dcpu_err_i(dcpu_err_i),
750
        .genpc_freeze(genpc_freeze),
751
        .id_freeze(id_freeze),
752
        .ex_freeze(ex_freeze),
753
        .wb_freeze(wb_freeze),
754
        .if_stall(if_stall),
755
        .if_pc(if_pc),
756
        .id_pc(id_pc),
757
        .lr_sav(lr_sav),
758
        .flushpipe(flushpipe),
759
        .extend_flush(extend_flush),
760
        .except_type(except_type),
761
        .except_start(except_start),
762
        .except_started(except_started),
763
        .except_stop(except_stop),
764
        .ex_void(ex_void),
765
        .spr_dat_ppc(spr_dat_ppc),
766
        .spr_dat_npc(spr_dat_npc),
767
 
768
        .datain(operand_b),
769
        .du_dsr(du_dsr),
770
        .epcr_we(epcr_we),
771
        .eear_we(eear_we),
772
        .esr_we(esr_we),
773
        .pc_we(pc_we),
774
        .epcr(epcr),
775
        .eear(eear),
776
        .esr(esr),
777
 
778
        .lsu_addr(dcpu_adr_o),
779
        .sr_we(sr_we),
780
        .to_sr(to_sr),
781
        .sr(sr),
782
        .abort_ex(abort_ex)
783
);
784
 
785
//
786
// Instantiation of configuration registers
787
//
788
or1200_cfgr or1200_cfgr(
789
        .spr_addr(spr_addr),
790
        .spr_dat_o(spr_dat_cfgr)
791
);
792
 
793
endmodule

powered by: WebSVN 2.1.0

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