1 |
23 |
lampret |
/* sprs.h -- OR1K architecture specific special-purpose registers
|
2 |
|
|
Copyright (C) 1999 Damjan Lampret, lampret@opencores.org
|
3 |
|
|
|
4 |
|
|
This file is part of OpenRISC 1000 Architectural Simulator.
|
5 |
|
|
|
6 |
|
|
This program is free software; you can redistribute it and/or modify
|
7 |
|
|
it under the terms of the GNU General Public License as published by
|
8 |
|
|
the Free Software Foundation; either version 2 of the License, or
|
9 |
|
|
(at your option) any later version.
|
10 |
|
|
|
11 |
|
|
This program is distributed in the hope that it will be useful,
|
12 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
|
|
GNU General Public License for more details.
|
15 |
|
|
|
16 |
|
|
You should have received a copy of the GNU General Public License
|
17 |
|
|
along with this program; if not, write to the Free Software
|
18 |
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
19 |
|
|
|
20 |
|
|
typedef unsigned long sprword;
|
21 |
|
|
|
22 |
30 |
lampret |
/* Prototypes */
|
23 |
|
|
void mtspr(int regno, sprword value);
|
24 |
|
|
sprword mfspr(int regno);
|
25 |
|
|
void setsprbit(int regno, int bitnum, unsigned long bitvalue);
|
26 |
|
|
int getsprbit(int regno, int bitnum);
|
27 |
|
|
void sprs_status();
|
28 |
23 |
lampret |
|
29 |
30 |
lampret |
/* Definition of special-purpose registers (SPRs) */
|
30 |
23 |
lampret |
|
31 |
30 |
lampret |
#define MAX_GRPS 32
|
32 |
|
|
#define MAX_SPRS_PER_GRP 0x1000
|
33 |
|
|
#define MAX_SPRS (MAX_GRPS * 0x1000000 / MAX_SPRS_PER_GRP)
|
34 |
|
|
|
35 |
|
|
/* Base addresses for the groups */
|
36 |
|
|
#define SPRGROUP_SYS 0x00000000
|
37 |
|
|
#define SPRGROUP_DMMU 0x01000000
|
38 |
|
|
#define SPRGROUP_IMMU 0x02000000
|
39 |
|
|
#define SPRGROUP_DC 0x03000000
|
40 |
|
|
#define SPRGROUP_IC 0x04000000
|
41 |
|
|
#define SPRGROUP_MAC 0x05000000
|
42 |
|
|
|
43 |
|
|
/* System control and status group */
|
44 |
|
|
#define SPR_VR (SPRGROUP_SYS + 0)
|
45 |
|
|
#define SPR_MPR (SPRGROUP_SYS + 1)
|
46 |
|
|
#define SPR_SR (SPRGROUP_SYS + 2)
|
47 |
|
|
#define SPR_EPCR_BASE (SPRGROUP_SYS + 16)
|
48 |
|
|
#define SPR_EPCR_LAST (SPRGROUP_SYS + 31)
|
49 |
|
|
#define SPR_CTR_BASE (SPRGROUP_SYS + 32)
|
50 |
|
|
#define SPR_CTR_LAST (SPRGROUP_SYS + 47)
|
51 |
|
|
#define SPR_EEAR_BASE (SPRGROUP_SYS + 48)
|
52 |
|
|
#define SPR_EEAR_LAST (SPRGROUP_SYS + 63)
|
53 |
|
|
|
54 |
|
|
/* Data MMU group */
|
55 |
|
|
#define SPR_DTLBMR_BASE (SPRGROUP_DMMU + 0)
|
56 |
|
|
#define SPR_DTLBMR_LAST (SPRGROUP_DMMU + 255)
|
57 |
|
|
#define SPR_DTLBTR_BASE (SPRGROUP_DMMU + 256)
|
58 |
|
|
#define SPR_DTLBTR_LAST (SPRGROUP_DMMU + 511)
|
59 |
|
|
#define SPR_DMMUCR (SPRGROUP_DMMU + 512)
|
60 |
|
|
|
61 |
|
|
/* Instruction MMU group */
|
62 |
|
|
#define SPR_ITLBMR_BASE (SPRGROUP_IMMU + 0)
|
63 |
|
|
#define SPR_ITLBMR_LAST (SPRGROUP_IMMU + 255)
|
64 |
|
|
#define SPR_ITLBTR_BASE (SPRGROUP_IMMU + 256)
|
65 |
|
|
#define SPR_ITLBTR_LAST (SPRGROUP_IMMU + 511)
|
66 |
|
|
#define SPR_IMMUCR (SPRGROUP_IMMU + 512)
|
67 |
|
|
|
68 |
|
|
/* Data cache group */
|
69 |
|
|
#define SPR_DCR_BASE (SPRGROUP_DC + 0)
|
70 |
|
|
#define SPR_DCR_LAST (SPRGROUP_DC + 511)
|
71 |
|
|
#define SPR_DCCR (SPRGROUP_DC + 512)
|
72 |
|
|
|
73 |
|
|
/* Instruction cache group */
|
74 |
|
|
#define SPR_ICR_BASE (SPRGROUP_IC + 0)
|
75 |
|
|
#define SPR_ICR_LAST (SPRGROUP_IC + 511)
|
76 |
|
|
#define SPR_ICCR (SPRGROUP_IC + 512)
|
77 |
|
|
|
78 |
|
|
/* MAC group */
|
79 |
|
|
#define SPR_MACLO (SPRGROUP_MAC + 1)
|
80 |
|
|
#define SPR_MACHI (SPRGROUP_MAC + 2)
|
81 |
|
|
|
82 |
|
|
/*
|
83 |
|
|
* Bit definitions for the Version Register
|
84 |
|
|
*
|
85 |
|
|
*/
|
86 |
|
|
#define SPR_VR_VER 0xffff0000 /* Processor version */
|
87 |
|
|
#define SPR_VR_PT 0x0000f000 /* Predefined template */
|
88 |
|
|
#define SPR_VR_REV 0x0000003f /* Processor revision */
|
89 |
|
|
|
90 |
|
|
/*
|
91 |
|
|
* Bit definitions for the Module Present Register
|
92 |
|
|
*
|
93 |
|
|
*/
|
94 |
|
|
#define SPR_MPR_SYS 0x00000001 /* System control and status module */
|
95 |
|
|
#define SPR_MPR_DMMU 0x00000002 /* Data MMU module */
|
96 |
|
|
#define SPR_MPR_IMMU 0x00000004 /* Instruction MMU module */
|
97 |
|
|
#define SPR_MPR_DC 0x00000008 /* Data cache module */
|
98 |
|
|
#define SPR_MPR_IC 0x00000010 /* Instruction cache module */
|
99 |
|
|
#define SPR_MPR_MAC 0x00000020 /* MAC module */
|
100 |
|
|
#define SPR_MPR_RES 0xffffffc0 /* Custom and future modules */
|
101 |
|
|
|
102 |
|
|
/*
|
103 |
|
|
* Bit definitions for the Supervision Register
|
104 |
|
|
*
|
105 |
|
|
*/
|
106 |
|
|
#define SPR_SR_CID 0xf0000000 /* Context ID */
|
107 |
|
|
#define SPR_SR_LEE 0x00000080 /* Little Endian Enable */
|
108 |
|
|
#define SPR_SR_IME 0x00000040 /* Instruction MMU Enable */
|
109 |
|
|
#define SPR_SR_DME 0x00000020 /* Data MMU Enable */
|
110 |
|
|
#define SPR_SR_ICE 0x00000010 /* Instruction Cache Enable */
|
111 |
|
|
#define SPR_SR_DCE 0x00000008 /* Data Cache Enable */
|
112 |
|
|
#define SPR_SR_EIR 0x00000004 /* External Interrupt Recognition */
|
113 |
|
|
#define SPR_SR_EXR 0x00000002 /* Exception Recognition */
|
114 |
|
|
#define SPR_SR_SUPV 0x00000001 /* Supervisor mode */
|
115 |
|
|
|
116 |
|
|
/*
|
117 |
|
|
* Bit definitions for the Data MMU Control Register
|
118 |
|
|
*
|
119 |
|
|
*/
|
120 |
|
|
#define SPR_DMMUCR_P2S 0x0000003e /* Level 2 Page Size */
|
121 |
|
|
#define SPR_DMMUCR_P1S 0x000007c0 /* Level 1 Page Size */
|
122 |
|
|
#define SPR_DMMUCR_VADDR_WIDTH 0x0000f800 /* Virtual ADDR Width */
|
123 |
|
|
#define SPR_DMMUCR_PADDR_WIDTH 0x000f0000 /* Physical ADDR Width */
|
124 |
|
|
|
125 |
|
|
/*
|
126 |
|
|
* Bit definitions for the Instruction MMU Control Register
|
127 |
|
|
*
|
128 |
|
|
*/
|
129 |
|
|
#define SPR_IMMUCR_P2S 0x0000003e /* Level 2 Page Size */
|
130 |
|
|
#define SPR_IMMUCR_P1S 0x000007c0 /* Level 1 Page Size */
|
131 |
|
|
#define SPR_IMMUCR_VADDR_WIDTH 0x0000f800 /* Virtual ADDR Width */
|
132 |
|
|
#define SPR_IMMUCR_PADDR_WIDTH 0x000f0000 /* Physical ADDR Width */
|
133 |
|
|
|
134 |
|
|
/*
|
135 |
|
|
* Bit definitions for the Data TLB Match Register
|
136 |
|
|
*
|
137 |
|
|
*/
|
138 |
|
|
#define SPR_DTLBMR_PL1 0x00000001 /* Page Level 1 (if 0 then PL2)*/
|
139 |
|
|
#define SPR_DTLBMR_CID 0x0000001e /* Context ID */
|
140 |
|
|
#define SPR_DTLBMR_VPN 0xfffffc00 /* Virtual Page Number */
|
141 |
|
|
|
142 |
|
|
/*
|
143 |
|
|
* Bit definitions for the Data TLB Translate Register
|
144 |
|
|
*
|
145 |
|
|
*/
|
146 |
|
|
#define SPR_DTLBTR_V 0x00000001 /* Valid */
|
147 |
|
|
#define SPR_DTLBTR_CC 0x00000002 /* Cache Coherency */
|
148 |
|
|
#define SPR_DTLBTR_CI 0x00000004 /* Cache Inhibit */
|
149 |
|
|
#define SPR_DTLBTR_WBC 0x00000008 /* Write-Back Cache*/
|
150 |
|
|
#define SPR_DTLBTR_WOM 0x00000010 /* Weakly-Ordered Memory */
|
151 |
|
|
#define SPR_DTLBTR_A 0x00000020 /* Accessed */
|
152 |
|
|
#define SPR_DTLBTR_D 0x00000040 /* Dirty */
|
153 |
|
|
#define SPR_DTLBTR_PPI 0x00000380 /* Page Protection Index */
|
154 |
|
|
#define SPR_DTLBTR_PPN 0xfffffc00 /* Physical Page Number */
|
155 |
|
|
|
156 |
|
|
/*
|
157 |
|
|
* Bit definitions for the Instruction TLB Match Register
|
158 |
|
|
*
|
159 |
|
|
*/
|
160 |
|
|
#define SPR_ITLBMR_PL1 0x00000001 /* Page Level 1 (if 0 then PL2)*/
|
161 |
|
|
#define SPR_ITLBMR_CID 0x0000001e /* Context ID */
|
162 |
|
|
#define SPR_ITLBMR_VPN 0xfffffc00 /* Virtual Page Number */
|
163 |
|
|
|
164 |
|
|
/*
|
165 |
|
|
* Bit definitions for the Instruction TLB Translate Register
|
166 |
|
|
*
|
167 |
|
|
*/
|
168 |
|
|
#define SPR_ITLBTR_V 0x00000001 /* Valid */
|
169 |
|
|
#define SPR_ITLBTR_CC 0x00000002 /* Cache Coherency */
|
170 |
|
|
#define SPR_ITLBTR_CI 0x00000004 /* Cache Inhibit */
|
171 |
|
|
#define SPR_ITLBTR_WBC 0x00000008 /* Write-Back Cache*/
|
172 |
|
|
#define SPR_ITLBTR_WOM 0x00000010 /* Weakly-Ordered Memory */
|
173 |
|
|
#define SPR_ITLBTR_A 0x00000020 /* Accessed */
|
174 |
|
|
#define SPR_ITLBTR_D 0x00000040 /* Dirty */
|
175 |
|
|
#define SPR_ITLBTR_PPI 0x00000380 /* Page Protection Index */
|
176 |
|
|
#define SPR_ITLBTR_PPN 0xfffffc00 /* Physical Page Number */
|
177 |
|
|
|