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

Subversion Repositories or1k

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

powered by: WebSVN 2.1.0

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