Forum Discussion
Altera_Forum
Honored Contributor
15 years agoIn my opinion the compiler sees the IORD result as an integer, and will cast it to a float value. I think the only way you could get around this is by using pointers and changing the pointer type. Something like (not tested):
float x,v;
*((unsigned int*)&x)= IORD(IOREG_BASE,0); // Reading from the register1 defined in H/W
v= x+2;
IOWR(IOREG_BASE,1,*((unsigned int*)&v)); // Writing to register2 defined in H/W I don't know if there is a more elegant way to do it...