加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

[转载]三分频的VHDL程序

(2013-06-23 22:54:33)
标签:

转载

原文地址:三分频的VHDL程序作者:破海飘依
   现在很多公司面试都会要面试者说一下如何用VHDL语言写一个三分频的程序。
下面是我写的三分频。期望能对大家有所启发。

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;

0

前一篇:no title
后一篇:闲谈一二
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有