minute1.vhd

来自「能自动记时」· VHDL 代码 · 共 28 行

VHD
28
字号
Library ieee;                       --分钟模块
Use ieee.std_logic_1164.all;
Use ieee.std_logic_arith.all;
Use ieee.std_logic_unsigned.all;
Entity minute1 is
   Port(clkm,set,reset:in std_logic;
                 m1,m0:in std_logic_vector(3 downto 0);         --输入预置分钟数
             min1,min0:buffer std_logic_vector(3 downto 0);     --输出分钟显示     
                 enmin:out std_logic);              --分钟满60,进位,小时加1
End   minute1;
Architecture one of minute1 is
Begin
Process(clkm,reset,set,m1,m0)
  variable  cq1,cq0: STD_LOGIC_vector( 3 downto 0);
Begin
  if reset='1' then cq1:="0000"; cq0:="0000";          
    Elsif clkm'event and clkm='1' then  cq0:=cq0+1; 
       if  cq0="1010" then  cq0:="0000";cq1:=cq1+1;  --分钟低位满10,进位高位加1
       if  cq1="0110" then  cq1:="0000";enmin<='1';  --分钟高位满6,进位,小时加1
         else  enmin<='0';   
       end if;    
       end if;
  end if;
  min1<=cq1;min0<=cq0;
End process;
End  one;  

⌨️ 快捷键说明

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