NIOS: alternative to IOWR

NIOS II programming is easy with the default include files and functions. An alternative to write to registers using simple C programming can be the following:

IOWR(SENSOR_BASE,0,0xAA);

IOWR() uses the ‘stio’ instruction in order to bypass the data cache.

int *sensor_reg0 = (int)*SENSOR_BASE;
*(sensor_reg0) =0xAA;

SENSOR_BASE, which is an address in this example, should have its 31th bit set in order to bypass the data cache.

Leave a comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.