------ TODO: change it to synchronous
GSC_INIT_PACKET_NUM_OUT <= packet_num;
GSC_INIT_DATAREADY_OUT <= gsc_init_dataready;
-gsc_init_dataready <= '1' when (GSC_INIT_READ_IN = '1' and dissect_current_state = LOAD_TO_HUB) or
+gsc_init_dataready <= '1' when (GSC_INIT_READ_IN = '1' and dissect_current_state = LOAD_TO_HUB) or --TODO Ob das so richtig ist, ohne auf fifo_rd zu schauen?
(dissect_current_state = WAIT_FOR_HUB) else '0';
PACKET_NUM_PROC : process(CLK)
if rising_edge(CLK) then
if (dissect_current_state = IDLE) then
packet_num <= "100";
- elsif (GSC_INIT_READ_IN = '1' and rx_fifo_rd = '1' and packet_num = "100") then
+ elsif (GSC_INIT_READ_IN = '1' and rx_fifo_rd = '1' and packet_num = "100" and dissect_current_state /= READ_FRAME) then --BUG zählt schon hoch beim fifo_rd weil read schon 1 ist. read geht aber nur auf 1 wenn dataready auf 1 ist
packet_num <= "000";
elsif (rx_fifo_rd = '1' and packet_num /= "100") then
packet_num <= packet_num + "1";
when READ_FRAME =>
state <= x"2";
- if (PS_DATA_IN(8) = '1') then
+ if (PS_DATA_IN(8) = '1' and (GSC_INIT_READ_IN = '0')) then
dissect_next_state <= WAIT_FOR_HUB;
+ elsif (PS_DATA_IN(8) = '1' and (GSC_INIT_READ_IN = '1')) then
+ dissect_next_state <= LOAD_TO_HUB;
else
dissect_next_state <= READ_FRAME;
end if;