subcountor.vhd

来自「vhdl的很多例子」· VHDL 代码 · 共 35 行

VHD
35
字号

library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity subcountor is
 PORT( clk  :  IN  STD_LOGIC;
       rst  :  IN  STD_LOGIC;
       cont :  OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
      full  :  OUT STD_LOGIC
 );
END subcountor;
ARCHITECTURE behav OF subcountor IS
  
  SIGNAL time   :  STD_LOGIC_VECTOR(3 DOWNTO 0);
  --SIGNAL full   :  STD_LOGIC;
  --SIGNAL ll,fclk :STD_LOGIC;
  
begin
  process(rst,clk)
begin
 if rst='1' then
   time<="0000";
  elsif rising_edge(clk) then
     if time=9 then 
       time<="0000";full<='1';
        else time <=time+1;full<='0';
      end if;
   end if;
end process;
cont<=time;

end behav;


⌨️ 快捷键说明

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