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

Subversion Repositories or1200_hp

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

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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