minute1.vdh

来自「能自动记时」· VDH 代码 · 共 34 行

VDH
34
字号
--分计数器
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);              --分计时器的进位,用来驱动时计数器
End;


Architecture a of minute1 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";   --对分计数器请0
            -- Elsif set='0' then cq1:=s1;cq0:=s0;     --对分计数器置数               
                Elsif clkm'event and clkm='1' then
                            cq0:=cq0+1; 
                            if  cq0="1010" then  
                            cq0:="0000";
                            cq1:=cq1+1; 
                            if  cq1="0110" then
                            cq1:="0000";   enmin<='0';       
                            end if;    
                            end if;
          end if;
       min1<=cq1;min0<=cq0;
     End process;
End;  

⌨️ 快捷键说明

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