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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [rtl/] [verilog/] [or1200/] [or1200_cpu.v] - Blame information for rev 561

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 350 julius
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  OR1200's CPU                                                ////
4
////                                                              ////
5
////  This file is part of the OpenRISC 1200 project              ////
6
////  http://www.opencores.org/project,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
// $Log: or1200_cpu.v,v $
46
// Revision 2.0  2010/06/30 11:00:00  ORSoC
47
// Major update: 
48
// Structure reordered and bugs fixed. 
49
 
50
// synopsys translate_off
51
`include "timescale.v"
52
// synopsys translate_on
53
`include "or1200_defines.v"
54
 
55
module or1200_cpu(
56
        // Clk & Rst
57
        clk, rst,
58
 
59
        // Insn interface
60
        ic_en,
61
        icpu_adr_o, icpu_cycstb_o, icpu_sel_o, icpu_tag_o,
62
        icpu_dat_i, icpu_ack_i, icpu_rty_i, icpu_err_i, icpu_adr_i, icpu_tag_i,
63
        immu_en,
64
 
65
        // Debug unit
66
        id_void, id_insn, ex_void,
67
        ex_insn, ex_freeze, wb_insn, wb_freeze, id_pc, ex_pc, wb_pc, branch_op,
68
        spr_dat_npc, rf_dataw, ex_flushpipe,
69
        du_stall, du_addr, du_dat_du, du_read, du_write, du_except_stop,
70
        du_except_trig, du_dsr, du_dmr1, du_hwbkpt, du_hwbkpt_ls_r, du_dat_cpu,
71
        du_lsu_store_dat, du_lsu_load_dat,
72
        abort_mvspr, abort_ex,
73
 
74
        // Data interface
75
        dc_en,
76
        dcpu_adr_o, dcpu_cycstb_o, dcpu_we_o, dcpu_sel_o, dcpu_tag_o,
77
        dcpu_dat_o, dcpu_dat_i, dcpu_ack_i, dcpu_rty_i, dcpu_err_i, dcpu_tag_i,
78
        sb_en, dmmu_en, dc_no_writethrough,
79
 
80
        // SR Interface
81
        boot_adr_sel_i,
82
 
83
        // Interrupt & tick exceptions
84
        sig_int, sig_tick,
85
 
86
        // SPR interface
87
        supv, spr_addr, spr_dat_cpu, spr_dat_pic, spr_dat_tt, spr_dat_pm,
88
        spr_dat_dmmu, spr_dat_immu, spr_dat_du, spr_cs, spr_we, mtspr_dc_done
89
);
90
 
91
parameter dw = `OR1200_OPERAND_WIDTH;
92
parameter aw = `OR1200_REGFILE_ADDR_WIDTH;
93
 
94
//
95
// I/O ports
96
//
97
 
98
//
99
// Clk & Rst
100
//
101
input                           clk;
102
input                           rst;
103
 
104
//
105
// Insn (IC) interface
106
//
107
output                          ic_en;
108
output  [31:0]                   icpu_adr_o;
109
output                          icpu_cycstb_o;
110
output  [3:0]                    icpu_sel_o;
111
output  [3:0]                    icpu_tag_o;
112
input   [31:0]                   icpu_dat_i;
113
input                           icpu_ack_i;
114
input                           icpu_rty_i;
115
input                           icpu_err_i;
116
input   [31:0]                   icpu_adr_i;
117
input   [3:0]                    icpu_tag_i;
118
 
119
//
120
// Insn (IMMU) interface
121
//
122
output                          immu_en;
123
 
124
//
125
// Debug interface
126
//
127
output                          id_void;
128
output  [31:0]                   id_insn;
129
output                          ex_void;
130
output  [31:0]                   ex_insn;
131
output                          ex_freeze;
132
output  [31:0]                   wb_insn;
133
output                          wb_freeze;
134
output  [31:0]                   id_pc;
135
output  [31:0]                   ex_pc;
136
output  [31:0]                   wb_pc;
137
output                          ex_flushpipe;
138
output  [`OR1200_BRANCHOP_WIDTH-1:0]     branch_op;
139
 
140
input                           du_stall;
141
input   [dw-1:0]         du_addr;
142
input   [dw-1:0]         du_dat_du;
143
input                           du_read;
144
input                           du_write;
145
input   [`OR1200_DU_DSR_WIDTH-1:0]       du_dsr;
146
input   [24:0]                   du_dmr1;
147
input                           du_hwbkpt;
148
input                           du_hwbkpt_ls_r;
149
output  [13:0]                   du_except_trig;
150
output  [13:0]                   du_except_stop;
151
output  [dw-1:0]         du_dat_cpu;
152
output  [dw-1:0]         rf_dataw;
153
output  [dw-1:0]         du_lsu_store_dat;
154
output  [dw-1:0]         du_lsu_load_dat;
155
 
156
//
157
// Data (DC) interface
158
//
159
output  [31:0]                   dcpu_adr_o;
160
output                          dcpu_cycstb_o;
161
output                          dcpu_we_o;
162
output  [3:0]                    dcpu_sel_o;
163
output  [3:0]                    dcpu_tag_o;
164
output  [31:0]                   dcpu_dat_o;
165
input   [31:0]                   dcpu_dat_i;
166
input                           dcpu_ack_i;
167
input                           dcpu_rty_i;
168
input                           dcpu_err_i;
169
input   [3:0]                    dcpu_tag_i;
170
output                          dc_en;
171
output                          dc_no_writethrough;
172
 
173
//
174
// Data (DMMU) interface
175
//
176
output                          sb_en;
177
output                          dmmu_en;
178
output                          abort_ex;
179
output                          abort_mvspr;
180
 
181
//
182
// SR Interface 
183
//
184
input                           boot_adr_sel_i;
185
 
186
//
187
// SPR interface
188
//
189
output                          supv;
190
input   [dw-1:0]         spr_dat_pic;
191
input   [dw-1:0]         spr_dat_tt;
192
input   [dw-1:0]         spr_dat_pm;
193
input   [dw-1:0]         spr_dat_dmmu;
194
input   [dw-1:0]         spr_dat_immu;
195
input   [dw-1:0]         spr_dat_du;
196
output  [dw-1:0]         spr_addr;
197
output  [dw-1:0]         spr_dat_cpu;
198
output  [dw-1:0]         spr_dat_npc;
199
output  [31:0]                   spr_cs;
200
output                          spr_we;
201
input                           mtspr_dc_done;
202
 
203
//
204
// Interrupt exceptions
205
//
206
input                           sig_int;
207
input                           sig_tick;
208
 
209
//
210
// Internal wires
211
//
212
wire    [31:0]                   if_insn;
213
wire                            saving_if_insn;
214
wire    [31:0]                   if_pc;
215
wire    [aw-1:0]         rf_addrw;
216
wire    [aw-1:0]                 rf_addra;
217
wire    [aw-1:0]                 rf_addrb;
218
wire                            rf_rda;
219
wire                            rf_rdb;
220
wire    [dw-1:0]         id_simm;
221
wire    [dw-1:2]                id_branch_addrtarget;
222
wire    [dw-1:2]                ex_branch_addrtarget;
223
wire    [`OR1200_ALUOP_WIDTH-1:0]        alu_op;
224 403 julius
wire    [`OR1200_ALUOP2_WIDTH-1:0]       alu_op2;
225 350 julius
wire    [`OR1200_COMPOP_WIDTH-1:0]       comp_op;
226
wire    [`OR1200_BRANCHOP_WIDTH-1:0]     pre_branch_op;
227
wire    [`OR1200_BRANCHOP_WIDTH-1:0]     branch_op;
228
wire    [`OR1200_LSUOP_WIDTH-1:0]        id_lsu_op;
229
wire                            genpc_freeze;
230
wire                            if_freeze;
231
wire                            id_freeze;
232
wire                            ex_freeze;
233
wire                            wb_freeze;
234
wire    [`OR1200_SEL_WIDTH-1:0]  sel_a;
235
wire    [`OR1200_SEL_WIDTH-1:0]  sel_b;
236
wire    [`OR1200_RFWBOP_WIDTH-1:0]       rfwb_op;
237
wire    [`OR1200_FPUOP_WIDTH-1:0]       fpu_op;
238
wire    [dw-1:0]         rf_dataw;
239
wire    [dw-1:0]         rf_dataa;
240
wire    [dw-1:0]         rf_datab;
241
wire    [dw-1:0]         muxed_a;
242
wire    [dw-1:0]         muxed_b;
243
wire    [dw-1:0]         wb_forw;
244
wire                            wbforw_valid;
245
wire    [dw-1:0]         operand_a;
246
wire    [dw-1:0]         operand_b;
247
wire    [dw-1:0]         alu_dataout;
248
wire    [dw-1:0]         lsu_dataout;
249
wire    [dw-1:0]         sprs_dataout;
250
wire    [dw-1:0]         fpu_dataout;
251
wire                            fpu_done;
252
wire    [31:0]                   ex_simm;
253
wire    [`OR1200_MULTICYCLE_WIDTH-1:0]   multicycle;
254
wire    [`OR1200_WAIT_ON_WIDTH-1:0]      wait_on;
255
wire    [`OR1200_EXCEPT_WIDTH-1:0]       except_type;
256
wire    [4:0]                    cust5_op;
257
wire    [5:0]                    cust5_limm;
258
wire                            if_flushpipe;
259
wire                            id_flushpipe;
260
wire                            ex_flushpipe;
261
wire                            wb_flushpipe;
262
wire                            extend_flush;
263
wire                            ex_branch_taken;
264
wire                            flag;
265
wire                            flagforw;
266
wire                            flag_we;
267
wire                            flagforw_alu;
268
wire                            flag_we_alu;
269
wire                            flagforw_fpu;
270
wire                            flag_we_fpu;
271
wire                            carry;
272
wire                            cyforw;
273
wire                            cy_we_alu;
274 502 julius
wire                            ovforw;
275
wire                            ov_we_alu;
276
wire                            ovforw_mult_mac;
277
wire                            ov_we_mult_mac;
278 350 julius
wire                            cy_we_rf;
279
wire                            lsu_stall;
280
wire                            epcr_we;
281
wire                            eear_we;
282
wire                            esr_we;
283
wire                            pc_we;
284
wire    [31:0]                   epcr;
285
wire    [31:0]                   eear;
286
wire    [`OR1200_SR_WIDTH-1:0]   esr;
287
wire    [`OR1200_FPCSR_WIDTH-1:0]       fpcsr;
288
wire                            fpcsr_we;
289
wire                            sr_we;
290
wire    [`OR1200_SR_WIDTH-1:0]   to_sr;
291
wire    [`OR1200_SR_WIDTH-1:0]   sr;
292
wire                            except_flushpipe;
293
wire                            except_start;
294
wire                            except_started;
295
wire                            fpu_except_started;
296
wire    [31:0]                   wb_insn;
297
wire                            sig_syscall;
298
wire                            sig_trap;
299 502 julius
wire                            sig_range;
300 350 julius
wire                            sig_fp;
301
wire    [31:0]                   spr_dat_cfgr;
302
wire    [31:0]                   spr_dat_rf;
303
wire    [31:0]                  spr_dat_npc;
304
wire    [31:0]                   spr_dat_ppc;
305
wire    [31:0]                   spr_dat_mac;
306
wire [31:0]                      spr_dat_fpu;
307
wire                            mtspr_done;
308
wire                            force_dslot_fetch;
309
wire                            no_more_dslot;
310
wire                            ex_void;
311
wire                            ex_spr_read;
312
wire                            ex_spr_write;
313
wire                            if_stall;
314
wire                            id_macrc_op;
315
wire                            ex_macrc_op;
316
wire    [`OR1200_MACOP_WIDTH-1:0] id_mac_op;
317
wire    [`OR1200_MACOP_WIDTH-1:0] mac_op;
318
wire    [31:0]                   mult_mac_result;
319 435 julius
wire                            mult_mac_stall;
320 350 julius
wire    [13:0]                   except_trig;
321
wire    [13:0]                   except_stop;
322
wire                            genpc_refetch;
323
wire                            rfe;
324
wire                            lsu_unstall;
325
wire                            except_align;
326
wire                            except_dtlbmiss;
327
wire                            except_dmmufault;
328
wire                            except_illegal;
329
wire                            except_itlbmiss;
330
wire                            except_immufault;
331
wire                            except_ibuserr;
332
wire                            except_dbuserr;
333
wire                            abort_ex;
334
wire                            abort_mvspr;
335
 
336
//
337
// Send exceptions to Debug Unit
338
//
339
assign du_except_trig = except_trig;
340
assign du_except_stop = except_stop;
341
assign du_lsu_store_dat = operand_b;
342
assign du_lsu_load_dat  = lsu_dataout;
343
 
344
//
345
// Data cache enable
346
//
347
`ifdef OR1200_NO_DC
348
assign dc_en = 1'b0;
349
`else
350
   assign dc_en = sr[`OR1200_SR_DCE];
351
`endif
352
 
353
//
354
// Instruction cache enable
355
//
356
`ifdef OR1200_NO_IC
357
assign ic_en = 1'b0;
358
`else
359
assign ic_en = sr[`OR1200_SR_ICE];
360
`endif
361
 
362
//
363
// SB enable
364
//
365
`ifdef OR1200_SB_IMPLEMENTED
366
//assign sb_en = sr[`OR1200_SR_SBE]; // SBE not defined  -- jb
367
`else
368
assign sb_en = 1'b0;
369
`endif
370
 
371
//
372
// DMMU enable
373
//
374
`ifdef OR1200_NO_DMMU
375
assign dmmu_en = 1'b0;
376
`else
377
assign dmmu_en = sr[`OR1200_SR_DME];
378
`endif
379
 
380
//
381
// IMMU enable
382
//
383
`ifdef OR1200_NO_IMMU
384
assign immu_en = 1'b0;
385
`else
386
assign immu_en = sr[`OR1200_SR_IME] & ~except_started;
387
`endif
388
 
389
//
390
// SUPV bit
391
//
392
assign supv = sr[`OR1200_SR_SM];
393
 
394
//
395
// FLAG write enable
396
//
397
assign flagforw = (flag_we_alu & flagforw_alu) | (flagforw_fpu & flag_we_fpu);
398
assign flag_we = (flag_we_alu | flag_we_fpu) & ~abort_mvspr;
399
 
400
//
401 502 julius
// Flag for any MTSPR instructions, that must block execution, to indicate done
402 350 julius
//
403
assign mtspr_done = mtspr_dc_done;
404 502 julius
 
405
//
406
// Range exception
407
//
408
assign sig_range = sr[`OR1200_SR_OV];
409 350 julius
 
410
 
411 502 julius
 
412 350 julius
//
413
// Instantiation of instruction fetch block
414
//
415
or1200_genpc or1200_genpc(
416
        .clk(clk),
417
        .rst(rst),
418
        .icpu_adr_o(icpu_adr_o),
419
        .icpu_cycstb_o(icpu_cycstb_o),
420
        .icpu_sel_o(icpu_sel_o),
421
        .icpu_tag_o(icpu_tag_o),
422
        .icpu_rty_i(icpu_rty_i),
423
        .icpu_adr_i(icpu_adr_i),
424
 
425
        .pre_branch_op(pre_branch_op),
426
        .branch_op(branch_op),
427
        .except_type(except_type),
428
        .except_start(except_start),
429
        .except_prefix(sr[`OR1200_SR_EPH]),
430
        .id_branch_addrtarget(id_branch_addrtarget),
431
        .ex_branch_addrtarget(ex_branch_addrtarget),
432
        .muxed_b(muxed_b),
433
        .operand_b(operand_b),
434
        .flag(flag),
435
        .flagforw(flagforw),
436
        .ex_branch_taken(ex_branch_taken),
437
        .epcr(epcr),
438
        .spr_dat_i(spr_dat_cpu),
439
        .spr_pc_we(pc_we),
440
        .genpc_refetch(genpc_refetch),
441
        .genpc_freeze(genpc_freeze),
442
        .no_more_dslot(no_more_dslot)
443
);
444
 
445
//
446
// Instantiation of instruction fetch block
447
//
448
or1200_if or1200_if(
449
        .clk(clk),
450
        .rst(rst),
451
        .icpu_dat_i(icpu_dat_i),
452
        .icpu_ack_i(icpu_ack_i),
453
        .icpu_err_i(icpu_err_i),
454
        .icpu_adr_i(icpu_adr_i),
455
        .icpu_tag_i(icpu_tag_i),
456
 
457
        .if_freeze(if_freeze),
458
        .if_insn(if_insn),
459
        .if_pc(if_pc),
460
        .saving_if_insn(saving_if_insn),
461
        .if_flushpipe(if_flushpipe),
462
        .if_stall(if_stall),
463
        .no_more_dslot(no_more_dslot),
464
        .genpc_refetch(genpc_refetch),
465
        .rfe(rfe),
466
        .except_itlbmiss(except_itlbmiss),
467
        .except_immufault(except_immufault),
468
        .except_ibuserr(except_ibuserr)
469
);
470
 
471
//
472
// Instantiation of instruction decode/control logic
473
//
474
or1200_ctrl or1200_ctrl(
475
        .clk(clk),
476
        .rst(rst),
477
        .id_freeze(id_freeze),
478
        .ex_freeze(ex_freeze),
479
        .wb_freeze(wb_freeze),
480
        .if_flushpipe(if_flushpipe),
481
        .id_flushpipe(id_flushpipe),
482
        .ex_flushpipe(ex_flushpipe),
483
        .wb_flushpipe(wb_flushpipe),
484
        .extend_flush(extend_flush),
485
        .except_flushpipe(except_flushpipe),
486
        .abort_mvspr(abort_mvspr),
487
        .if_insn(if_insn),
488
        .id_insn(id_insn),
489
        .ex_insn(ex_insn),
490
        .id_branch_op(pre_branch_op),
491
        .ex_branch_op(branch_op),
492
        .ex_branch_taken(ex_branch_taken),
493
        .rf_addra(rf_addra),
494
        .rf_addrb(rf_addrb),
495
        .rf_rda(rf_rda),
496
        .rf_rdb(rf_rdb),
497
        .alu_op(alu_op),
498 403 julius
        .alu_op2(alu_op2),
499 350 julius
        .mac_op(mac_op),
500
        .comp_op(comp_op),
501
        .rf_addrw(rf_addrw),
502
        .rfwb_op(rfwb_op),
503
        .fpu_op(fpu_op),
504
        .pc_we(pc_we),
505
        .wb_insn(wb_insn),
506
        .id_simm(id_simm),
507
        .id_branch_addrtarget(id_branch_addrtarget),
508
        .ex_branch_addrtarget(ex_branch_addrtarget),
509
        .ex_simm(ex_simm),
510
        .sel_a(sel_a),
511
        .sel_b(sel_b),
512
        .id_lsu_op(id_lsu_op),
513
        .cust5_op(cust5_op),
514
        .cust5_limm(cust5_limm),
515
        .id_pc(id_pc),
516
        .ex_pc(ex_pc),
517
        .multicycle(multicycle),
518
        .wait_on(wait_on),
519
        .wbforw_valid(wbforw_valid),
520
        .sig_syscall(sig_syscall),
521
        .sig_trap(sig_trap),
522
        .force_dslot_fetch(force_dslot_fetch),
523
        .no_more_dslot(no_more_dslot),
524
        .id_void(id_void),
525
        .ex_void(ex_void),
526
        .ex_spr_read(ex_spr_read),
527
        .ex_spr_write(ex_spr_write),
528
        .id_mac_op(id_mac_op),
529
        .id_macrc_op(id_macrc_op),
530
        .ex_macrc_op(ex_macrc_op),
531
        .rfe(rfe),
532
        .du_hwbkpt(du_hwbkpt),
533
        .except_illegal(except_illegal),
534
        .dc_no_writethrough(dc_no_writethrough)
535
);
536
 
537
//
538
// Instantiation of register file
539
//
540
or1200_rf or1200_rf(
541
        .clk(clk),
542
        .rst(rst),
543
        .cy_we_i(cy_we_alu),
544
        .cy_we_o(cy_we_rf),
545
        .supv(sr[`OR1200_SR_SM]),
546
        .wb_freeze(wb_freeze),
547
        .addrw(rf_addrw),
548
        .dataw(rf_dataw),
549
        .id_freeze(id_freeze),
550
        .we(rfwb_op[0]),
551
        .flushpipe(wb_flushpipe),
552
        .addra(rf_addra),
553
        .rda(rf_rda),
554
        .dataa(rf_dataa),
555
        .addrb(rf_addrb),
556
        .rdb(rf_rdb),
557
        .datab(rf_datab),
558
        .spr_cs(spr_cs[`OR1200_SPR_GROUP_SYS]),
559
        .spr_write(spr_we),
560
        .spr_addr(spr_addr),
561
        .spr_dat_i(spr_dat_cpu),
562
        .spr_dat_o(spr_dat_rf),
563
        .du_read(du_read)
564
);
565
 
566
//
567
// Instantiation of operand muxes
568
//
569
or1200_operandmuxes or1200_operandmuxes(
570
        .clk(clk),
571
        .rst(rst),
572
        .id_freeze(id_freeze),
573
        .ex_freeze(ex_freeze),
574
        .rf_dataa(rf_dataa),
575
        .rf_datab(rf_datab),
576
        .ex_forw(rf_dataw),
577
        .wb_forw(wb_forw),
578
        .simm(id_simm),
579
        .sel_a(sel_a),
580
        .sel_b(sel_b),
581
        .operand_a(operand_a),
582
        .operand_b(operand_b),
583
        .muxed_a(muxed_a),
584
        .muxed_b(muxed_b)
585
);
586
 
587
//
588
// Instantiation of CPU's ALU
589
//
590
or1200_alu or1200_alu(
591
        .a(operand_a),
592
        .b(operand_b),
593
        .mult_mac_result(mult_mac_result),
594
        .macrc_op(ex_macrc_op),
595
        .alu_op(alu_op),
596 403 julius
        .alu_op2(alu_op2),
597 350 julius
        .comp_op(comp_op),
598
        .cust5_op(cust5_op),
599
        .cust5_limm(cust5_limm),
600
        .result(alu_dataout),
601
        .flagforw(flagforw_alu),
602
        .flag_we(flag_we_alu),
603
        .cyforw(cyforw),
604
        .cy_we(cy_we_alu),
605 502 julius
        .ovforw(ovforw),
606
        .ov_we(ov_we_alu),
607 350 julius
        .flag(flag),
608
        .carry(carry)
609
);
610
 
611
 
612
//
613
// FPU's exception is being dealt with
614
//    
615
assign fpu_except_started = except_started && (except_type == `OR1200_EXCEPT_FLOAT);
616
 
617
//
618
// Instantiation of FPU
619
//
620
or1200_fpu or1200_fpu(
621
        .clk(clk),
622
        .rst(rst),
623
        .ex_freeze(ex_freeze),
624
        .a(operand_a),
625
        .b(operand_b),
626
        .fpu_op(fpu_op),
627
        .result(fpu_dataout),
628
        .done(fpu_done),
629
        .flagforw(flagforw_fpu),
630
        .flag_we(flag_we_fpu),
631
        .sig_fp(sig_fp),
632
        .except_started(fpu_except_started),
633
        .fpcsr_we(fpcsr_we),
634
        .fpcsr(fpcsr),
635
        .spr_cs(spr_cs[`OR1200_SPR_GROUP_FPU]),
636
        .spr_write(spr_we),
637
        .spr_addr(spr_addr),
638
        .spr_dat_i(spr_dat_cpu),
639
        .spr_dat_o(spr_dat_fpu)
640
);
641
 
642
 
643
//
644
// Instantiation of CPU's multiply unit
645
//
646
or1200_mult_mac or1200_mult_mac(
647
        .clk(clk),
648
        .rst(rst),
649
        .ex_freeze(ex_freeze),
650
        .id_macrc_op(id_macrc_op),
651
        .macrc_op(ex_macrc_op),
652
        .a(operand_a),
653
        .b(operand_b),
654
        .mac_op(mac_op),
655
        .alu_op(alu_op),
656
        .result(mult_mac_result),
657 502 julius
        .ovforw(ovforw_mult_mac),
658
        .ov_we(ov_we_mult_mac),
659 435 julius
        .mult_mac_stall(mult_mac_stall),
660 350 julius
        .spr_cs(spr_cs[`OR1200_SPR_GROUP_MAC]),
661
        .spr_write(spr_we),
662
        .spr_addr(spr_addr),
663
        .spr_dat_i(spr_dat_cpu),
664
        .spr_dat_o(spr_dat_mac)
665
);
666
 
667
//
668
// Instantiation of CPU's SPRS block
669
//
670
or1200_sprs or1200_sprs(
671
        .clk(clk),
672
        .rst(rst),
673
        .addrbase(operand_a),
674
        .addrofs(ex_simm[15:0]),
675
        .dat_i(operand_b),
676
        .ex_spr_read(ex_spr_read),
677
        .ex_spr_write(ex_spr_write),
678
        .flagforw(flagforw),
679
        .flag_we(flag_we),
680
        .flag(flag),
681
        .cyforw(cyforw),
682
        .cy_we(cy_we_rf),
683
        .carry(carry),
684 502 julius
        .ovforw(ovforw | ovforw_mult_mac),
685
        .ov_we(ov_we_alu | ov_we_mult_mac),
686 350 julius
        .to_wbmux(sprs_dataout),
687
 
688
        .du_addr(du_addr),
689
        .du_dat_du(du_dat_du),
690
        .du_read(du_read),
691
        .du_write(du_write),
692
        .du_dat_cpu(du_dat_cpu),
693
        .boot_adr_sel_i(boot_adr_sel_i),
694
        .spr_addr(spr_addr),
695
        .spr_dat_pic(spr_dat_pic),
696
        .spr_dat_tt(spr_dat_tt),
697
        .spr_dat_pm(spr_dat_pm),
698
        .spr_dat_cfgr(spr_dat_cfgr),
699
        .spr_dat_rf(spr_dat_rf),
700
        .spr_dat_npc(spr_dat_npc),
701
        .spr_dat_ppc(spr_dat_ppc),
702
        .spr_dat_mac(spr_dat_mac),
703
        .spr_dat_dmmu(spr_dat_dmmu),
704
        .spr_dat_immu(spr_dat_immu),
705
        .spr_dat_du(spr_dat_du),
706
        .spr_dat_o(spr_dat_cpu),
707
        .spr_cs(spr_cs),
708
        .spr_we(spr_we),
709
 
710
        .epcr_we(epcr_we),
711
        .eear_we(eear_we),
712
        .esr_we(esr_we),
713
        .pc_we(pc_we),
714
        .epcr(epcr),
715
        .eear(eear),
716
        .esr(esr),
717
        .except_started(except_started),
718
 
719
        .fpcsr(fpcsr),
720
        .fpcsr_we(fpcsr_we),
721
        .spr_dat_fpu(spr_dat_fpu),
722
 
723
        .sr_we(sr_we),
724
        .to_sr(to_sr),
725
        .sr(sr),
726
        .branch_op(branch_op)
727
);
728
 
729
//
730
// Instantiation of load/store unit
731
//
732
or1200_lsu or1200_lsu(
733
        .clk(clk),
734
        .rst(rst),
735
        .id_addrbase(muxed_a),
736
        .id_addrofs(id_simm),
737
        .ex_addrbase(operand_a),
738
        .ex_addrofs(ex_simm),
739
        .id_lsu_op(id_lsu_op),
740
        .lsu_datain(operand_b),
741
        .lsu_dataout(lsu_dataout),
742
        .lsu_stall(lsu_stall),
743
        .lsu_unstall(lsu_unstall),
744
        .du_stall(du_stall),
745
        .except_align(except_align),
746
        .except_dtlbmiss(except_dtlbmiss),
747
        .except_dmmufault(except_dmmufault),
748
        .except_dbuserr(except_dbuserr),
749
        .id_freeze(id_freeze),
750
        .ex_freeze(ex_freeze),
751
        .flushpipe(ex_flushpipe),
752
 
753
        .dcpu_adr_o(dcpu_adr_o),
754
        .dcpu_cycstb_o(dcpu_cycstb_o),
755
        .dcpu_we_o(dcpu_we_o),
756
        .dcpu_sel_o(dcpu_sel_o),
757
        .dcpu_tag_o(dcpu_tag_o),
758
        .dcpu_dat_o(dcpu_dat_o),
759
        .dcpu_dat_i(dcpu_dat_i),
760
        .dcpu_ack_i(dcpu_ack_i),
761
        .dcpu_rty_i(dcpu_rty_i),
762
        .dcpu_err_i(dcpu_err_i),
763
        .dcpu_tag_i(dcpu_tag_i)
764
);
765
 
766
//
767
// Instantiation of write-back muxes
768
//
769
or1200_wbmux or1200_wbmux(
770
        .clk(clk),
771
        .rst(rst),
772
        .wb_freeze(wb_freeze),
773
        .rfwb_op(rfwb_op),
774
        .muxin_a(alu_dataout),
775
        .muxin_b(lsu_dataout),
776
        .muxin_c(sprs_dataout),
777
        .muxin_d(ex_pc),
778
        .muxin_e(fpu_dataout),
779
        .muxout(rf_dataw),
780
        .muxreg(wb_forw),
781
        .muxreg_valid(wbforw_valid)
782
);
783
 
784
//
785
// Instantiation of freeze logic
786
//
787
or1200_freeze or1200_freeze(
788
        .clk(clk),
789
        .rst(rst),
790
        .multicycle(multicycle),
791
        .wait_on(wait_on),
792
        .fpu_done(fpu_done),
793
        .mtspr_done(mtspr_done),
794
        .flushpipe(wb_flushpipe),
795
        .extend_flush(extend_flush),
796
        .lsu_stall(lsu_stall),
797
        .if_stall(if_stall),
798
        .lsu_unstall(lsu_unstall),
799
        .force_dslot_fetch(force_dslot_fetch),
800
        .abort_ex(abort_ex),
801
        .du_stall(du_stall),
802 435 julius
        .mac_stall(mult_mac_stall),
803 350 julius
        .saving_if_insn(saving_if_insn),
804
        .genpc_freeze(genpc_freeze),
805
        .if_freeze(if_freeze),
806
        .id_freeze(id_freeze),
807
        .ex_freeze(ex_freeze),
808
        .wb_freeze(wb_freeze),
809
        .icpu_ack_i(icpu_ack_i),
810
        .icpu_err_i(icpu_err_i)
811
);
812
 
813
//
814
// Instantiation of exception block
815
//
816
or1200_except or1200_except(
817
        .clk(clk),
818
        .rst(rst),
819
        .sig_ibuserr(except_ibuserr),
820
        .sig_dbuserr(except_dbuserr),
821
        .sig_illegal(except_illegal),
822
        .sig_align(except_align),
823 502 julius
        .sig_range(sig_range),
824 350 julius
        .sig_dtlbmiss(except_dtlbmiss),
825
        .sig_dmmufault(except_dmmufault),
826
        .sig_int(sig_int),
827
        .sig_syscall(sig_syscall),
828
        .sig_trap(sig_trap),
829
        .sig_itlbmiss(except_itlbmiss),
830
        .sig_immufault(except_immufault),
831
        .sig_tick(sig_tick),
832
        .sig_fp(sig_fp),
833
        .fpcsr_fpee(fpcsr[`OR1200_FPCSR_FPEE]),
834
        .ex_branch_taken(ex_branch_taken),
835
        .icpu_ack_i(icpu_ack_i),
836
        .icpu_err_i(icpu_err_i),
837
        .dcpu_ack_i(dcpu_ack_i),
838
        .dcpu_err_i(dcpu_err_i),
839
        .genpc_freeze(genpc_freeze),
840
        .id_freeze(id_freeze),
841
        .ex_freeze(ex_freeze),
842
        .wb_freeze(wb_freeze),
843
        .if_stall(if_stall),
844
        .if_pc(if_pc),
845
        .id_pc(id_pc),
846
        .ex_pc(ex_pc),
847
        .wb_pc(wb_pc),
848
        .id_flushpipe(id_flushpipe),
849
        .ex_flushpipe(ex_flushpipe),
850
        .extend_flush(extend_flush),
851
        .except_flushpipe(except_flushpipe),
852
        .abort_mvspr(abort_mvspr),
853
        .except_type(except_type),
854
        .except_start(except_start),
855
        .except_started(except_started),
856
        .except_stop(except_stop),
857
        .except_trig(except_trig),
858
        .ex_void(ex_void),
859
        .spr_dat_ppc(spr_dat_ppc),
860
        .spr_dat_npc(spr_dat_npc),
861
 
862
        .datain(spr_dat_cpu),
863
        .branch_op(branch_op),
864
        .du_dsr(du_dsr),
865
        .du_dmr1(du_dmr1),
866
        .du_hwbkpt(du_hwbkpt),
867
        .du_hwbkpt_ls_r(du_hwbkpt_ls_r),
868
        .epcr_we(epcr_we),
869
        .eear_we(eear_we),
870
        .esr_we(esr_we),
871
        .pc_we(pc_we),
872
        .epcr(epcr),
873
        .eear(eear),
874
        .esr(esr),
875
 
876
        .lsu_addr(dcpu_adr_o),
877
        .sr_we(sr_we),
878
        .to_sr(to_sr),
879
        .sr(sr),
880
        .abort_ex(abort_ex)
881
);
882
 
883
//
884
// Instantiation of configuration registers
885
//
886
or1200_cfgr or1200_cfgr(
887
        .spr_addr(spr_addr),
888
        .spr_dat_o(spr_dat_cfgr)
889
);
890
 
891
endmodule

powered by: WebSVN 2.1.0

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