载入中...

| 载入中...'s blog

2007-11-5 21:02:00
三分频程序设计及任意奇数分(频占空比50%)

三分频程序设计及任意奇数分(频占空比50%)

实现一个3分频程序,程序如下:

library ieee;
use ieee.std_logic_1164.all;

entity fenpin3 is
port(clock:in std_logic;
      clk:out std_logic);
end;

architecture devider of fenpin3 is
signal counter:integer range 0 to 2;
signal temp1,temp2:std_logic;

begin
process(clock)
begin
if rising_edge(clock) then
    if counter=2 then
     counter<=0;
      temp1<=not temp1;
   else
    counter<=counter+1;
end if;
end if;

if falling_edge(clock) then
   if counter=1 then
    temp2<=not temp2;
end if;
end if;
end process;
clk<=temp1 xor temp2;
end;

此程序中只使用了一个进程,利用了一个计数器counter,并且使temp1在上升沿计数,rising_edg计到2时翻转,temp2在下降沿计数,当falling_edge计到1时翻转,这样temp1与temp2的相位正好相差180度,以此方法可以实现任意奇数分频,方法当分频数n为奇数时,上面的这条语句改为

signal counter:integer range 0 to (n-1);

仿真如下图:fenpin3

  • 标签:三分频程序设计及任意奇数分(频占空比50%) 
  • 2008-9-5 8:00:00
    Re:三分频程序设计及任意奇数分(频占空比50%)
    风后(游客)Thank you
    By 风后(游客) | 个人主页 | 引用 | 返回 | 删除 | 回复
    发表评论:
    载入中...

    日历

    载入中...

    公告

    最新文章

    载入中...

    文章分类

    载入中...

    MY Favorite Blogs

    最近评论

    载入中...

    最近留言

    载入中...

    信息

    载入中...

    登陆

    载入中...