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

Subversion Repositories or1k

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

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

powered by: WebSVN 2.1.0

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