VHDL debouncer – single switch or multiple bits

$ 0

This VHDL project contains three modules that can debounce a switch or a button or arrays of them using a generate statement.

Category: Tags: ,

Description

This design consists of three debouncer modules, where two of them have identical entities. The first is a simple switch debouncer, while the other two are capable of debouncing an n-bit vector of switches.

The first n-bit debouncer uses a process within a generate statement to duplicate the logic. The other instantiates the one-bit debouncer within a generate statement to achieve the same result.

The modules are customizable for any clock speeds or number of switches through the timeout_cycles and switch_count generics.

Entity

One-bit debouncer:

entity debouncer is
  generic (
    timeout_cycles : positive
    );
  port (
    clk : in std_logic;
    rst : in std_logic;
    switch : in std_logic;
    switch_debounced : out std_logic
  );
end debouncer; 

N-bit debouncer:

entity debouncer_n_bit is
  generic (
    switch_count : positive;
    timeout_cycles : positive
    );
  port (
    clk : in std_logic;
    rst : in std_logic;
    switches : in std_logic_vector(switch_count - 1 downto 0);
    switches_debounced : out std_logic_vector(switch_count - 1 downto 0)
  );
end debouncer_n_bit ;

Main article

Click here to read more about how I created this module:
Generate statement debouncer example

Download request form

Need the ModelSim/Questa project files?

Let me send you a Zip with everything you need to get started in 30 seconds

How does it work?

Tested on Windows and Linux Loading Gif.. How it works

    Unsubscribe at any time

    License agreement

    MIT License

    Copyright (c) 2022 Jonas Julian Jensen

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    Reviews

    There are no reviews yet.

    Be the first to review “VHDL debouncer – single switch or multiple bits”

    Your email address will not be published.