- 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
This commit is contained in:
2010-03-28 21:48:45 +00:00
parent 3d90300b81
commit 67136eeedf
+35 -22
View File
@@ -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;