OpenCores
URL https://opencores.org/ocsvn/an-fpga-implementation-of-low-latency-noc-based-mpsoc/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk

Subversion Repositories an-fpga-implementation-of-low-latency-noc-based-mpsoc

[/] [an-fpga-implementation-of-low-latency-noc-based-mpsoc/] [trunk/] [mpsoc/] [src_processor/] [or1200/] [verilog/] [or1200_defines] - Blame information for rev 38

Details | Compare with Previous | View Log

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