From: Pierre C. <Sup...@us...> - 2010-01-18 19:13:44
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot-resources". The branch, master has been updated via 4e73c71039b1931729e4f364c68d8ad0301064ac (commit) from 2d18070871a5b76a7a2dc20c9371a4f77b9588e2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4e73c71039b1931729e4f364c68d8ad0301064ac Author: chambart <cha...@cr...> Date: Mon Jan 18 20:13:09 2010 +0100 add an ugly (but working) version of ps2.vh2 ----------------------------------------------------------------------- Changes: diff --git a/fpga/components/ps2_ugly.vhd b/fpga/components/ps2_ugly.vhd new file mode 100644 index 0000000..402af96 --- /dev/null +++ b/fpga/components/ps2_ugly.vhd @@ -0,0 +1,75 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.std_logic_unsigned.all; + +entity driver_ps2 is + port (clk : in std_logic; + ps2d : in std_logic; + ps2c : in std_logic; + data : out std_logic_vector ( 0 to 7 ); + int : out std_logic; + -- only for debugging purpose + st : out std_logic_vector ( 4 downto 0 ) ); +end entity driver_ps2; + +architecture driver_ps2 of driver_ps2 is +type state_type is ( bit0, bit1, bit2, bit3, bit4, bit5, bit6, bit7, + bit8, bit9, end_state ); +signal tmp : std_logic_vector ( 9 downto 0 ) := "0000000000"; +signal state : state_type := bit0; +signal got : std_logic := '0'; +signal int_l : std_logic := '0'; +signal data_l : std_logic_vector ( 0 to 7 ) := "00000000"; +signal ps2c_old : std_logic := '1'; +begin + +int <= int_l; +data <= data_l; + +process (ps2c) +begin + if (falling_edge(ps2c)) + then + case state is + when bit0 => + state <= bit1; + tmp(0) <= ps2d; + when bit1 => + state <= bit2; + tmp(1) <= ps2d; + when bit2 => + state <= bit3; + tmp(2) <= ps2d; + when bit3 => + state <= bit4; + tmp(3) <= ps2d; + when bit4 => + state <= bit5; + tmp(4) <= ps2d; + when bit5 => + state <= bit6; + tmp(5) <= ps2d; + when bit6 => + state <= bit7; + tmp(6) <= ps2d; + when bit7 => + state <= bit8; + tmp(7) <= ps2d; + when bit8 => + state <= bit9; + tmp(8) <= ps2d; + when bit9 => + state <= end_state; + tmp(9) <= ps2d; + int_l <= '1'; + data_l <= tmp(8 downto 1); + when end_state => + state <= bit0; + int_l <= '0'; + end case; + + st <= "00000"; + end if; +end process; + +end driver_ps2; hooks/post-receive -- krobot-resources |