Codiode

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.

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 Interface and Communication Circuits

Problem 72 of 79 in the Interface and Communication Circuits track.

Related problems

Browse all problems · Digital logic design practice problems · Learning tracks

Solve this on a laptopSend yourself the link and continue there.