Forum Discussion
Altera_Forum
Honored Contributor
15 years agoHi Phate,
The Video ST interface transfers data synchronously with the system clock (50MHz in your case) therefore all signals in the interface is synchronised to the 50MHz clock. The interface includes two flow control lines: Valid and Ready. The Valid line is used by a source to indicate when valid (new) data is available on the data lines. The Ready line is used by the sink to indicate when it is able to recieve new data. If Ready is high, the source will output data as it becomes available and will set the Valid line high for each data word it outputs. If it has no data to output, it will make the Valid line low. In your example, since new pixel data arrives at a rate of 27MHz (assuming you output the colour planes in sequence), and since your system clock is almost twice as fast, the Avalon ST output will set the Valid line low almost every second pixel being transferred. If you wanted to count the pixels in a line, it would look something like this (in VHDL) process (Clk, Reset) begin if Reset = '1' then Count <= 0; elsif Clk'event and Clk='1' then if ST_Valid = '1' then Count <= Count + 1; end if; end if; end process; Clk is the 50MHz clock and ST_Valid is the Valid line on the ST interface. The Valid signal is high for every new word being transferred - not only for pixel data. Remember that each packet starts with a header word and that each video frame / field is preceded by a control packet. You have to implement a state machine that keeps track of where you are in the transfer process. The state machine would then have an output like VideoActive which you set high for as long as there is actual pixel data coming in. This signal, together with the Valid signal is used to enable your counters. I hope this helps. Ask if it is not yet clear. Regards, Niki