library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
-- use this library as much as possible.
entity sinewave is
port (clk :in std_logic;
dataout : out real range -1.0 to 1.0);
end sinewave;
architecture Behavioral of sinewave is
signal i : integer range 0 to 77:=0;
type memory_type is array (0 to 71) of real range -1.0000 to 1.0000 ;
--ROM for storing the sine values generated.
signal temp : memory_type :=(0.0,0.0872, 0.1736, 0.2588, 0.3420, 0.4226, 0.5000, 0.5736, 0.6428, 0.7071, 0.7660,
0.8191, 0.8660, 0.9063, 0.9397, 0.9659, 0.9848, 0.9962, 1.0000,0.9962,0.9848,0.9659,
0.9397, 0.9063, 0.8660, 0.8191, 0.7660, 0.7071, 0.6428, 0.5000, 0.4226, 0.3420, 0.2588,
0.1736, 0.0872,0.0, 0.0,-0.0872,-0.1736, -0.2588, -0.3420,-0.4226, -0.5000, -0.5736,
-0.6428, -0.7071, -0.7660, -0.8191, -0.8660, -0.9063, -0.9397, -0.9659, -0.9848, -0.9962,
-1.0000,-0.9962,-0.9848,-0.9659,-0.9397, -0.9063, -0.8660, -0.8191,
-0.766, -0.7071, -0.6428, -0.5000, -0.4226, -0.3420, -0.2588, -0.1736, -0.0872,0.0);
begin
process(clk)
begin
--to check the rising edge of the clock signal
if(rising_edge(clk)) then
dataout <= temp(i);
i <= i+ 1;
if(i = 71) then
i <= 0;
end if;
end if;
end process;
end Behavioral;
Решите эту реализацию
Это показывает ошибку, чем постоянное значение, ожидаемое для выражения 1.000