Forum Discussion

ZVere's avatar
ZVere
Icon for New Contributor rankNew Contributor
5 years ago

Slow access to avalon from NIOS

Hello,

My baremetal NIOS application is writing to 32bits registers in the FGPA via AVALON bus.

The code is:

void GwbrWriteWord32 (alt_u32 Offset, alt_u32 Data)
{
	IOWR_32DIRECT (0, Offset,Data);
}
void WriteMyRegister (alt_u32 Val)
{
	GwbrWriteWord32 (MY_OFFSET, Val);
}

int main (void)
{
    WriteMyRegister (17); 
    WriteMyRegister (17); 
    return 0;
}

I measured the time required to execute "WriteMyRegister" with Quartus and got 146 clock ticks. The clock is 100MHz so the time is: 1.46usec

Does it make sense ? It seems very slow.

Do you think I can make it faster by changing the code ?

Thank you,

Zvika

1 Reply

  • EricMunYew_C_Intel's avatar
    EricMunYew_C_Intel
    Icon for Frequent Contributor rankFrequent Contributor

    The long latency that you got is correct due to the fact that IOWR_32DIRECT is bypassing data cache.