diff --git a/libraries/dsp/wpfb/tb/vhdl/tb_wpfb_unit_dev_wg.vhd b/libraries/dsp/wpfb/tb/vhdl/tb_wpfb_unit_dev_wg.vhd index 61f659d3dc8206fbab2e38ab59c55ff83c8abaea..7216a1fd72dab08fad805afdbcbcf71dc5926395 100644 --- a/libraries/dsp/wpfb/tb/vhdl/tb_wpfb_unit_dev_wg.vhd +++ b/libraries/dsp/wpfb/tb/vhdl/tb_wpfb_unit_dev_wg.vhd @@ -125,7 +125,7 @@ ENTITY tb_wpfb_unit_dev_wg IS g_fil_coef_dat_w : NATURAL := 16; -- = 16, data width of the FIR coefficients --g_fil_coef_dat_w : NATURAL := 18; -- = 16, data width of the FIR coefficients g_fil_backoff_w : NATURAL := 0; -- = 0, number of bits for input backoff to avoid output overflow - g_fil_in_dat_w : NATURAL := 8; -- = W_adc, number of input bits + g_fil_in_dat_w : NATURAL := 14; -- = W_adc, number of input bits g_internal_dat_w : NATURAL := 17; -- = number of bits between fil and fft, g_internal_dat_w <= g_fft_stage_dat_w - g_fft_guard_w in fft_r2_pipe @@ -144,6 +144,9 @@ ARCHITECTURE tb OF tb_wpfb_unit_dev_wg IS CONSTANT c_mm_clk_period : TIME := 1 ns; CONSTANT c_dp_clk_period : TIME := 10 ns; + CONSTANT c_view_pfir_impulse_reponse : BOOLEAN := FALSE; -- Default FALSE to use WG data input, else use TRUE to view PFIR coefficients via fil_re_scope in Wave Window + --CONSTANT c_view_pfir_impulse_reponse : BOOLEAN := TRUE; + -- WPFB -- type t_wpfb is record -- -- General parameters for the wideband poly phase filter @@ -187,7 +190,6 @@ ARCHITECTURE tb OF tb_wpfb_unit_dev_wg IS CONSTANT c_wpfb_extra : t_wpfb_extra := (g_r2_mul_extra_w, g_sepa_extra_w); - CONSTANT c_N_fft : NATURAL := c_wpfb.nof_points; CONSTANT c_N_sub : NATURAL := c_N_fft / c_nof_complex; CONSTANT c_N_blk : NATURAL := c_wpfb.nof_blk_per_sync; -- nof FFT blocks per sync interval @@ -229,7 +231,7 @@ ARCHITECTURE tb OF tb_wpfb_unit_dev_wg IS CONSTANT c_wg_buf_dat_w : NATURAL := 18; -- default value of WG that fits 14 bits of ADC data CONSTANT c_wg_buf_addr_w : NATURAL := 10; -- default value of WG for 1024 samples; CONSTANT c_wg_calc_gain_w : NATURAL := 1; -- Normalized range [0 1> maps to fixed point range [0:2**(c_W_adc-1)> - CONSTANT c_wg_calc_dat_w : NATURAL := c_wpfb.fil_in_dat_w; + CONSTANT c_wg_calc_dat_w : NATURAL := c_W_adc; CONSTANT c_wg_subband_freq_unit : REAL := c_diag_wg_freq_unit / REAL(c_N_fft); -- freq = Fs/16 = 200 MSps/16 = 12.5 MHz sinus, -- subband index / c_N_fft = 64 / 1024 = 1/16 @@ -260,6 +262,9 @@ ARCHITECTURE tb OF tb_wpfb_unit_dev_wg IS SIGNAL wg_sosi_a_arr : t_dp_sosi_arr(0 DOWNTO 0); SIGNAL wg_sosi_b_arr : t_dp_sosi_arr(0 DOWNTO 0); + SIGNAL impulse_data : STD_LOGIC_VECTOR(c_W_adc-1 DOWNTO 0) := (OTHERS=>'0'); + SIGNAL impulse_cnt : NATURAL := 0; + SIGNAL in_sosi_arr : t_dp_sosi_arr(0 DOWNTO 0); SIGNAL in_sosi : t_dp_sosi; SIGNAL in_a_scope : INTEGER; @@ -606,13 +611,41 @@ BEGIN ); wg_val <= wg_sosi_a_arr(0).valid; + + p_impulse : PROCESS(dp_clk) + BEGIN + -- Create impulse during one block every 20 blocks, where 20 > c_wpfb.nof_taps + IF rising_edge(dp_clk) THEN + IF bs_sosi.eop='1' THEN + -- raise impulse for one block + IF impulse_cnt=0 THEN + impulse_data <= TO_SVEC(2**(c_W_adc-2), c_W_adc); -- 0.5 * full scale impulse that will be active at sop (= after eop) + ELSE + impulse_data <= TO_SVEC(0, c_W_adc); + END IF; + -- maintain impulse period + IF impulse_cnt=20 THEN + impulse_cnt <= 0; + ELSE + impulse_cnt <= impulse_cnt + 1; + END IF; + END IF; + END IF; + END PROCESS; p_in_sosi : PROCESS(wg_sosi_a_arr, wg_sosi_b_arr, bs_sosi) BEGIN -- DUT input in_sosi <= bs_sosi; - in_sosi.re <= RESIZE_DP_DSP_DATA(wg_sosi_a_arr(0).data); -- A via real input - in_sosi.im <= RESIZE_DP_DSP_DATA(wg_sosi_b_arr(0).data); -- B via imag input + IF c_view_pfir_impulse_reponse THEN + -- Use impulse_data at real input to view PFIR coefficients in impulse response in fil_re_scope in Wave Window + in_sosi.re <= RESIZE_DP_DSP_DATA(impulse_data); + in_sosi.im <= TO_DP_DSP_DATA(0); + ELSE + -- Use WG data + in_sosi.re <= RESIZE_DP_DSP_DATA(wg_sosi_a_arr(0).data); -- A via real input + in_sosi.im <= RESIZE_DP_DSP_DATA(wg_sosi_b_arr(0).data); -- B via imag input + END IF; END PROCESS; in_a_scope <= TO_SINT(in_sosi.re);