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 791

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

powered by: WebSVN 2.1.0

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