Skip to content
Snippets Groups Projects
Commit 267c49bd authored by Reinier van der Walle's avatar Reinier van der Walle
Browse files

Merge branch 'L2SDP-724' into 'master'

Pass on g_round_even = true default, to support using false for golden...

Closes L2SDP-724

See merge request desp/hdl!244
parents 59405210 8e635af4
No related branches found
No related tags found
1 merge request!244Pass on g_round_even = true default, to support using false for golden...
Pipeline #29324 passed
......@@ -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;
---------------------------------------------------------------------------
......
......@@ -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;
---------------------------------------------------------------------------
......
......@@ -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,
......
......@@ -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,
......
......@@ -74,6 +74,7 @@ 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_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,
......
......@@ -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
)
......
......@@ -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 (
......
......@@ -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)) &
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment