Skip to content

Commit bdb7df4

Browse files
authored
Merge pull request #2 from bluwireless/feature/privileged
Improving privileged instruction support
2 parents 3d49550 + f7c05c6 commit bdb7df4

File tree

8 files changed

+605
-10
lines changed

8 files changed

+605
-10
lines changed

riscvmodel/csrnames.py

Lines changed: 250 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,250 @@
1+
# Ported from https://github.com/riscv/riscv-binutils-gdb
2+
3+
# Privileged CSR addresses (v1.11).
4+
ustatus = 0x0
5+
uie = 0x4
6+
utvec = 0x5
7+
uscratch = 0x40
8+
uepc = 0x41
9+
ucause = 0x42
10+
utval = 0x43
11+
uip = 0x44
12+
cycle = 0xc00
13+
time = 0xc01
14+
instret = 0xc02
15+
hpmcounter3 = 0xc03
16+
hpmcounter4 = 0xc04
17+
hpmcounter5 = 0xc05
18+
hpmcounter6 = 0xc06
19+
hpmcounter7 = 0xc07
20+
hpmcounter8 = 0xc08
21+
hpmcounter9 = 0xc09
22+
hpmcounter10 = 0xc0a
23+
hpmcounter11 = 0xc0b
24+
hpmcounter12 = 0xc0c
25+
hpmcounter13 = 0xc0d
26+
hpmcounter14 = 0xc0e
27+
hpmcounter15 = 0xc0f
28+
hpmcounter16 = 0xc10
29+
hpmcounter17 = 0xc11
30+
hpmcounter18 = 0xc12
31+
hpmcounter19 = 0xc13
32+
hpmcounter20 = 0xc14
33+
hpmcounter21 = 0xc15
34+
hpmcounter22 = 0xc16
35+
hpmcounter23 = 0xc17
36+
hpmcounter24 = 0xc18
37+
hpmcounter25 = 0xc19
38+
hpmcounter26 = 0xc1a
39+
hpmcounter27 = 0xc1b
40+
hpmcounter28 = 0xc1c
41+
hpmcounter29 = 0xc1d
42+
hpmcounter30 = 0xc1e
43+
hpmcounter31 = 0xc1f
44+
cycleh = 0xc80
45+
timeh = 0xc81
46+
instreth = 0xc82
47+
hpmcounter3h = 0xc83
48+
hpmcounter4h = 0xc84
49+
hpmcounter5h = 0xc85
50+
hpmcounter6h = 0xc86
51+
hpmcounter7h = 0xc87
52+
hpmcounter8h = 0xc88
53+
hpmcounter9h = 0xc89
54+
hpmcounter10h = 0xc8a
55+
hpmcounter11h = 0xc8b
56+
hpmcounter12h = 0xc8c
57+
hpmcounter13h = 0xc8d
58+
hpmcounter14h = 0xc8e
59+
hpmcounter15h = 0xc8f
60+
hpmcounter16h = 0xc90
61+
hpmcounter17h = 0xc91
62+
hpmcounter18h = 0xc92
63+
hpmcounter19h = 0xc93
64+
hpmcounter20h = 0xc94
65+
hpmcounter21h = 0xc95
66+
hpmcounter22h = 0xc96
67+
hpmcounter23h = 0xc97
68+
hpmcounter24h = 0xc98
69+
hpmcounter25h = 0xc99
70+
hpmcounter26h = 0xc9a
71+
hpmcounter27h = 0xc9b
72+
hpmcounter28h = 0xc9c
73+
hpmcounter29h = 0xc9d
74+
hpmcounter30h = 0xc9e
75+
hpmcounter31h = 0xc9f
76+
sstatus = 0x100
77+
sedeleg = 0x102
78+
sideleg = 0x103
79+
sie = 0x104
80+
stvec = 0x105
81+
scounteren = 0x106
82+
sscratch = 0x140
83+
sepc = 0x141
84+
scause = 0x142
85+
stval = 0x143
86+
sip = 0x144
87+
satp = 0x180
88+
mvendorid = 0xf11
89+
marchid = 0xf12
90+
mimpid = 0xf13
91+
mhartid = 0xf14
92+
mstatus = 0x300
93+
misa = 0x301
94+
medeleg = 0x302
95+
mideleg = 0x303
96+
mie = 0x304
97+
mtvec = 0x305
98+
mcounteren = 0x306
99+
mscratch = 0x340
100+
mepc = 0x341
101+
mcause = 0x342
102+
mtval = 0x343
103+
mip = 0x344
104+
pmpcfg0 = 0x3a0
105+
pmpcfg1 = 0x3a1
106+
pmpcfg2 = 0x3a2
107+
pmpcfg3 = 0x3a3
108+
pmpaddr0 = 0x3b0
109+
pmpaddr1 = 0x3b1
110+
pmpaddr2 = 0x3b2
111+
pmpaddr3 = 0x3b3
112+
pmpaddr4 = 0x3b4
113+
pmpaddr5 = 0x3b5
114+
pmpaddr6 = 0x3b6
115+
pmpaddr7 = 0x3b7
116+
pmpaddr8 = 0x3b8
117+
pmpaddr9 = 0x3b9
118+
pmpaddr10 = 0x3ba
119+
pmpaddr11 = 0x3bb
120+
pmpaddr12 = 0x3bc
121+
pmpaddr13 = 0x3bd
122+
pmpaddr14 = 0x3be
123+
pmpaddr15 = 0x3bf
124+
mcycle = 0xb00
125+
minstret = 0xb02
126+
mhpmcounter3 = 0xb03
127+
mhpmcounter4 = 0xb04
128+
mhpmcounter5 = 0xb05
129+
mhpmcounter6 = 0xb06
130+
mhpmcounter7 = 0xb07
131+
mhpmcounter8 = 0xb08
132+
mhpmcounter9 = 0xb09
133+
mhpmcounter10 = 0xb0a
134+
mhpmcounter11 = 0xb0b
135+
mhpmcounter12 = 0xb0c
136+
mhpmcounter13 = 0xb0d
137+
mhpmcounter14 = 0xb0e
138+
mhpmcounter15 = 0xb0f
139+
mhpmcounter16 = 0xb10
140+
mhpmcounter17 = 0xb11
141+
mhpmcounter18 = 0xb12
142+
mhpmcounter19 = 0xb13
143+
mhpmcounter20 = 0xb14
144+
mhpmcounter21 = 0xb15
145+
mhpmcounter22 = 0xb16
146+
mhpmcounter23 = 0xb17
147+
mhpmcounter24 = 0xb18
148+
mhpmcounter25 = 0xb19
149+
mhpmcounter26 = 0xb1a
150+
mhpmcounter27 = 0xb1b
151+
mhpmcounter28 = 0xb1c
152+
mhpmcounter29 = 0xb1d
153+
mhpmcounter30 = 0xb1e
154+
mhpmcounter31 = 0xb1f
155+
mcycleh = 0xb80
156+
minstreth = 0xb82
157+
mhpmcounter3h = 0xb83
158+
mhpmcounter4h = 0xb84
159+
mhpmcounter5h = 0xb85
160+
mhpmcounter6h = 0xb86
161+
mhpmcounter7h = 0xb87
162+
mhpmcounter8h = 0xb88
163+
mhpmcounter9h = 0xb89
164+
mhpmcounter10h = 0xb8a
165+
mhpmcounter11h = 0xb8b
166+
mhpmcounter12h = 0xb8c
167+
mhpmcounter13h = 0xb8d
168+
mhpmcounter14h = 0xb8e
169+
mhpmcounter15h = 0xb8f
170+
mhpmcounter16h = 0xb90
171+
mhpmcounter17h = 0xb91
172+
mhpmcounter18h = 0xb92
173+
mhpmcounter19h = 0xb93
174+
mhpmcounter20h = 0xb94
175+
mhpmcounter21h = 0xb95
176+
mhpmcounter22h = 0xb96
177+
mhpmcounter23h = 0xb97
178+
mhpmcounter24h = 0xb98
179+
mhpmcounter25h = 0xb99
180+
mhpmcounter26h = 0xb9a
181+
mhpmcounter27h = 0xb9b
182+
mhpmcounter28h = 0xb9c
183+
mhpmcounter29h = 0xb9d
184+
mhpmcounter30h = 0xb9e
185+
mhpmcounter31h = 0xb9f
186+
mcountinhibit = 0x320
187+
mhpmevent3 = 0x323
188+
mhpmevent4 = 0x324
189+
mhpmevent5 = 0x325
190+
mhpmevent6 = 0x326
191+
mhpmevent7 = 0x327
192+
mhpmevent8 = 0x328
193+
mhpmevent9 = 0x329
194+
mhpmevent10 = 0x32a
195+
mhpmevent11 = 0x32b
196+
mhpmevent12 = 0x32c
197+
mhpmevent13 = 0x32d
198+
mhpmevent14 = 0x32e
199+
mhpmevent15 = 0x32f
200+
mhpmevent16 = 0x330
201+
mhpmevent17 = 0x331
202+
mhpmevent18 = 0x332
203+
mhpmevent19 = 0x333
204+
mhpmevent20 = 0x334
205+
mhpmevent21 = 0x335
206+
mhpmevent22 = 0x336
207+
mhpmevent23 = 0x337
208+
mhpmevent24 = 0x338
209+
mhpmevent25 = 0x339
210+
mhpmevent26 = 0x33a
211+
mhpmevent27 = 0x33b
212+
mhpmevent28 = 0x33c
213+
mhpmevent29 = 0x33d
214+
mhpmevent30 = 0x33e
215+
mhpmevent31 = 0x33f
216+
hstatus = 0x200
217+
hedeleg = 0x202
218+
hideleg = 0x203
219+
hie = 0x204
220+
htvec = 0x205
221+
hscratch = 0x240
222+
hepc = 0x241
223+
hcause = 0x242
224+
hbadaddr = 0x243
225+
hip = 0x244
226+
mbase = 0x380
227+
mbound = 0x381
228+
mibase = 0x382
229+
mibound = 0x383
230+
mdbase = 0x384
231+
mdbound = 0x385
232+
mscounteren = 0x321
233+
mhcounteren = 0x322
234+
235+
# Unprivileged CSR addresses
236+
fflags = 0x1
237+
frm = 0x2
238+
fcsr = 0x3
239+
dcsr = 0x7b0
240+
dpc = 0x7b1
241+
dscratch0 = 0x7b2
242+
dscratch1 = 0x7b3
243+
tselect = 0x7a0
244+
tdata1 = 0x7a1
245+
tdata2 = 0x7a2
246+
tdata3 = 0x7a3
247+
tinfo = 0x7a4
248+
tcontrol = 0x7a5
249+
mcontext = 0x7a8
250+
scontext = 0x7aa

0 commit comments

Comments
 (0)