求教!应用vhdl有关模拟标准ps/2键盘写入数据的时序问题!
时间:10-02
整理:3721RD
点击:
写了一个非标准键盘的程序,用ps/2连接fpga开发板和电脑,实现在开发板上的矩阵键盘上按个键,然后能在电脑上显示。
下面是我的ps/2模块,请各位大神帮忙看下写出来的时序是对的吗?
下面是我的ps/2模块,请各位大神帮忙看下写出来的时序是对的吗?
- library ieee;
- use ieee.std_logic_1164.all;
- use ieee.std_logic_arith.all;
- use ieee.std_logic_unsigned.all;
- entity ps2 is
- port(en_in:in std_logic; --按键使能标志
- ym_tong:in std_logic_vector(7 downto 0); --按键对应的通码
- clk:in std_logic;
- clk1:in std_logic;
- ps2data:out std_logic;--输出ps2数据
- ps2ccclock:out std_logic; --输出ps2时钟
- xiaoyan:in std_logic; --校验位
- en:buffer std_logic; --按下按键标志
- shifangen:buffer std_logic --释放按键标志
- );
- end ps2;
- architecture one of ps2 is
- signal cnt:std_logic_vector(3 downto 0);
- signal cnt0:std_logic_vector(3 downto 0);
- signal cnt1:std_logic_vector(4 downto 0);
- signal cnt2:std_logic_vector(4 downto 0);
- signal en0,en00,en000:std_logic;
- signal shifang0,shifangen00:std_logic;
- signal ym_tong1,ym_tong2:std_logic_vector(7 downto 0);
- begin
-
- process(en_in)---
- begin
- if(clk'event and clk='1')then
- en0 ps2data ps2data ps2data ps2data ps2data ps2data ps2data ps2data ps2data ps2data ps2data ps2data ps2data ps2data ps2data ps2data ps2data ps2data ps2data ps2data ps2data ps2data ps2data NULL;
- end case;
- case cnt0 is
- when "0000" => ps2data ps2data ps2data ps2data ps2data ps2data ps2data ps2data ps2data ps2data ps2data ps2data NULL;
- end case;
- end if;
- end process;
- end architecture one;
这是仿真出来的ps/2时序图
哇 好厉害 小编真棒