cnt10.vhd

来自「几个VHDL实现的源程序及其代码」· VHDL 代码 · 共 39 行

VHD
39
字号
library ieee;
use ieee.std_logic_1164.all;

entity cnt10 is
port(clk:  in std_logic;
     clr:  in std_logic;
     ena:  in std_logic;
     cq :  out integer range 0 to 15;
     carry_out: out std_logic);
end cnt10;

architecture behav of cnt10 is
signal cqi: integer range 0 to 15;
begin
process(clr,clk,ena)
begin
if(clr='1') then 
cqi<=0;
elsif(clk'event and clk='1') then
if(ena='1') then
if(cqi<9) then 
cqi<=cqi+1;
else 
cqi<=0;
end if;
end if;
end if;
end process;
process(cqi)
begin
if(cqi=9) then
carry_out<='1';
else
carry_out<='0';
end if;
end process;
cq<=cqi;
end behav;

⌨️ 快捷键说明

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