Skip to content
Snippets Groups Projects
Commit 998c5f5f authored by Eric Kooistra's avatar Eric Kooistra
Browse files

Add t_sdp_tbuf_cep_header_arr.

parent 7ba3b673
No related branches found
No related tags found
1 merge request!450Resolve L2SDP-1106
...@@ -39,7 +39,9 @@ library IEEE, common_lib, dp_lib; ...@@ -39,7 +39,9 @@ library IEEE, common_lib, dp_lib;
package tb_sdp_tbuf_pkg is package tb_sdp_tbuf_pkg is
type t_sdp_tbuf_strobe_total_counts_ro_arr is array (integer range <>) of t_sdp_tbuf_strobe_total_counts_ro; type t_sdp_tbuf_strobe_total_counts_ro_arr is array (integer range <>) of t_sdp_tbuf_strobe_total_counts_ro;
function func_expected_tbuf_strobe_total_counts_arr(nof_packets_per_rn, nof_rn, direction : natural) type t_sdp_tbuf_cep_header_arr is array (integer range <>) of t_sdp_tbuf_cep_header;
function func_sdp_tbuf_expected_strobe_total_counts_arr(nof_packets_per_rn, nof_rn, direction : natural)
return t_sdp_tbuf_strobe_total_counts_ro_arr; return t_sdp_tbuf_strobe_total_counts_ro_arr;
function func_sdp_tbuf_calculate_dump_inter_packet_gap(rs_block_size : natural; link_bps : real) return natural; function func_sdp_tbuf_calculate_dump_inter_packet_gap(rs_block_size : natural; link_bps : real) return natural;
...@@ -56,17 +58,25 @@ package tb_sdp_tbuf_pkg is ...@@ -56,17 +58,25 @@ package tb_sdp_tbuf_pkg is
ip_header_checksum : natural; ip_header_checksum : natural;
sdp_info : t_sdp_info; -- app header sdp_info : t_sdp_info; -- app header
gn_index : natural; gn_index : natural;
sample_width : natural;
antenna_input_index : natural; antenna_input_index : natural;
nof_raw_data_per_packet : natural; nof_raw_data_per_packet : natural;
dp_rsn : natural) return t_sdp_tbuf_cep_header; dp_rsn : natural) return t_sdp_tbuf_cep_header;
function func_sdp_tbuf_compose_cep_header_arr(nof_rn : natural;
nof_ai : natural;
nof_packets_per_ai : natural;
ai_indices : t_nat_integer_arr(c_sdp_A_pn - 1 downto 0);
first_gn : natural;
start_rsn : natural;
ip_src_addr : std_logic_vector;
sdp_info : t_sdp_info;
nof_raw_data_per_packet : natural) return t_sdp_tbuf_cep_header_arr;
function func_sdp_tbuf_verify_cep_header(in_hdr : t_sdp_tbuf_cep_header; function func_sdp_tbuf_verify_cep_header(in_hdr : t_sdp_tbuf_cep_header;
exp_hdr : t_sdp_tbuf_cep_header) return boolean; exp_hdr : t_sdp_tbuf_cep_header) return boolean;
end package tb_sdp_tbuf_pkg; end package tb_sdp_tbuf_pkg;
package body tb_sdp_tbuf_pkg is package body tb_sdp_tbuf_pkg is
function func_expected_tbuf_strobe_total_counts_arr(nof_packets_per_rn, nof_rn, direction : natural) function func_sdp_tbuf_expected_strobe_total_counts_arr(nof_packets_per_rn, nof_rn, direction : natural)
return t_sdp_tbuf_strobe_total_counts_ro_arr is return t_sdp_tbuf_strobe_total_counts_ro_arr is
-- Purpose: Determine expected tbuf_strobe_total_counts per ring node (RN) -- Purpose: Determine expected tbuf_strobe_total_counts per ring node (RN)
-- Description: -- Description:
...@@ -103,7 +113,7 @@ package body tb_sdp_tbuf_pkg is ...@@ -103,7 +113,7 @@ package body tb_sdp_tbuf_pkg is
v_arr(RN).output_nof_packets := sel_a_b(RN = c_last_rn, nof_packets_per_rn * nof_rn, 0); v_arr(RN).output_nof_packets := sel_a_b(RN = c_last_rn, nof_packets_per_rn * nof_rn, 0);
end loop; end loop;
return v_arr; return v_arr;
end func_expected_tbuf_strobe_total_counts_arr; end func_sdp_tbuf_expected_strobe_total_counts_arr;
function func_sdp_tbuf_calculate_dump_inter_packet_gap(rs_block_size : natural; link_bps : real) return natural is function func_sdp_tbuf_calculate_dump_inter_packet_gap(rs_block_size : natural; link_bps : real) return natural is
-- Purpose: Use interpacket gap to set link data rate link_bps of the transient dump. -- Purpose: Use interpacket gap to set link data rate link_bps of the transient dump.
...@@ -209,7 +219,6 @@ package body tb_sdp_tbuf_pkg is ...@@ -209,7 +219,6 @@ package body tb_sdp_tbuf_pkg is
ip_header_checksum : natural; ip_header_checksum : natural;
sdp_info : t_sdp_info; -- app header sdp_info : t_sdp_info; -- app header
gn_index : natural; gn_index : natural;
sample_width : natural;
antenna_input_index : natural; antenna_input_index : natural;
nof_raw_data_per_packet : natural; nof_raw_data_per_packet : natural;
dp_rsn : natural) return t_sdp_tbuf_cep_header is dp_rsn : natural) return t_sdp_tbuf_cep_header is
...@@ -256,7 +265,7 @@ package body tb_sdp_tbuf_pkg is ...@@ -256,7 +265,7 @@ package body tb_sdp_tbuf_pkg is
v_hdr.app.sdp_source_info_antenna_band_id := slv(sdp_info.antenna_band_index); v_hdr.app.sdp_source_info_antenna_band_id := slv(sdp_info.antenna_band_index);
v_hdr.app.sdp_source_info_nyquist_zone_id := sdp_info.nyquist_zone_index; v_hdr.app.sdp_source_info_nyquist_zone_id := sdp_info.nyquist_zone_index;
v_hdr.app.sdp_source_info_f_adc := slv(sdp_info.f_adc); v_hdr.app.sdp_source_info_f_adc := slv(sdp_info.f_adc);
v_hdr.app.sdp_source_info_sample_width := TO_UVEC(sample_width, 4); v_hdr.app.sdp_source_info_sample_width := TO_UVEC(c_sdp_W_adc, 4);
v_hdr.app.sdp_source_info_gn_id := TO_UVEC(gn_index, 8); v_hdr.app.sdp_source_info_gn_id := TO_UVEC(gn_index, 8);
v_hdr.app.sdp_reserved := TO_UVEC(0, 24); v_hdr.app.sdp_reserved := TO_UVEC(0, 24);
...@@ -267,6 +276,50 @@ package body tb_sdp_tbuf_pkg is ...@@ -267,6 +276,50 @@ package body tb_sdp_tbuf_pkg is
return v_hdr; return v_hdr;
end func_sdp_tbuf_compose_cep_header; end func_sdp_tbuf_compose_cep_header;
function func_sdp_tbuf_compose_cep_header_arr(nof_rn : natural;
nof_ai : natural;
nof_packets_per_ai : natural;
ai_indices : t_nat_integer_arr(c_sdp_A_pn - 1 downto 0);
first_gn : natural;
start_rsn : natural;
ip_src_addr : std_logic_vector;
sdp_info : t_sdp_info;
nof_raw_data_per_packet : natural) return t_sdp_tbuf_cep_header_arr is
-- Purpose:
-- Determine expected sdp_tbuf_cep_header per antenna input in ai_indices and per ring node (RN) in range(nof_rn).
-- Description:
-- . Do not verify the ip_header_checksum, because it depends on src IP, and therefore on last GN, and on IP size
-- and therefore on g_rs_block_size.
-- Return:
-- v_arr[c_nof_headers] = v_arr[nof_rn][nof_ai][nof_packets_per_ai]
constant c_nof_headers : natural := nof_rn * nof_ai * nof_packets_per_ai;
variable v_arr : t_sdp_tbuf_cep_header_arr(0 to c_nof_headers - 1);
variable v_rn : natural;
variable v_H : natural; -- header index
variable v_gn : natural;
variable v_global_ai : natural;
variable v_rsn : natural;
begin
for RN in 0 to nof_rn - 1 loop
v_gn := first_gn + RN;
for AI in 0 to nof_ai - 1 loop
v_global_ai := v_gn * c_sdp_A_pn + ai_indices(AI);
for P in 0 to nof_packets_per_ai - 1 loop
v_rsn := start_rsn + P * nof_raw_data_per_packet;
v_H := (RN * nof_ai + AI) * nof_packets_per_ai + P;
v_arr(v_H) := func_sdp_tbuf_compose_cep_header(ip_src_addr,
0, -- do not verify ip_header_checksum
sdp_info,
v_gn,
v_global_ai,
nof_raw_data_per_packet,
v_rsn);
end loop;
end loop;
end loop;
return v_arr;
end func_sdp_tbuf_compose_cep_header_arr;
function func_sdp_tbuf_verify_cep_header(in_hdr : t_sdp_tbuf_cep_header; function func_sdp_tbuf_verify_cep_header(in_hdr : t_sdp_tbuf_cep_header;
exp_hdr : t_sdp_tbuf_cep_header) return boolean is exp_hdr : t_sdp_tbuf_cep_header) return boolean is
begin begin
...@@ -309,9 +362,11 @@ package body tb_sdp_tbuf_pkg is ...@@ -309,9 +362,11 @@ package body tb_sdp_tbuf_pkg is
assert in_hdr.ip.protocol = exp_hdr.ip.protocol assert in_hdr.ip.protocol = exp_hdr.ip.protocol
report "Wrong transient ip.protocol" report "Wrong transient ip.protocol"
severity ERROR; severity ERROR;
if to_uint(exp_hdr.ip.header_checksum) > 0 then
assert in_hdr.ip.header_checksum = exp_hdr.ip.header_checksum assert in_hdr.ip.header_checksum = exp_hdr.ip.header_checksum
report "Wrong transient ip.header_checksum" report "Wrong transient ip.header_checksum"
severity ERROR; severity ERROR;
end if;
assert in_hdr.ip.src_ip_addr = exp_hdr.ip.src_ip_addr assert in_hdr.ip.src_ip_addr = exp_hdr.ip.src_ip_addr
report "Wrong transient ip.src_ip_addr" report "Wrong transient ip.src_ip_addr"
severity ERROR; severity ERROR;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment