Advertisement
wojtas626

klawiatura PS2

Jan 26th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 1.70 KB | None | 0 0
  1. entity PS2 is
  2.     port(   RESET: in std_logic;
  3.                 DATA: in std_logic;
  4.                 CLK: in std_logic;
  5.                 WYJ: out std_logic_vector(7 downto 0));
  6. end PS2;
  7.  
  8. architecture arch_ps2 of PS2 is
  9.     signal nrbitu: std_logic_vector(3 downto 0);
  10.     signal rejestr: std_logic_vector(10 downto 0);
  11.  
  12.     begin
  13.         process(RESET, CLK)
  14.             begin
  15.                 if(RESET = '1') then
  16.                     prdata <= (others => '1');
  17.                     S1 <= (others => '1');
  18.                     AKTSTAN <= '1';                
  19.  
  20.                     nrbitu <= (others => '0');
  21.                     rejestr <= (others => '0');
  22.                     WYJ <= (others => '0');
  23.                 elsif(CLK'event and CLK='0') then
  24.  
  25.                     PRDATA <= DATA & PRDATA(3 downto 1);                  
  26.                     S1 <= CLK & S1(2 downto 1);
  27.                     if (CLK + S1(2) + S1(1) < 2 and AKTSTAN = '1') then
  28.                         AKTSTAN <='0';                    
  29.                         nrbitu <= nrbitu + 1;
  30.                         if(PRDATA(4) + PRDATA(3) + PRDATA(2) + PRDATA(1) + DAtA > 2) then
  31.                             REJ <= '1' & REj(10 downto 1);
  32.                         else
  33.                             REJ <= '0' & REJ(10 downto 1);
  34.                         end if;
  35.                         if(nrbitu = 10) then
  36.                             nrbitu <= (others => '0');
  37.                             WYJ <= REJ(9 downto 2);
  38.                         end if;
  39.                     end if;
  40.                 end if;
  41.                 if(CLK+S1(2)+S1(1) > 1 and AKTSTAN = '0') then
  42.                     AKTSTAN <= '1';
  43.                 end if;
  44.         end process;
  45. end arch_ps2;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement