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

Subversion Repositories or1k

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

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

powered by: WebSVN 2.1.0

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