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