OpenCores
URL https://opencores.org/ocsvn/astron_wb_fft/astron_wb_fft/trunk

Subversion Repositories astron_wb_fft

[/] [astron_wb_fft/] [trunk/] [fft_r2_par.vhd] - Diff between revs 3 and 5

Show entire file | Details | Blame | View Log

Rev 3 Rev 5
Line 32... Line 32...
--                        an alternating way: A(0), B(0), A(1), B(1).... etc
--                        an alternating way: A(0), B(0), A(1), B(1).... etc
--                        The separate function adds and subtracts two complex bins. 
--                        The separate function adds and subtracts two complex bins. 
--                        Therefore it causes 1 bit growth that needs to be rounded, as
--                        Therefore it causes 1 bit growth that needs to be rounded, as
--                        explained in fft_sepa.vhd
--                        explained in fft_sepa.vhd
 
 
library ieee, common_pkg_lib, common_components_lib, common_add_sub_lib, common_requantize_lib, rTwoSDF_lib;
library ieee, common_pkg_lib, common_components_lib, astron_adder_lib, astron_requantize_lib, astron_r2sdf_fft_lib;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_1164.all;
use common_pkg_lib.common_pkg.all;
use common_pkg_lib.common_pkg.all;
use rTwoSDF_lib.rTwoSDFPkg.all;
use astron_r2sdf_fft_lib.rTwoSDFPkg.all;
use work.fft_pkg.all;
use work.fft_pkg.all;
 
 
entity fft_r2_par is
entity fft_r2_par is
  generic (
  generic (
    g_fft      : t_fft := c_fft;                  -- generics for the FFT
    g_fft      : t_fft := c_fft;                  -- generics for the FFT
    g_pipeline : t_fft_pipeline := c_fft_pipeline -- generics for pipelining, defined in rTwoSDF_lib.rTwoSDFPkg
    g_pipeline : t_fft_pipeline := c_fft_pipeline -- generics for pipelining, defined in astron_r2sdf_fft_lib.rTwoSDFPkg
  );
  );
  port (
  port (
    clk        : in  std_logic;
    clk        : in  std_logic;
    rst        : in  std_logic := '0';
    rst        : in  std_logic := '0';
    in_re_arr  : in  t_fft_slv_arr(g_fft.nof_points-1 downto 0);
    in_re_arr  : in  t_fft_slv_arr(g_fft.nof_points-1 downto 0);
Line 223... Line 223...
    ---------------------------------------------------------------------------
    ---------------------------------------------------------------------------
    -- Calulate the positive bins
    -- Calulate the positive bins
    ---------------------------------------------------------------------------
    ---------------------------------------------------------------------------
    gen_positive_bins : for I in 1 to g_fft.nof_points/2 - 1 generate
    gen_positive_bins : for I in 1 to g_fft.nof_points/2 - 1 generate
      -- common_add_sub
      -- common_add_sub
      a_output_real_adder : entity common_add_sub_lib.common_add_sub
      a_output_real_adder : entity astron_adder_lib.common_add_sub
      generic map (
      generic map (
        g_direction       => "ADD",
        g_direction       => "ADD",
        g_representation  => "SIGNED",
        g_representation  => "SIGNED",
        g_pipeline_input  => 0,
        g_pipeline_input  => 0,
        g_pipeline_output => c_pipeline_add_sub,
        g_pipeline_output => c_pipeline_add_sub,
Line 239... Line 239...
        in_a    => int_re_arr(g_fft.nof_points-I),
        in_a    => int_re_arr(g_fft.nof_points-I),
        in_b    => int_re_arr(I),
        in_b    => int_re_arr(I),
        result  => add_arr(2*I)
        result  => add_arr(2*I)
      );
      );
 
 
      b_output_real_adder : entity common_add_sub_lib.common_add_sub
      b_output_real_adder : entity astron_adder_lib.common_add_sub
      generic map (
      generic map (
        g_direction       => "ADD",
        g_direction       => "ADD",
        g_representation  => "SIGNED",
        g_representation  => "SIGNED",
        g_pipeline_input  => 0,
        g_pipeline_input  => 0,
        g_pipeline_output => c_pipeline_add_sub,
        g_pipeline_output => c_pipeline_add_sub,
Line 255... Line 255...
        in_a    => int_im_arr(g_fft.nof_points-I),
        in_a    => int_im_arr(g_fft.nof_points-I),
        in_b    => int_im_arr(I),
        in_b    => int_im_arr(I),
        result  => add_arr(2*I+1)
        result  => add_arr(2*I+1)
      );
      );
 
 
      a_output_imag_subtractor : entity common_add_sub_lib.common_add_sub
      a_output_imag_subtractor : entity astron_adder_lib.common_add_sub
      generic map (
      generic map (
        g_direction       => "SUB",
        g_direction       => "SUB",
        g_representation  => "SIGNED",
        g_representation  => "SIGNED",
        g_pipeline_input  => 0,
        g_pipeline_input  => 0,
        g_pipeline_output => c_pipeline_add_sub,
        g_pipeline_output => c_pipeline_add_sub,
Line 271... Line 271...
        in_a    => int_im_arr(I),
        in_a    => int_im_arr(I),
        in_b    => int_im_arr(g_fft.nof_points-I),
        in_b    => int_im_arr(g_fft.nof_points-I),
        result  => sub_arr(2*I)
        result  => sub_arr(2*I)
      );
      );
 
 
      b_output_imag_subtractor : entity common_add_sub_lib.common_add_sub
      b_output_imag_subtractor : entity astron_adder_lib.common_add_sub
      generic map (
      generic map (
        g_direction       => "SUB",
        g_direction       => "SUB",
        g_representation  => "SIGNED",
        g_representation  => "SIGNED",
        g_pipeline_input  => 0,
        g_pipeline_input  => 0,
        g_pipeline_output => c_pipeline_add_sub,
        g_pipeline_output => c_pipeline_add_sub,
Line 297... Line 297...
        fft_im_arr(2*I+1) <= sub_arr(2*I+1)(g_fft.stage_dat_w DOWNTO 1);  -- B imag
        fft_im_arr(2*I+1) <= sub_arr(2*I+1)(g_fft.stage_dat_w DOWNTO 1);  -- B imag
      end generate;
      end generate;
 
 
      gen_sepa_round : IF c_sepa_round=true GENERATE
      gen_sepa_round : IF c_sepa_round=true GENERATE
        -- round the one LSbit
        -- round the one LSbit
        round_re_a : ENTITY common_requantize_lib.common_round
        round_re_a : ENTITY astron_requantize_lib.common_round
        GENERIC MAP (
        GENERIC MAP (
          g_representation  => "SIGNED",  -- SIGNED (round +-0.5 away from zero to +- infinity) or UNSIGNED rounding (round 0.5 up to + inifinity)
          g_representation  => "SIGNED",  -- SIGNED (round +-0.5 away from zero to +- infinity) or UNSIGNED rounding (round 0.5 up to + inifinity)
          g_round           => TRUE,      -- when TRUE round the input, else truncate the input
          g_round           => TRUE,      -- when TRUE round the input, else truncate the input
          g_round_clip      => FALSE,     -- when TRUE clip rounded input >= +max to avoid wrapping to output -min (signed) or 0 (unsigned)
          g_round_clip      => FALSE,     -- when TRUE clip rounded input >= +max to avoid wrapping to output -min (signed) or 0 (unsigned)
          g_pipeline_input  => 0,         -- >= 0
          g_pipeline_input  => 0,         -- >= 0
Line 313... Line 313...
          clk        => clk,
          clk        => clk,
          in_dat     => add_arr(2*I),
          in_dat     => add_arr(2*I),
          out_dat    => fft_re_arr(2*I)
          out_dat    => fft_re_arr(2*I)
        );
        );
 
 
        round_re_b : ENTITY common_requantize_lib.common_round
        round_re_b : ENTITY astron_requantize_lib.common_round
        GENERIC MAP (
        GENERIC MAP (
          g_representation  => "SIGNED",  -- SIGNED (round +-0.5 away from zero to +- infinity) or UNSIGNED rounding (round 0.5 up to + inifinity)
          g_representation  => "SIGNED",  -- SIGNED (round +-0.5 away from zero to +- infinity) or UNSIGNED rounding (round 0.5 up to + inifinity)
          g_round           => TRUE,      -- when TRUE round the input, else truncate the input
          g_round           => TRUE,      -- when TRUE round the input, else truncate the input
          g_round_clip      => FALSE,     -- when TRUE clip rounded input >= +max to avoid wrapping to output -min (signed) or 0 (unsigned)
          g_round_clip      => FALSE,     -- when TRUE clip rounded input >= +max to avoid wrapping to output -min (signed) or 0 (unsigned)
          g_pipeline_input  => 0,         -- >= 0
          g_pipeline_input  => 0,         -- >= 0
Line 329... Line 329...
          clk        => clk,
          clk        => clk,
          in_dat     => add_arr(2*I+1),
          in_dat     => add_arr(2*I+1),
          out_dat    => fft_re_arr(2*I+1)
          out_dat    => fft_re_arr(2*I+1)
        );
        );
 
 
        round_im_a : ENTITY common_requantize_lib.common_round
        round_im_a : ENTITY astron_requantize_lib.common_round
        GENERIC MAP (
        GENERIC MAP (
          g_representation  => "SIGNED",  -- SIGNED (round +-0.5 away from zero to +- infinity) or UNSIGNED rounding (round 0.5 up to + inifinity)
          g_representation  => "SIGNED",  -- SIGNED (round +-0.5 away from zero to +- infinity) or UNSIGNED rounding (round 0.5 up to + inifinity)
          g_round           => TRUE,      -- when TRUE round the input, else truncate the input
          g_round           => TRUE,      -- when TRUE round the input, else truncate the input
          g_round_clip      => FALSE,     -- when TRUE clip rounded input >= +max to avoid wrapping to output -min (signed) or 0 (unsigned)
          g_round_clip      => FALSE,     -- when TRUE clip rounded input >= +max to avoid wrapping to output -min (signed) or 0 (unsigned)
          g_pipeline_input  => 0,         -- >= 0
          g_pipeline_input  => 0,         -- >= 0
Line 345... Line 345...
          clk        => clk,
          clk        => clk,
          in_dat     => sub_arr(2*I),
          in_dat     => sub_arr(2*I),
          out_dat    => fft_im_arr(2*I)
          out_dat    => fft_im_arr(2*I)
        );
        );
 
 
        round_im_b : ENTITY common_requantize_lib.common_round
        round_im_b : ENTITY astron_requantize_lib.common_round
        GENERIC MAP (
        GENERIC MAP (
          g_representation  => "SIGNED",  -- SIGNED (round +-0.5 away from zero to +- infinity) or UNSIGNED rounding (round 0.5 up to + inifinity)
          g_representation  => "SIGNED",  -- SIGNED (round +-0.5 away from zero to +- infinity) or UNSIGNED rounding (round 0.5 up to + inifinity)
          g_round           => TRUE,      -- when TRUE round the input, else truncate the input
          g_round           => TRUE,      -- when TRUE round the input, else truncate the input
          g_round_clip      => FALSE,     -- when TRUE clip rounded input >= +max to avoid wrapping to output -min (signed) or 0 (unsigned)
          g_round_clip      => FALSE,     -- when TRUE clip rounded input >= +max to avoid wrapping to output -min (signed) or 0 (unsigned)
          g_pipeline_input  => 0,         -- >= 0
          g_pipeline_input  => 0,         -- >= 0
Line 426... Line 426...
 
 
  ------------------------------------------------------------------------------
  ------------------------------------------------------------------------------
  -- Parallel FFT output requantization
  -- Parallel FFT output requantization
  ------------------------------------------------------------------------------
  ------------------------------------------------------------------------------
  gen_output_requantizers : for I in 0 to g_fft.nof_points-1 generate
  gen_output_requantizers : for I in 0 to g_fft.nof_points-1 generate
    u_requantize_re : entity common_requantize_lib.common_requantize
    u_requantize_re : entity astron_requantize_lib.common_requantize
    generic map (
    generic map (
      g_representation      => "SIGNED",
      g_representation      => "SIGNED",
      g_lsb_w               => c_out_scale_w,
      g_lsb_w               => c_out_scale_w,
      g_lsb_round           => TRUE,
      g_lsb_round           => TRUE,
      g_lsb_round_clip      => FALSE,
      g_lsb_round_clip      => FALSE,
Line 446... Line 446...
      in_dat     => fft_re_arr(I),
      in_dat     => fft_re_arr(I),
      out_dat    => out_re_arr(I),
      out_dat    => out_re_arr(I),
      out_ovr    => open
      out_ovr    => open
    );
    );
 
 
    u_requantize_im : entity common_requantize_lib.common_requantize
    u_requantize_im : entity astron_requantize_lib.common_requantize
    generic map (
    generic map (
      g_representation      => "SIGNED",
      g_representation      => "SIGNED",
      g_lsb_w               => c_out_scale_w,
      g_lsb_w               => c_out_scale_w,
      g_lsb_round           => TRUE,
      g_lsb_round           => TRUE,
      g_lsb_round_clip      => FALSE,
      g_lsb_round_clip      => FALSE,

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.