OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [branches/] [branch_speed_opt/] [or1200/] [rtl/] [verilog/] [or1200_defines.v] - Blame information for rev 1023

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.