Altera_Forum
Honored Contributor
16 years agoShadow Registers
I'm having trouble initiating shadow registers, and I'd appreciate any help or suggestions. I'm using a Nios II/f with 5 (arbitrary number) shadow register sets. I have an internal interrupt controller, but I'm trying to use the shadow registers separately.
I'm using Quartus and Nios II BSP version 9.1. In system.h, the five shadow registers are listed. My problem is writing to the control registers. Per the programming model in the reference handbook, I'm trying to initialize the zero and gp registers on the shadow registers, but the status register won't change. Here's my attempt:
asm("movui r2, 0x0100");
asm("rdctl r3, status");
asm("or r4, r2, r3");
asm("wrctl status, r4");
asm("wrprs gp, gp");
Reading status works fine, just not writing. I've also tried writing to estatus with the same results. Am I missing a hardware or software step? Thanks. [EDIT] I've determined "wrctl" is in fact writing to estatus, but only for a handful of "reserved" bits and the PIE bit. This makes sense as the remainder are dependent (Table 3-8 of the PM) on using EIC, shadow registers, or MMU. So once again, does anyone see why I can't alter the CRS or PRS bits? Has anyone used shadow registers before?