Files of a 5*2^n VHDL entity using Winograd5 and radix2 implementations
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
3.9KB

  1. LIBRARY ieee;
  2. USE ieee.std_logic_1164.ALL;
  3. USE ieee.numeric_std.ALL;
  4. USE ieee.std_logic_unsigned.ALL;
  5. USE ieee.std_logic_signed.ALL;
  6. -- NOTE:
  7. -- The number of in/output samples must be a 2^n factor of 5, < 160
  8. PACKAGE FIVEn_DFT_PKG IS
  9. CONSTANT cst_w_in_5ndft : natural := 19; -- input_bitwidth
  10. CONSTANT cst_w_out_5ndft : natural := 6; -- output bitwidth, must be < 30
  11. CONSTANT cst_nb_samples_in_5ndft : natural := 20; -- must be 5*n
  12. CONSTANT cst_w_precision_winograd5_coeffs_5ndft : natural := 8; -- must be <= 32 and >= 3, sign bit included. Ideal is >= 8
  13. CONSTANT cst_w_precision_radix2_coeffs_5ndft : natural := 8; -- must be <= 32 and >= 3, sign bit included. Ideal is >= 8
  14. -- CALCULATIONS --
  15. CONSTANT cst_nb_parallel_winograd5 : natural := cst_nb_samples_in_5ndft/5;
  16. CONSTANT cst_log2_nb_parallel_winograd5 : natural := 2; -- = log2(cst_nb_parallel_winograd5)
  17. CONSTANT cst_w_winograd_added : natural := cst_w_precision_winograd5_coeffs_5ndft+6; -- 6 is the number of addition stages in the winograd5 blk
  18. CONSTANT cst_w_radix2_added : natural := cst_w_precision_radix2_coeffs_5ndft+2;
  19. CONSTANT cst_dft_w_out_5ndft : natural := cst_w_in_5ndft+cst_w_winograd_added+(cst_log2_nb_parallel_winograd5*cst_w_radix2_added);
  20. CONSTANT cst_winograd5_w_out_5ndft : natural := cst_w_in_5ndft+cst_w_winograd_added; -- 6 is the number of addition stages in the winograd5 blk
  21. CONSTANT cst_nb_wn_coeffs : natural := cst_nb_samples_in_5ndft/2;
  22. -- TYPES --
  23. SUBTYPE smpl_in_5ndft IS std_logic_vector(cst_w_in_5ndft-1 DOWNTO 0);
  24. SUBTYPE smpl_out_5ndft IS std_logic_vector(cst_w_out_5ndft-1 DOWNTO 0);
  25. TYPE vect_dft_input IS ARRAY (0 TO cst_nb_samples_in_5ndft-1) OF smpl_in_5ndft;
  26. TYPE vect_dft_output IS ARRAY (0 TO cst_nb_samples_in_5ndft-1) OF smpl_out_5ndft;
  27. -- winograd5
  28. SUBTYPE smpl_out_winograd5_5ndft IS std_logic_vector(cst_winograd5_w_out_5ndft-1 DOWNTO 0);
  29. SUBTYPE smpl_out_winograd5_signed_5ndft IS signed(cst_winograd5_w_out_5ndft-1 DOWNTO 0);
  30. TYPE vect_input_winograd5_5ndft IS ARRAY (0 TO 4) OF smpl_in_5ndft;
  31. TYPE vect_output_winograd5_5ndft IS ARRAY (0 TO 4) OF smpl_out_winograd5_5ndft;
  32. TYPE vect_total_output_winograd5_cells IS ARRAY (0 TO cst_nb_samples_in_5ndft-1) OF smpl_out_winograd5_5ndft;
  33. TYPE vect_winograd5_generic_stage IS ARRAY (0 TO 5) OF smpl_out_winograd5_5ndft;
  34. TYPE matrix_winograd5_generic_stages IS ARRAY (0 TO 7) OF vect_winograd5_generic_stage;
  35. SUBTYPE smpl_mult_factor_w_multipliers IS std_logic_vector(cst_w_precision_winograd5_coeffs_5ndft-1 DOWNTO 0);
  36. SUBTYPE smpl_mult_factor_w_multipliers_signed IS signed(cst_w_precision_winograd5_coeffs_5ndft-1 DOWNTO 0);
  37. TYPE vect_mult_factors_32b IS ARRAY (1 TO 5) OF std_logic_vector(31 DOWNTO 0);
  38. TYPE vect_mult_factor_w_multipliers IS ARRAY (1 TO 5) OF smpl_mult_factor_w_multipliers;
  39. --radix2
  40. SUBTYPE smpl_cos_sin_wb IS std_logic_vector(cst_w_precision_radix2_coeffs_5ndft-1 DOWNTO 0);
  41. SUBTYPE smpl_cos_sin_signed_wb IS signed(cst_w_precision_radix2_coeffs_5ndft-1 DOWNTO 0);
  42. TYPE vect_cos_sin_k_pi_over_5_32b IS ARRAY(0 TO 4) OF std_logic_vector(31 DOWNTO 0);
  43. TYPE vect_cos_sin_k_pi_over_5_wb IS ARRAY(0 TO 4) OF smpl_cos_sin_wb;
  44. TYPE vect_cos_sin_k_pi_over_80_32b IS ARRAY (0 TO cst_nb_wn_coeffs-1) OF std_logic_vector(31 DOWNTO 0);
  45. SUBTYPE smpl_out_radix2 IS std_logic_vector(cst_dft_w_out_5ndft-1 DOWNTO 0);
  46. SUBTYPE smpl_out_signed_radix2 IS signed(cst_dft_w_out_5ndft-1 DOWNTO 0);
  47. TYPE vect_radix2_fft_line IS ARRAY (0 TO cst_log2_nb_parallel_winograd5) OF smpl_out_radix2;
  48. TYPE vect_radix2_line IS ARRAY (0 TO 3) OF smpl_out_radix2;
  49. TYPE matrix_radix2_cell IS ARRAY (0 TO 1) OF vect_radix2_line;
  50. -- whole fft
  51. TYPE matrix_fft_stages IS ARRAY (0 TO cst_nb_samples_in_5ndft-1) OF vect_radix2_fft_line; -- inputs and outputs of radix2 cells
  52. END;