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

Subversion Repositories or1k

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

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

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

powered by: WebSVN 2.1.0

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