scan_count.vhd

来自「【经典设计】VHDL源代码下载~~ 其中经典的设计有:【自动售货机】、【电子钟」· VHDL 代码 · 共 27 行

VHD
27
字号


--scan_count.vhd scan keypress counter
library ieee ;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity scan_count is
port(
  clk : in std_logic;--clock
  scan_f : in std_logic;--1khz clock
  key_pressed : in std_logic;--detect key_preeed to stop counter
  scan_cnt : out std_logic_vector(3 downto 0));--count
end scan_count;
architecture behavior of scan_count is 
  signal qscan : std_logic_vector(3 downto 0);
begin 
  scan_1:process(clk,scan_f,key_pressed)
  begin
    if (clk'event and clk='1') then
      if(scan_f='1' and key_pressed='1') then
        qscan<=qscan+1;
      end if;
    end if;
  end process;
  scan_cnt<=qscan;
end behavior;

⌨️ 快捷键说明

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