OpenCores
URL https://opencores.org/ocsvn/keyboardcontroller/keyboardcontroller/trunk

Subversion Repositories keyboardcontroller

[/] [keyboardcontroller/] [trunk/] [Producer.vhd] - Blame information for rev 6

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 wouterw
library ieee;
2
use ieee.std_logic_1164.all;
3
use ieee.numeric_std.all;
4
use ieee.std_logic_arith.sxt;
5
use work.Constants.all;
6
 
7
entity Producer is
8
        port (reset, clk: in  std_logic;
9
       produce : in std_logic;
10
       released : in std_logic;
11
 
12
       conv_col : in col_number;
13
       conv_row : in row_number;
14
 
15
       scanc : out scancode;
16
       interrupt : out std_logic
17
   );
18
 
19
end Producer;
20
 
21
architecture Producer_arc of Producer is
22
 
23
signal next_scanc: std_logic_vector(scancode_width-1 downto 0);
24
 
25
 
26
begin
27
 
28
   process(released, conv_row, conv_col)
29
 
30
       variable index: natural range 0 to 93;
31
                 variable tmp : std_logic_vector(6 downto 0);
32
 
33
   begin
34
                --make address out of col and row number of the pressed/released key
35
                tmp := std_logic_vector(to_unsigned(conv_row,4)) & std_logic_vector(to_unsigned(conv_col,3));
36
                index := to_integer(unsigned(tmp));
37
                --look-up scancode
38
                next_scanc <= set1_scancodes_lut(index);
39
                if (released='1') then
40
                        next_scanc(scancode_width-1)<='1'; --add 0x80 for keyrelease scancode
41
                end if;
42
        end process;
43
 
44
        --put values in registers on next rising edge
45
   process
46
   begin
47
   wait until rising_edge(clk);
48
   if (reset='1') then
49
      scanc <= "00000000";
50
      interrupt <= '0';
51
   elsif(produce = '1') then
52
      scanc <= next_scanc;
53
      interrupt <= '1';
54
   else
55
      interrupt <= '0';
56
        end if;
57
   end process;
58
 
59
end Producer_arc;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.