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

Subversion Repositories or1k

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

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

powered by: WebSVN 2.1.0

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