Nios® V Processor Reference Manual

ID 683632
Date 5/25/2025
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

4.3.2.2.1. Shadow Register File Status CSR (msrfstatus)

The msrfstatus is a 32-bits wide register containing shadow register status information. The msrfstatus.ESI bit determines if the hardware switches the shadow register files automatically upon taking an interrupt. This bit is cleared upon a processor reset.
Table 98.   msrfstatus Register Layout
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 99.   msrfstatus Field Encoding
Bits Field Description
31 ESI

0: Disable register set switching upon interrupt is taken

1: Enable register set switching upon interrupt is taken

30:16 Reserved -
15:8 psrf

Previous register file

0: General Purpose Register

1– 256: Shadow Register Sets

7:0 asrf

Active register file

0: General Purpose Register

1– 256: Shadow Register Sets

Table 100.   msrfstatus Behaviour during Interrupt Handling (With msrfstatus.ESI bit = 1)
Interrupt Controller Condition msrfstatus.psrf msrfstatus.asrf
CLINT No interrupt Don’t Care

0

(General-purpose register)

Typical interrupt entry

0

(General-purpose register)

1

(Shadow register)

Typical interrupt exit

(back to No interrupt)

Don’t Care

0

(General-purpose register)

CLIC + “Number of CLIC interrupt levels” option No interrupt Don’t Care

0

(General-purpose register)

Initial interrupt entry

0

(General-purpose register)

Any non-zero value (Shadow register) that equals to the initial interrupt level

Pre-emption entry

Any non-zero value (Shadow register) that equals to the:

  • Initial interrupt level
  • Lower interrupt level

Any non-zero value (Shadow register) that equals to the higher interrupt level

2nd or higher level pre-emption exit Any non-zero value (Shadow register) that equals to a much lower interrupt level

Any non-zero value (Shadow register) that equals to the lower interrupt level

1st pre-emption exit

(back to Initial interrupt entry)

0 (General-purpose register) Any non-zero value (Shadow register) that equals to the initial interrupt level

Initial interrupt exit

(back to No interrupt)

Don’t Care

0

(General-purpose register)

CLIC + “Number of CLIC interrupt levels - 1” option No interrupt Don’t Care

0

(General-purpose register)

Initial interrupt entry

0

(General-purpose register)

0

(General-purpose register)

1st pre-emption entry

0

(General-purpose register)

Any non-zero value (Shadow register) that equals to the 1st pre-empting interrupt level

2nd or higher level pre-emption entry

Any non-zero value (Shadow register) that equals to the:

  • 1st pre-empting interrupt level
  • Lower interrupt level
Any non-zero value (Shadow register) that equals to the higher interrupt level
3rd or higher level pre-emption exit

Any non-zero value (Shadow register) that equals to a much lower interrupt level

Any non-zero value (Shadow register) that equals to the lower interrupt level

2nd pre-emption exit

(back to 1st pre-emption entry)

0

(General-purpose register)

Any non-zero value (Shadow register) that equals to the 1st pre-empting interrupt level

1st pre-emption exit

(back to Initial interrupt entry)

0

(General-purpose register)

0

(General-purpose register)

Initial interrupt exit

(back to No interrupt)

Don’t Care

0

(General-purpose register)

Note: When msrfstatus .ESI bit = 0, you need to update msrfstatus.psrf and msrfstatus.asrf manually using csrr* instruction to switch between register sets manually.
Figure 15.  msrfstatus Behaviour in CLINT
Events msrfstatus CSR Which processor state is held?
psrf asrf GPR SRF
No interrupt Don’t Care 0 Application -
Typical interrupt entry 0 1 Application Interrupt
Typical interrupt exit Don’t Care 0 Application -
Figure 16.  msrfstatus Behaviour in CLIC with Number of CLIC interrupt levels Option
Events msrfstatus CSR Which processor state is held?
psrf asrf GPR SRF 1 SRF 2 SRF 3 SRF 4
No interrupt Don’t Care 0 Level 0 - - - -
Initial interrupt entry 0 63 Level 0 Level 63 - - -
1st Pre-emption entry 63 127 Level 0 Level 63 Level 127 - -
2nd Pre-emption entry 127 191 Level 0 Level 63 Level 127 Level 191 -
3rd Pre-emption entry 191 255 Level 0 Level 63 Level 127 Level 191 Level 255
3rd Pre-emption exit 127 191 Level 0 Level 63 Level 127 Level 191 -
2nd Pre-emption exit 63 127 Level 0 Level 63 Level 127 - -
1st Pre-emption exit 0 63 Level 0 Level 63 - - -
Initial interrupt exit Don’t Care 0 Level 0 - - - -
Figure 17.  msrfstatus Behaviour in CLIC with Number of CLIC interrupt levels – 1 Option
Events msrfstatus CSR Which processor state is held?
psrf asrf GPR SRF 1 SRF 2 SRF 3
No interrupt Don’t Care 0 Level 0 - - -
Initial interrupt entry 0 0 Level 127 - - -
1st Pre-emption entry 0 191 Level 127 Level 191 - -
1st Pre-emption exit 0 0 Level 127 - - -
Initial interrupt exit Don’t Care 0 Level 0 - - -