Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

Writting floating point numbers using IOWR IORD

Hi,

I'm trying to read a custom register which has a 32 bit floating point value, from the NIOS in the c-code using the Macro IORD(base,offset).

If I assign this to a variable defined as float and Add it with 2.

And write the result into another custom register using IOWR Macro.

I'm not getting equivalent IEEE-754 value in the register.

Can anybody suggest what might be the problem?

Code is as below:

float x,v;

x= IORD(IOREG_BASE,0); // Reading from the register1 defined in H/W

v= x+2;

IOWR(IOREG_BASE,1,v); // Writing to register2 defined in H/W

11 Replies