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

Subversion Repositories or1k

[/] [or1k/] [tags/] [rel_1/] [or1200/] [rtl/] [verilog/] [or1200_defines.v] - Blame information for rev 1780

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

powered by: WebSVN 2.1.0

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