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

Subversion Repositories or1k

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

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

powered by: WebSVN 2.1.0

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