Nios® II Processor Reference Guide

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

8.5.95. wrprs

Instruction write to previous register set
Operation

prs.rC ←  rA

Assembler Syntax

wrprs rC, rA

Example

wrprs r6, r7

Description

Copies the value of rA in the current register set to rC in the previous register set. This instruction can set r0 to 0 in a shadow register set.

Usage

The previous register set is specified by status.PRS. By default, status.PRS indicates the register set in use before an exception, such as an external interrupt, caused a register set change.

To write to an arbitrary register set, software can insert the desired register set number in status.PRS prior to executing wrprs.

System software must use wrprs to initialize r0 to 0 in each shadow register set before using that register set.

If shadow register sets are not implemented on the Nios II core, wrprs is an illegal instruction.

Exceptions

Supervisor-only instruction

Illegal instruction

Instruction Type

R

Instruction Fields

A = Register index of operand rA

C = Register index of operand rC

Bit Fields
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
A 0 C 0x14
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0x14 0 0x3a