KEYBOARD.VHD
上传用户:dgjihui88
上传日期:2013-07-23
资源大小:43k
文件大小:1k
源码类别:
VHDL/FPGA/Verilog
开发平台:
MultiPlatform
- --keyboard.vhd keyboard scanner
- library ieee ;
- use ieee.std_logic_1164.all;
- use work.components.all ;
- entity keyboard is
- port(
- clock : in std_logic ;
- col : in std_logic_vector(3 downto 0 ) ;
- row : out std_logic_vector(3 downto 0) ;
- scan_f : out std_logic ;
- key_valid : out std_logic ;
- butt_code : out std_logic_vector(3 downto 0)) ;
- end keyboard;
- architecture behavior of keyboard is
- signal scanf : std_logic ;
- signal key_pressed : std_logic ;
- signal scan_cnt : std_logic_vector(3 downto 0) ;
- begin
- divfreq: scan_gen
- generic map ( osc_f => 3686 , osc_bit => 12 )
- port map ( clock, scanf ) ;
- keycount: scan_count
- port map ( clock, scanf, key_pressed, scan_cnt ) ;
- keyscan: key_scan
- port map ( col, scan_cnt, row, key_pressed ) ;
- debounkey: debounce
- port map ( key_pressed, clock, scanf, key_valid ) ;
- coding: code_tran
- port map ( scan_cnt, clock, butt_code ) ;
- scan_f <= scanf ;
- end behavior;