seltime.vhd

来自「有关数字钟的」· VHDL 代码 · 共 38 行

VHD
38
字号
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity seltime is
port(ckdsp,reset:in std_logic;
	second,minute,hour:in std_logic_vector(7 downto 0);
	daout:out std_logic_vector(3 downto 0);
	sel:out std_logic_vector(2 downto 0));
end seltime;
architecture behave of seltime is
   signal count:std_logic_vector(2 downto 0);
begin
   sel<=count;
   process(CKDSP)
          begin
			if(reset='0')then daout<="0000";
            else 
			 if(CKDSP'event and CKDSP='1') then
				 if(count>="111") then
                    count<="000";
				 else
                    count<=count+1;
				 end if;
              end if;
			end if;
    		case count is
  			when"000"=>daout<=second(3 downto 0);
  			when"001"=>daout<=second(7 downto 4);  
  			when"010"=>daout<=minute(3 downto 0);
			when"011"=>daout<=minute(7 downto 4);
  			when"100"=>daout<=hour(3 downto 0);
			when"101"=>daout<=hour(7 downto 4);
  			when others=>null;
			end case;
  end process;
end;

⌨️ 快捷键说明

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