(原创)产生AM调幅信号的DDS——VHDL

 library ieee;
use ieee.std_logic_1164.all;
use IEEE.numeric_std.all;
USE IEEE.std_logic_unsigned.ALL;
use ieee.std_logic_arith.all;
-- -----------------------------------------------
Entity amdds_module is
-- -----------------------------------------------
Port
(
 CLK   : in  std_logic;
 Freq_Data_1 : in  std_logic_vector (31 downto 0);
 Freq_Data_2 : in  std_logic_vector (31 downto 0);
 Dout   : out std_logic_vector (7 downto 0) 
);
end amdds_module;
-- -----------------------------------------------
Architecture RTL of amdds_module is
-- -----------------------------------------------
signal Address_1  : std_logic_vector(7 downto 0);
signal Address_2  : std_logic_vector(7 downto 0);
signal Accum_1   : std_logic_vector (31 downto 0);
signal Accum_2   : std_logic_vector (31 downto 0); 
begin
--------------------------------------------------
Acc_1: process (CLK)
begin
if rising_edge(CLK) then
Accum_1 <= Accum_1 +Freq_Data_1+Freq_Data_2;
end if;
END process acc_1;

Acc_2: process (CLK)
begin
if rising_edge(CLK) then
Accum_2 <= Accum_2 +Freq_Data_1-Freq_Data_2;
end if;
END process acc_2;

Address_1 <=Accum_1(31 downto 24);
Address_2 <=Accum_2(31 downto 24);

--以下查正弦表
lookup: process (Address_1,Address_2)
subtype SLV8 is std_logic_vector (7 downto 0);
type Rom256x8 is array (0 to 255) of SLV8;
constant Sinus_Rom : Rom256x8 := (
x"40",x"41",x"43",x"44",x"46",x"47",x"49",x"4a",x"4c",x"4e",
x"4f",x"51",x"52",x"54",x"55",x"57",x"58",x"59",x"5b",x"5c",
x"5e",x"5f",x"60",x"62",x"63",x"64",x"66",x"67",x"68",x"69",
x"6a",x"6c",x"6d",x"6e",x"6f",x"70",x"71",x"72",x"73",x"74",
x"75",x"76",x"76",x"77",x"78",x"79",x"79",x"7a",x"7b",x"7b",
x"7c",x"7c",x"7d",x"7d",x"7e",x"7e",x"7e",x"7f",x"7f",x"7f",
x"7f",x"7f",x"7f",x"7f",x"7f",x"7f",x"7f",x"7f",x"7f",x"7f",
x"7f",x"7f",x"7e",x"7e",x"7e",x"7d",x"7d",x"7c",x"7c",x"7b",
x"7b",x"7a",x"79",x"79",x"78",x"77",x"76",x"76",x"75",x"74",
x"73",x"72",x"71",x"70",x"6f",x"6e",x"6d",x"6c",x"6a",x"69",
x"68",x"67",x"66",x"64",x"63",x"62",x"60",x"5f",x"5e",x"5c",
x"5b",x"59",x"58",x"57",x"55",x"54",x"52",x"51",x"4f",x"4e",
x"4c",x"4a",x"49",x"47",x"46",x"44",x"43",x"41",x"40",x"3e",
x"3c",x"3b",x"39",x"38",x"36",x"35",x"33",x"31",x"30",x"2e",
x"2d",x"2b",x"2a",x"28",x"27",x"26",x"24",x"23",x"21",x"20",
x"1f",x"1d",x"1c",x"1b",x"19",x"18",x"17",x"16",x"15",x"13",
x"12",x"11",x"10",x"0f",x"0e",x"0d",x"0c",x"0b",x"0a",x"09",
x"09",x"08",x"07",x"06",x"06",x"05",x"04",x"04",x"03",x"03",
x"02",x"02",x"01",x"01",x"01",x"00",x"00",x"00",x"00",x"00",
x"00",x"00",x"00",x"00",x"00",x"00",x"00",x"00",x"00",x"00",
x"01",x"01",x"01",x"02",x"02",x"03",x"03",x"04",x"04",x"05",
x"06",x"06",x"07",x"08",x"09",x"09",x"0a",x"0b",x"0c",x"0d",
x"0e",x"0f",x"10",x"11",x"12",x"13",x"15",x"16",x"17",x"18",
x"19",x"1b",x"1c",x"1d",x"1f",x"20",x"21",x"23",x"24",x"26",
x"27",x"28",x"2a",x"2b",x"2d",x"2e",x"30",x"31",x"33",x"35",
x"36",x"38",x"39",x"3b",x"3c",x"3e");
begin

if rising_edge(CLK) then
Dout <=Sinus_Rom(CONV_INTEGER(Address_1))+Sinus_Rom(CONV_INTEGER(Address_2));
end if;
end process lookup;
end Architecture RTL;

你可能感兴趣的:((原创)产生AM调幅信号的DDS——VHDL)