码迷,mamicode.com
首页 > 其他好文 > 详细

如何实现4分频?

时间:2015-05-27 00:43:45      阅读:202      评论:0      收藏:0      [点我收藏+]

标签:

偶来扔个砖头先

举例来说:16M的晶振,让它的输入信号输入4个脉冲的时候翻转一次,这个翻转的输出就是四分频拉。。
用CPLD的VHDL语言来做的话:
library ieee;
use ieee.std_logic_1164.all;

entity fp is
    port(
             clk                :in std_logic;--这个是输入的时钟信号嘛
             clk_out         :out std_logic);--这个输出的是四分频的信号嘛
end;

architecture one of fp is
signal:cnt:integer range 0 to 4;
begin
process(clk)
        if rising_edge(clk) then
            cnt <= cnt+1;
                  if cnt=4 then
                     cnt <= 0;
                     cnt_out <= not cnt_out;
                  end if;
        end if;
end process;
end;
好像是这样的吧。。呵呵

如何实现4分频?

标签:

原文地址:http://www.cnblogs.com/shangdawei/p/4532117.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!