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

📄 month.vhd

📁 基于VHDL的电子钟 实现一个简单的电子钟
💻 VHD
字号:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity month is 
port( 	mh,ml : buffer std_logic_vector (3 downto 0);
      	clk : in std_logic;
	    carry1: buffer std_logic;
        carry2: buffer std_logic_vector (1 downto 0));
end month;
architecture month_display of month is
begin 
  process(clk)
  begin
	if clk'event  and clk='1' then
	  if ml=9 then
		ml <="0000";
		mh <= mh+1;
		--carry2<="01";
	  elsif ml=2 then 
		if mh=1 then
		  mh <= "0000"; ml <="0001";
                  carry1 <= not carry1;
        else ml <= ml+ 1;
          carry1 <= '0';
		end if;
	  else ml <= ml+1;
              carry1 <= '0';
            if mh=0 and ml=0 then carry2<="11";
            elsif mh=0 and ml=1  then carry2<="10";
            elsif mh=0 and ml=2 then carry2<="11";
            elsif mh=0 and ml=3 then carry2<="01";
            elsif mh=0 and ml=4 then carry2<="11";
            elsif mh=0 and ml=5 then carry2<="01";
            elsif mh=0 and ml=6 then carry2<="11";
            elsif mh=0 and ml=7 then carry2<="11";
            elsif mh=0 and ml=8 then carry2<="01";
            elsif mh=0 and ml=9 then carry2<="11";
            elsif mh=1 and ml=0 then carry2<="01";
            elsif mh=1 and ml=1 then carry2<="11";
           end if;
	  end if;
    end if;
   end process;
end month_display;

⌨️ 快捷键说明

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