Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12600 Discussions

how to sent 5 different data in 5 five clock cycles

Altera_Forum
Honored Contributor II
1,360 Views

Hello everyone 

 

I need to sent 5 different 16 bits data in 5 five clock cycles to my costum component. 

My Altera board is driven by a 50MHz oscillator (a period of 0.02 µs). 

 

so should I write  

 

IOWR_16DIRECT(BASE , OFFSET, DATA_1); 

usleep(0.02); 

IOWR_16DIRECT(BASE , OFFSET, DATA_2); 

usleep(0.02); 

IOWR_16DIRECT(BASE , OFFSET, DATA_5);
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
347 Views

If the NIOS is running with the 50MHz clock, then each instruction takes one clock cycle. It takes more than one instruction to do the IO write, so unless I am mistake you won't be able to do it directly. 

What you could do is have a custom component which contains a small FIFO and some read/write logic. First you load the data into the FIFO. Then you have the component transmit the data at the correct speed (one word per cycle). You could have logic which detects when 5 words of data have been loaded and then immediately start sending, or you could have a start bit which the NIOS has to write to once the data is loaded. 

For the latter option, as NIOS is 32 bit, you could have the NIOS send five 32bit symbols, the lower 16 of which are your data, and then one of the other bits (e.g. bit 31) could be used to signify that this is the last packet. When the fifo detects that bit 31 is set, then it starts sending. That way the two never get out of sync if say the Nios crashed and reset.
0 Kudos
Altera_Forum
Honored Contributor II
347 Views

tha's very helpfull. thank you

0 Kudos
Altera_Forum
Honored Contributor II
347 Views

Hello Can you share the docs for this task because i also want to do same task like i want to pass 8 integer data to my custom component.

0 Kudos
Reply