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

Subversion Repositories openrisc

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

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