The value in each CSR registers determines the state of the Nios® V/g processor. The field descriptions are based on the RISC-V specification. You can access all CSRs by using csrr* instruction in Machine mode except for the Debug mode registers (0x7B0 and 0x7B1) which can only be accessed through Debug mode.
Table 207. Floating-Point CSR Register FieldsThe fcsr CSR is a 32-bit read/write register that holds the accrued exception flags. RISC-V CSR instructions can access fflags and frm field individually by specifying the CSR address (0x001 and 0x002) respectively.
When accessing frm field individually using the CSR address 0x002, the rounding mode is transferred as bits [2:0] of the destination register.
RNE (000) is the only supporting rounding mode. Writing other rounding mode into frm generates an illegal instruction exception.
Bit Field |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
24 |
23 |
22 |
21 |
20 |
19 |
18 |
17 |
16 |
Reserved |
15 |
14 |
13 |
12 |
11 |
10 |
9 |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
Reserved |
Rounding Mode (frm) |
Accured Exceptions (fflags) |
000 |
NV |
DZ |
OF |
UF |
NX |
Table 208. Machine Status Register FieldsThe mstatus register is a 32-bit read-write register that keeps track of and controls the hart’s current operating state.
Bit Field |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
24 |
23 |
22 |
21 |
20 |
19 |
18 |
17 |
16 |
SD |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
15 |
14 |
13 |
12 |
11 |
10 |
9 |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
0 |
FS[1:0] |
MPP[1:0] |
0 |
0 |
MPIE |
0 |
0 |
0 |
MIE |
0 |
0 |
0 |
The following bitfields are read-only 0:
- Bit 22 (TSR = 0): S-mode is not supported
- Bit 21 (TW = 0): There are no modes less privileged than M-mode.
- Bit 20 (TVM = 0): S-mode is not supported
- Bit 19 (MXR = 0): S-mode is not supported
- Bit 18 (SUM = 0): S-mode and U-mode are not supported
- Bit 17 (MPRV = 0): U-mode is not supported
- Bit 16 and Bit 15 (XS[1:0] = 0): S-mode is not supported
- Bit 10 and Bit 9 (VS[1:0] = 0): S-mode is not supported
- Bit 8 (SPP = 0): S-mode is not supported
- Bit 6 (UBE = 0): U-mode is not supported
- Bit 5 (SPIE = 0): S-mode is not supported
- Bit 1 (SIE = 0): S-mode is not supported
Table 209. Machine ISA Register FieldsThe misa CSR is a read-write register reporting the ISA supported by the hart.
Bit Field |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
24 |
23 |
22 |
21 |
20 |
19 |
18 |
17 |
16 |
MXL[1:0] |
0 |
Extension[25:0] |
15 |
14 |
13 |
12 |
11 |
10 |
9 |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
Extension[25:0] . |
Table 210. Machine Interrupt-Enable Register FieldsThe mie register is a 32-bit read-write register that contains interrupt enable bits. In CLIC mode, the mie register is inactive, thus hardwired to 0. It is replaced by the CLIC interrupt enable register (clicintie)
Bit Field |
31 |
… |
0 |
0 |
Table 211. Machine Trap-Handler Base Address Register Fields (For CLIC mode)The mtvec register is a 32-bit read/write register that holds trap CLIC configuration, consisting of a trap CLIC base address (base) and a CLIC mode (mode = 11). submode bit field is reserved for future use.
Bit Field |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
24 |
23 |
22 |
21 |
20 |
19 |
18 |
17 |
16 |
base[31:6] |
15 |
14 |
13 |
12 |
11 |
10 |
9 |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
base[31:6] |
submode = 0 |
mode = 11 |
Table 212. Machine Trap-Handler Vector Table Base Address Register FieldsThe mtvt register is a 32-bit read-write register that holds the Machine Trap Vector base address for CLIC vectored interrupts.
Bit Field |
31 |
30 |
29 |
… |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
base[31:6] |
Reserved. |
Table 213. Machine Scratch Register for Trap Handler Register FieldsThe mscratch register is a 32-bit read-write register that holds a pointer to a machine-mode hart-local context space and swapped with a user register upon entry to an M-mode trap handler.
Bit Field |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
… |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
mscratch |
Table 214. Machine Exception Program Counter Register FieldsThe mepc register is a 32-bit read-write register that holds the addresses of the instruction that was interrupted or that encountered the exception when a trap is taken into M-mode.
Bit Field |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
… |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
mepc |
Table 215. Machine Trap Cause Register Fields (For CLIC mode)The mcause register is a 32-bit read-write register that holds the code indicating the event that caused the trap when a trap is taken into M-mode.
Bit Fields |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
24 |
23 |
22 |
21 |
20 |
19 |
18 |
17 |
16 |
interrupt |
minhv |
mpp[1:0] = 00 |
mpie |
Reserved |
mpil[7:0] |
15 |
14 |
13 |
12 |
11 |
10 |
9 |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
Reserved |
exccode[11:0] |
Table 216. Machine Trap Value Register FieldsThe mtval register is a 32-bit read-write register that is written with exception-specific information to assist software in handling the trap.
Bit Field |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
… |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
mtval |
Table 217. Machine Interrupt-Pending Register FieldsThe mip register is a 32-bit read/write register containing information on pending interrupts. In CLIC mode, the mip register is inactive, thus hardwired to 0. It is replaced by separate interrupt pending (clicintip).
Bit Field |
31 |
… |
0 |
0 |
Table 218. Machine Next Interrupt Handler Address and Interrupt Enable Register FieldThe mnxti register is a 32-bit read-write register that improve the performance of handling back-to-back software vectored interrupts.
Bit Field |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
… |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
mnxti |
Table 219. Machine Interrupt-Level Register FieldsThe mintthresh register is a 32-bit read-write register that holds an 8-bit field for the threshold level.
Bit Field |
31 |
30 |
29 |
… |
9 |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
Reserved = 0 |
threshold |
Table 220. Machine Scratch Swap for Interrupt-Level Change Register FieldsThe mscratchswl register is a 32-bit read-write register that support faster swapping of the stack pointer between interrupt and non-interrupt code.
Bit Field |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
… |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
mscratchswl |
Table 221. Machine Interrupt Status Register FieldsThe mintstatus register is a 32-bit read-write register that holds the active interrupt level.
Bit Fields |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
24 |
23 |
22 |
21 |
20 |
19 |
18 |
17 |
16 |
mil |
Reserved |
15 |
14 |
13 |
12 |
11 |
10 |
9 |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
0 |
Reserved |
Table 222. Machine Indirect Select Register FieldsThe miselect register is a 32-bit read-write register that select the CLIC registers based on specific index.
Bit Field |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
… |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
miselect |
Table 223. Machine Indirect Alias Register FieldsThe mireg register is a 32-bit read-write register that hold the current value of the CLIC register for register read and write operation. Use miselect register to select which CLIC register to display. Refer to Packing of Indirectly Accessed CLIC Registers for more information.
Bit Field |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
… |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
mireg |
Table 224. Machine Indirect Alias 2 Register FieldsThe mireg2 register is a 32-bit read-write register that hold the current value of the CLIC register for register read and write operation. Use miselect register to select which CLIC register to display. Refer to Packing of Indirectly Accessed CLIC Registers for more information.
Bit Field |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
… |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
mireg2 |
Table 225. Trigger Select Register FieldsThe tselect register is a 32-bit read/write register that selects the current trigger is accessible by other trigger register.
Bit Field |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
… |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
tselect |
Table 226. Trigger Data 1 (Match Control) Register FieldsThe tdata1 (mcontrol) register is a 32-bit read/write register containing information on the trigger type, tdata registers accessibility, and trigger implementation. This core does not support supervisor or user modes. Thus, any bitfield related to these modes is read-only 0.
Bit Field |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
24 |
23 |
22 |
21 |
20 |
19 |
18 |
17 |
16 |
type = 2 |
dmode |
maskmax |
hit |
select |
timing |
sizelo |
15 |
14 |
13 |
12 |
11 |
10 |
9 |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
action |
chain |
match |
m |
0 |
0 |
0 |
execute |
store |
load |
Table 227. Trigger Data 2 Register FieldsThe tdata2 register is a 32-bit read/write register containing the trigger-specific data.
Bit Field |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
… |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
tdata2 |
Table 228. Trigger Info Register FieldsThe tinfo register is a 32-bit read-only register containing information on each possible tdata1.type.
Bit Field |
31 |
30 |
29 |
… |
18 |
17 |
16 |
15 |
14 |
13 |
… |
2 |
1 |
0 |
0 |
info |
Table 229. Debug Control and Status Register FieldsThe dcsr CSR is a 32-bit read-write register containing information and status during D-mode. This core does not support supervisor or user modes. Thus, any bitfield related to these modes is read-only 0.
Bit Field |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
24 |
23 |
22 |
21 |
20 |
19 |
18 |
17 |
16 |
debugver |
0 |
15 |
14 |
13 |
12 |
11 |
10 |
9 |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
ebreakm |
0 |
0 |
0 |
stepie |
stopcount |
stoptime |
cause |
0 |
mprven |
nmip |
step |
Prv |
Table 230. Debug Program Counter Register FieldsUpon entry to D-mode, dpc CSR is updated with the virtual address of the next instruction to be executed.
Bit Field |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
… |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
dpc |
Table 231. Shadow Register File Status CSR FieldsThe msrfstatus is a 32-bits wide register containing shadow register status information. Refer to Shadow Registerr for more information.
Bit Field |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
24 |
23 |
22 |
21 |
20 |
19 |
18 |
17 |
16 |
ESI |
Reserved |
15 |
14 |
13 |
12 |
11 |
10 |
9 |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
psrf |
asrf |
Table 232. Read Previous Shadow Register CSR FieldsThe m rdpsrf register facilitates copying a single register from previous shadow register sets to the active one. Refer to Shadow Register for more information.
Bit Field |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
… |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
mrdpsrf |
Table 233. Write Previous Shadow Register CSR FieldsThe mwrpsrf register facilitates copying a single register from active shadow register sets to the previous one. Refer to 4.3.2. Shadow Register for more information.
Bit Field |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
… |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
mwrpsrf |
Table 234. Vendor ID Register FieldsThe mvendorid CSR is a 32-bit read-only register that provides the JEDEC manufacturer ID of the provider of the core.
Bit Field |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
24 |
23 |
22 |
21 |
20 |
19 |
18 |
17 |
16 |
Bank |
15 |
14 |
13 |
12 |
11 |
10 |
9 |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
Bank |
Offset |
Table 235. Architecture ID Register FieldsThe marchid CSR is a 32-bit read-only register encoding the base microarchitecture of the hart.
Bit Field |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
… |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
Architecture ID |
Table 236. Implementation ID Register FieldsThe mimpid CSR provides a unique encoding of the version of the processor implementation.
Bit Field |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
… |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
Implementation |
Table 237. Hardware Thread ID Register FieldsThe mhartid CSR is a 32-bit read-only register that contains the integer ID of the hardware thread running the code.
Bit Field |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
… |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
Hart ID |