diff --git a/applications/lofar2/designs/lofar2_unb2b_sdp_station/revisions/lofar2_unb2b_sdp_station_fsub/tb_lofar2_unb2b_sdp_station_fsub.vhd b/applications/lofar2/designs/lofar2_unb2b_sdp_station/revisions/lofar2_unb2b_sdp_station_fsub/tb_lofar2_unb2b_sdp_station_fsub.vhd index 53cc9a3770e5bd05d2e948f615754f36a14ab735..b48c8064f8144cc4d7172729ef1bd6dd6aa82d98 100644 --- a/applications/lofar2/designs/lofar2_unb2b_sdp_station/revisions/lofar2_unb2b_sdp_station_fsub/tb_lofar2_unb2b_sdp_station_fsub.vhd +++ b/applications/lofar2/designs/lofar2_unb2b_sdp_station/revisions/lofar2_unb2b_sdp_station_fsub/tb_lofar2_unb2b_sdp_station_fsub.vhd @@ -467,7 +467,7 @@ BEGIN IF sp_subband_sst > c_eps AND v_power > c_eps THEN sp_subband_sst_crosstalk_snr_dB <= 10.0 * LOG10(sp_subband_sst / v_power); ELSIF g_read_all_SST THEN - REPORT "Wrong, zero crosstalk is unexpected for SP-" & NATURAL'IMAGE(g_sp) SEVERITY ERROR; + REPORT "Zero crosstalk for SP-" & NATURAL'IMAGE(g_sp) SEVERITY NOTE; END IF; proc_common_wait_some_cycles(tb_clk, 10); @@ -519,8 +519,8 @@ BEGIN IF g_read_all_SST THEN -- Verify expected SNR quality measures - ASSERT sp_subband_sst_leakage_snr_dB > c_exp_subband_sst_leakage_snr_dB REPORT "Wrong to much leakage for SP " & NATURAL'IMAGE(g_sp) SEVERITY ERROR; - ASSERT sp_subband_sst_crosstalk_snr_dB > c_exp_subband_sst_crosstalk_snr_dB REPORT "Wrong to much crosstalk for SP " & NATURAL'IMAGE(g_sp) SEVERITY ERROR; + ASSERT sp_subband_sst_leakage = 0.0 OR sp_subband_sst_leakage_snr_dB > c_exp_subband_sst_leakage_snr_dB REPORT "Wrong too much leakage for SP " & NATURAL'IMAGE(g_sp) SEVERITY ERROR; + ASSERT sp_subband_sst_crosstalk = 0.0 OR sp_subband_sst_crosstalk_snr_dB > c_exp_subband_sst_crosstalk_snr_dB REPORT "Wrong too much crosstalk for SP " & NATURAL'IMAGE(g_sp) SEVERITY ERROR; END IF; --------------------------------------------------------------------------- diff --git a/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_fsub/tb_lofar2_unb2c_sdp_station_fsub.vhd b/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_fsub/tb_lofar2_unb2c_sdp_station_fsub.vhd index ef550d46f766c8083a10c39f05cfa4133039c085..1896e85d9447a378aff1e97882eda23696324c4e 100644 --- a/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_fsub/tb_lofar2_unb2c_sdp_station_fsub.vhd +++ b/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_fsub/tb_lofar2_unb2c_sdp_station_fsub.vhd @@ -449,7 +449,7 @@ BEGIN IF sp_subband_sst > c_eps AND v_power > c_eps THEN sp_subband_sst_crosstalk_snr_dB <= 10.0 * LOG10(sp_subband_sst / v_power); ELSIF g_read_all_SST THEN - REPORT "Wrong, zero crosstalk is unexpected for SP-" & NATURAL'IMAGE(g_sp) SEVERITY ERROR; + REPORT "Zero crosstalk for SP-" & NATURAL'IMAGE(g_sp) SEVERITY NOTE; END IF; proc_common_wait_some_cycles(tb_clk, 10); @@ -501,8 +501,8 @@ BEGIN IF g_read_all_SST THEN -- Verify expected SNR quality measures - ASSERT sp_subband_sst_leakage_snr_dB > c_exp_subband_sst_leakage_snr_dB REPORT "Wrong to much leakage for SP " & NATURAL'IMAGE(g_sp) SEVERITY ERROR; - ASSERT sp_subband_sst_crosstalk_snr_dB > c_exp_subband_sst_crosstalk_snr_dB REPORT "Wrong to much crosstalk for SP " & NATURAL'IMAGE(g_sp) SEVERITY ERROR; + ASSERT sp_subband_sst_leakage = 0.0 OR sp_subband_sst_leakage_snr_dB > c_exp_subband_sst_leakage_snr_dB REPORT "Wrong too much leakage for SP " & NATURAL'IMAGE(g_sp) SEVERITY ERROR; + ASSERT sp_subband_sst_crosstalk = 0.0 OR sp_subband_sst_crosstalk_snr_dB > c_exp_subband_sst_crosstalk_snr_dB REPORT "Wrong too much crosstalk for SP " & NATURAL'IMAGE(g_sp) SEVERITY ERROR; END IF; --------------------------------------------------------------------------- diff --git a/libraries/base/common/tb/vhdl/tb_requantize.vhd b/libraries/base/common/tb/vhdl/tb_requantize.vhd index 9f4ca004fa7de0a4f0a9872b00cb1f77fbb09b77..f7317d92b37f830ce63a11eb50bdc40170749fc1 100644 --- a/libraries/base/common/tb/vhdl/tb_requantize.vhd +++ b/libraries/base/common/tb/vhdl/tb_requantize.vhd @@ -34,6 +34,7 @@ USE work.common_pkg.ALL; -- . c_out_dat_w = 3 -- . c_lsb_w = 2 -- . c_lsb_round_clip = TRUE +-- . c_lsb_round_even = FALSE -- . c_msb_clip_symmetric = TRUE -- . Observe reg_dat with respect to the out_s_*_*.dat and out_u_*_*.dat -- . Try also c_lsb_round_clip=FALSE @@ -55,6 +56,7 @@ ARCHITECTURE tb OF tb_requantize IS CONSTANT c_out_dat_w : NATURAL := 3; CONSTANT c_lsb_w : NATURAL := 2; CONSTANT c_lsb_round_clip : BOOLEAN := TRUE; --FALSE; + CONSTANT c_lsb_round_even : BOOLEAN := FALSE; -- golden reference data is for round half away from zero CONSTANT c_msb_clip_symmetric : BOOLEAN := TRUE; --FALSE; -- Stimuli @@ -158,6 +160,7 @@ BEGIN g_lsb_w => c_lsb_w, g_lsb_round => TRUE, g_lsb_round_clip => c_lsb_round_clip, + g_lsb_round_even => c_lsb_round_even, g_msb_clip => TRUE, g_msb_clip_symmetric => c_msb_clip_symmetric, g_pipeline_remove_lsb => g_pipeline_remove_lsb, @@ -178,6 +181,7 @@ BEGIN g_lsb_w => c_lsb_w, g_lsb_round => TRUE, g_lsb_round_clip => c_lsb_round_clip, + g_lsb_round_even => c_lsb_round_even, g_msb_clip => FALSE, g_msb_clip_symmetric => c_msb_clip_symmetric, g_pipeline_remove_lsb => g_pipeline_remove_lsb, @@ -198,6 +202,7 @@ BEGIN g_lsb_w => c_lsb_w, g_lsb_round => FALSE, g_lsb_round_clip => c_lsb_round_clip, + g_lsb_round_even => c_lsb_round_even, g_msb_clip => TRUE, g_msb_clip_symmetric => c_msb_clip_symmetric, g_pipeline_remove_lsb => g_pipeline_remove_lsb, @@ -218,6 +223,7 @@ BEGIN g_lsb_w => c_lsb_w, g_lsb_round => FALSE, g_lsb_round_clip => c_lsb_round_clip, + g_lsb_round_even => c_lsb_round_even, g_msb_clip => FALSE, g_msb_clip_symmetric => c_msb_clip_symmetric, g_pipeline_remove_lsb => g_pipeline_remove_lsb, @@ -239,6 +245,7 @@ BEGIN g_lsb_w => c_lsb_w, g_lsb_round => TRUE, g_lsb_round_clip => c_lsb_round_clip, + g_lsb_round_even => c_lsb_round_even, g_msb_clip => TRUE, g_msb_clip_symmetric => c_msb_clip_symmetric, g_pipeline_remove_lsb => g_pipeline_remove_lsb, @@ -259,6 +266,7 @@ BEGIN g_lsb_w => c_lsb_w, g_lsb_round => TRUE, g_lsb_round_clip => c_lsb_round_clip, + g_lsb_round_even => c_lsb_round_even, g_msb_clip => FALSE, g_msb_clip_symmetric => c_msb_clip_symmetric, g_pipeline_remove_lsb => g_pipeline_remove_lsb, @@ -279,6 +287,7 @@ BEGIN g_lsb_w => c_lsb_w, g_lsb_round => FALSE, g_lsb_round_clip => c_lsb_round_clip, + g_lsb_round_even => c_lsb_round_even, g_msb_clip => TRUE, g_msb_clip_symmetric => c_msb_clip_symmetric, g_pipeline_remove_lsb => g_pipeline_remove_lsb, @@ -299,6 +308,7 @@ BEGIN g_lsb_w => c_lsb_w, g_lsb_round => FALSE, g_lsb_round_clip => c_lsb_round_clip, + g_lsb_round_even => c_lsb_round_even, g_msb_clip => FALSE, g_msb_clip_symmetric => c_msb_clip_symmetric, g_pipeline_remove_lsb => g_pipeline_remove_lsb, diff --git a/libraries/dsp/filter/src/vhdl/fil_ppf_filter.vhd b/libraries/dsp/filter/src/vhdl/fil_ppf_filter.vhd index bf6077f23944998799de18e472ae629af6f8e327..564cc785908f660aeee0aef3e5e8fac077608774 100644 --- a/libraries/dsp/filter/src/vhdl/fil_ppf_filter.vhd +++ b/libraries/dsp/filter/src/vhdl/fil_ppf_filter.vhd @@ -38,7 +38,8 @@ entity fil_ppf_filter is generic ( g_technology : NATURAL := c_tech_select_default; g_fil_ppf : t_fil_ppf; - g_fil_ppf_pipeline : t_fil_ppf_pipeline + g_fil_ppf_pipeline : t_fil_ppf_pipeline; + g_round_even : boolean := true ); port ( clk : in std_logic; @@ -117,12 +118,13 @@ begin sum => adder_out ); - u_requantize_addeer_output : entity common_lib.common_requantize + u_requantize_adder_output : entity common_lib.common_requantize generic map ( g_representation => "SIGNED", g_lsb_w => c_ppf_lsb_w, g_lsb_round => TRUE, g_lsb_round_clip => FALSE, + g_lsb_round_even => g_round_even, g_msb_clip => FALSE, g_msb_clip_symmetric => FALSE, g_pipeline_remove_lsb => g_fil_ppf_pipeline.requant_remove_lsb, diff --git a/libraries/dsp/filter/src/vhdl/fil_ppf_single.vhd b/libraries/dsp/filter/src/vhdl/fil_ppf_single.vhd index 3b1b9dedbaef621133376261144cd64ba3369a49..2351c5f89688fa1c4c3e4fa6022d31a729de3362 100644 --- a/libraries/dsp/filter/src/vhdl/fil_ppf_single.vhd +++ b/libraries/dsp/filter/src/vhdl/fil_ppf_single.vhd @@ -73,7 +73,8 @@ use work.fil_pkg.ALL; entity fil_ppf_single is generic ( g_fil_ppf : t_fil_ppf := c_fil_ppf; - g_fil_ppf_pipeline : t_fil_ppf_pipeline := c_fil_ppf_pipeline; + g_fil_ppf_pipeline : t_fil_ppf_pipeline := c_fil_ppf_pipeline; + g_round_even : boolean := true; g_file_index_arr : t_nat_natural_arr := array_init(0, 128, 1); -- default use the instance index as file index 0, 1, 2, 3, 4 ... g_coefs_file_prefix : string := "hex/coef" -- Relative path to the mif files that contain the initial data for the coefficients memories ); -- The sequence number and ".mif"-extension are added within the entity. @@ -234,7 +235,8 @@ begin u_filter : entity work.fil_ppf_filter generic map ( g_fil_ppf_pipeline => g_fil_ppf_pipeline, - g_fil_ppf => g_fil_ppf + g_fil_ppf => g_fil_ppf, + g_round_even => g_round_even ) port map ( clk => dp_clk, diff --git a/libraries/dsp/filter/src/vhdl/fil_ppf_wide.vhd b/libraries/dsp/filter/src/vhdl/fil_ppf_wide.vhd index 85bdf3c3fcb3d18d31085a6a22789935a2a87a1f..9561d28a3c913925127bc2895dbda95ba4b9670a 100644 --- a/libraries/dsp/filter/src/vhdl/fil_ppf_wide.vhd +++ b/libraries/dsp/filter/src/vhdl/fil_ppf_wide.vhd @@ -121,6 +121,7 @@ entity fil_ppf_wide is g_big_endian_wb_out : boolean := false; g_fil_ppf : t_fil_ppf := c_fil_ppf; g_fil_ppf_pipeline : t_fil_ppf_pipeline := c_fil_ppf_pipeline; + g_round_even : boolean := true; g_coefs_file_prefix : string := "../../data/coef" -- Relative path to the mif files that contain the FIR the coefficients -- The sequence number and ".mif"-extension are added within the entity. ); @@ -235,6 +236,7 @@ begin generic map ( g_fil_ppf => c_fil_ppf_arr(P), g_fil_ppf_pipeline => g_fil_ppf_pipeline, + g_round_even => g_round_even, g_file_index_arr => c_file_index_arr2(P), -- use (g_fil_ppf.wb_factor-1 - P) to try impact of reversed WB FIR coefficients g_coefs_file_prefix => g_coefs_file_prefix ) diff --git a/libraries/dsp/filter/tb/vhdl/tb_fil_ppf_wide_file_data.vhd b/libraries/dsp/filter/tb/vhdl/tb_fil_ppf_wide_file_data.vhd index 103f01b59270e47ad366b88ee4c74a08102d75f9..c56ad139456fca352a11729aafb6b2b6254b18bf 100644 --- a/libraries/dsp/filter/tb/vhdl/tb_fil_ppf_wide_file_data.vhd +++ b/libraries/dsp/filter/tb/vhdl/tb_fil_ppf_wide_file_data.vhd @@ -131,6 +131,7 @@ architecture tb of tb_fil_ppf_wide_file_data is constant c_clk_period : time := 10 ns; constant c_sclk_period : time := c_clk_period / g_fil_ppf.wb_factor; + constant c_round_even : boolean := false; -- golden reference data is for round half away from zero constant c_diff_margin : integer := 0; -- maximum difference between PFIR HDL output and expected output (> 0 to allow minor rounding differences) constant c_nof_channels : natural := 2**g_fil_ppf.nof_chan; @@ -285,6 +286,7 @@ begin g_big_endian_wb_out => g_big_endian_wb_out, g_fil_ppf => g_fil_ppf, g_fil_ppf_pipeline => g_fil_ppf_pipeline, + g_round_even => c_round_even, g_coefs_file_prefix => c_coefs_mif_file_prefix ) port map ( @@ -489,4 +491,4 @@ begin end if; end process; -end tb; \ No newline at end of file +end tb; diff --git a/libraries/dsp/iquv/tb/vhdl/tb_iquv_iab.vhd b/libraries/dsp/iquv/tb/vhdl/tb_iquv_iab.vhd index 89fd455399a8a13a23b200e40e11ab6eb0f6168e..bd45dac37548b18227e72e8041a5547e6784d307 100644 --- a/libraries/dsp/iquv/tb/vhdl/tb_iquv_iab.vhd +++ b/libraries/dsp/iquv/tb/vhdl/tb_iquv_iab.vhd @@ -59,6 +59,11 @@ ARCHITECTURE tb OF tb_iquv_iab IS CONSTANT c_fsd_w : NATURAL := c_iquv_out_w + ceil_log2(g_nof_streams); -- The number of bits fsd after the adder tree CONSTANT c_lsb_w : NATURAL := c_fsd_w - g_out_data_w; -- number of lsbs to remove from the expected result + CONSTANT c_clip : BOOLEAN := TRUE; + CONSTANT c_wrap : BOOLEAN := NOT c_clip; + CONSTANT c_even : BOOLEAN := TRUE; + CONSTANT c_away : BOOLEAN := NOT c_even; + SIGNAL tb_end : STD_LOGIC := '0'; SIGNAL dp_rst : STD_LOGIC := '1'; SIGNAL dp_clk : STD_LOGIC := '0'; @@ -205,19 +210,19 @@ BEGIN IF rising_edge(dp_clk) THEN IF diag_out_valid = '1' THEN IF g_nof_int = 8 THEN - ASSERT TO_UINT(i_out.data) = TO_UINT(u_round(TO_UVEC(i_nint8_exp_arr(v_index),c_fsd_w), c_lsb_w, TRUE)) REPORT "Error: wrong result in I out DUT" SEVERITY ERROR; - --REPORT "I exp = " & integer'image(to_uint(s_round(TO_UVEC(i_nint8_exp_arr(v_index),c_fsd_w), c_lsb_w, TRUE))); - ASSERT TO_SINT(q_out.data) = TO_SINT(s_round(TO_SVEC(q_nint8_exp_arr(v_index),c_word_w), c_lsb_w)) REPORT "Error: wrong result in Q out DUT" SEVERITY ERROR; - ASSERT TO_SINT(u_out.data) = TO_SINT(s_round(TO_SVEC(u_nint8_exp_arr(v_index),c_word_w), c_lsb_w)) REPORT "Error: wrong result in U out DUT" SEVERITY ERROR; - ASSERT TO_SINT(v_out.data) = TO_SINT(s_round(TO_SVEC(v_nint8_exp_arr(v_index),c_word_w), c_lsb_w)) REPORT "Error: wrong result in V out DUT" SEVERITY ERROR; + ASSERT TO_UINT(i_out.data) = TO_UINT(u_round(TO_UVEC(i_nint8_exp_arr(v_index),c_fsd_w), c_lsb_w, c_clip, c_even)) REPORT "Error: wrong result in I out DUT" SEVERITY ERROR; + --REPORT "I exp = " & integer'image(to_uint(s_round(TO_UVEC(i_nint8_exp_arr(v_index),c_fsd_w), c_lsb_w, c_clip))); + ASSERT TO_SINT(q_out.data) = TO_SINT(s_round(TO_SVEC(q_nint8_exp_arr(v_index),c_word_w), c_lsb_w, c_wrap, c_even)) REPORT "Error: wrong result in Q out DUT" SEVERITY ERROR; + ASSERT TO_SINT(u_out.data) = TO_SINT(s_round(TO_SVEC(u_nint8_exp_arr(v_index),c_word_w), c_lsb_w, c_wrap, c_even)) REPORT "Error: wrong result in U out DUT" SEVERITY ERROR; + ASSERT TO_SINT(v_out.data) = TO_SINT(s_round(TO_SVEC(v_nint8_exp_arr(v_index),c_word_w), c_lsb_w, c_wrap, c_even)) REPORT "Error: wrong result in V out DUT" SEVERITY ERROR; ELSIF g_nof_int = 16 THEN - ASSERT TO_UINT(i_out.data) = TO_UINT(u_round(TO_UVEC(i_nint16_exp_arr(v_index),c_fsd_w), c_lsb_w, TRUE)) REPORT "Error: wrong result in I out DUT" SEVERITY ERROR; - --REPORT "I expected = " & integer'image(to_uint(u_round(TO_UVEC(i_nint16_exp_arr(v_index),c_fsd_w), c_lsb_w, TRUE))); - ASSERT TO_SINT(q_out.data) = TO_SINT(s_round(TO_SVEC(q_nint16_exp_arr(v_index),c_word_w), c_lsb_w)) REPORT "Error: wrong result in Q out DUT" SEVERITY ERROR; - --REPORT "Q expected = " & integer'image(to_sint(s_round(TO_SVEC(q_nint16_exp_arr(v_index),c_word_w), c_lsb_w))); - ASSERT TO_SINT(u_out.data) = TO_SINT(s_round(TO_SVEC(u_nint16_exp_arr(v_index),c_word_w), c_lsb_w)) REPORT "Error: wrong result in U out DUT" SEVERITY ERROR; - ASSERT TO_SINT(v_out.data) = TO_SINT(s_round(TO_SVEC(v_nint16_exp_arr(v_index),c_word_w), c_lsb_w)) REPORT "Error: wrong result in V out DUT" SEVERITY ERROR; + ASSERT TO_UINT(i_out.data) = TO_UINT(u_round(TO_UVEC(i_nint16_exp_arr(v_index),c_fsd_w), c_lsb_w, c_clip, c_even)) REPORT "Error: wrong result in I out DUT" SEVERITY ERROR; + --REPORT "I expected = " & integer'image(to_uint(u_round(TO_UVEC(i_nint16_exp_arr(v_index),c_fsd_w), c_lsb_w, c_clip, c_even))); + ASSERT TO_SINT(q_out.data) = TO_SINT(s_round(TO_SVEC(q_nint16_exp_arr(v_index),c_word_w), c_lsb_w, c_wrap, c_even)) REPORT "Error: wrong result in Q out DUT" SEVERITY ERROR; + --REPORT "Q expected = " & integer'image(to_sint(s_round(TO_SVEC(q_nint16_exp_arr(v_index),c_word_w), c_lsb_w, c_wrap, c_even))); + ASSERT TO_SINT(u_out.data) = TO_SINT(s_round(TO_SVEC(u_nint16_exp_arr(v_index),c_word_w), c_lsb_w, c_wrap, c_even)) REPORT "Error: wrong result in U out DUT" SEVERITY ERROR; + ASSERT TO_SINT(v_out.data) = TO_SINT(s_round(TO_SVEC(v_nint16_exp_arr(v_index),c_word_w), c_lsb_w, c_wrap, c_even)) REPORT "Error: wrong result in V out DUT" SEVERITY ERROR; END IF; REPORT "I = " & integer'image(to_uint(i_out.data)) & ", Q = " & integer'image(to_sint(q_out.data)) &