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

Subversion Repositories or1k

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

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