Studentenversion des ESY6/A Praktikums "signal_processing".
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.

float_sine.vhd 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use ieee.numeric_std.all;
  4. use ieee.math_real.all;
  5. library work;
  6. use work.cordic_pkg.all;
  7. use work.float.all;
  8. entity float_sine is
  9. generic (
  10. ITERATIONS : positive -- Number of CORDIC iterations
  11. );
  12. port (
  13. clk : in std_logic;
  14. reset : in std_logic;
  15. data_valid : in std_logic; --# load new input data
  16. busy : out std_logic; --# generating new result
  17. result_valid : out std_logic; --# flag when result is valid
  18. angle : in signed(31 downto 0); -- angle in brads (2**size brads = 2*pi radians)
  19. sine : out signed(31 downto 0)
  20. );
  21. end entity float_sine;
  22. architecture rtl of float_sine is
  23. signal fixed : signed( 31 downto 0 );
  24. begin
  25. u_fixed_sine : entity work.fixed_sine
  26. generic map (
  27. SIZE => 32,
  28. ITERATIONS => 8,
  29. FRAC_BITS => 31
  30. )
  31. port map (
  32. clock => clk,
  33. reset => reset,
  34. data_valid => data_valid,
  35. busy => busy,
  36. result_valid => result_valid,
  37. angle => angle,
  38. sine => fixed
  39. );
  40. sine <= signed( to_float( std_logic_vector( fixed ) ) );
  41. end architecture;