| 1 |
10 |
unneback |
//////////////////////////////////////////////////////////////////////
|
| 2 |
|
|
//// ////
|
| 3 |
|
|
//// OR1200's definitions ////
|
| 4 |
|
|
//// ////
|
| 5 |
|
|
//// This file is part of the OpenRISC 1200 project ////
|
| 6 |
185 |
julius |
//// http://opencores.org/project,or1k ////
|
| 7 |
10 |
unneback |
//// ////
|
| 8 |
|
|
//// Description ////
|
| 9 |
185 |
julius |
//// Defines for the OR1200 core ////
|
| 10 |
10 |
unneback |
//// ////
|
| 11 |
|
|
//// To Do: ////
|
| 12 |
|
|
//// - add parameters that are missing ////
|
| 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 |
141 |
marcus.erl |
// $Log: or1200_defines.v,v $
|
| 45 |
|
|
// Revision 2.0 2010/06/30 11:00:00 ORSoC
|
| 46 |
|
|
// Minor update:
|
| 47 |
|
|
// Defines added, bugs fixed.
|
| 48 |
10 |
unneback |
|
| 49 |
|
|
//
|
| 50 |
|
|
// Dump VCD
|
| 51 |
|
|
//
|
| 52 |
|
|
//`define OR1200_VCD_DUMP
|
| 53 |
|
|
|
| 54 |
|
|
//
|
| 55 |
|
|
// Generate debug messages during simulation
|
| 56 |
|
|
//
|
| 57 |
|
|
//`define OR1200_VERBOSE
|
| 58 |
|
|
|
| 59 |
|
|
// `define OR1200_ASIC
|
| 60 |
|
|
////////////////////////////////////////////////////////
|
| 61 |
|
|
//
|
| 62 |
|
|
// Typical configuration for an ASIC
|
| 63 |
|
|
//
|
| 64 |
|
|
`ifdef OR1200_ASIC
|
| 65 |
|
|
|
| 66 |
|
|
//
|
| 67 |
|
|
// Target ASIC memories
|
| 68 |
|
|
//
|
| 69 |
|
|
//`define OR1200_ARTISAN_SSP
|
| 70 |
|
|
//`define OR1200_ARTISAN_SDP
|
| 71 |
|
|
//`define OR1200_ARTISAN_STP
|
| 72 |
|
|
`define OR1200_VIRTUALSILICON_SSP
|
| 73 |
|
|
//`define OR1200_VIRTUALSILICON_STP_T1
|
| 74 |
|
|
//`define OR1200_VIRTUALSILICON_STP_T2
|
| 75 |
|
|
|
| 76 |
|
|
//
|
| 77 |
|
|
// Do not implement Data cache
|
| 78 |
|
|
//
|
| 79 |
|
|
//`define OR1200_NO_DC
|
| 80 |
|
|
|
| 81 |
|
|
//
|
| 82 |
|
|
// Do not implement Insn cache
|
| 83 |
|
|
//
|
| 84 |
|
|
//`define OR1200_NO_IC
|
| 85 |
|
|
|
| 86 |
|
|
//
|
| 87 |
|
|
// Do not implement Data MMU
|
| 88 |
|
|
//
|
| 89 |
|
|
//`define OR1200_NO_DMMU
|
| 90 |
|
|
|
| 91 |
|
|
//
|
| 92 |
|
|
// Do not implement Insn MMU
|
| 93 |
|
|
//
|
| 94 |
|
|
//`define OR1200_NO_IMMU
|
| 95 |
|
|
|
| 96 |
|
|
//
|
| 97 |
|
|
// Select between ASIC optimized and generic multiplier
|
| 98 |
|
|
//
|
| 99 |
|
|
//`define OR1200_ASIC_MULTP2_32X32
|
| 100 |
|
|
`define OR1200_GENERIC_MULTP2_32X32
|
| 101 |
|
|
|
| 102 |
|
|
//
|
| 103 |
|
|
// Size/type of insn/data cache if implemented
|
| 104 |
|
|
//
|
| 105 |
|
|
// `define OR1200_IC_1W_512B
|
| 106 |
|
|
// `define OR1200_IC_1W_4KB
|
| 107 |
|
|
`define OR1200_IC_1W_8KB
|
| 108 |
|
|
// `define OR1200_DC_1W_4KB
|
| 109 |
|
|
`define OR1200_DC_1W_8KB
|
| 110 |
|
|
|
| 111 |
|
|
`else
|
| 112 |
|
|
|
| 113 |
|
|
|
| 114 |
|
|
/////////////////////////////////////////////////////////
|
| 115 |
|
|
//
|
| 116 |
|
|
// Typical configuration for an FPGA
|
| 117 |
|
|
//
|
| 118 |
|
|
|
| 119 |
|
|
//
|
| 120 |
|
|
// Target FPGA memories
|
| 121 |
|
|
//
|
| 122 |
|
|
//`define OR1200_ALTERA_LPM
|
| 123 |
|
|
//`define OR1200_XILINX_RAMB16
|
| 124 |
|
|
//`define OR1200_XILINX_RAMB4
|
| 125 |
|
|
//`define OR1200_XILINX_RAM32X1D
|
| 126 |
|
|
//`define OR1200_USE_RAM16X1D_FOR_RAM32X1D
|
| 127 |
141 |
marcus.erl |
`define OR1200_ACTEL
|
| 128 |
10 |
unneback |
|
| 129 |
|
|
//
|
| 130 |
|
|
// Do not implement Data cache
|
| 131 |
|
|
//
|
| 132 |
|
|
`define OR1200_NO_DC
|
| 133 |
|
|
|
| 134 |
|
|
//
|
| 135 |
|
|
// Do not implement Insn cache
|
| 136 |
|
|
//
|
| 137 |
141 |
marcus.erl |
//`define OR1200_NO_IC
|
| 138 |
10 |
unneback |
|
| 139 |
|
|
//
|
| 140 |
|
|
// Do not implement Data MMU
|
| 141 |
|
|
//
|
| 142 |
141 |
marcus.erl |
//`define OR1200_NO_DMMU
|
| 143 |
10 |
unneback |
|
| 144 |
|
|
//
|
| 145 |
|
|
// Do not implement Insn MMU
|
| 146 |
|
|
//
|
| 147 |
141 |
marcus.erl |
//`define OR1200_NO_IMMU
|
| 148 |
10 |
unneback |
|
| 149 |
|
|
//
|
| 150 |
|
|
// Select between ASIC and generic multiplier
|
| 151 |
|
|
//
|
| 152 |
|
|
// (Generic seems to trigger a bug in the Cadence Ncsim simulator)
|
| 153 |
|
|
//
|
| 154 |
|
|
//`define OR1200_ASIC_MULTP2_32X32
|
| 155 |
|
|
`define OR1200_GENERIC_MULTP2_32X32
|
| 156 |
|
|
|
| 157 |
|
|
//
|
| 158 |
|
|
// Size/type of insn/data cache if implemented
|
| 159 |
|
|
// (consider available FPGA memory resources)
|
| 160 |
|
|
//
|
| 161 |
|
|
//`define OR1200_IC_1W_512B
|
| 162 |
141 |
marcus.erl |
//`define OR1200_IC_1W_4KB
|
| 163 |
|
|
`define OR1200_IC_1W_8KB
|
| 164 |
10 |
unneback |
`define OR1200_DC_1W_4KB
|
| 165 |
|
|
//`define OR1200_DC_1W_8KB
|
| 166 |
|
|
|
| 167 |
|
|
`endif
|
| 168 |
|
|
|
| 169 |
|
|
|
| 170 |
|
|
//////////////////////////////////////////////////////////
|
| 171 |
|
|
//
|
| 172 |
|
|
// Do not change below unless you know what you are doing
|
| 173 |
|
|
//
|
| 174 |
|
|
|
| 175 |
|
|
//
|
| 176 |
|
|
// Enable RAM BIST
|
| 177 |
|
|
//
|
| 178 |
|
|
// At the moment this only works for Virtual Silicon
|
| 179 |
|
|
// single port RAMs. For other RAMs it has not effect.
|
| 180 |
|
|
// Special wrapper for VS RAMs needs to be provided
|
| 181 |
|
|
// with scan flops to facilitate bist scan.
|
| 182 |
|
|
//
|
| 183 |
|
|
//`define OR1200_BIST
|
| 184 |
|
|
|
| 185 |
|
|
//
|
| 186 |
|
|
// Register OR1200 WISHBONE outputs
|
| 187 |
|
|
// (must be defined/enabled)
|
| 188 |
|
|
//
|
| 189 |
|
|
`define OR1200_REGISTERED_OUTPUTS
|
| 190 |
|
|
|
| 191 |
|
|
//
|
| 192 |
|
|
// Register OR1200 WISHBONE inputs
|
| 193 |
|
|
//
|
| 194 |
|
|
// (must be undefined/disabled)
|
| 195 |
|
|
//
|
| 196 |
|
|
//`define OR1200_REGISTERED_INPUTS
|
| 197 |
|
|
|
| 198 |
|
|
//
|
| 199 |
|
|
// Disable bursts if they are not supported by the
|
| 200 |
|
|
// memory subsystem (only affect cache line fill)
|
| 201 |
|
|
//
|
| 202 |
|
|
//`define OR1200_NO_BURSTS
|
| 203 |
|
|
//
|
| 204 |
|
|
|
| 205 |
|
|
//
|
| 206 |
|
|
// WISHBONE retry counter range
|
| 207 |
|
|
//
|
| 208 |
|
|
// 2^value range for retry counter. Retry counter
|
| 209 |
|
|
// is activated whenever *wb_rty_i is asserted and
|
| 210 |
|
|
// until retry counter expires, corresponding
|
| 211 |
|
|
// WISHBONE interface is deactivated.
|
| 212 |
|
|
//
|
| 213 |
|
|
// To disable retry counters and *wb_rty_i all together,
|
| 214 |
|
|
// undefine this macro.
|
| 215 |
|
|
//
|
| 216 |
|
|
//`define OR1200_WB_RETRY 7
|
| 217 |
|
|
|
| 218 |
|
|
//
|
| 219 |
|
|
// WISHBONE Consecutive Address Burst
|
| 220 |
|
|
//
|
| 221 |
|
|
// This was used prior to WISHBONE B3 specification
|
| 222 |
|
|
// to identify bursts. It is no longer needed but
|
| 223 |
|
|
// remains enabled for compatibility with old designs.
|
| 224 |
|
|
//
|
| 225 |
|
|
// To remove *wb_cab_o ports undefine this macro.
|
| 226 |
|
|
//
|
| 227 |
141 |
marcus.erl |
//`define OR1200_WB_CAB
|
| 228 |
10 |
unneback |
|
| 229 |
|
|
//
|
| 230 |
|
|
// WISHBONE B3 compatible interface
|
| 231 |
|
|
//
|
| 232 |
|
|
// This follows the WISHBONE B3 specification.
|
| 233 |
|
|
// It is not enabled by default because most
|
| 234 |
|
|
// designs still don't use WB b3.
|
| 235 |
|
|
//
|
| 236 |
|
|
// To enable *wb_cti_o/*wb_bte_o ports,
|
| 237 |
|
|
// define this macro.
|
| 238 |
|
|
//
|
| 239 |
141 |
marcus.erl |
`define OR1200_WB_B3
|
| 240 |
10 |
unneback |
|
| 241 |
|
|
//
|
| 242 |
141 |
marcus.erl |
// LOG all WISHBONE accesses
|
| 243 |
|
|
//
|
| 244 |
|
|
`define OR1200_LOG_WB_ACCESS
|
| 245 |
|
|
|
| 246 |
|
|
//
|
| 247 |
10 |
unneback |
// Enable additional synthesis directives if using
|
| 248 |
|
|
// _Synopsys_ synthesis tool
|
| 249 |
|
|
//
|
| 250 |
|
|
//`define OR1200_ADDITIONAL_SYNOPSYS_DIRECTIVES
|
| 251 |
|
|
|
| 252 |
|
|
//
|
| 253 |
|
|
// Enables default statement in some case blocks
|
| 254 |
|
|
// and disables Synopsys synthesis directive full_case
|
| 255 |
|
|
//
|
| 256 |
|
|
// By default it is enabled. When disabled it
|
| 257 |
|
|
// can increase clock frequency.
|
| 258 |
|
|
//
|
| 259 |
|
|
`define OR1200_CASE_DEFAULT
|
| 260 |
|
|
|
| 261 |
|
|
//
|
| 262 |
|
|
// Operand width / register file address width
|
| 263 |
|
|
//
|
| 264 |
|
|
// (DO NOT CHANGE)
|
| 265 |
|
|
//
|
| 266 |
|
|
`define OR1200_OPERAND_WIDTH 32
|
| 267 |
|
|
`define OR1200_REGFILE_ADDR_WIDTH 5
|
| 268 |
|
|
|
| 269 |
|
|
//
|
| 270 |
|
|
// l.add/l.addi/l.and and optional l.addc/l.addic
|
| 271 |
|
|
// also set (compare) flag when result of their
|
| 272 |
|
|
// operation equals zero
|
| 273 |
|
|
//
|
| 274 |
|
|
// At the time of writing this, default or32
|
| 275 |
|
|
// C/C++ compiler doesn't generate code that
|
| 276 |
|
|
// would benefit from this optimization.
|
| 277 |
|
|
//
|
| 278 |
|
|
// By default this optimization is disabled to
|
| 279 |
|
|
// save area.
|
| 280 |
|
|
//
|
| 281 |
|
|
//`define OR1200_ADDITIONAL_FLAG_MODIFIERS
|
| 282 |
|
|
|
| 283 |
|
|
//
|
| 284 |
|
|
// Implement l.addc/l.addic instructions
|
| 285 |
|
|
//
|
| 286 |
|
|
// By default implementation of l.addc/l.addic
|
| 287 |
|
|
// instructions is enabled in case you need them.
|
| 288 |
|
|
// If you don't use them, then disable implementation
|
| 289 |
|
|
// to save area.
|
| 290 |
|
|
//
|
| 291 |
141 |
marcus.erl |
//`define OR1200_IMPL_ADDC
|
| 292 |
10 |
unneback |
|
| 293 |
|
|
//
|
| 294 |
141 |
marcus.erl |
// Implement l.sub instruction
|
| 295 |
|
|
//
|
| 296 |
|
|
// By default implementation of l.sub instructions
|
| 297 |
|
|
// is enabled to be compliant with the simulator.
|
| 298 |
|
|
// If you don't use carry bit, then disable
|
| 299 |
|
|
// implementation to save area.
|
| 300 |
|
|
//
|
| 301 |
|
|
`define OR1200_IMPL_SUB
|
| 302 |
|
|
|
| 303 |
|
|
//
|
| 304 |
10 |
unneback |
// Implement carry bit SR[CY]
|
| 305 |
|
|
//
|
| 306 |
141 |
marcus.erl |
//
|
| 307 |
10 |
unneback |
// By default implementation of SR[CY] is enabled
|
| 308 |
141 |
marcus.erl |
// to be compliant with the simulator. However SR[CY]
|
| 309 |
|
|
// is explicitly only used by l.addc/l.addic/l.sub
|
| 310 |
|
|
// instructions and if these three insns are not
|
| 311 |
10 |
unneback |
// implemented there is not much point having SR[CY].
|
| 312 |
|
|
//
|
| 313 |
141 |
marcus.erl |
//`define OR1200_IMPL_CY
|
| 314 |
10 |
unneback |
|
| 315 |
|
|
//
|
| 316 |
|
|
// Implement optional l.div/l.divu instructions
|
| 317 |
|
|
//
|
| 318 |
|
|
// By default divide instructions are not implemented
|
| 319 |
|
|
// to save area and increase clock frequency. or32 C/C++
|
| 320 |
|
|
// compiler can use soft library for division.
|
| 321 |
|
|
//
|
| 322 |
|
|
// To implement divide, multiplier needs to be implemented.
|
| 323 |
|
|
//
|
| 324 |
|
|
//`define OR1200_IMPL_DIV
|
| 325 |
|
|
|
| 326 |
|
|
//
|
| 327 |
|
|
// Implement rotate in the ALU
|
| 328 |
|
|
//
|
| 329 |
|
|
// At the time of writing this, or32
|
| 330 |
|
|
// C/C++ compiler doesn't generate rotate
|
| 331 |
|
|
// instructions. However or32 assembler
|
| 332 |
|
|
// can assemble code that uses rotate insn.
|
| 333 |
|
|
// This means that rotate instructions
|
| 334 |
|
|
// must be used manually inserted.
|
| 335 |
|
|
//
|
| 336 |
|
|
// By default implementation of rotate
|
| 337 |
|
|
// is disabled to save area and increase
|
| 338 |
|
|
// clock frequency.
|
| 339 |
|
|
//
|
| 340 |
|
|
//`define OR1200_IMPL_ALU_ROTATE
|
| 341 |
|
|
|
| 342 |
|
|
//
|
| 343 |
|
|
// Type of ALU compare to implement
|
| 344 |
|
|
//
|
| 345 |
|
|
// Try either one to find what yields
|
| 346 |
|
|
// higher clock frequencyin your case.
|
| 347 |
|
|
//
|
| 348 |
|
|
//`define OR1200_IMPL_ALU_COMP1
|
| 349 |
|
|
`define OR1200_IMPL_ALU_COMP2
|
| 350 |
|
|
|
| 351 |
|
|
//
|
| 352 |
|
|
// Implement multiplier
|
| 353 |
|
|
//
|
| 354 |
|
|
// By default multiplier is implemented
|
| 355 |
|
|
//
|
| 356 |
141 |
marcus.erl |
//`define OR1200_MULT_IMPLEMENTED
|
| 357 |
10 |
unneback |
|
| 358 |
|
|
//
|
| 359 |
|
|
// Implement multiply-and-accumulate
|
| 360 |
|
|
//
|
| 361 |
|
|
// By default MAC is implemented. To
|
| 362 |
|
|
// implement MAC, multiplier needs to be
|
| 363 |
|
|
// implemented.
|
| 364 |
|
|
//
|
| 365 |
141 |
marcus.erl |
//`define OR1200_MAC_IMPLEMENTED
|
| 366 |
10 |
unneback |
|
| 367 |
|
|
//
|
| 368 |
|
|
// Low power, slower multiplier
|
| 369 |
|
|
//
|
| 370 |
|
|
// Select between low-power (larger) multiplier
|
| 371 |
|
|
// and faster multiplier. The actual difference
|
| 372 |
|
|
// is only AND logic that prevents distribution
|
| 373 |
|
|
// of operands into the multiplier when instruction
|
| 374 |
|
|
// in execution is not multiply instruction
|
| 375 |
|
|
//
|
| 376 |
|
|
//`define OR1200_LOWPWR_MULT
|
| 377 |
|
|
|
| 378 |
|
|
//
|
| 379 |
185 |
julius |
// Implement HW Single Precision FPU
|
| 380 |
|
|
//
|
| 381 |
|
|
//`define OR1200_FPU_IMPLEMENTED
|
| 382 |
|
|
|
| 383 |
|
|
//
|
| 384 |
10 |
unneback |
// Clock ratio RISC clock versus WB clock
|
| 385 |
|
|
//
|
| 386 |
|
|
// If you plan to run WB:RISC clock fixed to 1:1, disable
|
| 387 |
|
|
// both defines
|
| 388 |
|
|
//
|
| 389 |
|
|
// For WB:RISC 1:2 or 1:1, enable OR1200_CLKDIV_2_SUPPORTED
|
| 390 |
|
|
// and use clmode to set ratio
|
| 391 |
|
|
//
|
| 392 |
|
|
// For WB:RISC 1:4, 1:2 or 1:1, enable both defines and use
|
| 393 |
|
|
// clmode to set ratio
|
| 394 |
|
|
//
|
| 395 |
141 |
marcus.erl |
//`define OR1200_CLKDIV_2_SUPPORTED
|
| 396 |
10 |
unneback |
//`define OR1200_CLKDIV_4_SUPPORTED
|
| 397 |
|
|
|
| 398 |
|
|
//
|
| 399 |
|
|
// Type of register file RAM
|
| 400 |
|
|
//
|
| 401 |
|
|
// Memory macro w/ two ports (see or1200_tpram_32x32.v)
|
| 402 |
|
|
//`define OR1200_RFRAM_TWOPORT
|
| 403 |
|
|
//
|
| 404 |
|
|
// Memory macro dual port (see or1200_dpram_32x32.v)
|
| 405 |
141 |
marcus.erl |
`define OR1200_RFRAM_DUALPORT
|
| 406 |
|
|
|
| 407 |
10 |
unneback |
//
|
| 408 |
|
|
// Generic (flip-flop based) register file (see or1200_rfram_generic.v)
|
| 409 |
141 |
marcus.erl |
//`define OR1200_RFRAM_GENERIC
|
| 410 |
|
|
// Generic register file supports - 16 registers
|
| 411 |
|
|
`ifdef OR1200_RFRAM_GENERIC
|
| 412 |
|
|
// `define OR1200_RFRAM_16REG
|
| 413 |
|
|
`endif
|
| 414 |
10 |
unneback |
|
| 415 |
|
|
//
|
| 416 |
|
|
// Type of mem2reg aligner to implement.
|
| 417 |
|
|
//
|
| 418 |
|
|
// Once OR1200_IMPL_MEM2REG2 yielded faster
|
| 419 |
|
|
// circuit, however with today tools it will
|
| 420 |
|
|
// most probably give you slower circuit.
|
| 421 |
|
|
//
|
| 422 |
|
|
`define OR1200_IMPL_MEM2REG1
|
| 423 |
|
|
//`define OR1200_IMPL_MEM2REG2
|
| 424 |
|
|
|
| 425 |
|
|
//
|
| 426 |
|
|
// ALUOPs
|
| 427 |
|
|
//
|
| 428 |
|
|
`define OR1200_ALUOP_WIDTH 4
|
| 429 |
|
|
`define OR1200_ALUOP_NOP 4'd4
|
| 430 |
|
|
/* Order defined by arith insns that have two source operands both in regs
|
| 431 |
|
|
(see binutils/include/opcode/or32.h) */
|
| 432 |
|
|
`define OR1200_ALUOP_ADD 4'd0
|
| 433 |
|
|
`define OR1200_ALUOP_ADDC 4'd1
|
| 434 |
|
|
`define OR1200_ALUOP_SUB 4'd2
|
| 435 |
|
|
`define OR1200_ALUOP_AND 4'd3
|
| 436 |
|
|
`define OR1200_ALUOP_OR 4'd4
|
| 437 |
|
|
`define OR1200_ALUOP_XOR 4'd5
|
| 438 |
|
|
`define OR1200_ALUOP_MUL 4'd6
|
| 439 |
|
|
`define OR1200_ALUOP_CUST5 4'd7
|
| 440 |
|
|
`define OR1200_ALUOP_SHROT 4'd8
|
| 441 |
|
|
`define OR1200_ALUOP_DIV 4'd9
|
| 442 |
|
|
`define OR1200_ALUOP_DIVU 4'd10
|
| 443 |
|
|
/* Order not specifically defined. */
|
| 444 |
|
|
`define OR1200_ALUOP_IMM 4'd11
|
| 445 |
|
|
`define OR1200_ALUOP_MOVHI 4'd12
|
| 446 |
|
|
`define OR1200_ALUOP_COMP 4'd13
|
| 447 |
|
|
`define OR1200_ALUOP_MTSR 4'd14
|
| 448 |
|
|
`define OR1200_ALUOP_MFSR 4'd15
|
| 449 |
141 |
marcus.erl |
`define OR1200_ALUOP_CMOV 4'd14
|
| 450 |
|
|
`define OR1200_ALUOP_FF1 4'd15
|
| 451 |
10 |
unneback |
//
|
| 452 |
|
|
// MACOPs
|
| 453 |
|
|
//
|
| 454 |
141 |
marcus.erl |
`define OR1200_MACOP_WIDTH 3
|
| 455 |
|
|
`define OR1200_MACOP_NOP 3'b000
|
| 456 |
|
|
`define OR1200_MACOP_MAC 3'b001
|
| 457 |
|
|
`define OR1200_MACOP_MSB 3'b010
|
| 458 |
10 |
unneback |
|
| 459 |
|
|
//
|
| 460 |
|
|
// Shift/rotate ops
|
| 461 |
|
|
//
|
| 462 |
|
|
`define OR1200_SHROTOP_WIDTH 2
|
| 463 |
|
|
`define OR1200_SHROTOP_NOP 2'd0
|
| 464 |
|
|
`define OR1200_SHROTOP_SLL 2'd0
|
| 465 |
|
|
`define OR1200_SHROTOP_SRL 2'd1
|
| 466 |
|
|
`define OR1200_SHROTOP_SRA 2'd2
|
| 467 |
|
|
`define OR1200_SHROTOP_ROR 2'd3
|
| 468 |
|
|
|
| 469 |
|
|
// Execution cycles per instruction
|
| 470 |
185 |
julius |
`define OR1200_MULTICYCLE_WIDTH 3
|
| 471 |
|
|
`define OR1200_ONE_CYCLE 3'd0
|
| 472 |
|
|
`define OR1200_TWO_CYCLES 3'd1
|
| 473 |
10 |
unneback |
|
| 474 |
|
|
// Operand MUX selects
|
| 475 |
|
|
`define OR1200_SEL_WIDTH 2
|
| 476 |
|
|
`define OR1200_SEL_RF 2'd0
|
| 477 |
|
|
`define OR1200_SEL_IMM 2'd1
|
| 478 |
|
|
`define OR1200_SEL_EX_FORW 2'd2
|
| 479 |
|
|
`define OR1200_SEL_WB_FORW 2'd3
|
| 480 |
|
|
|
| 481 |
|
|
//
|
| 482 |
|
|
// BRANCHOPs
|
| 483 |
|
|
//
|
| 484 |
|
|
`define OR1200_BRANCHOP_WIDTH 3
|
| 485 |
|
|
`define OR1200_BRANCHOP_NOP 3'd0
|
| 486 |
|
|
`define OR1200_BRANCHOP_J 3'd1
|
| 487 |
|
|
`define OR1200_BRANCHOP_JR 3'd2
|
| 488 |
|
|
`define OR1200_BRANCHOP_BAL 3'd3
|
| 489 |
|
|
`define OR1200_BRANCHOP_BF 3'd4
|
| 490 |
|
|
`define OR1200_BRANCHOP_BNF 3'd5
|
| 491 |
|
|
`define OR1200_BRANCHOP_RFE 3'd6
|
| 492 |
|
|
|
| 493 |
|
|
//
|
| 494 |
|
|
// LSUOPs
|
| 495 |
|
|
//
|
| 496 |
|
|
// Bit 0: sign extend
|
| 497 |
|
|
// Bits 1-2: 00 doubleword, 01 byte, 10 halfword, 11 singleword
|
| 498 |
|
|
// Bit 3: 0 load, 1 store
|
| 499 |
|
|
`define OR1200_LSUOP_WIDTH 4
|
| 500 |
|
|
`define OR1200_LSUOP_NOP 4'b0000
|
| 501 |
|
|
`define OR1200_LSUOP_LBZ 4'b0010
|
| 502 |
|
|
`define OR1200_LSUOP_LBS 4'b0011
|
| 503 |
|
|
`define OR1200_LSUOP_LHZ 4'b0100
|
| 504 |
|
|
`define OR1200_LSUOP_LHS 4'b0101
|
| 505 |
|
|
`define OR1200_LSUOP_LWZ 4'b0110
|
| 506 |
|
|
`define OR1200_LSUOP_LWS 4'b0111
|
| 507 |
141 |
marcus.erl |
`define OR1200_LSUOP_LD 4'b0001
|
| 508 |
|
|
`define OR1200_LSUOP_SD 4'b1000
|
| 509 |
|
|
`define OR1200_LSUOP_SB 4'b1010
|
| 510 |
|
|
`define OR1200_LSUOP_SH 4'b1100
|
| 511 |
|
|
`define OR1200_LSUOP_SW 4'b1110
|
| 512 |
10 |
unneback |
|
| 513 |
141 |
marcus.erl |
// Number of bits of load/store EA precalculated in ID stage
|
| 514 |
|
|
// for balancing ID and EX stages.
|
| 515 |
|
|
//
|
| 516 |
|
|
// Valid range: 2,3,...,30,31
|
| 517 |
|
|
`define OR1200_LSUEA_PRECALC 2
|
| 518 |
|
|
|
| 519 |
10 |
unneback |
// FETCHOPs
|
| 520 |
|
|
`define OR1200_FETCHOP_WIDTH 1
|
| 521 |
|
|
`define OR1200_FETCHOP_NOP 1'b0
|
| 522 |
|
|
`define OR1200_FETCHOP_LW 1'b1
|
| 523 |
|
|
|
| 524 |
|
|
//
|
| 525 |
|
|
// Register File Write-Back OPs
|
| 526 |
|
|
//
|
| 527 |
|
|
// Bit 0: register file write enable
|
| 528 |
185 |
julius |
// Bits 3-1: write-back mux selects
|
| 529 |
|
|
//
|
| 530 |
|
|
`define OR1200_RFWBOP_WIDTH 4
|
| 531 |
|
|
`define OR1200_RFWBOP_NOP 4'b0000
|
| 532 |
|
|
`define OR1200_RFWBOP_ALU 3'b000
|
| 533 |
|
|
`define OR1200_RFWBOP_LSU 3'b001
|
| 534 |
|
|
`define OR1200_RFWBOP_SPRS 3'b010
|
| 535 |
|
|
`define OR1200_RFWBOP_LR 3'b011
|
| 536 |
|
|
`define OR1200_RFWBOP_FPU 3'b100
|
| 537 |
10 |
unneback |
|
| 538 |
|
|
// Compare instructions
|
| 539 |
|
|
`define OR1200_COP_SFEQ 3'b000
|
| 540 |
|
|
`define OR1200_COP_SFNE 3'b001
|
| 541 |
|
|
`define OR1200_COP_SFGT 3'b010
|
| 542 |
|
|
`define OR1200_COP_SFGE 3'b011
|
| 543 |
|
|
`define OR1200_COP_SFLT 3'b100
|
| 544 |
|
|
`define OR1200_COP_SFLE 3'b101
|
| 545 |
|
|
`define OR1200_COP_X 3'b111
|
| 546 |
|
|
`define OR1200_SIGNED_COMPARE 'd3
|
| 547 |
|
|
`define OR1200_COMPOP_WIDTH 4
|
| 548 |
|
|
|
| 549 |
|
|
//
|
| 550 |
185 |
julius |
// FP OPs
|
| 551 |
|
|
//
|
| 552 |
|
|
// MSbit indicates FPU operation valid
|
| 553 |
|
|
//
|
| 554 |
|
|
`define OR1200_FPUOP_WIDTH 8
|
| 555 |
|
|
// FPU unit from Usselman takes 5 cycles from decode, so 4 ex. cycles
|
| 556 |
|
|
`define OR1200_FPUOP_CYCLES 3'd4
|
| 557 |
|
|
// FP instruction is double precision if bit 4 is set. We're a 32-bit
|
| 558 |
|
|
// implementation thus do not support double precision FP
|
| 559 |
|
|
`define OR1200_FPUOP_DOUBLE_BIT 4
|
| 560 |
|
|
`define OR1200_FPUOP_ADD 8'b0000_0000
|
| 561 |
|
|
`define OR1200_FPUOP_SUB 8'b0000_0001
|
| 562 |
|
|
`define OR1200_FPUOP_MUL 8'b0000_0010
|
| 563 |
|
|
`define OR1200_FPUOP_DIV 8'b0000_0011
|
| 564 |
|
|
`define OR1200_FPUOP_ITOF 8'b0000_0100
|
| 565 |
|
|
`define OR1200_FPUOP_FTOI 8'b0000_0101
|
| 566 |
|
|
`define OR1200_FPUOP_REM 8'b0000_0110
|
| 567 |
|
|
`define OR1200_FPUOP_RESERVED 8'b0000_0111
|
| 568 |
|
|
// FP Compare instructions
|
| 569 |
|
|
`define OR1200_FPCOP_SFEQ 8'b0000_1000
|
| 570 |
|
|
`define OR1200_FPCOP_SFNE 8'b0000_1001
|
| 571 |
|
|
`define OR1200_FPCOP_SFGT 8'b0000_1010
|
| 572 |
|
|
`define OR1200_FPCOP_SFGE 8'b0000_1011
|
| 573 |
|
|
`define OR1200_FPCOP_SFLT 8'b0000_1100
|
| 574 |
|
|
`define OR1200_FPCOP_SFLE 8'b0000_1101
|
| 575 |
|
|
|
| 576 |
|
|
//
|
| 577 |
10 |
unneback |
// TAGs for instruction bus
|
| 578 |
|
|
//
|
| 579 |
|
|
`define OR1200_ITAG_IDLE 4'h0 // idle bus
|
| 580 |
|
|
`define OR1200_ITAG_NI 4'h1 // normal insn
|
| 581 |
|
|
`define OR1200_ITAG_BE 4'hb // Bus error exception
|
| 582 |
|
|
`define OR1200_ITAG_PE 4'hc // Page fault exception
|
| 583 |
|
|
`define OR1200_ITAG_TE 4'hd // TLB miss exception
|
| 584 |
|
|
|
| 585 |
|
|
//
|
| 586 |
|
|
// TAGs for data bus
|
| 587 |
|
|
//
|
| 588 |
|
|
`define OR1200_DTAG_IDLE 4'h0 // idle bus
|
| 589 |
|
|
`define OR1200_DTAG_ND 4'h1 // normal data
|
| 590 |
|
|
`define OR1200_DTAG_AE 4'ha // Alignment exception
|
| 591 |
|
|
`define OR1200_DTAG_BE 4'hb // Bus error exception
|
| 592 |
|
|
`define OR1200_DTAG_PE 4'hc // Page fault exception
|
| 593 |
|
|
`define OR1200_DTAG_TE 4'hd // TLB miss exception
|
| 594 |
|
|
|
| 595 |
|
|
|
| 596 |
|
|
//////////////////////////////////////////////
|
| 597 |
|
|
//
|
| 598 |
|
|
// ORBIS32 ISA specifics
|
| 599 |
|
|
//
|
| 600 |
|
|
|
| 601 |
|
|
// SHROT_OP position in machine word
|
| 602 |
|
|
`define OR1200_SHROTOP_POS 7:6
|
| 603 |
|
|
|
| 604 |
|
|
// ALU instructions multicycle field in machine word
|
| 605 |
|
|
`define OR1200_ALUMCYC_POS 9:8
|
| 606 |
|
|
|
| 607 |
|
|
//
|
| 608 |
|
|
// Instruction opcode groups (basic)
|
| 609 |
|
|
//
|
| 610 |
|
|
`define OR1200_OR32_J 6'b000000
|
| 611 |
|
|
`define OR1200_OR32_JAL 6'b000001
|
| 612 |
|
|
`define OR1200_OR32_BNF 6'b000011
|
| 613 |
|
|
`define OR1200_OR32_BF 6'b000100
|
| 614 |
|
|
`define OR1200_OR32_NOP 6'b000101
|
| 615 |
|
|
`define OR1200_OR32_MOVHI 6'b000110
|
| 616 |
|
|
`define OR1200_OR32_XSYNC 6'b001000
|
| 617 |
|
|
`define OR1200_OR32_RFE 6'b001001
|
| 618 |
|
|
/* */
|
| 619 |
|
|
`define OR1200_OR32_JR 6'b010001
|
| 620 |
|
|
`define OR1200_OR32_JALR 6'b010010
|
| 621 |
|
|
`define OR1200_OR32_MACI 6'b010011
|
| 622 |
|
|
/* */
|
| 623 |
|
|
`define OR1200_OR32_LWZ 6'b100001
|
| 624 |
|
|
`define OR1200_OR32_LBZ 6'b100011
|
| 625 |
|
|
`define OR1200_OR32_LBS 6'b100100
|
| 626 |
|
|
`define OR1200_OR32_LHZ 6'b100101
|
| 627 |
|
|
`define OR1200_OR32_LHS 6'b100110
|
| 628 |
|
|
`define OR1200_OR32_ADDI 6'b100111
|
| 629 |
|
|
`define OR1200_OR32_ADDIC 6'b101000
|
| 630 |
|
|
`define OR1200_OR32_ANDI 6'b101001
|
| 631 |
|
|
`define OR1200_OR32_ORI 6'b101010
|
| 632 |
|
|
`define OR1200_OR32_XORI 6'b101011
|
| 633 |
|
|
`define OR1200_OR32_MULI 6'b101100
|
| 634 |
|
|
`define OR1200_OR32_MFSPR 6'b101101
|
| 635 |
|
|
`define OR1200_OR32_SH_ROTI 6'b101110
|
| 636 |
|
|
`define OR1200_OR32_SFXXI 6'b101111
|
| 637 |
|
|
/* */
|
| 638 |
|
|
`define OR1200_OR32_MTSPR 6'b110000
|
| 639 |
|
|
`define OR1200_OR32_MACMSB 6'b110001
|
| 640 |
185 |
julius |
`define OR1200_OR32_FLOAT 6'b110010
|
| 641 |
10 |
unneback |
/* */
|
| 642 |
|
|
`define OR1200_OR32_SW 6'b110101
|
| 643 |
|
|
`define OR1200_OR32_SB 6'b110110
|
| 644 |
|
|
`define OR1200_OR32_SH 6'b110111
|
| 645 |
|
|
`define OR1200_OR32_ALU 6'b111000
|
| 646 |
|
|
`define OR1200_OR32_SFXX 6'b111001
|
| 647 |
|
|
//`define OR1200_OR32_CUST5 6'b111100
|
| 648 |
|
|
|
| 649 |
|
|
|
| 650 |
|
|
/////////////////////////////////////////////////////
|
| 651 |
|
|
//
|
| 652 |
|
|
// Exceptions
|
| 653 |
|
|
//
|
| 654 |
|
|
|
| 655 |
|
|
//
|
| 656 |
|
|
// Exception vectors per OR1K architecture:
|
| 657 |
|
|
// 0xPPPPP100 - reset
|
| 658 |
|
|
// 0xPPPPP200 - bus error
|
| 659 |
|
|
// ... etc
|
| 660 |
|
|
// where P represents exception prefix.
|
| 661 |
|
|
//
|
| 662 |
|
|
// Exception vectors can be customized as per
|
| 663 |
|
|
// the following formula:
|
| 664 |
|
|
// 0xPPPPPNVV - exception N
|
| 665 |
|
|
//
|
| 666 |
|
|
// P represents exception prefix
|
| 667 |
|
|
// N represents exception N
|
| 668 |
|
|
// VV represents length of the individual vector space,
|
| 669 |
|
|
// usually it is 8 bits wide and starts with all bits zero
|
| 670 |
|
|
//
|
| 671 |
|
|
|
| 672 |
|
|
//
|
| 673 |
|
|
// PPPPP and VV parts
|
| 674 |
|
|
//
|
| 675 |
|
|
// Sum of these two defines needs to be 28
|
| 676 |
|
|
//
|
| 677 |
141 |
marcus.erl |
`define OR1200_EXCEPT_EPH0_P 20'h00000
|
| 678 |
|
|
`define OR1200_EXCEPT_EPH1_P 20'hF0000
|
| 679 |
|
|
`define OR1200_EXCEPT_V 8'h00
|
| 680 |
10 |
unneback |
|
| 681 |
|
|
//
|
| 682 |
|
|
// N part width
|
| 683 |
|
|
//
|
| 684 |
|
|
`define OR1200_EXCEPT_WIDTH 4
|
| 685 |
|
|
|
| 686 |
|
|
//
|
| 687 |
|
|
// Definition of exception vectors
|
| 688 |
|
|
//
|
| 689 |
|
|
// To avoid implementation of a certain exception,
|
| 690 |
|
|
// simply comment out corresponding line
|
| 691 |
|
|
//
|
| 692 |
|
|
`define OR1200_EXCEPT_UNUSED `OR1200_EXCEPT_WIDTH'hf
|
| 693 |
|
|
`define OR1200_EXCEPT_TRAP `OR1200_EXCEPT_WIDTH'he
|
| 694 |
185 |
julius |
`define OR1200_EXCEPT_FLOAT `OR1200_EXCEPT_WIDTH'hd
|
| 695 |
10 |
unneback |
`define OR1200_EXCEPT_SYSCALL `OR1200_EXCEPT_WIDTH'hc
|
| 696 |
|
|
`define OR1200_EXCEPT_RANGE `OR1200_EXCEPT_WIDTH'hb
|
| 697 |
|
|
`define OR1200_EXCEPT_ITLBMISS `OR1200_EXCEPT_WIDTH'ha
|
| 698 |
|
|
`define OR1200_EXCEPT_DTLBMISS `OR1200_EXCEPT_WIDTH'h9
|
| 699 |
|
|
`define OR1200_EXCEPT_INT `OR1200_EXCEPT_WIDTH'h8
|
| 700 |
|
|
`define OR1200_EXCEPT_ILLEGAL `OR1200_EXCEPT_WIDTH'h7
|
| 701 |
|
|
`define OR1200_EXCEPT_ALIGN `OR1200_EXCEPT_WIDTH'h6
|
| 702 |
|
|
`define OR1200_EXCEPT_TICK `OR1200_EXCEPT_WIDTH'h5
|
| 703 |
|
|
`define OR1200_EXCEPT_IPF `OR1200_EXCEPT_WIDTH'h4
|
| 704 |
|
|
`define OR1200_EXCEPT_DPF `OR1200_EXCEPT_WIDTH'h3
|
| 705 |
|
|
`define OR1200_EXCEPT_BUSERR `OR1200_EXCEPT_WIDTH'h2
|
| 706 |
|
|
`define OR1200_EXCEPT_RESET `OR1200_EXCEPT_WIDTH'h1
|
| 707 |
|
|
`define OR1200_EXCEPT_NONE `OR1200_EXCEPT_WIDTH'h0
|
| 708 |
|
|
|
| 709 |
|
|
|
| 710 |
|
|
/////////////////////////////////////////////////////
|
| 711 |
|
|
//
|
| 712 |
|
|
// SPR groups
|
| 713 |
|
|
//
|
| 714 |
|
|
|
| 715 |
|
|
// Bits that define the group
|
| 716 |
|
|
`define OR1200_SPR_GROUP_BITS 15:11
|
| 717 |
|
|
|
| 718 |
|
|
// Width of the group bits
|
| 719 |
|
|
`define OR1200_SPR_GROUP_WIDTH 5
|
| 720 |
|
|
|
| 721 |
|
|
// Bits that define offset inside the group
|
| 722 |
|
|
`define OR1200_SPR_OFS_BITS 10:0
|
| 723 |
|
|
|
| 724 |
|
|
// List of groups
|
| 725 |
|
|
`define OR1200_SPR_GROUP_SYS 5'd00
|
| 726 |
|
|
`define OR1200_SPR_GROUP_DMMU 5'd01
|
| 727 |
|
|
`define OR1200_SPR_GROUP_IMMU 5'd02
|
| 728 |
|
|
`define OR1200_SPR_GROUP_DC 5'd03
|
| 729 |
|
|
`define OR1200_SPR_GROUP_IC 5'd04
|
| 730 |
|
|
`define OR1200_SPR_GROUP_MAC 5'd05
|
| 731 |
|
|
`define OR1200_SPR_GROUP_DU 5'd06
|
| 732 |
|
|
`define OR1200_SPR_GROUP_PM 5'd08
|
| 733 |
|
|
`define OR1200_SPR_GROUP_PIC 5'd09
|
| 734 |
|
|
`define OR1200_SPR_GROUP_TT 5'd10
|
| 735 |
185 |
julius |
`define OR1200_SPR_GROUP_FPU 5'd11
|
| 736 |
10 |
unneback |
|
| 737 |
|
|
/////////////////////////////////////////////////////
|
| 738 |
|
|
//
|
| 739 |
|
|
// System group
|
| 740 |
|
|
//
|
| 741 |
|
|
|
| 742 |
|
|
//
|
| 743 |
|
|
// System registers
|
| 744 |
|
|
//
|
| 745 |
|
|
`define OR1200_SPR_CFGR 7'd0
|
| 746 |
|
|
`define OR1200_SPR_RF 6'd32 // 1024 >> 5
|
| 747 |
|
|
`define OR1200_SPR_NPC 11'd16
|
| 748 |
|
|
`define OR1200_SPR_SR 11'd17
|
| 749 |
|
|
`define OR1200_SPR_PPC 11'd18
|
| 750 |
185 |
julius |
`define OR1200_SPR_FPCSR 11'd20
|
| 751 |
10 |
unneback |
`define OR1200_SPR_EPCR 11'd32
|
| 752 |
|
|
`define OR1200_SPR_EEAR 11'd48
|
| 753 |
|
|
`define OR1200_SPR_ESR 11'd64
|
| 754 |
|
|
|
| 755 |
|
|
//
|
| 756 |
|
|
// SR bits
|
| 757 |
|
|
//
|
| 758 |
141 |
marcus.erl |
`define OR1200_SR_WIDTH 17
|
| 759 |
10 |
unneback |
`define OR1200_SR_SM 0
|
| 760 |
|
|
`define OR1200_SR_TEE 1
|
| 761 |
|
|
`define OR1200_SR_IEE 2
|
| 762 |
|
|
`define OR1200_SR_DCE 3
|
| 763 |
|
|
`define OR1200_SR_ICE 4
|
| 764 |
|
|
`define OR1200_SR_DME 5
|
| 765 |
|
|
`define OR1200_SR_IME 6
|
| 766 |
|
|
`define OR1200_SR_LEE 7
|
| 767 |
|
|
`define OR1200_SR_CE 8
|
| 768 |
|
|
`define OR1200_SR_F 9
|
| 769 |
|
|
`define OR1200_SR_CY 10 // Unused
|
| 770 |
|
|
`define OR1200_SR_OV 11 // Unused
|
| 771 |
|
|
`define OR1200_SR_OVE 12 // Unused
|
| 772 |
|
|
`define OR1200_SR_DSX 13 // Unused
|
| 773 |
|
|
`define OR1200_SR_EPH 14
|
| 774 |
|
|
`define OR1200_SR_FO 15
|
| 775 |
141 |
marcus.erl |
`define OR1200_SR_TED 16
|
| 776 |
10 |
unneback |
`define OR1200_SR_CID 31:28 // Unimplemented
|
| 777 |
|
|
|
| 778 |
|
|
//
|
| 779 |
|
|
// Bits that define offset inside the group
|
| 780 |
|
|
//
|
| 781 |
|
|
`define OR1200_SPROFS_BITS 10:0
|
| 782 |
|
|
|
| 783 |
|
|
//
|
| 784 |
|
|
// Default Exception Prefix
|
| 785 |
|
|
//
|
| 786 |
|
|
// 1'b0 - OR1200_EXCEPT_EPH0_P (0x0000_0000)
|
| 787 |
|
|
// 1'b1 - OR1200_EXCEPT_EPH1_P (0xF000_0000)
|
| 788 |
|
|
//
|
| 789 |
|
|
`define OR1200_SR_EPH_DEF 1'b0
|
| 790 |
|
|
|
| 791 |
185 |
julius |
|
| 792 |
|
|
//
|
| 793 |
|
|
// FPCSR bits
|
| 794 |
|
|
//
|
| 795 |
|
|
`define OR1200_FPCSR_WIDTH 12
|
| 796 |
|
|
`define OR1200_FPCSR_FPEE 0
|
| 797 |
|
|
`define OR1200_FPCSR_RM 2:1
|
| 798 |
|
|
`define OR1200_FPCSR_OVF 3
|
| 799 |
|
|
`define OR1200_FPCSR_UNF 4
|
| 800 |
|
|
`define OR1200_FPCSR_SNF 5
|
| 801 |
|
|
`define OR1200_FPCSR_QNF 6
|
| 802 |
|
|
`define OR1200_FPCSR_ZF 7
|
| 803 |
|
|
`define OR1200_FPCSR_IXF 8
|
| 804 |
|
|
`define OR1200_FPCSR_IVF 9
|
| 805 |
|
|
`define OR1200_FPCSR_INF 10
|
| 806 |
|
|
`define OR1200_FPCSR_DZF 11
|
| 807 |
|
|
`define OR1200_FPCSR_RES 31:12
|
| 808 |
|
|
|
| 809 |
10 |
unneback |
/////////////////////////////////////////////////////
|
| 810 |
|
|
//
|
| 811 |
|
|
// Power Management (PM)
|
| 812 |
|
|
//
|
| 813 |
|
|
|
| 814 |
|
|
// Define it if you want PM implemented
|
| 815 |
141 |
marcus.erl |
//`define OR1200_PM_IMPLEMENTED
|
| 816 |
10 |
unneback |
|
| 817 |
|
|
// Bit positions inside PMR (don't change)
|
| 818 |
|
|
`define OR1200_PM_PMR_SDF 3:0
|
| 819 |
|
|
`define OR1200_PM_PMR_DME 4
|
| 820 |
|
|
`define OR1200_PM_PMR_SME 5
|
| 821 |
|
|
`define OR1200_PM_PMR_DCGE 6
|
| 822 |
|
|
`define OR1200_PM_PMR_UNUSED 31:7
|
| 823 |
|
|
|
| 824 |
|
|
// PMR offset inside PM group of registers
|
| 825 |
|
|
`define OR1200_PM_OFS_PMR 11'b0
|
| 826 |
|
|
|
| 827 |
|
|
// PM group
|
| 828 |
|
|
`define OR1200_SPRGRP_PM 5'd8
|
| 829 |
|
|
|
| 830 |
|
|
// Define if PMR can be read/written at any address inside PM group
|
| 831 |
|
|
`define OR1200_PM_PARTIAL_DECODING
|
| 832 |
|
|
|
| 833 |
|
|
// Define if reading PMR is allowed
|
| 834 |
|
|
`define OR1200_PM_READREGS
|
| 835 |
|
|
|
| 836 |
|
|
// Define if unused PMR bits should be zero
|
| 837 |
|
|
`define OR1200_PM_UNUSED_ZERO
|
| 838 |
|
|
|
| 839 |
|
|
|
| 840 |
|
|
/////////////////////////////////////////////////////
|
| 841 |
|
|
//
|
| 842 |
|
|
// Debug Unit (DU)
|
| 843 |
|
|
//
|
| 844 |
|
|
|
| 845 |
|
|
// Define it if you want DU implemented
|
| 846 |
|
|
`define OR1200_DU_IMPLEMENTED
|
| 847 |
|
|
|
| 848 |
|
|
//
|
| 849 |
|
|
// Define if you want HW Breakpoints
|
| 850 |
|
|
// (if HW breakpoints are not implemented
|
| 851 |
|
|
// only default software trapping is
|
| 852 |
|
|
// possible with l.trap insn - this is
|
| 853 |
|
|
// however already enough for use
|
| 854 |
|
|
// with or32 gdb)
|
| 855 |
|
|
//
|
| 856 |
|
|
//`define OR1200_DU_HWBKPTS
|
| 857 |
|
|
|
| 858 |
|
|
// Number of DVR/DCR pairs if HW breakpoints enabled
|
| 859 |
141 |
marcus.erl |
// Comment / uncomment DU_DVRn / DU_DCRn pairs bellow according to this number !
|
| 860 |
|
|
// DU_DVR0..DU_DVR7 should be uncommented for 8 DU_DVRDCR_PAIRS
|
| 861 |
10 |
unneback |
`define OR1200_DU_DVRDCR_PAIRS 8
|
| 862 |
|
|
|
| 863 |
|
|
// Define if you want trace buffer
|
| 864 |
141 |
marcus.erl |
// (for now only available for Xilinx Virtex FPGAs)
|
| 865 |
10 |
unneback |
//`define OR1200_DU_TB_IMPLEMENTED
|
| 866 |
|
|
|
| 867 |
141 |
marcus.erl |
|
| 868 |
10 |
unneback |
//
|
| 869 |
|
|
// Address offsets of DU registers inside DU group
|
| 870 |
|
|
//
|
| 871 |
|
|
// To not implement a register, doq not define its address
|
| 872 |
|
|
//
|
| 873 |
|
|
`ifdef OR1200_DU_HWBKPTS
|
| 874 |
|
|
`define OR1200_DU_DVR0 11'd0
|
| 875 |
|
|
`define OR1200_DU_DVR1 11'd1
|
| 876 |
|
|
`define OR1200_DU_DVR2 11'd2
|
| 877 |
|
|
`define OR1200_DU_DVR3 11'd3
|
| 878 |
|
|
`define OR1200_DU_DVR4 11'd4
|
| 879 |
|
|
`define OR1200_DU_DVR5 11'd5
|
| 880 |
|
|
`define OR1200_DU_DVR6 11'd6
|
| 881 |
|
|
`define OR1200_DU_DVR7 11'd7
|
| 882 |
|
|
`define OR1200_DU_DCR0 11'd8
|
| 883 |
|
|
`define OR1200_DU_DCR1 11'd9
|
| 884 |
|
|
`define OR1200_DU_DCR2 11'd10
|
| 885 |
|
|
`define OR1200_DU_DCR3 11'd11
|
| 886 |
|
|
`define OR1200_DU_DCR4 11'd12
|
| 887 |
|
|
`define OR1200_DU_DCR5 11'd13
|
| 888 |
|
|
`define OR1200_DU_DCR6 11'd14
|
| 889 |
|
|
`define OR1200_DU_DCR7 11'd15
|
| 890 |
|
|
`endif
|
| 891 |
|
|
`define OR1200_DU_DMR1 11'd16
|
| 892 |
|
|
`ifdef OR1200_DU_HWBKPTS
|
| 893 |
|
|
`define OR1200_DU_DMR2 11'd17
|
| 894 |
|
|
`define OR1200_DU_DWCR0 11'd18
|
| 895 |
|
|
`define OR1200_DU_DWCR1 11'd19
|
| 896 |
|
|
`endif
|
| 897 |
|
|
`define OR1200_DU_DSR 11'd20
|
| 898 |
|
|
`define OR1200_DU_DRR 11'd21
|
| 899 |
|
|
`ifdef OR1200_DU_TB_IMPLEMENTED
|
| 900 |
|
|
`define OR1200_DU_TBADR 11'h0ff
|
| 901 |
|
|
`define OR1200_DU_TBIA 11'h1xx
|
| 902 |
|
|
`define OR1200_DU_TBIM 11'h2xx
|
| 903 |
|
|
`define OR1200_DU_TBAR 11'h3xx
|
| 904 |
|
|
`define OR1200_DU_TBTS 11'h4xx
|
| 905 |
|
|
`endif
|
| 906 |
|
|
|
| 907 |
|
|
// Position of offset bits inside SPR address
|
| 908 |
|
|
`define OR1200_DUOFS_BITS 10:0
|
| 909 |
|
|
|
| 910 |
|
|
// DCR bits
|
| 911 |
|
|
`define OR1200_DU_DCR_DP 0
|
| 912 |
|
|
`define OR1200_DU_DCR_CC 3:1
|
| 913 |
|
|
`define OR1200_DU_DCR_SC 4
|
| 914 |
|
|
`define OR1200_DU_DCR_CT 7:5
|
| 915 |
|
|
|
| 916 |
|
|
// DMR1 bits
|
| 917 |
|
|
`define OR1200_DU_DMR1_CW0 1:0
|
| 918 |
|
|
`define OR1200_DU_DMR1_CW1 3:2
|
| 919 |
|
|
`define OR1200_DU_DMR1_CW2 5:4
|
| 920 |
|
|
`define OR1200_DU_DMR1_CW3 7:6
|
| 921 |
|
|
`define OR1200_DU_DMR1_CW4 9:8
|
| 922 |
|
|
`define OR1200_DU_DMR1_CW5 11:10
|
| 923 |
|
|
`define OR1200_DU_DMR1_CW6 13:12
|
| 924 |
|
|
`define OR1200_DU_DMR1_CW7 15:14
|
| 925 |
|
|
`define OR1200_DU_DMR1_CW8 17:16
|
| 926 |
|
|
`define OR1200_DU_DMR1_CW9 19:18
|
| 927 |
|
|
`define OR1200_DU_DMR1_CW10 21:20
|
| 928 |
|
|
`define OR1200_DU_DMR1_ST 22
|
| 929 |
|
|
`define OR1200_DU_DMR1_BT 23
|
| 930 |
|
|
`define OR1200_DU_DMR1_DXFW 24
|
| 931 |
|
|
`define OR1200_DU_DMR1_ETE 25
|
| 932 |
|
|
|
| 933 |
|
|
// DMR2 bits
|
| 934 |
|
|
`define OR1200_DU_DMR2_WCE0 0
|
| 935 |
|
|
`define OR1200_DU_DMR2_WCE1 1
|
| 936 |
|
|
`define OR1200_DU_DMR2_AWTC 12:2
|
| 937 |
|
|
`define OR1200_DU_DMR2_WGB 23:13
|
| 938 |
|
|
|
| 939 |
|
|
// DWCR bits
|
| 940 |
|
|
`define OR1200_DU_DWCR_COUNT 15:0
|
| 941 |
|
|
`define OR1200_DU_DWCR_MATCH 31:16
|
| 942 |
|
|
|
| 943 |
|
|
// DSR bits
|
| 944 |
|
|
`define OR1200_DU_DSR_WIDTH 14
|
| 945 |
|
|
`define OR1200_DU_DSR_RSTE 0
|
| 946 |
|
|
`define OR1200_DU_DSR_BUSEE 1
|
| 947 |
|
|
`define OR1200_DU_DSR_DPFE 2
|
| 948 |
|
|
`define OR1200_DU_DSR_IPFE 3
|
| 949 |
|
|
`define OR1200_DU_DSR_TTE 4
|
| 950 |
|
|
`define OR1200_DU_DSR_AE 5
|
| 951 |
|
|
`define OR1200_DU_DSR_IIE 6
|
| 952 |
|
|
`define OR1200_DU_DSR_IE 7
|
| 953 |
|
|
`define OR1200_DU_DSR_DME 8
|
| 954 |
|
|
`define OR1200_DU_DSR_IME 9
|
| 955 |
|
|
`define OR1200_DU_DSR_RE 10
|
| 956 |
|
|
`define OR1200_DU_DSR_SCE 11
|
| 957 |
185 |
julius |
`define OR1200_DU_DSR_FPE 12
|
| 958 |
10 |
unneback |
`define OR1200_DU_DSR_TE 13
|
| 959 |
|
|
|
| 960 |
|
|
// DRR bits
|
| 961 |
|
|
`define OR1200_DU_DRR_RSTE 0
|
| 962 |
|
|
`define OR1200_DU_DRR_BUSEE 1
|
| 963 |
|
|
`define OR1200_DU_DRR_DPFE 2
|
| 964 |
|
|
`define OR1200_DU_DRR_IPFE 3
|
| 965 |
|
|
`define OR1200_DU_DRR_TTE 4
|
| 966 |
|
|
`define OR1200_DU_DRR_AE 5
|
| 967 |
|
|
`define OR1200_DU_DRR_IIE 6
|
| 968 |
|
|
`define OR1200_DU_DRR_IE 7
|
| 969 |
|
|
`define OR1200_DU_DRR_DME 8
|
| 970 |
|
|
`define OR1200_DU_DRR_IME 9
|
| 971 |
|
|
`define OR1200_DU_DRR_RE 10
|
| 972 |
|
|
`define OR1200_DU_DRR_SCE 11
|
| 973 |
185 |
julius |
`define OR1200_DU_DRR_FPE 12
|
| 974 |
10 |
unneback |
`define OR1200_DU_DRR_TE 13
|
| 975 |
|
|
|
| 976 |
|
|
// Define if reading DU regs is allowed
|
| 977 |
|
|
`define OR1200_DU_READREGS
|
| 978 |
|
|
|
| 979 |
|
|
// Define if unused DU registers bits should be zero
|
| 980 |
|
|
`define OR1200_DU_UNUSED_ZERO
|
| 981 |
|
|
|
| 982 |
|
|
// Define if IF/LSU status is not needed by devel i/f
|
| 983 |
|
|
`define OR1200_DU_STATUS_UNIMPLEMENTED
|
| 984 |
|
|
|
| 985 |
|
|
/////////////////////////////////////////////////////
|
| 986 |
|
|
//
|
| 987 |
|
|
// Programmable Interrupt Controller (PIC)
|
| 988 |
|
|
//
|
| 989 |
|
|
|
| 990 |
|
|
// Define it if you want PIC implemented
|
| 991 |
|
|
`define OR1200_PIC_IMPLEMENTED
|
| 992 |
|
|
|
| 993 |
|
|
// Define number of interrupt inputs (2-31)
|
| 994 |
141 |
marcus.erl |
`define OR1200_PIC_INTS 31
|
| 995 |
10 |
unneback |
|
| 996 |
|
|
// Address offsets of PIC registers inside PIC group
|
| 997 |
|
|
`define OR1200_PIC_OFS_PICMR 2'd0
|
| 998 |
|
|
`define OR1200_PIC_OFS_PICSR 2'd2
|
| 999 |
|
|
|
| 1000 |
|
|
// Position of offset bits inside SPR address
|
| 1001 |
|
|
`define OR1200_PICOFS_BITS 1:0
|
| 1002 |
|
|
|
| 1003 |
|
|
// Define if you want these PIC registers to be implemented
|
| 1004 |
|
|
`define OR1200_PIC_PICMR
|
| 1005 |
|
|
`define OR1200_PIC_PICSR
|
| 1006 |
|
|
|
| 1007 |
|
|
// Define if reading PIC registers is allowed
|
| 1008 |
|
|
`define OR1200_PIC_READREGS
|
| 1009 |
|
|
|
| 1010 |
|
|
// Define if unused PIC register bits should be zero
|
| 1011 |
|
|
`define OR1200_PIC_UNUSED_ZERO
|
| 1012 |
|
|
|
| 1013 |
|
|
|
| 1014 |
|
|
/////////////////////////////////////////////////////
|
| 1015 |
|
|
//
|
| 1016 |
|
|
// Tick Timer (TT)
|
| 1017 |
|
|
//
|
| 1018 |
|
|
|
| 1019 |
|
|
// Define it if you want TT implemented
|
| 1020 |
|
|
`define OR1200_TT_IMPLEMENTED
|
| 1021 |
|
|
|
| 1022 |
|
|
// Address offsets of TT registers inside TT group
|
| 1023 |
|
|
`define OR1200_TT_OFS_TTMR 1'd0
|
| 1024 |
|
|
`define OR1200_TT_OFS_TTCR 1'd1
|
| 1025 |
|
|
|
| 1026 |
|
|
// Position of offset bits inside SPR group
|
| 1027 |
|
|
`define OR1200_TTOFS_BITS 0
|
| 1028 |
|
|
|
| 1029 |
|
|
// Define if you want these TT registers to be implemented
|
| 1030 |
|
|
`define OR1200_TT_TTMR
|
| 1031 |
|
|
`define OR1200_TT_TTCR
|
| 1032 |
|
|
|
| 1033 |
|
|
// TTMR bits
|
| 1034 |
|
|
`define OR1200_TT_TTMR_TP 27:0
|
| 1035 |
|
|
`define OR1200_TT_TTMR_IP 28
|
| 1036 |
|
|
`define OR1200_TT_TTMR_IE 29
|
| 1037 |
|
|
`define OR1200_TT_TTMR_M 31:30
|
| 1038 |
|
|
|
| 1039 |
|
|
// Define if reading TT registers is allowed
|
| 1040 |
|
|
`define OR1200_TT_READREGS
|
| 1041 |
|
|
|
| 1042 |
|
|
|
| 1043 |
|
|
//////////////////////////////////////////////
|
| 1044 |
|
|
//
|
| 1045 |
|
|
// MAC
|
| 1046 |
|
|
//
|
| 1047 |
|
|
`define OR1200_MAC_ADDR 0 // MACLO 0xxxxxxxx1, MACHI 0xxxxxxxx0
|
| 1048 |
|
|
`define OR1200_MAC_SPR_WE // Define if MACLO/MACHI are SPR writable
|
| 1049 |
|
|
|
| 1050 |
|
|
//
|
| 1051 |
|
|
// Shift {MACHI,MACLO} into destination register when executing l.macrc
|
| 1052 |
|
|
//
|
| 1053 |
|
|
// According to architecture manual there is no shift, so default value is 0.
|
| 1054 |
|
|
//
|
| 1055 |
|
|
// However the implementation has deviated in this from the arch manual and had hard coded shift by 28 bits which
|
| 1056 |
|
|
// is a useful optimization for MP3 decoding (if using libmad fixed point library). Shifts are no longer
|
| 1057 |
|
|
// default setup, but if you need to remain backward compatible, define your shift bits, which were normally
|
| 1058 |
|
|
// dest_GPR = {MACHI,MACLO}[59:28]
|
| 1059 |
|
|
`define OR1200_MAC_SHIFTBY 0 // 0 = According to arch manual, 28 = obsolete backward compatibility
|
| 1060 |
|
|
|
| 1061 |
|
|
|
| 1062 |
|
|
//////////////////////////////////////////////
|
| 1063 |
|
|
//
|
| 1064 |
|
|
// Data MMU (DMMU)
|
| 1065 |
|
|
//
|
| 1066 |
|
|
|
| 1067 |
|
|
//
|
| 1068 |
|
|
// Address that selects between TLB TR and MR
|
| 1069 |
|
|
//
|
| 1070 |
|
|
`define OR1200_DTLB_TM_ADDR 7
|
| 1071 |
|
|
|
| 1072 |
|
|
//
|
| 1073 |
|
|
// DTLBMR fields
|
| 1074 |
|
|
//
|
| 1075 |
|
|
`define OR1200_DTLBMR_V_BITS 0
|
| 1076 |
|
|
`define OR1200_DTLBMR_CID_BITS 4:1
|
| 1077 |
|
|
`define OR1200_DTLBMR_RES_BITS 11:5
|
| 1078 |
|
|
`define OR1200_DTLBMR_VPN_BITS 31:13
|
| 1079 |
|
|
|
| 1080 |
|
|
//
|
| 1081 |
|
|
// DTLBTR fields
|
| 1082 |
|
|
//
|
| 1083 |
|
|
`define OR1200_DTLBTR_CC_BITS 0
|
| 1084 |
|
|
`define OR1200_DTLBTR_CI_BITS 1
|
| 1085 |
|
|
`define OR1200_DTLBTR_WBC_BITS 2
|
| 1086 |
|
|
`define OR1200_DTLBTR_WOM_BITS 3
|
| 1087 |
|
|
`define OR1200_DTLBTR_A_BITS 4
|
| 1088 |
|
|
`define OR1200_DTLBTR_D_BITS 5
|
| 1089 |
|
|
`define OR1200_DTLBTR_URE_BITS 6
|
| 1090 |
|
|
`define OR1200_DTLBTR_UWE_BITS 7
|
| 1091 |
|
|
`define OR1200_DTLBTR_SRE_BITS 8
|
| 1092 |
|
|
`define OR1200_DTLBTR_SWE_BITS 9
|
| 1093 |
|
|
`define OR1200_DTLBTR_RES_BITS 11:10
|
| 1094 |
|
|
`define OR1200_DTLBTR_PPN_BITS 31:13
|
| 1095 |
|
|
|
| 1096 |
|
|
//
|
| 1097 |
|
|
// DTLB configuration
|
| 1098 |
|
|
//
|
| 1099 |
|
|
`define OR1200_DMMU_PS 13 // 13 for 8KB page size
|
| 1100 |
|
|
`define OR1200_DTLB_INDXW 6 // 6 for 64 entry DTLB 7 for 128 entries
|
| 1101 |
|
|
`define OR1200_DTLB_INDXL `OR1200_DMMU_PS // 13 13
|
| 1102 |
|
|
`define OR1200_DTLB_INDXH `OR1200_DMMU_PS+`OR1200_DTLB_INDXW-1 // 18 19
|
| 1103 |
|
|
`define OR1200_DTLB_INDX `OR1200_DTLB_INDXH:`OR1200_DTLB_INDXL // 18:13 19:13
|
| 1104 |
|
|
`define OR1200_DTLB_TAGW 32-`OR1200_DTLB_INDXW-`OR1200_DMMU_PS // 13 12
|
| 1105 |
|
|
`define OR1200_DTLB_TAGL `OR1200_DTLB_INDXH+1 // 19 20
|
| 1106 |
|
|
`define OR1200_DTLB_TAG 31:`OR1200_DTLB_TAGL // 31:19 31:20
|
| 1107 |
|
|
`define OR1200_DTLBMRW `OR1200_DTLB_TAGW+1 // +1 because of V bit
|
| 1108 |
|
|
`define OR1200_DTLBTRW 32-`OR1200_DMMU_PS+5 // +5 because of protection bits and CI
|
| 1109 |
|
|
|
| 1110 |
|
|
//
|
| 1111 |
|
|
// Cache inhibit while DMMU is not enabled/implemented
|
| 1112 |
|
|
//
|
| 1113 |
|
|
// cache inhibited 0GB-4GB 1'b1
|
| 1114 |
|
|
// cache inhibited 0GB-2GB !dcpu_adr_i[31]
|
| 1115 |
|
|
// cache inhibited 0GB-1GB 2GB-3GB !dcpu_adr_i[30]
|
| 1116 |
|
|
// cache inhibited 1GB-2GB 3GB-4GB dcpu_adr_i[30]
|
| 1117 |
|
|
// cache inhibited 2GB-4GB (default) dcpu_adr_i[31]
|
| 1118 |
|
|
// cached 0GB-4GB 1'b0
|
| 1119 |
|
|
//
|
| 1120 |
|
|
`define OR1200_DMMU_CI dcpu_adr_i[31]
|
| 1121 |
|
|
|
| 1122 |
|
|
|
| 1123 |
|
|
//////////////////////////////////////////////
|
| 1124 |
|
|
//
|
| 1125 |
|
|
// Insn MMU (IMMU)
|
| 1126 |
|
|
//
|
| 1127 |
|
|
|
| 1128 |
|
|
//
|
| 1129 |
|
|
// Address that selects between TLB TR and MR
|
| 1130 |
|
|
//
|
| 1131 |
|
|
`define OR1200_ITLB_TM_ADDR 7
|
| 1132 |
|
|
|
| 1133 |
|
|
//
|
| 1134 |
|
|
// ITLBMR fields
|
| 1135 |
|
|
//
|
| 1136 |
|
|
`define OR1200_ITLBMR_V_BITS 0
|
| 1137 |
|
|
`define OR1200_ITLBMR_CID_BITS 4:1
|
| 1138 |
|
|
`define OR1200_ITLBMR_RES_BITS 11:5
|
| 1139 |
|
|
`define OR1200_ITLBMR_VPN_BITS 31:13
|
| 1140 |
|
|
|
| 1141 |
|
|
//
|
| 1142 |
|
|
// ITLBTR fields
|
| 1143 |
|
|
//
|
| 1144 |
|
|
`define OR1200_ITLBTR_CC_BITS 0
|
| 1145 |
|
|
`define OR1200_ITLBTR_CI_BITS 1
|
| 1146 |
|
|
`define OR1200_ITLBTR_WBC_BITS 2
|
| 1147 |
|
|
`define OR1200_ITLBTR_WOM_BITS 3
|
| 1148 |
|
|
`define OR1200_ITLBTR_A_BITS 4
|
| 1149 |
|
|
`define OR1200_ITLBTR_D_BITS 5
|
| 1150 |
|
|
`define OR1200_ITLBTR_SXE_BITS 6
|
| 1151 |
|
|
`define OR1200_ITLBTR_UXE_BITS 7
|
| 1152 |
|
|
`define OR1200_ITLBTR_RES_BITS 11:8
|
| 1153 |
|
|
`define OR1200_ITLBTR_PPN_BITS 31:13
|
| 1154 |
|
|
|
| 1155 |
|
|
//
|
| 1156 |
|
|
// ITLB configuration
|
| 1157 |
|
|
//
|
| 1158 |
|
|
`define OR1200_IMMU_PS 13 // 13 for 8KB page size
|
| 1159 |
|
|
`define OR1200_ITLB_INDXW 6 // 6 for 64 entry ITLB 7 for 128 entries
|
| 1160 |
|
|
`define OR1200_ITLB_INDXL `OR1200_IMMU_PS // 13 13
|
| 1161 |
|
|
`define OR1200_ITLB_INDXH `OR1200_IMMU_PS+`OR1200_ITLB_INDXW-1 // 18 19
|
| 1162 |
|
|
`define OR1200_ITLB_INDX `OR1200_ITLB_INDXH:`OR1200_ITLB_INDXL // 18:13 19:13
|
| 1163 |
|
|
`define OR1200_ITLB_TAGW 32-`OR1200_ITLB_INDXW-`OR1200_IMMU_PS // 13 12
|
| 1164 |
|
|
`define OR1200_ITLB_TAGL `OR1200_ITLB_INDXH+1 // 19 20
|
| 1165 |
|
|
`define OR1200_ITLB_TAG 31:`OR1200_ITLB_TAGL // 31:19 31:20
|
| 1166 |
|
|
`define OR1200_ITLBMRW `OR1200_ITLB_TAGW+1 // +1 because of V bit
|
| 1167 |
|
|
`define OR1200_ITLBTRW 32-`OR1200_IMMU_PS+3 // +3 because of protection bits and CI
|
| 1168 |
|
|
|
| 1169 |
|
|
//
|
| 1170 |
|
|
// Cache inhibit while IMMU is not enabled/implemented
|
| 1171 |
|
|
// Note: all combinations that use icpu_adr_i cause async loop
|
| 1172 |
|
|
//
|
| 1173 |
|
|
// cache inhibited 0GB-4GB 1'b1
|
| 1174 |
|
|
// cache inhibited 0GB-2GB !icpu_adr_i[31]
|
| 1175 |
|
|
// cache inhibited 0GB-1GB 2GB-3GB !icpu_adr_i[30]
|
| 1176 |
|
|
// cache inhibited 1GB-2GB 3GB-4GB icpu_adr_i[30]
|
| 1177 |
|
|
// cache inhibited 2GB-4GB (default) icpu_adr_i[31]
|
| 1178 |
|
|
// cached 0GB-4GB 1'b0
|
| 1179 |
|
|
//
|
| 1180 |
|
|
`define OR1200_IMMU_CI 1'b0
|
| 1181 |
|
|
|
| 1182 |
|
|
|
| 1183 |
|
|
/////////////////////////////////////////////////
|
| 1184 |
|
|
//
|
| 1185 |
|
|
// Insn cache (IC)
|
| 1186 |
|
|
//
|
| 1187 |
|
|
|
| 1188 |
|
|
// 3 for 8 bytes, 4 for 16 bytes etc
|
| 1189 |
|
|
`define OR1200_ICLS 4
|
| 1190 |
|
|
|
| 1191 |
|
|
//
|
| 1192 |
|
|
// IC configurations
|
| 1193 |
|
|
//
|
| 1194 |
|
|
`ifdef OR1200_IC_1W_512B
|
| 1195 |
|
|
`define OR1200_ICSIZE 9 // 512
|
| 1196 |
|
|
`define OR1200_ICINDX `OR1200_ICSIZE-2 // 7
|
| 1197 |
|
|
`define OR1200_ICINDXH `OR1200_ICSIZE-1 // 8
|
| 1198 |
|
|
`define OR1200_ICTAGL `OR1200_ICINDXH+1 // 9
|
| 1199 |
|
|
`define OR1200_ICTAG `OR1200_ICSIZE-`OR1200_ICLS // 5
|
| 1200 |
|
|
`define OR1200_ICTAG_W 24
|
| 1201 |
|
|
`endif
|
| 1202 |
|
|
`ifdef OR1200_IC_1W_4KB
|
| 1203 |
|
|
`define OR1200_ICSIZE 12 // 4096
|
| 1204 |
|
|
`define OR1200_ICINDX `OR1200_ICSIZE-2 // 10
|
| 1205 |
|
|
`define OR1200_ICINDXH `OR1200_ICSIZE-1 // 11
|
| 1206 |
|
|
`define OR1200_ICTAGL `OR1200_ICINDXH+1 // 12
|
| 1207 |
|
|
`define OR1200_ICTAG `OR1200_ICSIZE-`OR1200_ICLS // 8
|
| 1208 |
|
|
`define OR1200_ICTAG_W 21
|
| 1209 |
|
|
`endif
|
| 1210 |
|
|
`ifdef OR1200_IC_1W_8KB
|
| 1211 |
|
|
`define OR1200_ICSIZE 13 // 8192
|
| 1212 |
|
|
`define OR1200_ICINDX `OR1200_ICSIZE-2 // 11
|
| 1213 |
|
|
`define OR1200_ICINDXH `OR1200_ICSIZE-1 // 12
|
| 1214 |
|
|
`define OR1200_ICTAGL `OR1200_ICINDXH+1 // 13
|
| 1215 |
|
|
`define OR1200_ICTAG `OR1200_ICSIZE-`OR1200_ICLS // 9
|
| 1216 |
|
|
`define OR1200_ICTAG_W 20
|
| 1217 |
|
|
`endif
|
| 1218 |
|
|
|
| 1219 |
|
|
|
| 1220 |
|
|
/////////////////////////////////////////////////
|
| 1221 |
|
|
//
|
| 1222 |
|
|
// Data cache (DC)
|
| 1223 |
|
|
//
|
| 1224 |
|
|
|
| 1225 |
|
|
// 3 for 8 bytes, 4 for 16 bytes etc
|
| 1226 |
|
|
`define OR1200_DCLS 4
|
| 1227 |
|
|
|
| 1228 |
|
|
// Define to perform store refill (potential performance penalty)
|
| 1229 |
|
|
// `define OR1200_DC_STORE_REFILL
|
| 1230 |
|
|
|
| 1231 |
|
|
//
|
| 1232 |
|
|
// DC configurations
|
| 1233 |
|
|
//
|
| 1234 |
|
|
`ifdef OR1200_DC_1W_4KB
|
| 1235 |
|
|
`define OR1200_DCSIZE 12 // 4096
|
| 1236 |
|
|
`define OR1200_DCINDX `OR1200_DCSIZE-2 // 10
|
| 1237 |
|
|
`define OR1200_DCINDXH `OR1200_DCSIZE-1 // 11
|
| 1238 |
|
|
`define OR1200_DCTAGL `OR1200_DCINDXH+1 // 12
|
| 1239 |
|
|
`define OR1200_DCTAG `OR1200_DCSIZE-`OR1200_DCLS // 8
|
| 1240 |
|
|
`define OR1200_DCTAG_W 21
|
| 1241 |
|
|
`endif
|
| 1242 |
|
|
`ifdef OR1200_DC_1W_8KB
|
| 1243 |
|
|
`define OR1200_DCSIZE 13 // 8192
|
| 1244 |
|
|
`define OR1200_DCINDX `OR1200_DCSIZE-2 // 11
|
| 1245 |
|
|
`define OR1200_DCINDXH `OR1200_DCSIZE-1 // 12
|
| 1246 |
|
|
`define OR1200_DCTAGL `OR1200_DCINDXH+1 // 13
|
| 1247 |
|
|
`define OR1200_DCTAG `OR1200_DCSIZE-`OR1200_DCLS // 9
|
| 1248 |
|
|
`define OR1200_DCTAG_W 20
|
| 1249 |
|
|
`endif
|
| 1250 |
|
|
|
| 1251 |
|
|
/////////////////////////////////////////////////
|
| 1252 |
|
|
//
|
| 1253 |
|
|
// Store buffer (SB)
|
| 1254 |
|
|
//
|
| 1255 |
|
|
|
| 1256 |
|
|
//
|
| 1257 |
|
|
// Store buffer
|
| 1258 |
|
|
//
|
| 1259 |
|
|
// It will improve performance by "caching" CPU stores
|
| 1260 |
|
|
// using store buffer. This is most important for function
|
| 1261 |
|
|
// prologues because DC can only work in write though mode
|
| 1262 |
|
|
// and all stores would have to complete external WB writes
|
| 1263 |
|
|
// to memory.
|
| 1264 |
|
|
// Store buffer is between DC and data BIU.
|
| 1265 |
|
|
// All stores will be stored into store buffer and immediately
|
| 1266 |
|
|
// completed by the CPU, even though actual external writes
|
| 1267 |
|
|
// will be performed later. As a consequence store buffer masks
|
| 1268 |
|
|
// all data bus errors related to stores (data bus errors
|
| 1269 |
|
|
// related to loads are delivered normally).
|
| 1270 |
|
|
// All pending CPU loads will wait until store buffer is empty to
|
| 1271 |
|
|
// ensure strict memory model. Right now this is necessary because
|
| 1272 |
|
|
// we don't make destinction between cached and cache inhibited
|
| 1273 |
|
|
// address space, so we simply empty store buffer until loads
|
| 1274 |
|
|
// can begin.
|
| 1275 |
|
|
//
|
| 1276 |
|
|
// It makes design a bit bigger, depending what is the number of
|
| 1277 |
|
|
// entries in SB FIFO. Number of entries can be changed further
|
| 1278 |
|
|
// down.
|
| 1279 |
|
|
//
|
| 1280 |
|
|
//`define OR1200_SB_IMPLEMENTED
|
| 1281 |
|
|
|
| 1282 |
|
|
//
|
| 1283 |
|
|
// Number of store buffer entries
|
| 1284 |
|
|
//
|
| 1285 |
|
|
// Verified number of entries are 4 and 8 entries
|
| 1286 |
|
|
// (2 and 3 for OR1200_SB_LOG). OR1200_SB_ENTRIES must
|
| 1287 |
|
|
// always match 2**OR1200_SB_LOG.
|
| 1288 |
|
|
// To disable store buffer, undefine
|
| 1289 |
|
|
// OR1200_SB_IMPLEMENTED.
|
| 1290 |
|
|
//
|
| 1291 |
|
|
`define OR1200_SB_LOG 2 // 2 or 3
|
| 1292 |
|
|
`define OR1200_SB_ENTRIES 4 // 4 or 8
|
| 1293 |
|
|
|
| 1294 |
|
|
|
| 1295 |
|
|
/////////////////////////////////////////////////
|
| 1296 |
|
|
//
|
| 1297 |
|
|
// Quick Embedded Memory (QMEM)
|
| 1298 |
|
|
//
|
| 1299 |
|
|
|
| 1300 |
|
|
//
|
| 1301 |
|
|
// Quick Embedded Memory
|
| 1302 |
|
|
//
|
| 1303 |
|
|
// Instantiation of dedicated insn/data memory (RAM or ROM).
|
| 1304 |
|
|
// Insn fetch has effective throughput 1insn / clock cycle.
|
| 1305 |
|
|
// Data load takes two clock cycles / access, data store
|
| 1306 |
|
|
// takes 1 clock cycle / access (if there is no insn fetch)).
|
| 1307 |
|
|
// Memory instantiation is shared between insn and data,
|
| 1308 |
|
|
// meaning if insn fetch are performed, data load/store
|
| 1309 |
|
|
// performance will be lower.
|
| 1310 |
|
|
//
|
| 1311 |
|
|
// Main reason for QMEM is to put some time critical functions
|
| 1312 |
|
|
// into this memory and to have predictable and fast access
|
| 1313 |
|
|
// to these functions. (soft fpu, context switch, exception
|
| 1314 |
|
|
// handlers, stack, etc)
|
| 1315 |
|
|
//
|
| 1316 |
|
|
// It makes design a bit bigger and slower. QMEM sits behind
|
| 1317 |
|
|
// IMMU/DMMU so all addresses are physical (so the MMUs can be
|
| 1318 |
|
|
// used with QMEM and QMEM is seen by the CPU just like any other
|
| 1319 |
|
|
// memory in the system). IC/DC are sitting behind QMEM so the
|
| 1320 |
|
|
// whole design timing might be worse with QMEM implemented.
|
| 1321 |
|
|
//
|
| 1322 |
141 |
marcus.erl |
//`define OR1200_QMEM_IMPLEMENTED
|
| 1323 |
10 |
unneback |
|
| 1324 |
|
|
//
|
| 1325 |
|
|
// Base address and mask of QMEM
|
| 1326 |
|
|
//
|
| 1327 |
|
|
// Base address defines first address of QMEM. Mask defines
|
| 1328 |
|
|
// QMEM range in address space. Actual size of QMEM is however
|
| 1329 |
|
|
// determined with instantiated RAM/ROM. However bigger
|
| 1330 |
|
|
// mask will reserve more address space for QMEM, but also
|
| 1331 |
|
|
// make design faster, while more tight mask will take
|
| 1332 |
|
|
// less address space but also make design slower. If
|
| 1333 |
|
|
// instantiated RAM/ROM is smaller than space reserved with
|
| 1334 |
|
|
// the mask, instatiated RAM/ROM will also be shadowed
|
| 1335 |
|
|
// at higher addresses in reserved space.
|
| 1336 |
|
|
//
|
| 1337 |
|
|
`define OR1200_QMEM_IADDR 32'h0080_0000
|
| 1338 |
141 |
marcus.erl |
`define OR1200_QMEM_IMASK 32'hfff0_0000 // Max QMEM size 1MB
|
| 1339 |
|
|
`define OR1200_QMEM_DADDR 32'h0080_0000
|
| 1340 |
|
|
`define OR1200_QMEM_DMASK 32'hfff0_0000 // Max QMEM size 1MB
|
| 1341 |
10 |
unneback |
|
| 1342 |
|
|
//
|
| 1343 |
|
|
// QMEM interface byte-select capability
|
| 1344 |
|
|
//
|
| 1345 |
|
|
// To enable qmem_sel* ports, define this macro.
|
| 1346 |
|
|
//
|
| 1347 |
|
|
//`define OR1200_QMEM_BSEL
|
| 1348 |
|
|
|
| 1349 |
|
|
//
|
| 1350 |
|
|
// QMEM interface acknowledge
|
| 1351 |
|
|
//
|
| 1352 |
|
|
// To enable qmem_ack port, define this macro.
|
| 1353 |
|
|
//
|
| 1354 |
|
|
//`define OR1200_QMEM_ACK
|
| 1355 |
|
|
|
| 1356 |
|
|
/////////////////////////////////////////////////////
|
| 1357 |
|
|
//
|
| 1358 |
|
|
// VR, UPR and Configuration Registers
|
| 1359 |
|
|
//
|
| 1360 |
|
|
//
|
| 1361 |
|
|
// VR, UPR and configuration registers are optional. If
|
| 1362 |
|
|
// implemented, operating system can automatically figure
|
| 1363 |
|
|
// out how to use the processor because it knows
|
| 1364 |
|
|
// what units are available in the processor and how they
|
| 1365 |
|
|
// are configured.
|
| 1366 |
|
|
//
|
| 1367 |
|
|
// This section must be last in or1200_defines.v file so
|
| 1368 |
|
|
// that all units are already configured and thus
|
| 1369 |
|
|
// configuration registers are properly set.
|
| 1370 |
|
|
//
|
| 1371 |
|
|
|
| 1372 |
|
|
// Define if you want configuration registers implemented
|
| 1373 |
|
|
`define OR1200_CFGR_IMPLEMENTED
|
| 1374 |
|
|
|
| 1375 |
|
|
// Define if you want full address decode inside SYS group
|
| 1376 |
|
|
`define OR1200_SYS_FULL_DECODE
|
| 1377 |
|
|
|
| 1378 |
|
|
// Offsets of VR, UPR and CFGR registers
|
| 1379 |
|
|
`define OR1200_SPRGRP_SYS_VR 4'h0
|
| 1380 |
|
|
`define OR1200_SPRGRP_SYS_UPR 4'h1
|
| 1381 |
|
|
`define OR1200_SPRGRP_SYS_CPUCFGR 4'h2
|
| 1382 |
|
|
`define OR1200_SPRGRP_SYS_DMMUCFGR 4'h3
|
| 1383 |
|
|
`define OR1200_SPRGRP_SYS_IMMUCFGR 4'h4
|
| 1384 |
|
|
`define OR1200_SPRGRP_SYS_DCCFGR 4'h5
|
| 1385 |
|
|
`define OR1200_SPRGRP_SYS_ICCFGR 4'h6
|
| 1386 |
|
|
`define OR1200_SPRGRP_SYS_DCFGR 4'h7
|
| 1387 |
|
|
|
| 1388 |
|
|
// VR fields
|
| 1389 |
|
|
`define OR1200_VR_REV_BITS 5:0
|
| 1390 |
|
|
`define OR1200_VR_RES1_BITS 15:6
|
| 1391 |
|
|
`define OR1200_VR_CFG_BITS 23:16
|
| 1392 |
|
|
`define OR1200_VR_VER_BITS 31:24
|
| 1393 |
|
|
|
| 1394 |
|
|
// VR values
|
| 1395 |
|
|
`define OR1200_VR_REV 6'h01
|
| 1396 |
|
|
`define OR1200_VR_RES1 10'h000
|
| 1397 |
|
|
`define OR1200_VR_CFG 8'h00
|
| 1398 |
|
|
`define OR1200_VR_VER 8'h12
|
| 1399 |
|
|
|
| 1400 |
|
|
// UPR fields
|
| 1401 |
|
|
`define OR1200_UPR_UP_BITS 0
|
| 1402 |
|
|
`define OR1200_UPR_DCP_BITS 1
|
| 1403 |
|
|
`define OR1200_UPR_ICP_BITS 2
|
| 1404 |
|
|
`define OR1200_UPR_DMP_BITS 3
|
| 1405 |
|
|
`define OR1200_UPR_IMP_BITS 4
|
| 1406 |
|
|
`define OR1200_UPR_MP_BITS 5
|
| 1407 |
|
|
`define OR1200_UPR_DUP_BITS 6
|
| 1408 |
|
|
`define OR1200_UPR_PCUP_BITS 7
|
| 1409 |
|
|
`define OR1200_UPR_PMP_BITS 8
|
| 1410 |
|
|
`define OR1200_UPR_PICP_BITS 9
|
| 1411 |
|
|
`define OR1200_UPR_TTP_BITS 10
|
| 1412 |
|
|
`define OR1200_UPR_RES1_BITS 23:11
|
| 1413 |
|
|
`define OR1200_UPR_CUP_BITS 31:24
|
| 1414 |
|
|
|
| 1415 |
|
|
// UPR values
|
| 1416 |
|
|
`define OR1200_UPR_UP 1'b1
|
| 1417 |
|
|
`ifdef OR1200_NO_DC
|
| 1418 |
|
|
`define OR1200_UPR_DCP 1'b0
|
| 1419 |
|
|
`else
|
| 1420 |
|
|
`define OR1200_UPR_DCP 1'b1
|
| 1421 |
|
|
`endif
|
| 1422 |
|
|
`ifdef OR1200_NO_IC
|
| 1423 |
|
|
`define OR1200_UPR_ICP 1'b0
|
| 1424 |
|
|
`else
|
| 1425 |
|
|
`define OR1200_UPR_ICP 1'b1
|
| 1426 |
|
|
`endif
|
| 1427 |
|
|
`ifdef OR1200_NO_DMMU
|
| 1428 |
|
|
`define OR1200_UPR_DMP 1'b0
|
| 1429 |
|
|
`else
|
| 1430 |
|
|
`define OR1200_UPR_DMP 1'b1
|
| 1431 |
|
|
`endif
|
| 1432 |
|
|
`ifdef OR1200_NO_IMMU
|
| 1433 |
|
|
`define OR1200_UPR_IMP 1'b0
|
| 1434 |
|
|
`else
|
| 1435 |
|
|
`define OR1200_UPR_IMP 1'b1
|
| 1436 |
|
|
`endif
|
| 1437 |
|
|
`define OR1200_UPR_MP 1'b1 // MAC always present
|
| 1438 |
|
|
`ifdef OR1200_DU_IMPLEMENTED
|
| 1439 |
|
|
`define OR1200_UPR_DUP 1'b1
|
| 1440 |
|
|
`else
|
| 1441 |
|
|
`define OR1200_UPR_DUP 1'b0
|
| 1442 |
|
|
`endif
|
| 1443 |
|
|
`define OR1200_UPR_PCUP 1'b0 // Performance counters not present
|
| 1444 |
141 |
marcus.erl |
`ifdef OR1200_PM_IMPLEMENTED
|
| 1445 |
10 |
unneback |
`define OR1200_UPR_PMP 1'b1
|
| 1446 |
|
|
`else
|
| 1447 |
|
|
`define OR1200_UPR_PMP 1'b0
|
| 1448 |
|
|
`endif
|
| 1449 |
141 |
marcus.erl |
`ifdef OR1200_PIC_IMPLEMENTED
|
| 1450 |
10 |
unneback |
`define OR1200_UPR_PICP 1'b1
|
| 1451 |
|
|
`else
|
| 1452 |
|
|
`define OR1200_UPR_PICP 1'b0
|
| 1453 |
|
|
`endif
|
| 1454 |
141 |
marcus.erl |
`ifdef OR1200_TT_IMPLEMENTED
|
| 1455 |
10 |
unneback |
`define OR1200_UPR_TTP 1'b1
|
| 1456 |
|
|
`else
|
| 1457 |
|
|
`define OR1200_UPR_TTP 1'b0
|
| 1458 |
|
|
`endif
|
| 1459 |
|
|
`define OR1200_UPR_RES1 13'h0000
|
| 1460 |
|
|
`define OR1200_UPR_CUP 8'h00
|
| 1461 |
|
|
|
| 1462 |
|
|
// CPUCFGR fields
|
| 1463 |
|
|
`define OR1200_CPUCFGR_NSGF_BITS 3:0
|
| 1464 |
141 |
marcus.erl |
`define OR1200_CPUCFGR_HGF_BITS 4
|
| 1465 |
10 |
unneback |
`define OR1200_CPUCFGR_OB32S_BITS 5
|
| 1466 |
|
|
`define OR1200_CPUCFGR_OB64S_BITS 6
|
| 1467 |
|
|
`define OR1200_CPUCFGR_OF32S_BITS 7
|
| 1468 |
|
|
`define OR1200_CPUCFGR_OF64S_BITS 8
|
| 1469 |
|
|
`define OR1200_CPUCFGR_OV64S_BITS 9
|
| 1470 |
|
|
`define OR1200_CPUCFGR_RES1_BITS 31:10
|
| 1471 |
|
|
|
| 1472 |
|
|
// CPUCFGR values
|
| 1473 |
141 |
marcus.erl |
`define OR1200_CPUCFGR_NSGF 4'h0
|
| 1474 |
|
|
`ifdef OR1200_RFRAM_16REG
|
| 1475 |
|
|
`define OR1200_CPUCFGR_HGF 1'b1
|
| 1476 |
|
|
`else
|
| 1477 |
|
|
`define OR1200_CPUCFGR_HGF 1'b0
|
| 1478 |
|
|
`endif
|
| 1479 |
10 |
unneback |
`define OR1200_CPUCFGR_OB32S 1'b1
|
| 1480 |
|
|
`define OR1200_CPUCFGR_OB64S 1'b0
|
| 1481 |
|
|
`define OR1200_CPUCFGR_OF32S 1'b0
|
| 1482 |
|
|
`define OR1200_CPUCFGR_OF64S 1'b0
|
| 1483 |
|
|
`define OR1200_CPUCFGR_OV64S 1'b0
|
| 1484 |
|
|
`define OR1200_CPUCFGR_RES1 22'h000000
|
| 1485 |
|
|
|
| 1486 |
|
|
// DMMUCFGR fields
|
| 1487 |
|
|
`define OR1200_DMMUCFGR_NTW_BITS 1:0
|
| 1488 |
|
|
`define OR1200_DMMUCFGR_NTS_BITS 4:2
|
| 1489 |
|
|
`define OR1200_DMMUCFGR_NAE_BITS 7:5
|
| 1490 |
|
|
`define OR1200_DMMUCFGR_CRI_BITS 8
|
| 1491 |
|
|
`define OR1200_DMMUCFGR_PRI_BITS 9
|
| 1492 |
|
|
`define OR1200_DMMUCFGR_TEIRI_BITS 10
|
| 1493 |
|
|
`define OR1200_DMMUCFGR_HTR_BITS 11
|
| 1494 |
|
|
`define OR1200_DMMUCFGR_RES1_BITS 31:12
|
| 1495 |
|
|
|
| 1496 |
|
|
// DMMUCFGR values
|
| 1497 |
|
|
`ifdef OR1200_NO_DMMU
|
| 1498 |
|
|
`define OR1200_DMMUCFGR_NTW 2'h0 // Irrelevant
|
| 1499 |
|
|
`define OR1200_DMMUCFGR_NTS 3'h0 // Irrelevant
|
| 1500 |
|
|
`define OR1200_DMMUCFGR_NAE 3'h0 // Irrelevant
|
| 1501 |
|
|
`define OR1200_DMMUCFGR_CRI 1'b0 // Irrelevant
|
| 1502 |
|
|
`define OR1200_DMMUCFGR_PRI 1'b0 // Irrelevant
|
| 1503 |
|
|
`define OR1200_DMMUCFGR_TEIRI 1'b0 // Irrelevant
|
| 1504 |
|
|
`define OR1200_DMMUCFGR_HTR 1'b0 // Irrelevant
|
| 1505 |
|
|
`define OR1200_DMMUCFGR_RES1 20'h00000
|
| 1506 |
|
|
`else
|
| 1507 |
|
|
`define OR1200_DMMUCFGR_NTW 2'h0 // 1 TLB way
|
| 1508 |
|
|
`define OR1200_DMMUCFGR_NTS 3'h`OR1200_DTLB_INDXW // Num TLB sets
|
| 1509 |
|
|
`define OR1200_DMMUCFGR_NAE 3'h0 // No ATB entries
|
| 1510 |
|
|
`define OR1200_DMMUCFGR_CRI 1'b0 // No control register
|
| 1511 |
|
|
`define OR1200_DMMUCFGR_PRI 1'b0 // No protection reg
|
| 1512 |
|
|
`define OR1200_DMMUCFGR_TEIRI 1'b1 // TLB entry inv reg impl.
|
| 1513 |
|
|
`define OR1200_DMMUCFGR_HTR 1'b0 // No HW TLB reload
|
| 1514 |
|
|
`define OR1200_DMMUCFGR_RES1 20'h00000
|
| 1515 |
|
|
`endif
|
| 1516 |
|
|
|
| 1517 |
|
|
// IMMUCFGR fields
|
| 1518 |
|
|
`define OR1200_IMMUCFGR_NTW_BITS 1:0
|
| 1519 |
|
|
`define OR1200_IMMUCFGR_NTS_BITS 4:2
|
| 1520 |
|
|
`define OR1200_IMMUCFGR_NAE_BITS 7:5
|
| 1521 |
|
|
`define OR1200_IMMUCFGR_CRI_BITS 8
|
| 1522 |
|
|
`define OR1200_IMMUCFGR_PRI_BITS 9
|
| 1523 |
|
|
`define OR1200_IMMUCFGR_TEIRI_BITS 10
|
| 1524 |
|
|
`define OR1200_IMMUCFGR_HTR_BITS 11
|
| 1525 |
|
|
`define OR1200_IMMUCFGR_RES1_BITS 31:12
|
| 1526 |
|
|
|
| 1527 |
|
|
// IMMUCFGR values
|
| 1528 |
|
|
`ifdef OR1200_NO_IMMU
|
| 1529 |
|
|
`define OR1200_IMMUCFGR_NTW 2'h0 // Irrelevant
|
| 1530 |
|
|
`define OR1200_IMMUCFGR_NTS 3'h0 // Irrelevant
|
| 1531 |
|
|
`define OR1200_IMMUCFGR_NAE 3'h0 // Irrelevant
|
| 1532 |
|
|
`define OR1200_IMMUCFGR_CRI 1'b0 // Irrelevant
|
| 1533 |
|
|
`define OR1200_IMMUCFGR_PRI 1'b0 // Irrelevant
|
| 1534 |
|
|
`define OR1200_IMMUCFGR_TEIRI 1'b0 // Irrelevant
|
| 1535 |
|
|
`define OR1200_IMMUCFGR_HTR 1'b0 // Irrelevant
|
| 1536 |
|
|
`define OR1200_IMMUCFGR_RES1 20'h00000
|
| 1537 |
|
|
`else
|
| 1538 |
|
|
`define OR1200_IMMUCFGR_NTW 2'h0 // 1 TLB way
|
| 1539 |
|
|
`define OR1200_IMMUCFGR_NTS 3'h`OR1200_ITLB_INDXW // Num TLB sets
|
| 1540 |
|
|
`define OR1200_IMMUCFGR_NAE 3'h0 // No ATB entry
|
| 1541 |
|
|
`define OR1200_IMMUCFGR_CRI 1'b0 // No control reg
|
| 1542 |
|
|
`define OR1200_IMMUCFGR_PRI 1'b0 // No protection reg
|
| 1543 |
|
|
`define OR1200_IMMUCFGR_TEIRI 1'b1 // TLB entry inv reg impl
|
| 1544 |
|
|
`define OR1200_IMMUCFGR_HTR 1'b0 // No HW TLB reload
|
| 1545 |
|
|
`define OR1200_IMMUCFGR_RES1 20'h00000
|
| 1546 |
|
|
`endif
|
| 1547 |
|
|
|
| 1548 |
|
|
// DCCFGR fields
|
| 1549 |
|
|
`define OR1200_DCCFGR_NCW_BITS 2:0
|
| 1550 |
|
|
`define OR1200_DCCFGR_NCS_BITS 6:3
|
| 1551 |
|
|
`define OR1200_DCCFGR_CBS_BITS 7
|
| 1552 |
|
|
`define OR1200_DCCFGR_CWS_BITS 8
|
| 1553 |
|
|
`define OR1200_DCCFGR_CCRI_BITS 9
|
| 1554 |
|
|
`define OR1200_DCCFGR_CBIRI_BITS 10
|
| 1555 |
|
|
`define OR1200_DCCFGR_CBPRI_BITS 11
|
| 1556 |
|
|
`define OR1200_DCCFGR_CBLRI_BITS 12
|
| 1557 |
|
|
`define OR1200_DCCFGR_CBFRI_BITS 13
|
| 1558 |
|
|
`define OR1200_DCCFGR_CBWBRI_BITS 14
|
| 1559 |
|
|
`define OR1200_DCCFGR_RES1_BITS 31:15
|
| 1560 |
|
|
|
| 1561 |
|
|
// DCCFGR values
|
| 1562 |
|
|
`ifdef OR1200_NO_DC
|
| 1563 |
|
|
`define OR1200_DCCFGR_NCW 3'h0 // Irrelevant
|
| 1564 |
|
|
`define OR1200_DCCFGR_NCS 4'h0 // Irrelevant
|
| 1565 |
|
|
`define OR1200_DCCFGR_CBS 1'b0 // Irrelevant
|
| 1566 |
|
|
`define OR1200_DCCFGR_CWS 1'b0 // Irrelevant
|
| 1567 |
141 |
marcus.erl |
`define OR1200_DCCFGR_CCRI 1'b0 // Irrelevant
|
| 1568 |
|
|
`define OR1200_DCCFGR_CBIRI 1'b0 // Irrelevant
|
| 1569 |
10 |
unneback |
`define OR1200_DCCFGR_CBPRI 1'b0 // Irrelevant
|
| 1570 |
|
|
`define OR1200_DCCFGR_CBLRI 1'b0 // Irrelevant
|
| 1571 |
141 |
marcus.erl |
`define OR1200_DCCFGR_CBFRI 1'b0 // Irrelevant
|
| 1572 |
10 |
unneback |
`define OR1200_DCCFGR_CBWBRI 1'b0 // Irrelevant
|
| 1573 |
|
|
`define OR1200_DCCFGR_RES1 17'h00000
|
| 1574 |
|
|
`else
|
| 1575 |
|
|
`define OR1200_DCCFGR_NCW 3'h0 // 1 cache way
|
| 1576 |
|
|
`define OR1200_DCCFGR_NCS (`OR1200_DCTAG) // Num cache sets
|
| 1577 |
|
|
`define OR1200_DCCFGR_CBS (`OR1200_DCLS-4) // 16 byte cache block
|
| 1578 |
|
|
`define OR1200_DCCFGR_CWS 1'b0 // Write-through strategy
|
| 1579 |
|
|
`define OR1200_DCCFGR_CCRI 1'b1 // Cache control reg impl.
|
| 1580 |
|
|
`define OR1200_DCCFGR_CBIRI 1'b1 // Cache block inv reg impl.
|
| 1581 |
|
|
`define OR1200_DCCFGR_CBPRI 1'b0 // Cache block prefetch reg not impl.
|
| 1582 |
|
|
`define OR1200_DCCFGR_CBLRI 1'b0 // Cache block lock reg not impl.
|
| 1583 |
|
|
`define OR1200_DCCFGR_CBFRI 1'b1 // Cache block flush reg impl.
|
| 1584 |
|
|
`define OR1200_DCCFGR_CBWBRI 1'b0 // Cache block WB reg not impl.
|
| 1585 |
|
|
`define OR1200_DCCFGR_RES1 17'h00000
|
| 1586 |
|
|
`endif
|
| 1587 |
|
|
|
| 1588 |
|
|
// ICCFGR fields
|
| 1589 |
|
|
`define OR1200_ICCFGR_NCW_BITS 2:0
|
| 1590 |
|
|
`define OR1200_ICCFGR_NCS_BITS 6:3
|
| 1591 |
|
|
`define OR1200_ICCFGR_CBS_BITS 7
|
| 1592 |
|
|
`define OR1200_ICCFGR_CWS_BITS 8
|
| 1593 |
|
|
`define OR1200_ICCFGR_CCRI_BITS 9
|
| 1594 |
|
|
`define OR1200_ICCFGR_CBIRI_BITS 10
|
| 1595 |
|
|
`define OR1200_ICCFGR_CBPRI_BITS 11
|
| 1596 |
|
|
`define OR1200_ICCFGR_CBLRI_BITS 12
|
| 1597 |
|
|
`define OR1200_ICCFGR_CBFRI_BITS 13
|
| 1598 |
|
|
`define OR1200_ICCFGR_CBWBRI_BITS 14
|
| 1599 |
|
|
`define OR1200_ICCFGR_RES1_BITS 31:15
|
| 1600 |
|
|
|
| 1601 |
|
|
// ICCFGR values
|
| 1602 |
|
|
`ifdef OR1200_NO_IC
|
| 1603 |
|
|
`define OR1200_ICCFGR_NCW 3'h0 // Irrelevant
|
| 1604 |
|
|
`define OR1200_ICCFGR_NCS 4'h0 // Irrelevant
|
| 1605 |
|
|
`define OR1200_ICCFGR_CBS 1'b0 // Irrelevant
|
| 1606 |
|
|
`define OR1200_ICCFGR_CWS 1'b0 // Irrelevant
|
| 1607 |
|
|
`define OR1200_ICCFGR_CCRI 1'b0 // Irrelevant
|
| 1608 |
|
|
`define OR1200_ICCFGR_CBIRI 1'b0 // Irrelevant
|
| 1609 |
|
|
`define OR1200_ICCFGR_CBPRI 1'b0 // Irrelevant
|
| 1610 |
|
|
`define OR1200_ICCFGR_CBLRI 1'b0 // Irrelevant
|
| 1611 |
|
|
`define OR1200_ICCFGR_CBFRI 1'b0 // Irrelevant
|
| 1612 |
|
|
`define OR1200_ICCFGR_CBWBRI 1'b0 // Irrelevant
|
| 1613 |
|
|
`define OR1200_ICCFGR_RES1 17'h00000
|
| 1614 |
|
|
`else
|
| 1615 |
|
|
`define OR1200_ICCFGR_NCW 3'h0 // 1 cache way
|
| 1616 |
|
|
`define OR1200_ICCFGR_NCS (`OR1200_ICTAG) // Num cache sets
|
| 1617 |
|
|
`define OR1200_ICCFGR_CBS (`OR1200_ICLS-4) // 16 byte cache block
|
| 1618 |
|
|
`define OR1200_ICCFGR_CWS 1'b0 // Irrelevant
|
| 1619 |
|
|
`define OR1200_ICCFGR_CCRI 1'b1 // Cache control reg impl.
|
| 1620 |
|
|
`define OR1200_ICCFGR_CBIRI 1'b1 // Cache block inv reg impl.
|
| 1621 |
|
|
`define OR1200_ICCFGR_CBPRI 1'b0 // Cache block prefetch reg not impl.
|
| 1622 |
|
|
`define OR1200_ICCFGR_CBLRI 1'b0 // Cache block lock reg not impl.
|
| 1623 |
|
|
`define OR1200_ICCFGR_CBFRI 1'b1 // Cache block flush reg impl.
|
| 1624 |
|
|
`define OR1200_ICCFGR_CBWBRI 1'b0 // Irrelevant
|
| 1625 |
|
|
`define OR1200_ICCFGR_RES1 17'h00000
|
| 1626 |
|
|
`endif
|
| 1627 |
|
|
|
| 1628 |
|
|
// DCFGR fields
|
| 1629 |
141 |
marcus.erl |
`define OR1200_DCFGR_NDP_BITS 3:0
|
| 1630 |
|
|
`define OR1200_DCFGR_WPCI_BITS 4
|
| 1631 |
|
|
`define OR1200_DCFGR_RES1_BITS 31:5
|
| 1632 |
10 |
unneback |
|
| 1633 |
|
|
// DCFGR values
|
| 1634 |
|
|
`ifdef OR1200_DU_HWBKPTS
|
| 1635 |
141 |
marcus.erl |
`define OR1200_DCFGR_NDP 4'h`OR1200_DU_DVRDCR_PAIRS // # of DVR/DCR pairs
|
| 1636 |
10 |
unneback |
`ifdef OR1200_DU_DWCR0
|
| 1637 |
|
|
`define OR1200_DCFGR_WPCI 1'b1
|
| 1638 |
|
|
`else
|
| 1639 |
|
|
`define OR1200_DCFGR_WPCI 1'b0 // WP counters not impl.
|
| 1640 |
|
|
`endif
|
| 1641 |
|
|
`else
|
| 1642 |
141 |
marcus.erl |
`define OR1200_DCFGR_NDP 4'h0 // Zero DVR/DCR pairs
|
| 1643 |
10 |
unneback |
`define OR1200_DCFGR_WPCI 1'b0 // WP counters not impl.
|
| 1644 |
|
|
`endif
|
| 1645 |
|
|
`define OR1200_DCFGR_RES1 28'h0000000
|
| 1646 |
141 |
marcus.erl |
|
| 1647 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
| 1648 |
|
|
// Boot Address Selection //
|
| 1649 |
185 |
julius |
// This only changes where the initial reset occurs. EPH setting is still //
|
| 1650 |
|
|
// used to determine where vectors are located. //
|
| 1651 |
141 |
marcus.erl |
///////////////////////////////////////////////////////////////////////////////
|
| 1652 |
185 |
julius |
// Boot from 0xf0000100
|
| 1653 |
141 |
marcus.erl |
`define OR1200_BOOT_PCREG_DEFAULT 30'h3c00003f
|
| 1654 |
|
|
`define OR1200_BOOT_ADR 32'hf0000100
|
| 1655 |
|
|
// Boot from 0x100
|
| 1656 |
|
|
// `define OR1200_BOOT_PCREG_DEFAULT 30'h0000003f
|
| 1657 |
|
|
// `define OR1200_BOOT_ADR 32'h00000100
|