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

Subversion Repositories keyboardcontroller

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 wouterw
-----------------------------------------------------------------------------------------------
2
--
3
--      Keyboard controller entity
4
--
5
-- The controller scans the columns, cols, by making a different column logic-0
6
--      therefor the inputs have to be pull-up high. It processes the input, rows, and
7
--      the pressed key to a corresponding scancode and giving an interrupt
8
--
9
--      Author: Wouter Wiggers
10
-- Mail: w.a.wiggers@student.utwente.nl
11
--
12
------------------------------------------------------------------------------------------------
13
 
14
library ieee;
15
use ieee.std_logic_1164.all;
16
use ieee.numeric_std.all;
17
 
18
use work.Constants.all;
19
 
20
entity Keyboard_controller is
21
 
22
    port (reset, clk_in : in  std_logic;
23
       clk_out : out std_logic;
24
       cols : in col;
25
       rows : out row;
26
       scan : out scancode;
27
       interrupt : out std_logic
28
       );
29
end Keyboard_controller;
30
 
31
architecture structure of Keyboard_controller is
32
 
33
    component Strober
34
    port (reset, clk : in  std_logic;
35
       strobe : in std_logic;
36
       sample : in std_logic;
37
       env_col : in col;
38
       env_row : out row;
39
       sample_col : out col;
40
       sample_row_number : out row_number
41
       );
42
    end component;
43
 
44
    component Analyser
45
     port (reset, clk : in  std_logic;
46
       analyse : in std_logic;
47
       store : in std_logic;
48
                 debounced : out std_logic;
49
                 keychanged : out std_logic;
50
       released : out std_logic;
51
       sample_col: in col;
52
       sample_row_number : in row_number;
53
       conv_col : out col_number;
54
       conv_row : out row_number
55
       );
56
    end component;
57
 
58
    component Producer
59
    port (reset, clk: in  std_logic;
60
       produce : in std_logic;
61
       released : in std_logic;
62
 
63
       conv_col : in col_number;
64
       conv_row : in row_number;
65
 
66
       scanc : out scancode;
67
       interrupt : out std_logic
68
       );
69
    end component;
70
 
71
    component FSM
72
    port (reset, clk : in  std_logic;
73
       strobe : out std_logic;
74
       sample : out std_logic;
75
       analyse : out std_logic;
76
                 store : out std_logic;
77
                 produce : out std_logic;
78
                 release : out std_logic;
79
                 debounced : in std_logic;
80
       keychanged : in std_logic; --keychange found
81
       keyreleased : in std_logic
82
       );
83
    end component;
84
 
85
 
86
    signal stb: std_logic;
87
    signal str: std_logic;
88
    signal sam: std_logic;
89
    signal ana: std_logic;
90
         signal pro: std_logic;
91
         signal rel: std_logic;
92
 
93
    signal deb: std_logic;
94
    signal keyc: std_logic;
95
    signal keyr: std_logic;
96
 
97
    signal col_sample : col;
98
    signal row_sample_number : row_number;
99
 
100
    signal col_conv : col_number;
101
    signal row_conv : row_number;
102
 
103
         signal clk : std_logic;
104
 
105
begin
106
        -- divide by 512
107
        clockdiv: process
108
        variable count : std_logic_vector(8 downto 0);
109
        begin
110
        wait until rising_edge(clk_in);
111
                count := std_logic_vector(to_unsigned( (to_integer(unsigned(count)) + 1),9 ));
112
                clk <= count(8);
113
        end process;
114
 
115
        clk_out <= clk;
116
 
117
        strb: Strober port map (reset, clk, stb, sam, cols, rows,  col_sample, row_sample_number);
118
 
119
        analys: Analyser port map (reset, clk, ana, str, deb, keyc, keyr, col_sample, row_sample_number, col_conv, row_conv);
120
 
121
        prod: Producer port map (reset, clk, pro, rel, col_conv, row_conv, scan, interrupt);
122
 
123
        finsm: FSM port map (reset, clk, stb, sam,  ana, str, pro,  rel , deb, keyc, keyr);
124
 
125
end structure;

powered by: WebSVN 2.1.0

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