counter.vhd

来自「实现了对SD卡的SPI方式下读写操作」· VHDL 代码 · 共 26 行

VHD
26
字号
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.numeric_std.ALL;
entity counter is
generic(counter_end : integer);
port (
clk : in std_logic;
counter_out : out integer
);
end counter;

architecture behave of counter is

begin 
process(clk)
variable counter_temp : integer := 0;
begin
if rising_edge(clk)  then
counter_temp := counter_temp+1;
if counter_temp=counter_end   then
counter_temp := 0;
counter_out <= counter_end;
END IF;
end if;
end process;
end behave;

⌨️ 快捷键说明

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