The AND-gate at the end means you're debouncing only positive edges, not negative. So a momentary 0 will cause a second press to be detected. A consensus sort of gate and flip-flop could avoid preferring 0, something like:
process (clk)
begin if rising_edge(clk) then in1<=in0; in2<=in1; if in1=in2 then out<=in1; end if; end if;
end process;
Another method might be using asynchronous SR-latches to detect input instability, and only switch if stable.
Very nice! Thanks!
Lagonz2000 4 months ago
voted up simply for mentioning metastability cos hardly anyone believes me when I describe it to people:
"that can't happen!!!"
wolfekeeper 5 months ago
very good
tear086 1 year ago
watching this video help me understand a lot about metastability
0sys0 1 year ago
The AND-gate at the end means you're debouncing only positive edges, not negative. So a momentary 0 will cause a second press to be detected. A consensus sort of gate and flip-flop could avoid preferring 0, something like:
process (clk)
begin if rising_edge(clk) then in1<=in0; in2<=in1; if in1=in2 then out<=in1; end if; end if;
end process;
Another method might be using asynchronous SR-latches to detect input instability, and only switch if stable.
YTrefusesAllNames 2 years ago
excellent!!!! exactly what I have needed. thanks a lot
sahhaf1234 2 years ago