DDS任意频率发生器

[复制链接]
查看505 | 回复0 | 2019-5-7 16:38:13 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区

您需要 登录 才可以下载或查看,没有账号?立即注册

×
--N  = 2^32
--fc = 50 000 000 HZ
--fo = fc*K/(2^32)
--K  = fo*(2^32)/fc

entity DDS_FRE is
port(
    clk    : in std_logic;
    rst_n    : in std_logic;
    clk_o    : out std_logic
);
end DDS_FRE;

architecture Behavioral of DDS_FRE is
--constant Freq_Word : std_logic_vector(31 downto 0) := x"0000218e";--100K
--constant Freq_Word : std_logic_vector(31 downto 0)      := x"0AA7EF9E";--666K
constant Freq_Word : std_logic_vector(31 downto 0)      := x"08000000";--500K
--constant Freq_Word : std_logic_vector(31 downto 0)      := x"08CCCCCC";--550K
--constant Freq_Word : std_logic_vector(31 downto 0) := x"0C000000";--750K
signal max_value    : std_logic_vector(31 downto 0);
begin
process(clk,rst_n)
begin
    if(rst_n = '0')then
        max_value    <= x"00000000";
    elsif(clk'event and clk = '1')then
        max_value    <= max_value + Freq_Word;
    end if;
end process;

process(clk,rst_n)
begin
    if(rst_n = '0')then
        clk_o    <= '0';
    elsif(clk'event and clk = '1')then
        if(max_value < x"7fffffff")then
            clk_o    <= '0';
        else
            clk_o    <= '1';
        end if;
    end if;
end process;

end Behavioral;
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

6

主题

6

回帖

68

积分

一级逆天

积分
68

终身成就奖