PoC.io.KeyPadScanner

This module drives a one-hot encoded column vector to read back a rows vector. By scanning column-by-column it’s possible to extract the current button state of the whole keypad. The scanner uses high-active logic. The keypad size and scan frequency can be configured. The outputed signal matrix is not debounced.

Entity Declaration:

 1    ROWS                    : positive    := 4;
 2    COLUMNS                 : positive    := 4;
 3    ADD_INPUT_SYNCHRONIZERS : boolean     := TRUE
 4  );
 5  port (
 6    Clock         : in  std_logic;
 7    Reset         : in  std_logic;
 8    -- Matrix interface
 9    KeyPadMatrix  : out T_SLM(COLUMNS - 1 downto 0, ROWS - 1 downto 0);
10    -- KeyPad interface
11    ColumnVector  : out std_logic_vector(COLUMNS - 1 downto 0);
12    RowVector     : in  std_logic_vector(ROWS - 1 downto 0)
13  );
14end entity;
15
16
17architecture rtl of io_KeyPadScanner is
18  constant SHIFT_FREQ       : FREQ      := SCAN_FREQ * COLUMNS;