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

Verify XST g_crosslet_direction.

parent 6e6453b2
No related branches found
No related tags found
1 merge request!175Added t_sdp_sim. Add func_sdp_get_stat_*() functions to determine the header...
......@@ -20,7 +20,7 @@
-------------------------------------------------------------------------------
--
-- Author: P. Donker
-- Author: P. Donker, E. Kooistra
-- Purpose:
-- . test bench for sdp_statistics_offload.vhd
......@@ -29,8 +29,10 @@
-- https://support.astron.nl/confluence/display/L2M/L5+SDPFW+Design+Document%3A+Subband+filterbank
-- . See figure 4.8
--
-- Remark:
-- .
-- Usage:
-- > as 8
-- > run -a
-- e.g. view test_offload_sosi and the rx_sdp_stat_header.app fields
-------------------------------------------------------------------------------
LIBRARY IEEE, common_lib, dp_lib, ring_lib;
......@@ -50,15 +52,18 @@ USE work.tb_sdp_pkg.ALL;
ENTITY tb_sdp_statistics_offload IS
GENERIC (
g_statistics_type : STRING := "XST";
-- All
g_statistics_type : STRING := "SST";
g_offload_time : NATURAL := 50;
g_beamset_id : NATURAL := 1; -- < c_sdp_N_beamsets
g_gn_index : NATURAL := 5; -- global node (GN) index, must be in range(O_rn, O_rn + N_rn), use > 0 to see effect of g_offload_time
-- BST
g_beamset_id : NATURAL := 1; -- < c_sdp_N_beamsets
-- XST
g_O_rn : NATURAL := 4; -- GN index of first ring node (RN)
g_N_rn : NATURAL := 8; -- <= c_sdp_N_rn_max = 16, number of nodes in ring
g_P_sq : NATURAL := 9; -- <= c_sdp_P_sq
g_P_sq : NATURAL := 1; -- <= c_sdp_P_sq
g_nof_crosslets : NATURAL := 1; -- <= c_sdp_N_crosslets_max
g_crosslets_direction : INTEGER := 1 -- +1 or -1
g_crosslets_direction : NATURAL := 1 -- > 0 for crosslet transport in positive direction (incrementing RN), else 0 for negative direction
);
END tb_sdp_statistics_offload;
......@@ -90,7 +95,7 @@ ARCHITECTURE tb OF tb_sdp_statistics_offload IS
CONSTANT c_beamlet_index : NATURAL := g_beamset_id * c_sdp_S_sub_bf;
CONSTANT c_crosslets_info_rec : t_sdp_crosslets_info := (offset_arr => (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15), step => 16);
CONSTANT c_crosslets_info_slv : STD_LOGIC_VECTOR(c_sdp_crosslets_info_reg_w-1 DOWNTO 0) := func_construct_crosslets_info(c_crosslets_info_rec);
CONSTANT c_crosslets_info_slv : STD_LOGIC_VECTOR(c_sdp_crosslets_info_reg_w-1 DOWNTO 0) := func_sdp_map_crosslets_info(c_crosslets_info_rec);
-- payload data
CONSTANT c_data_size : NATURAL := c_sdp_W_statistic_sz;
......@@ -107,7 +112,7 @@ ARCHITECTURE tb OF tb_sdp_statistics_offload IS
CONSTANT c_nof_block_per_sync : NATURAL := 3 + ceil_div(c_offload_time, c_nof_data) + c_nof_packets_max; -- Sufficient to fit more than c_nof_packets_max offload packets per sync interval.
CONSTANT c_nof_clk_per_block : NATURAL := c_nof_data * c_data_size;
CONSTANT c_nof_valid_per_block : NATURAL := c_nof_data * c_data_size;
CONSTANT c_nof_sync : NATURAL := 5;
CONSTANT c_nof_sync : NATURAL := 3;
CONSTANT c_nof_clk_per_sync : NATURAL := c_nof_block_per_sync * c_nof_clk_per_block;
SIGNAL tb_end : STD_LOGIC := '0';
......@@ -130,30 +135,32 @@ ARCHITECTURE tb OF tb_sdp_statistics_offload IS
SIGNAL offload_rx_hdr_dat_mosi : t_mem_mosi := c_mem_mosi_rst;
SIGNAL offload_rx_hdr_dat_miso : t_mem_miso;
SIGNAL in_sosi : t_dp_sosi := c_dp_sosi_rst;
SIGNAL in_sosi : t_dp_sosi := c_dp_sosi_rst;
SIGNAL in_crosslets_info_rec : t_sdp_crosslets_info;
SIGNAL in_crosslets_info_slv : STD_LOGIC_VECTOR(c_sdp_crosslets_info_reg_w-1 DOWNTO 0);
SIGNAL offload_data : STD_LOGIC_VECTOR(31 DOWNTO 0);
SIGNAL offload_sosi : t_dp_sosi;
SIGNAL offload_siso : t_dp_siso := c_dp_siso_rst;
SIGNAL offload_data : STD_LOGIC_VECTOR(31 DOWNTO 0);
SIGNAL offload_sosi : t_dp_sosi;
SIGNAL offload_siso : t_dp_siso := c_dp_siso_rst;
SIGNAL test_offload_sosi : t_dp_sosi := c_dp_sosi_rst;
SIGNAL test_offload_en : STD_LOGIC := '0';
SIGNAL test_offload_sop_cnt : NATURAL;
SIGNAL test_offload_eop_cnt : NATURAL;
SIGNAL test_offload_sosi : t_dp_sosi := c_dp_sosi_rst;
SIGNAL test_offload_en : STD_LOGIC := '0';
SIGNAL test_offload_sop_cnt : NATURAL;
SIGNAL test_offload_eop_cnt : NATURAL;
SIGNAL rx_hdr_fields_out : STD_LOGIC_VECTOR(1023 DOWNTO 0);
SIGNAL rx_hdr_fields_raw : STD_LOGIC_VECTOR(1023 DOWNTO 0) := (OTHERS => '0');
SIGNAL rx_sdp_stat_header : t_sdp_stat_header;
SIGNAL exp_sdp_stat_header : t_sdp_stat_header;
SIGNAL rx_hdr_fields_out : STD_LOGIC_VECTOR(1023 DOWNTO 0);
SIGNAL rx_hdr_fields_raw : STD_LOGIC_VECTOR(1023 DOWNTO 0) := (OTHERS => '0');
SIGNAL rx_sdp_stat_header : t_sdp_stat_header;
SIGNAL exp_sdp_stat_header : t_sdp_stat_header;
SIGNAL exp_dp_bsn : STD_LOGIC_VECTOR(63 DOWNTO 0);
SIGNAL exp_sst_signal_input : NATURAL;
SIGNAL exp_bst_beamlet_index : NATURAL;
SIGNAL cur_X_sq_cell : NATURAL;
SIGNAL cur_crosslet : NATURAL;
SIGNAL exp_subband_index : NATURAL;
SIGNAL exp_xst_signal_input_A : NATURAL;
SIGNAL exp_xst_signal_input_B : NATURAL;
SIGNAL exp_sst_signal_input : NATURAL;
SIGNAL exp_bst_beamlet_index : NATURAL;
SIGNAL cur_X_sq_cell : NATURAL;
SIGNAL cur_crosslet : NATURAL;
SIGNAL exp_subband_index : NATURAL;
SIGNAL exp_xst_signal_input_A : NATURAL;
SIGNAL exp_xst_signal_input_B : NATURAL;
-- Signals used to change settings of sdp_info.
SIGNAL sdp_info : t_sdp_info := (
......@@ -242,6 +249,7 @@ BEGIN
proc_common_wait_some_cycles(dp_clk, 10);
in_sosi.bsn <= TO_DP_BSN(c_bsn_init);
in_sosi.valid <= '1';
in_crosslets_info_rec <= c_crosslets_info_rec;
WHILE TRUE LOOP
FOR i IN 0 TO c_nof_block_per_sync-1 LOOP
FOR j IN 0 TO c_nof_clk_per_block-1 LOOP
......@@ -251,6 +259,10 @@ BEGIN
IF i = 0 AND j = 0 THEN
in_sosi.sync <= '1';
END IF;
IF i = 0 AND j = 1 THEN
-- Increment crosslets_info offsets for next sync interval
in_crosslets_info_rec <= func_sdp_step_crosslets_info(in_crosslets_info_rec, g_nof_crosslets);
END IF;
IF j = 0 THEN
in_sosi.sop <= '1';
in_sosi.bsn <= INCR_UVEC(in_sosi.bsn, 1);
......@@ -265,12 +277,13 @@ BEGIN
WAIT;
END PROCESS;
in_crosslets_info_slv <= func_sdp_map_crosslets_info(in_crosslets_info_rec, g_nof_crosslets);
-- Enable the statistics offload when input is running
p_enable_trigger : PROCESS
BEGIN
proc_common_wait_until_high(mm_clk, init_ram_done);
proc_common_wait_until_high(dp_clk, in_sosi.sync);
-- Enable common variabel delay.
-- Enable common variable delay.
proc_mem_mm_bus_wr(c_reg_enable_mm_addr_enable, 1, mm_clk, enable_miso, enable_mosi);
proc_common_wait_some_cycles(mm_clk, c_cross_clock_domain_latency);
proc_common_wait_some_cycles(dp_clk, 1);
......@@ -307,7 +320,7 @@ BEGIN
END IF;
END IF;
END PROCESS;
test_sync_cnt <= in_sync_cnt + 1; -- optionally adjust to fit test_offload_sosi
test_sync_cnt <= in_sync_cnt + 0; -- optionally adjust to fit test_offload_sosi
-- derive current X_sq correlator cell index
cur_X_sq_cell <= (test_offload_eop_cnt / g_nof_crosslets) MOD g_P_sq;
......@@ -402,7 +415,7 @@ BEGIN
exp_sdp_stat_header.app.dp_bsn <= exp_dp_bsn;
END PROCESS;
rx_sdp_stat_header <= func_sdp_extract_stat_header(rx_hdr_fields_raw);
rx_sdp_stat_header <= func_sdp_map_stat_header(rx_hdr_fields_raw);
p_verify_header : PROCESS(test_offload_sosi)
VARIABLE v_bool : BOOLEAN;
......@@ -519,10 +532,11 @@ BEGIN
-- SDP info
u_dut: ENTITY work.sdp_statistics_offload
GENERIC MAP (
g_statistics_type => g_statistics_type,
g_offload_time => g_offload_time,
g_beamset_id => g_beamset_id,
g_P_sq => g_P_sq
g_statistics_type => g_statistics_type,
g_offload_time => g_offload_time,
g_beamset_id => g_beamset_id,
g_P_sq => g_P_sq,
g_crosslets_direction => g_crosslets_direction
)
PORT MAP (
mm_clk => mm_clk,
......@@ -556,11 +570,11 @@ BEGIN
sdp_info => sdp_info,
subband_calibrated_flag => subband_calibrated_flag,
nof_crosslets => nof_crosslets,
crosslets_info => c_crosslets_info_slv
crosslets_info => in_crosslets_info_slv
);
-- Check crosslet_info functions
ASSERT c_crosslets_info_rec = func_extract_crosslets_info(c_crosslets_info_slv) REPORT "Error in func_extract_crosslets_info() or func_construct_crosslets_info()" SEVERITY FAILURE;
ASSERT c_crosslets_info_rec = func_sdp_map_crosslets_info(c_crosslets_info_slv) REPORT "Error in func_sdp_map_crosslets_info()" SEVERITY FAILURE;
-- To view the 32 bit 1GbE offload data more easily in the Wave window
offload_data <= offload_sosi.data(31 DOWNTO 0);
......
......@@ -19,7 +19,7 @@
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-- Author : R vd Walle
-- Author : R vd Walle, E. Kooistra
-- Purpose: Verify multiple variations of tb_sdp_statistics_offload
-- Description:
-- Usage:
......@@ -37,22 +37,27 @@ ARCHITECTURE tb OF tb_tb_sdp_statistics_offload IS
SIGNAL tb_end : STD_LOGIC := '0'; -- declare tb_end to avoid 'No objects found' error on 'when -label tb_end'
BEGIN
-- -- All
-- g_statistics_type : STRING := "SST";
-- g_offload_time : NATURAL := 500;
-- g_beamset_id : NATURAL := 0;
-- g_gn_index : NATURAL := 1; -- global node (GN) index, use > 0 to see effect of g_offload_time
-- -- BST
-- g_beamset_id : NATURAL := 0;
-- -- XST
-- g_O_rn : NATURAL := 0; -- GN index of first ring node (RN)
-- g_N_rn : NATURAL := 16; -- <= c_sdp_N_rn_max = 16, number of nodes in ring
-- g_P_sq : NATURAL := c_sdp_P_sq
-- g_nof_crosslets : NATURAL := 1;
-- g_crosslets_direction : INTEGER := 1; -- +1 or -1
u_sst : ENTITY work.tb_sdp_statistics_offload GENERIC MAP("SST", 50);
u_bst_0 : ENTITY work.tb_sdp_statistics_offload GENERIC MAP("BST", 50, 0);
u_bst_1 : ENTITY work.tb_sdp_statistics_offload GENERIC MAP("BST", 50, 1);
u_xst_P1 : ENTITY work.tb_sdp_statistics_offload GENERIC MAP("XST", 50, 0, 1, 0, 16, 1, 1, 1);
u_xst_P1_nof3 : ENTITY work.tb_sdp_statistics_offload GENERIC MAP("XST", 50, 0, 1, 0, 16, 1, 3, 1);
u_xst_P9 : ENTITY work.tb_sdp_statistics_offload GENERIC MAP("XST", 50, 0, 1, 0, 16, 9, 1, 1);
u_xst_P9_nof3 : ENTITY work.tb_sdp_statistics_offload GENERIC MAP("XST", 50, 0, 1, 0, 16, 9, 3, 1);
u_sst : ENTITY work.tb_sdp_statistics_offload GENERIC MAP("SST", 50, 3, 0, 0);
u_bst_0 : ENTITY work.tb_sdp_statistics_offload GENERIC MAP("BST", 50, 1, 0, 0);
u_bst_1 : ENTITY work.tb_sdp_statistics_offload GENERIC MAP("BST", 50, 1, 1, 0);
u_xst_P1 : ENTITY work.tb_sdp_statistics_offload GENERIC MAP("XST", 50, 1, 0, 0, 16, 1, 1, 1);
u_xst_P1_N3 : ENTITY work.tb_sdp_statistics_offload GENERIC MAP("XST", 50, 1, 0, 0, 16, 1, 3, 1);
u_xst_P9 : ENTITY work.tb_sdp_statistics_offload GENERIC MAP("XST", 50, 1, 0, 0, 16, 9, 1, 1);
u_xst_P9_N3 : ENTITY work.tb_sdp_statistics_offload GENERIC MAP("XST", 50, 1, 0, 0, 16, 9, 3, 1);
u_xst_P9_N3_neg : ENTITY work.tb_sdp_statistics_offload GENERIC MAP("XST", 50, 1, 0, 0, 16, 9, 3, 0);
u_xst_P8_N7_RN1_15 : ENTITY work.tb_sdp_statistics_offload GENERIC MAP("XST", 50, 1, 0, 1, 15, 8, 7, 0);
END tb;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment