diff --git a/lib/emac/src/emac_tx.vhd b/lib/emac/src/emac_tx.vhd index b66ab9c..1ab3426 100644 --- a/lib/emac/src/emac_tx.vhd +++ b/lib/emac/src/emac_tx.vhd @@ -67,9 +67,9 @@ ARCHITECTURE behavior OF emac_tx IS signal nwords_free : word_ptr_t; signal alloc_size : word_ptr_t; - signal alloc_en : std_logic; + signal mem_alloc_en : std_logic; - signal free_en : std_logic; + signal mem_free_en : std_logic; signal commit_en : std_logic; signal uncommit_en : std_logic; @@ -127,8 +127,8 @@ ARCHITECTURE behavior OF emac_tx IS begin - ctrl_out.tx_req <= alloc_req; - + ctrl_out.pkt_alloc_req <= alloc_req; + ctrl_out.pkt_done <= cmd_fifo_empty; mii_tx_er <= ctrl_in.tx_er; @@ -166,7 +166,7 @@ host_state_next: end process; host_state: - process(host_s, alloc_req, alloc_OK, fill_rdy, din_vld) + process(host_s, alloc_req, alloc_OK, fill_rdy, din_vld, ctrl_in.pkt_commit_en) begin flush_en <= '0'; @@ -176,7 +176,7 @@ host_state: fill_ptr_adv <= '0'; commit_en <= '0'; alloc_ack <= '0'; - alloc_en <= '0'; + mem_alloc_en <= '0'; host_sn <= host_s; @@ -215,13 +215,13 @@ host_state: fill_ptr_adv <= not fill_rdy and din_vld; if alloc_req = '1' then host_sn <= host_alloc; - elsif fill_rdy = '1' then + elsif fill_rdy = '1' or ctrl_in.pkt_commit_en = '1' then host_sn <= host_commit; end if; when host_commit => commit_en <= '1'; - alloc_en <= '1'; + mem_alloc_en <= '1'; host_sn <= host_idle; when others => @@ -239,7 +239,7 @@ alloc_request_logic: if rising_edge(clk) then if rst = '1' then alloc_req <= '0'; - elsif ctrl_in.tx_req_en = '1' and alloc_req = '0' then + elsif ctrl_in.pkt_alloc_en = '1' and alloc_req = '0' then alloc_req <= '1'; fill_remain <= ctrl_in.tx_size(1 downto 0); fill_size <= ctrl_in.tx_size(word_ptr_t'left+2 downto 2); @@ -289,9 +289,9 @@ nwords_free_counter: if rising_edge(clk) then if flush_en = '1' then nwords_free <= (others => '1'); - elsif alloc_en = '1' then + elsif mem_alloc_en = '1' then nwords_free <= nwords_free - fill_size; - elsif free_en = '1' then + elsif mem_free_en = '1' then nwords_free <= nwords_free + xfer_size; end if; end if; @@ -345,7 +345,7 @@ xfer_state_next: end process; xfer_state: - process(xfer_s, cmd_fifo_empty, xfer_odd, xfer_rdy, inter_frame_gap_rdy, alloc_en, mii_fifo_full) + process(xfer_s, cmd_fifo_empty, xfer_odd, xfer_rdy, inter_frame_gap_rdy, mem_alloc_en, mii_fifo_full) begin xfer_cnt_set <= '0'; @@ -354,7 +354,7 @@ xfer_state: xfer_ptr_adv <= '0'; xfer_remain_en <= '0'; mii_fifo_we <= '0'; - free_en <= '0'; + mem_free_en <= '0'; uncommit_en <= '0'; xfer_sn <= xfer_s; @@ -396,8 +396,8 @@ xfer_state: end if; when xfer_free => - free_en <= not alloc_en; - if alloc_en = '0' then + mem_free_en <= not mem_alloc_en; + if mem_alloc_en = '0' then uncommit_en <= '1'; xfer_sn <= xfer_idle; end if;