From 7c6a19b078c7b2afc957a454c2d654f0bb1c7398 Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Thu, 25 Mar 2010 21:11:37 +0000 Subject: [PATCH] - added data read counter 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@825 cc03376c-175c-47c8-b038-4cd826a8556b --- lib/emac/src/tb_emac_top_jb.vhd | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/emac/src/tb_emac_top_jb.vhd b/lib/emac/src/tb_emac_top_jb.vhd index c60ebed..33aed55 100644 --- a/lib/emac/src/tb_emac_top_jb.vhd +++ b/lib/emac/src/tb_emac_top_jb.vhd @@ -68,6 +68,10 @@ ARCHITECTURE behavior OF tb_emac_top_jb IS signal loop_back_en : std_logic := '0'; + signal dat_o_cnt_en : std_logic := '0'; + signal dat_o_cnt_rst : std_logic := '1'; + signal dat_o_cnt : natural; + type emac_action_t is (emac_idle, emac_alloc, emac_wait_alloc, emac_write, emac_wait_data, emac_read, emac_free); signal emac_action : emac_action_t; @@ -135,6 +139,17 @@ DAT_O_register: end if; end process; +DAT_O_count_register: + process(CLK) + begin + if rising_edge(CLK) then + if dat_o_cnt_rst = '1' then + dat_o_cnt <= 0; + elsif ACK_O = '1' and dat_o_cnt_en = '1' then + dat_o_cnt <= dat_o_cnt + 1; + end if; + end if; + end process; mii_rx <= mii_tx when loop_back_en = '1' else (others => 'Z'); mii_rx_dv <= mii_tx_en when loop_back_en = '1' else '0'; @@ -254,6 +269,7 @@ STIMULUS: process end loop; read_size: + dat_o_cnt_rst <= '1'; CYC_I <= '1'; wait until rising_edge(CLK) and SRDY_O = '1'; WE_I <= '0'; @@ -278,6 +294,8 @@ STIMULUS: process num_words := size/4 + 1; end if; + dat_o_cnt_rst <= '0'; + dat_o_cnt_en <= '1'; CYC_I <= '1'; wait until rising_edge(CLK) and SRDY_O = '1'; data := X"00"; @@ -288,7 +306,8 @@ STIMULUS: process wait until rising_edge(CLK) and SRDY_O = '1'; end loop; STB_I <= '0'; - wait until rising_edge(CLK) and SRDY_O = '1'; + wait until rising_edge(CLK) and dat_o_cnt = num_words; + dat_o_cnt_en <= '0'; emac_action <= emac_idle; end procedure emac_read;