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