01-04-2015 10:31 AM
Hello everyoneI 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);
01-05-2015 12:10 AM
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.