欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

專注電子技術學習與研究
當前位置:單片機教程網 >> MCU設計實例 >> 瀏覽文章

基于VHDL語言含異步清零同步計數使能12進制加減可控制器

作者:huqin   來源:本站原創   點擊數:  更新時間:2014年04月04日   【字體:

library ieee;
use ieee.std_logic_1164.all;
entity counter12_updown is
port(clr,ena,clk,updown,load: in std_logic;
     d: buffer integer range 0 to 11;
     q: buffer integer range 0 to 11;
     count:out std_logic);
end entity counter12_updown;
architecture rtl of counter12_updown is
begin
process(clk,clr)
begin
if clr='1' then q<=0;
else
    if clk='1' and clk'event then
    if load='1' then q<=d;
    elsif ena='1'then
    if updown='1' then
      if q=11 then q<=0;
       else
        q<=q+1;
       end if;
      else
         if q=0 then q<=11;
         else
           q<=q-1;
       end if;
       end if;
       end if;
       end if;
end if;
if updown='1' then
 if q=9 then count<='1';
else count<='0';
end if;
else
if q=0 then
count<='1';
else count<='0';
end if;
end if;
end process;
end architecture rtl;

關閉窗口

相關文章