| 1 |
2 |
tobil |
//////////////////////////////////////////////////////////////////////
|
| 2 |
|
|
//// ////
|
| 3 |
|
|
//// OR1200 Top Level ////
|
| 4 |
|
|
//// ////
|
| 5 |
|
|
//// This file is part of the OpenRISC 1200 project ////
|
| 6 |
|
|
//// http://www.opencores.org/cores/or1k/ ////
|
| 7 |
|
|
//// ////
|
| 8 |
|
|
//// Description ////
|
| 9 |
|
|
//// OR1200 Top Level ////
|
| 10 |
|
|
//// ////
|
| 11 |
|
|
//// To Do: ////
|
| 12 |
|
|
//// - make it smaller and faster ////
|
| 13 |
|
|
//// ////
|
| 14 |
|
|
//// Author(s): ////
|
| 15 |
|
|
//// - Damjan Lampret, lampret@opencores.org ////
|
| 16 |
|
|
//// ////
|
| 17 |
|
|
//////////////////////////////////////////////////////////////////////
|
| 18 |
|
|
//// ////
|
| 19 |
|
|
//// Copyright (C) 2000 Authors and OPENCORES.ORG ////
|
| 20 |
|
|
//// ////
|
| 21 |
|
|
//// This source file may be used and distributed without ////
|
| 22 |
|
|
//// restriction provided that this copyright statement is not ////
|
| 23 |
|
|
//// removed from the file and that any derivative work contains ////
|
| 24 |
|
|
//// the original copyright notice and the associated disclaimer. ////
|
| 25 |
|
|
//// ////
|
| 26 |
|
|
//// This source file is free software; you can redistribute it ////
|
| 27 |
|
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
| 28 |
|
|
//// Public License as published by the Free Software Foundation; ////
|
| 29 |
|
|
//// either version 2.1 of the License, or (at your option) any ////
|
| 30 |
|
|
//// later version. ////
|
| 31 |
|
|
//// ////
|
| 32 |
|
|
//// This source is distributed in the hope that it will be ////
|
| 33 |
|
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
| 34 |
|
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
| 35 |
|
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
| 36 |
|
|
//// details. ////
|
| 37 |
|
|
//// ////
|
| 38 |
|
|
//// You should have received a copy of the GNU Lesser General ////
|
| 39 |
|
|
//// Public License along with this source; if not, download it ////
|
| 40 |
|
|
//// from http://www.opencores.org/lgpl.shtml ////
|
| 41 |
|
|
//// ////
|
| 42 |
|
|
//////////////////////////////////////////////////////////////////////
|
| 43 |
|
|
//
|
| 44 |
|
|
// CVS Revision History
|
| 45 |
|
|
//
|
| 46 |
|
|
// $Log: not supported by cvs2svn $
|
| 47 |
|
|
// Revision 1.12 2004/04/05 08:29:57 lampret
|
| 48 |
|
|
// Merged branch_qmem into main tree.
|
| 49 |
|
|
//
|
| 50 |
|
|
// Revision 1.10.4.9 2004/02/11 01:40:11 lampret
|
| 51 |
|
|
// preliminary HW breakpoints support in debug unit (by default disabled). To enable define OR1200_DU_HWBKPTS.
|
| 52 |
|
|
//
|
| 53 |
|
|
// Revision 1.10.4.8 2004/01/17 21:14:14 simons
|
| 54 |
|
|
// Errors fixed.
|
| 55 |
|
|
//
|
| 56 |
|
|
// Revision 1.10.4.7 2004/01/17 19:06:38 simons
|
| 57 |
|
|
// Error fixed.
|
| 58 |
|
|
//
|
| 59 |
|
|
// Revision 1.10.4.6 2004/01/17 18:39:48 simons
|
| 60 |
|
|
// Error fixed.
|
| 61 |
|
|
//
|
| 62 |
|
|
// Revision 1.10.4.5 2004/01/15 06:46:38 markom
|
| 63 |
|
|
// interface to debug changed; no more opselect; stb-ack protocol
|
| 64 |
|
|
//
|
| 65 |
|
|
// Revision 1.10.4.4 2003/12/09 11:46:49 simons
|
| 66 |
|
|
// Mbist nameing changed, Artisan ram instance signal names fixed, some synthesis waning fixed.
|
| 67 |
|
|
//
|
| 68 |
|
|
// Revision 1.10.4.3 2003/12/05 00:08:44 lampret
|
| 69 |
|
|
// Fixed instantiation name.
|
| 70 |
|
|
//
|
| 71 |
|
|
// Revision 1.10.4.2 2003/07/11 01:10:35 lampret
|
| 72 |
|
|
// Added three missing wire declarations. No functional changes.
|
| 73 |
|
|
//
|
| 74 |
|
|
// Revision 1.10.4.1 2003/07/08 15:36:37 lampret
|
| 75 |
|
|
// Added embedded memory QMEM.
|
| 76 |
|
|
//
|
| 77 |
|
|
// Revision 1.10 2002/12/08 08:57:56 lampret
|
| 78 |
|
|
// Added optional support for WB B3 specification (xwb_cti_o, xwb_bte_o). Made xwb_cab_o optional.
|
| 79 |
|
|
//
|
| 80 |
|
|
// Revision 1.9 2002/10/17 20:04:41 lampret
|
| 81 |
|
|
// Added BIST scan. Special VS RAMs need to be used to implement BIST.
|
| 82 |
|
|
//
|
| 83 |
|
|
// Revision 1.8 2002/08/18 19:54:22 lampret
|
| 84 |
|
|
// Added store buffer.
|
| 85 |
|
|
//
|
| 86 |
|
|
// Revision 1.7 2002/07/14 22:17:17 lampret
|
| 87 |
|
|
// Added simple trace buffer [only for Xilinx Virtex target]. Fixed instruction fetch abort when new exception is recognized.
|
| 88 |
|
|
//
|
| 89 |
|
|
// Revision 1.6 2002/03/29 15:16:56 lampret
|
| 90 |
|
|
// Some of the warnings fixed.
|
| 91 |
|
|
//
|
| 92 |
|
|
// Revision 1.5 2002/02/11 04:33:17 lampret
|
| 93 |
|
|
// Speed optimizations (removed duplicate _cyc_ and _stb_). Fixed D/IMMU cache-inhibit attr.
|
| 94 |
|
|
//
|
| 95 |
|
|
// Revision 1.4 2002/02/01 19:56:55 lampret
|
| 96 |
|
|
// Fixed combinational loops.
|
| 97 |
|
|
//
|
| 98 |
|
|
// Revision 1.3 2002/01/28 01:16:00 lampret
|
| 99 |
|
|
// 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.
|
| 100 |
|
|
//
|
| 101 |
|
|
// Revision 1.2 2002/01/18 07:56:00 lampret
|
| 102 |
|
|
// No more low/high priority interrupts (PICPR removed). Added tick timer exception. Added exception prefix (SR[EPH]). Fixed single-step bug whenreading NPC.
|
| 103 |
|
|
//
|
| 104 |
|
|
// Revision 1.1 2002/01/03 08:16:15 lampret
|
| 105 |
|
|
// New prefixes for RTL files, prefixed module names. Updated cache controllers and MMUs.
|
| 106 |
|
|
//
|
| 107 |
|
|
// Revision 1.13 2001/11/23 08:38:51 lampret
|
| 108 |
|
|
// Changed DSR/DRR behavior and exception detection.
|
| 109 |
|
|
//
|
| 110 |
|
|
// Revision 1.12 2001/11/20 00:57:22 lampret
|
| 111 |
|
|
// Fixed width of du_except.
|
| 112 |
|
|
//
|
| 113 |
|
|
// Revision 1.11 2001/11/18 08:36:28 lampret
|
| 114 |
|
|
// For GDB changed single stepping and disabled trap exception.
|
| 115 |
|
|
//
|
| 116 |
|
|
// Revision 1.10 2001/10/21 17:57:16 lampret
|
| 117 |
|
|
// 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.
|
| 118 |
|
|
//
|
| 119 |
|
|
// Revision 1.9 2001/10/14 13:12:10 lampret
|
| 120 |
|
|
// MP3 version.
|
| 121 |
|
|
//
|
| 122 |
|
|
// Revision 1.1.1.1 2001/10/06 10:18:35 igorm
|
| 123 |
|
|
// no message
|
| 124 |
|
|
//
|
| 125 |
|
|
// Revision 1.4 2001/08/13 03:36:20 lampret
|
| 126 |
|
|
// Added cfg regs. Moved all defines into one defines.v file. More cleanup.
|
| 127 |
|
|
//
|
| 128 |
|
|
// Revision 1.3 2001/08/09 13:39:33 lampret
|
| 129 |
|
|
// Major clean-up.
|
| 130 |
|
|
//
|
| 131 |
|
|
// Revision 1.2 2001/07/22 03:31:54 lampret
|
| 132 |
|
|
// Fixed RAM's oen bug. Cache bypass under development.
|
| 133 |
|
|
//
|
| 134 |
|
|
// Revision 1.1 2001/07/20 00:46:21 lampret
|
| 135 |
|
|
// Development version of RTL. Libraries are missing.
|
| 136 |
|
|
//
|
| 137 |
|
|
//
|
| 138 |
|
|
|
| 139 |
|
|
// synopsys translate_off
|
| 140 |
|
|
`include "timescale.v"
|
| 141 |
|
|
// synopsys translate_on
|
| 142 |
|
|
`include "or1200_defines.v"
|
| 143 |
|
|
|
| 144 |
|
|
module or1200_top(
|
| 145 |
|
|
// System
|
| 146 |
|
|
clk_i, rst_i, pic_ints_i, clmode_i,
|
| 147 |
|
|
|
| 148 |
|
|
// Instruction WISHBONE INTERFACE
|
| 149 |
|
|
//iwb_clk_i, iwb_rst_i,
|
| 150 |
|
|
iwb_ack_i, iwb_err_i, iwb_rty_i, iwb_dat_i,
|
| 151 |
|
|
iwb_cyc_o, iwb_adr_o, iwb_stb_o, iwb_we_o, iwb_sel_o, iwb_dat_o,
|
| 152 |
|
|
`ifdef OR1200_WB_CAB
|
| 153 |
|
|
iwb_cab_o,
|
| 154 |
|
|
`endif
|
| 155 |
|
|
`ifdef OR1200_WB_B3
|
| 156 |
|
|
iwb_cti_o, iwb_bte_o,
|
| 157 |
|
|
`endif
|
| 158 |
|
|
// Data WISHBONE INTERFACE
|
| 159 |
|
|
//dwb_clk_i, dwb_rst_i,
|
| 160 |
|
|
dwb_ack_i, dwb_err_i, dwb_rty_i, dwb_dat_i,
|
| 161 |
|
|
dwb_cyc_o, dwb_adr_o, dwb_stb_o, dwb_we_o, dwb_sel_o, dwb_dat_o,
|
| 162 |
|
|
`ifdef OR1200_WB_CAB
|
| 163 |
|
|
dwb_cab_o,
|
| 164 |
|
|
`endif
|
| 165 |
|
|
`ifdef OR1200_WB_B3
|
| 166 |
|
|
dwb_cti_o, dwb_bte_o,
|
| 167 |
|
|
`endif
|
| 168 |
|
|
|
| 169 |
|
|
// External Debug Interface
|
| 170 |
|
|
dbg_stall_i, dbg_ewt_i, dbg_lss_o, dbg_is_o, dbg_wp_o, dbg_bp_o,
|
| 171 |
|
|
dbg_stb_i, dbg_we_i, dbg_adr_i, dbg_dat_i, dbg_dat_o, dbg_ack_o,
|
| 172 |
|
|
|
| 173 |
|
|
`ifdef OR1200_BIST
|
| 174 |
|
|
// RAM BIST
|
| 175 |
|
|
mbist_si_i, mbist_so_o, mbist_ctrl_i,
|
| 176 |
|
|
`endif
|
| 177 |
|
|
// Power Management
|
| 178 |
|
|
pm_cpustall_i,
|
| 179 |
|
|
pm_clksd_o, pm_dc_gate_o, pm_ic_gate_o, pm_dmmu_gate_o,
|
| 180 |
|
|
pm_immu_gate_o, pm_tt_gate_o, pm_cpu_gate_o, pm_wakeup_o, pm_lvolt_o
|
| 181 |
|
|
|
| 182 |
|
|
);
|
| 183 |
|
|
|
| 184 |
|
|
parameter dw = `OR1200_OPERAND_WIDTH;
|
| 185 |
|
|
parameter aw = `OR1200_OPERAND_WIDTH;
|
| 186 |
|
|
parameter ppic_ints = `OR1200_PIC_INTS;
|
| 187 |
|
|
|
| 188 |
|
|
//
|
| 189 |
|
|
// I/O
|
| 190 |
|
|
//
|
| 191 |
|
|
|
| 192 |
|
|
//
|
| 193 |
|
|
// System
|
| 194 |
|
|
//
|
| 195 |
|
|
input clk_i;
|
| 196 |
|
|
input rst_i;
|
| 197 |
|
|
input [1:0] clmode_i; // 00 WB=RISC, 01 WB=RISC/2, 10 N/A, 11 WB=RISC/4
|
| 198 |
|
|
input [ppic_ints-1:0] pic_ints_i;
|
| 199 |
|
|
|
| 200 |
|
|
//
|
| 201 |
|
|
// Instruction WISHBONE interface
|
| 202 |
|
|
//
|
| 203 |
|
|
//input iwb_clk_i; // clock input
|
| 204 |
|
|
//input iwb_rst_i; // reset input
|
| 205 |
|
|
wire iwb_clk_i = clk_i;
|
| 206 |
|
|
wire iwb_rst_i = rst_i;
|
| 207 |
|
|
|
| 208 |
|
|
input iwb_ack_i; // normal termination
|
| 209 |
|
|
input iwb_err_i; // termination w/ error
|
| 210 |
|
|
input iwb_rty_i; // termination w/ retry
|
| 211 |
|
|
input [dw-1:0] iwb_dat_i; // input data bus
|
| 212 |
|
|
output iwb_cyc_o; // cycle valid output
|
| 213 |
|
|
output [aw-1:0] iwb_adr_o; // address bus outputs
|
| 214 |
|
|
output iwb_stb_o; // strobe output
|
| 215 |
|
|
output iwb_we_o; // indicates write transfer
|
| 216 |
|
|
output [3:0] iwb_sel_o; // byte select outputs
|
| 217 |
|
|
output [dw-1:0] iwb_dat_o; // output data bus
|
| 218 |
|
|
`ifdef OR1200_WB_CAB
|
| 219 |
|
|
output iwb_cab_o; // indicates consecutive address burst
|
| 220 |
|
|
`endif
|
| 221 |
|
|
`ifdef OR1200_WB_B3
|
| 222 |
|
|
output [2:0] iwb_cti_o; // cycle type identifier
|
| 223 |
|
|
output [1:0] iwb_bte_o; // burst type extension
|
| 224 |
|
|
`endif
|
| 225 |
|
|
|
| 226 |
|
|
//
|
| 227 |
|
|
// Data WISHBONE interface
|
| 228 |
|
|
//
|
| 229 |
|
|
//input dwb_clk_i; // clock input
|
| 230 |
|
|
//input dwb_rst_i; // reset input
|
| 231 |
|
|
wire dwb_clk_i = clk_i;
|
| 232 |
|
|
wire dwb_rst_i = rst_i;
|
| 233 |
|
|
|
| 234 |
|
|
input dwb_ack_i; // normal termination
|
| 235 |
|
|
input dwb_err_i; // termination w/ error
|
| 236 |
|
|
input dwb_rty_i; // termination w/ retry
|
| 237 |
|
|
input [dw-1:0] dwb_dat_i; // input data bus
|
| 238 |
|
|
output dwb_cyc_o; // cycle valid output
|
| 239 |
|
|
output [aw-1:0] dwb_adr_o; // address bus outputs
|
| 240 |
|
|
output dwb_stb_o; // strobe output
|
| 241 |
|
|
output dwb_we_o; // indicates write transfer
|
| 242 |
|
|
output [3:0] dwb_sel_o; // byte select outputs
|
| 243 |
|
|
output [dw-1:0] dwb_dat_o; // output data bus
|
| 244 |
|
|
`ifdef OR1200_WB_CAB
|
| 245 |
|
|
output dwb_cab_o; // indicates consecutive address burst
|
| 246 |
|
|
`endif
|
| 247 |
|
|
`ifdef OR1200_WB_B3
|
| 248 |
|
|
output [2:0] dwb_cti_o; // cycle type identifier
|
| 249 |
|
|
output [1:0] dwb_bte_o; // burst type extension
|
| 250 |
|
|
`endif
|
| 251 |
|
|
|
| 252 |
|
|
//
|
| 253 |
|
|
// External Debug Interface
|
| 254 |
|
|
//
|
| 255 |
|
|
input dbg_stall_i; // External Stall Input
|
| 256 |
|
|
input dbg_ewt_i; // External Watchpoint Trigger Input
|
| 257 |
|
|
output [3:0] dbg_lss_o; // External Load/Store Unit Status
|
| 258 |
|
|
output [1:0] dbg_is_o; // External Insn Fetch Status
|
| 259 |
|
|
output [10:0] dbg_wp_o; // Watchpoints Outputs
|
| 260 |
|
|
output dbg_bp_o; // Breakpoint Output
|
| 261 |
|
|
input dbg_stb_i; // External Address/Data Strobe
|
| 262 |
|
|
input dbg_we_i; // External Write Enable
|
| 263 |
|
|
input [aw-1:0] dbg_adr_i; // External Address Input
|
| 264 |
|
|
input [dw-1:0] dbg_dat_i; // External Data Input
|
| 265 |
|
|
output [dw-1:0] dbg_dat_o; // External Data Output
|
| 266 |
|
|
output dbg_ack_o; // External Data Acknowledge (not WB compatible)
|
| 267 |
|
|
|
| 268 |
|
|
`ifdef OR1200_BIST
|
| 269 |
|
|
//
|
| 270 |
|
|
// RAM BIST
|
| 271 |
|
|
//
|
| 272 |
|
|
input mbist_si_i;
|
| 273 |
|
|
input [`OR1200_MBIST_CTRL_WIDTH - 1:0] mbist_ctrl_i;
|
| 274 |
|
|
output mbist_so_o;
|
| 275 |
|
|
`endif
|
| 276 |
|
|
|
| 277 |
|
|
//
|
| 278 |
|
|
// Power Management
|
| 279 |
|
|
//
|
| 280 |
|
|
input pm_cpustall_i;
|
| 281 |
|
|
output [3:0] pm_clksd_o;
|
| 282 |
|
|
output pm_dc_gate_o;
|
| 283 |
|
|
output pm_ic_gate_o;
|
| 284 |
|
|
output pm_dmmu_gate_o;
|
| 285 |
|
|
output pm_immu_gate_o;
|
| 286 |
|
|
output pm_tt_gate_o;
|
| 287 |
|
|
output pm_cpu_gate_o;
|
| 288 |
|
|
output pm_wakeup_o;
|
| 289 |
|
|
output pm_lvolt_o;
|
| 290 |
|
|
|
| 291 |
|
|
|
| 292 |
|
|
//
|
| 293 |
|
|
// Internal wires and regs
|
| 294 |
|
|
//
|
| 295 |
|
|
|
| 296 |
|
|
//
|
| 297 |
|
|
// DC to SB
|
| 298 |
|
|
//
|
| 299 |
|
|
wire [dw-1:0] dcsb_dat_dc;
|
| 300 |
|
|
wire [aw-1:0] dcsb_adr_dc;
|
| 301 |
|
|
wire dcsb_cyc_dc;
|
| 302 |
|
|
wire dcsb_stb_dc;
|
| 303 |
|
|
wire dcsb_we_dc;
|
| 304 |
|
|
wire [3:0] dcsb_sel_dc;
|
| 305 |
|
|
wire dcsb_cab_dc;
|
| 306 |
|
|
wire [dw-1:0] dcsb_dat_sb;
|
| 307 |
|
|
wire dcsb_ack_sb;
|
| 308 |
|
|
wire dcsb_err_sb;
|
| 309 |
|
|
|
| 310 |
|
|
//
|
| 311 |
|
|
// SB to BIU
|
| 312 |
|
|
//
|
| 313 |
|
|
wire [dw-1:0] sbbiu_dat_sb;
|
| 314 |
|
|
wire [aw-1:0] sbbiu_adr_sb;
|
| 315 |
|
|
wire sbbiu_cyc_sb;
|
| 316 |
|
|
wire sbbiu_stb_sb;
|
| 317 |
|
|
wire sbbiu_we_sb;
|
| 318 |
|
|
wire [3:0] sbbiu_sel_sb;
|
| 319 |
|
|
wire sbbiu_cab_sb;
|
| 320 |
|
|
wire [dw-1:0] sbbiu_dat_biu;
|
| 321 |
|
|
wire sbbiu_ack_biu;
|
| 322 |
|
|
wire sbbiu_err_biu;
|
| 323 |
|
|
|
| 324 |
|
|
//
|
| 325 |
|
|
// IC to BIU
|
| 326 |
|
|
//
|
| 327 |
|
|
wire [dw-1:0] icbiu_dat_ic;
|
| 328 |
|
|
wire [aw-1:0] icbiu_adr_ic;
|
| 329 |
|
|
wire icbiu_cyc_ic;
|
| 330 |
|
|
wire icbiu_stb_ic;
|
| 331 |
|
|
wire icbiu_we_ic;
|
| 332 |
|
|
wire [3:0] icbiu_sel_ic;
|
| 333 |
|
|
wire [3:0] icbiu_tag_ic;
|
| 334 |
|
|
wire icbiu_cab_ic;
|
| 335 |
|
|
wire [dw-1:0] icbiu_dat_biu;
|
| 336 |
|
|
wire icbiu_ack_biu;
|
| 337 |
|
|
wire icbiu_err_biu;
|
| 338 |
|
|
wire [3:0] icbiu_tag_biu;
|
| 339 |
|
|
|
| 340 |
|
|
//
|
| 341 |
|
|
// CPU's SPR access to various RISC units (shared wires)
|
| 342 |
|
|
//
|
| 343 |
|
|
wire supv;
|
| 344 |
|
|
wire [aw-1:0] spr_addr;
|
| 345 |
|
|
wire [dw-1:0] spr_dat_cpu;
|
| 346 |
|
|
wire [31:0] spr_cs;
|
| 347 |
|
|
wire spr_we;
|
| 348 |
|
|
|
| 349 |
|
|
//
|
| 350 |
|
|
// DMMU and CPU
|
| 351 |
|
|
//
|
| 352 |
|
|
wire dmmu_en;
|
| 353 |
|
|
wire [31:0] spr_dat_dmmu;
|
| 354 |
|
|
|
| 355 |
|
|
//
|
| 356 |
|
|
// DMMU and QMEM
|
| 357 |
|
|
//
|
| 358 |
|
|
wire qmemdmmu_err_qmem;
|
| 359 |
|
|
wire [3:0] qmemdmmu_tag_qmem;
|
| 360 |
|
|
wire [aw-1:0] qmemdmmu_adr_dmmu;
|
| 361 |
|
|
wire qmemdmmu_cycstb_dmmu;
|
| 362 |
|
|
wire qmemdmmu_ci_dmmu;
|
| 363 |
|
|
|
| 364 |
|
|
//
|
| 365 |
|
|
// CPU and data memory subsystem
|
| 366 |
|
|
//
|
| 367 |
|
|
wire dc_en;
|
| 368 |
|
|
wire [31:0] dcpu_adr_cpu;
|
| 369 |
|
|
wire dcpu_cycstb_cpu;
|
| 370 |
|
|
wire dcpu_we_cpu;
|
| 371 |
|
|
wire [3:0] dcpu_sel_cpu;
|
| 372 |
|
|
wire [3:0] dcpu_tag_cpu;
|
| 373 |
|
|
wire [31:0] dcpu_dat_cpu;
|
| 374 |
|
|
wire [31:0] dcpu_dat_qmem;
|
| 375 |
|
|
wire dcpu_ack_qmem;
|
| 376 |
|
|
wire dcpu_rty_qmem;
|
| 377 |
|
|
wire dcpu_err_dmmu;
|
| 378 |
|
|
wire [3:0] dcpu_tag_dmmu;
|
| 379 |
|
|
|
| 380 |
|
|
//
|
| 381 |
|
|
// IMMU and CPU
|
| 382 |
|
|
//
|
| 383 |
|
|
wire immu_en;
|
| 384 |
|
|
wire [31:0] spr_dat_immu;
|
| 385 |
|
|
|
| 386 |
|
|
//
|
| 387 |
|
|
// CPU and insn memory subsystem
|
| 388 |
|
|
//
|
| 389 |
|
|
wire ic_en;
|
| 390 |
|
|
wire [31:0] icpu_adr_cpu;
|
| 391 |
|
|
wire icpu_cycstb_cpu;
|
| 392 |
|
|
wire [3:0] icpu_sel_cpu;
|
| 393 |
|
|
wire [3:0] icpu_tag_cpu;
|
| 394 |
|
|
wire [31:0] icpu_dat_qmem;
|
| 395 |
|
|
wire icpu_ack_qmem;
|
| 396 |
|
|
wire [31:0] icpu_adr_immu;
|
| 397 |
|
|
wire icpu_err_immu;
|
| 398 |
|
|
wire [3:0] icpu_tag_immu;
|
| 399 |
|
|
wire icpu_rty_immu;
|
| 400 |
|
|
|
| 401 |
|
|
//
|
| 402 |
|
|
// IMMU and QMEM
|
| 403 |
|
|
//
|
| 404 |
|
|
wire [aw-1:0] qmemimmu_adr_immu;
|
| 405 |
|
|
wire qmemimmu_rty_qmem;
|
| 406 |
|
|
wire qmemimmu_err_qmem;
|
| 407 |
|
|
wire [3:0] qmemimmu_tag_qmem;
|
| 408 |
|
|
wire qmemimmu_cycstb_immu;
|
| 409 |
|
|
wire qmemimmu_ci_immu;
|
| 410 |
|
|
|
| 411 |
|
|
//
|
| 412 |
|
|
// QMEM and IC
|
| 413 |
|
|
//
|
| 414 |
|
|
wire [aw-1:0] icqmem_adr_qmem;
|
| 415 |
|
|
wire icqmem_rty_ic;
|
| 416 |
|
|
wire icqmem_err_ic;
|
| 417 |
|
|
wire [3:0] icqmem_tag_ic;
|
| 418 |
|
|
wire icqmem_cycstb_qmem;
|
| 419 |
|
|
wire icqmem_ci_qmem;
|
| 420 |
|
|
wire [31:0] icqmem_dat_ic;
|
| 421 |
|
|
wire icqmem_ack_ic;
|
| 422 |
|
|
|
| 423 |
|
|
//
|
| 424 |
|
|
// QMEM and DC
|
| 425 |
|
|
//
|
| 426 |
|
|
wire [aw-1:0] dcqmem_adr_qmem;
|
| 427 |
|
|
wire dcqmem_rty_dc;
|
| 428 |
|
|
wire dcqmem_err_dc;
|
| 429 |
|
|
wire [3:0] dcqmem_tag_dc;
|
| 430 |
|
|
wire dcqmem_cycstb_qmem;
|
| 431 |
|
|
wire dcqmem_ci_qmem;
|
| 432 |
|
|
wire [31:0] dcqmem_dat_dc;
|
| 433 |
|
|
wire [31:0] dcqmem_dat_qmem;
|
| 434 |
|
|
wire dcqmem_we_qmem;
|
| 435 |
|
|
wire [3:0] dcqmem_sel_qmem;
|
| 436 |
|
|
wire dcqmem_ack_dc;
|
| 437 |
|
|
|
| 438 |
|
|
//
|
| 439 |
|
|
// Connection between CPU and PIC
|
| 440 |
|
|
//
|
| 441 |
|
|
wire [dw-1:0] spr_dat_pic;
|
| 442 |
|
|
wire pic_wakeup;
|
| 443 |
|
|
wire sig_int;
|
| 444 |
|
|
|
| 445 |
|
|
//
|
| 446 |
|
|
// Connection between CPU and PM
|
| 447 |
|
|
//
|
| 448 |
|
|
wire [dw-1:0] spr_dat_pm;
|
| 449 |
|
|
|
| 450 |
|
|
//
|
| 451 |
|
|
// CPU and TT
|
| 452 |
|
|
//
|
| 453 |
|
|
wire [dw-1:0] spr_dat_tt;
|
| 454 |
|
|
wire sig_tick;
|
| 455 |
|
|
|
| 456 |
|
|
//
|
| 457 |
|
|
// Debug port and caches/MMUs
|
| 458 |
|
|
//
|
| 459 |
|
|
wire [dw-1:0] spr_dat_du;
|
| 460 |
|
|
wire du_stall;
|
| 461 |
|
|
wire [dw-1:0] du_addr;
|
| 462 |
|
|
wire [dw-1:0] du_dat_du;
|
| 463 |
|
|
wire du_read;
|
| 464 |
|
|
wire du_write;
|
| 465 |
|
|
wire [12:0] du_except;
|
| 466 |
|
|
wire [`OR1200_DU_DSR_WIDTH-1:0] du_dsr;
|
| 467 |
|
|
wire [dw-1:0] du_dat_cpu;
|
| 468 |
|
|
wire du_hwbkpt;
|
| 469 |
|
|
|
| 470 |
|
|
wire ex_freeze;
|
| 471 |
|
|
wire [31:0] ex_insn;
|
| 472 |
|
|
wire [31:0] id_pc;
|
| 473 |
|
|
wire [`OR1200_BRANCHOP_WIDTH-1:0] branch_op;
|
| 474 |
|
|
wire [31:0] spr_dat_npc;
|
| 475 |
|
|
wire [31:0] rf_dataw;
|
| 476 |
|
|
|
| 477 |
|
|
`ifdef OR1200_BIST
|
| 478 |
|
|
//
|
| 479 |
|
|
// RAM BIST
|
| 480 |
|
|
//
|
| 481 |
|
|
wire mbist_immu_so;
|
| 482 |
|
|
wire mbist_ic_so;
|
| 483 |
|
|
wire mbist_dmmu_so;
|
| 484 |
|
|
wire mbist_dc_so;
|
| 485 |
|
|
wire mbist_qmem_so;
|
| 486 |
|
|
wire mbist_immu_si = mbist_si_i;
|
| 487 |
|
|
wire mbist_ic_si = mbist_immu_so;
|
| 488 |
|
|
wire mbist_qmem_si = mbist_ic_so;
|
| 489 |
|
|
wire mbist_dmmu_si = mbist_qmem_so;
|
| 490 |
|
|
wire mbist_dc_si = mbist_dmmu_so;
|
| 491 |
|
|
assign mbist_so_o = mbist_dc_so;
|
| 492 |
|
|
`endif
|
| 493 |
|
|
|
| 494 |
|
|
wire [3:0] icqmem_sel_qmem;
|
| 495 |
|
|
wire [3:0] icqmem_tag_qmem;
|
| 496 |
|
|
wire [3:0] dcqmem_tag_qmem;
|
| 497 |
|
|
|
| 498 |
|
|
//
|
| 499 |
|
|
// Instantiation of Instruction WISHBONE BIU
|
| 500 |
|
|
//
|
| 501 |
|
|
or1200_iwb_biu iwb_biu(
|
| 502 |
|
|
// RISC clk, rst and clock control
|
| 503 |
|
|
.clk(clk_i),
|
| 504 |
|
|
.rst(rst_i),
|
| 505 |
|
|
.clmode(clmode_i),
|
| 506 |
|
|
|
| 507 |
|
|
// WISHBONE interface
|
| 508 |
|
|
.wb_clk_i(iwb_clk_i),
|
| 509 |
|
|
.wb_rst_i(iwb_rst_i),
|
| 510 |
|
|
.wb_ack_i(iwb_ack_i),
|
| 511 |
|
|
.wb_err_i(iwb_err_i),
|
| 512 |
|
|
.wb_rty_i(iwb_rty_i),
|
| 513 |
|
|
.wb_dat_i(iwb_dat_i),
|
| 514 |
|
|
.wb_cyc_o(iwb_cyc_o),
|
| 515 |
|
|
.wb_adr_o(iwb_adr_o),
|
| 516 |
|
|
.wb_stb_o(iwb_stb_o),
|
| 517 |
|
|
.wb_we_o(iwb_we_o),
|
| 518 |
|
|
.wb_sel_o(iwb_sel_o),
|
| 519 |
|
|
.wb_dat_o(iwb_dat_o),
|
| 520 |
|
|
`ifdef OR1200_WB_CAB
|
| 521 |
|
|
.wb_cab_o(iwb_cab_o),
|
| 522 |
|
|
`endif
|
| 523 |
|
|
`ifdef OR1200_WB_B3
|
| 524 |
|
|
.wb_cti_o(iwb_cti_o),
|
| 525 |
|
|
.wb_bte_o(iwb_bte_o),
|
| 526 |
|
|
`endif
|
| 527 |
|
|
|
| 528 |
|
|
// Internal RISC bus
|
| 529 |
|
|
.biu_dat_i(icbiu_dat_ic),
|
| 530 |
|
|
.biu_adr_i(icbiu_adr_ic),
|
| 531 |
|
|
.biu_cyc_i(icbiu_cyc_ic),
|
| 532 |
|
|
.biu_stb_i(icbiu_stb_ic),
|
| 533 |
|
|
.biu_we_i(icbiu_we_ic),
|
| 534 |
|
|
.biu_sel_i(icbiu_sel_ic),
|
| 535 |
|
|
.biu_cab_i(icbiu_cab_ic),
|
| 536 |
|
|
.biu_dat_o(icbiu_dat_biu),
|
| 537 |
|
|
.biu_ack_o(icbiu_ack_biu),
|
| 538 |
|
|
.biu_err_o(icbiu_err_biu)
|
| 539 |
|
|
);
|
| 540 |
|
|
|
| 541 |
|
|
//
|
| 542 |
|
|
// Instantiation of Data WISHBONE BIU
|
| 543 |
|
|
//
|
| 544 |
|
|
or1200_wb_biu dwb_biu(
|
| 545 |
|
|
// RISC clk, rst and clock control
|
| 546 |
|
|
.clk(clk_i),
|
| 547 |
|
|
.rst(rst_i),
|
| 548 |
|
|
.clmode(clmode_i),
|
| 549 |
|
|
|
| 550 |
|
|
// WISHBONE interface
|
| 551 |
|
|
.wb_clk_i(dwb_clk_i),
|
| 552 |
|
|
.wb_rst_i(dwb_rst_i),
|
| 553 |
|
|
.wb_ack_i(dwb_ack_i),
|
| 554 |
|
|
.wb_err_i(dwb_err_i),
|
| 555 |
|
|
.wb_rty_i(dwb_rty_i),
|
| 556 |
|
|
.wb_dat_i(dwb_dat_i),
|
| 557 |
|
|
.wb_cyc_o(dwb_cyc_o),
|
| 558 |
|
|
.wb_adr_o(dwb_adr_o),
|
| 559 |
|
|
.wb_stb_o(dwb_stb_o),
|
| 560 |
|
|
.wb_we_o(dwb_we_o),
|
| 561 |
|
|
.wb_sel_o(dwb_sel_o),
|
| 562 |
|
|
.wb_dat_o(dwb_dat_o),
|
| 563 |
|
|
`ifdef OR1200_WB_CAB
|
| 564 |
|
|
.wb_cab_o(dwb_cab_o),
|
| 565 |
|
|
`endif
|
| 566 |
|
|
`ifdef OR1200_WB_B3
|
| 567 |
|
|
.wb_cti_o(dwb_cti_o),
|
| 568 |
|
|
.wb_bte_o(dwb_bte_o),
|
| 569 |
|
|
`endif
|
| 570 |
|
|
|
| 571 |
|
|
// Internal RISC bus
|
| 572 |
|
|
.biu_dat_i(sbbiu_dat_sb),
|
| 573 |
|
|
.biu_adr_i(sbbiu_adr_sb),
|
| 574 |
|
|
.biu_cyc_i(sbbiu_cyc_sb),
|
| 575 |
|
|
.biu_stb_i(sbbiu_stb_sb),
|
| 576 |
|
|
.biu_we_i(sbbiu_we_sb),
|
| 577 |
|
|
.biu_sel_i(sbbiu_sel_sb),
|
| 578 |
|
|
.biu_cab_i(sbbiu_cab_sb),
|
| 579 |
|
|
.biu_dat_o(sbbiu_dat_biu),
|
| 580 |
|
|
.biu_ack_o(sbbiu_ack_biu),
|
| 581 |
|
|
.biu_err_o(sbbiu_err_biu)
|
| 582 |
|
|
);
|
| 583 |
|
|
|
| 584 |
|
|
//
|
| 585 |
|
|
// Instantiation of IMMU
|
| 586 |
|
|
//
|
| 587 |
|
|
wire spr_cs_group_immu;
|
| 588 |
|
|
assign spr_cs_group_immu = spr_cs[`OR1200_SPR_GROUP_IMMU];
|
| 589 |
|
|
or1200_immu_top or1200_immu_top(
|
| 590 |
|
|
// Rst and clk
|
| 591 |
|
|
.clk(clk_i),
|
| 592 |
|
|
.rst(rst_i),
|
| 593 |
|
|
|
| 594 |
|
|
`ifdef OR1200_BIST
|
| 595 |
|
|
// RAM BIST
|
| 596 |
|
|
.mbist_si_i(mbist_immu_si),
|
| 597 |
|
|
.mbist_so_o(mbist_immu_so),
|
| 598 |
|
|
.mbist_ctrl_i(mbist_ctrl_i),
|
| 599 |
|
|
`endif
|
| 600 |
|
|
|
| 601 |
|
|
// CPU and IMMU
|
| 602 |
|
|
.ic_en(ic_en),
|
| 603 |
|
|
.immu_en(immu_en),
|
| 604 |
|
|
.supv(supv),
|
| 605 |
|
|
.icpu_adr_i(icpu_adr_cpu),
|
| 606 |
|
|
.icpu_cycstb_i(icpu_cycstb_cpu),
|
| 607 |
|
|
.icpu_adr_o(icpu_adr_immu),
|
| 608 |
|
|
.icpu_tag_o(icpu_tag_immu),
|
| 609 |
|
|
.icpu_rty_o(icpu_rty_immu),
|
| 610 |
|
|
.icpu_err_o(icpu_err_immu),
|
| 611 |
|
|
|
| 612 |
|
|
// SPR access
|
| 613 |
|
|
.spr_cs(spr_cs_group_immu),
|
| 614 |
|
|
.spr_write(spr_we),
|
| 615 |
|
|
.spr_addr(spr_addr),
|
| 616 |
|
|
.spr_dat_i(spr_dat_cpu),
|
| 617 |
|
|
.spr_dat_o(spr_dat_immu),
|
| 618 |
|
|
|
| 619 |
|
|
// QMEM and IMMU
|
| 620 |
|
|
.qmemimmu_rty_i(qmemimmu_rty_qmem),
|
| 621 |
|
|
.qmemimmu_err_i(qmemimmu_err_qmem),
|
| 622 |
|
|
.qmemimmu_tag_i(qmemimmu_tag_qmem),
|
| 623 |
|
|
.qmemimmu_adr_o(qmemimmu_adr_immu),
|
| 624 |
|
|
.qmemimmu_cycstb_o(qmemimmu_cycstb_immu),
|
| 625 |
|
|
.qmemimmu_ci_o(qmemimmu_ci_immu)
|
| 626 |
|
|
);
|
| 627 |
|
|
|
| 628 |
|
|
//
|
| 629 |
|
|
// Instantiation of Instruction Cache
|
| 630 |
|
|
//
|
| 631 |
|
|
wire spr_cs_group_ic;
|
| 632 |
|
|
assign spr_cs_group_ic = spr_cs[`OR1200_SPR_GROUP_IC];
|
| 633 |
|
|
or1200_ic_top or1200_ic_top(
|
| 634 |
|
|
.clk(clk_i),
|
| 635 |
|
|
.rst(rst_i),
|
| 636 |
|
|
|
| 637 |
|
|
`ifdef OR1200_BIST
|
| 638 |
|
|
// RAM BIST
|
| 639 |
|
|
.mbist_si_i(mbist_ic_si),
|
| 640 |
|
|
.mbist_so_o(mbist_ic_so),
|
| 641 |
|
|
.mbist_ctrl_i(mbist_ctrl_i),
|
| 642 |
|
|
`endif
|
| 643 |
|
|
|
| 644 |
|
|
// IC and QMEM
|
| 645 |
|
|
.ic_en(ic_en),
|
| 646 |
|
|
.icqmem_adr_i(icqmem_adr_qmem),
|
| 647 |
|
|
.icqmem_cycstb_i(icqmem_cycstb_qmem),
|
| 648 |
|
|
.icqmem_ci_i(icqmem_ci_qmem),
|
| 649 |
|
|
.icqmem_sel_i(icqmem_sel_qmem),
|
| 650 |
|
|
.icqmem_tag_i(icqmem_tag_qmem),
|
| 651 |
|
|
.icqmem_dat_o(icqmem_dat_ic),
|
| 652 |
|
|
.icqmem_ack_o(icqmem_ack_ic),
|
| 653 |
|
|
.icqmem_rty_o(icqmem_rty_ic),
|
| 654 |
|
|
.icqmem_err_o(icqmem_err_ic),
|
| 655 |
|
|
.icqmem_tag_o(icqmem_tag_ic),
|
| 656 |
|
|
|
| 657 |
|
|
// SPR access
|
| 658 |
|
|
.spr_cs(spr_cs_group_ic),
|
| 659 |
|
|
.spr_write(spr_we),
|
| 660 |
|
|
.spr_dat_i(spr_dat_cpu),
|
| 661 |
|
|
|
| 662 |
|
|
// IC and BIU
|
| 663 |
|
|
.icbiu_dat_o(icbiu_dat_ic),
|
| 664 |
|
|
.icbiu_adr_o(icbiu_adr_ic),
|
| 665 |
|
|
.icbiu_cyc_o(icbiu_cyc_ic),
|
| 666 |
|
|
.icbiu_stb_o(icbiu_stb_ic),
|
| 667 |
|
|
.icbiu_we_o(icbiu_we_ic),
|
| 668 |
|
|
.icbiu_sel_o(icbiu_sel_ic),
|
| 669 |
|
|
.icbiu_cab_o(icbiu_cab_ic),
|
| 670 |
|
|
.icbiu_dat_i(icbiu_dat_biu),
|
| 671 |
|
|
.icbiu_ack_i(icbiu_ack_biu),
|
| 672 |
|
|
.icbiu_err_i(icbiu_err_biu)
|
| 673 |
|
|
);
|
| 674 |
|
|
|
| 675 |
|
|
//
|
| 676 |
|
|
// Instantiation of Instruction Cache
|
| 677 |
|
|
//
|
| 678 |
|
|
or1200_cpu or1200_cpu(
|
| 679 |
|
|
.clk(clk_i),
|
| 680 |
|
|
.rst(rst_i),
|
| 681 |
|
|
|
| 682 |
|
|
// Connection QMEM and IFETCHER inside CPU
|
| 683 |
|
|
.ic_en(ic_en),
|
| 684 |
|
|
.icpu_adr_o(icpu_adr_cpu),
|
| 685 |
|
|
.icpu_cycstb_o(icpu_cycstb_cpu),
|
| 686 |
|
|
.icpu_sel_o(icpu_sel_cpu),
|
| 687 |
|
|
.icpu_tag_o(icpu_tag_cpu),
|
| 688 |
|
|
.icpu_dat_i(icpu_dat_qmem),
|
| 689 |
|
|
.icpu_ack_i(icpu_ack_qmem),
|
| 690 |
|
|
.icpu_rty_i(icpu_rty_immu),
|
| 691 |
|
|
.icpu_adr_i(icpu_adr_immu),
|
| 692 |
|
|
.icpu_err_i(icpu_err_immu),
|
| 693 |
|
|
.icpu_tag_i(icpu_tag_immu),
|
| 694 |
|
|
|
| 695 |
|
|
// Connection CPU to external Debug port
|
| 696 |
|
|
.ex_freeze(ex_freeze),
|
| 697 |
|
|
.ex_insn(ex_insn),
|
| 698 |
|
|
.id_pc(id_pc),
|
| 699 |
|
|
.branch_op(branch_op),
|
| 700 |
|
|
.du_stall(du_stall),
|
| 701 |
|
|
.du_addr(du_addr),
|
| 702 |
|
|
.du_dat_du(du_dat_du),
|
| 703 |
|
|
.du_read(du_read),
|
| 704 |
|
|
.du_write(du_write),
|
| 705 |
|
|
.du_dsr(du_dsr),
|
| 706 |
|
|
.du_except(du_except),
|
| 707 |
|
|
.du_dat_cpu(du_dat_cpu),
|
| 708 |
|
|
.du_hwbkpt(du_hwbkpt),
|
| 709 |
|
|
.rf_dataw(rf_dataw),
|
| 710 |
|
|
|
| 711 |
|
|
|
| 712 |
|
|
// Connection IMMU and CPU internally
|
| 713 |
|
|
.immu_en(immu_en),
|
| 714 |
|
|
|
| 715 |
|
|
// Connection QMEM and CPU
|
| 716 |
|
|
.dc_en(dc_en),
|
| 717 |
|
|
.dcpu_adr_o(dcpu_adr_cpu),
|
| 718 |
|
|
.dcpu_cycstb_o(dcpu_cycstb_cpu),
|
| 719 |
|
|
.dcpu_we_o(dcpu_we_cpu),
|
| 720 |
|
|
.dcpu_sel_o(dcpu_sel_cpu),
|
| 721 |
|
|
.dcpu_tag_o(dcpu_tag_cpu),
|
| 722 |
|
|
.dcpu_dat_o(dcpu_dat_cpu),
|
| 723 |
|
|
.dcpu_dat_i(dcpu_dat_qmem),
|
| 724 |
|
|
.dcpu_ack_i(dcpu_ack_qmem),
|
| 725 |
|
|
.dcpu_rty_i(dcpu_rty_qmem),
|
| 726 |
|
|
.dcpu_err_i(dcpu_err_dmmu),
|
| 727 |
|
|
.dcpu_tag_i(dcpu_tag_dmmu),
|
| 728 |
|
|
|
| 729 |
|
|
// Connection DMMU and CPU internally
|
| 730 |
|
|
.dmmu_en(dmmu_en),
|
| 731 |
|
|
|
| 732 |
|
|
// Connection PIC and CPU's EXCEPT
|
| 733 |
|
|
.sig_int(sig_int),
|
| 734 |
|
|
.sig_tick(sig_tick),
|
| 735 |
|
|
|
| 736 |
|
|
// SPRs
|
| 737 |
|
|
.supv(supv),
|
| 738 |
|
|
.spr_addr(spr_addr),
|
| 739 |
|
|
.spr_dat_cpu(spr_dat_cpu),
|
| 740 |
|
|
.spr_dat_pic(spr_dat_pic),
|
| 741 |
|
|
.spr_dat_tt(spr_dat_tt),
|
| 742 |
|
|
.spr_dat_pm(spr_dat_pm),
|
| 743 |
|
|
.spr_dat_dmmu(spr_dat_dmmu),
|
| 744 |
|
|
.spr_dat_immu(spr_dat_immu),
|
| 745 |
|
|
.spr_dat_du(spr_dat_du),
|
| 746 |
|
|
.spr_dat_npc(spr_dat_npc),
|
| 747 |
|
|
.spr_cs(spr_cs),
|
| 748 |
|
|
.spr_we(spr_we)
|
| 749 |
|
|
);
|
| 750 |
|
|
|
| 751 |
|
|
//
|
| 752 |
|
|
// Instantiation of DMMU
|
| 753 |
|
|
//
|
| 754 |
|
|
wire spr_cs_group_dmmu;
|
| 755 |
|
|
assign spr_cs_group_dmmu = spr_cs[`OR1200_SPR_GROUP_DMMU];
|
| 756 |
|
|
or1200_dmmu_top or1200_dmmu_top(
|
| 757 |
|
|
// Rst and clk
|
| 758 |
|
|
.clk(clk_i),
|
| 759 |
|
|
.rst(rst_i),
|
| 760 |
|
|
|
| 761 |
|
|
`ifdef OR1200_BIST
|
| 762 |
|
|
// RAM BIST
|
| 763 |
|
|
.mbist_si_i(mbist_dmmu_si),
|
| 764 |
|
|
.mbist_so_o(mbist_dmmu_so),
|
| 765 |
|
|
.mbist_ctrl_i(mbist_ctrl_i),
|
| 766 |
|
|
`endif
|
| 767 |
|
|
|
| 768 |
|
|
// CPU i/f
|
| 769 |
|
|
.dc_en(dc_en),
|
| 770 |
|
|
.dmmu_en(dmmu_en),
|
| 771 |
|
|
.supv(supv),
|
| 772 |
|
|
.dcpu_adr_i(dcpu_adr_cpu),
|
| 773 |
|
|
.dcpu_cycstb_i(dcpu_cycstb_cpu),
|
| 774 |
|
|
.dcpu_we_i(dcpu_we_cpu),
|
| 775 |
|
|
.dcpu_tag_o(dcpu_tag_dmmu),
|
| 776 |
|
|
.dcpu_err_o(dcpu_err_dmmu),
|
| 777 |
|
|
|
| 778 |
|
|
// SPR access
|
| 779 |
|
|
.spr_cs(spr_cs_group_dmmu),
|
| 780 |
|
|
.spr_write(spr_we),
|
| 781 |
|
|
.spr_addr(spr_addr),
|
| 782 |
|
|
.spr_dat_i(spr_dat_cpu),
|
| 783 |
|
|
.spr_dat_o(spr_dat_dmmu),
|
| 784 |
|
|
|
| 785 |
|
|
// QMEM and DMMU
|
| 786 |
|
|
.qmemdmmu_err_i(qmemdmmu_err_qmem),
|
| 787 |
|
|
.qmemdmmu_tag_i(qmemdmmu_tag_qmem),
|
| 788 |
|
|
.qmemdmmu_adr_o(qmemdmmu_adr_dmmu),
|
| 789 |
|
|
.qmemdmmu_cycstb_o(qmemdmmu_cycstb_dmmu),
|
| 790 |
|
|
.qmemdmmu_ci_o(qmemdmmu_ci_dmmu)
|
| 791 |
|
|
);
|
| 792 |
|
|
|
| 793 |
|
|
//
|
| 794 |
|
|
// Instantiation of Data Cache
|
| 795 |
|
|
//
|
| 796 |
|
|
wire spr_cs_group_dc;
|
| 797 |
|
|
assign spr_cs_group_dc = spr_cs[`OR1200_SPR_GROUP_DC];
|
| 798 |
|
|
or1200_dc_top or1200_dc_top(
|
| 799 |
|
|
.clk(clk_i),
|
| 800 |
|
|
.rst(rst_i),
|
| 801 |
|
|
|
| 802 |
|
|
`ifdef OR1200_BIST
|
| 803 |
|
|
// RAM BIST
|
| 804 |
|
|
.mbist_si_i(mbist_dc_si),
|
| 805 |
|
|
.mbist_so_o(mbist_dc_so),
|
| 806 |
|
|
.mbist_ctrl_i(mbist_ctrl_i),
|
| 807 |
|
|
`endif
|
| 808 |
|
|
|
| 809 |
|
|
// DC and QMEM
|
| 810 |
|
|
.dc_en(dc_en),
|
| 811 |
|
|
.dcqmem_adr_i(dcqmem_adr_qmem),
|
| 812 |
|
|
.dcqmem_cycstb_i(dcqmem_cycstb_qmem),
|
| 813 |
|
|
.dcqmem_ci_i(dcqmem_ci_qmem),
|
| 814 |
|
|
.dcqmem_we_i(dcqmem_we_qmem),
|
| 815 |
|
|
.dcqmem_sel_i(dcqmem_sel_qmem),
|
| 816 |
|
|
.dcqmem_tag_i(dcqmem_tag_qmem),
|
| 817 |
|
|
.dcqmem_dat_i(dcqmem_dat_qmem),
|
| 818 |
|
|
.dcqmem_dat_o(dcqmem_dat_dc),
|
| 819 |
|
|
.dcqmem_ack_o(dcqmem_ack_dc),
|
| 820 |
|
|
.dcqmem_rty_o(dcqmem_rty_dc),
|
| 821 |
|
|
.dcqmem_err_o(dcqmem_err_dc),
|
| 822 |
|
|
.dcqmem_tag_o(dcqmem_tag_dc),
|
| 823 |
|
|
|
| 824 |
|
|
// SPR access
|
| 825 |
|
|
.spr_cs(spr_cs_group_dc),
|
| 826 |
|
|
.spr_write(spr_we),
|
| 827 |
|
|
.spr_dat_i(spr_dat_cpu),
|
| 828 |
|
|
|
| 829 |
|
|
// DC and BIU
|
| 830 |
|
|
.dcsb_dat_o(dcsb_dat_dc),
|
| 831 |
|
|
.dcsb_adr_o(dcsb_adr_dc),
|
| 832 |
|
|
.dcsb_cyc_o(dcsb_cyc_dc),
|
| 833 |
|
|
.dcsb_stb_o(dcsb_stb_dc),
|
| 834 |
|
|
.dcsb_we_o(dcsb_we_dc),
|
| 835 |
|
|
.dcsb_sel_o(dcsb_sel_dc),
|
| 836 |
|
|
.dcsb_cab_o(dcsb_cab_dc),
|
| 837 |
|
|
.dcsb_dat_i(dcsb_dat_sb),
|
| 838 |
|
|
.dcsb_ack_i(dcsb_ack_sb),
|
| 839 |
|
|
.dcsb_err_i(dcsb_err_sb)
|
| 840 |
|
|
);
|
| 841 |
|
|
|
| 842 |
|
|
//
|
| 843 |
|
|
// Instantiation of embedded memory - qmem
|
| 844 |
|
|
//
|
| 845 |
|
|
or1200_qmem_top or1200_qmem_top(
|
| 846 |
|
|
.clk(clk_i),
|
| 847 |
|
|
.rst(rst_i),
|
| 848 |
|
|
|
| 849 |
|
|
`ifdef OR1200_BIST
|
| 850 |
|
|
// RAM BIST
|
| 851 |
|
|
.mbist_si_i(mbist_qmem_si),
|
| 852 |
|
|
.mbist_so_o(mbist_qmem_so),
|
| 853 |
|
|
.mbist_ctrl_i(mbist_ctrl_i),
|
| 854 |
|
|
`endif
|
| 855 |
|
|
|
| 856 |
|
|
// QMEM and CPU/IMMU
|
| 857 |
|
|
.qmemimmu_adr_i(qmemimmu_adr_immu),
|
| 858 |
|
|
.qmemimmu_cycstb_i(qmemimmu_cycstb_immu),
|
| 859 |
|
|
.qmemimmu_ci_i(qmemimmu_ci_immu),
|
| 860 |
|
|
.qmemicpu_sel_i(icpu_sel_cpu),
|
| 861 |
|
|
.qmemicpu_tag_i(icpu_tag_cpu),
|
| 862 |
|
|
.qmemicpu_dat_o(icpu_dat_qmem),
|
| 863 |
|
|
.qmemicpu_ack_o(icpu_ack_qmem),
|
| 864 |
|
|
.qmemimmu_rty_o(qmemimmu_rty_qmem),
|
| 865 |
|
|
.qmemimmu_err_o(qmemimmu_err_qmem),
|
| 866 |
|
|
.qmemimmu_tag_o(qmemimmu_tag_qmem),
|
| 867 |
|
|
|
| 868 |
|
|
// QMEM and IC
|
| 869 |
|
|
.icqmem_adr_o(icqmem_adr_qmem),
|
| 870 |
|
|
.icqmem_cycstb_o(icqmem_cycstb_qmem),
|
| 871 |
|
|
.icqmem_ci_o(icqmem_ci_qmem),
|
| 872 |
|
|
.icqmem_sel_o(icqmem_sel_qmem),
|
| 873 |
|
|
.icqmem_tag_o(icqmem_tag_qmem),
|
| 874 |
|
|
.icqmem_dat_i(icqmem_dat_ic),
|
| 875 |
|
|
.icqmem_ack_i(icqmem_ack_ic),
|
| 876 |
|
|
.icqmem_rty_i(icqmem_rty_ic),
|
| 877 |
|
|
.icqmem_err_i(icqmem_err_ic),
|
| 878 |
|
|
.icqmem_tag_i(icqmem_tag_ic),
|
| 879 |
|
|
|
| 880 |
|
|
// QMEM and CPU/DMMU
|
| 881 |
|
|
.qmemdmmu_adr_i(qmemdmmu_adr_dmmu),
|
| 882 |
|
|
.qmemdmmu_cycstb_i(qmemdmmu_cycstb_dmmu),
|
| 883 |
|
|
.qmemdmmu_ci_i(qmemdmmu_ci_dmmu),
|
| 884 |
|
|
.qmemdcpu_we_i(dcpu_we_cpu),
|
| 885 |
|
|
.qmemdcpu_sel_i(dcpu_sel_cpu),
|
| 886 |
|
|
.qmemdcpu_tag_i(dcpu_tag_cpu),
|
| 887 |
|
|
.qmemdcpu_dat_i(dcpu_dat_cpu),
|
| 888 |
|
|
.qmemdcpu_dat_o(dcpu_dat_qmem),
|
| 889 |
|
|
.qmemdcpu_ack_o(dcpu_ack_qmem),
|
| 890 |
|
|
.qmemdcpu_rty_o(dcpu_rty_qmem),
|
| 891 |
|
|
.qmemdmmu_err_o(qmemdmmu_err_qmem),
|
| 892 |
|
|
.qmemdmmu_tag_o(qmemdmmu_tag_qmem),
|
| 893 |
|
|
|
| 894 |
|
|
// QMEM and DC
|
| 895 |
|
|
.dcqmem_adr_o(dcqmem_adr_qmem),
|
| 896 |
|
|
.dcqmem_cycstb_o(dcqmem_cycstb_qmem),
|
| 897 |
|
|
.dcqmem_ci_o(dcqmem_ci_qmem),
|
| 898 |
|
|
.dcqmem_we_o(dcqmem_we_qmem),
|
| 899 |
|
|
.dcqmem_sel_o(dcqmem_sel_qmem),
|
| 900 |
|
|
.dcqmem_tag_o(dcqmem_tag_qmem),
|
| 901 |
|
|
.dcqmem_dat_o(dcqmem_dat_qmem),
|
| 902 |
|
|
.dcqmem_dat_i(dcqmem_dat_dc),
|
| 903 |
|
|
.dcqmem_ack_i(dcqmem_ack_dc),
|
| 904 |
|
|
.dcqmem_rty_i(dcqmem_rty_dc),
|
| 905 |
|
|
.dcqmem_err_i(dcqmem_err_dc),
|
| 906 |
|
|
.dcqmem_tag_i(dcqmem_tag_dc)
|
| 907 |
|
|
);
|
| 908 |
|
|
|
| 909 |
|
|
//
|
| 910 |
|
|
// Instantiation of Store Buffer
|
| 911 |
|
|
//
|
| 912 |
|
|
or1200_sb or1200_sb(
|
| 913 |
|
|
// RISC clock, reset
|
| 914 |
|
|
.clk(clk_i),
|
| 915 |
|
|
.rst(rst_i),
|
| 916 |
|
|
|
| 917 |
|
|
// Internal RISC bus (DC<->SB)
|
| 918 |
|
|
.dcsb_dat_i(dcsb_dat_dc),
|
| 919 |
|
|
.dcsb_adr_i(dcsb_adr_dc),
|
| 920 |
|
|
.dcsb_cyc_i(dcsb_cyc_dc),
|
| 921 |
|
|
.dcsb_stb_i(dcsb_stb_dc),
|
| 922 |
|
|
.dcsb_we_i(dcsb_we_dc),
|
| 923 |
|
|
.dcsb_sel_i(dcsb_sel_dc),
|
| 924 |
|
|
.dcsb_cab_i(dcsb_cab_dc),
|
| 925 |
|
|
.dcsb_dat_o(dcsb_dat_sb),
|
| 926 |
|
|
.dcsb_ack_o(dcsb_ack_sb),
|
| 927 |
|
|
.dcsb_err_o(dcsb_err_sb),
|
| 928 |
|
|
|
| 929 |
|
|
// SB and BIU
|
| 930 |
|
|
.sbbiu_dat_o(sbbiu_dat_sb),
|
| 931 |
|
|
.sbbiu_adr_o(sbbiu_adr_sb),
|
| 932 |
|
|
.sbbiu_cyc_o(sbbiu_cyc_sb),
|
| 933 |
|
|
.sbbiu_stb_o(sbbiu_stb_sb),
|
| 934 |
|
|
.sbbiu_we_o(sbbiu_we_sb),
|
| 935 |
|
|
.sbbiu_sel_o(sbbiu_sel_sb),
|
| 936 |
|
|
.sbbiu_cab_o(sbbiu_cab_sb),
|
| 937 |
|
|
.sbbiu_dat_i(sbbiu_dat_biu),
|
| 938 |
|
|
.sbbiu_ack_i(sbbiu_ack_biu),
|
| 939 |
|
|
.sbbiu_err_i(sbbiu_err_biu)
|
| 940 |
|
|
);
|
| 941 |
|
|
|
| 942 |
|
|
//
|
| 943 |
|
|
// Instantiation of Debug Unit
|
| 944 |
|
|
//
|
| 945 |
|
|
wire spr_cs_group_du;
|
| 946 |
|
|
assign spr_cs_group_du = spr_cs[`OR1200_SPR_GROUP_DU];
|
| 947 |
|
|
or1200_du or1200_du(
|
| 948 |
|
|
// RISC Internal Interface
|
| 949 |
|
|
.clk(clk_i),
|
| 950 |
|
|
.rst(rst_i),
|
| 951 |
|
|
.dcpu_cycstb_i(dcpu_cycstb_cpu),
|
| 952 |
|
|
.dcpu_we_i(dcpu_we_cpu),
|
| 953 |
|
|
.dcpu_adr_i(dcpu_adr_cpu),
|
| 954 |
|
|
.dcpu_dat_lsu(dcpu_dat_cpu),
|
| 955 |
|
|
.dcpu_dat_dc(dcpu_dat_qmem),
|
| 956 |
|
|
.icpu_cycstb_i(icpu_cycstb_cpu),
|
| 957 |
|
|
.ex_freeze(ex_freeze),
|
| 958 |
|
|
.branch_op(branch_op),
|
| 959 |
|
|
.ex_insn(ex_insn),
|
| 960 |
|
|
.id_pc(id_pc),
|
| 961 |
|
|
.du_dsr(du_dsr),
|
| 962 |
|
|
|
| 963 |
|
|
// For Trace buffer
|
| 964 |
|
|
.spr_dat_npc(spr_dat_npc),
|
| 965 |
|
|
.rf_dataw(rf_dataw),
|
| 966 |
|
|
|
| 967 |
|
|
// DU's access to SPR unit
|
| 968 |
|
|
.du_stall(du_stall),
|
| 969 |
|
|
.du_addr(du_addr),
|
| 970 |
|
|
.du_dat_i(du_dat_cpu),
|
| 971 |
|
|
.du_dat_o(du_dat_du),
|
| 972 |
|
|
.du_read(du_read),
|
| 973 |
|
|
.du_write(du_write),
|
| 974 |
|
|
.du_except(du_except),
|
| 975 |
|
|
.du_hwbkpt(du_hwbkpt),
|
| 976 |
|
|
|
| 977 |
|
|
// Access to DU's SPRs
|
| 978 |
|
|
.spr_cs(spr_cs_group_du),
|
| 979 |
|
|
.spr_write(spr_we),
|
| 980 |
|
|
.spr_addr(spr_addr),
|
| 981 |
|
|
.spr_dat_i(spr_dat_cpu),
|
| 982 |
|
|
.spr_dat_o(spr_dat_du),
|
| 983 |
|
|
|
| 984 |
|
|
// External Debug Interface
|
| 985 |
|
|
.dbg_stall_i(dbg_stall_i),
|
| 986 |
|
|
.dbg_ewt_i(dbg_ewt_i),
|
| 987 |
|
|
.dbg_lss_o(dbg_lss_o),
|
| 988 |
|
|
.dbg_is_o(dbg_is_o),
|
| 989 |
|
|
.dbg_wp_o(dbg_wp_o),
|
| 990 |
|
|
.dbg_bp_o(dbg_bp_o),
|
| 991 |
|
|
.dbg_stb_i(dbg_stb_i),
|
| 992 |
|
|
.dbg_we_i(dbg_we_i),
|
| 993 |
|
|
.dbg_adr_i(dbg_adr_i),
|
| 994 |
|
|
.dbg_dat_i(dbg_dat_i),
|
| 995 |
|
|
.dbg_dat_o(dbg_dat_o),
|
| 996 |
|
|
.dbg_ack_o(dbg_ack_o)
|
| 997 |
|
|
);
|
| 998 |
|
|
|
| 999 |
|
|
//
|
| 1000 |
|
|
// Programmable interrupt controller
|
| 1001 |
|
|
//
|
| 1002 |
|
|
wire spr_cs_group_pic;
|
| 1003 |
|
|
assign spr_cs_group_pic = spr_cs[`OR1200_SPR_GROUP_PIC];
|
| 1004 |
|
|
or1200_pic or1200_pic(
|
| 1005 |
|
|
// RISC Internal Interface
|
| 1006 |
|
|
.clk(clk_i),
|
| 1007 |
|
|
.rst(rst_i),
|
| 1008 |
|
|
.spr_cs(spr_cs_group_pic),
|
| 1009 |
|
|
.spr_write(spr_we),
|
| 1010 |
|
|
.spr_addr(spr_addr),
|
| 1011 |
|
|
.spr_dat_i(spr_dat_cpu),
|
| 1012 |
|
|
.spr_dat_o(spr_dat_pic),
|
| 1013 |
|
|
.pic_wakeup(pic_wakeup),
|
| 1014 |
|
|
.intr(sig_int),
|
| 1015 |
|
|
|
| 1016 |
|
|
// PIC Interface
|
| 1017 |
|
|
.pic_int(pic_ints_i)
|
| 1018 |
|
|
);
|
| 1019 |
|
|
|
| 1020 |
|
|
//
|
| 1021 |
|
|
// Instantiation of Tick timer
|
| 1022 |
|
|
//
|
| 1023 |
|
|
wire spr_cs_group_tt;
|
| 1024 |
|
|
assign spr_cs_group_tt = spr_cs[`OR1200_SPR_GROUP_TT];
|
| 1025 |
|
|
or1200_tt or1200_tt(
|
| 1026 |
|
|
// RISC Internal Interface
|
| 1027 |
|
|
.clk(clk_i),
|
| 1028 |
|
|
.rst(rst_i),
|
| 1029 |
|
|
.du_stall(du_stall),
|
| 1030 |
|
|
.spr_cs(spr_cs_group_tt),
|
| 1031 |
|
|
.spr_write(spr_we),
|
| 1032 |
|
|
.spr_addr(spr_addr),
|
| 1033 |
|
|
.spr_dat_i(spr_dat_cpu),
|
| 1034 |
|
|
.spr_dat_o(spr_dat_tt),
|
| 1035 |
|
|
.intr(sig_tick)
|
| 1036 |
|
|
);
|
| 1037 |
|
|
|
| 1038 |
|
|
//
|
| 1039 |
|
|
// Instantiation of Power Management
|
| 1040 |
|
|
//
|
| 1041 |
|
|
or1200_pm or1200_pm(
|
| 1042 |
|
|
// RISC Internal Interface
|
| 1043 |
|
|
.clk(clk_i),
|
| 1044 |
|
|
.rst(rst_i),
|
| 1045 |
|
|
.pic_wakeup(pic_wakeup),
|
| 1046 |
|
|
.spr_write(spr_we),
|
| 1047 |
|
|
.spr_addr(spr_addr),
|
| 1048 |
|
|
.spr_dat_i(spr_dat_cpu),
|
| 1049 |
|
|
.spr_dat_o(spr_dat_pm),
|
| 1050 |
|
|
|
| 1051 |
|
|
// Power Management Interface
|
| 1052 |
|
|
.pm_cpustall(pm_cpustall_i),
|
| 1053 |
|
|
.pm_clksd(pm_clksd_o),
|
| 1054 |
|
|
.pm_dc_gate(pm_dc_gate_o),
|
| 1055 |
|
|
.pm_ic_gate(pm_ic_gate_o),
|
| 1056 |
|
|
.pm_dmmu_gate(pm_dmmu_gate_o),
|
| 1057 |
|
|
.pm_immu_gate(pm_immu_gate_o),
|
| 1058 |
|
|
.pm_tt_gate(pm_tt_gate_o),
|
| 1059 |
|
|
.pm_cpu_gate(pm_cpu_gate_o),
|
| 1060 |
|
|
.pm_wakeup(pm_wakeup_o),
|
| 1061 |
|
|
.pm_lvolt(pm_lvolt_o)
|
| 1062 |
|
|
);
|
| 1063 |
|
|
|
| 1064 |
|
|
|
| 1065 |
|
|
endmodule
|