CodiodeCodiode
Home
Problem Solving
Skill Tracks
My Assignments
Contests
Leaderboard
Community
Settings
Codiode/Problems/Sequential Logic

Safe External Button Sampler

MediumLogic CircuitBuild

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: 1. Synchronize btn_in to the clock domain using a standard 2-flip-flop synchronizer. 2. 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. 3. Generate a single-cycle high pulse on pulse_out exactly 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

edge-detectorsynchronizerdebouncer

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.

Sign in to solveSee what Pro unlocks

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.

Related problems

  • 3-bit Ripple Counter from Toggle Flip-FlopsEasy
  • D Latch from a 2:1 MUXEasy
  • 2-bit Ring CounterEasy
  • T Flip-Flop from a D Flip-FlopEasy
  • Handshake Deadlock Due to Early ResetHard
  • Reconvergence of Individually Synchronized BitsHard
  • Debug: Asynchronous Clear GlitchHard
  • Clock Gate Enable Crossing DomainsHard

Browse all problems · Learning tracks