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

Subversion Repositories or1k

[/] [or1k/] [tags/] [rel_26/] [or1200/] [rtl/] [verilog/] [or1200_cpu.v] - Blame information for rev 1765

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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