1 |
746 |
lampret |
//////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// OR1200's definitions ////
|
4 |
|
|
//// ////
|
5 |
|
|
//// This file is part of the OpenRISC 1200 project ////
|
6 |
|
|
//// http://www.opencores.org/cores/or1k/ ////
|
7 |
|
|
//// ////
|
8 |
|
|
//// Description ////
|
9 |
|
|
//// Parameters of the OR1200 core ////
|
10 |
|
|
//// ////
|
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 |
|
|
// CVS Revision History
|
45 |
|
|
//
|
46 |
|
|
// $Log: not supported by cvs2svn $
|
47 |
|
|
// Revision 1.10 2002/03/14 00:30:24 lampret
|
48 |
|
|
// Added alternative for critical path in DU.
|
49 |
|
|
//
|
50 |
|
|
// Revision 1.9 2002/03/11 01:26:26 lampret
|
51 |
|
|
// Fixed async loop. Changed multiplier type for ASIC.
|
52 |
|
|
//
|
53 |
|
|
// Revision 1.8 2002/02/11 04:33:17 lampret
|
54 |
|
|
// Speed optimizations (removed duplicate _cyc_ and _stb_). Fixed D/IMMU cache-inhibit attr.
|
55 |
|
|
//
|
56 |
|
|
// Revision 1.7 2002/02/01 19:56:54 lampret
|
57 |
|
|
// Fixed combinational loops.
|
58 |
|
|
//
|
59 |
|
|
// Revision 1.6 2002/01/19 14:10:22 lampret
|
60 |
|
|
// Fixed OR1200_XILINX_RAM32X1D.
|
61 |
|
|
//
|
62 |
|
|
// Revision 1.5 2002/01/18 07:56:00 lampret
|
63 |
|
|
// No more low/high priority interrupts (PICPR removed). Added tick timer exception. Added exception prefix (SR[EPH]). Fixed single-step bug whenreading NPC.
|
64 |
|
|
//
|
65 |
|
|
// Revision 1.4 2002/01/14 09:44:12 lampret
|
66 |
|
|
// Default ASIC configuration does not sample WB inputs.
|
67 |
|
|
//
|
68 |
|
|
// Revision 1.3 2002/01/08 00:51:08 lampret
|
69 |
|
|
// Fixed typo. OR1200_REGISTERED_OUTPUTS was not defined. Should be.
|
70 |
|
|
//
|
71 |
|
|
// Revision 1.2 2002/01/03 21:23:03 lampret
|
72 |
|
|
// Uncommented OR1200_REGISTERED_OUTPUTS for FPGA target.
|
73 |
|
|
//
|
74 |
|
|
// Revision 1.1 2002/01/03 08:16:15 lampret
|
75 |
|
|
// New prefixes for RTL files, prefixed module names. Updated cache controllers and MMUs.
|
76 |
|
|
//
|
77 |
|
|
// Revision 1.20 2001/12/04 05:02:36 lampret
|
78 |
|
|
// Added OR1200_GENERIC_MULTP2_32X32 and OR1200_ASIC_MULTP2_32X32
|
79 |
|
|
//
|
80 |
|
|
// Revision 1.19 2001/11/27 19:46:57 lampret
|
81 |
|
|
// Now FPGA and ASIC target are separate.
|
82 |
|
|
//
|
83 |
|
|
// Revision 1.18 2001/11/23 21:42:31 simons
|
84 |
|
|
// Program counter divided to PPC and NPC.
|
85 |
|
|
//
|
86 |
|
|
// Revision 1.17 2001/11/23 08:38:51 lampret
|
87 |
|
|
// Changed DSR/DRR behavior and exception detection.
|
88 |
|
|
//
|
89 |
|
|
// Revision 1.16 2001/11/20 21:30:38 lampret
|
90 |
|
|
// Added OR1200_REGISTERED_INPUTS.
|
91 |
|
|
//
|
92 |
|
|
// Revision 1.15 2001/11/19 14:29:48 simons
|
93 |
|
|
// Cashes disabled.
|
94 |
|
|
//
|
95 |
|
|
// Revision 1.14 2001/11/13 10:02:21 lampret
|
96 |
|
|
// Added 'setpc'. Renamed some signals (except_flushpipe into flushpipe etc)
|
97 |
|
|
//
|
98 |
|
|
// Revision 1.13 2001/11/12 01:45:40 lampret
|
99 |
|
|
// Moved flag bit into SR. Changed RF enable from constant enable to dynamic enable for read ports.
|
100 |
|
|
//
|
101 |
|
|
// Revision 1.12 2001/11/10 03:43:57 lampret
|
102 |
|
|
// Fixed exceptions.
|
103 |
|
|
//
|
104 |
|
|
// Revision 1.11 2001/11/02 18:57:14 lampret
|
105 |
|
|
// Modified virtual silicon instantiations.
|
106 |
|
|
//
|
107 |
|
|
// Revision 1.10 2001/10/21 17:57:16 lampret
|
108 |
|
|
// 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.
|
109 |
|
|
//
|
110 |
|
|
// Revision 1.9 2001/10/19 23:28:46 lampret
|
111 |
|
|
// Fixed some synthesis warnings. Configured with caches and MMUs.
|
112 |
|
|
//
|
113 |
|
|
// Revision 1.8 2001/10/14 13:12:09 lampret
|
114 |
|
|
// MP3 version.
|
115 |
|
|
//
|
116 |
|
|
// Revision 1.1.1.1 2001/10/06 10:18:36 igorm
|
117 |
|
|
// no message
|
118 |
|
|
//
|
119 |
|
|
// Revision 1.3 2001/08/17 08:01:19 lampret
|
120 |
|
|
// IC enable/disable.
|
121 |
|
|
//
|
122 |
|
|
// Revision 1.2 2001/08/13 03:36:20 lampret
|
123 |
|
|
// Added cfg regs. Moved all defines into one defines.v file. More cleanup.
|
124 |
|
|
//
|
125 |
|
|
// Revision 1.1 2001/08/09 13:39:33 lampret
|
126 |
|
|
// Major clean-up.
|
127 |
|
|
//
|
128 |
|
|
// Revision 1.2 2001/07/22 03:31:54 lampret
|
129 |
|
|
// Fixed RAM's oen bug. Cache bypass under development.
|
130 |
|
|
//
|
131 |
|
|
// Revision 1.1 2001/07/20 00:46:03 lampret
|
132 |
|
|
// Development version of RTL. Libraries are missing.
|
133 |
|
|
//
|
134 |
|
|
//
|
135 |
|
|
|
136 |
|
|
//
|
137 |
|
|
// Dump VCD
|
138 |
|
|
//
|
139 |
|
|
//`define OR1200_VCD_DUMP
|
140 |
|
|
|
141 |
|
|
//
|
142 |
|
|
// Generate debug messages during simulation
|
143 |
|
|
//
|
144 |
|
|
//`define OR1200_VERBOSE
|
145 |
|
|
|
146 |
|
|
//`define OR1200_ASIC
|
147 |
|
|
////////////////////////////////////////////////////////
|
148 |
|
|
//
|
149 |
|
|
// Typical configuration for an ASIC
|
150 |
|
|
//
|
151 |
|
|
`ifdef OR1200_ASIC
|
152 |
|
|
|
153 |
|
|
//
|
154 |
|
|
// Target ASIC memories
|
155 |
|
|
//
|
156 |
|
|
//`define OR1200_ARTISAN_SSP
|
157 |
|
|
//`define OR1200_ARTISAN_SDP
|
158 |
|
|
//`define OR1200_ARTISAN_STP
|
159 |
|
|
`define OR1200_VIRTUALSILICON_SSP
|
160 |
|
|
`define OR1200_VIRTUALSILICON_STP
|
161 |
|
|
|
162 |
|
|
//
|
163 |
|
|
// Do not implement Data cache
|
164 |
|
|
//
|
165 |
|
|
//`define OR1200_NO_DC
|
166 |
|
|
|
167 |
|
|
//
|
168 |
|
|
// Do not implement Insn cache
|
169 |
|
|
//
|
170 |
|
|
//`define OR1200_NO_IC
|
171 |
|
|
|
172 |
|
|
//
|
173 |
|
|
// Do not implement Data MMU
|
174 |
|
|
//
|
175 |
|
|
//`define OR1200_NO_DMMU
|
176 |
|
|
|
177 |
|
|
//
|
178 |
|
|
// Do not implement Insn MMU
|
179 |
|
|
//
|
180 |
|
|
//`define OR1200_NO_IMMU
|
181 |
|
|
|
182 |
|
|
//
|
183 |
|
|
// Register OR1200 WISHBONE outputs
|
184 |
|
|
// (at the moment correct operation
|
185 |
|
|
// only with registered outputs)
|
186 |
|
|
//
|
187 |
|
|
`define OR1200_REGISTERED_OUTPUTS
|
188 |
|
|
|
189 |
|
|
//
|
190 |
|
|
// Register OR1200 WISHBNE inputs
|
191 |
|
|
//
|
192 |
|
|
//`define OR1200_REGISTERED_INPUTS
|
193 |
|
|
|
194 |
|
|
//
|
195 |
|
|
// Select between ASIC optimized and generic multiplier
|
196 |
|
|
//
|
197 |
|
|
//`define OR1200_ASIC_MULTP2_32X32
|
198 |
|
|
`define OR1200_GENERIC_MULTP2_32X32
|
199 |
|
|
|
200 |
|
|
//
|
201 |
|
|
// Size/type of insn/data cache if implemented
|
202 |
|
|
//
|
203 |
|
|
// `define OR1200_IC_1W_4KB
|
204 |
|
|
`define OR1200_IC_1W_8KB
|
205 |
|
|
// `define OR1200_DC_1W_4KB
|
206 |
|
|
`define OR1200_DC_1W_8KB
|
207 |
|
|
|
208 |
|
|
`else
|
209 |
|
|
|
210 |
|
|
|
211 |
|
|
/////////////////////////////////////////////////////////
|
212 |
|
|
//
|
213 |
|
|
// Typical configuration for an FPGA
|
214 |
|
|
//
|
215 |
|
|
|
216 |
|
|
//
|
217 |
|
|
// Target FPGA memories
|
218 |
|
|
//
|
219 |
|
|
`define OR1200_XILINX_RAMB4
|
220 |
|
|
//`define OR1200_XILINX_RAM32X1D
|
221 |
|
|
|
222 |
|
|
//
|
223 |
|
|
// Do not implement Data cache
|
224 |
|
|
//
|
225 |
|
|
//`define OR1200_NO_DC
|
226 |
|
|
|
227 |
|
|
//
|
228 |
|
|
// Do not implement Insn cache
|
229 |
|
|
//
|
230 |
|
|
//`define OR1200_NO_IC
|
231 |
|
|
|
232 |
|
|
//
|
233 |
|
|
// Do not implement Data MMU
|
234 |
|
|
//
|
235 |
|
|
`define OR1200_NO_DMMU
|
236 |
|
|
|
237 |
|
|
//
|
238 |
|
|
// Do not implement Insn MMU
|
239 |
|
|
//
|
240 |
|
|
`define OR1200_NO_IMMU
|
241 |
|
|
|
242 |
|
|
//
|
243 |
|
|
// Register OR1200 WISHBONE outputs
|
244 |
|
|
// (at the moment works only with
|
245 |
|
|
// registered outputs)
|
246 |
|
|
//
|
247 |
|
|
`define OR1200_REGISTERED_OUTPUTS
|
248 |
|
|
|
249 |
|
|
//
|
250 |
|
|
// Register OR1200 WISHBONE inputs
|
251 |
|
|
//
|
252 |
|
|
//`define OR1200_REGISTERED_INPUTS
|
253 |
|
|
|
254 |
|
|
//
|
255 |
|
|
// Select between ASIC and generic multiplier
|
256 |
|
|
//
|
257 |
|
|
//`define OR1200_ASIC_MULTP2_32X32
|
258 |
|
|
`define OR1200_GENERIC_MULTP2_32X32
|
259 |
|
|
|
260 |
|
|
//
|
261 |
|
|
// Size/type of insn/data cache if implemented
|
262 |
|
|
// (consider available FPGA memory resources)
|
263 |
|
|
//
|
264 |
|
|
`define OR1200_IC_1W_4KB
|
265 |
|
|
//`define OR1200_IC_1W_8KB
|
266 |
|
|
`define OR1200_DC_1W_4KB
|
267 |
|
|
//`define OR1200_DC_1W_8KB
|
268 |
|
|
|
269 |
|
|
`endif
|
270 |
|
|
|
271 |
|
|
|
272 |
|
|
//////////////////////////////////////////////////////////
|
273 |
|
|
//
|
274 |
|
|
// Do not change below unless you know what you are doing
|
275 |
|
|
//
|
276 |
|
|
|
277 |
|
|
// Operand width / register file address width
|
278 |
|
|
`define OR1200_OPERAND_WIDTH 32
|
279 |
|
|
`define OR1200_REGFILE_ADDR_WIDTH 5
|
280 |
|
|
|
281 |
|
|
//
|
282 |
|
|
// Implement rotate in the ALU
|
283 |
|
|
//
|
284 |
|
|
//`define OR1200_IMPL_ALU_ROTATE
|
285 |
|
|
|
286 |
|
|
//
|
287 |
|
|
// Type of ALU compare to implement
|
288 |
|
|
//
|
289 |
|
|
//`define OR1200_IMPL_ALU_COMP1
|
290 |
|
|
`define OR1200_IMPL_ALU_COMP2
|
291 |
|
|
|
292 |
|
|
//
|
293 |
|
|
// Select between low-power (larger) multiplier or faster multiplier
|
294 |
|
|
//
|
295 |
|
|
//`define OR1200_LOWPWR_MULT
|
296 |
|
|
|
297 |
|
|
//
|
298 |
|
|
// Clock synchronization for RISC clk and WB divided clocks
|
299 |
|
|
//
|
300 |
|
|
// If you plan to run WB:RISC clock 1:1, you can comment these two
|
301 |
|
|
//
|
302 |
|
|
`define OR1200_CLKDIV_2_SUPPORTED
|
303 |
|
|
`define OR1200_CLKDIV_4_SUPPORTED
|
304 |
|
|
|
305 |
|
|
//
|
306 |
|
|
// Type of register file RAM
|
307 |
|
|
//
|
308 |
|
|
// `define OR1200_RFRAM_TWOPORT
|
309 |
|
|
|
310 |
|
|
//
|
311 |
|
|
// Define to use fast (and bigger) version of mem2reg aligner
|
312 |
|
|
//
|
313 |
|
|
`define OR1200_MEM2REG_FAST
|
314 |
|
|
|
315 |
|
|
//
|
316 |
|
|
// Simulate l.div and l.divu
|
317 |
|
|
//
|
318 |
|
|
// If commented, l.div/l.divu will produce undefined result. If enabled,
|
319 |
|
|
// div instructions will be simulated, but not synthesized ! OR1200
|
320 |
|
|
// does not have a hardware divider.
|
321 |
|
|
//
|
322 |
|
|
`define OR1200_SIM_ALU_DIV
|
323 |
|
|
`define OR1200_SIM_ALU_DIVU
|
324 |
|
|
|
325 |
|
|
//
|
326 |
|
|
// ALUOPs
|
327 |
|
|
//
|
328 |
|
|
`define OR1200_ALUOP_WIDTH 4
|
329 |
|
|
`define OR1200_ALUOP_NOP 4'd4
|
330 |
|
|
/* Order defined by arith insns that have two source operands both in regs
|
331 |
|
|
(see binutils/include/opcode/or32.h) */
|
332 |
|
|
`define OR1200_ALUOP_ADD 4'd0
|
333 |
|
|
`define OR1200_ALUOP_ADDC 4'd1
|
334 |
|
|
`define OR1200_ALUOP_SUB 4'd2
|
335 |
|
|
`define OR1200_ALUOP_AND 4'd3
|
336 |
|
|
`define OR1200_ALUOP_OR 4'd4
|
337 |
|
|
`define OR1200_ALUOP_XOR 4'd5
|
338 |
|
|
`define OR1200_ALUOP_MUL 4'd6
|
339 |
|
|
`define OR1200_ALUOP_SHROT 4'd8
|
340 |
|
|
`define OR1200_ALUOP_DIV 4'd9
|
341 |
|
|
`define OR1200_ALUOP_DIVU 4'd10
|
342 |
|
|
/* Order not specifically defined. */
|
343 |
|
|
`define OR1200_ALUOP_IMM 4'd11
|
344 |
|
|
`define OR1200_ALUOP_MOVHI 4'd12
|
345 |
|
|
`define OR1200_ALUOP_COMP 4'd13
|
346 |
|
|
`define OR1200_ALUOP_MTSR 4'd14
|
347 |
|
|
`define OR1200_ALUOP_MFSR 4'd15
|
348 |
|
|
|
349 |
|
|
//
|
350 |
|
|
// MACOPs
|
351 |
|
|
//
|
352 |
|
|
`define OR1200_MACOP_WIDTH 2
|
353 |
|
|
`define OR1200_MACOP_NOP 2'b00
|
354 |
|
|
`define OR1200_MACOP_MAC 2'b01
|
355 |
|
|
`define OR1200_MACOP_MSB 2'b10
|
356 |
|
|
|
357 |
|
|
//
|
358 |
|
|
// Shift/rotate ops
|
359 |
|
|
//
|
360 |
|
|
`define OR1200_SHROTOP_WIDTH 2
|
361 |
|
|
`define OR1200_SHROTOP_NOP 2'd0
|
362 |
|
|
`define OR1200_SHROTOP_SLL 2'd0
|
363 |
|
|
`define OR1200_SHROTOP_SRL 2'd1
|
364 |
|
|
`define OR1200_SHROTOP_SRA 2'd2
|
365 |
|
|
`define OR1200_SHROTOP_ROR 2'd3
|
366 |
|
|
|
367 |
|
|
// Execution cycles per instruction
|
368 |
|
|
`define OR1200_MULTICYCLE_WIDTH 2
|
369 |
|
|
`define OR1200_ONE_CYCLE 2'd0
|
370 |
|
|
`define OR1200_TWO_CYCLES 2'd1
|
371 |
|
|
|
372 |
|
|
// Operand MUX selects
|
373 |
|
|
`define OR1200_SEL_WIDTH 2
|
374 |
|
|
`define OR1200_SEL_RF 2'd0
|
375 |
|
|
`define OR1200_SEL_IMM 2'd1
|
376 |
|
|
`define OR1200_SEL_EX_FORW 2'd2
|
377 |
|
|
`define OR1200_SEL_WB_FORW 2'd3
|
378 |
|
|
|
379 |
|
|
//
|
380 |
|
|
// BRANCHOPs
|
381 |
|
|
//
|
382 |
|
|
`define OR1200_BRANCHOP_WIDTH 3
|
383 |
|
|
`define OR1200_BRANCHOP_NOP 3'd0
|
384 |
|
|
`define OR1200_BRANCHOP_J 3'd1
|
385 |
|
|
`define OR1200_BRANCHOP_JR 3'd2
|
386 |
|
|
`define OR1200_BRANCHOP_BAL 3'd3
|
387 |
|
|
`define OR1200_BRANCHOP_BF 3'd4
|
388 |
|
|
`define OR1200_BRANCHOP_BNF 3'd5
|
389 |
|
|
`define OR1200_BRANCHOP_RFE 3'd6
|
390 |
|
|
|
391 |
|
|
//
|
392 |
|
|
// LSUOPs
|
393 |
|
|
//
|
394 |
|
|
// Bit 0: sign extend
|
395 |
|
|
// Bits 1-2: 00 doubleword, 01 byte, 10 halfword, 11 singleword
|
396 |
|
|
// Bit 3: 0 load, 1 store
|
397 |
|
|
`define OR1200_LSUOP_WIDTH 4
|
398 |
|
|
`define OR1200_LSUOP_NOP 4'b0000
|
399 |
|
|
`define OR1200_LSUOP_LBZ 4'b0010
|
400 |
|
|
`define OR1200_LSUOP_LBS 4'b0011
|
401 |
|
|
`define OR1200_LSUOP_LHZ 4'b0100
|
402 |
|
|
`define OR1200_LSUOP_LHS 4'b0101
|
403 |
|
|
`define OR1200_LSUOP_LWZ 4'b0110
|
404 |
|
|
`define OR1200_LSUOP_LWS 4'b0111
|
405 |
|
|
`define OR1200_LSUOP_LD 4'b0001
|
406 |
|
|
`define OR1200_LSUOP_SD 4'b1000
|
407 |
|
|
`define OR1200_LSUOP_SB 4'b1010
|
408 |
|
|
`define OR1200_LSUOP_SH 4'b1100
|
409 |
|
|
`define OR1200_LSUOP_SW 4'b1110
|
410 |
|
|
|
411 |
|
|
// FETCHOPs
|
412 |
|
|
`define OR1200_FETCHOP_WIDTH 1
|
413 |
|
|
`define OR1200_FETCHOP_NOP 1'b0
|
414 |
|
|
`define OR1200_FETCHOP_LW 1'b1
|
415 |
|
|
|
416 |
|
|
//
|
417 |
|
|
// Register File Write-Back OPs
|
418 |
|
|
//
|
419 |
|
|
// Bit 0: register file write enable
|
420 |
|
|
// Bits 2-1: write-back mux selects
|
421 |
|
|
`define OR1200_RFWBOP_WIDTH 3
|
422 |
|
|
`define OR1200_RFWBOP_NOP 3'b000
|
423 |
|
|
`define OR1200_RFWBOP_ALU 3'b001
|
424 |
|
|
`define OR1200_RFWBOP_LSU 3'b011
|
425 |
|
|
`define OR1200_RFWBOP_SPRS 3'b101
|
426 |
|
|
`define OR1200_RFWBOP_LR 3'b111
|
427 |
|
|
|
428 |
|
|
// Compare instructions
|
429 |
|
|
`define OR1200_COP_SFEQ 3'b000
|
430 |
|
|
`define OR1200_COP_SFNE 3'b001
|
431 |
|
|
`define OR1200_COP_SFGT 3'b010
|
432 |
|
|
`define OR1200_COP_SFGE 3'b011
|
433 |
|
|
`define OR1200_COP_SFLT 3'b100
|
434 |
|
|
`define OR1200_COP_SFLE 3'b101
|
435 |
|
|
`define OR1200_COP_X 3'b111
|
436 |
|
|
`define OR1200_SIGNED_COMPARE 'd3
|
437 |
|
|
`define OR1200_COMPOP_WIDTH 4
|
438 |
|
|
|
439 |
|
|
//
|
440 |
|
|
// TAGs for instruction bus
|
441 |
|
|
//
|
442 |
|
|
`define OR1200_ITAG_IDLE 4'h0 // idle bus
|
443 |
|
|
`define OR1200_ITAG_NI 4'h1 // normal insn
|
444 |
|
|
`define OR1200_ITAG_BE 4'hb // Bus error exception
|
445 |
|
|
`define OR1200_ITAG_PE 4'hc // Page fault exception
|
446 |
|
|
`define OR1200_ITAG_TE 4'hd // TLB miss exception
|
447 |
|
|
|
448 |
|
|
//
|
449 |
|
|
// TAGs for data bus
|
450 |
|
|
//
|
451 |
|
|
`define OR1200_DTAG_IDLE 4'h0 // idle bus
|
452 |
|
|
`define OR1200_DTAG_ND 4'h1 // normal data
|
453 |
|
|
`define OR1200_DTAG_AE 4'ha // Alignment exception
|
454 |
|
|
`define OR1200_DTAG_BE 4'hb // Bus error exception
|
455 |
|
|
`define OR1200_DTAG_PE 4'hc // Page fault exception
|
456 |
|
|
`define OR1200_DTAG_TE 4'hd // TLB miss exception
|
457 |
|
|
|
458 |
|
|
|
459 |
|
|
//////////////////////////////////////////////
|
460 |
|
|
//
|
461 |
|
|
// ORBIS32 ISA specifics
|
462 |
|
|
//
|
463 |
|
|
|
464 |
|
|
// SHROT_OP position in machine word
|
465 |
|
|
`define OR1200_SHROTOP_POS 7:6
|
466 |
|
|
|
467 |
|
|
// ALU instructions multicycle field in machine word
|
468 |
|
|
`define OR1200_ALUMCYC_POS 9:8
|
469 |
|
|
|
470 |
|
|
//
|
471 |
|
|
// Instruction opcode groups (basic)
|
472 |
|
|
//
|
473 |
|
|
`define OR1200_OR32_J 6'b000000
|
474 |
|
|
`define OR1200_OR32_JAL 6'b000001
|
475 |
|
|
`define OR1200_OR32_BNF 6'b000011
|
476 |
|
|
`define OR1200_OR32_BF 6'b000100
|
477 |
|
|
`define OR1200_OR32_NOP 6'b000101
|
478 |
|
|
`define OR1200_OR32_MOVHI 6'b000110
|
479 |
|
|
`define OR1200_OR32_XSYNC 6'b001000
|
480 |
|
|
`define OR1200_OR32_RFE 6'b001001
|
481 |
|
|
/* */
|
482 |
|
|
`define OR1200_OR32_JR 6'b010001
|
483 |
|
|
`define OR1200_OR32_JALR 6'b010010
|
484 |
|
|
`define OR1200_OR32_MACI 6'b010011
|
485 |
|
|
/* */
|
486 |
|
|
`define OR1200_OR32_LWZ 6'b100001
|
487 |
|
|
`define OR1200_OR32_LBZ 6'b100011
|
488 |
|
|
`define OR1200_OR32_LBS 6'b100100
|
489 |
|
|
`define OR1200_OR32_LHZ 6'b100101
|
490 |
|
|
`define OR1200_OR32_LHS 6'b100110
|
491 |
|
|
`define OR1200_OR32_ADDI 6'b100111
|
492 |
|
|
`define OR1200_OR32_ADDIC 6'b101000
|
493 |
|
|
`define OR1200_OR32_ANDI 6'b101001
|
494 |
|
|
`define OR1200_OR32_ORI 6'b101010
|
495 |
|
|
`define OR1200_OR32_XORI 6'b101011
|
496 |
|
|
`define OR1200_OR32_MULI 6'b101100
|
497 |
|
|
`define OR1200_OR32_MFSPR 6'b101101
|
498 |
|
|
`define OR1200_OR32_SH_ROTI 6'b101110
|
499 |
|
|
`define OR1200_OR32_SFXXI 6'b101111
|
500 |
|
|
/* */
|
501 |
|
|
`define OR1200_OR32_MTSPR 6'b110000
|
502 |
|
|
`define OR1200_OR32_MACMSB 6'b110001
|
503 |
|
|
/* */
|
504 |
|
|
`define OR1200_OR32_SW 6'b110101
|
505 |
|
|
`define OR1200_OR32_SB 6'b110110
|
506 |
|
|
`define OR1200_OR32_SH 6'b110111
|
507 |
|
|
`define OR1200_OR32_ALU 6'b111000
|
508 |
|
|
`define OR1200_OR32_SFXX 6'b111001
|
509 |
|
|
|
510 |
|
|
|
511 |
|
|
/////////////////////////////////////////////////////
|
512 |
|
|
//
|
513 |
|
|
// Exceptions
|
514 |
|
|
//
|
515 |
|
|
`define OR1200_EXCEPT_WIDTH 4
|
516 |
|
|
`define OR1200_EXCEPT_UNUSED `OR1200_EXCEPT_WIDTH'hf
|
517 |
|
|
`define OR1200_EXCEPT_TRAP `OR1200_EXCEPT_WIDTH'he
|
518 |
|
|
`define OR1200_EXCEPT_BREAK `OR1200_EXCEPT_WIDTH'hd
|
519 |
|
|
`define OR1200_EXCEPT_SYSCALL `OR1200_EXCEPT_WIDTH'hc
|
520 |
|
|
`define OR1200_EXCEPT_RANGE `OR1200_EXCEPT_WIDTH'hb
|
521 |
|
|
`define OR1200_EXCEPT_ITLBMISS `OR1200_EXCEPT_WIDTH'ha
|
522 |
|
|
`define OR1200_EXCEPT_DTLBMISS `OR1200_EXCEPT_WIDTH'h9
|
523 |
|
|
`define OR1200_EXCEPT_INT `OR1200_EXCEPT_WIDTH'h8
|
524 |
|
|
`define OR1200_EXCEPT_ILLEGAL `OR1200_EXCEPT_WIDTH'h7
|
525 |
|
|
`define OR1200_EXCEPT_ALIGN `OR1200_EXCEPT_WIDTH'h6
|
526 |
|
|
`define OR1200_EXCEPT_TICK `OR1200_EXCEPT_WIDTH'h5
|
527 |
|
|
`define OR1200_EXCEPT_IPF `OR1200_EXCEPT_WIDTH'h4
|
528 |
|
|
`define OR1200_EXCEPT_DPF `OR1200_EXCEPT_WIDTH'h3
|
529 |
|
|
`define OR1200_EXCEPT_BUSERR `OR1200_EXCEPT_WIDTH'h2
|
530 |
|
|
`define OR1200_EXCEPT_RESET `OR1200_EXCEPT_WIDTH'h1
|
531 |
|
|
`define OR1200_EXCEPT_NONE `OR1200_EXCEPT_WIDTH'h0
|
532 |
|
|
|
533 |
|
|
|
534 |
|
|
/////////////////////////////////////////////////////
|
535 |
|
|
//
|
536 |
|
|
// SPR groups
|
537 |
|
|
//
|
538 |
|
|
|
539 |
|
|
// Bits that define the group
|
540 |
|
|
`define OR1200_SPR_GROUP_BITS 15:11
|
541 |
|
|
|
542 |
|
|
// Width of the group bits
|
543 |
|
|
`define OR1200_SPR_GROUP_WIDTH 5
|
544 |
|
|
|
545 |
|
|
// Bits that define offset inside the group
|
546 |
|
|
`define OR1200_SPR_OFS_BITS 10:0
|
547 |
|
|
|
548 |
|
|
// List of groups
|
549 |
|
|
`define OR1200_SPR_GROUP_SYS 5'd00
|
550 |
|
|
`define OR1200_SPR_GROUP_DMMU 5'd01
|
551 |
|
|
`define OR1200_SPR_GROUP_IMMU 5'd02
|
552 |
|
|
`define OR1200_SPR_GROUP_DC 5'd03
|
553 |
|
|
`define OR1200_SPR_GROUP_IC 5'd04
|
554 |
|
|
`define OR1200_SPR_GROUP_MAC 5'd05
|
555 |
|
|
`define OR1200_SPR_GROUP_DU 5'd06
|
556 |
|
|
`define OR1200_SPR_GROUP_PM 5'd08
|
557 |
|
|
`define OR1200_SPR_GROUP_PIC 5'd09
|
558 |
|
|
`define OR1200_SPR_GROUP_TT 5'd10
|
559 |
|
|
|
560 |
|
|
|
561 |
|
|
/////////////////////////////////////////////////////
|
562 |
|
|
//
|
563 |
|
|
// System group
|
564 |
|
|
//
|
565 |
|
|
|
566 |
|
|
//
|
567 |
|
|
// System registers
|
568 |
|
|
//
|
569 |
|
|
`define OR1200_SPR_CFGR 7'd0
|
570 |
|
|
`define OR1200_SPR_RF 6'd32 // 1024 >> 5
|
571 |
|
|
`define OR1200_SPR_NPC 11'd16
|
572 |
|
|
`define OR1200_SPR_SR 11'd17
|
573 |
|
|
`define OR1200_SPR_PPC 11'd18
|
574 |
|
|
`define OR1200_SPR_EPCR 11'd32
|
575 |
|
|
`define OR1200_SPR_EEAR 11'd48
|
576 |
|
|
`define OR1200_SPR_ESR 11'd64
|
577 |
|
|
|
578 |
|
|
//
|
579 |
|
|
// SR bits
|
580 |
|
|
//
|
581 |
|
|
`define OR1200_SR_WIDTH 16
|
582 |
|
|
`define OR1200_SR_SM 0
|
583 |
|
|
`define OR1200_SR_TEE 1
|
584 |
|
|
`define OR1200_SR_IEE 2
|
585 |
|
|
`define OR1200_SR_DCE 3
|
586 |
|
|
`define OR1200_SR_ICE 4
|
587 |
|
|
`define OR1200_SR_DME 5
|
588 |
|
|
`define OR1200_SR_IME 6
|
589 |
|
|
`define OR1200_SR_LEE 7
|
590 |
|
|
`define OR1200_SR_CE 8
|
591 |
|
|
`define OR1200_SR_F 9
|
592 |
|
|
`define OR1200_SR_CY 10 // Unused
|
593 |
|
|
`define OR1200_SR_OV 11 // Unused
|
594 |
|
|
`define OR1200_SR_OVE 12 // Unused
|
595 |
|
|
`define OR1200_SR_DSX 13 // Unused
|
596 |
|
|
`define OR1200_SR_EPH 14
|
597 |
|
|
`define OR1200_SR_FO 15
|
598 |
|
|
`define OR1200_SR_CID 31:28 // Unimplemented
|
599 |
|
|
|
600 |
|
|
// Bits that define offset inside the group
|
601 |
|
|
`define OR1200_SPROFS_BITS 10:0
|
602 |
|
|
|
603 |
|
|
//
|
604 |
|
|
// VR, UPR and Configuration Registers
|
605 |
|
|
//
|
606 |
|
|
|
607 |
|
|
// Define if you want configuration registers implemented
|
608 |
|
|
`define OR1200_CFGR_IMPLEMENTED
|
609 |
|
|
|
610 |
|
|
// Define if you want full address decode inside SYS group
|
611 |
|
|
`define OR1200_SYS_FULL_DECODE
|
612 |
|
|
|
613 |
|
|
// Offsets of VR, UPR and CFGR registers
|
614 |
|
|
`define OR1200_SPRGRP_SYS_VR 4'h0
|
615 |
|
|
`define OR1200_SPRGRP_SYS_UPR 4'h1
|
616 |
|
|
`define OR1200_SPRGRP_SYS_CPUCFGR 4'h2
|
617 |
|
|
`define OR1200_SPRGRP_SYS_DMMUCFGR 4'h3
|
618 |
|
|
`define OR1200_SPRGRP_SYS_IMMUCFGR 4'h4
|
619 |
|
|
`define OR1200_SPRGRP_SYS_DCCFGR 4'h5
|
620 |
|
|
`define OR1200_SPRGRP_SYS_ICCFGR 4'h6
|
621 |
|
|
`define OR1200_SPRGRP_SYS_DCFGR 4'h7
|
622 |
|
|
|
623 |
|
|
// VR fields
|
624 |
|
|
`define OR1200_VR_REV_BITS 5:0
|
625 |
|
|
`define OR1200_VR_RES1_BITS 15:6
|
626 |
|
|
`define OR1200_VR_CFG_BITS 23:16
|
627 |
|
|
`define OR1200_VR_VER_BITS 31:24
|
628 |
|
|
|
629 |
|
|
// VR values
|
630 |
|
|
`define OR1200_VR_REV 6'h00
|
631 |
|
|
`define OR1200_VR_RES1 10'h000
|
632 |
|
|
`define OR1200_VR_CFG 8'h00
|
633 |
|
|
`define OR1200_VR_VER 8'h12
|
634 |
|
|
|
635 |
|
|
// UPR fields
|
636 |
|
|
`define OR1200_UPR_UP_BITS 0
|
637 |
|
|
`define OR1200_UPR_DCP_BITS 1
|
638 |
|
|
`define OR1200_UPR_ICP_BITS 2
|
639 |
|
|
`define OR1200_UPR_DMP_BITS 3
|
640 |
|
|
`define OR1200_UPR_IMP_BITS 4
|
641 |
|
|
`define OR1200_UPR_MP_BITS 5
|
642 |
|
|
`define OR1200_UPR_DUP_BITS 6
|
643 |
|
|
`define OR1200_UPR_PCUP_BITS 7
|
644 |
|
|
`define OR1200_UPR_PMP_BITS 8
|
645 |
|
|
`define OR1200_UPR_PICP_BITS 9
|
646 |
|
|
`define OR1200_UPR_TTP_BITS 10
|
647 |
|
|
`define OR1200_UPR_RES1_BITS 23:11
|
648 |
|
|
`define OR1200_UPR_CUP_BITS 31:24
|
649 |
|
|
|
650 |
|
|
// UPR values
|
651 |
|
|
`define OR1200_UPR_UP 1'b1
|
652 |
|
|
`define OR1200_UPR_DCP 1'b1
|
653 |
|
|
`define OR1200_UPR_ICP 1'b1
|
654 |
|
|
`define OR1200_UPR_DMP 1'b1
|
655 |
|
|
`define OR1200_UPR_IMP 1'b1
|
656 |
|
|
`define OR1200_UPR_MP 1'b1
|
657 |
|
|
`define OR1200_UPR_DUP 1'b1
|
658 |
|
|
`define OR1200_UPR_PCUP 1'b0
|
659 |
|
|
`define OR1200_UPR_PMP 1'b1
|
660 |
|
|
`define OR1200_UPR_PICP 1'b1
|
661 |
|
|
`define OR1200_UPR_TTP 1'b1
|
662 |
|
|
`define OR1200_UPR_RES1 13'h0000
|
663 |
|
|
`define OR1200_UPR_CUP 8'h00
|
664 |
|
|
|
665 |
|
|
// CPUCFGR fields
|
666 |
|
|
`define OR1200_CPUCFGR_NSGF_BITS 3:0
|
667 |
|
|
`define OR1200_CPUCFGR_HGF_BITS 4
|
668 |
|
|
`define OR1200_CPUCFGR_OB32S_BITS 5
|
669 |
|
|
`define OR1200_CPUCFGR_OB64S_BITS 6
|
670 |
|
|
`define OR1200_CPUCFGR_OF32S_BITS 7
|
671 |
|
|
`define OR1200_CPUCFGR_OF64S_BITS 8
|
672 |
|
|
`define OR1200_CPUCFGR_OV64S_BITS 9
|
673 |
|
|
`define OR1200_CPUCFGR_RES1_BITS 31:10
|
674 |
|
|
|
675 |
|
|
// CPUCFGR values
|
676 |
|
|
`define OR1200_CPUCFGR_NSGF 4'h0
|
677 |
|
|
`define OR1200_CPUCFGR_HGF 1'b0
|
678 |
|
|
`define OR1200_CPUCFGR_OB32S 1'b1
|
679 |
|
|
`define OR1200_CPUCFGR_OB64S 1'b0
|
680 |
|
|
`define OR1200_CPUCFGR_OF32S 1'b0
|
681 |
|
|
`define OR1200_CPUCFGR_OF64S 1'b0
|
682 |
|
|
`define OR1200_CPUCFGR_OV64S 1'b0
|
683 |
|
|
`define OR1200_CPUCFGR_RES1 22'h000000
|
684 |
|
|
|
685 |
|
|
// DMMUCFGR fields
|
686 |
|
|
`define OR1200_DMMUCFGR_NTW_BITS 1:0
|
687 |
|
|
`define OR1200_DMMUCFGR_NTS_BITS 4:2
|
688 |
|
|
`define OR1200_DMMUCFGR_NAE_BITS 7:5
|
689 |
|
|
`define OR1200_DMMUCFGR_CRI_BITS 8
|
690 |
|
|
`define OR1200_DMMUCFGR_PRI_BITS 9
|
691 |
|
|
`define OR1200_DMMUCFGR_TEIRI_BITS 10
|
692 |
|
|
`define OR1200_DMMUCFGR_HTR_BITS 11
|
693 |
|
|
`define OR1200_DMMUCFGR_RES1_BITS 31:12
|
694 |
|
|
|
695 |
|
|
// DMMUCFGR values
|
696 |
|
|
`define OR1200_DMMUCFGR_NTW 2'h0
|
697 |
|
|
`define OR1200_DMMUCFGR_NTS 3'h5
|
698 |
|
|
`define OR1200_DMMUCFGR_NAE 3'h0
|
699 |
|
|
`define OR1200_DMMUCFGR_CRI 1'b0
|
700 |
|
|
`define OR1200_DMMUCFGR_PRI 1'b0
|
701 |
|
|
`define OR1200_DMMUCFGR_TEIRI 1'b1
|
702 |
|
|
`define OR1200_DMMUCFGR_HTR 1'b0
|
703 |
|
|
`define OR1200_DMMUCFGR_RES1 20'h00000
|
704 |
|
|
|
705 |
|
|
// IMMUCFGR fields
|
706 |
|
|
`define OR1200_IMMUCFGR_NTW_BITS 1:0
|
707 |
|
|
`define OR1200_IMMUCFGR_NTS_BITS 4:2
|
708 |
|
|
`define OR1200_IMMUCFGR_NAE_BITS 7:5
|
709 |
|
|
`define OR1200_IMMUCFGR_CRI_BITS 8
|
710 |
|
|
`define OR1200_IMMUCFGR_PRI_BITS 9
|
711 |
|
|
`define OR1200_IMMUCFGR_TEIRI_BITS 10
|
712 |
|
|
`define OR1200_IMMUCFGR_HTR_BITS 11
|
713 |
|
|
`define OR1200_IMMUCFGR_RES1_BITS 31:12
|
714 |
|
|
|
715 |
|
|
// IMMUCFGR values
|
716 |
|
|
`define OR1200_IMMUCFGR_NTW 2'h0
|
717 |
|
|
`define OR1200_IMMUCFGR_NTS 3'h5
|
718 |
|
|
`define OR1200_IMMUCFGR_NAE 3'h0
|
719 |
|
|
`define OR1200_IMMUCFGR_CRI 1'b0
|
720 |
|
|
`define OR1200_IMMUCFGR_PRI 1'b0
|
721 |
|
|
`define OR1200_IMMUCFGR_TEIRI 1'b1
|
722 |
|
|
`define OR1200_IMMUCFGR_HTR 1'b0
|
723 |
|
|
`define OR1200_IMMUCFGR_RES1 20'h00000
|
724 |
|
|
|
725 |
|
|
// DCCFGR fields
|
726 |
|
|
`define OR1200_DCCFGR_NCW_BITS 2:0
|
727 |
|
|
`define OR1200_DCCFGR_NCS_BITS 6:3
|
728 |
|
|
`define OR1200_DCCFGR_CBS_BITS 7
|
729 |
|
|
`define OR1200_DCCFGR_CWS_BITS 8
|
730 |
|
|
`define OR1200_DCCFGR_CCRI_BITS 9
|
731 |
|
|
`define OR1200_DCCFGR_CBIRI_BITS 10
|
732 |
|
|
`define OR1200_DCCFGR_CBPRI_BITS 11
|
733 |
|
|
`define OR1200_DCCFGR_CBLRI_BITS 12
|
734 |
|
|
`define OR1200_DCCFGR_CBFRI_BITS 13
|
735 |
|
|
`define OR1200_DCCFGR_CBWBRI_BITS 14
|
736 |
|
|
`define OR1200_DCCFGR_RES1_BITS 31:15
|
737 |
|
|
|
738 |
|
|
// DCCFGR values
|
739 |
|
|
`define OR1200_DCCFGR_NCW 3'h0
|
740 |
|
|
`define OR1200_DCCFGR_NCS 4'h5
|
741 |
|
|
`define OR1200_DCCFGR_CBS 1'b0
|
742 |
|
|
`define OR1200_DCCFGR_CWS 1'b0
|
743 |
|
|
`define OR1200_DCCFGR_CCRI 1'b1
|
744 |
|
|
`define OR1200_DCCFGR_CBIRI 1'b1
|
745 |
|
|
`define OR1200_DCCFGR_CBPRI 1'b0
|
746 |
|
|
`define OR1200_DCCFGR_CBLRI 1'b0
|
747 |
|
|
`define OR1200_DCCFGR_CBFRI 1'b0
|
748 |
|
|
`define OR1200_DCCFGR_CBWBRI 1'b1
|
749 |
|
|
`define OR1200_DCCFGR_RES1 17'h00000
|
750 |
|
|
|
751 |
|
|
// ICCFGR fields
|
752 |
|
|
`define OR1200_ICCFGR_NCW_BITS 2:0
|
753 |
|
|
`define OR1200_ICCFGR_NCS_BITS 6:3
|
754 |
|
|
`define OR1200_ICCFGR_CBS_BITS 7
|
755 |
|
|
`define OR1200_ICCFGR_CWS_BITS 8
|
756 |
|
|
`define OR1200_ICCFGR_CCRI_BITS 9
|
757 |
|
|
`define OR1200_ICCFGR_CBIRI_BITS 10
|
758 |
|
|
`define OR1200_ICCFGR_CBPRI_BITS 11
|
759 |
|
|
`define OR1200_ICCFGR_CBLRI_BITS 12
|
760 |
|
|
`define OR1200_ICCFGR_CBFRI_BITS 13
|
761 |
|
|
`define OR1200_ICCFGR_CBWBRI_BITS 14
|
762 |
|
|
`define OR1200_ICCFGR_RES1_BITS 31:15
|
763 |
|
|
|
764 |
|
|
// ICCFGR values
|
765 |
|
|
`define OR1200_ICCFGR_NCW 3'h0
|
766 |
|
|
`define OR1200_ICCFGR_NCS 4'h5
|
767 |
|
|
`define OR1200_ICCFGR_CBS 1'b0
|
768 |
|
|
`define OR1200_ICCFGR_CWS 1'b0
|
769 |
|
|
`define OR1200_ICCFGR_CCRI 1'b1
|
770 |
|
|
`define OR1200_ICCFGR_CBIRI 1'b1
|
771 |
|
|
`define OR1200_ICCFGR_CBPRI 1'b0
|
772 |
|
|
`define OR1200_ICCFGR_CBLRI 1'b0
|
773 |
|
|
`define OR1200_ICCFGR_CBFRI 1'b0
|
774 |
|
|
`define OR1200_ICCFGR_CBWBRI 1'b1
|
775 |
|
|
`define OR1200_ICCFGR_RES1 17'h00000
|
776 |
|
|
|
777 |
|
|
// DCFGR fields
|
778 |
|
|
`define OR1200_DCFGR_NDP_BITS 2:0
|
779 |
|
|
`define OR1200_DCFGR_WPCI_BITS 3
|
780 |
|
|
`define OR1200_DCFGR_RES1_BITS 31:4
|
781 |
|
|
|
782 |
|
|
// DCFGR values
|
783 |
|
|
`define OR1200_DCFGR_NDP 3'h0
|
784 |
|
|
`define OR1200_DCFGR_WPCI 1'b0
|
785 |
|
|
`define OR1200_DCFGR_RES1 28'h0000000
|
786 |
|
|
|
787 |
|
|
|
788 |
|
|
/////////////////////////////////////////////////////
|
789 |
|
|
//
|
790 |
|
|
// Power Management (PM)
|
791 |
|
|
//
|
792 |
|
|
|
793 |
|
|
// Define it if you want PM implemented
|
794 |
|
|
`define OR1200_PM_IMPLEMENTED
|
795 |
|
|
|
796 |
|
|
// Bit positions inside PMR (don't change)
|
797 |
|
|
`define OR1200_PM_PMR_SDF 3:0
|
798 |
|
|
`define OR1200_PM_PMR_DME 4
|
799 |
|
|
`define OR1200_PM_PMR_SME 5
|
800 |
|
|
`define OR1200_PM_PMR_DCGE 6
|
801 |
|
|
`define OR1200_PM_PMR_UNUSED 31:7
|
802 |
|
|
|
803 |
|
|
// PMR offset inside PM group of registers
|
804 |
|
|
`define OR1200_PM_OFS_PMR 11'b0
|
805 |
|
|
|
806 |
|
|
// PM group
|
807 |
|
|
`define OR1200_SPRGRP_PM 5'd8
|
808 |
|
|
|
809 |
|
|
// Define if PMR can be read/written at any address inside PM group
|
810 |
|
|
`define OR1200_PM_PARTIAL_DECODING
|
811 |
|
|
|
812 |
|
|
// Define if reading PMR is allowed
|
813 |
|
|
`define OR1200_PM_READREGS
|
814 |
|
|
|
815 |
|
|
// Define if unused PMR bits should be zero
|
816 |
|
|
`define OR1200_PM_UNUSED_ZERO
|
817 |
|
|
|
818 |
|
|
|
819 |
|
|
/////////////////////////////////////////////////////
|
820 |
|
|
//
|
821 |
|
|
// Debug Unit (DU)
|
822 |
|
|
//
|
823 |
|
|
|
824 |
|
|
// Define it if you want DU implemented
|
825 |
|
|
`define OR1200_DU_IMPLEMENTED
|
826 |
|
|
|
827 |
|
|
// Address offsets of DU registers inside DU group
|
828 |
|
|
`define OR1200_DU_OFS_DMR1 5'd16
|
829 |
|
|
`define OR1200_DU_OFS_DMR2 5'd17
|
830 |
|
|
`define OR1200_DU_OFS_DSR 5'd20
|
831 |
|
|
`define OR1200_DU_OFS_DRR 5'd21
|
832 |
|
|
|
833 |
|
|
// Position of offset bits inside SPR address
|
834 |
|
|
`define OR1200_DUOFS_BITS 4:0
|
835 |
|
|
|
836 |
|
|
// Define if you want these DU registers to be implemented
|
837 |
|
|
`define OR1200_DU_DMR1
|
838 |
|
|
`define OR1200_DU_DMR2
|
839 |
|
|
`define OR1200_DU_DSR
|
840 |
|
|
`define OR1200_DU_DRR
|
841 |
|
|
|
842 |
|
|
// DMR1 bits
|
843 |
|
|
`define OR1200_DU_DMR1_ST 22
|
844 |
|
|
|
845 |
|
|
// DSR bits
|
846 |
|
|
`define OR1200_DU_DSR_WIDTH 14
|
847 |
|
|
`define OR1200_DU_DSR_RSTE 0
|
848 |
|
|
`define OR1200_DU_DSR_BUSEE 1
|
849 |
|
|
`define OR1200_DU_DSR_DPFE 2
|
850 |
|
|
`define OR1200_DU_DSR_IPFE 3
|
851 |
|
|
`define OR1200_DU_DSR_TTE 4
|
852 |
|
|
`define OR1200_DU_DSR_AE 5
|
853 |
|
|
`define OR1200_DU_DSR_IIE 6
|
854 |
|
|
`define OR1200_DU_DSR_IE 7
|
855 |
|
|
`define OR1200_DU_DSR_DME 8
|
856 |
|
|
`define OR1200_DU_DSR_IME 9
|
857 |
|
|
`define OR1200_DU_DSR_RE 10
|
858 |
|
|
`define OR1200_DU_DSR_SCE 11
|
859 |
|
|
`define OR1200_DU_DSR_BE 12
|
860 |
|
|
`define OR1200_DU_DSR_TE 13
|
861 |
|
|
|
862 |
|
|
// DRR bits
|
863 |
|
|
`define OR1200_DU_DRR_RSTE 0
|
864 |
|
|
`define OR1200_DU_DRR_BUSEE 1
|
865 |
|
|
`define OR1200_DU_DRR_DPFE 2
|
866 |
|
|
`define OR1200_DU_DRR_IPFE 3
|
867 |
|
|
`define OR1200_DU_DRR_TTE 4
|
868 |
|
|
`define OR1200_DU_DRR_AE 5
|
869 |
|
|
`define OR1200_DU_DRR_IIE 6
|
870 |
|
|
`define OR1200_DU_DRR_IE 7
|
871 |
|
|
`define OR1200_DU_DRR_DME 8
|
872 |
|
|
`define OR1200_DU_DRR_IME 9
|
873 |
|
|
`define OR1200_DU_DRR_RE 10
|
874 |
|
|
`define OR1200_DU_DRR_SCE 11
|
875 |
|
|
`define OR1200_DU_DRR_BE 12
|
876 |
|
|
`define OR1200_DU_DRR_TE 13
|
877 |
|
|
|
878 |
|
|
// Define if reading DU regs is allowed
|
879 |
|
|
`define OR1200_DU_READREGS
|
880 |
|
|
|
881 |
|
|
// Define if unused DU registers bits should be zero
|
882 |
|
|
`define OR1200_DU_UNUSED_ZERO
|
883 |
|
|
|
884 |
|
|
// DU operation commands
|
885 |
|
|
`define OR1200_DU_OP_READSPR 3'd4
|
886 |
|
|
`define OR1200_DU_OP_WRITESPR 3'd5
|
887 |
|
|
|
888 |
|
|
// Define if IF/LSU status is not needed by devel i/f
|
889 |
|
|
`define OR1200_DU_STATUS_UNIMPLEMENTED
|
890 |
|
|
|
891 |
|
|
/////////////////////////////////////////////////////
|
892 |
|
|
//
|
893 |
|
|
// Programmable Interrupt Controller (PIC)
|
894 |
|
|
//
|
895 |
|
|
|
896 |
|
|
// Define it if you want PIC implemented
|
897 |
|
|
`define OR1200_PIC_IMPLEMENTED
|
898 |
|
|
|
899 |
|
|
// Define number of interrupt inputs (2-31)
|
900 |
|
|
`define OR1200_PIC_INTS 20
|
901 |
|
|
|
902 |
|
|
// Address offsets of PIC registers inside PIC group
|
903 |
|
|
`define OR1200_PIC_OFS_PICMR 2'd0
|
904 |
|
|
`define OR1200_PIC_OFS_PICSR 2'd2
|
905 |
|
|
|
906 |
|
|
// Position of offset bits inside SPR address
|
907 |
|
|
`define OR1200_PICOFS_BITS 1:0
|
908 |
|
|
|
909 |
|
|
// Define if you want these PIC registers to be implemented
|
910 |
|
|
`define OR1200_PIC_PICMR
|
911 |
|
|
`define OR1200_PIC_PICSR
|
912 |
|
|
|
913 |
|
|
// Define if reading PIC registers is allowed
|
914 |
|
|
`define OR1200_PIC_READREGS
|
915 |
|
|
|
916 |
|
|
// Define if unused PIC register bits should be zero
|
917 |
|
|
`define OR1200_PIC_UNUSED_ZERO
|
918 |
|
|
|
919 |
|
|
|
920 |
|
|
/////////////////////////////////////////////////////
|
921 |
|
|
//
|
922 |
|
|
// Tick Timer (TT)
|
923 |
|
|
//
|
924 |
|
|
|
925 |
|
|
// Define it if you want TT implemented
|
926 |
|
|
`define OR1200_TT_IMPLEMENTED
|
927 |
|
|
|
928 |
|
|
// Address offsets of TT registers inside TT group
|
929 |
|
|
`define OR1200_TT_OFS_TTMR 1'd0
|
930 |
|
|
`define OR1200_TT_OFS_TTCR 1'd1
|
931 |
|
|
|
932 |
|
|
// Position of offset bits inside SPR group
|
933 |
|
|
`define OR1200_TTOFS_BITS 0
|
934 |
|
|
|
935 |
|
|
// Define if you want these TT registers to be implemented
|
936 |
|
|
`define OR1200_TT_TTMR
|
937 |
|
|
`define OR1200_TT_TTCR
|
938 |
|
|
|
939 |
|
|
// TTMR bits
|
940 |
|
|
`define OR1200_TT_TTMR_TP 27:0
|
941 |
|
|
`define OR1200_TT_TTMR_IP 28
|
942 |
|
|
`define OR1200_TT_TTMR_IE 29
|
943 |
|
|
`define OR1200_TT_TTMR_M 31:30
|
944 |
|
|
|
945 |
|
|
// Define if reading TT registers is allowed
|
946 |
|
|
`define OR1200_TT_READREGS
|
947 |
|
|
|
948 |
|
|
|
949 |
|
|
//////////////////////////////////////////////
|
950 |
|
|
//
|
951 |
|
|
// MAC
|
952 |
|
|
//
|
953 |
|
|
`define OR1200_MAC_ADDR 0 // MACLO 0xxxxxxxx1, MACHI 0xxxxxxxx0
|
954 |
|
|
`define OR1200_MAC_SPR_WE // Define if MACLO/MACHI are SPR writable
|
955 |
|
|
|
956 |
|
|
|
957 |
|
|
//////////////////////////////////////////////
|
958 |
|
|
//
|
959 |
|
|
// Data MMU (DMMU)
|
960 |
|
|
//
|
961 |
|
|
|
962 |
|
|
//
|
963 |
|
|
// Address that selects between TLB TR and MR
|
964 |
|
|
//
|
965 |
|
|
`define OR1200_DTLB_TM_ADDR 7
|
966 |
|
|
|
967 |
|
|
//
|
968 |
|
|
// DTLBMR fields
|
969 |
|
|
//
|
970 |
|
|
`define OR1200_DTLBMR_V_BITS 0
|
971 |
|
|
`define OR1200_DTLBMR_CID_BITS 4:1
|
972 |
|
|
`define OR1200_DTLBMR_RES_BITS 11:5
|
973 |
|
|
`define OR1200_DTLBMR_VPN_BITS 31:13
|
974 |
|
|
|
975 |
|
|
//
|
976 |
|
|
// DTLBTR fields
|
977 |
|
|
//
|
978 |
|
|
`define OR1200_DTLBTR_CC_BITS 0
|
979 |
|
|
`define OR1200_DTLBTR_CI_BITS 1
|
980 |
|
|
`define OR1200_DTLBTR_WBC_BITS 2
|
981 |
|
|
`define OR1200_DTLBTR_WOM_BITS 3
|
982 |
|
|
`define OR1200_DTLBTR_A_BITS 4
|
983 |
|
|
`define OR1200_DTLBTR_D_BITS 5
|
984 |
|
|
`define OR1200_DTLBTR_URE_BITS 6
|
985 |
|
|
`define OR1200_DTLBTR_UWE_BITS 7
|
986 |
|
|
`define OR1200_DTLBTR_SRE_BITS 8
|
987 |
|
|
`define OR1200_DTLBTR_SWE_BITS 9
|
988 |
|
|
`define OR1200_DTLBTR_RES_BITS 11:10
|
989 |
|
|
`define OR1200_DTLBTR_PPN_BITS 31:13
|
990 |
|
|
|
991 |
|
|
//
|
992 |
|
|
// DTLB configuration
|
993 |
|
|
//
|
994 |
|
|
`define OR1200_DMMU_PS 13 // 13 for 8KB page size
|
995 |
|
|
`define OR1200_DTLB_INDXW 6 // 6 for 64 entry DTLB 7 for 128 entries
|
996 |
|
|
`define OR1200_DTLB_INDXL `OR1200_DMMU_PS // 13 13
|
997 |
|
|
`define OR1200_DTLB_INDXH `OR1200_DMMU_PS+`OR1200_DTLB_INDXW-1 // 18 19
|
998 |
|
|
`define OR1200_DTLB_INDX `OR1200_DTLB_INDXH:`OR1200_DTLB_INDXL // 18:13 19:13
|
999 |
|
|
`define OR1200_DTLB_TAGW 32-`OR1200_DTLB_INDXW-`OR1200_DMMU_PS // 13 12
|
1000 |
|
|
`define OR1200_DTLB_TAGL `OR1200_DTLB_INDXH+1 // 19 20
|
1001 |
|
|
`define OR1200_DTLB_TAG 31:`OR1200_DTLB_TAGL // 31:19 31:20
|
1002 |
|
|
`define OR1200_DTLBMRW `OR1200_DTLB_TAGW+1 // +1 because of V bit
|
1003 |
|
|
`define OR1200_DTLBTRW 32-`OR1200_DMMU_PS+5 // +5 because of protection bits and CI
|
1004 |
|
|
|
1005 |
|
|
//
|
1006 |
|
|
// Cache inhibit while DMMU is not enabled/implemented
|
1007 |
|
|
//
|
1008 |
|
|
// cache inhibited 0GB-4GB 1'b1
|
1009 |
|
|
// cache inhibited 0GB-2GB !dcpu_adr_i[31]
|
1010 |
|
|
// cache inhibited 0GB-1GB 2GB-3GB !dcpu_adr_i[30]
|
1011 |
|
|
// cache inhibited 1GB-2GB 3GB-4GB dcpu_adr_i[30]
|
1012 |
|
|
// cache inhibited 2GB-4GB (default) dcpu_adr_i[31]
|
1013 |
|
|
// cached 0GB-4GB 1'b0
|
1014 |
|
|
//
|
1015 |
|
|
`define OR1200_DMMU_CI dcpu_adr_i[31]
|
1016 |
|
|
|
1017 |
|
|
|
1018 |
|
|
//////////////////////////////////////////////
|
1019 |
|
|
//
|
1020 |
|
|
// Insn MMU (IMMU)
|
1021 |
|
|
//
|
1022 |
|
|
|
1023 |
|
|
//
|
1024 |
|
|
// Address that selects between TLB TR and MR
|
1025 |
|
|
//
|
1026 |
|
|
`define OR1200_ITLB_TM_ADDR 7
|
1027 |
|
|
|
1028 |
|
|
//
|
1029 |
|
|
// ITLBMR fields
|
1030 |
|
|
//
|
1031 |
|
|
`define OR1200_ITLBMR_V_BITS 0
|
1032 |
|
|
`define OR1200_ITLBMR_CID_BITS 4:1
|
1033 |
|
|
`define OR1200_ITLBMR_RES_BITS 11:5
|
1034 |
|
|
`define OR1200_ITLBMR_VPN_BITS 31:13
|
1035 |
|
|
|
1036 |
|
|
//
|
1037 |
|
|
// ITLBTR fields
|
1038 |
|
|
//
|
1039 |
|
|
`define OR1200_ITLBTR_CC_BITS 0
|
1040 |
|
|
`define OR1200_ITLBTR_CI_BITS 1
|
1041 |
|
|
`define OR1200_ITLBTR_WBC_BITS 2
|
1042 |
|
|
`define OR1200_ITLBTR_WOM_BITS 3
|
1043 |
|
|
`define OR1200_ITLBTR_A_BITS 4
|
1044 |
|
|
`define OR1200_ITLBTR_D_BITS 5
|
1045 |
|
|
`define OR1200_ITLBTR_SXE_BITS 6
|
1046 |
|
|
`define OR1200_ITLBTR_UXE_BITS 7
|
1047 |
|
|
`define OR1200_ITLBTR_RES_BITS 11:8
|
1048 |
|
|
`define OR1200_ITLBTR_PPN_BITS 31:13
|
1049 |
|
|
|
1050 |
|
|
//
|
1051 |
|
|
// ITLB configuration
|
1052 |
|
|
//
|
1053 |
|
|
`define OR1200_IMMU_PS 13 // 13 for 8KB page size
|
1054 |
|
|
`define OR1200_ITLB_INDXW 6 // 6 for 64 entry ITLB 7 for 128 entries
|
1055 |
|
|
`define OR1200_ITLB_INDXL `OR1200_IMMU_PS // 13 13
|
1056 |
|
|
`define OR1200_ITLB_INDXH `OR1200_IMMU_PS+`OR1200_ITLB_INDXW-1 // 18 19
|
1057 |
|
|
`define OR1200_ITLB_INDX `OR1200_ITLB_INDXH:`OR1200_ITLB_INDXL // 18:13 19:13
|
1058 |
|
|
`define OR1200_ITLB_TAGW 32-`OR1200_ITLB_INDXW-`OR1200_IMMU_PS // 13 12
|
1059 |
|
|
`define OR1200_ITLB_TAGL `OR1200_ITLB_INDXH+1 // 19 20
|
1060 |
|
|
`define OR1200_ITLB_TAG 31:`OR1200_ITLB_TAGL // 31:19 31:20
|
1061 |
|
|
`define OR1200_ITLBMRW `OR1200_ITLB_TAGW+1 // +1 because of V bit
|
1062 |
|
|
`define OR1200_ITLBTRW 32-`OR1200_IMMU_PS+3 // +3 because of protection bits and CI
|
1063 |
|
|
|
1064 |
|
|
//
|
1065 |
|
|
// Cache inhibit while IMMU is not enabled/implemented
|
1066 |
|
|
// Note: all combinations that use icpu_adr_i cause async loop
|
1067 |
|
|
//
|
1068 |
|
|
// cache inhibited 0GB-4GB 1'b1
|
1069 |
|
|
// cache inhibited 0GB-2GB !icpu_adr_i[31]
|
1070 |
|
|
// cache inhibited 0GB-1GB 2GB-3GB !icpu_adr_i[30]
|
1071 |
|
|
// cache inhibited 1GB-2GB 3GB-4GB icpu_adr_i[30]
|
1072 |
|
|
// cache inhibited 2GB-4GB (default) icpu_adr_i[31]
|
1073 |
|
|
// cached 0GB-4GB 1'b0
|
1074 |
|
|
//
|
1075 |
|
|
`define OR1200_IMMU_CI 1'b0
|
1076 |
|
|
|
1077 |
|
|
|
1078 |
|
|
/////////////////////////////////////////////////
|
1079 |
|
|
//
|
1080 |
|
|
// Insn cache (IC)
|
1081 |
|
|
//
|
1082 |
|
|
|
1083 |
|
|
// 3 for 8 bytes, 4 for 16 bytes etc
|
1084 |
|
|
`define OR1200_ICLS 4
|
1085 |
|
|
|
1086 |
|
|
//
|
1087 |
|
|
// IC configurations
|
1088 |
|
|
//
|
1089 |
|
|
`ifdef OR1200_IC_1W_4KB
|
1090 |
|
|
`define OR1200_ICSIZE 12 // 4096
|
1091 |
|
|
`define OR1200_ICINDX `OR1200_ICSIZE-2 // 10
|
1092 |
|
|
`define OR1200_ICINDXH `OR1200_ICSIZE-1 // 11
|
1093 |
|
|
`define OR1200_ICTAGL `OR1200_ICINDXH+1 // 12
|
1094 |
|
|
`define OR1200_ICTAG `OR1200_ICSIZE-`OR1200_ICLS // 8
|
1095 |
|
|
`define OR1200_ICTAG_W 21
|
1096 |
|
|
`endif
|
1097 |
|
|
`ifdef OR1200_IC_1W_8KB
|
1098 |
|
|
`define OR1200_ICSIZE 13 // 8192
|
1099 |
|
|
`define OR1200_ICINDX `OR1200_ICSIZE-2 // 11
|
1100 |
|
|
`define OR1200_ICINDXH `OR1200_ICSIZE-1 // 12
|
1101 |
|
|
`define OR1200_ICTAGL `OR1200_ICINDXH+1 // 13
|
1102 |
|
|
`define OR1200_ICTAG `OR1200_ICSIZE-`OR1200_ICLS // 9
|
1103 |
|
|
`define OR1200_ICTAG_W 20
|
1104 |
|
|
`endif
|
1105 |
|
|
|
1106 |
|
|
|
1107 |
|
|
/////////////////////////////////////////////////
|
1108 |
|
|
//
|
1109 |
|
|
// Data cache (DC)
|
1110 |
|
|
//
|
1111 |
|
|
|
1112 |
|
|
// 3 for 8 bytes, 4 for 16 bytes etc
|
1113 |
|
|
`define OR1200_DCLS 4
|
1114 |
|
|
|
1115 |
|
|
// Define to perform store refill (potential performance penalty)
|
1116 |
|
|
// `define OR1200_DC_STORE_REFILL
|
1117 |
|
|
|
1118 |
|
|
//
|
1119 |
|
|
// DC configurations
|
1120 |
|
|
//
|
1121 |
|
|
`ifdef OR1200_DC_1W_4KB
|
1122 |
|
|
`define OR1200_DCSIZE 12 // 4096
|
1123 |
|
|
`define OR1200_DCINDX `OR1200_DCSIZE-2 // 10
|
1124 |
|
|
`define OR1200_DCINDXH `OR1200_DCSIZE-1 // 11
|
1125 |
|
|
`define OR1200_DCTAGL `OR1200_DCINDXH+1 // 12
|
1126 |
|
|
`define OR1200_DCTAG `OR1200_DCSIZE-`OR1200_DCLS // 8
|
1127 |
|
|
`define OR1200_DCTAG_W 21
|
1128 |
|
|
`endif
|
1129 |
|
|
`ifdef OR1200_DC_1W_8KB
|
1130 |
|
|
`define OR1200_DCSIZE 13 // 8192
|
1131 |
|
|
`define OR1200_DCINDX `OR1200_DCSIZE-2 // 11
|
1132 |
|
|
`define OR1200_DCINDXH `OR1200_DCSIZE-1 // 12
|
1133 |
|
|
`define OR1200_DCTAGL `OR1200_DCINDXH+1 // 13
|
1134 |
|
|
`define OR1200_DCTAG `OR1200_DCSIZE-`OR1200_DCLS // 9
|
1135 |
|
|
`define OR1200_DCTAG_W 20
|
1136 |
|
|
`endif
|