diff --git a/lib/emac/emac_jb.vhd b/lib/emac/emac_jb.vhd index ada8e05..650569c 100644 --- a/lib/emac/emac_jb.vhd +++ b/lib/emac/emac_jb.vhd @@ -76,6 +76,7 @@ ARCHITECTURE behavior OF emac_jb IS signal tx_fill_rdy : std_logic; signal tx_fill_cnt_set : std_logic; signal tx_fill_cnt_adv : std_logic; + signal tx_fill_ptr_set : std_logic; signal tx_fill_ptr_adv : std_logic; signal tx_alloc_OK : std_logic; @@ -200,6 +201,8 @@ host_tx_state: tx_flush_ptr_set <= '0'; tx_alloc_ack <= '0'; tx_fill_cnt_set <= '0'; + tx_fill_cnt_adv <= '0'; + tx_fill_ptr_set <= '0'; tx_fill_ptr_adv <= '0'; tx_commit_en <= '0'; tx_alloc_en <= '0'; @@ -232,7 +235,8 @@ host_tx_state: when host_tx_setup => tx_fill_cnt_set <= '1'; - host_tx_sn <= host_tx_arm; + tx_fill_ptr_set <= '1'; + host_tx_sn <= host_tx_arm; when host_tx_arm => tx_fill_ptr_adv <= '1'; @@ -242,7 +246,9 @@ host_tx_state: when host_tx_fill => tx_fill_cnt_adv <= host_data_we; tx_fill_ptr_adv <= not tx_fill_rdy and host_data_we; - if tx_fill_rdy = '1' then + if tx_alloc_req = '1' then + host_tx_sn <= host_tx_alloc; + elsif tx_fill_rdy = '1' then host_tx_sn <= host_tx_commit; end if; @@ -366,8 +372,8 @@ tx_fill_pointer: process(CLK_I) begin if rising_edge(CLK_I) then - if tx_flush_en = '1' then - tx_fill_ptr <= (others => '0'); + if tx_fill_ptr_set = '1' then + tx_fill_ptr <= tx_alloc_base; elsif tx_fill_ptr_adv = '1' then tx_fill_ptr <= tx_fill_ptr + 1; end if;