⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 counter10.vhd

📁 该程序实现的是10进制的计数器
💻 VHD
字号:
Library IEEE;
use IEEE.std_logic_1164.all;
Entity counter_10 Is
port(	reset : in std_logic; 
    up_enable : in std_logic;
          clk : in std_logic;
	count : out  std_logic;
          bcd : out integer range 0 to 9
      );
end counter_10;

Architecture counter10_arch of counter_10 is
begin
signal bcd_temp : integer range 0 to 9;

process(clk,reset)
begin

       if reset='1' then
	      count <=0;
		  bcd<=0;
	      bcd_temp:=0;
	  elsif clk='1' and clk'event then
		if up_enable='1' then
		    if bcd_temp=8 then
 	  	       count <='1';
		       bcd_temp<=bcd_temp+1;
		    elsif bcd_temp=9 then
		       count <='0';
		       bcd_temp<='0';
			else
			   count <='0';
			   bcd_temp<=bcd_temp+1;

		    end if;
		end if;
       end if;
	bcd <= bcd_temp;
end process;

end counter10_arch;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -