From 67136eeedf8c103a0ba026cf34533d8d5e5649e8 Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Sun, 28 Mar 2010 21:48:45 +0000 Subject: [PATCH] - improved allocation stuff 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@842 cc03376c-175c-47c8-b038-4cd826a8556b --- lib/emac/src/emac_tx.vhd | 57 ++++++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/lib/emac/src/emac_tx.vhd b/lib/emac/src/emac_tx.vhd index bfe0cfb..0ce5314 100644 --- a/lib/emac/src/emac_tx.vhd +++ b/lib/emac/src/emac_tx.vhd @@ -184,7 +184,7 @@ host_state_next: end process; host_state: - process(host_s, alloc_req, alloc_OK, fill_rdy, din_vld, ctrl_in.pkt_commit_en) + process(host_s, alloc_OK, fill_rdy, din_vld, ctrl_in.pkt_commit_en, alloc_req) begin fill_cnt_set <= '0'; @@ -208,15 +208,16 @@ host_state: end if; when host_alloc => + alloc_ack <= '1'; + host_sn <= host_idle; if alloc_OK = '1' then host_sn <= host_setup; - alloc_ack <= '1'; end if; when host_setup => + host_sn <= host_arm; fill_cnt_set <= '1'; fill_ptr_set <= '1'; - host_sn <= host_arm; when host_arm => fill_cnt_adv <= '1'; @@ -227,7 +228,7 @@ host_state: fill_ptr_adv <= not fill_rdy and din_vld; if alloc_req = '1' then host_sn <= host_alloc; - elsif fill_rdy = '1' or ctrl_in.pkt_commit_en = '1' then + elsif ctrl_in.pkt_commit_en = '1' then host_sn <= host_commit; end if; @@ -259,10 +260,36 @@ alloc_request_logic: fill_size <= ctrl_in.tx_size(word_ptr_t'left+2 downto 2) + 1; end if; ctrl_out.tx_size <= resize(ctrl_in.tx_size(word_ptr_t'left downto 0), 16); - elsif alloc_ack = '1' then - alloc_req <= '0'; - alloc_size <= fill_size; + alloc_req <= '0'; + if alloc_OK = '1' then + alloc_size <= fill_size; + end if; + end if; + end if; + end process; + +------------------------------------------------------------------ +host_alloc_armed_register: + process(clk) + begin + if rising_edge(clk) then + if reset_en = '1' or ctrl_in.pkt_commit_en = '1' or ctrl_in.pkt_alloc_en = '1' then + ctrl_out.pkt_armed <= '0'; + elsif alloc_ack = '1' then + ctrl_out.pkt_armed <= alloc_OK; + end if; + end if; + end process; + +------------------------------------------------------------------ +alloc_eval_logic: + process(clk) + begin + if rising_edge(clk) then + alloc_OK <= '0'; + if fill_size < nwords_free then + alloc_OK <= '1'; end if; end if; end process; @@ -280,20 +307,6 @@ fill_base_logic: end if; end process; ------------------------------------------------------------------- -alloc_eval_logic: - process(clk) - begin - if rising_edge(clk) then - alloc_OK <= '0'; - if alloc_req = '1' then - if fill_size < nwords_free then - alloc_OK <= '1'; - end if; - end if; - end if; - end process; - ------------------------------------------------------------------ nwords_free_counter: process(clk) @@ -302,7 +315,7 @@ nwords_free_counter: if reset_en = '1' then nwords_free <= (others => '1'); elsif mem_alloc_en = '1' then - nwords_free <= nwords_free - fill_size; + nwords_free <= nwords_free - alloc_size; elsif mem_free_en = '1' then nwords_free <= nwords_free + xfer_size; end if;