Hi,
Our FPGA has an interrupt status register that resets on read. I have to read the register and decode the value to decide what events have occurred. In other words I have written an ISR that looks something like:
Void IsrFxn(Void)
{
const Uint16 interruptStatus = *(Uint16*)0x64000012; // read clears value
if (interruptStatus & 0x0001)
{
...
}
if (interruptStatus & 0x0002)
{
...
}
// and so on for all 16 bits
}
I know that the compiler (CGT C6x) attempts to reduce memory accesses and the code I've generated (CGT V6.1.13 with -o3) is okay because it reads the value of 0x64000012 into a register and keeps it for the whole function.
But is it guaranteed to work?
If not, is there away to ensure only one access?
Alternatively I could talk to the FPGA designer and come up with a different way of dealing with this i.e. write to clear or have clear register.
Any thoughts greatly appreciated!
Thanks,
Matt