PS2VHDL.vhd
资源名称:PS2.rar [点击查看]
上传用户:keloyb
上传日期:2022-08-09
资源大小:256k
文件大小:3k
源码类别:
VHDL/FPGA/Verilog
开发平台:
Others
- ---------------------------------------------------------------------------------------------------
- --*************************************************************************************************
- -- CreateDate : 2007-07-12
- -- ModifData : 2007-07-12
- -- Description : PS2 ( Synchronous, Data bits: 8 )
- -- Author : Explorer01
- -- Version : V1.0
- --*************************************************************************************************
- ---------------------------------------------------------------------------------------------------
- -- VHDL library Declarations
- LIBRARY IEEE;
- USE IEEE.std_logic_1164.ALL;
- USE IEEE.std_logic_unsigned.ALL;
- ---------------------------------------------------------------------------------------------------
- ---------------------------------------------------------------------------------------------------
- -- The Entity Declarations
- ENTITY PS2VHDL IS
- PORT
- (
- RESET: IN STD_LOGIC;
- KBDATA: IN STD_LOGIC;
- KBCLK: IN STD_LOGIC;
- EOC: OUT STD_LOGIC;
- PDATA: OUT STD_LOGIC_VECTOR(7 DOWNTO 0)
- );
- END PS2VHDL;
- ---------------------------------------------------------------------------------------------------
- ---------------------------------------------------------------------------------------------------
- -- The Architecture of Entity Declarations
- ARCHITECTURE PS2VHDL_arch OF PS2VHDL IS
- SIGNAL spdata: STD_LOGIC_VECTOR(10 DOWNTO 0);
- SIGNAL TT: STD_LOGIC;
- SIGNAL cnt8: INTEGER RANGE 0 TO 10;
- BEGIN
- -------------------------------------------------
- -- Optimize ??????????????????????????????????
- PROCESS( KBCLK, TT )
- BEGIN
- IF KBCLK = '0' THEN TT <= '0';
- ELSE TT <= '1';
- END IF;
- END PROCESS;
- -------------------------------------------------
- -- Recevie
- Recevie: PROCESS( RESET, TT, KBDATA, spdata, cnt8 )
- BEGIN
- IF RESET = '0' THEN
- cnt8 <= 0; spdata <= "00000000000";
- ELSIF TT'event AND TT = '0' THEN
- IF( cnt8 < 10 ) THEN
- spdata(cnt8) <= KBDATA;
- cnt8 <= cnt8 + 1;
- ELSE
- cnt8 <= 0;
- END IF;
- END IF;
- END PROCESS;
- -------------------------------------------------
- -- End of recevie ???????????????????????????
- PROCESS( RESET, cnt8 )
- BEGIN
- IF RESET = '0' THEN EOC <= '0';
- ELSIF cnt8 /= 0 THEN EOC <= '1';
- ELSE EOC <= '0';
- END IF;
- END PROCESS;
- -------------------------------------------------
- -------------------------------------------------
- PDATA <= spdata( 8 downto 1 );
- END PS2VHDL_arch;