From 2989bb688ff8217e49512ac8f40ec6a8102b0a7a Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Fri, 26 Mar 2010 09:45:44 +0000 Subject: [PATCH] - renamed signal names - receiver commands: packet request : sets fill pointer to next packet from queue packet free : removes packet from queue - added pkt_done flag (TX idle) - transmitter commands: packet alloc : request ram for packet packet commit : sends packet 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@830 cc03376c-175c-47c8-b038-4cd826a8556b --- lib/emac/src/emac_top_jb.vhd | 23 +++-- lib/emac/src/emac_types.vhd | 15 +-- lib/emac/src/tb_emac_top_jb.vhd | 178 +++++++++++++++++++++++++------- 3 files changed, 165 insertions(+), 51 deletions(-) diff --git a/lib/emac/src/emac_top_jb.vhd b/lib/emac/src/emac_top_jb.vhd index 9e53b3b..ce8e308 100644 --- a/lib/emac/src/emac_top_jb.vhd +++ b/lib/emac/src/emac_top_jb.vhd @@ -74,8 +74,10 @@ registers_write: begin if rising_edge(CLK_I) then tx_din_vld <= '0'; - tx_ctrl_in.tx_req_en <= '0'; - rx_ctrl_in.uncommit <= '0'; + tx_ctrl_in.pkt_alloc_en <= '0'; + tx_ctrl_in.pkt_commit_en <= '0'; + rx_ctrl_in.pkt_free_en <= '0'; + rx_ctrl_in.pkt_req_en <= '0'; if RST_I = '1' then rx_int_en <= '0'; tx_int_en <= '0'; @@ -86,8 +88,10 @@ registers_write: when "0000" => tx_ctrl_in.tx_er <= DAT_I(31); - tx_ctrl_in.tx_req_en <= DAT_I(17); - rx_ctrl_in.uncommit <= DAT_I(16); + tx_ctrl_in.pkt_alloc_en <= DAT_I(25); + tx_ctrl_in.pkt_commit_en <= DAT_I(24); + rx_ctrl_in.pkt_free_en <= DAT_I(17); + rx_ctrl_in.pkt_req_en <= DAT_I(16); tx_int_en <= DAT_I(5); rx_int_en <= DAT_I(4); @@ -108,7 +112,7 @@ registers_read: process(CLK_I) begin if rising_edge(CLK_I) then - rx_ctrl_in.data_read <= '0'; + rx_ctrl_in.pkt_read_en <= '0'; ACK_O <= rx_dout_vld and CYC_I and not WE_I; DAT_O <= rx_dout; if (STB_I and CYC_I) = '1' and WE_I = '0' then @@ -121,9 +125,10 @@ registers_read: DAT_O(30) <= mii_rx_er; DAT_O(29) <= mii_col; DAT_O(28) <= mii_crs; - DAT_O(18) <= rx_ctrl_out.ram_ovf; - DAT_O(17) <= tx_ctrl_out.tx_req; - DAT_O(16) <= rx_ctrl_out.rx_vld; + DAT_O(25) <= tx_ctrl_out.pkt_alloc_req; + DAT_O(24) <= tx_ctrl_out.pkt_done; + DAT_O(23) <= rx_ctrl_out.pkt_lost; + DAT_O(16) <= rx_ctrl_out.pkt_avail; DAT_O(5) <= tx_int_en; DAT_O(4) <= rx_int_en; when "0001" => @@ -131,7 +136,7 @@ registers_read: DAT_O <= tx_ctrl_out.tx_size & rx_ctrl_out.rx_size; when "0010" => - rx_ctrl_in.data_read <= '1'; + rx_ctrl_in.pkt_read_en <= '1'; when others => null; end case; diff --git a/lib/emac/src/emac_types.vhd b/lib/emac/src/emac_types.vhd index 9a28e6d..33e1c53 100644 --- a/lib/emac/src/emac_types.vhd +++ b/lib/emac/src/emac_types.vhd @@ -17,23 +17,26 @@ package emac_types is type tx_ctrl_in_t is record tx_er : std_logic; tx_size : unsigned(15 downto 0); - tx_req_en : std_logic; + pkt_commit_en : std_logic; + pkt_alloc_en : std_logic; end record; type tx_ctrl_out_t is record tx_size : unsigned(15 downto 0); - tx_req : std_logic; + pkt_done : std_logic; + pkt_alloc_req : std_logic; end record; type rx_ctrl_in_t is record - data_read : std_logic; - uncommit : std_logic; + pkt_read_en : std_logic; + pkt_req_en : std_logic; + pkt_free_en : std_logic; end record; type rx_ctrl_out_t is record rx_er : std_logic; - rx_vld : std_logic; - ram_ovf : std_logic; + pkt_avail : std_logic; + pkt_lost : std_logic; rx_size : unsigned(15 downto 0); end record; diff --git a/lib/emac/src/tb_emac_top_jb.vhd b/lib/emac/src/tb_emac_top_jb.vhd index 33aed55..39fd0e5 100644 --- a/lib/emac/src/tb_emac_top_jb.vhd +++ b/lib/emac/src/tb_emac_top_jb.vhd @@ -178,7 +178,7 @@ STIMULUS: process -- set alloc request CYC_I <= '1'; wait until rising_edge(CLK) and SRDY_O = '1'; - DAT_I <= X"0002_0000"; + DAT_I <= X"0200_0000"; STB_I <= '1'; WE_I <= '1'; ADDR_I <= X"0000_0000"; @@ -199,7 +199,7 @@ STIMULUS: process STB_I <= '0'; wait until rising_edge(CLK) and ACK_O = '1'; wait until rising_edge(CLK); - if DAT_O_reg(17) = '0' then + if DAT_O_reg(25) = '0' then exit check_bsy; end if; end loop; @@ -280,6 +280,16 @@ STIMULUS: process wait until rising_edge(CLK) and ACK_O = '1'; wait until rising_edge(CLK); + -- set packet request + CYC_I <= '1'; + wait until rising_edge(CLK) and SRDY_O = '1'; + DAT_I <= X"0001_0000"; + STB_I <= '1'; + WE_I <= '1'; + ADDR_I <= X"0000_0000"; + wait until rising_edge(CLK) and SRDY_O = '1'; + STB_I <= '0'; + WE_I <= '0'; emac_action <= emac_read; -- Read RX data @@ -321,7 +331,7 @@ STIMULUS: process -- set free request CYC_I <= '1'; wait until rising_edge(CLK) and SRDY_O = '1'; - DAT_I <= X"0001_0000"; + DAT_I <= X"0002_0000"; STB_I <= '1'; WE_I <= '1'; ADDR_I <= X"0000_0000"; @@ -341,78 +351,174 @@ STIMULUS: process loop_back_en <= '1'; - emac_alloc (1536); - emac_write (1536); - emac_read (0); - emac_free; + emac_alloc (72); + emac_write (72); - emac_alloc (1536); - emac_write (1536); + emac_alloc (104); + emac_write (104); + emac_read (0); emac_free; - emac_alloc (1536); - emac_write (1536); emac_read (0); emac_free; - emac_alloc (1536); - emac_write (1536); + emac_alloc (104); + emac_write (104); + emac_read (0); emac_free; - emac_alloc (1536); - emac_write (1536); + emac_alloc (72); + emac_write (72); + emac_read (0); emac_free; - emac_alloc (1536); - emac_write (1536); + emac_alloc (82); + emac_write (82); + + emac_alloc (82); + emac_write (82); + emac_read (0); emac_free; - emac_alloc (1536); - emac_write (1536); emac_read (0); emac_free; - emac_alloc (64); - emac_write (64); + emac_alloc (72); + emac_write (72); + + emac_alloc (104); + emac_write (104); + + emac_alloc (82); + emac_write (82); + + emac_alloc (72); + emac_write (72); + emac_read (0); emac_free; - emac_alloc (512); - emac_write (512); + emac_alloc (104); + emac_write (104); + emac_read (0); emac_free; - emac_alloc (1536); - emac_write (1536); + emac_alloc (72); + emac_write (72); + + emac_alloc (104); + emac_write (104); + + emac_alloc (82); + emac_write (82); + emac_read (0); emac_free; - emac_alloc (65); - emac_write (65); + emac_alloc (72); + emac_write (72); + + emac_alloc (104); + emac_write (104); + emac_read (0); emac_free; - emac_alloc (66); - emac_write (66); emac_read (0); emac_free; - emac_alloc (67); - emac_write (67); emac_read (0); emac_free; - emac_alloc (512); - emac_write (64); - - emac_alloc (128); - emac_write (128); emac_read (0); emac_free; + + emac_read (0); + emac_free; + + emac_read (0); + emac_free; + + emac_read (0); + emac_free; + +-- emac_alloc (1536); +-- emac_write (1536); +-- emac_read (0); +-- emac_free; +-- +-- emac_alloc (1536); +-- emac_write (1536); +-- emac_read (0); +-- emac_free; +-- +-- emac_alloc (1536); +-- emac_write (1536); +-- emac_read (0); +-- emac_free; +-- +-- emac_alloc (1536); +-- emac_write (1536); +-- emac_read (0); +-- emac_free; +-- +-- emac_alloc (1536); +-- emac_write (1536); +-- emac_read (0); +-- emac_free; +-- +-- emac_alloc (1536); +-- emac_write (1536); +-- emac_read (0); +-- emac_free; +-- +-- emac_alloc (1536); +-- emac_write (1536); +-- emac_read (0); +-- emac_free; +-- +-- emac_alloc (64); +-- emac_write (64); +-- emac_read (0); +-- emac_free; +-- +-- emac_alloc (512); +-- emac_write (512); +-- emac_read (0); +-- emac_free; +-- +-- emac_alloc (1536); +-- emac_write (1536); +-- emac_read (0); +-- emac_free; +-- +-- emac_alloc (65); +-- emac_write (65); +-- emac_read (0); +-- emac_free; +-- +-- emac_alloc (66); +-- emac_write (66); +-- emac_read (0); +-- emac_free; +-- +-- emac_alloc (67); +-- emac_write (67); +-- emac_read (0); +-- emac_free; +-- +-- emac_alloc (512); +-- emac_write (64); +-- +-- emac_alloc (128); +-- emac_write (128); +-- emac_read (0); +-- emac_free; wait;