Safe External Button Sampler
Mechanical switches bounce and create dozens of false transitions before settling. A robust input sampler must pull the asynchronous signal into the clock domain, filter out high-frequency noise, and extract a single clean pulse per button press.
Construct a complete button sampling subsystem for the asynchronous input btn_in. The circuit must perform three operations in sequence:
- Synchronize
btn_into the clock domain using a standard 2-flip-flop synchronizer. - Pass the synchronized signal through a 3-bit shift register. The internal debounced state is evaluated as high only when all 3 bits of this shift register are 1.
- Generate a single-cycle high pulse on
pulse_outexactly when the debounced state transitions from 0 to 1.
Constraints
- Use D flip-flops for all state elements.
- Build the synchronizer using exactly two D flip-flops in series.
- Build the debounce filter using exactly three D flip-flops in series.
- Extract the edge transition using combinational logic and one final state element to store the previous debounced state.
Topics
Solve this problem
Place the gates, wire them up and watch the signals settle. Every submission runs on the same simulation engine that grades it.
This problem is part of Codiode Pro. The statement above is free to read.
The circuit builder and code editor need a desktop screen. On a phone, read the problem here and open it on a laptop to solve.
Part of Clocking and Synchronization
Problem 51 of 85 in the Clocking and Synchronization track.
Related problems
Browse all problems · Digital logic design practice problems · Learning tracks