Nios® II Processor Reference Guide

ID 683836
Date 8/28/2023
Public
Document Table of Contents

3.4.3.1.1. Changing Register Sets

Modifying status.CRS immediately switches the Nios® II processor to another register set. However, software cannot write to status.CRS directly. To modify status.CRS, insert the desired value into the saved copy of the status register, and then execute the eret instruction, as follows:
  • If the processor is currently running in the normal register set, insert the new register set number in estatus.CRS, and execute eret.
  • If the processor is currently running in a shadow register set, insert the new register set number in sstatus.CRS, and execute eret.

Before executing eret to change the register set, system software must set individual external interrupt masks correctly to ensure that registers in the shadow register set cannot be corrupted. If an interrupt is assigned to the register set, system software must ensure that one of the following conditions is true:

  • The ISR is written to preserve register contents.
  • The individual interrupt is disabled. The method for disabling an individual external interrupt is specific to the EIC implementation.