From c0c893b12811cc3dfd60326d91b9513eca2b9e3b Mon Sep 17 00:00:00 2001 From: Eric Kooistra <kooistra@astron.nl> Date: Thu, 27 Oct 2022 10:01:14 +0200 Subject: [PATCH] Add func_eth_tester_eth_packet_length(). --- libraries/io/eth/tb/vhdl/tb_eth_tester_pkg.vhd | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 2f443c90cc..9944c99cc3 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; -- GitLab