- added transfer dropstate in case of RAM full
- registered ctrl_out.pkt_lost. Cleared on pkt_free 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@832 cc03376c-175c-47c8-b038-4cd826a8556b
This commit is contained in:
+29
-38
@@ -54,27 +54,19 @@ ARCHITECTURE behavior OF emac_rx IS
|
|||||||
signal flush_en : std_logic;
|
signal flush_en : std_logic;
|
||||||
|
|
||||||
signal fill_ptr : word_ptr_t;
|
signal fill_ptr : word_ptr_t;
|
||||||
signal fill_ptr_set : std_logic;
|
|
||||||
signal fill_ptr_adv : std_logic;
|
|
||||||
|
|
||||||
signal commit_en : std_logic;
|
signal commit_en : std_logic;
|
||||||
signal uncommit_en : std_logic;
|
|
||||||
|
|
||||||
signal xfer_ram_limit : word_ptr_t;
|
signal xfer_ram_limit : word_ptr_t;
|
||||||
signal xfer_ram_full : std_logic;
|
signal xfer_ram_full : std_logic;
|
||||||
signal xfer_base : word_ptr_t;
|
signal xfer_base : word_ptr_t;
|
||||||
signal xfer_size : word_ptr_t;
|
signal xfer_size : word_ptr_t;
|
||||||
signal xfer_ptr : word_ptr_t;
|
signal xfer_ptr : word_ptr_t;
|
||||||
signal xfer_cnt : word_ptr_t;
|
|
||||||
signal xfer_ptr_set : std_logic;
|
signal xfer_ptr_set : std_logic;
|
||||||
signal xfer_ptr_adv : std_logic;
|
signal xfer_ptr_adv : std_logic;
|
||||||
signal xfer_cnt_set : std_logic;
|
signal xfer_cnt_set : std_logic;
|
||||||
signal xfer_cnt_adv : std_logic;
|
signal xfer_cnt_adv : std_logic;
|
||||||
signal xfer_rdy : std_logic;
|
signal xfer_rdy : std_logic;
|
||||||
signal xfer_tag : unsigned(3 downto 0);
|
|
||||||
signal xfer_remain : unsigned(1 downto 0);
|
|
||||||
signal xfer_odd : std_logic;
|
|
||||||
signal xfer_remain_en : std_logic;
|
|
||||||
|
|
||||||
signal ram_en_a : std_logic;
|
signal ram_en_a : std_logic;
|
||||||
signal ram_we_a : std_logic;
|
signal ram_we_a : std_logic;
|
||||||
@@ -111,10 +103,10 @@ ARCHITECTURE behavior OF emac_rx IS
|
|||||||
signal word_count_ack : std_logic;
|
signal word_count_ack : std_logic;
|
||||||
signal word_count_vld : std_logic;
|
signal word_count_vld : std_logic;
|
||||||
|
|
||||||
type host_state_t is (host_init, host_flush, host_idle, host_setup, host_arm, host_fill, host_uncommit);
|
type host_state_t is (host_init, host_flush, host_idle);
|
||||||
signal host_s, host_sn : host_state_t;
|
signal host_s, host_sn : host_state_t;
|
||||||
|
|
||||||
type xfer_state_t is (xfer_init, xfer_idle, xfer_setup, xfer_wait, xfer_active, xfer_free);
|
type xfer_state_t is (xfer_init, xfer_idle, xfer_setup, xfer_active, xfer_drop, xfer_free);
|
||||||
signal xfer_s, xfer_sn : xfer_state_t;
|
signal xfer_s, xfer_sn : xfer_state_t;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@@ -122,7 +114,6 @@ begin
|
|||||||
ctrl_out.rx_size <= cmd_fifo_dout(31 downto 16);
|
ctrl_out.rx_size <= cmd_fifo_dout(31 downto 16);
|
||||||
ctrl_out.pkt_avail <= not cmd_fifo_empty;
|
ctrl_out.pkt_avail <= not cmd_fifo_empty;
|
||||||
ctrl_out.rx_er <= mii_rx_er;
|
ctrl_out.rx_er <= mii_rx_er;
|
||||||
ctrl_out.pkt_lost <= xfer_ram_full;
|
|
||||||
|
|
||||||
dout <= ram_dout_a;
|
dout <= ram_dout_a;
|
||||||
|
|
||||||
@@ -137,7 +128,7 @@ begin
|
|||||||
ram_en_b <= '1';
|
ram_en_b <= '1';
|
||||||
ram_din_b <= mii_fifo_dout(31 downto 0);
|
ram_din_b <= mii_fifo_dout(31 downto 0);
|
||||||
ram_addr_b <= xfer_ptr;
|
ram_addr_b <= xfer_ptr;
|
||||||
ram_we_b <= xfer_cnt_adv;
|
ram_we_b <= xfer_ptr_adv;
|
||||||
|
|
||||||
cmd_fifo_we <= commit_en;
|
cmd_fifo_we <= commit_en;
|
||||||
cmd_fifo_re <= ctrl_in.pkt_free_en;
|
cmd_fifo_re <= ctrl_in.pkt_free_en;
|
||||||
@@ -157,12 +148,10 @@ host_state_next:
|
|||||||
end process;
|
end process;
|
||||||
|
|
||||||
host_state:
|
host_state:
|
||||||
process(host_s, cmd_fifo_empty, ctrl_in.pkt_read_en, ctrl_in.pkt_req_en)
|
process(host_s)
|
||||||
begin
|
begin
|
||||||
|
|
||||||
flush_en <= '0';
|
flush_en <= '0';
|
||||||
fill_ptr_set <= '0';
|
|
||||||
fill_ptr_adv <= '0';
|
|
||||||
|
|
||||||
host_sn <= host_s;
|
host_sn <= host_s;
|
||||||
|
|
||||||
@@ -177,25 +166,6 @@ host_state:
|
|||||||
host_sn <= host_idle;
|
host_sn <= host_idle;
|
||||||
|
|
||||||
when host_idle =>
|
when host_idle =>
|
||||||
if cmd_fifo_empty = '0' then
|
|
||||||
host_sn <= host_setup;
|
|
||||||
end if;
|
|
||||||
|
|
||||||
when host_setup =>
|
|
||||||
fill_ptr_set <= '1';
|
|
||||||
host_sn <= host_arm;
|
|
||||||
|
|
||||||
when host_arm =>
|
|
||||||
host_sn <= host_fill;
|
|
||||||
|
|
||||||
when host_fill =>
|
|
||||||
fill_ptr_adv <= ctrl_in.pkt_read_en;
|
|
||||||
if ctrl_in.pkt_req_en = '1' then
|
|
||||||
host_sn <= host_uncommit;
|
|
||||||
end if;
|
|
||||||
|
|
||||||
when host_uncommit =>
|
|
||||||
host_sn <= host_idle;
|
|
||||||
|
|
||||||
when others =>
|
when others =>
|
||||||
host_sn <= host_idle;
|
host_sn <= host_idle;
|
||||||
@@ -261,9 +231,6 @@ xfer_state:
|
|||||||
when xfer_setup =>
|
when xfer_setup =>
|
||||||
xfer_cnt_set <= '1';
|
xfer_cnt_set <= '1';
|
||||||
xfer_ptr_set <= '1';
|
xfer_ptr_set <= '1';
|
||||||
xfer_sn <= xfer_wait;
|
|
||||||
|
|
||||||
when xfer_wait =>
|
|
||||||
xfer_sn <= xfer_active;
|
xfer_sn <= xfer_active;
|
||||||
|
|
||||||
when xfer_active =>
|
when xfer_active =>
|
||||||
@@ -271,13 +238,22 @@ xfer_state:
|
|||||||
xfer_cnt_adv <= not mii_fifo_empty;
|
xfer_cnt_adv <= not mii_fifo_empty;
|
||||||
xfer_ptr_adv <= not mii_fifo_empty;
|
xfer_ptr_adv <= not mii_fifo_empty;
|
||||||
if xfer_ram_full = '1' then
|
if xfer_ram_full = '1' then
|
||||||
xfer_sn <= xfer_free;
|
xfer_sn <= xfer_drop;
|
||||||
elsif xfer_rdy = '1' then
|
elsif xfer_rdy = '1' then
|
||||||
if mii_fifo_empty = '1' then
|
if mii_fifo_empty = '1' then
|
||||||
xfer_sn <= xfer_free;
|
xfer_sn <= xfer_free;
|
||||||
end if;
|
end if;
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
|
when xfer_drop =>
|
||||||
|
mii_fifo_re <= '1';
|
||||||
|
xfer_cnt_adv <= not mii_fifo_empty;
|
||||||
|
if xfer_rdy = '1' then
|
||||||
|
if mii_fifo_empty = '1' then
|
||||||
|
xfer_sn <= xfer_free;
|
||||||
|
end if;
|
||||||
|
end if;
|
||||||
|
|
||||||
when xfer_free =>
|
when xfer_free =>
|
||||||
word_count_ack <= '1';
|
word_count_ack <= '1';
|
||||||
commit_en <= not xfer_ram_full;
|
commit_en <= not xfer_ram_full;
|
||||||
@@ -290,6 +266,21 @@ xfer_state:
|
|||||||
end process;
|
end process;
|
||||||
|
|
||||||
------------------------------------------------------------------
|
------------------------------------------------------------------
|
||||||
|
pkt_lost_register:
|
||||||
|
process(clk)
|
||||||
|
begin
|
||||||
|
if rising_edge(clk) then
|
||||||
|
if flush_en = '1' then
|
||||||
|
ctrl_out.pkt_lost <= '0';
|
||||||
|
elsif word_count_ack = '1' and xfer_ram_full = '1' then
|
||||||
|
ctrl_out.pkt_lost <= '1';
|
||||||
|
elsif ctrl_in.pkt_free_en = '1' then
|
||||||
|
ctrl_out.pkt_lost <= '0';
|
||||||
|
end if;
|
||||||
|
end if;
|
||||||
|
|
||||||
|
end process;
|
||||||
|
|
||||||
xfer_limit_register:
|
xfer_limit_register:
|
||||||
process(clk)
|
process(clk)
|
||||||
begin
|
begin
|
||||||
|
|||||||
Reference in New Issue
Block a user