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

Apply g_fft.out_gain_w (no functional change when g_fft.out_gain_w is 0).

parent d6dc0ce9
No related branches found
No related tags found
No related merge requests found
...@@ -128,9 +128,9 @@ architecture str of fft_r2_par is ...@@ -128,9 +128,9 @@ architecture str of fft_r2_par is
constant c_in_scale_w_tester : integer := g_fft.stage_dat_w - g_fft.in_dat_w - sel_a_b(g_fft.guard_enable, g_fft.guard_w, 0); constant c_in_scale_w_tester : integer := g_fft.stage_dat_w - g_fft.in_dat_w - sel_a_b(g_fft.guard_enable, g_fft.guard_w, 0);
constant c_in_scale_w : natural := sel_a_b(c_in_scale_w_tester > 0, c_in_scale_w_tester, 0); -- Only scale when in_dat_w is not too big. constant c_in_scale_w : natural := sel_a_b(c_in_scale_w_tester > 0, c_in_scale_w_tester, 0); -- Only scale when in_dat_w is not too big.
constant c_out_scale_w_tester : integer := g_fft.stage_dat_w - g_fft.out_dat_w; -- Estimate number of LSBs to throw away. constant c_out_scale_w_tester : integer := g_fft.stage_dat_w - g_fft.out_dat_w - g_fft.out_gain_w; -- Estimate number of LSBs to throw away.
constant c_out_scale_w : natural := sel_a_b(c_out_scale_w_tester > 0, c_out_scale_w_tester, 0); constant c_out_scale_w : natural := sel_a_b(c_out_scale_w_tester > 0, c_out_scale_w_tester, 0);
constant c_out_gain_w : natural := sel_a_b(c_out_scale_w_tester < 0, -c_out_scale_w_tester, 0) + g_fft.out_gain_w; constant c_out_gain_w : natural := sel_a_b(c_out_scale_w_tester < 0, -c_out_scale_w_tester, 0);
type t_stage_dat_arr is array (integer range <>) of std_logic_vector(g_fft.stage_dat_w-1 downto 0); type t_stage_dat_arr is array (integer range <>) of std_logic_vector(g_fft.stage_dat_w-1 downto 0);
type t_stage_sum_arr is array (integer range <>) of std_logic_vector(g_fft.stage_dat_w downto 0); type t_stage_sum_arr is array (integer range <>) of std_logic_vector(g_fft.stage_dat_w downto 0);
......
...@@ -79,9 +79,9 @@ architecture str of fft_r2_pipe is ...@@ -79,9 +79,9 @@ architecture str of fft_r2_pipe is
constant c_nof_stages : natural := ceil_log2(g_fft.nof_points); constant c_nof_stages : natural := ceil_log2(g_fft.nof_points);
constant c_stage_offset : natural := true_log2(g_fft.wb_factor); -- Stage offset is required for twiddle generation in wideband fft constant c_stage_offset : natural := true_log2(g_fft.wb_factor); -- Stage offset is required for twiddle generation in wideband fft
constant c_in_scale_w : natural := g_fft.stage_dat_w - g_fft.in_dat_w - sel_a_b(g_fft.guard_enable, g_fft.guard_w, 0); constant c_in_scale_w : natural := g_fft.stage_dat_w - g_fft.in_dat_w - sel_a_b(g_fft.guard_enable, g_fft.guard_w, 0);
constant c_out_scale_w_tester : integer := g_fft.stage_dat_w - g_fft.out_dat_w; -- Estimate number of LSBs to throw away. constant c_out_scale_w_tester : integer := g_fft.stage_dat_w - g_fft.out_dat_w - g_fft.out_gain_w; -- Estimate number of LSBs to throw away.
constant c_out_scale_w : natural := sel_a_b(c_out_scale_w_tester > 0, c_out_scale_w_tester, 0); constant c_out_scale_w : natural := sel_a_b(c_out_scale_w_tester > 0, c_out_scale_w_tester, 0);
constant c_out_gain_w : natural := sel_a_b(c_out_scale_w_tester < 0, -c_out_scale_w_tester, 0) + g_fft.out_gain_w; constant c_out_gain_w : natural := sel_a_b(c_out_scale_w_tester < 0, -c_out_scale_w_tester, 0);
-- number the stage instances from c_nof_stages:1 -- number the stage instances from c_nof_stages:1
-- . the data input for the first stage has index c_nof_stages -- . the data input for the first stage has index c_nof_stages
......
...@@ -92,7 +92,7 @@ architecture rtl of fft_r2_wide is ...@@ -92,7 +92,7 @@ architecture rtl of fft_r2_wide is
v_return(I).nof_points := v_nof_points; -- Set the nof points v_return(I).nof_points := v_nof_points; -- Set the nof points
v_return(I).in_dat_w := input.stage_dat_w; -- Set the input width v_return(I).in_dat_w := input.stage_dat_w; -- Set the input width
v_return(I).out_dat_w := input.stage_dat_w; -- Set the output width. v_return(I).out_dat_w := input.stage_dat_w; -- Set the output width.
v_return(I).out_gain_w := 0; -- Output gain is forced to 0 for pipeline FFT, because it is taken care of in parallel FFT v_return(I).out_gain_w := 0; -- Output gain is forced to 0
v_return(I).guard_w := 0; -- Set the guard_w to 0 to enable scaling at every stage. v_return(I).guard_w := 0; -- Set the guard_w to 0 to enable scaling at every stage.
v_return(I).guard_enable := false; -- No input guard. v_return(I).guard_enable := false; -- No input guard.
end loop; end loop;
...@@ -112,20 +112,20 @@ architecture rtl of fft_r2_wide is ...@@ -112,20 +112,20 @@ architecture rtl of fft_r2_wide is
v_return.nof_points := input.wb_factor; -- Set the number of points to wb_factor v_return.nof_points := input.wb_factor; -- Set the number of points to wb_factor
v_return.in_dat_w := input.stage_dat_w; -- Specify the input width v_return.in_dat_w := input.stage_dat_w; -- Specify the input width
v_return.out_dat_w := input.stage_dat_w; -- Output width v_return.out_dat_w := input.stage_dat_w; -- Output width
v_return.out_gain_w := input.out_gain_w; -- Output gain v_return.out_gain_w := 0; -- Output gain is forced to 0, because it is taken care of outside parallel fft
v_return.guard_w := input.guard_w; -- Set the guard_w here to skip the scaling on the last stages v_return.guard_w := input.guard_w; -- Set the guard_w here to skip the scaling on the last stages
v_return.guard_enable := false; -- No input guard. v_return.guard_enable := false; -- No input guard.
return v_return; return v_return;
end; end;
constant c_fft_r2_par : t_fft := func_create_generic_for_par_fft(g_fft);
constant c_fft_r2_pipe_arr : t_fft_arr(g_fft.wb_factor-1 downto 0) := func_create_generic_for_pipe_fft(g_fft); constant c_fft_r2_pipe_arr : t_fft_arr(g_fft.wb_factor-1 downto 0) := func_create_generic_for_pipe_fft(g_fft);
constant c_fft_r2_par : t_fft := func_create_generic_for_par_fft(g_fft);
constant c_in_scale_w : natural := g_fft.stage_dat_w - g_fft.in_dat_w - sel_a_b(g_fft.guard_enable, g_fft.guard_w, 0); constant c_in_scale_w : natural := g_fft.stage_dat_w - g_fft.in_dat_w - sel_a_b(g_fft.guard_enable, g_fft.guard_w, 0);
constant c_out_scale_w_tester : integer := c_fft_r2_par.out_dat_w - g_fft.out_dat_w; -- Estimate number of LSBs to throw away. constant c_out_scale_w_tester : integer := c_fft_r2_par.out_dat_w - g_fft.out_dat_w - g_fft.out_gain_w; -- Estimate number of LSBs to throw away.
constant c_out_scale_w : natural := sel_a_b(c_out_scale_w_tester > 0, c_out_scale_w_tester, 0); constant c_out_scale_w : natural := sel_a_b(c_out_scale_w_tester > 0, c_out_scale_w_tester, 0);
constant c_out_gain_w : natural := sel_a_b(c_out_scale_w_tester < 0, -c_out_scale_w_tester, 0) + c_fft_r2_par.out_gain_w; constant c_out_gain_w : natural := sel_a_b(c_out_scale_w_tester < 0, -c_out_scale_w_tester, 0);
signal in_fft_pipe_re_arr : t_fft_slv_arr(g_fft.wb_factor-1 downto 0); signal in_fft_pipe_re_arr : t_fft_slv_arr(g_fft.wb_factor-1 downto 0);
signal in_fft_pipe_im_arr : t_fft_slv_arr(g_fft.wb_factor-1 downto 0); signal in_fft_pipe_im_arr : t_fft_slv_arr(g_fft.wb_factor-1 downto 0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment