PoC.io.Debounce

This module debounces several input pins preventing input changes following a previous one within the configured BOUNCE_TIME to pass. Internally, the forwarded state is locked for, at least, this BOUNCE_TIME. As the backing timer is restarted on every input fluctuation, the next passing input update must have seen a stabilized input.

The parameter COMMON_LOCK uses a single internal timer for all processed inputs. Thus, all inputs must stabilize before any one may pass changed. This option is usually fully acceptable for user inputs such as push buttons.

The parameter ADD_INPUT_SYNCHRONIZERS triggers the optional instantiation of a two-FF input synchronizer on each input bit.

Entity Declaration:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
entity io_Debounce is
  generic (
    CLOCK_FREQ              : FREQ;
    BOUNCE_TIME             : time;
    BITS                    : positive := 1;
    INIT                    : std_logic_vector    := x"00000000"; -- initial state of Output
    ADD_INPUT_SYNCHRONIZERS : boolean  := true;
    COMMON_LOCK             : boolean  := false
  );
  port (
    Clock   : in  std_logic;
    Reset   : in  std_logic             := '0';
    Input   : in  std_logic_vector(BITS-1 downto 0);
    Output  : out std_logic_vector(BITS-1 downto 0) := resize(descend(INIT), BITS)
  );
end entity;