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

Subversion Repositories or1k

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

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

powered by: WebSVN 2.1.0

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