我们从2011年坚守至今,只想做存粹的技术论坛。  由于网站在外面,点击附件后要很长世间才弹出下载,请耐心等待,勿重复点击不要用Edge和IE浏览器下载,否则提示不安全下载不了

 找回密码
 立即注册
搜索
查看: 487|回复: 0

DDS任意频率发生器

[复制链接]

该用户从未签到

6

主题

5

回帖

0

积分

一级逆天

积分
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;
回复

使用道具 举报

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

本版积分规则

论坛开启做任务可以
额外奖励金币快速赚
积分升级了


Copyright ©2011-2024 NTpcb.com All Right Reserved.  Powered by Discuz! (NTpcb)

本站信息均由会员发表,不代表NTpcb立场,如侵犯了您的权利请发帖投诉

平平安安
TOP
快速回复 返回顶部 返回列表