cnt6.vhd
来自「在Xilinx环境下编写的vhdl程序」· VHDL 代码 · 共 40 行
VHD
40 行
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity cnt6 is
port (
Q: OUT std_logic_VECTOR(2 downto 0);
CLK: IN std_logic;
ACLR: IN std_logic);
end cnt6;
architecture Behavioral of cnt6 is
signal count : std_logic_vector(2 downto 0):="000"; --count
signal reset : std_logic;
signal clk_in: std_logic;
BEGIN
Q<=count;
reset<=ACLR;
clk_in<=CLK;
process (clk_in, reset,count) begin if reset='1' then count <= (others => '0'); elsif clk_in='1' and clk_in'event then
if count="101" then count<="000";
else count <= count + 1;
end if; end if;end process;
end Behavioral;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?