2024-02-23 13:01:05 +00:00
|
|
|
ARCHITECTURE studentVersion OF sineTable IS
|
|
|
|
|
|
|
|
signal phaseTableAddress : unsigned(tableAddressBitNb-1 downto 0);
|
2024-03-05 10:48:52 +00:00
|
|
|
signal phaseTableAddress2 : unsigned(tableAddressBitNb-1 downto 0);
|
2024-02-23 13:01:05 +00:00
|
|
|
signal quarterSine : signed(sine'range);
|
|
|
|
|
|
|
|
BEGIN
|
|
|
|
|
|
|
|
phaseTableAddress <= phase(phase'high-2 downto phase'high-2-tableAddressBitNb+1);
|
|
|
|
|
2024-03-05 10:48:52 +00:00
|
|
|
sequenceTable: process(phase)
|
2024-02-23 13:01:05 +00:00
|
|
|
begin
|
2024-03-05 10:48:52 +00:00
|
|
|
if phase(phase'high-1) = '1' then
|
|
|
|
phaseTableAddress2 <= 8 - phaseTableAddress;
|
|
|
|
else
|
|
|
|
phaseTableAddress2 <= phaseTableAddress;
|
|
|
|
end if;
|
|
|
|
end process sequenceTable;
|
|
|
|
|
|
|
|
quarterTable: process(phaseTableAddress2)
|
|
|
|
begin
|
|
|
|
case to_integer(phaseTableAddress2) is
|
2024-02-23 13:01:05 +00:00
|
|
|
when 0 => quarterSine <= to_signed(16#0000#, quarterSine'length);
|
|
|
|
when 1 => quarterSine <= to_signed(16#18F9#, quarterSine'length);
|
|
|
|
when 2 => quarterSine <= to_signed(16#30FB#, quarterSine'length);
|
|
|
|
when 3 => quarterSine <= to_signed(16#471C#, quarterSine'length);
|
|
|
|
when 4 => quarterSine <= to_signed(16#5A82#, quarterSine'length);
|
|
|
|
when 5 => quarterSine <= to_signed(16#6A6D#, quarterSine'length);
|
|
|
|
when 6 => quarterSine <= to_signed(16#7641#, quarterSine'length);
|
|
|
|
when 7 => quarterSine <= to_signed(16#7D89#, quarterSine'length);
|
|
|
|
when others => quarterSine <= (others => '-');
|
|
|
|
end case;
|
|
|
|
end process quarterTable;
|
|
|
|
|
2024-03-05 10:48:52 +00:00
|
|
|
invert: process(quarterSine)
|
|
|
|
begin
|
|
|
|
if phase(phase'high) = '1' then
|
|
|
|
sine <= NOT quarterSine;
|
|
|
|
else
|
|
|
|
sine <= quarterSine;
|
|
|
|
end if;
|
|
|
|
end process invert;
|
|
|
|
|
|
|
|
--sine <= quarterSine;
|
2024-02-23 13:01:05 +00:00
|
|
|
|
|
|
|
END ARCHITECTURE studentVersion;
|