集成电路技术分享

 找回密码
 我要注册

QQ登录

只需一步,快速开始

搜索
查看: 2627|回复: 5

[半整数分频器的设计(VHDL)

[复制链接]
weibode01 发表于 2010-11-5 14:29:53 | 显示全部楼层 |阅读模式
[半整数分频器的设计(VHDL)

实现方法:首先需要设计一个计数器,计数器的模为分频系数的整数部分加1,然后设计一个扣除脉冲电路,并把它加在计数器的输出之后。(不懂什么意思,不过对照时序图比较容易理解)

VHDL程序:

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;

entity clk_div_h is
    port(
        clk        :in std_logic;
        clk_out    ut std_logic;
        clk_ot1,clk_ot2ut std_logic
    );
end clk_div_h;

architecture rtl of clk_div_h is
    constant md:std_logic_vector(3 downto 0):="0011";--计数器的模为分频系数的整数部分加1
    signal count:std_logic_vector(3 downto 0);
    signal clk_tmp1:std_logic;
    signal clk_tmp2:std_logic;
    signal clk_out_tmp:std_logic;
begin
    clk_tmp1<=clk xor clk_tmp2;
    modn_counter:process(clk_tmp1)
    begin
        if(clk_tmp1'event and clk_tmp1='1')then
            if(count="0000")then
                count<=md-1;
                clk_out<='1';
                clk_out_tmp<='1';
            else
                count<=count-1;
                clk_out<='0';
                clk_out_tmp<='0';
            end if;
        end if;
    end process modn_counter;

    half_clk:process(clk_out_tmp)
    begin
        if(clk_out_tmp'event and clk_out_tmp='1')then
            clk_tmp2<=not clk_tmp2;
        end if;
    end process half_clk;

    clk_ot1<=clk_tmp1;
    clk_ot2<=clk_tmp2;
end rtl;

以上是一个2.5分频的半整数分频器的VHDL源程序,要得到其它分频系数的半整数分频器,只需要改变程序中常量md的值即可。

该分频器的仿真时序图:



仿真中添加了二个临时信号(clk_ot1对应clk_tmp1,clk_ot2对应clk_tmp2)的输出以便观察内部信号的跳变过程。

如时序图中所示,由于clk与clk_tmp2信号相异或,使得clk_tmp1从1回到了0快了半个时钟,也就是扣除了半个时钟。也许这就是所谓的扣除脉冲电路吧。

本帖子中包含更多资源

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

x
 楼主| weibode01 发表于 2010-11-5 14:42:39 | 显示全部楼层
此东西是很有用的,多看一下吧
aklangmuir 发表于 2011-6-24 12:05:44 | 显示全部楼层
顶一下顶一下
蓝余 发表于 2011-6-24 17:05:47 | 显示全部楼层
很值得学习!
蓝余 发表于 2011-7-5 18:48:26 | 显示全部楼层
觉得短时间难理解的,可以用dcm模块来做时钟的分频,这样可以把后面的模块先做起来,便于仿真验证。
碎碎念 发表于 2011-7-7 13:57:53 | 显示全部楼层
很值得学习!
您需要登录后才可以回帖 登录 | 我要注册

本版积分规则

关闭

站长推荐上一条 /1 下一条

QQ|小黑屋|手机版|Archiver|集成电路技术分享 ( 京ICP备20003123号-1 )

GMT+8, 2024-6-17 20:57 , Processed in 0.068909 second(s), 22 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表