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 1063

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