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

Subversion Repositories or1k

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

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 512 lampret
// Revision 1.1  2002/01/03 08:16:15  lampret
48
// New prefixes for RTL files, prefixed module names. Updated cache controllers and MMUs.
49
//
50 504 lampret
// Revision 1.20  2001/12/04 05:02:36  lampret
51
// Added OR1200_GENERIC_MULTP2_32X32 and OR1200_ASIC_MULTP2_32X32
52
//
53
// Revision 1.19  2001/11/27 19:46:57  lampret
54
// Now FPGA and ASIC target are separate.
55
//
56
// Revision 1.18  2001/11/23 21:42:31  simons
57
// Program counter divided to PPC and NPC.
58
//
59
// Revision 1.17  2001/11/23 08:38:51  lampret
60
// Changed DSR/DRR behavior and exception detection.
61
//
62
// Revision 1.16  2001/11/20 21:30:38  lampret
63
// Added OR1200_REGISTERED_INPUTS.
64
//
65
// Revision 1.15  2001/11/19 14:29:48  simons
66
// Cashes disabled.
67
//
68
// Revision 1.14  2001/11/13 10:02:21  lampret
69
// Added 'setpc'. Renamed some signals (except_flushpipe into flushpipe etc)
70
//
71
// Revision 1.13  2001/11/12 01:45:40  lampret
72
// Moved flag bit into SR. Changed RF enable from constant enable to dynamic enable for read ports.
73
//
74
// Revision 1.12  2001/11/10 03:43:57  lampret
75
// Fixed exceptions.
76
//
77
// Revision 1.11  2001/11/02 18:57:14  lampret
78
// Modified virtual silicon instantiations.
79
//
80
// Revision 1.10  2001/10/21 17:57:16  lampret
81
// 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.
82
//
83
// Revision 1.9  2001/10/19 23:28:46  lampret
84
// Fixed some synthesis warnings. Configured with caches and MMUs.
85
//
86
// Revision 1.8  2001/10/14 13:12:09  lampret
87
// MP3 version.
88
//
89
// Revision 1.1.1.1  2001/10/06 10:18:36  igorm
90
// no message
91
//
92
// Revision 1.3  2001/08/17 08:01:19  lampret
93
// IC enable/disable.
94
//
95
// Revision 1.2  2001/08/13 03:36:20  lampret
96
// Added cfg regs. Moved all defines into one defines.v file. More cleanup.
97
//
98
// Revision 1.1  2001/08/09 13:39:33  lampret
99
// Major clean-up.
100
//
101
// Revision 1.2  2001/07/22 03:31:54  lampret
102
// Fixed RAM's oen bug. Cache bypass under development.
103
//
104
// Revision 1.1  2001/07/20 00:46:03  lampret
105
// Development version of RTL. Libraries are missing.
106
//
107
//
108
 
109
//
110
// Dump VCD
111
//
112
//`define OR1200_VCD_DUMP
113
 
114
//
115
// Generate debug messages during simulation
116
//
117
//`define OR1200_VERBOSE
118
 
119
 
120
////////////////////////////////////////////////////////
121
//
122
// Typical configuration for an ASIC
123
//
124
`ifdef OR1200_ASIC
125
 
126
//
127
// Target ASIC memories
128
//
129
//`define OR1200_ARTISAN_SSP
130
//`define OR1200_ARTISAN_SDP
131
//`define OR1200_ARTISAN_STP
132
`define OR1200_VIRTUALSILICON_SSP
133
`define OR1200_VIRTUALSILICON_STP
134
 
135
//
136
// Do not implement Data cache
137
//
138
//`define OR1200_NO_DC
139
 
140
//
141
// Do not implement Insn cache
142
//
143
//`define OR1200_NO_IC
144
 
145
//
146
// Do not implement Data MMU
147
//
148
//`define OR1200_NO_DMMU
149
 
150
//
151
// Do not implement Insn MMU
152
//
153
//`define OR1200_NO_IMMU
154
 
155
//
156
// Register OR1200 WISHBONE outputs
157
// (at the moment correct operation
158
// only with registered outputs)
159
//
160 512 lampret
//`define OR1200_REGISTERED_OUTPUTS
161 504 lampret
 
162
//
163
// Register OR1200 WISHBNE inputs
164
//
165
`define OR1200_REGISTERED_INPUTS
166
 
167
//
168
// Select between ASIC optimized and generic multiplier
169
//
170
`define OR1200_ASIC_MULTP2_32X32
171
//`define OR1200_GENERIC_MULTP2_32X32
172
 
173
//
174
// Size/type of insn/data cache if implemented
175
//
176
// `define OR1200_IC_1W_4KB
177
`define OR1200_IC_1W_8KB
178
// `define OR1200_DC_1W_4KB
179
`define OR1200_DC_1W_8KB
180
 
181
`else
182
 
183
 
184
/////////////////////////////////////////////////////////
185
//
186
// Typical configuration for an FPGA
187
//
188
 
189
//
190
// Target FPGA memories
191
//
192
`define OR1200_XILINX_RAMB4
193
//`define OR1200_XILINX_RAM32X1D
194
 
195
//
196
// Do not implement Data cache
197
//
198
//`define OR1200_NO_DC
199
 
200
//
201
// Do not implement Insn cache
202
//
203
//`define OR1200_NO_IC
204
 
205
//
206
// Do not implement Data MMU
207
//
208
//`define OR1200_NO_DMMU
209
 
210
//
211
// Do not implement Insn MMU
212
//
213
//`define OR1200_NO_IMMU
214
 
215
//
216
// Register OR1200 WISHBONE outputs
217
// (at the moment works only with
218
// registered outputs)
219
//
220 512 lampret
`define OR1200_REGISTERED_OUTPUTS
221 504 lampret
 
222
//
223
// Register OR1200 WISHBONE inputs
224
//
225
//`define OR1200_REGISTERED_INPUTS
226
 
227
//
228
// Select between ASIC and generic multiplier
229
//
230
//`define OR1200_ASIC_MULTP2_32X32
231
`define OR1200_GENERIC_MULTP2_32X32
232
 
233
//
234
// Size/type of insn/data cache if implemented
235
// (consider available FPGA memory resources)
236
//
237
`define OR1200_IC_1W_4KB
238
//`define OR1200_IC_1W_8KB
239
`define OR1200_DC_1W_4KB
240
//`define OR1200_DC_1W_8KB
241
 
242
`endif
243
 
244
 
245
//////////////////////////////////////////////////////////
246
//
247
// Do not change below unless you know what you are doing
248
//
249
 
250
// Operand width / register file address width
251
`define OR1200_OPERAND_WIDTH            32
252
`define OR1200_REGFILE_ADDR_WIDTH       5
253
 
254
//
255
// Implement rotate in the ALU
256
//
257
//`define OR1200_IMPL_ALU_ROTATE
258
 
259
//
260
// Type of ALU compare to implement
261
//
262
//`define OR1200_IMPL_ALU_COMP1
263
`define OR1200_IMPL_ALU_COMP2
264
 
265
//
266
// Select between low-power (larger) multiplier or faster multiplier
267
//
268
`define OR1200_LOWPWR_MULT
269
 
270
//
271
// Clock synchronization for RISC clk and WB divided clocks
272
//
273
// If you plan to run WB:RISC clock 1:1, you can comment these two
274
//
275
`define OR1200_CLKDIV_2_SUPPORTED
276
`define OR1200_CLKDIV_4_SUPPORTED
277
 
278
//
279
// Type of register file RAM
280
//
281
// `define OR1200_RFRAM_TWOPORT
282
 
283
//
284
// Define to use fast (and bigger) version of mem2reg aligner
285
//
286
`define OR1200_MEM2REG_FAST
287
 
288
//
289
// Simulate l.div and l.divu
290
//
291
// If commented, l.div/l.divu will produce undefined result. If enabled,
292
// div instructions will be simulated, but not synthesized ! OR1200
293
// does not have a hardware divider.
294
//
295
`define OR1200_SIM_ALU_DIV
296
`define OR1200_SIM_ALU_DIVU
297
 
298
//
299
// ALUOPs
300
//
301
`define OR1200_ALUOP_WIDTH      4
302
`define OR1200_ALUOP_NOP        4'd0
303
/* Order defined by arith insns that have two source operands both in regs
304
   (see binutils/include/opcode/or32.h) */
305
`define OR1200_ALUOP_ADD        4'd0
306
`define OR1200_ALUOP_ADDC       4'd1
307
`define OR1200_ALUOP_SUB        4'd2
308
`define OR1200_ALUOP_AND        4'd3
309
`define OR1200_ALUOP_OR 4'd4
310
`define OR1200_ALUOP_XOR        4'd5
311
`define OR1200_ALUOP_MUL        4'd6
312
`define OR1200_ALUOP_SHROT      4'd8
313
`define OR1200_ALUOP_DIV        4'd9
314
`define OR1200_ALUOP_DIVU       4'd10
315
/* Order not specifically defined. */
316
`define OR1200_ALUOP_IMM        4'd11
317
`define OR1200_ALUOP_MOVHI      4'd12
318
`define OR1200_ALUOP_COMP       4'd13
319
`define OR1200_ALUOP_MTSR       4'd14
320
`define OR1200_ALUOP_MFSR       4'd15
321
 
322
//
323
// MACOPs
324
//
325
`define OR1200_MACOP_WIDTH      2
326
`define OR1200_MACOP_NOP        2'b00
327
`define OR1200_MACOP_MAC        2'b01
328
`define OR1200_MACOP_MSB        2'b10
329
 
330
//
331
// Shift/rotate ops
332
//
333
`define OR1200_SHROTOP_WIDTH    2
334
`define OR1200_SHROTOP_NOP      2'd0
335
`define OR1200_SHROTOP_SLL      2'd0
336
`define OR1200_SHROTOP_SRL      2'd1
337
`define OR1200_SHROTOP_SRA      2'd2
338
`define OR1200_SHROTOP_ROR      2'd3
339
 
340
// Execution cycles per instruction
341
`define OR1200_MULTICYCLE_WIDTH 2
342
`define OR1200_ONE_CYCLE                2'd0
343
`define OR1200_TWO_CYCLES               2'd1
344
 
345
// Operand MUX selects
346
`define OR1200_SEL_WIDTH                2
347
`define OR1200_SEL_RF                   2'd0
348
`define OR1200_SEL_IMM                  2'd1
349
`define OR1200_SEL_EX_FORW              2'd2
350
`define OR1200_SEL_WB_FORW              2'd3
351
 
352
//
353
// BRANCHOPs
354
//
355
`define OR1200_BRANCHOP_WIDTH           3
356
`define OR1200_BRANCHOP_NOP             3'd0
357
`define OR1200_BRANCHOP_J               3'd1
358
`define OR1200_BRANCHOP_JR              3'd2
359
`define OR1200_BRANCHOP_BAL             3'd3
360
`define OR1200_BRANCHOP_BF              3'd4
361
`define OR1200_BRANCHOP_BNF             3'd5
362
`define OR1200_BRANCHOP_RFE             3'd6
363
 
364
//
365
// LSUOPs
366
//
367
// Bit 0: sign extend
368
// Bits 1-2: 00 doubleword, 01 byte, 10 halfword, 11 singleword
369
// Bit 3: 0 load, 1 store
370
`define OR1200_LSUOP_WIDTH              4
371
`define OR1200_LSUOP_NOP                4'b0000
372
`define OR1200_LSUOP_LBZ                4'b0010
373
`define OR1200_LSUOP_LBS                4'b0011
374
`define OR1200_LSUOP_LHZ                4'b0100
375
`define OR1200_LSUOP_LHS                4'b0101
376
`define OR1200_LSUOP_LWZ                4'b0110
377
`define OR1200_LSUOP_LWS                4'b0111
378
`define OR1200_LSUOP_LD         4'b0001
379
`define OR1200_LSUOP_SD         4'b1000
380
`define OR1200_LSUOP_SB         4'b1010
381
`define OR1200_LSUOP_SH         4'b1100
382
`define OR1200_LSUOP_SW         4'b1110
383
 
384
// FETCHOPs
385
`define OR1200_FETCHOP_WIDTH            1
386
`define OR1200_FETCHOP_NOP              1'b0
387
`define OR1200_FETCHOP_LW               1'b1
388
 
389
//
390
// Register File Write-Back OPs
391
//
392
// Bit 0: register file write enable
393
// Bits 2-1: write-back mux selects
394
`define OR1200_RFWBOP_WIDTH             3
395
`define OR1200_RFWBOP_NOP               3'b000
396
`define OR1200_RFWBOP_ALU               3'b001
397
`define OR1200_RFWBOP_LSU               3'b011
398
`define OR1200_RFWBOP_SPRS              3'b101
399
`define OR1200_RFWBOP_LR                3'b111
400
 
401
// Compare instructions
402
`define OR1200_COP_SFEQ       3'b000
403
`define OR1200_COP_SFNE       3'b001
404
`define OR1200_COP_SFGT       3'b010
405
`define OR1200_COP_SFGE       3'b011
406
`define OR1200_COP_SFLT       3'b100
407
`define OR1200_COP_SFLE       3'b101
408
`define OR1200_COP_X          3'b111
409
`define OR1200_SIGNED_COMPARE 'd3
410
`define OR1200_COMPOP_WIDTH     4
411
 
412
//
413
// TAGs for instruction bus
414
//
415
`define OR1200_ITAG_IDLE        4'h0    // idle bus
416
`define OR1200_ITAG_NI          4'h1    // normal insn
417
`define OR1200_ITAG_BE          4'hb    // Bus error exception
418
`define OR1200_ITAG_PE          4'hc    // Page fault exception
419
`define OR1200_ITAG_TE          4'hd    // TLB miss exception
420
 
421
//
422
// TAGs for data bus
423
//
424
`define OR1200_DTAG_IDLE        4'h0    // idle bus
425
`define OR1200_DTAG_ND          4'h1    // normal data
426
`define OR1200_DTAG_AE          4'ha    // Alignment exception
427
`define OR1200_DTAG_BE          4'hb    // Bus error exception
428
`define OR1200_DTAG_PE          4'hc    // Page fault exception
429
`define OR1200_DTAG_TE          4'hd    // TLB miss exception
430
 
431
 
432
//////////////////////////////////////////////
433
//
434
// ORBIS32 ISA specifics
435
//
436
 
437
// SHROT_OP position in machine word
438
`define OR1200_SHROTOP_POS              7:6
439
 
440
// ALU instructions multicycle field in machine word
441
`define OR1200_ALUMCYC_POS              9:8
442
 
443
//
444
// Instruction opcode groups (basic)
445
//
446
`define OR1200_OR32_J                 6'b000000
447
`define OR1200_OR32_JAL               6'b000001
448
`define OR1200_OR32_BNF               6'b000011
449
`define OR1200_OR32_BF                6'b000100
450
`define OR1200_OR32_NOP               6'b000101
451
`define OR1200_OR32_MOVHI             6'b000110
452
`define OR1200_OR32_XSYNC             6'b001000
453
`define OR1200_OR32_RFE               6'b001001
454
/* */
455
`define OR1200_OR32_JR                6'b010001
456
`define OR1200_OR32_JALR              6'b010010
457
`define OR1200_OR32_MACI              6'b010011
458
/* */
459
`define OR1200_OR32_LWZ               6'b100001
460
`define OR1200_OR32_LBZ               6'b100011
461
`define OR1200_OR32_LBS               6'b100100
462
`define OR1200_OR32_LHZ               6'b100101
463
`define OR1200_OR32_LHS               6'b100110
464
`define OR1200_OR32_ADDI              6'b100111
465
`define OR1200_OR32_ADDIC             6'b101000
466
`define OR1200_OR32_ANDI              6'b101001
467
`define OR1200_OR32_ORI               6'b101010
468
`define OR1200_OR32_XORI              6'b101011
469
`define OR1200_OR32_MULI              6'b101100
470
`define OR1200_OR32_MFSPR             6'b101101
471
`define OR1200_OR32_SH_ROTI           6'b101110
472
`define OR1200_OR32_SFXXI             6'b101111
473
/* */
474
`define OR1200_OR32_MTSPR             6'b110000
475
`define OR1200_OR32_MACMSB            6'b110001
476
/* */
477
`define OR1200_OR32_SW                6'b110101
478
`define OR1200_OR32_SB                6'b110110
479
`define OR1200_OR32_SH                6'b110111
480
`define OR1200_OR32_ALU               6'b111000
481
`define OR1200_OR32_SFXX              6'b111001
482
 
483
 
484
/////////////////////////////////////////////////////
485
//
486
// Exceptions
487
//
488
`define OR1200_EXCEPT_WIDTH 4
489
`define OR1200_EXCEPT_UNUSED            `OR1200_EXCEPT_WIDTH'hf
490
`define OR1200_EXCEPT_TRAP              `OR1200_EXCEPT_WIDTH'he
491
`define OR1200_EXCEPT_BREAK             `OR1200_EXCEPT_WIDTH'hd
492
`define OR1200_EXCEPT_SYSCALL           `OR1200_EXCEPT_WIDTH'hc
493
`define OR1200_EXCEPT_RANGE             `OR1200_EXCEPT_WIDTH'hb
494
`define OR1200_EXCEPT_ITLBMISS          `OR1200_EXCEPT_WIDTH'ha
495
`define OR1200_EXCEPT_DTLBMISS          `OR1200_EXCEPT_WIDTH'h9
496
`define OR1200_EXCEPT_HPINT             `OR1200_EXCEPT_WIDTH'h8
497
`define OR1200_EXCEPT_ILLEGAL           `OR1200_EXCEPT_WIDTH'h7
498
`define OR1200_EXCEPT_ALIGN             `OR1200_EXCEPT_WIDTH'h6
499
`define OR1200_EXCEPT_LPINT             `OR1200_EXCEPT_WIDTH'h5
500
`define OR1200_EXCEPT_IPF               `OR1200_EXCEPT_WIDTH'h4
501
`define OR1200_EXCEPT_DPF               `OR1200_EXCEPT_WIDTH'h3
502
`define OR1200_EXCEPT_BUSERR            `OR1200_EXCEPT_WIDTH'h2
503
`define OR1200_EXCEPT_RESET             `OR1200_EXCEPT_WIDTH'h1
504
`define OR1200_EXCEPT_NONE              `OR1200_EXCEPT_WIDTH'h0
505
 
506
 
507
/////////////////////////////////////////////////////
508
//
509
// SPR groups
510
//
511
 
512
// Bits that define the group
513
`define OR1200_SPR_GROUP_BITS   15:11
514
 
515
// Width of the group bits
516
`define OR1200_SPR_GROUP_WIDTH  5
517
 
518
// Bits that define offset inside the group
519
`define OR1200_SPR_OFS_BITS 10:0
520
 
521
// List of groups
522
`define OR1200_SPR_GROUP_SYS    5'd00
523
`define OR1200_SPR_GROUP_DMMU   5'd01
524
`define OR1200_SPR_GROUP_IMMU   5'd02
525
`define OR1200_SPR_GROUP_DC     5'd03
526
`define OR1200_SPR_GROUP_IC     5'd04
527
`define OR1200_SPR_GROUP_MAC    5'd05
528
`define OR1200_SPR_GROUP_DU     5'd06
529
`define OR1200_SPR_GROUP_PM     5'd08
530
`define OR1200_SPR_GROUP_PIC    5'd09
531
`define OR1200_SPR_GROUP_TT     5'd10
532
 
533
 
534
/////////////////////////////////////////////////////
535
//
536
// System group
537
//
538
 
539
//
540
// System registers
541
//
542
`define OR1200_SPR_CFGR         7'd0
543
`define OR1200_SPR_RF           6'd32   // 1024 >> 5
544
`define OR1200_SPR_NPC          11'd16
545
`define OR1200_SPR_SR           11'd17
546
`define OR1200_SPR_PPC          11'd18
547
`define OR1200_SPR_EPCR         11'd32
548
`define OR1200_SPR_EEAR         11'd48
549
`define OR1200_SPR_ESR          11'd64
550
 
551
//
552
// SR bits
553
//
554
`define OR1200_SR_WIDTH 10
555
`define OR1200_SR_SUPV 0
556
`define OR1200_SR_EXR  1
557
`define OR1200_SR_EIR  2
558
`define OR1200_SR_DCE  3
559
`define OR1200_SR_ICE  4
560
`define OR1200_SR_DME  5
561
`define OR1200_SR_IME  6
562
`define OR1200_SR_LEE  7
563
`define OR1200_SR_CE   8
564
`define OR1200_SR_F    9
565
 
566
// Bits that define offset inside the group
567
`define OR1200_SPROFS_BITS 10:0
568
 
569
//
570
// VR, UPR and Configuration Registers
571
//
572
 
573
// Define if you want configuration registers implemented
574
`define OR1200_CFGR_IMPLEMENTED
575
 
576
// Define if you want full address decode inside SYS group
577
`define OR1200_SYS_FULL_DECODE
578
 
579
// Offsets of VR, UPR and CFGR registers
580
`define OR1200_SPRGRP_SYS_VR            4'h0
581
`define OR1200_SPRGRP_SYS_UPR           4'h1
582
`define OR1200_SPRGRP_SYS_CPUCFGR       4'h2
583
`define OR1200_SPRGRP_SYS_DMMUCFGR      4'h3
584
`define OR1200_SPRGRP_SYS_IMMUCFGR      4'h4
585
`define OR1200_SPRGRP_SYS_DCCFGR        4'h5
586
`define OR1200_SPRGRP_SYS_ICCFGR        4'h6
587
`define OR1200_SPRGRP_SYS_DCFGR 4'h7
588
 
589
// VR fields
590
`define OR1200_VR_REV_BITS              5:0
591
`define OR1200_VR_RES1_BITS             15:6
592
`define OR1200_VR_CFG_BITS              23:16
593
`define OR1200_VR_VER_BITS              31:24
594
 
595
// VR values
596
`define OR1200_VR_REV                   6'h00
597
`define OR1200_VR_RES1                  10'h000
598
`define OR1200_VR_CFG                   8'h00
599
`define OR1200_VR_VER                   8'h12
600
 
601
// UPR fields
602
`define OR1200_UPR_UP_BITS              0
603
`define OR1200_UPR_DCP_BITS             1
604
`define OR1200_UPR_ICP_BITS             2
605
`define OR1200_UPR_DMP_BITS             3
606
`define OR1200_UPR_IMP_BITS             4
607
`define OR1200_UPR_MP_BITS              5
608
`define OR1200_UPR_DUP_BITS             6
609
`define OR1200_UPR_PCUP_BITS            7
610
`define OR1200_UPR_PMP_BITS             8
611
`define OR1200_UPR_PICP_BITS            9
612
`define OR1200_UPR_TTP_BITS             10
613
`define OR1200_UPR_RES1_BITS            23:11
614
`define OR1200_UPR_CUP_BITS             31:24
615
 
616
// UPR values
617
`define OR1200_UPR_UP                   1'b1
618
`define OR1200_UPR_DCP                  1'b1
619
`define OR1200_UPR_ICP                  1'b1
620
`define OR1200_UPR_DMP                  1'b1
621
`define OR1200_UPR_IMP                  1'b1
622
`define OR1200_UPR_MP                   1'b1
623
`define OR1200_UPR_DUP                  1'b1
624
`define OR1200_UPR_PCUP         1'b0
625
`define OR1200_UPR_PMP                  1'b1
626
`define OR1200_UPR_PICP         1'b1
627
`define OR1200_UPR_TTP                  1'b1
628
`define OR1200_UPR_RES1         13'h0000
629
`define OR1200_UPR_CUP                  8'h00
630
 
631
// CPUCFGR fields
632
`define OR1200_CPUCFGR_NSGF_BITS        3:0
633
`define OR1200_CPUCFGR_HGF_BITS 4
634
`define OR1200_CPUCFGR_OB32S_BITS       5
635
`define OR1200_CPUCFGR_OB64S_BITS       6
636
`define OR1200_CPUCFGR_OF32S_BITS       7
637
`define OR1200_CPUCFGR_OF64S_BITS       8
638
`define OR1200_CPUCFGR_OV64S_BITS       9
639
`define OR1200_CPUCFGR_RES1_BITS        31:10
640
 
641
// CPUCFGR values
642
`define OR1200_CPUCFGR_NSGF             4'h0
643
`define OR1200_CPUCFGR_HGF              1'b0
644
`define OR1200_CPUCFGR_OB32S            1'b1
645
`define OR1200_CPUCFGR_OB64S            1'b0
646
`define OR1200_CPUCFGR_OF32S            1'b0
647
`define OR1200_CPUCFGR_OF64S            1'b0
648
`define OR1200_CPUCFGR_OV64S            1'b0
649
`define OR1200_CPUCFGR_RES1             22'h000000
650
 
651
// DMMUCFGR fields
652
`define OR1200_DMMUCFGR_NTW_BITS        1:0
653
`define OR1200_DMMUCFGR_NTS_BITS        4:2
654
`define OR1200_DMMUCFGR_NAE_BITS        7:5
655
`define OR1200_DMMUCFGR_CRI_BITS        8
656
`define OR1200_DMMUCFGR_PRI_BITS        9
657
`define OR1200_DMMUCFGR_TEIRI_BITS      10
658
`define OR1200_DMMUCFGR_HTR_BITS        11
659
`define OR1200_DMMUCFGR_RES1_BITS       31:12
660
 
661
// DMMUCFGR values
662
`define OR1200_DMMUCFGR_NTW             2'h0
663
`define OR1200_DMMUCFGR_NTS             3'h5
664
`define OR1200_DMMUCFGR_NAE             3'h0
665
`define OR1200_DMMUCFGR_CRI             1'b0
666
`define OR1200_DMMUCFGR_PRI             1'b0
667
`define OR1200_DMMUCFGR_TEIRI           1'b1
668
`define OR1200_DMMUCFGR_HTR             1'b0
669
`define OR1200_DMMUCFGR_RES1            20'h00000
670
 
671
// IMMUCFGR fields
672
`define OR1200_IMMUCFGR_NTW_BITS        1:0
673
`define OR1200_IMMUCFGR_NTS_BITS        4:2
674
`define OR1200_IMMUCFGR_NAE_BITS        7:5
675
`define OR1200_IMMUCFGR_CRI_BITS        8
676
`define OR1200_IMMUCFGR_PRI_BITS        9
677
`define OR1200_IMMUCFGR_TEIRI_BITS      10
678
`define OR1200_IMMUCFGR_HTR_BITS        11
679
`define OR1200_IMMUCFGR_RES1_BITS       31:12
680
 
681
// IMMUCFGR values
682
`define OR1200_IMMUCFGR_NTW             2'h0
683
`define OR1200_IMMUCFGR_NTS             3'h5
684
`define OR1200_IMMUCFGR_NAE             3'h0
685
`define OR1200_IMMUCFGR_CRI             1'b0
686
`define OR1200_IMMUCFGR_PRI             1'b0
687
`define OR1200_IMMUCFGR_TEIRI           1'b1
688
`define OR1200_IMMUCFGR_HTR             1'b0
689
`define OR1200_IMMUCFGR_RES1            20'h00000
690
 
691
// DCCFGR fields
692
`define OR1200_DCCFGR_NCW_BITS          2:0
693
`define OR1200_DCCFGR_NCS_BITS          6:3
694
`define OR1200_DCCFGR_CBS_BITS          7
695
`define OR1200_DCCFGR_CWS_BITS          8
696
`define OR1200_DCCFGR_CCRI_BITS 9
697
`define OR1200_DCCFGR_CBIRI_BITS        10
698
`define OR1200_DCCFGR_CBPRI_BITS        11
699
`define OR1200_DCCFGR_CBLRI_BITS        12
700
`define OR1200_DCCFGR_CBFRI_BITS        13
701
`define OR1200_DCCFGR_CBWBRI_BITS       14
702
`define OR1200_DCCFGR_RES1_BITS 31:15
703
 
704
// DCCFGR values
705
`define OR1200_DCCFGR_NCW               3'h0
706
`define OR1200_DCCFGR_NCS               4'h5
707
`define OR1200_DCCFGR_CBS               1'b0
708
`define OR1200_DCCFGR_CWS               1'b0
709
`define OR1200_DCCFGR_CCRI              1'b1
710
`define OR1200_DCCFGR_CBIRI             1'b1
711
`define OR1200_DCCFGR_CBPRI             1'b0
712
`define OR1200_DCCFGR_CBLRI             1'b0
713
`define OR1200_DCCFGR_CBFRI             1'b0
714
`define OR1200_DCCFGR_CBWBRI            1'b1
715
`define OR1200_DCCFGR_RES1              17'h00000
716
 
717
// ICCFGR fields
718
`define OR1200_ICCFGR_NCW_BITS          2:0
719
`define OR1200_ICCFGR_NCS_BITS          6:3
720
`define OR1200_ICCFGR_CBS_BITS          7
721
`define OR1200_ICCFGR_CWS_BITS          8
722
`define OR1200_ICCFGR_CCRI_BITS 9
723
`define OR1200_ICCFGR_CBIRI_BITS        10
724
`define OR1200_ICCFGR_CBPRI_BITS        11
725
`define OR1200_ICCFGR_CBLRI_BITS        12
726
`define OR1200_ICCFGR_CBFRI_BITS        13
727
`define OR1200_ICCFGR_CBWBRI_BITS       14
728
`define OR1200_ICCFGR_RES1_BITS 31:15
729
 
730
// ICCFGR values
731
`define OR1200_ICCFGR_NCW               3'h0
732
`define OR1200_ICCFGR_NCS               4'h5
733
`define OR1200_ICCFGR_CBS               1'b0
734
`define OR1200_ICCFGR_CWS               1'b0
735
`define OR1200_ICCFGR_CCRI              1'b1
736
`define OR1200_ICCFGR_CBIRI             1'b1
737
`define OR1200_ICCFGR_CBPRI             1'b0
738
`define OR1200_ICCFGR_CBLRI             1'b0
739
`define OR1200_ICCFGR_CBFRI             1'b0
740
`define OR1200_ICCFGR_CBWBRI            1'b1
741
`define OR1200_ICCFGR_RES1              17'h00000
742
 
743
// DCFGR fields
744
`define OR1200_DCFGR_NDP_BITS           2:0
745
`define OR1200_DCFGR_WPCI_BITS          3
746
`define OR1200_DCFGR_RES1_BITS          31:4
747
 
748
// DCFGR values
749
`define OR1200_DCFGR_NDP                3'h0
750
`define OR1200_DCFGR_WPCI               1'b0
751
`define OR1200_DCFGR_RES1               28'h0000000
752
 
753
 
754
/////////////////////////////////////////////////////
755
//
756
// Power Management (PM)
757
//
758
 
759
// Define it if you want PM implemented
760
`define OR1200_PM_IMPLEMENTED
761
 
762
// Bit positions inside PMR (don't change)
763
`define OR1200_PM_PMR_SDF 3:0
764
`define OR1200_PM_PMR_DME 4
765
`define OR1200_PM_PMR_SME 5
766
`define OR1200_PM_PMR_DCGE 6
767
`define OR1200_PM_PMR_UNUSED 31:7
768
 
769
// PMR offset inside PM group of registers
770
`define OR1200_PM_OFS_PMR 11'b0
771
 
772
// PM group
773
`define OR1200_SPRGRP_PM 5'd8
774
 
775
// Define if PMR can be read/written at any address inside PM group
776
`define OR1200_PM_PARTIAL_DECODING
777
 
778
// Define if reading PMR is allowed
779
`define OR1200_PM_READREGS
780
 
781
// Define if unused PMR bits should be zero
782
`define OR1200_PM_UNUSED_ZERO
783
 
784
 
785
/////////////////////////////////////////////////////
786
//
787
// Debug Unit (DU)
788
//
789
 
790
// Define it if you want DU implemented
791
`define OR1200_DU_IMPLEMENTED
792
 
793
// Address offsets of DU registers inside DU group
794
`define OR1200_DU_OFS_DMR1 5'd16
795
`define OR1200_DU_OFS_DMR2 5'd17
796
`define OR1200_DU_OFS_DSR 5'd20
797
`define OR1200_DU_OFS_DRR 5'd21
798
 
799
// Position of offset bits inside SPR address
800
`define OR1200_DUOFS_BITS 4:0
801
 
802
// Define if you want these DU registers to be implemented
803
`define OR1200_DU_DMR1
804
`define OR1200_DU_DMR2
805
`define OR1200_DU_DSR
806
`define OR1200_DU_DRR
807
 
808
// DMR1 bits
809
`define OR1200_DU_DMR1_ST 22
810
 
811
// DSR bits
812
`define OR1200_DU_DSR_WIDTH     14
813
`define OR1200_DU_DSR_RSTE      0
814
`define OR1200_DU_DSR_BUSEE     1
815
`define OR1200_DU_DSR_DPFE      2
816
`define OR1200_DU_DSR_IPFE      3
817
`define OR1200_DU_DSR_LPINTE    4
818
`define OR1200_DU_DSR_AE        5
819
`define OR1200_DU_DSR_IIE       6
820
`define OR1200_DU_DSR_HPINTE    7
821
`define OR1200_DU_DSR_DME       8
822
`define OR1200_DU_DSR_IME       9
823
`define OR1200_DU_DSR_RE        10
824
`define OR1200_DU_DSR_SCE       11
825
`define OR1200_DU_DSR_BE        12
826
`define OR1200_DU_DSR_TE        13
827
 
828
// DRR bits
829
`define OR1200_DU_DRR_RSTE      0
830
`define OR1200_DU_DRR_BUSEE     1
831
`define OR1200_DU_DRR_DPFE      2
832
`define OR1200_DU_DRR_IPFE      3
833
`define OR1200_DU_DRR_LPINTE    4
834
`define OR1200_DU_DRR_AE        5
835
`define OR1200_DU_DRR_IIE       6
836
`define OR1200_DU_DRR_HPINTE    7
837
`define OR1200_DU_DRR_DME       8
838
`define OR1200_DU_DRR_IME       9
839
`define OR1200_DU_DRR_RE        10
840
`define OR1200_DU_DRR_SCE       11
841
`define OR1200_DU_DRR_BE        12
842
`define OR1200_DU_DRR_TE        13
843
 
844
// Define if reading DU regs is allowed
845
`define OR1200_DU_READREGS
846
 
847
// Define if unused DU registers bits should be zero
848
`define OR1200_DU_UNUSED_ZERO
849
 
850
// DU operation commands
851
`define OR1200_DU_OP_READSPR    3'd4
852
`define OR1200_DU_OP_WRITESPR   3'd5
853
 
854
 
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_PICPR 2'd1
869
`define OR1200_PIC_OFS_PICSR 2'd2
870
 
871
// Position of offset bits inside SPR address
872
`define OR1200_PICOFS_BITS 1:0
873
 
874
// Define if you want these PIC registers to be implemented
875
`define OR1200_PIC_PICMR
876
`define OR1200_PIC_PICPR
877
`define OR1200_PIC_PICSR
878
 
879
// Define if reading PIC registers is allowed
880
`define OR1200_PIC_READREGS
881
 
882
// Define if unused PIC register bits should be zero
883
`define OR1200_PIC_UNUSED_ZERO
884
 
885
 
886
/////////////////////////////////////////////////////
887
//
888
// Tick Timer (TT)
889
//
890
 
891
// Define it if you want TT implemented
892
`define OR1200_TT_IMPLEMENTED
893
 
894
// Address offsets of TT registers inside TT group
895
`define OR1200_TT_OFS_TTMR 1'd0
896
`define OR1200_TT_OFS_TTCR 1'd1
897
 
898
// Position of offset bits inside SPR group
899
`define OR1200_TTOFS_BITS 0
900
 
901
// Define if you want these TT registers to be implemented
902
`define OR1200_TT_TTMR
903
`define OR1200_TT_TTCR
904
 
905
// TTMR bits
906
`define OR1200_TT_TTMR_TP 27:0
907
`define OR1200_TT_TTMR_IP 28
908
`define OR1200_TT_TTMR_IE 29
909
`define OR1200_TT_TTMR_M 31:30
910
 
911
// Define if reading TT registers is allowed
912
`define OR1200_TT_READREGS
913
 
914
 
915
//////////////////////////////////////////////
916
//
917
// MAC
918
//
919
`define OR1200_MAC_ADDR         0        // MACLO 0xxxxxxxx1, MACHI 0xxxxxxxx0
920
`define OR1200_MAC_SPR_WE               // Define if MACLO/MACHI are SPR writable
921
 
922
 
923
//////////////////////////////////////////////
924
//
925
// Data MMU (DMMU)
926
//
927
 
928
//
929
// Address that selects between TLB TR and MR
930
//
931
`define OR1200_DTLB_TM_ADDR     8
932
 
933
//
934
// DTLBMR fields
935
//
936
`define OR1200_DTLBMR_V_BITS    0
937
`define OR1200_DTLBMR_CID_BITS  4:1
938
`define OR1200_DTLBMR_RES_BITS  11:5
939
`define OR1200_DTLBMR_VPN_BITS  31:13
940
 
941
//
942
// DTLBTR fields
943
//
944
`define OR1200_DTLBTR_CC_BITS   0
945
`define OR1200_DTLBTR_CI_BITS   1
946
`define OR1200_DTLBTR_WBC_BITS  2
947
`define OR1200_DTLBTR_WOM_BITS  3
948
`define OR1200_DTLBTR_A_BITS    4
949
`define OR1200_DTLBTR_D_BITS    5
950
`define OR1200_DTLBTR_URE_BITS  6
951
`define OR1200_DTLBTR_UWE_BITS  7
952
`define OR1200_DTLBTR_SRE_BITS  8
953
`define OR1200_DTLBTR_SWE_BITS  9
954
`define OR1200_DTLBTR_RES_BITS  11:10
955
`define OR1200_DTLBTR_PPN_BITS  31:13
956
 
957
//
958
// DTLB configuration
959
//
960
`define OR1200_DMMU_PS          13                                      // 13 for 8KB page size
961
`define OR1200_DTLB_INDXW       6                                       // 6 for 64 entry DTLB  7 for 128 entries
962
`define OR1200_DTLB_INDXL       `OR1200_DMMU_PS                         // 13                   13
963
`define OR1200_DTLB_INDXH       `OR1200_DMMU_PS+`OR1200_DTLB_INDXW-1    // 18                   19
964
`define OR1200_DTLB_INDX        `OR1200_DTLB_INDXH:`OR1200_DTLB_INDXL   // 18:13                19:13
965
`define OR1200_DTLB_TAGW        32-`OR1200_DTLB_INDXW-`OR1200_DMMU_PS   // 13                   12
966
`define OR1200_DTLB_TAGL        `OR1200_DTLB_INDXH+1                    // 19                   20
967
`define OR1200_DTLB_TAG         31:`OR1200_DTLB_TAGL                    // 31:19                31:20
968
`define OR1200_DTLBMRW          `OR1200_DTLB_TAGW+1                     // +1 because of V bit
969
`define OR1200_DTLBTRW          32-`OR1200_DMMU_PS+5                    // +5 because of protection bits and CI
970
 
971
 
972
//////////////////////////////////////////////
973
//
974
// Insn MMU (IMMU)
975
//
976
 
977
//
978
// Address that selects between TLB TR and MR
979
//
980
`define OR1200_ITLB_TM_ADDR     8
981
 
982
//
983
// ITLBMR fields
984
//
985
`define OR1200_ITLBMR_V_BITS    0
986
`define OR1200_ITLBMR_CID_BITS  4:1
987
`define OR1200_ITLBMR_RES_BITS  11:5
988
`define OR1200_ITLBMR_VPN_BITS  31:13
989
 
990
//
991
// ITLBTR fields
992
//
993
`define OR1200_ITLBTR_CC_BITS   0
994
`define OR1200_ITLBTR_CI_BITS   1
995
`define OR1200_ITLBTR_WBC_BITS  2
996
`define OR1200_ITLBTR_WOM_BITS  3
997
`define OR1200_ITLBTR_A_BITS    4
998
`define OR1200_ITLBTR_D_BITS    5
999
`define OR1200_ITLBTR_SXE_BITS  6
1000
`define OR1200_ITLBTR_UXE_BITS  7
1001
`define OR1200_ITLBTR_RES_BITS  11:8
1002
`define OR1200_ITLBTR_PPN_BITS  31:13
1003
 
1004
//
1005
// ITLB configuration
1006
//
1007
`define OR1200_IMMU_PS          13                                      // 13 for 8KB page size
1008
`define OR1200_ITLB_INDXW       6                                       // 6 for 64 entry ITLB  7 for 128 entries
1009
`define OR1200_ITLB_INDXL       `OR1200_IMMU_PS                         // 13                   13
1010
`define OR1200_ITLB_INDXH       `OR1200_IMMU_PS+`OR1200_ITLB_INDXW-1    // 18                   19
1011
`define OR1200_ITLB_INDX        `OR1200_ITLB_INDXH:`OR1200_ITLB_INDXL   // 18:13                19:13
1012
`define OR1200_ITLB_TAGW        32-`OR1200_ITLB_INDXW-`OR1200_IMMU_PS   // 13                   12
1013
`define OR1200_ITLB_TAGL        `OR1200_ITLB_INDXH+1                    // 19                   20
1014
`define OR1200_ITLB_TAG         31:`OR1200_ITLB_TAGL                    // 31:19                31:20
1015
`define OR1200_ITLBMRW          `OR1200_ITLB_TAGW+1                     // +1 because of V bit
1016
`define OR1200_ITLBTRW          32-`OR1200_IMMU_PS+3                    // +3 because of protection bits and CI
1017
 
1018
 
1019
/////////////////////////////////////////////////
1020
//
1021
// Insn cache (IC)
1022
//
1023
 
1024
// 3 for 8 bytes, 4 for 16 bytes etc
1025
`define OR1200_ICLS             4
1026
 
1027
//
1028
// IC configurations
1029
//
1030
`ifdef OR1200_IC_1W_4KB
1031
`define OR1200_ICSIZE                   12                      // 4096
1032
`define OR1200_ICINDX                   `OR1200_ICSIZE-2        // 10
1033
`define OR1200_ICINDXH                  `OR1200_ICSIZE-1        // 11
1034
`define OR1200_ICTAGL                   `OR1200_ICINDXH+1       // 12
1035
`define OR1200_ICTAG                    `OR1200_ICSIZE-`OR1200_ICLS     // 8
1036
`define OR1200_ICTAG_W                  21
1037
`endif
1038
`ifdef OR1200_IC_1W_8KB
1039
`define OR1200_ICSIZE                   13                      // 8192
1040
`define OR1200_ICINDX                   `OR1200_ICSIZE-2        // 11
1041
`define OR1200_ICINDXH                  `OR1200_ICSIZE-1        // 12
1042
`define OR1200_ICTAGL                   `OR1200_ICINDXH+1       // 13
1043
`define OR1200_ICTAG                    `OR1200_ICSIZE-`OR1200_ICLS     // 9
1044
`define OR1200_ICTAG_W                  20
1045
`endif
1046
 
1047
 
1048
/////////////////////////////////////////////////
1049
//
1050
// Data cache (DC)
1051
//
1052
 
1053
// 3 for 8 bytes, 4 for 16 bytes etc
1054
`define OR1200_DCLS             4
1055
 
1056
//
1057
// DC configurations
1058
//
1059
`ifdef OR1200_DC_1W_4KB
1060
`define OR1200_DCSIZE                   12                      // 4096
1061
`define OR1200_DCINDX                   `OR1200_DCSIZE-2        // 10
1062
`define OR1200_DCINDXH                  `OR1200_DCSIZE-1        // 11
1063
`define OR1200_DCTAGL                   `OR1200_DCINDXH+1       // 12
1064
`define OR1200_DCTAG                    `OR1200_DCSIZE-`OR1200_DCLS     // 8
1065
`define OR1200_DCTAG_W                  21
1066
`endif
1067
`ifdef OR1200_DC_1W_8KB
1068
`define OR1200_DCSIZE                   13                      // 8192
1069
`define OR1200_DCINDX                   `OR1200_DCSIZE-2        // 11
1070
`define OR1200_DCINDXH                  `OR1200_DCSIZE-1        // 12
1071
`define OR1200_DCTAGL                   `OR1200_DCINDXH+1       // 13
1072
`define OR1200_DCTAG                    `OR1200_DCSIZE-`OR1200_DCLS     // 9
1073
`define OR1200_DCTAG_W                  20
1074
`endif

powered by: WebSVN 2.1.0

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