This website uses cookies. By using this site, you consent to the use of cookies. For more information, please take a look at our Privacy Policy.
Home > FPGA Technical Tutorials > Design Recipes for FPGAs Using Verilog and VHDL > PS/2 Mouse Interface > Basic PS/2 Mouse Handler VHDL

TABLE OF CONTENTS

Xilinx FPGA FPGA Forum

Basic PS/2 Mouse Handler VHDL

FONT SIZE : AAA

The simplest form of the VHDL handler could use the mouse clock signal as the system clock and then monitor the data coming from the mouse. This is shown here:

1 library ieee;

2 use ieee.std_logic_1164.all;

3

4 entity psmouse is

5 port (

6 clock : in std_logic;

7 data : in std_logic

8 );

9 end entity psmouse;

10

11 architecture basic of psmouse is

12 signal d : std_logic_vector (23 downto 0);

13 signal byte1 : std_logic_vector (7 downto 0);

14 signal byte2 : std_logic_vector (7 downto 0);

15 signal byte3 : std_logic_vector (7 downto 0);

16 signal index : integer :$=$ 23;

17 begin

18 process(clock) is

19 begin

20 if falling_edge(clock) then

21 d(index) <= data;

22 if index>0 then

23 index <= index−1;

24 else

25 byte1 <= d(23 downto 16);

26 byte2 <= d(15 downto 8);

27 byte3 <= d(7 downto 0);

28 index<=23;

29 end if;

30 end if;

31 end process;

32 end architecture basic;

This VHDL is very simple: on each falling edge of the clock the current value of the data is read into the next element of the data array (d) and when the complete 24-bits packet has been read in (and index has counted down to zero) then the three bytes are transcribed from the packet. 

  • XCV300-6FGG456C

    Manufacturer:Xilinx

  • FPGA Virtex Family 322.97K Gates 6912 Cells 333MHz 0.22um Technology 2.5V 456-Pin FBGA
  • Product Categories:

    Lifecycle:Obsolete -

    RoHS:

  • XC5VLX110T-3FFG1136C

    Manufacturer:Xilinx

  • FPGA Virtex-5 LXT Family 110592 Cells 65nm Technology 1V 1136-Pin FCBGA
  • Product Categories: FPGAs (Field Programmable Gate Array)

    Lifecycle:Active Active

    RoHS:

  • XC5VLX155-1FF1760C

    Manufacturer:Xilinx

  • FPGA Virtex-5 LX Family 65nm Technology 1V 1760-Pin FCBGA
  • Product Categories: Dispositif de protection de circuit

    Lifecycle:Active Active

    RoHS: No RoHS

  • XC5VLX155-1FFG1760C

    Manufacturer:Xilinx

  • FPGA Virtex-5 LX Family 65nm Technology 1V 1760-Pin FCBGA
  • Product Categories: FPGAs (Field Programmable Gate Array)

    Lifecycle:Active Active

    RoHS:

  • XC3090A-7PQ208C

    Manufacturer:Xilinx

  • FPGA XC3000 Family 6K Gates 320 Cells 113MHz 5V 208-Pin PQFP
  • Product Categories:

    Lifecycle:Obsolete -

    RoHS: No RoHS

Need Help?

Support

If you have any questions about the product and related issues, Please contact us.