锐单电子商城 , 一站式电子元器件采购平台!
  • 电话:400-990-0325

基于VHDL语言含异步清零同步计数使能12进制加减可控制器

时间:2024-04-30 02:37:09

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;


-电子元器件采购网(www.ruidan.com)是本土元器件目录分销商,采用“小批量、现货、样品”销售模式,致力于满足客户多型号、高质量、快速交付的采购需求。 自建高效智能仓储,拥有自营库存超过50,000种,提供一站式正品现货采购、个性化解决方案、选型替代等多元化服务。
锐单商城拥有海量元器件数据手册IC替代型号,打造电子元器件IC百科大全!

相关文章