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 636

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

powered by: WebSVN 2.1.0

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