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

I2C Clock Stretching Detector

HardLogic CircuitBuild

I2C masters must accommodate slow slave devices that pause communication by holding the clock line low. This flow control mechanism requires the master to monitor the physical bus state against its own intended output.

When the master attempts to drive the clock high (scl_out is 1) but the physical bus remains low (scl_in is 0), clock stretching is active. The circuit must output a registered signal stretch_det that asserts high under this condition.

| scl_out | scl_in | Next stretch_det | |-----------|----------|--------------------| | 0 | 0 | 0 | | 0 | 1 | 0 | | 1 | 0 | 1 | | 1 | 1 | 0 |

Constraints

  • Use a D flip-flop to register the stretch_det output.
  • Implement an active-low synchronous reset using the rst_n signal.
  • Evaluate the stretch condition using strictly combinational logic before the register.

Topics

protocolflow-controli2c

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