- added packet generator

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@834 cc03376c-175c-47c8-b038-4cd826a8556b
This commit is contained in:
2010-03-28 08:29:04 +00:00
parent aede06ea9e
commit 6118008f77
+47 -76
View File
@@ -67,10 +67,16 @@ ARCHITECTURE behavior OF tb_emac_top_jb IS
signal mii_gtx_clk : std_logic;
signal loop_back_en : std_logic := '0';
signal pktgen_tx : unsigned(7 downto 0);
signal pktgen_tx_en : std_logic;
signal pktgen_tx_er : std_logic;
signal pktgen_rst : std_logic := '1';
signal dat_o_cnt_en : std_logic := '0';
signal dat_o_cnt_rst : std_logic := '1';
signal dat_o_cnt : natural;
signal pkt_count : 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;
@@ -113,6 +119,28 @@ inst_emac_top_jb : entity work.emac_top_jb
);
inst_pkt_gen : entity work.pkt_gen
GENERIC MAP
(
f_sysclk => 100.0,
PKT_DLY_MIN => 1.0E-6,
PKT_DLY_MAX => 10.0E-6,
PKT_SIZE_MIN => 64,
PKT_SIZE_MAX => 512
)
PORT MAP
(
clk => CLK,
rst => pktgen_rst,
mii_tx_clk => mii_tx_clk_board,
mii_tx_en => pktgen_tx_en,
mii_tx_er => pktgen_tx_er,
mii_tx => pktgen_tx
);
CLK_GEN: process
begin
wait for CLK_PERIOD/2;
@@ -151,9 +179,9 @@ DAT_O_count_register:
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';
mii_rx_er <= mii_tx_er when loop_back_en = '1' else '0';
mii_rx <= mii_tx when loop_back_en = '1' else pktgen_tx;
mii_rx_dv <= mii_tx_en when loop_back_en = '1' else pktgen_tx_en;
mii_rx_er <= mii_tx_er when loop_back_en = '1' else pktgen_tx_er;
mii_crs <= '0';
mii_col <= '0';
@@ -447,79 +475,22 @@ STIMULUS: process
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 for 6000*CLK_PERIOD;
loop_back_en <= '0';
pktgen_rst <= '0';
pkt_count <= 0;
for i in 1 to 100 loop
wait for 100000*CLK_PERIOD;
emac_read (0);
emac_free;
pkt_count <= pkt_count + 1;
end loop;
pktgen_rst <= '1';
emac_read (0);
emac_free;
wait;
end process;