-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathcsr-v1.10.mu4
254 lines (237 loc) · 16.3 KB
/
csr-v1.10.mu4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
| This file is part of muforth: https://muforth.dev/
|
| Copyright 2002-2025 David Frech. (Read the LICENSE for details.)
| This file contains the definitions of RISC-V CSRs. It is auto-generated
| from target/RISC-V/csr.lua. Do NOT edit this file. Re-run that file
| instead!
|
| These definitions reflect version v1.10 of the RISC-V Privileged
| Architecture Specification (riscv-privileged-v1.10.pdf)
| Let's define names for the well-known CSRs. This will help both with
| writing code - as these are available to the assembler and compiler - and
| also with disassembling code - as instructions that modify CSRs will be
| able to look up the name by searching the .csr. dictionary chain.
hex
( User-level CSRs)
( User Trap Setup)
0000 ( URW) csr ustatus | User status register.
0004 ( URW) csr uie | User interrupt-enable register.
0005 ( URW) csr utvec | User trap handler base address.
( User Trap Handling)
0040 ( URW) csr uscratch | Scratch register for user trap handlers.
0041 ( URW) csr uepc | User exception program counter.
0042 ( URW) csr ucause | User trap cause.
0043 ( URW) csr utval | User bad address or instruction.
0044 ( URW) csr uip | User interrupt pending.
( User Floating-Point CSRs)
0001 ( URW) csr fflags | Floating-Point Accrued Exceptions.
0002 ( URW) csr frm | Floating-Point Dynamic Rounding Mode.
0003 ( URW) csr fcsr | Floating-Point Control and Status Register [frm + fflags].
( User Counter/Timers)
0c00 ( URO) csr cycle | Cycle counter for RDCYCLE instruction.
0c01 ( URO) csr time | Timer for RDTIME instruction.
0c02 ( URO) csr instret | Instructions-retired counter for RDINSTRET instruction.
0c03 ( URO) csr hpmcounter3 | Performance-monitoring counter.
0c04 ( URO) csr hpmcounter4 | Performance-monitoring counter.
0c05 ( URO) csr hpmcounter5 | Performance-monitoring counter.
0c06 ( URO) csr hpmcounter6 | Performance-monitoring counter.
0c07 ( URO) csr hpmcounter7 | Performance-monitoring counter.
0c08 ( URO) csr hpmcounter8 | Performance-monitoring counter.
0c09 ( URO) csr hpmcounter9 | Performance-monitoring counter.
0c0a ( URO) csr hpmcounter10 | Performance-monitoring counter.
0c0b ( URO) csr hpmcounter11 | Performance-monitoring counter.
0c0c ( URO) csr hpmcounter12 | Performance-monitoring counter.
0c0d ( URO) csr hpmcounter13 | Performance-monitoring counter.
0c0e ( URO) csr hpmcounter14 | Performance-monitoring counter.
0c0f ( URO) csr hpmcounter15 | Performance-monitoring counter.
0c10 ( URO) csr hpmcounter16 | Performance-monitoring counter.
0c11 ( URO) csr hpmcounter17 | Performance-monitoring counter.
0c12 ( URO) csr hpmcounter18 | Performance-monitoring counter.
0c13 ( URO) csr hpmcounter19 | Performance-monitoring counter.
0c14 ( URO) csr hpmcounter20 | Performance-monitoring counter.
0c15 ( URO) csr hpmcounter21 | Performance-monitoring counter.
0c16 ( URO) csr hpmcounter22 | Performance-monitoring counter.
0c17 ( URO) csr hpmcounter23 | Performance-monitoring counter.
0c18 ( URO) csr hpmcounter24 | Performance-monitoring counter.
0c19 ( URO) csr hpmcounter25 | Performance-monitoring counter.
0c1a ( URO) csr hpmcounter26 | Performance-monitoring counter.
0c1b ( URO) csr hpmcounter27 | Performance-monitoring counter.
0c1c ( URO) csr hpmcounter28 | Performance-monitoring counter.
0c1d ( URO) csr hpmcounter29 | Performance-monitoring counter.
0c1e ( URO) csr hpmcounter30 | Performance-monitoring counter.
0c1f ( URO) csr hpmcounter31 | Performance-monitoring counter.
0c80 ( URO) csr cycleh | Upper 32 bits of cycle, RV32I only.
0c81 ( URO) csr timeh | Upper 32 bits of time, RV32I only.
0c82 ( URO) csr instreth | Upper 32 bits of instret, RV32I only.
0c83 ( URO) csr hpmcounter3h | Upper 32 bits of hpmcounter3, RV32I only.
0c84 ( URO) csr hpmcounter4h | Upper 32 bits of hpmcounter4, RV32I only.
0c85 ( URO) csr hpmcounter5h | Upper 32 bits of hpmcounter5, RV32I only.
0c86 ( URO) csr hpmcounter6h | Upper 32 bits of hpmcounter6, RV32I only.
0c87 ( URO) csr hpmcounter7h | Upper 32 bits of hpmcounter7, RV32I only.
0c88 ( URO) csr hpmcounter8h | Upper 32 bits of hpmcounter8, RV32I only.
0c89 ( URO) csr hpmcounter9h | Upper 32 bits of hpmcounter9, RV32I only.
0c8a ( URO) csr hpmcounter10h | Upper 32 bits of hpmcounter10, RV32I only.
0c8b ( URO) csr hpmcounter11h | Upper 32 bits of hpmcounter11, RV32I only.
0c8c ( URO) csr hpmcounter12h | Upper 32 bits of hpmcounter12, RV32I only.
0c8d ( URO) csr hpmcounter13h | Upper 32 bits of hpmcounter13, RV32I only.
0c8e ( URO) csr hpmcounter14h | Upper 32 bits of hpmcounter14, RV32I only.
0c8f ( URO) csr hpmcounter15h | Upper 32 bits of hpmcounter15, RV32I only.
0c90 ( URO) csr hpmcounter16h | Upper 32 bits of hpmcounter16, RV32I only.
0c91 ( URO) csr hpmcounter17h | Upper 32 bits of hpmcounter17, RV32I only.
0c92 ( URO) csr hpmcounter18h | Upper 32 bits of hpmcounter18, RV32I only.
0c93 ( URO) csr hpmcounter19h | Upper 32 bits of hpmcounter19, RV32I only.
0c94 ( URO) csr hpmcounter20h | Upper 32 bits of hpmcounter20, RV32I only.
0c95 ( URO) csr hpmcounter21h | Upper 32 bits of hpmcounter21, RV32I only.
0c96 ( URO) csr hpmcounter22h | Upper 32 bits of hpmcounter22, RV32I only.
0c97 ( URO) csr hpmcounter23h | Upper 32 bits of hpmcounter23, RV32I only.
0c98 ( URO) csr hpmcounter24h | Upper 32 bits of hpmcounter24, RV32I only.
0c99 ( URO) csr hpmcounter25h | Upper 32 bits of hpmcounter25, RV32I only.
0c9a ( URO) csr hpmcounter26h | Upper 32 bits of hpmcounter26, RV32I only.
0c9b ( URO) csr hpmcounter27h | Upper 32 bits of hpmcounter27, RV32I only.
0c9c ( URO) csr hpmcounter28h | Upper 32 bits of hpmcounter28, RV32I only.
0c9d ( URO) csr hpmcounter29h | Upper 32 bits of hpmcounter29, RV32I only.
0c9e ( URO) csr hpmcounter30h | Upper 32 bits of hpmcounter30, RV32I only.
0c9f ( URO) csr hpmcounter31h | Upper 32 bits of hpmcounter31, RV32I only.
( Machine-level CSRs)
( Machine Information Registers)
0f11 ( MRO) csr mvendorid | Vendor ID.
0f12 ( MRO) csr marchid | Architecture ID.
0f13 ( MRO) csr mimpid | Implementation ID.
0f14 ( MRO) csr mhartid | Hardware thread ID.
( Machine Trap Setup)
0300 ( MRW) csr mstatus | Machine status register.
0301 ( MRW) csr misa | ISA and extensions
0302 ( MRW) csr medeleg | Machine exception delegation register.
0303 ( MRW) csr mideleg | Machine interrupt delegation register.
0304 ( MRW) csr mie | Machine interrupt-enable register.
0305 ( MRW) csr mtvec | Machine trap-handler base address.
0306 ( MRW) csr mcounteren | Machine counter enable.
( Machine Trap Handling)
0340 ( MRW) csr mscratch | Scratch register for machine trap handlers.
0341 ( MRW) csr mepc | Machine exception program counter.
0342 ( MRW) csr mcause | Machine trap cause.
0343 ( MRW) csr mtval | Machine bad address or instruction.
0344 ( MRW) csr mip | Machine interrupt pending.
( Machine Protection and Translation)
03a0 ( MRW) csr pmpcfg0 | Physical memory protection configuration.
03a1 ( MRW) csr pmpcfg1 | Physical memory protection configuration, RV32 only.
03a2 ( MRW) csr pmpcfg2 | Physical memory protection configuration.
03a3 ( MRW) csr pmpcfg3 | Physical memory protection configuration, RV32 only.
03b0 ( MRW) csr pmpaddr0 | Physical memory protection address register.
03b1 ( MRW) csr pmpaddr1 | Physical memory protection address register.
03b2 ( MRW) csr pmpaddr2 | Physical memory protection address register.
03b3 ( MRW) csr pmpaddr3 | Physical memory protection address register.
03b4 ( MRW) csr pmpaddr4 | Physical memory protection address register.
03b5 ( MRW) csr pmpaddr5 | Physical memory protection address register.
03b6 ( MRW) csr pmpaddr6 | Physical memory protection address register.
03b7 ( MRW) csr pmpaddr7 | Physical memory protection address register.
03b8 ( MRW) csr pmpaddr8 | Physical memory protection address register.
03b9 ( MRW) csr pmpaddr9 | Physical memory protection address register.
03ba ( MRW) csr pmpaddr10 | Physical memory protection address register.
03bb ( MRW) csr pmpaddr11 | Physical memory protection address register.
03bc ( MRW) csr pmpaddr12 | Physical memory protection address register.
03bd ( MRW) csr pmpaddr13 | Physical memory protection address register.
03be ( MRW) csr pmpaddr14 | Physical memory protection address register.
03bf ( MRW) csr pmpaddr15 | Physical memory protection address register.
( Machine Counter/Timers)
0b00 ( MRW) csr mcycle | Machine cycle counter.
0b02 ( MRW) csr minstret | Machine instructions-retired counter.
0b03 ( MRW) csr mhpmcounter3 | Machine performance-monitoring counter.
0b04 ( MRW) csr mhpmcounter4 | Machine performance-monitoring counter.
0b05 ( MRW) csr mhpmcounter5 | Machine performance-monitoring counter.
0b06 ( MRW) csr mhpmcounter6 | Machine performance-monitoring counter.
0b07 ( MRW) csr mhpmcounter7 | Machine performance-monitoring counter.
0b08 ( MRW) csr mhpmcounter8 | Machine performance-monitoring counter.
0b09 ( MRW) csr mhpmcounter9 | Machine performance-monitoring counter.
0b0a ( MRW) csr mhpmcounter10 | Machine performance-monitoring counter.
0b0b ( MRW) csr mhpmcounter11 | Machine performance-monitoring counter.
0b0c ( MRW) csr mhpmcounter12 | Machine performance-monitoring counter.
0b0d ( MRW) csr mhpmcounter13 | Machine performance-monitoring counter.
0b0e ( MRW) csr mhpmcounter14 | Machine performance-monitoring counter.
0b0f ( MRW) csr mhpmcounter15 | Machine performance-monitoring counter.
0b10 ( MRW) csr mhpmcounter16 | Machine performance-monitoring counter.
0b11 ( MRW) csr mhpmcounter17 | Machine performance-monitoring counter.
0b12 ( MRW) csr mhpmcounter18 | Machine performance-monitoring counter.
0b13 ( MRW) csr mhpmcounter19 | Machine performance-monitoring counter.
0b14 ( MRW) csr mhpmcounter20 | Machine performance-monitoring counter.
0b15 ( MRW) csr mhpmcounter21 | Machine performance-monitoring counter.
0b16 ( MRW) csr mhpmcounter22 | Machine performance-monitoring counter.
0b17 ( MRW) csr mhpmcounter23 | Machine performance-monitoring counter.
0b18 ( MRW) csr mhpmcounter24 | Machine performance-monitoring counter.
0b19 ( MRW) csr mhpmcounter25 | Machine performance-monitoring counter.
0b1a ( MRW) csr mhpmcounter26 | Machine performance-monitoring counter.
0b1b ( MRW) csr mhpmcounter27 | Machine performance-monitoring counter.
0b1c ( MRW) csr mhpmcounter28 | Machine performance-monitoring counter.
0b1d ( MRW) csr mhpmcounter29 | Machine performance-monitoring counter.
0b1e ( MRW) csr mhpmcounter30 | Machine performance-monitoring counter.
0b1f ( MRW) csr mhpmcounter31 | Machine performance-monitoring counter.
0b80 ( MRW) csr mcycleh | Upper 32 bits of mcycle, RV32I only.
0b82 ( MRW) csr minstreth | Upper 32 bits of minstret, RV32I only.
0b83 ( MRW) csr mhpmcounter3h | Upper 32 bits of mhpmcounter3, RV32I only.
0b84 ( MRW) csr mhpmcounter4h | Upper 32 bits of mhpmcounter4, RV32I only.
0b85 ( MRW) csr mhpmcounter5h | Upper 32 bits of mhpmcounter5, RV32I only.
0b86 ( MRW) csr mhpmcounter6h | Upper 32 bits of mhpmcounter6, RV32I only.
0b87 ( MRW) csr mhpmcounter7h | Upper 32 bits of mhpmcounter7, RV32I only.
0b88 ( MRW) csr mhpmcounter8h | Upper 32 bits of mhpmcounter8, RV32I only.
0b89 ( MRW) csr mhpmcounter9h | Upper 32 bits of mhpmcounter9, RV32I only.
0b8a ( MRW) csr mhpmcounter10h | Upper 32 bits of mhpmcounter10, RV32I only.
0b8b ( MRW) csr mhpmcounter11h | Upper 32 bits of mhpmcounter11, RV32I only.
0b8c ( MRW) csr mhpmcounter12h | Upper 32 bits of mhpmcounter12, RV32I only.
0b8d ( MRW) csr mhpmcounter13h | Upper 32 bits of mhpmcounter13, RV32I only.
0b8e ( MRW) csr mhpmcounter14h | Upper 32 bits of mhpmcounter14, RV32I only.
0b8f ( MRW) csr mhpmcounter15h | Upper 32 bits of mhpmcounter15, RV32I only.
0b90 ( MRW) csr mhpmcounter16h | Upper 32 bits of mhpmcounter16, RV32I only.
0b91 ( MRW) csr mhpmcounter17h | Upper 32 bits of mhpmcounter17, RV32I only.
0b92 ( MRW) csr mhpmcounter18h | Upper 32 bits of mhpmcounter18, RV32I only.
0b93 ( MRW) csr mhpmcounter19h | Upper 32 bits of mhpmcounter19, RV32I only.
0b94 ( MRW) csr mhpmcounter20h | Upper 32 bits of mhpmcounter20, RV32I only.
0b95 ( MRW) csr mhpmcounter21h | Upper 32 bits of mhpmcounter21, RV32I only.
0b96 ( MRW) csr mhpmcounter22h | Upper 32 bits of mhpmcounter22, RV32I only.
0b97 ( MRW) csr mhpmcounter23h | Upper 32 bits of mhpmcounter23, RV32I only.
0b98 ( MRW) csr mhpmcounter24h | Upper 32 bits of mhpmcounter24, RV32I only.
0b99 ( MRW) csr mhpmcounter25h | Upper 32 bits of mhpmcounter25, RV32I only.
0b9a ( MRW) csr mhpmcounter26h | Upper 32 bits of mhpmcounter26, RV32I only.
0b9b ( MRW) csr mhpmcounter27h | Upper 32 bits of mhpmcounter27, RV32I only.
0b9c ( MRW) csr mhpmcounter28h | Upper 32 bits of mhpmcounter28, RV32I only.
0b9d ( MRW) csr mhpmcounter29h | Upper 32 bits of mhpmcounter29, RV32I only.
0b9e ( MRW) csr mhpmcounter30h | Upper 32 bits of mhpmcounter30, RV32I only.
0b9f ( MRW) csr mhpmcounter31h | Upper 32 bits of mhpmcounter31, RV32I only.
( Machine Counter Setup)
0323 ( MRW) csr mhpmevent3 | Machine performance-monitoring event selector.
0324 ( MRW) csr mhpmevent4 | Machine performance-monitoring event selector.
0325 ( MRW) csr mhpmevent5 | Machine performance-monitoring event selector.
0326 ( MRW) csr mhpmevent6 | Machine performance-monitoring event selector.
0327 ( MRW) csr mhpmevent7 | Machine performance-monitoring event selector.
0328 ( MRW) csr mhpmevent8 | Machine performance-monitoring event selector.
0329 ( MRW) csr mhpmevent9 | Machine performance-monitoring event selector.
032a ( MRW) csr mhpmevent10 | Machine performance-monitoring event selector.
032b ( MRW) csr mhpmevent11 | Machine performance-monitoring event selector.
032c ( MRW) csr mhpmevent12 | Machine performance-monitoring event selector.
032d ( MRW) csr mhpmevent13 | Machine performance-monitoring event selector.
032e ( MRW) csr mhpmevent14 | Machine performance-monitoring event selector.
032f ( MRW) csr mhpmevent15 | Machine performance-monitoring event selector.
0330 ( MRW) csr mhpmevent16 | Machine performance-monitoring event selector.
0331 ( MRW) csr mhpmevent17 | Machine performance-monitoring event selector.
0332 ( MRW) csr mhpmevent18 | Machine performance-monitoring event selector.
0333 ( MRW) csr mhpmevent19 | Machine performance-monitoring event selector.
0334 ( MRW) csr mhpmevent20 | Machine performance-monitoring event selector.
0335 ( MRW) csr mhpmevent21 | Machine performance-monitoring event selector.
0336 ( MRW) csr mhpmevent22 | Machine performance-monitoring event selector.
0337 ( MRW) csr mhpmevent23 | Machine performance-monitoring event selector.
0338 ( MRW) csr mhpmevent24 | Machine performance-monitoring event selector.
0339 ( MRW) csr mhpmevent25 | Machine performance-monitoring event selector.
033a ( MRW) csr mhpmevent26 | Machine performance-monitoring event selector.
033b ( MRW) csr mhpmevent27 | Machine performance-monitoring event selector.
033c ( MRW) csr mhpmevent28 | Machine performance-monitoring event selector.
033d ( MRW) csr mhpmevent29 | Machine performance-monitoring event selector.
033e ( MRW) csr mhpmevent30 | Machine performance-monitoring event selector.
033f ( MRW) csr mhpmevent31 | Machine performance-monitoring event selector.
( Debug/Trace Registers [shared with Debug Mode])
07a0 ( MRW) csr tselect | Debug/Trace trigger register select.
07a1 ( MRW) csr tdata1 | First Debug/Trace trigger data register.
07a2 ( MRW) csr tdata2 | Second Debug/Trace trigger data register.
07a3 ( MRW) csr tdata3 | Third Debug/Trace trigger data register.
( Debug Mode Registers)
07b0 ( DRW) csr dcsr | Debug control and status register.
07b1 ( DRW) csr dpc | Debug PC.
07b2 ( DRW) csr dscratch | Debug scratch register.