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

Subversion Repositories or1k

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

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

powered by: WebSVN 2.1.0

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