FAQ: A number of registers appear to be missing from sysreg.h in VisualDSP++ 5.0 compared to earlier versions

Document created by DavidS on May 4, 2011
Version 1Show Document
  • View in full screen mode

Q: A number of registers appear to be missing from sysreg.h in VisualDSP++ 5.0 is this correct? If so, why?

 

---------------------------

 

A: Yes this is correct. A number of registers have been removed from sysreg.h in this version of the tools because these registers can be used by the compiler and so reading from or writing to these registers in regular "C" code could result in unexpected behaviour as you have no way of knowing what values they are going to hold.

 

The compiler assumes that all sysregs are registers that aren't otherwise used by the compiler. So, saying sysreg_write(reg_r3, x) and then y = sysreg_read(reg_r3) doesn't necessarily mean that x == y because the compiler might have used r3 in between them.

 

The only way to write to or read from these registers directly is to use inline assembly, though when writing your code you should take into account the factors mentioned above.

 

The registers affected are R0-R7, xR0-xr15, HR0-HR7, xHR0-xHR15, P0-P5, xP0-xP11, FP, SP and Q0-Q3.

Attachments

    Outcomes