From 8960bc52e776fdefe661d4118c177b51f2f7450d Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Sun, 21 Mar 2010 15:12:09 +0000 Subject: [PATCH] - allow reallocation during tx-fill tx is re-armed and already written data is discarded. Committed on the Free edition of March Hare Software CVSNT Server. Upgrade to CVS Suite for more features and support: http://march-hare.com/cvsnt/ git-svn-id: http://moon:8086/svn/vhdl/trunk@807 cc03376c-175c-47c8-b038-4cd826a8556b --- lib/emac/emac_jb.vhd | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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;