diff --git a/libraries/io/eth/tb/vhdl/tb_eth_tester_pkg.vhd b/libraries/io/eth/tb/vhdl/tb_eth_tester_pkg.vhd index 2f443c90cc2964521e3422a6f6a9fc335a58edfb..9944c99cc36839ec843daa0ece9a3b2d1ca04c9b 100644 --- a/libraries/io/eth/tb/vhdl/tb_eth_tester_pkg.vhd +++ b/libraries/io/eth/tb/vhdl/tb_eth_tester_pkg.vhd @@ -31,6 +31,7 @@ USE common_lib.common_pkg.ALL; USE common_lib.common_mem_pkg.ALL; USE common_lib.common_field_pkg.ALL; USE common_lib.common_network_layers_pkg.ALL; +USE work.eth_tester_pkg.ALL; PACKAGE tb_eth_tester_pkg is @@ -42,6 +43,9 @@ PACKAGE tb_eth_tester_pkg is FUNCTION func_eth_tester_gn_index_to_mac_15_0(gn_index : NATURAL) RETURN STD_LOGIC_VECTOR; FUNCTION func_eth_tester_gn_index_to_ip_15_0(gn_index : NATURAL) RETURN STD_LOGIC_VECTOR; + -- Ethernet packet length in octets inclduing eth header and CRC + FUNCTION func_eth_tester_eth_packet_length(block_len : NATURAL) RETURN NATURAL; + END tb_eth_tester_pkg; @@ -63,5 +67,14 @@ PACKAGE BODY tb_eth_tester_pkg IS RETURN c_ip_15_0; END func_eth_tester_gn_index_to_ip_15_0; + FUNCTION func_eth_tester_eth_packet_length(block_len : NATURAL) RETURN NATURAL IS + CONSTANT c_app_len : NATURAL := c_eth_tester_app_hdr_len + block_len; + CONSTANT c_udp_len : NATURAL := c_network_udp_header_len + c_app_len; + CONSTANT c_ip_len : NATURAL := c_network_ip_header_len + c_udp_len; + CONSTANT c_eth_len : NATURAL := c_network_eth_header_len + c_ip_len + c_network_eth_crc_len; + BEGIN + RETURN c_eth_len; + END func_eth_tester_eth_packet_length; + END tb_eth_tester_pkg;