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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or1200/] [rtl/] [verilog/] [or1200_defines.v] - Blame information for rev 302

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

Line No. Rev Author Line
1 10 unneback
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  OR1200's definitions                                        ////
4
////                                                              ////
5
////  This file is part of the OpenRISC 1200 project              ////
6 185 julius
////  http://opencores.org/project,or1k                           ////
7 10 unneback
////                                                              ////
8
////  Description                                                 ////
9 185 julius
////  Defines for the OR1200 core                                 ////
10 10 unneback
////                                                              ////
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 141 marcus.erl
// $Log: or1200_defines.v,v $
45
// Revision 2.0  2010/06/30 11:00:00  ORSoC
46
// Minor update: 
47
// Defines added, bugs fixed. 
48 10 unneback
 
49
//
50
// Dump VCD
51
//
52
//`define OR1200_VCD_DUMP
53
 
54
//
55
// Generate debug messages during simulation
56
//
57
//`define OR1200_VERBOSE
58
 
59
//  `define OR1200_ASIC
60
////////////////////////////////////////////////////////
61
//
62
// Typical configuration for an ASIC
63
//
64
`ifdef OR1200_ASIC
65
 
66
//
67
// Target ASIC memories
68
//
69
//`define OR1200_ARTISAN_SSP
70
//`define OR1200_ARTISAN_SDP
71
//`define OR1200_ARTISAN_STP
72
`define OR1200_VIRTUALSILICON_SSP
73
//`define OR1200_VIRTUALSILICON_STP_T1
74
//`define OR1200_VIRTUALSILICON_STP_T2
75
 
76
//
77
// Do not implement Data cache
78
//
79
//`define OR1200_NO_DC
80
 
81
//
82
// Do not implement Insn cache
83
//
84
//`define OR1200_NO_IC
85
 
86
//
87
// Do not implement Data MMU
88
//
89
//`define OR1200_NO_DMMU
90
 
91
//
92
// Do not implement Insn MMU
93
//
94
//`define OR1200_NO_IMMU
95
 
96
//
97
// Select between ASIC optimized and generic multiplier
98
//
99
//`define OR1200_ASIC_MULTP2_32X32
100
`define OR1200_GENERIC_MULTP2_32X32
101
 
102
//
103
// Size/type of insn/data cache if implemented
104
//
105
// `define OR1200_IC_1W_512B
106
// `define OR1200_IC_1W_4KB
107
`define OR1200_IC_1W_8KB
108
// `define OR1200_DC_1W_4KB
109
`define OR1200_DC_1W_8KB
110
 
111
`else
112
 
113
 
114
/////////////////////////////////////////////////////////
115
//
116
// Typical configuration for an FPGA
117
//
118
 
119
//
120
// Target FPGA memories
121
//
122
//`define OR1200_ALTERA_LPM
123
//`define OR1200_XILINX_RAMB16
124
//`define OR1200_XILINX_RAMB4
125
//`define OR1200_XILINX_RAM32X1D
126
//`define OR1200_USE_RAM16X1D_FOR_RAM32X1D
127 258 julius
// Generic models should infer RAM blocks at synthesis time (not only effects 
128
// single port ram.)
129
`define OR1200_GENERIC
130 10 unneback
 
131
//
132
// Do not implement Data cache
133
//
134 258 julius
//`define OR1200_NO_DC
135 10 unneback
 
136
//
137
// Do not implement Insn cache
138
//
139 141 marcus.erl
//`define OR1200_NO_IC
140 10 unneback
 
141
//
142
// Do not implement Data MMU
143
//
144 141 marcus.erl
//`define OR1200_NO_DMMU
145 10 unneback
 
146
//
147
// Do not implement Insn MMU
148
//
149 141 marcus.erl
//`define OR1200_NO_IMMU
150 10 unneback
 
151
//
152
// Select between ASIC and generic multiplier
153
//
154
// (Generic seems to trigger a bug in the Cadence Ncsim simulator)
155
//
156
//`define OR1200_ASIC_MULTP2_32X32
157
`define OR1200_GENERIC_MULTP2_32X32
158
 
159
//
160
// Size/type of insn/data cache if implemented
161
// (consider available FPGA memory resources)
162
//
163
//`define OR1200_IC_1W_512B
164 141 marcus.erl
//`define OR1200_IC_1W_4KB
165
`define OR1200_IC_1W_8KB
166 258 julius
//`define OR1200_DC_1W_4KB
167
`define OR1200_DC_1W_8KB
168 10 unneback
 
169
`endif
170
 
171
 
172
//////////////////////////////////////////////////////////
173
//
174
// Do not change below unless you know what you are doing
175
//
176
 
177
//
178
// Enable RAM BIST
179
//
180
// At the moment this only works for Virtual Silicon
181
// single port RAMs. For other RAMs it has not effect.
182
// Special wrapper for VS RAMs needs to be provided
183
// with scan flops to facilitate bist scan.
184
//
185
//`define OR1200_BIST
186
 
187
//
188
// Register OR1200 WISHBONE outputs
189
// (must be defined/enabled)
190
//
191
`define OR1200_REGISTERED_OUTPUTS
192
 
193
//
194
// Register OR1200 WISHBONE inputs
195
//
196
// (must be undefined/disabled)
197
//
198
//`define OR1200_REGISTERED_INPUTS
199
 
200
//
201
// Disable bursts if they are not supported by the
202
// memory subsystem (only affect cache line fill)
203
//
204
//`define OR1200_NO_BURSTS
205
//
206
 
207
//
208
// WISHBONE retry counter range
209
//
210
// 2^value range for retry counter. Retry counter
211
// is activated whenever *wb_rty_i is asserted and
212
// until retry counter expires, corresponding
213
// WISHBONE interface is deactivated.
214
//
215
// To disable retry counters and *wb_rty_i all together,
216
// undefine this macro.
217
//
218
//`define OR1200_WB_RETRY 7
219
 
220
//
221
// WISHBONE Consecutive Address Burst
222
//
223
// This was used prior to WISHBONE B3 specification
224
// to identify bursts. It is no longer needed but
225
// remains enabled for compatibility with old designs.
226
//
227
// To remove *wb_cab_o ports undefine this macro.
228
//
229 141 marcus.erl
//`define OR1200_WB_CAB
230 10 unneback
 
231
//
232
// WISHBONE B3 compatible interface
233
//
234
// This follows the WISHBONE B3 specification.
235
// It is not enabled by default because most
236
// designs still don't use WB b3.
237
//
238
// To enable *wb_cti_o/*wb_bte_o ports,
239
// define this macro.
240
//
241 141 marcus.erl
`define OR1200_WB_B3
242 10 unneback
 
243
//
244 141 marcus.erl
// LOG all WISHBONE accesses
245
//
246
`define OR1200_LOG_WB_ACCESS
247
 
248
//
249 10 unneback
// Enable additional synthesis directives if using
250
// _Synopsys_ synthesis tool
251
//
252
//`define OR1200_ADDITIONAL_SYNOPSYS_DIRECTIVES
253
 
254
//
255
// Enables default statement in some case blocks
256
// and disables Synopsys synthesis directive full_case
257
//
258
// By default it is enabled. When disabled it
259
// can increase clock frequency.
260
//
261
`define OR1200_CASE_DEFAULT
262
 
263
//
264
// Operand width / register file address width
265
//
266
// (DO NOT CHANGE)
267
//
268
`define OR1200_OPERAND_WIDTH            32
269
`define OR1200_REGFILE_ADDR_WIDTH       5
270
 
271
//
272
// l.add/l.addi/l.and and optional l.addc/l.addic
273
// also set (compare) flag when result of their
274
// operation equals zero
275
//
276
// At the time of writing this, default or32
277
// C/C++ compiler doesn't generate code that
278
// would benefit from this optimization.
279
//
280
// By default this optimization is disabled to
281
// save area.
282
//
283
//`define OR1200_ADDITIONAL_FLAG_MODIFIERS
284
 
285
//
286
// Implement l.addc/l.addic instructions
287
//
288
// By default implementation of l.addc/l.addic
289
// instructions is enabled in case you need them.
290
// If you don't use them, then disable implementation
291
// to save area.
292
//
293 141 marcus.erl
//`define OR1200_IMPL_ADDC
294 10 unneback
 
295
//
296 141 marcus.erl
// Implement l.sub instruction
297
//
298
// By default implementation of l.sub instructions
299
// is enabled to be compliant with the simulator.
300
// If you don't use carry bit, then disable
301
// implementation to save area.
302
//
303
`define OR1200_IMPL_SUB
304
 
305
//
306 10 unneback
// Implement carry bit SR[CY]
307
//
308 141 marcus.erl
//
309 10 unneback
// By default implementation of SR[CY] is enabled
310 141 marcus.erl
// to be compliant with the simulator. However SR[CY]
311
// is explicitly only used by l.addc/l.addic/l.sub
312
// instructions and if these three insns are not
313 10 unneback
// implemented there is not much point having SR[CY].
314
//
315 141 marcus.erl
//`define OR1200_IMPL_CY
316 10 unneback
 
317
//
318
// Implement rotate in the ALU
319
//
320
// At the time of writing this, or32
321
// C/C++ compiler doesn't generate rotate
322
// instructions. However or32 assembler
323
// can assemble code that uses rotate insn.
324
// This means that rotate instructions
325
// must be used manually inserted.
326
//
327
// By default implementation of rotate
328
// is disabled to save area and increase
329
// clock frequency.
330
//
331
//`define OR1200_IMPL_ALU_ROTATE
332
 
333
//
334
// Type of ALU compare to implement
335
//
336
// Try either one to find what yields
337
// higher clock frequencyin your case.
338
//
339
//`define OR1200_IMPL_ALU_COMP1
340
`define OR1200_IMPL_ALU_COMP2
341
 
342
//
343
// Implement multiplier
344
//
345
// By default multiplier is implemented
346
//
347 258 julius
`define OR1200_MULT_IMPLEMENTED
348 10 unneback
 
349
//
350
// Implement multiply-and-accumulate
351
//
352
// By default MAC is implemented. To
353
// implement MAC, multiplier needs to be
354
// implemented.
355
//
356 258 julius
`define OR1200_MAC_IMPLEMENTED
357 10 unneback
 
358
//
359 258 julius
// Implement optional l.div/l.divu instructions
360
//
361
// By default divide instructions are not implemented
362
// to save area and increase clock frequency. or32 C/C++
363
// compiler can use soft library for division.
364
//
365
// To implement divide, both multiplier and MAC needs to be implemented.
366
//
367
`define OR1200_DIV_IMPLEMENTED
368
 
369
//
370 10 unneback
// Low power, slower multiplier
371
//
372
// Select between low-power (larger) multiplier
373
// and faster multiplier. The actual difference
374
// is only AND logic that prevents distribution
375
// of operands into the multiplier when instruction
376
// in execution is not multiply instruction
377
//
378
//`define OR1200_LOWPWR_MULT
379
 
380
//
381 185 julius
// Implement HW Single Precision FPU
382
//
383
//`define OR1200_FPU_IMPLEMENTED
384 258 julius
//
385 185 julius
 
386
//
387 10 unneback
// Clock ratio RISC clock versus WB clock
388
//
389
// If you plan to run WB:RISC clock fixed to 1:1, disable
390
// both defines
391
//
392
// For WB:RISC 1:2 or 1:1, enable OR1200_CLKDIV_2_SUPPORTED
393
// and use clmode to set ratio
394
//
395
// For WB:RISC 1:4, 1:2 or 1:1, enable both defines and use
396
// clmode to set ratio
397
//
398 141 marcus.erl
//`define OR1200_CLKDIV_2_SUPPORTED
399 10 unneback
//`define OR1200_CLKDIV_4_SUPPORTED
400
 
401
//
402
// Type of register file RAM
403
//
404
// Memory macro w/ two ports (see or1200_tpram_32x32.v)
405
//`define OR1200_RFRAM_TWOPORT
406
//
407 258 julius
// Memory macro dual port (see or1200_dpram.v)
408 141 marcus.erl
`define OR1200_RFRAM_DUALPORT
409
 
410 10 unneback
//
411
// Generic (flip-flop based) register file (see or1200_rfram_generic.v)
412 141 marcus.erl
//`define OR1200_RFRAM_GENERIC
413
//  Generic register file supports - 16 registers 
414
`ifdef OR1200_RFRAM_GENERIC
415
//    `define OR1200_RFRAM_16REG
416
`endif
417 10 unneback
 
418
//
419
// Type of mem2reg aligner to implement.
420
//
421
// Once OR1200_IMPL_MEM2REG2 yielded faster
422
// circuit, however with today tools it will
423
// most probably give you slower circuit.
424
//
425
`define OR1200_IMPL_MEM2REG1
426
//`define OR1200_IMPL_MEM2REG2
427
 
428
//
429
// ALUOPs
430
//
431
`define OR1200_ALUOP_WIDTH      4
432
`define OR1200_ALUOP_NOP        4'd4
433
/* Order defined by arith insns that have two source operands both in regs
434
   (see binutils/include/opcode/or32.h) */
435
`define OR1200_ALUOP_ADD        4'd0
436
`define OR1200_ALUOP_ADDC       4'd1
437
`define OR1200_ALUOP_SUB        4'd2
438
`define OR1200_ALUOP_AND        4'd3
439
`define OR1200_ALUOP_OR         4'd4
440
`define OR1200_ALUOP_XOR        4'd5
441
`define OR1200_ALUOP_MUL        4'd6
442
`define OR1200_ALUOP_CUST5      4'd7
443
`define OR1200_ALUOP_SHROT      4'd8
444
`define OR1200_ALUOP_DIV        4'd9
445
`define OR1200_ALUOP_DIVU       4'd10
446
/* Order not specifically defined. */
447
`define OR1200_ALUOP_IMM        4'd11
448
`define OR1200_ALUOP_MOVHI      4'd12
449
`define OR1200_ALUOP_COMP       4'd13
450
`define OR1200_ALUOP_MTSR       4'd14
451
`define OR1200_ALUOP_MFSR       4'd15
452 141 marcus.erl
`define OR1200_ALUOP_CMOV       4'd14
453
`define OR1200_ALUOP_FF1        4'd15
454 10 unneback
//
455
// MACOPs
456
//
457 141 marcus.erl
`define OR1200_MACOP_WIDTH      3
458
`define OR1200_MACOP_NOP        3'b000
459
`define OR1200_MACOP_MAC        3'b001
460
`define OR1200_MACOP_MSB        3'b010
461 10 unneback
 
462
//
463
// Shift/rotate ops
464
//
465
`define OR1200_SHROTOP_WIDTH    2
466
`define OR1200_SHROTOP_NOP      2'd0
467
`define OR1200_SHROTOP_SLL      2'd0
468
`define OR1200_SHROTOP_SRL      2'd1
469
`define OR1200_SHROTOP_SRA      2'd2
470
`define OR1200_SHROTOP_ROR      2'd3
471
 
472
// Execution cycles per instruction
473 185 julius
`define OR1200_MULTICYCLE_WIDTH 3
474
`define OR1200_ONE_CYCLE                3'd0
475
`define OR1200_TWO_CYCLES               3'd1
476 10 unneback
 
477 258 julius
// Execution control which will "wait on" a module to finish
478
`define OR1200_WAIT_ON_WIDTH 2
479
`define OR1200_WAIT_ON_FPU `OR1200_WAIT_ON_WIDTH'd1
480
`define OR1200_WAIT_ON_MTSPR `OR1200_WAIT_ON_WIDTH'd2
481
 
482 10 unneback
// Operand MUX selects
483
`define OR1200_SEL_WIDTH                2
484
`define OR1200_SEL_RF                   2'd0
485
`define OR1200_SEL_IMM                  2'd1
486
`define OR1200_SEL_EX_FORW              2'd2
487
`define OR1200_SEL_WB_FORW              2'd3
488
 
489
//
490
// BRANCHOPs
491
//
492
`define OR1200_BRANCHOP_WIDTH           3
493
`define OR1200_BRANCHOP_NOP             3'd0
494
`define OR1200_BRANCHOP_J               3'd1
495
`define OR1200_BRANCHOP_JR              3'd2
496
`define OR1200_BRANCHOP_BAL             3'd3
497
`define OR1200_BRANCHOP_BF              3'd4
498
`define OR1200_BRANCHOP_BNF             3'd5
499
`define OR1200_BRANCHOP_RFE             3'd6
500
 
501
//
502
// LSUOPs
503
//
504
// Bit 0: sign extend
505
// Bits 1-2: 00 doubleword, 01 byte, 10 halfword, 11 singleword
506
// Bit 3: 0 load, 1 store
507
`define OR1200_LSUOP_WIDTH              4
508
`define OR1200_LSUOP_NOP                4'b0000
509
`define OR1200_LSUOP_LBZ                4'b0010
510
`define OR1200_LSUOP_LBS                4'b0011
511
`define OR1200_LSUOP_LHZ                4'b0100
512
`define OR1200_LSUOP_LHS                4'b0101
513
`define OR1200_LSUOP_LWZ                4'b0110
514
`define OR1200_LSUOP_LWS                4'b0111
515 141 marcus.erl
`define OR1200_LSUOP_LD                 4'b0001
516
`define OR1200_LSUOP_SD                 4'b1000
517
`define OR1200_LSUOP_SB                 4'b1010
518
`define OR1200_LSUOP_SH                 4'b1100
519
`define OR1200_LSUOP_SW                 4'b1110
520 10 unneback
 
521 141 marcus.erl
// Number of bits of load/store EA precalculated in ID stage
522
// for balancing ID and EX stages.
523
//
524
// Valid range: 2,3,...,30,31
525
`define OR1200_LSUEA_PRECALC            2
526
 
527 10 unneback
// FETCHOPs
528
`define OR1200_FETCHOP_WIDTH            1
529
`define OR1200_FETCHOP_NOP              1'b0
530
`define OR1200_FETCHOP_LW               1'b1
531
 
532
//
533
// Register File Write-Back OPs
534
//
535
// Bit 0: register file write enable
536 185 julius
// Bits 3-1: write-back mux selects
537
//
538
 `define OR1200_RFWBOP_WIDTH            4
539
 `define OR1200_RFWBOP_NOP              4'b0000
540
 `define OR1200_RFWBOP_ALU              3'b000
541
 `define OR1200_RFWBOP_LSU              3'b001
542
 `define OR1200_RFWBOP_SPRS             3'b010
543
 `define OR1200_RFWBOP_LR               3'b011
544
 `define OR1200_RFWBOP_FPU              3'b100
545 10 unneback
 
546
// Compare instructions
547
`define OR1200_COP_SFEQ       3'b000
548
`define OR1200_COP_SFNE       3'b001
549
`define OR1200_COP_SFGT       3'b010
550
`define OR1200_COP_SFGE       3'b011
551
`define OR1200_COP_SFLT       3'b100
552
`define OR1200_COP_SFLE       3'b101
553
`define OR1200_COP_X          3'b111
554
`define OR1200_SIGNED_COMPARE 'd3
555
`define OR1200_COMPOP_WIDTH     4
556
 
557
//
558 185 julius
// FP OPs
559
//
560
// MSbit indicates FPU operation valid
561
//
562
`define OR1200_FPUOP_WIDTH      8
563
// FPU unit from Usselman takes 5 cycles from decode, so 4 ex. cycles
564
`define OR1200_FPUOP_CYCLES 3'd4
565
// FP instruction is double precision if bit 4 is set. We're a 32-bit 
566
// implementation thus do not support double precision FP 
567
`define OR1200_FPUOP_DOUBLE_BIT 4
568
`define OR1200_FPUOP_ADD  8'b0000_0000
569
`define OR1200_FPUOP_SUB  8'b0000_0001
570
`define OR1200_FPUOP_MUL  8'b0000_0010
571
`define OR1200_FPUOP_DIV  8'b0000_0011
572
`define OR1200_FPUOP_ITOF 8'b0000_0100
573
`define OR1200_FPUOP_FTOI 8'b0000_0101
574
`define OR1200_FPUOP_REM  8'b0000_0110
575
`define OR1200_FPUOP_RESERVED  8'b0000_0111
576
// FP Compare instructions
577
`define OR1200_FPCOP_SFEQ 8'b0000_1000
578
`define OR1200_FPCOP_SFNE 8'b0000_1001
579
`define OR1200_FPCOP_SFGT 8'b0000_1010
580
`define OR1200_FPCOP_SFGE 8'b0000_1011
581
`define OR1200_FPCOP_SFLT 8'b0000_1100
582
`define OR1200_FPCOP_SFLE 8'b0000_1101
583
 
584
//
585 10 unneback
// TAGs for instruction bus
586
//
587
`define OR1200_ITAG_IDLE        4'h0    // idle bus
588
`define OR1200_ITAG_NI          4'h1    // normal insn
589
`define OR1200_ITAG_BE          4'hb    // Bus error exception
590
`define OR1200_ITAG_PE          4'hc    // Page fault exception
591
`define OR1200_ITAG_TE          4'hd    // TLB miss exception
592
 
593
//
594
// TAGs for data bus
595
//
596
`define OR1200_DTAG_IDLE        4'h0    // idle bus
597
`define OR1200_DTAG_ND          4'h1    // normal data
598
`define OR1200_DTAG_AE          4'ha    // Alignment exception
599
`define OR1200_DTAG_BE          4'hb    // Bus error exception
600
`define OR1200_DTAG_PE          4'hc    // Page fault exception
601
`define OR1200_DTAG_TE          4'hd    // TLB miss exception
602
 
603
 
604
//////////////////////////////////////////////
605
//
606
// ORBIS32 ISA specifics
607
//
608
 
609
// SHROT_OP position in machine word
610
`define OR1200_SHROTOP_POS              7:6
611
 
612
// ALU instructions multicycle field in machine word
613
`define OR1200_ALUMCYC_POS              9:8
614
 
615
//
616
// Instruction opcode groups (basic)
617
//
618
`define OR1200_OR32_J                 6'b000000
619
`define OR1200_OR32_JAL               6'b000001
620
`define OR1200_OR32_BNF               6'b000011
621
`define OR1200_OR32_BF                6'b000100
622
`define OR1200_OR32_NOP               6'b000101
623
`define OR1200_OR32_MOVHI             6'b000110
624
`define OR1200_OR32_XSYNC             6'b001000
625
`define OR1200_OR32_RFE               6'b001001
626
/* */
627
`define OR1200_OR32_JR                6'b010001
628
`define OR1200_OR32_JALR              6'b010010
629
`define OR1200_OR32_MACI              6'b010011
630
/* */
631
`define OR1200_OR32_LWZ               6'b100001
632
`define OR1200_OR32_LBZ               6'b100011
633
`define OR1200_OR32_LBS               6'b100100
634
`define OR1200_OR32_LHZ               6'b100101
635
`define OR1200_OR32_LHS               6'b100110
636
`define OR1200_OR32_ADDI              6'b100111
637
`define OR1200_OR32_ADDIC             6'b101000
638
`define OR1200_OR32_ANDI              6'b101001
639
`define OR1200_OR32_ORI               6'b101010
640
`define OR1200_OR32_XORI              6'b101011
641
`define OR1200_OR32_MULI              6'b101100
642
`define OR1200_OR32_MFSPR             6'b101101
643
`define OR1200_OR32_SH_ROTI           6'b101110
644
`define OR1200_OR32_SFXXI             6'b101111
645
/* */
646
`define OR1200_OR32_MTSPR             6'b110000
647
`define OR1200_OR32_MACMSB            6'b110001
648 185 julius
`define OR1200_OR32_FLOAT             6'b110010
649 10 unneback
/* */
650
`define OR1200_OR32_SW                6'b110101
651
`define OR1200_OR32_SB                6'b110110
652
`define OR1200_OR32_SH                6'b110111
653
`define OR1200_OR32_ALU               6'b111000
654
`define OR1200_OR32_SFXX              6'b111001
655
//`define OR1200_OR32_CUST5             6'b111100
656
 
657
 
658
/////////////////////////////////////////////////////
659
//
660
// Exceptions
661
//
662
 
663
//
664
// Exception vectors per OR1K architecture:
665
// 0xPPPPP100 - reset
666
// 0xPPPPP200 - bus error
667
// ... etc
668
// where P represents exception prefix.
669
//
670
// Exception vectors can be customized as per
671
// the following formula:
672
// 0xPPPPPNVV - exception N
673
//
674
// P represents exception prefix
675
// N represents exception N
676
// VV represents length of the individual vector space,
677
//   usually it is 8 bits wide and starts with all bits zero
678
//
679
 
680
//
681
// PPPPP and VV parts
682
//
683
// Sum of these two defines needs to be 28
684
//
685 141 marcus.erl
`define OR1200_EXCEPT_EPH0_P    20'h00000
686
`define OR1200_EXCEPT_EPH1_P    20'hF0000
687
`define OR1200_EXCEPT_V             8'h00
688 10 unneback
 
689
//
690
// N part width
691
//
692
`define OR1200_EXCEPT_WIDTH 4
693
 
694
//
695
// Definition of exception vectors
696
//
697
// To avoid implementation of a certain exception,
698
// simply comment out corresponding line
699
//
700
`define OR1200_EXCEPT_UNUSED            `OR1200_EXCEPT_WIDTH'hf
701
`define OR1200_EXCEPT_TRAP              `OR1200_EXCEPT_WIDTH'he
702 185 julius
`define OR1200_EXCEPT_FLOAT             `OR1200_EXCEPT_WIDTH'hd
703 10 unneback
`define OR1200_EXCEPT_SYSCALL           `OR1200_EXCEPT_WIDTH'hc
704
`define OR1200_EXCEPT_RANGE             `OR1200_EXCEPT_WIDTH'hb
705
`define OR1200_EXCEPT_ITLBMISS          `OR1200_EXCEPT_WIDTH'ha
706
`define OR1200_EXCEPT_DTLBMISS          `OR1200_EXCEPT_WIDTH'h9
707
`define OR1200_EXCEPT_INT               `OR1200_EXCEPT_WIDTH'h8
708
`define OR1200_EXCEPT_ILLEGAL           `OR1200_EXCEPT_WIDTH'h7
709
`define OR1200_EXCEPT_ALIGN             `OR1200_EXCEPT_WIDTH'h6
710
`define OR1200_EXCEPT_TICK              `OR1200_EXCEPT_WIDTH'h5
711
`define OR1200_EXCEPT_IPF               `OR1200_EXCEPT_WIDTH'h4
712
`define OR1200_EXCEPT_DPF               `OR1200_EXCEPT_WIDTH'h3
713
`define OR1200_EXCEPT_BUSERR            `OR1200_EXCEPT_WIDTH'h2
714
`define OR1200_EXCEPT_RESET             `OR1200_EXCEPT_WIDTH'h1
715
`define OR1200_EXCEPT_NONE              `OR1200_EXCEPT_WIDTH'h0
716
 
717
 
718
/////////////////////////////////////////////////////
719
//
720
// SPR groups
721
//
722
 
723
// Bits that define the group
724
`define OR1200_SPR_GROUP_BITS   15:11
725
 
726
// Width of the group bits
727
`define OR1200_SPR_GROUP_WIDTH  5
728
 
729
// Bits that define offset inside the group
730
`define OR1200_SPR_OFS_BITS 10:0
731
 
732
// List of groups
733
`define OR1200_SPR_GROUP_SYS    5'd00
734
`define OR1200_SPR_GROUP_DMMU   5'd01
735
`define OR1200_SPR_GROUP_IMMU   5'd02
736
`define OR1200_SPR_GROUP_DC     5'd03
737
`define OR1200_SPR_GROUP_IC     5'd04
738
`define OR1200_SPR_GROUP_MAC    5'd05
739
`define OR1200_SPR_GROUP_DU     5'd06
740
`define OR1200_SPR_GROUP_PM     5'd08
741
`define OR1200_SPR_GROUP_PIC    5'd09
742
`define OR1200_SPR_GROUP_TT     5'd10
743 185 julius
`define OR1200_SPR_GROUP_FPU    5'd11
744 10 unneback
 
745
/////////////////////////////////////////////////////
746
//
747
// System group
748
//
749
 
750
//
751
// System registers
752
//
753
`define OR1200_SPR_CFGR         7'd0
754
`define OR1200_SPR_RF           6'd32   // 1024 >> 5
755
`define OR1200_SPR_NPC          11'd16
756
`define OR1200_SPR_SR           11'd17
757
`define OR1200_SPR_PPC          11'd18
758 185 julius
`define OR1200_SPR_FPCSR        11'd20
759 10 unneback
`define OR1200_SPR_EPCR         11'd32
760
`define OR1200_SPR_EEAR         11'd48
761
`define OR1200_SPR_ESR          11'd64
762
 
763
//
764
// SR bits
765
//
766 141 marcus.erl
`define OR1200_SR_WIDTH 17
767 10 unneback
`define OR1200_SR_SM   0
768
`define OR1200_SR_TEE  1
769
`define OR1200_SR_IEE  2
770
`define OR1200_SR_DCE  3
771
`define OR1200_SR_ICE  4
772
`define OR1200_SR_DME  5
773
`define OR1200_SR_IME  6
774
`define OR1200_SR_LEE  7
775
`define OR1200_SR_CE   8
776
`define OR1200_SR_F    9
777
`define OR1200_SR_CY   10       // Unused
778
`define OR1200_SR_OV   11       // Unused
779
`define OR1200_SR_OVE  12       // Unused
780
`define OR1200_SR_DSX  13       // Unused
781
`define OR1200_SR_EPH  14
782
`define OR1200_SR_FO   15
783 141 marcus.erl
`define OR1200_SR_TED  16
784 10 unneback
`define OR1200_SR_CID  31:28    // Unimplemented
785
 
786
//
787
// Bits that define offset inside the group
788
//
789
`define OR1200_SPROFS_BITS 10:0
790
 
791
//
792
// Default Exception Prefix
793
//
794
// 1'b0 - OR1200_EXCEPT_EPH0_P (0x0000_0000)
795
// 1'b1 - OR1200_EXCEPT_EPH1_P (0xF000_0000)
796
//
797
`define OR1200_SR_EPH_DEF       1'b0
798
 
799 185 julius
 
800
//
801
// FPCSR bits
802
//
803
`define OR1200_FPCSR_WIDTH 12
804
`define OR1200_FPCSR_FPEE  0
805
`define OR1200_FPCSR_RM    2:1
806
`define OR1200_FPCSR_OVF   3
807
`define OR1200_FPCSR_UNF   4
808
`define OR1200_FPCSR_SNF   5
809
`define OR1200_FPCSR_QNF   6
810
`define OR1200_FPCSR_ZF    7
811
`define OR1200_FPCSR_IXF   8
812
`define OR1200_FPCSR_IVF   9
813
`define OR1200_FPCSR_INF   10
814
`define OR1200_FPCSR_DZF   11
815
`define OR1200_FPCSR_RES   31:12
816
 
817 10 unneback
/////////////////////////////////////////////////////
818
//
819
// Power Management (PM)
820
//
821
 
822
// Define it if you want PM implemented
823 141 marcus.erl
//`define OR1200_PM_IMPLEMENTED
824 10 unneback
 
825
// Bit positions inside PMR (don't change)
826
`define OR1200_PM_PMR_SDF 3:0
827
`define OR1200_PM_PMR_DME 4
828
`define OR1200_PM_PMR_SME 5
829
`define OR1200_PM_PMR_DCGE 6
830
`define OR1200_PM_PMR_UNUSED 31:7
831
 
832
// PMR offset inside PM group of registers
833
`define OR1200_PM_OFS_PMR 11'b0
834
 
835
// PM group
836
`define OR1200_SPRGRP_PM 5'd8
837
 
838
// Define if PMR can be read/written at any address inside PM group
839
`define OR1200_PM_PARTIAL_DECODING
840
 
841
// Define if reading PMR is allowed
842
`define OR1200_PM_READREGS
843
 
844
// Define if unused PMR bits should be zero
845
`define OR1200_PM_UNUSED_ZERO
846
 
847
 
848
/////////////////////////////////////////////////////
849
//
850
// Debug Unit (DU)
851
//
852
 
853
// Define it if you want DU implemented
854
`define OR1200_DU_IMPLEMENTED
855
 
856
//
857
// Define if you want HW Breakpoints
858
// (if HW breakpoints are not implemented
859
// only default software trapping is
860
// possible with l.trap insn - this is
861
// however already enough for use
862
// with or32 gdb)
863
//
864
//`define OR1200_DU_HWBKPTS
865
 
866
// Number of DVR/DCR pairs if HW breakpoints enabled
867 141 marcus.erl
//      Comment / uncomment DU_DVRn / DU_DCRn pairs bellow according to this number ! 
868
//      DU_DVR0..DU_DVR7 should be uncommented for 8 DU_DVRDCR_PAIRS 
869 10 unneback
`define OR1200_DU_DVRDCR_PAIRS 8
870
 
871
// Define if you want trace buffer
872 141 marcus.erl
//      (for now only available for Xilinx Virtex FPGAs)
873 10 unneback
//`define OR1200_DU_TB_IMPLEMENTED
874
 
875 141 marcus.erl
 
876 10 unneback
//
877
// Address offsets of DU registers inside DU group
878
//
879
// To not implement a register, doq not define its address
880
//
881
`ifdef OR1200_DU_HWBKPTS
882
`define OR1200_DU_DVR0          11'd0
883
`define OR1200_DU_DVR1          11'd1
884
`define OR1200_DU_DVR2          11'd2
885
`define OR1200_DU_DVR3          11'd3
886
`define OR1200_DU_DVR4          11'd4
887
`define OR1200_DU_DVR5          11'd5
888
`define OR1200_DU_DVR6          11'd6
889
`define OR1200_DU_DVR7          11'd7
890
`define OR1200_DU_DCR0          11'd8
891
`define OR1200_DU_DCR1          11'd9
892
`define OR1200_DU_DCR2          11'd10
893
`define OR1200_DU_DCR3          11'd11
894
`define OR1200_DU_DCR4          11'd12
895
`define OR1200_DU_DCR5          11'd13
896
`define OR1200_DU_DCR6          11'd14
897
`define OR1200_DU_DCR7          11'd15
898
`endif
899
`define OR1200_DU_DMR1          11'd16
900
`ifdef OR1200_DU_HWBKPTS
901
`define OR1200_DU_DMR2          11'd17
902
`define OR1200_DU_DWCR0         11'd18
903
`define OR1200_DU_DWCR1         11'd19
904
`endif
905
`define OR1200_DU_DSR           11'd20
906
`define OR1200_DU_DRR           11'd21
907
`ifdef OR1200_DU_TB_IMPLEMENTED
908
`define OR1200_DU_TBADR         11'h0ff
909
`define OR1200_DU_TBIA          11'h1xx
910
`define OR1200_DU_TBIM          11'h2xx
911
`define OR1200_DU_TBAR          11'h3xx
912
`define OR1200_DU_TBTS          11'h4xx
913
`endif
914
 
915
// Position of offset bits inside SPR address
916
`define OR1200_DUOFS_BITS       10:0
917
 
918
// DCR bits
919
`define OR1200_DU_DCR_DP        0
920
`define OR1200_DU_DCR_CC        3:1
921
`define OR1200_DU_DCR_SC        4
922
`define OR1200_DU_DCR_CT        7:5
923
 
924
// DMR1 bits
925
`define OR1200_DU_DMR1_CW0      1:0
926
`define OR1200_DU_DMR1_CW1      3:2
927
`define OR1200_DU_DMR1_CW2      5:4
928
`define OR1200_DU_DMR1_CW3      7:6
929
`define OR1200_DU_DMR1_CW4      9:8
930
`define OR1200_DU_DMR1_CW5      11:10
931
`define OR1200_DU_DMR1_CW6      13:12
932
`define OR1200_DU_DMR1_CW7      15:14
933
`define OR1200_DU_DMR1_CW8      17:16
934
`define OR1200_DU_DMR1_CW9      19:18
935
`define OR1200_DU_DMR1_CW10     21:20
936
`define OR1200_DU_DMR1_ST       22
937
`define OR1200_DU_DMR1_BT       23
938
`define OR1200_DU_DMR1_DXFW     24
939
`define OR1200_DU_DMR1_ETE      25
940
 
941
// DMR2 bits
942
`define OR1200_DU_DMR2_WCE0     0
943
`define OR1200_DU_DMR2_WCE1     1
944
`define OR1200_DU_DMR2_AWTC     12:2
945
`define OR1200_DU_DMR2_WGB      23:13
946
 
947
// DWCR bits
948
`define OR1200_DU_DWCR_COUNT    15:0
949
`define OR1200_DU_DWCR_MATCH    31:16
950
 
951
// DSR bits
952
`define OR1200_DU_DSR_WIDTH     14
953
`define OR1200_DU_DSR_RSTE      0
954
`define OR1200_DU_DSR_BUSEE     1
955
`define OR1200_DU_DSR_DPFE      2
956
`define OR1200_DU_DSR_IPFE      3
957
`define OR1200_DU_DSR_TTE       4
958
`define OR1200_DU_DSR_AE        5
959
`define OR1200_DU_DSR_IIE       6
960
`define OR1200_DU_DSR_IE        7
961
`define OR1200_DU_DSR_DME       8
962
`define OR1200_DU_DSR_IME       9
963
`define OR1200_DU_DSR_RE        10
964
`define OR1200_DU_DSR_SCE       11
965 185 julius
`define OR1200_DU_DSR_FPE       12
966 10 unneback
`define OR1200_DU_DSR_TE        13
967
 
968
// DRR bits
969
`define OR1200_DU_DRR_RSTE      0
970
`define OR1200_DU_DRR_BUSEE     1
971
`define OR1200_DU_DRR_DPFE      2
972
`define OR1200_DU_DRR_IPFE      3
973
`define OR1200_DU_DRR_TTE       4
974
`define OR1200_DU_DRR_AE        5
975
`define OR1200_DU_DRR_IIE       6
976
`define OR1200_DU_DRR_IE        7
977
`define OR1200_DU_DRR_DME       8
978
`define OR1200_DU_DRR_IME       9
979
`define OR1200_DU_DRR_RE        10
980
`define OR1200_DU_DRR_SCE       11
981 185 julius
`define OR1200_DU_DRR_FPE       12
982 10 unneback
`define OR1200_DU_DRR_TE        13
983
 
984
// Define if reading DU regs is allowed
985
`define OR1200_DU_READREGS
986
 
987
// Define if unused DU registers bits should be zero
988
`define OR1200_DU_UNUSED_ZERO
989
 
990
// Define if IF/LSU status is not needed by devel i/f
991
`define OR1200_DU_STATUS_UNIMPLEMENTED
992
 
993
/////////////////////////////////////////////////////
994
//
995
// Programmable Interrupt Controller (PIC)
996
//
997
 
998
// Define it if you want PIC implemented
999
`define OR1200_PIC_IMPLEMENTED
1000
 
1001
// Define number of interrupt inputs (2-31)
1002 141 marcus.erl
`define OR1200_PIC_INTS 31
1003 10 unneback
 
1004
// Address offsets of PIC registers inside PIC group
1005
`define OR1200_PIC_OFS_PICMR 2'd0
1006
`define OR1200_PIC_OFS_PICSR 2'd2
1007
 
1008
// Position of offset bits inside SPR address
1009
`define OR1200_PICOFS_BITS 1:0
1010
 
1011
// Define if you want these PIC registers to be implemented
1012
`define OR1200_PIC_PICMR
1013
`define OR1200_PIC_PICSR
1014
 
1015
// Define if reading PIC registers is allowed
1016
`define OR1200_PIC_READREGS
1017
 
1018
// Define if unused PIC register bits should be zero
1019
`define OR1200_PIC_UNUSED_ZERO
1020
 
1021
 
1022
/////////////////////////////////////////////////////
1023
//
1024
// Tick Timer (TT)
1025
//
1026
 
1027
// Define it if you want TT implemented
1028
`define OR1200_TT_IMPLEMENTED
1029
 
1030
// Address offsets of TT registers inside TT group
1031
`define OR1200_TT_OFS_TTMR 1'd0
1032
`define OR1200_TT_OFS_TTCR 1'd1
1033
 
1034
// Position of offset bits inside SPR group
1035
`define OR1200_TTOFS_BITS 0
1036
 
1037
// Define if you want these TT registers to be implemented
1038
`define OR1200_TT_TTMR
1039
`define OR1200_TT_TTCR
1040
 
1041
// TTMR bits
1042
`define OR1200_TT_TTMR_TP 27:0
1043
`define OR1200_TT_TTMR_IP 28
1044
`define OR1200_TT_TTMR_IE 29
1045
`define OR1200_TT_TTMR_M 31:30
1046
 
1047
// Define if reading TT registers is allowed
1048
`define OR1200_TT_READREGS
1049
 
1050
 
1051
//////////////////////////////////////////////
1052
//
1053
// MAC
1054
//
1055
`define OR1200_MAC_ADDR         0        // MACLO 0xxxxxxxx1, MACHI 0xxxxxxxx0
1056
`define OR1200_MAC_SPR_WE               // Define if MACLO/MACHI are SPR writable
1057
 
1058
//
1059
// Shift {MACHI,MACLO} into destination register when executing l.macrc
1060
//
1061
// According to architecture manual there is no shift, so default value is 0.
1062
//
1063
// However the implementation has deviated in this from the arch manual and had hard coded shift by 28 bits which
1064
// is a useful optimization for MP3 decoding (if using libmad fixed point library). Shifts are no longer
1065
// default setup, but if you need to remain backward compatible, define your shift bits, which were normally
1066
// dest_GPR = {MACHI,MACLO}[59:28]
1067
`define OR1200_MAC_SHIFTBY      0        // 0 = According to arch manual, 28 = obsolete backward compatibility
1068
 
1069
 
1070
//////////////////////////////////////////////
1071
//
1072
// Data MMU (DMMU)
1073
//
1074
 
1075
//
1076
// Address that selects between TLB TR and MR
1077
//
1078
`define OR1200_DTLB_TM_ADDR     7
1079
 
1080
//
1081
// DTLBMR fields
1082
//
1083
`define OR1200_DTLBMR_V_BITS    0
1084
`define OR1200_DTLBMR_CID_BITS  4:1
1085
`define OR1200_DTLBMR_RES_BITS  11:5
1086
`define OR1200_DTLBMR_VPN_BITS  31:13
1087
 
1088
//
1089
// DTLBTR fields
1090
//
1091
`define OR1200_DTLBTR_CC_BITS   0
1092
`define OR1200_DTLBTR_CI_BITS   1
1093
`define OR1200_DTLBTR_WBC_BITS  2
1094
`define OR1200_DTLBTR_WOM_BITS  3
1095
`define OR1200_DTLBTR_A_BITS    4
1096
`define OR1200_DTLBTR_D_BITS    5
1097
`define OR1200_DTLBTR_URE_BITS  6
1098
`define OR1200_DTLBTR_UWE_BITS  7
1099
`define OR1200_DTLBTR_SRE_BITS  8
1100
`define OR1200_DTLBTR_SWE_BITS  9
1101
`define OR1200_DTLBTR_RES_BITS  11:10
1102
`define OR1200_DTLBTR_PPN_BITS  31:13
1103
 
1104
//
1105
// DTLB configuration
1106
//
1107
`define OR1200_DMMU_PS          13                                      // 13 for 8KB page size
1108
`define OR1200_DTLB_INDXW       6                                       // 6 for 64 entry DTLB  7 for 128 entries
1109
`define OR1200_DTLB_INDXL       `OR1200_DMMU_PS                         // 13                   13
1110
`define OR1200_DTLB_INDXH       `OR1200_DMMU_PS+`OR1200_DTLB_INDXW-1    // 18                   19
1111
`define OR1200_DTLB_INDX        `OR1200_DTLB_INDXH:`OR1200_DTLB_INDXL   // 18:13                19:13
1112
`define OR1200_DTLB_TAGW        32-`OR1200_DTLB_INDXW-`OR1200_DMMU_PS   // 13                   12
1113
`define OR1200_DTLB_TAGL        `OR1200_DTLB_INDXH+1                    // 19                   20
1114
`define OR1200_DTLB_TAG         31:`OR1200_DTLB_TAGL                    // 31:19                31:20
1115
`define OR1200_DTLBMRW          `OR1200_DTLB_TAGW+1                     // +1 because of V bit
1116
`define OR1200_DTLBTRW          32-`OR1200_DMMU_PS+5                    // +5 because of protection bits and CI
1117
 
1118
//
1119
// Cache inhibit while DMMU is not enabled/implemented
1120
//
1121
// cache inhibited 0GB-4GB              1'b1
1122
// cache inhibited 0GB-2GB              !dcpu_adr_i[31]
1123
// cache inhibited 0GB-1GB 2GB-3GB      !dcpu_adr_i[30]
1124
// cache inhibited 1GB-2GB 3GB-4GB      dcpu_adr_i[30]
1125
// cache inhibited 2GB-4GB (default)    dcpu_adr_i[31]
1126
// cached 0GB-4GB                       1'b0
1127
//
1128
`define OR1200_DMMU_CI                  dcpu_adr_i[31]
1129
 
1130
 
1131
//////////////////////////////////////////////
1132
//
1133
// Insn MMU (IMMU)
1134
//
1135
 
1136
//
1137
// Address that selects between TLB TR and MR
1138
//
1139
`define OR1200_ITLB_TM_ADDR     7
1140
 
1141
//
1142
// ITLBMR fields
1143
//
1144
`define OR1200_ITLBMR_V_BITS    0
1145
`define OR1200_ITLBMR_CID_BITS  4:1
1146
`define OR1200_ITLBMR_RES_BITS  11:5
1147
`define OR1200_ITLBMR_VPN_BITS  31:13
1148
 
1149
//
1150
// ITLBTR fields
1151
//
1152
`define OR1200_ITLBTR_CC_BITS   0
1153
`define OR1200_ITLBTR_CI_BITS   1
1154
`define OR1200_ITLBTR_WBC_BITS  2
1155
`define OR1200_ITLBTR_WOM_BITS  3
1156
`define OR1200_ITLBTR_A_BITS    4
1157
`define OR1200_ITLBTR_D_BITS    5
1158
`define OR1200_ITLBTR_SXE_BITS  6
1159
`define OR1200_ITLBTR_UXE_BITS  7
1160
`define OR1200_ITLBTR_RES_BITS  11:8
1161
`define OR1200_ITLBTR_PPN_BITS  31:13
1162
 
1163
//
1164
// ITLB configuration
1165
//
1166
`define OR1200_IMMU_PS          13                                      // 13 for 8KB page size
1167
`define OR1200_ITLB_INDXW       6                                       // 6 for 64 entry ITLB  7 for 128 entries
1168
`define OR1200_ITLB_INDXL       `OR1200_IMMU_PS                         // 13                   13
1169
`define OR1200_ITLB_INDXH       `OR1200_IMMU_PS+`OR1200_ITLB_INDXW-1    // 18                   19
1170
`define OR1200_ITLB_INDX        `OR1200_ITLB_INDXH:`OR1200_ITLB_INDXL   // 18:13                19:13
1171
`define OR1200_ITLB_TAGW        32-`OR1200_ITLB_INDXW-`OR1200_IMMU_PS   // 13                   12
1172
`define OR1200_ITLB_TAGL        `OR1200_ITLB_INDXH+1                    // 19                   20
1173
`define OR1200_ITLB_TAG         31:`OR1200_ITLB_TAGL                    // 31:19                31:20
1174
`define OR1200_ITLBMRW          `OR1200_ITLB_TAGW+1                     // +1 because of V bit
1175
`define OR1200_ITLBTRW          32-`OR1200_IMMU_PS+3                    // +3 because of protection bits and CI
1176
 
1177
//
1178
// Cache inhibit while IMMU is not enabled/implemented
1179
// Note: all combinations that use icpu_adr_i cause async loop
1180
//
1181
// cache inhibited 0GB-4GB              1'b1
1182
// cache inhibited 0GB-2GB              !icpu_adr_i[31]
1183
// cache inhibited 0GB-1GB 2GB-3GB      !icpu_adr_i[30]
1184
// cache inhibited 1GB-2GB 3GB-4GB      icpu_adr_i[30]
1185
// cache inhibited 2GB-4GB (default)    icpu_adr_i[31]
1186
// cached 0GB-4GB                       1'b0
1187
//
1188
`define OR1200_IMMU_CI                  1'b0
1189
 
1190
 
1191
/////////////////////////////////////////////////
1192
//
1193
// Insn cache (IC)
1194
//
1195
 
1196
// 3 for 8 bytes, 4 for 16 bytes etc
1197
`define OR1200_ICLS             4
1198
 
1199
//
1200
// IC configurations
1201
//
1202
`ifdef OR1200_IC_1W_512B
1203
`define OR1200_ICSIZE   9     // 512
1204
`define OR1200_ICINDX   `OR1200_ICSIZE-2 // 7
1205
`define OR1200_ICINDXH  `OR1200_ICSIZE-1 // 8
1206
`define OR1200_ICTAGL   `OR1200_ICINDXH+1 // 9
1207
`define OR1200_ICTAG    `OR1200_ICSIZE-`OR1200_ICLS // 5
1208
`define OR1200_ICTAG_W  24
1209
`endif
1210
`ifdef OR1200_IC_1W_4KB
1211
`define OR1200_ICSIZE                   12                      // 4096
1212
`define OR1200_ICINDX                   `OR1200_ICSIZE-2        // 10
1213
`define OR1200_ICINDXH                  `OR1200_ICSIZE-1        // 11
1214
`define OR1200_ICTAGL                   `OR1200_ICINDXH+1       // 12
1215
`define OR1200_ICTAG                    `OR1200_ICSIZE-`OR1200_ICLS     // 8
1216
`define OR1200_ICTAG_W                  21
1217
`endif
1218
`ifdef OR1200_IC_1W_8KB
1219
`define OR1200_ICSIZE                   13                      // 8192
1220
`define OR1200_ICINDX                   `OR1200_ICSIZE-2        // 11
1221
`define OR1200_ICINDXH                  `OR1200_ICSIZE-1        // 12
1222
`define OR1200_ICTAGL                   `OR1200_ICINDXH+1       // 13
1223
`define OR1200_ICTAG                    `OR1200_ICSIZE-`OR1200_ICLS     // 9
1224
`define OR1200_ICTAG_W                  20
1225
`endif
1226
 
1227
 
1228
/////////////////////////////////////////////////
1229
//
1230
// Data cache (DC)
1231
//
1232
 
1233
// 3 for 8 bytes, 4 for 16 bytes etc
1234
`define OR1200_DCLS             4
1235
 
1236 258 julius
// Define to enable default behavior of cache as write through
1237
// Turning this off enabled write back statergy
1238
//
1239
`define OR1200_DC_WRITETHROUGH
1240 10 unneback
 
1241 258 julius
// Define to enable stores from the stack not doing writethrough.
1242
// EXPERIMENTAL
1243
//`define OR1200_DC_NOSTACKWRITETHROUGH
1244
 
1245
// Data cache SPR definitions
1246
`define OR1200_SPRGRP_DC_ADR_WIDTH 3
1247
// Data cache group SPR addresses
1248
`define OR1200_SPRGRP_DC_DCCR           3'd0 // Not implemented
1249
`define OR1200_SPRGRP_DC_DCBPR          3'd1 // Not implemented
1250
`define OR1200_SPRGRP_DC_DCBFR          3'd2
1251
`define OR1200_SPRGRP_DC_DCBIR          3'd3
1252
`define OR1200_SPRGRP_DC_DCBWR          3'd4 // Not implemented
1253
`define OR1200_SPRGRP_DC_DCBLR          3'd5 // Not implemented
1254
 
1255 10 unneback
//
1256
// DC configurations
1257
//
1258
`ifdef OR1200_DC_1W_4KB
1259
`define OR1200_DCSIZE                   12                      // 4096
1260
`define OR1200_DCINDX                   `OR1200_DCSIZE-2        // 10
1261
`define OR1200_DCINDXH                  `OR1200_DCSIZE-1        // 11
1262
`define OR1200_DCTAGL                   `OR1200_DCINDXH+1       // 12
1263
`define OR1200_DCTAG                    `OR1200_DCSIZE-`OR1200_DCLS     // 8
1264
`define OR1200_DCTAG_W                  21
1265
`endif
1266
`ifdef OR1200_DC_1W_8KB
1267
`define OR1200_DCSIZE                   13                      // 8192
1268
`define OR1200_DCINDX                   `OR1200_DCSIZE-2        // 11
1269
`define OR1200_DCINDXH                  `OR1200_DCSIZE-1        // 12
1270
`define OR1200_DCTAGL                   `OR1200_DCINDXH+1       // 13
1271
`define OR1200_DCTAG                    `OR1200_DCSIZE-`OR1200_DCLS     // 9
1272
`define OR1200_DCTAG_W                  20
1273
`endif
1274
 
1275 258 julius
 
1276 10 unneback
/////////////////////////////////////////////////
1277
//
1278
// Store buffer (SB)
1279
//
1280
 
1281
//
1282
// Store buffer
1283
//
1284
// It will improve performance by "caching" CPU stores
1285
// using store buffer. This is most important for function
1286
// prologues because DC can only work in write though mode
1287
// and all stores would have to complete external WB writes
1288
// to memory.
1289
// Store buffer is between DC and data BIU.
1290
// All stores will be stored into store buffer and immediately
1291
// completed by the CPU, even though actual external writes
1292
// will be performed later. As a consequence store buffer masks
1293
// all data bus errors related to stores (data bus errors
1294
// related to loads are delivered normally).
1295
// All pending CPU loads will wait until store buffer is empty to
1296
// ensure strict memory model. Right now this is necessary because
1297
// we don't make destinction between cached and cache inhibited
1298
// address space, so we simply empty store buffer until loads
1299
// can begin.
1300
//
1301
// It makes design a bit bigger, depending what is the number of
1302
// entries in SB FIFO. Number of entries can be changed further
1303
// down.
1304
//
1305
//`define OR1200_SB_IMPLEMENTED
1306
 
1307
//
1308
// Number of store buffer entries
1309
//
1310
// Verified number of entries are 4 and 8 entries
1311
// (2 and 3 for OR1200_SB_LOG). OR1200_SB_ENTRIES must
1312
// always match 2**OR1200_SB_LOG.
1313
// To disable store buffer, undefine
1314
// OR1200_SB_IMPLEMENTED.
1315
//
1316
`define OR1200_SB_LOG           2       // 2 or 3
1317
`define OR1200_SB_ENTRIES       4       // 4 or 8
1318
 
1319
 
1320
/////////////////////////////////////////////////
1321
//
1322
// Quick Embedded Memory (QMEM)
1323
//
1324
 
1325
//
1326
// Quick Embedded Memory
1327
//
1328
// Instantiation of dedicated insn/data memory (RAM or ROM).
1329
// Insn fetch has effective throughput 1insn / clock cycle.
1330
// Data load takes two clock cycles / access, data store
1331
// takes 1 clock cycle / access (if there is no insn fetch)).
1332
// Memory instantiation is shared between insn and data,
1333
// meaning if insn fetch are performed, data load/store
1334
// performance will be lower.
1335
//
1336
// Main reason for QMEM is to put some time critical functions
1337
// into this memory and to have predictable and fast access
1338
// to these functions. (soft fpu, context switch, exception
1339
// handlers, stack, etc)
1340
//
1341
// It makes design a bit bigger and slower. QMEM sits behind
1342
// IMMU/DMMU so all addresses are physical (so the MMUs can be
1343
// used with QMEM and QMEM is seen by the CPU just like any other
1344
// memory in the system). IC/DC are sitting behind QMEM so the
1345
// whole design timing might be worse with QMEM implemented.
1346
//
1347 141 marcus.erl
//`define OR1200_QMEM_IMPLEMENTED
1348 10 unneback
 
1349
//
1350
// Base address and mask of QMEM
1351
//
1352
// Base address defines first address of QMEM. Mask defines
1353
// QMEM range in address space. Actual size of QMEM is however
1354
// determined with instantiated RAM/ROM. However bigger
1355
// mask will reserve more address space for QMEM, but also
1356
// make design faster, while more tight mask will take
1357
// less address space but also make design slower. If
1358
// instantiated RAM/ROM is smaller than space reserved with
1359
// the mask, instatiated RAM/ROM will also be shadowed
1360
// at higher addresses in reserved space.
1361
//
1362
`define OR1200_QMEM_IADDR       32'h0080_0000
1363 141 marcus.erl
`define OR1200_QMEM_IMASK       32'hfff0_0000 // Max QMEM size 1MB
1364
`define OR1200_QMEM_DADDR       32'h0080_0000
1365
`define OR1200_QMEM_DMASK       32'hfff0_0000 // Max QMEM size 1MB
1366 10 unneback
 
1367
//
1368
// QMEM interface byte-select capability
1369
//
1370
// To enable qmem_sel* ports, define this macro.
1371
//
1372
//`define OR1200_QMEM_BSEL
1373
 
1374
//
1375
// QMEM interface acknowledge
1376
//
1377
// To enable qmem_ack port, define this macro.
1378
//
1379
//`define OR1200_QMEM_ACK
1380
 
1381
/////////////////////////////////////////////////////
1382
//
1383
// VR, UPR and Configuration Registers
1384
//
1385
//
1386
// VR, UPR and configuration registers are optional. If 
1387
// implemented, operating system can automatically figure
1388
// out how to use the processor because it knows 
1389
// what units are available in the processor and how they
1390
// are configured.
1391
//
1392
// This section must be last in or1200_defines.v file so
1393
// that all units are already configured and thus
1394
// configuration registers are properly set.
1395
// 
1396
 
1397
// Define if you want configuration registers implemented
1398
`define OR1200_CFGR_IMPLEMENTED
1399
 
1400
// Define if you want full address decode inside SYS group
1401
`define OR1200_SYS_FULL_DECODE
1402
 
1403
// Offsets of VR, UPR and CFGR registers
1404
`define OR1200_SPRGRP_SYS_VR            4'h0
1405
`define OR1200_SPRGRP_SYS_UPR           4'h1
1406
`define OR1200_SPRGRP_SYS_CPUCFGR       4'h2
1407
`define OR1200_SPRGRP_SYS_DMMUCFGR      4'h3
1408
`define OR1200_SPRGRP_SYS_IMMUCFGR      4'h4
1409
`define OR1200_SPRGRP_SYS_DCCFGR        4'h5
1410
`define OR1200_SPRGRP_SYS_ICCFGR        4'h6
1411
`define OR1200_SPRGRP_SYS_DCFGR 4'h7
1412
 
1413
// VR fields
1414
`define OR1200_VR_REV_BITS              5:0
1415
`define OR1200_VR_RES1_BITS             15:6
1416
`define OR1200_VR_CFG_BITS              23:16
1417
`define OR1200_VR_VER_BITS              31:24
1418
 
1419
// VR values
1420 258 julius
`define OR1200_VR_REV                   6'h08
1421 10 unneback
`define OR1200_VR_RES1                  10'h000
1422
`define OR1200_VR_CFG                   8'h00
1423
`define OR1200_VR_VER                   8'h12
1424
 
1425
// UPR fields
1426
`define OR1200_UPR_UP_BITS              0
1427
`define OR1200_UPR_DCP_BITS             1
1428
`define OR1200_UPR_ICP_BITS             2
1429
`define OR1200_UPR_DMP_BITS             3
1430
`define OR1200_UPR_IMP_BITS             4
1431
`define OR1200_UPR_MP_BITS              5
1432
`define OR1200_UPR_DUP_BITS             6
1433
`define OR1200_UPR_PCUP_BITS            7
1434
`define OR1200_UPR_PMP_BITS             8
1435
`define OR1200_UPR_PICP_BITS            9
1436
`define OR1200_UPR_TTP_BITS             10
1437 258 julius
`define OR1200_UPR_FPP_BITS             11
1438
`define OR1200_UPR_RES1_BITS            23:12
1439 10 unneback
`define OR1200_UPR_CUP_BITS             31:24
1440
 
1441
// UPR values
1442
`define OR1200_UPR_UP                   1'b1
1443
`ifdef OR1200_NO_DC
1444
`define OR1200_UPR_DCP                  1'b0
1445
`else
1446
`define OR1200_UPR_DCP                  1'b1
1447
`endif
1448
`ifdef OR1200_NO_IC
1449
`define OR1200_UPR_ICP                  1'b0
1450
`else
1451
`define OR1200_UPR_ICP                  1'b1
1452
`endif
1453
`ifdef OR1200_NO_DMMU
1454
`define OR1200_UPR_DMP                  1'b0
1455
`else
1456
`define OR1200_UPR_DMP                  1'b1
1457
`endif
1458
`ifdef OR1200_NO_IMMU
1459
`define OR1200_UPR_IMP                  1'b0
1460
`else
1461
`define OR1200_UPR_IMP                  1'b1
1462
`endif
1463 258 julius
`ifdef OR1200_MAC_IMPLEMENTED
1464
`define OR1200_UPR_MP                   1'b1
1465
`else
1466
`define OR1200_UPR_MP                   1'b0
1467
`endif
1468 10 unneback
`ifdef OR1200_DU_IMPLEMENTED
1469
`define OR1200_UPR_DUP                  1'b1
1470
`else
1471
`define OR1200_UPR_DUP                  1'b0
1472
`endif
1473
`define OR1200_UPR_PCUP                 1'b0    // Performance counters not present
1474 141 marcus.erl
`ifdef OR1200_PM_IMPLEMENTED
1475 10 unneback
`define OR1200_UPR_PMP                  1'b1
1476
`else
1477
`define OR1200_UPR_PMP                  1'b0
1478
`endif
1479 141 marcus.erl
`ifdef OR1200_PIC_IMPLEMENTED
1480 10 unneback
`define OR1200_UPR_PICP                 1'b1
1481
`else
1482
`define OR1200_UPR_PICP                 1'b0
1483
`endif
1484 141 marcus.erl
`ifdef OR1200_TT_IMPLEMENTED
1485 10 unneback
`define OR1200_UPR_TTP                  1'b1
1486
`else
1487
`define OR1200_UPR_TTP                  1'b0
1488
`endif
1489 258 julius
`ifdef OR1200_FPU_IMPLEMENTED
1490
`define OR1200_UPR_FPP                  1'b1
1491
`else
1492
`define OR1200_UPR_FPP                  1'b0
1493
`endif
1494
`define OR1200_UPR_RES1                 12'h000
1495 10 unneback
`define OR1200_UPR_CUP                  8'h00
1496
 
1497
// CPUCFGR fields
1498
`define OR1200_CPUCFGR_NSGF_BITS        3:0
1499 141 marcus.erl
`define OR1200_CPUCFGR_HGF_BITS     4
1500 10 unneback
`define OR1200_CPUCFGR_OB32S_BITS       5
1501
`define OR1200_CPUCFGR_OB64S_BITS       6
1502
`define OR1200_CPUCFGR_OF32S_BITS       7
1503
`define OR1200_CPUCFGR_OF64S_BITS       8
1504
`define OR1200_CPUCFGR_OV64S_BITS       9
1505
`define OR1200_CPUCFGR_RES1_BITS        31:10
1506
 
1507
// CPUCFGR values
1508 141 marcus.erl
`define OR1200_CPUCFGR_NSGF                 4'h0
1509
`ifdef OR1200_RFRAM_16REG
1510
    `define OR1200_CPUCFGR_HGF                  1'b1
1511
`else
1512
    `define OR1200_CPUCFGR_HGF                  1'b0
1513
`endif
1514 10 unneback
`define OR1200_CPUCFGR_OB32S            1'b1
1515
`define OR1200_CPUCFGR_OB64S            1'b0
1516 258 julius
`ifdef OR1200_FPU_IMPLEMENTED
1517
 `define OR1200_CPUCFGR_OF32S           1'b1
1518
`else
1519
 `define OR1200_CPUCFGR_OF32S           1'b0
1520
`endif
1521
 
1522 10 unneback
`define OR1200_CPUCFGR_OF64S            1'b0
1523
`define OR1200_CPUCFGR_OV64S            1'b0
1524
`define OR1200_CPUCFGR_RES1             22'h000000
1525
 
1526
// DMMUCFGR fields
1527
`define OR1200_DMMUCFGR_NTW_BITS        1:0
1528
`define OR1200_DMMUCFGR_NTS_BITS        4:2
1529
`define OR1200_DMMUCFGR_NAE_BITS        7:5
1530
`define OR1200_DMMUCFGR_CRI_BITS        8
1531
`define OR1200_DMMUCFGR_PRI_BITS        9
1532
`define OR1200_DMMUCFGR_TEIRI_BITS      10
1533
`define OR1200_DMMUCFGR_HTR_BITS        11
1534
`define OR1200_DMMUCFGR_RES1_BITS       31:12
1535
 
1536
// DMMUCFGR values
1537
`ifdef OR1200_NO_DMMU
1538
`define OR1200_DMMUCFGR_NTW             2'h0    // Irrelevant
1539
`define OR1200_DMMUCFGR_NTS             3'h0    // Irrelevant
1540
`define OR1200_DMMUCFGR_NAE             3'h0    // Irrelevant
1541
`define OR1200_DMMUCFGR_CRI             1'b0    // Irrelevant
1542
`define OR1200_DMMUCFGR_PRI             1'b0    // Irrelevant
1543
`define OR1200_DMMUCFGR_TEIRI           1'b0    // Irrelevant
1544
`define OR1200_DMMUCFGR_HTR             1'b0    // Irrelevant
1545
`define OR1200_DMMUCFGR_RES1            20'h00000
1546
`else
1547
`define OR1200_DMMUCFGR_NTW             2'h0    // 1 TLB way
1548
`define OR1200_DMMUCFGR_NTS 3'h`OR1200_DTLB_INDXW       // Num TLB sets
1549
`define OR1200_DMMUCFGR_NAE             3'h0    // No ATB entries
1550
`define OR1200_DMMUCFGR_CRI             1'b0    // No control register
1551
`define OR1200_DMMUCFGR_PRI             1'b0    // No protection reg
1552
`define OR1200_DMMUCFGR_TEIRI           1'b1    // TLB entry inv reg impl.
1553
`define OR1200_DMMUCFGR_HTR             1'b0    // No HW TLB reload
1554
`define OR1200_DMMUCFGR_RES1            20'h00000
1555
`endif
1556
 
1557
// IMMUCFGR fields
1558
`define OR1200_IMMUCFGR_NTW_BITS        1:0
1559
`define OR1200_IMMUCFGR_NTS_BITS        4:2
1560
`define OR1200_IMMUCFGR_NAE_BITS        7:5
1561
`define OR1200_IMMUCFGR_CRI_BITS        8
1562
`define OR1200_IMMUCFGR_PRI_BITS        9
1563
`define OR1200_IMMUCFGR_TEIRI_BITS      10
1564
`define OR1200_IMMUCFGR_HTR_BITS        11
1565
`define OR1200_IMMUCFGR_RES1_BITS       31:12
1566
 
1567
// IMMUCFGR values
1568
`ifdef OR1200_NO_IMMU
1569
`define OR1200_IMMUCFGR_NTW             2'h0    // Irrelevant
1570
`define OR1200_IMMUCFGR_NTS             3'h0    // Irrelevant
1571
`define OR1200_IMMUCFGR_NAE             3'h0    // Irrelevant
1572
`define OR1200_IMMUCFGR_CRI             1'b0    // Irrelevant
1573
`define OR1200_IMMUCFGR_PRI             1'b0    // Irrelevant
1574
`define OR1200_IMMUCFGR_TEIRI           1'b0    // Irrelevant
1575
`define OR1200_IMMUCFGR_HTR             1'b0    // Irrelevant
1576
`define OR1200_IMMUCFGR_RES1            20'h00000
1577
`else
1578
`define OR1200_IMMUCFGR_NTW             2'h0    // 1 TLB way
1579
`define OR1200_IMMUCFGR_NTS 3'h`OR1200_ITLB_INDXW       // Num TLB sets
1580
`define OR1200_IMMUCFGR_NAE             3'h0    // No ATB entry
1581
`define OR1200_IMMUCFGR_CRI             1'b0    // No control reg
1582
`define OR1200_IMMUCFGR_PRI             1'b0    // No protection reg
1583
`define OR1200_IMMUCFGR_TEIRI           1'b1    // TLB entry inv reg impl
1584
`define OR1200_IMMUCFGR_HTR             1'b0    // No HW TLB reload
1585
`define OR1200_IMMUCFGR_RES1            20'h00000
1586
`endif
1587
 
1588
// DCCFGR fields
1589
`define OR1200_DCCFGR_NCW_BITS          2:0
1590
`define OR1200_DCCFGR_NCS_BITS          6:3
1591
`define OR1200_DCCFGR_CBS_BITS          7
1592
`define OR1200_DCCFGR_CWS_BITS          8
1593
`define OR1200_DCCFGR_CCRI_BITS         9
1594
`define OR1200_DCCFGR_CBIRI_BITS        10
1595
`define OR1200_DCCFGR_CBPRI_BITS        11
1596
`define OR1200_DCCFGR_CBLRI_BITS        12
1597
`define OR1200_DCCFGR_CBFRI_BITS        13
1598
`define OR1200_DCCFGR_CBWBRI_BITS       14
1599
`define OR1200_DCCFGR_RES1_BITS 31:15
1600
 
1601
// DCCFGR values
1602
`ifdef OR1200_NO_DC
1603
`define OR1200_DCCFGR_NCW               3'h0    // Irrelevant
1604
`define OR1200_DCCFGR_NCS               4'h0    // Irrelevant
1605
`define OR1200_DCCFGR_CBS               1'b0    // Irrelevant
1606
`define OR1200_DCCFGR_CWS               1'b0    // Irrelevant
1607 141 marcus.erl
`define OR1200_DCCFGR_CCRI              1'b0    // Irrelevant
1608
`define OR1200_DCCFGR_CBIRI             1'b0    // Irrelevant
1609 10 unneback
`define OR1200_DCCFGR_CBPRI             1'b0    // Irrelevant
1610
`define OR1200_DCCFGR_CBLRI             1'b0    // Irrelevant
1611 141 marcus.erl
`define OR1200_DCCFGR_CBFRI             1'b0    // Irrelevant
1612 10 unneback
`define OR1200_DCCFGR_CBWBRI            1'b0    // Irrelevant
1613
`define OR1200_DCCFGR_RES1              17'h00000
1614
`else
1615
`define OR1200_DCCFGR_NCW               3'h0    // 1 cache way
1616
`define OR1200_DCCFGR_NCS (`OR1200_DCTAG)       // Num cache sets
1617
`define OR1200_DCCFGR_CBS (`OR1200_DCLS-4)      // 16 byte cache block
1618 258 julius
`ifdef OR1200_DC_WRITETHROUGH
1619
 `define OR1200_DCCFGR_CWS              1'b0    // Write-through strategy
1620
`else
1621
 `define OR1200_DCCFGR_CWS              1'b1    // Write-back strategy
1622
`endif
1623 10 unneback
`define OR1200_DCCFGR_CCRI              1'b1    // Cache control reg impl.
1624
`define OR1200_DCCFGR_CBIRI             1'b1    // Cache block inv reg impl.
1625
`define OR1200_DCCFGR_CBPRI             1'b0    // Cache block prefetch reg not impl.
1626
`define OR1200_DCCFGR_CBLRI             1'b0    // Cache block lock reg not impl.
1627
`define OR1200_DCCFGR_CBFRI             1'b1    // Cache block flush reg impl.
1628 258 julius
`ifdef OR1200_DC_WRITETHROUGH
1629
 `define OR1200_DCCFGR_CBWBRI           1'b0    // Cache block WB reg not impl.
1630
`else
1631
 `define OR1200_DCCFGR_CBWBRI           1'b1    // Cache block WB reg impl.
1632
`endif
1633 10 unneback
`define OR1200_DCCFGR_RES1              17'h00000
1634
`endif
1635
 
1636
// ICCFGR fields
1637
`define OR1200_ICCFGR_NCW_BITS          2:0
1638
`define OR1200_ICCFGR_NCS_BITS          6:3
1639
`define OR1200_ICCFGR_CBS_BITS          7
1640
`define OR1200_ICCFGR_CWS_BITS          8
1641
`define OR1200_ICCFGR_CCRI_BITS         9
1642
`define OR1200_ICCFGR_CBIRI_BITS        10
1643
`define OR1200_ICCFGR_CBPRI_BITS        11
1644
`define OR1200_ICCFGR_CBLRI_BITS        12
1645
`define OR1200_ICCFGR_CBFRI_BITS        13
1646
`define OR1200_ICCFGR_CBWBRI_BITS       14
1647
`define OR1200_ICCFGR_RES1_BITS 31:15
1648
 
1649
// ICCFGR values
1650
`ifdef OR1200_NO_IC
1651
`define OR1200_ICCFGR_NCW               3'h0    // Irrelevant
1652
`define OR1200_ICCFGR_NCS               4'h0    // Irrelevant
1653
`define OR1200_ICCFGR_CBS               1'b0    // Irrelevant
1654
`define OR1200_ICCFGR_CWS               1'b0    // Irrelevant
1655
`define OR1200_ICCFGR_CCRI              1'b0    // Irrelevant
1656
`define OR1200_ICCFGR_CBIRI             1'b0    // Irrelevant
1657
`define OR1200_ICCFGR_CBPRI             1'b0    // Irrelevant
1658
`define OR1200_ICCFGR_CBLRI             1'b0    // Irrelevant
1659
`define OR1200_ICCFGR_CBFRI             1'b0    // Irrelevant
1660
`define OR1200_ICCFGR_CBWBRI            1'b0    // Irrelevant
1661
`define OR1200_ICCFGR_RES1              17'h00000
1662
`else
1663
`define OR1200_ICCFGR_NCW               3'h0    // 1 cache way
1664
`define OR1200_ICCFGR_NCS (`OR1200_ICTAG)       // Num cache sets
1665
`define OR1200_ICCFGR_CBS (`OR1200_ICLS-4)      // 16 byte cache block
1666
`define OR1200_ICCFGR_CWS               1'b0    // Irrelevant
1667
`define OR1200_ICCFGR_CCRI              1'b1    // Cache control reg impl.
1668
`define OR1200_ICCFGR_CBIRI             1'b1    // Cache block inv reg impl.
1669
`define OR1200_ICCFGR_CBPRI             1'b0    // Cache block prefetch reg not impl.
1670
`define OR1200_ICCFGR_CBLRI             1'b0    // Cache block lock reg not impl.
1671
`define OR1200_ICCFGR_CBFRI             1'b1    // Cache block flush reg impl.
1672
`define OR1200_ICCFGR_CBWBRI            1'b0    // Irrelevant
1673
`define OR1200_ICCFGR_RES1              17'h00000
1674
`endif
1675
 
1676
// DCFGR fields
1677 141 marcus.erl
`define OR1200_DCFGR_NDP_BITS           3:0
1678
`define OR1200_DCFGR_WPCI_BITS          4
1679
`define OR1200_DCFGR_RES1_BITS          31:5
1680 10 unneback
 
1681
// DCFGR values
1682
`ifdef OR1200_DU_HWBKPTS
1683 141 marcus.erl
`define OR1200_DCFGR_NDP                4'h`OR1200_DU_DVRDCR_PAIRS // # of DVR/DCR pairs
1684 10 unneback
`ifdef OR1200_DU_DWCR0
1685
`define OR1200_DCFGR_WPCI               1'b1
1686
`else
1687
`define OR1200_DCFGR_WPCI               1'b0    // WP counters not impl.
1688
`endif
1689
`else
1690 141 marcus.erl
`define OR1200_DCFGR_NDP                4'h0    // Zero DVR/DCR pairs
1691 10 unneback
`define OR1200_DCFGR_WPCI               1'b0    // WP counters not impl.
1692
`endif
1693
`define OR1200_DCFGR_RES1               28'h0000000
1694 141 marcus.erl
 
1695
///////////////////////////////////////////////////////////////////////////////
1696
// Boot Address Selection                                                    //
1697 185 julius
// This only changes where the initial reset occurs. EPH setting is still    //
1698
// used to determine where vectors are located.                              //
1699 141 marcus.erl
///////////////////////////////////////////////////////////////////////////////
1700 185 julius
 // Boot from 0xf0000100
1701 258 julius
//`define OR1200_BOOT_PCREG_DEFAULT 30'h3c00003f
1702
//`define OR1200_BOOT_ADR 32'hf0000100
1703 141 marcus.erl
// Boot from 0x100
1704 258 julius
 `define OR1200_BOOT_PCREG_DEFAULT 30'h0000003f
1705
 `define OR1200_BOOT_ADR 32'h00000100

powered by: WebSVN 2.1.0

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