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

Subversion Repositories or1k

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

powered by: WebSVN 2.1.0

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