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

📄 second1.vhd

📁 能自动记时
💻 VHD
字号:
Library ieee;                 --秒钟模块
Use ieee.std_logic_1164.all; 
Use ieee.std_logic_arith.all;
Use ieee.std_logic_unsigned.all;
Entity second1 is
   Port(clk,set,reset:in std_logic;
                s1,s0:in std_logic_vector(3 downto 0);   --输入预置秒钟数      
            sec1,sec0:buffer std_logic_vector(3 downto 0);  --秒钟输出    
                ensec:out std_logic);                   --满60秒输出进位,分钟加1
End  second1;
Architecture one of second1 is
Begin
Process(clk,reset,set,s1,s0)
  variable  cq1,cq0: STD_LOGIC_vector( 3 downto 0);
Begin
  if reset='1' then cq1:="0000"; cq0:="0000";             
    Elsif clk'event and clk='1' then  cq0:=cq0+1; 
       if cq0="1010" then  cq0:="0000";cq1:=cq1+1;  --秒钟低位满10,进位,高位加1
       if  cq1="0110"  then  cq1:="0000";ensec<='1';  --秒钟高位满6,进位,分钟加1
         else  ensec<='0';   
       end if;    
       end if;
   end if;
   sec1<=cq1;sec0<=cq0;
End process;
End one;  


⌨️ 快捷键说明

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