aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/pyunit/dom/examples/StopWatch/Debouncer.vhdl
diff options
context:
space:
mode:
authorPatrick Lehmann <Patrick.Lehmann@plc2.de>2022-12-29 23:18:42 +0100
committerPatrick Lehmann <Patrick.Lehmann@plc2.de>2022-12-29 23:18:42 +0100
commit7ae0931d3e6733ceb76f1d884e282d7d6b5fb489 (patch)
tree02975f7b7ce0170dd608d694f714bb873adcd37d /testsuite/pyunit/dom/examples/StopWatch/Debouncer.vhdl
parent9cf69f324186932e4308e1ca0b19f563dab90e5e (diff)
downloadghdl-7ae0931d3e6733ceb76f1d884e282d7d6b5fb489.tar.gz
ghdl-7ae0931d3e6733ceb76f1d884e282d7d6b5fb489.tar.bz2
ghdl-7ae0931d3e6733ceb76f1d884e282d7d6b5fb489.zip
Improved VHDL example project.
Diffstat (limited to 'testsuite/pyunit/dom/examples/StopWatch/Debouncer.vhdl')
-rw-r--r--testsuite/pyunit/dom/examples/StopWatch/Debouncer.vhdl18
1 files changed, 17 insertions, 1 deletions
diff --git a/testsuite/pyunit/dom/examples/StopWatch/Debouncer.vhdl b/testsuite/pyunit/dom/examples/StopWatch/Debouncer.vhdl
index 4e687da0b..ef1474164 100644
--- a/testsuite/pyunit/dom/examples/StopWatch/Debouncer.vhdl
+++ b/testsuite/pyunit/dom/examples/StopWatch/Debouncer.vhdl
@@ -15,7 +15,8 @@ entity Debouncer is
CLOCK_PERIOD : time := 10 ns;
DEBOUNCE_TIME : time := 3 ms;
- BITS : positive
+ BITS : positive;
+ INPUT_SYNC : boolean := true
);
port (
Clock : in std_logic;
@@ -29,12 +30,27 @@ architecture rtl of Debouncer is
constant DEBOUNCE_COUNTER_MAX : positive := DEBOUNCE_TIME / (CLOCK_PERIOD* ite(IS_SIMULATION, 20, 1));
constant DEBOUNCE_COUNTER_BITS : positive := log2(DEBOUNCE_COUNTER_MAX);
+ signal Input_sync : Input'subtype;
begin
assert false report "CLOCK_PERIOD: " & time'image(CLOCK_PERIOD);
assert false report "DEBOUNCE_TIME: " & time'image(DEBOUNCE_TIME);
--assert false report "DEBOUNCE_COUNTER_MAX: " & to_string(10 ns);
--assert false report "INTEGER'high: " & integer'image(integer'high);
+ genSync: if INPUT_SYNC generate
+ sync: entity work.sync_Bits
+ generic map (
+ BITS => BITS
+ )
+ port map (
+ Clock => Clock,
+ Input => Input,
+ Output => Input_sync
+ );
+ else generate
+ Input_sync <= Input;
+ end generate;
+
genBits: for i in Input'range generate
signal DebounceCounter : signed(DEBOUNCE_COUNTER_BITS downto 0) := to_signed(DEBOUNCE_COUNTER_MAX - 3, DEBOUNCE_COUNTER_BITS + 1);
begin