process(ft245ClkOut)
begin
if falling_edge(ft245ClkOut) then
if syncRst = '1' then
currState <= idle;
s_pixel_wdata <= (others => '0');
pre_pixel_we <= '0';
else
pre_pixel_we <= pixel_we;
case currState is
when idle =>
currState <= checkForPixelRdy;
s_pixel_wdata <= (others => '0');
pre_pixel_we <= '0';
when checkForPixelRdy =>
if pre_pixel_we = '0' and pixel_we = '1' then
currState <= checkForTxBuff;
s_pixel_wdata <= pixel_wdata;
else
currState <= checkForPixelRdy;
end if;
when checkForTxBuff =>
if ft245TxFull = '0' then
currState <= sendPixelBigEndian;
else
currState <= checkForTxBuff;
end if;
when sendPixelBigEndian =>
currState <= writeDone;
when writeDone =>
currState <= sendPixelLittleEndian;
when sendPixelLittleEndian =>
currState <= checkForPixelRdy;
when others =>
currState <= idle;
s_pixel_wdata <= (others => '0');
pre_pixel_we <= '0';
end case;
end if;
end if;
end process;