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

Shift Register Debouncer

MediumLogic CircuitBuild

Mechanical switches physically bounce upon closure, generating a rapid sequence of false logic transitions. A sampling window filters these transients to present a clean, stable signal to downstream logic.

The circuit continuously samples the raw input btn_in on the rising edge of clk. The output btn_out asserts high if and only if the four most recent samples of btn_in are all logic 1. If any of the last four samples are logic 0, btn_out remains 0. The shift register must clear all stored history when rst is asserted high.

| rst | btn_in history (oldest to newest) | btn_out | |-------|-------------------------------------|-----------| | 1 | X X X X | 0 | | 0 | 0 1 1 1 | 0 | | 0 | 1 0 1 1 | 0 | | 0 | 1 1 1 1 | 1 |

Constraints

  • Implement a 4-bit shift register using D flip-flops.
  • Drive all flip-flops with the same clk signal.
  • Clear all flip-flop states synchronously when rst is high.

Topics

debouncershift registerfilteringstate machine

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