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

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_47/] [or1ksim/] [cpu/] [or1k/] [sprs.h] - Blame information for rev 48

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

Line No. Rev Author Line
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 48 lampret
#define SPR_CCR         (SPRGROUP_SYS + 3)
48 30 lampret
#define SPR_EPCR_BASE   (SPRGROUP_SYS + 16)
49
#define SPR_EPCR_LAST   (SPRGROUP_SYS + 31)
50
#define SPR_CTR_BASE    (SPRGROUP_SYS + 32)
51
#define SPR_CTR_LAST    (SPRGROUP_SYS + 47)
52
#define SPR_EEAR_BASE   (SPRGROUP_SYS + 48)
53
#define SPR_EEAR_LAST   (SPRGROUP_SYS + 63)
54
 
55
/* Data MMU group */
56
#define SPR_DTLBMR_BASE (SPRGROUP_DMMU + 0)
57
#define SPR_DTLBMR_LAST (SPRGROUP_DMMU + 255)
58
#define SPR_DTLBTR_BASE (SPRGROUP_DMMU + 256)
59
#define SPR_DTLBTR_LAST (SPRGROUP_DMMU + 511)
60
#define SPR_DMMUCR      (SPRGROUP_DMMU + 512)
61
 
62
/* Instruction MMU group */
63
#define SPR_ITLBMR_BASE (SPRGROUP_IMMU + 0)
64
#define SPR_ITLBMR_LAST (SPRGROUP_IMMU + 255)
65
#define SPR_ITLBTR_BASE (SPRGROUP_IMMU + 256)
66
#define SPR_ITLBTR_LAST (SPRGROUP_IMMU + 511)
67
#define SPR_IMMUCR      (SPRGROUP_IMMU + 512)
68
 
69
/* Data cache group */
70
#define SPR_DCR_BASE    (SPRGROUP_DC + 0)
71
#define SPR_DCR_LAST    (SPRGROUP_DC + 511)
72
#define SPR_DCCR        (SPRGROUP_DC + 512)
73
 
74
/* Instruction cache group */
75
#define SPR_ICR_BASE    (SPRGROUP_IC + 0)
76
#define SPR_ICR_LAST    (SPRGROUP_IC + 511)
77
#define SPR_ICCR        (SPRGROUP_IC + 512)
78
 
79
/* MAC group */
80
#define SPR_MACLO (SPRGROUP_MAC + 1)
81
#define SPR_MACHI (SPRGROUP_MAC + 2)
82
 
83
/*
84
 * Bit definitions for the Version Register
85
 *
86
 */
87
#define SPR_VR_VER      0xffff0000  /* Processor version */
88
#define SPR_VR_PT       0x0000f000  /* Predefined template */
89
#define SPR_VR_REV      0x0000003f  /* Processor revision */
90
 
91
/*
92
 * Bit definitions for the Module Present Register
93
 *
94
 */
95
#define SPR_MPR_SYS     0x00000001  /* System control and status module */
96
#define SPR_MPR_DMMU    0x00000002  /* Data MMU module */
97
#define SPR_MPR_IMMU    0x00000004  /* Instruction MMU module */
98
#define SPR_MPR_DC      0x00000008  /* Data cache module */
99
#define SPR_MPR_IC      0x00000010  /* Instruction cache module */
100
#define SPR_MPR_MAC     0x00000020  /* MAC module */
101
#define SPR_MPR_RES     0xffffffc0  /* Custom and future modules */
102
 
103
/*
104
 * Bit definitions for the Supervision Register
105
 *
106
 */
107
#define SPR_SR_CID      0xf0000000  /* Context ID */
108
#define SPR_SR_LEE      0x00000080  /* Little Endian Enable */
109
#define SPR_SR_IME      0x00000040  /* Instruction MMU Enable */
110
#define SPR_SR_DME      0x00000020  /* Data MMU Enable */
111
#define SPR_SR_ICE      0x00000010  /* Instruction Cache Enable */
112
#define SPR_SR_DCE      0x00000008  /* Data Cache Enable */
113
#define SPR_SR_EIR      0x00000004  /* External Interrupt Recognition */
114
#define SPR_SR_EXR      0x00000002  /* Exception Recognition */
115
#define SPR_SR_SUPV     0x00000001  /* Supervisor mode */
116
 
117
/*
118 48 lampret
 * Bit definitions for the Condition Code Register
119
 *
120
 */
121
#define SPR_CCR_OVERFL  0x00000004  /* Overflow */
122
#define SPR_CCR_CARRY   0x00000002  /* Carry */
123
#define SPR_CCR_FLAG    0x00000001  /* Compare Flag */
124
 
125
/*
126 30 lampret
 * Bit definitions for the Data MMU Control Register
127
 *
128
 */
129
#define SPR_DMMUCR_P2S  0x0000003e  /* Level 2 Page Size */
130
#define SPR_DMMUCR_P1S  0x000007c0  /* Level 1 Page Size */
131
#define SPR_DMMUCR_VADDR_WIDTH  0x0000f800  /* Virtual ADDR Width */
132
#define SPR_DMMUCR_PADDR_WIDTH  0x000f0000  /* Physical ADDR Width */
133
 
134
/*
135
 * Bit definitions for the Instruction MMU Control Register
136
 *
137
 */
138
#define SPR_IMMUCR_P2S  0x0000003e  /* Level 2 Page Size */
139
#define SPR_IMMUCR_P1S  0x000007c0  /* Level 1 Page Size */
140
#define SPR_IMMUCR_VADDR_WIDTH  0x0000f800  /* Virtual ADDR Width */
141
#define SPR_IMMUCR_PADDR_WIDTH  0x000f0000  /* Physical ADDR Width */
142
 
143
/*
144
 * Bit definitions for the Data TLB Match Register
145
 *
146
 */
147
#define SPR_DTLBMR_PL1  0x00000001  /* Page Level 1 (if 0 then PL2)*/
148
#define SPR_DTLBMR_CID  0x0000001e  /* Context ID */
149
#define SPR_DTLBMR_VPN  0xfffffc00  /* Virtual Page Number */
150
 
151
/*
152
 * Bit definitions for the Data TLB Translate Register
153
 *
154
 */
155
#define SPR_DTLBTR_V    0x00000001  /* Valid */
156
#define SPR_DTLBTR_CC   0x00000002  /* Cache Coherency */
157
#define SPR_DTLBTR_CI   0x00000004  /* Cache Inhibit */
158
#define SPR_DTLBTR_WBC  0x00000008  /* Write-Back Cache*/
159
#define SPR_DTLBTR_WOM  0x00000010  /* Weakly-Ordered Memory */
160
#define SPR_DTLBTR_A    0x00000020  /* Accessed */
161
#define SPR_DTLBTR_D    0x00000040  /* Dirty */
162
#define SPR_DTLBTR_PPI  0x00000380  /* Page Protection Index */
163
#define SPR_DTLBTR_PPN  0xfffffc00  /* Physical Page Number */
164
 
165
/*
166
 * Bit definitions for the Instruction TLB Match Register
167
 *
168
 */
169
#define SPR_ITLBMR_PL1  0x00000001  /* Page Level 1 (if 0 then PL2)*/
170
#define SPR_ITLBMR_CID  0x0000001e  /* Context ID */
171
#define SPR_ITLBMR_VPN  0xfffffc00  /* Virtual Page Number */
172
 
173
/*
174
 * Bit definitions for the Instruction TLB Translate Register
175
 *
176
 */
177
#define SPR_ITLBTR_V    0x00000001  /* Valid */
178
#define SPR_ITLBTR_CC   0x00000002  /* Cache Coherency */
179
#define SPR_ITLBTR_CI   0x00000004  /* Cache Inhibit */
180
#define SPR_ITLBTR_WBC  0x00000008  /* Write-Back Cache*/
181
#define SPR_ITLBTR_WOM  0x00000010  /* Weakly-Ordered Memory */
182
#define SPR_ITLBTR_A    0x00000020  /* Accessed */
183
#define SPR_ITLBTR_D    0x00000040  /* Dirty */
184
#define SPR_ITLBTR_PPI  0x00000380  /* Page Protection Index */
185
#define SPR_ITLBTR_PPN  0xfffffc00  /* Physical Page Number */
186
 

powered by: WebSVN 2.1.0

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