VHDL implementation of a polyphase filter bank with polyphase filter and 5ndft
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.

71 lines
2.1KB

  1. LIBRARY ieee;
  2. USE ieee.std_logic_1164.ALL;
  3. USE work.POLY_FIR_PKG.ALL;
  4. ENTITY poly_fir_blk IS
  5. PORT (
  6. i_clk : IN std_logic;
  7. i_coeffs : IN vect_polyfir_coeffs_in;
  8. i_data : IN vect_adc_data_out;
  9. o_data : OUT matrix_fir_data_out := (OTHERS => (OTHERS => (OTHERS => '0')))
  10. );
  11. END ENTITY poly_fir_blk;
  12. ARCHITECTURE polyphase OF poly_fir_blk IS
  13. SIGNAL matrix3D_reg_out_simple_rif_in : matrix3D_reg_data_out := (OTHERS => (OTHERS => (OTHERS => (OTHERS => '0'))));
  14. SIGNAL matrix_coeffs : matrix_fir_coeffs_in := (OTHERS => (OTHERS => (OTHERS => '0')));
  15. SIGNAL matrix_fir_out : matrix_fir_data_out := (OTHERS => (OTHERS => (OTHERS => '0')));
  16. BEGIN -- ARCHITECTURE polyphase
  17. --purpose: fill the polyphase coefficients into a 2D matrix from the filter vector (1D)
  18. fill_coeff : PROCESS(i_coeffs) -- rearrange coeffs into a matrix
  19. VARIABLE coeff_nb : natural;
  20. VARIABLE sf_coeff : natural;
  21. VARIABLE subfilter_nb : natural;
  22. BEGIN
  23. coeff_nb := 0;
  24. sf_coeff := 0;
  25. subfilter_nb := 0;
  26. coeff_for_matrix : FOR coeff_nb IN 0 TO cst_nb_coeffs_filter_in-1 LOOP
  27. matrix_coeffs(subfilter_nb)(sf_coeff) <= i_coeffs(coeff_nb);
  28. subfilter_nb := subfilter_nb+1;
  29. IF (subfilter_nb = cst_nb_subfilters) THEN
  30. sf_coeff := sf_coeff+1;
  31. subfilter_nb := 0;
  32. END IF;
  33. END LOOP coeff_for_matrix;
  34. END PROCESS fill_coeff;
  35. -- instanciation of the shift-reg for polyphasd filter
  36. shift_reg_inst : ENTITY work.POLY_SHIFT_REG(Fill_Matrix)
  37. PORT MAP (i_clk => i_clk,
  38. i_data => i_data,
  39. o_data => matrix3D_reg_out_simple_rif_in
  40. );
  41. wires_inst : ENTITY work.tree_firs(wires)
  42. PORT MAP(
  43. i_clk => i_clk,
  44. i_matrix3D_reg_out => matrix3D_reg_out_simple_rif_in,
  45. i_coeffs => matrix_coeffs,
  46. o_data => matrix_fir_out
  47. );
  48. o_data <= matrix_fir_out;
  49. END ARCHITECTURE polyphase;