A simple vhdl fir description.
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.

39 lines
1.1KB

  1. LIBRARY ieee;
  2. USE ieee.std_logic_1164.ALL;
  3. USE work.GENERAL_INCLUDES.ALL;
  4. ENTITY N_SAMPLES_PARTIAL_ADDER IS
  5. GENERIC( w_in : natural;
  6. nb_samples_out : natural
  7. );
  8. PORT( i_clk : IN std_logic;
  9. i_data : IN ARRAY (0 TO 2*nb_samples_out-1) OF std_logic_vector(w_in-1 DOWNTO 0);
  10. o_data : OUT ARRAY (0 TO nb_samples_out-1) OF std_logic_vector(w_in DOWNTO 0)
  11. );
  12. END N_SAMPLES_PARTIAL_ADDER;
  13. ARCHITECTURE Adder_Simple OF N_SAMPLES_PARTIAL_ADDER IS
  14. SIGNAL data1 : ARRAY (0 TO nb_samples_out) OF signed(w_in-1 DOWNTO 0);
  15. SIGNAL data2 : ARRAY (0 TO nb_samples_out) OF signed(w_in-1 DOWNTO 0);
  16. SIGNAL result : ARRAY (0 TO nb_samples_out) OF signed(w_in DOWNTO 0);
  17. BEGIN
  18. async_cast : FOR i IN 0 TO nb_samples_out-1 GENERATE
  19. data1(i) <= signed(i_data(2*i));
  20. data2(i) <= signed(i_data(2*i+1));
  21. o_data(i) <= std_logic_vector(result(i));
  22. END GENERATE async_cast;
  23. PROCESS(i_clk)
  24. BEGIN
  25. IF(rising_edge(i_clk)) THEN
  26. FOR i IN 0 TO nb_samples_out-1 LOOP
  27. result(i) <= data1(i) + data2(i);
  28. END LOOP;
  29. END IF;
  30. END PROCESS;
  31. END Adder_Tree;