RTL Studio Open IDE

Interface Protocols

I2C Arbitration Lost Detector

Detects I2C arbitration loss by comparing driven and sampled SDA values. Outputs a sticky flag until cleared.

About this block

Simulate it in the Verilog IDE

Mediumverilogsimsyn

I2C Arbitration Lost Detector is a Verilog reference block in the Interface Protocols catalog. UART, SPI, I2C, and other serial or peripheral protocol interfaces. Marked Medium: more state or a wider datapath, still one workspace in the IDE.

This IP provides a robust mechanism for detecting I2C arbitration loss.

It adheres to the I2C specification for open-drain bus monitoring.

The sticky flag ensures that the event is not missed by the controller.

  1. Choose Open in IDE. RTL Studio loads the packaged workspace for I2C Arbitration Lost Detector.
  2. Read the Verilog module in the editor. The catalog line for this block: Detects I2C arbitration loss by comparing driven and sampled SDA values. Outputs a sticky flag until cleared.
  3. Run the packaged testbench with the in-browser Verilator simulator, then open the VCD in the waveform viewer.
  4. Run Yosys in the same IDE for a generic netlist. Sky130 liberty mapping is a separate Pro library option.

RTL Studio is the Verilog simulator and IDE around this block: Slang lint, Verilator, VCD waveforms, and Yosys, in the browser. Simulation guide · Yosys guide.

Features

  • Arbitration Loss Detection: Detects when SDA is driven low but sampled high.
  • Sticky Flag: The arb_lost signal remains asserted until explicitly cleared.
  • Flexible Reset: Supports both asynchronous active-low reset (rst_n) and synchronous active-high clear (clr).
  • Low Latency: Combinational comparison with synchronous latching.

Ports

Port NameDirectionWidthDescription
clkInput1Clock input
rst_nInput1Active-low asynchronous reset
sda_inInput1Sampled SDA line value
sda_driveInput1Value driven onto SDA line
clrInput1Active-high clear signal
arb_lostOutput1Sticky arbitration lost flag

Architecture

The following block diagram illustrates the internal logic flow.

The core logic compares the driven value against the sampled value. If the driven value is low and the sampled value is high, the flag sets. The flag is sticky and does not clear automatically when the condition ends. An asynchronous reset clears the flag to zero. An active-high clear signal also resets the flag synchronously.

Verification

The testbench verifies normal operation and arbitration loss scenarios. It checks that the flag remains zero during normal driving conditions. It confirms detection when driving low and sampling high. It validates the sticky behavior after the condition clears. It ensures the clear signal resets the flag correctly. It verifies the asynchronous reset functionality.

Test CaseConditionExpected ResultStatus
TC1Drive H, Sample Harb_lost = 0PASS
TC2Drive L, Sample Larb_lost = 0PASS
TC3Drive L, Sample Harb_lost = 1PASS
TC4Condition Removedarb_lost = 1 (Sticky)PASS
TC5Clear Assertedarb_lost = 0PASS
TC6Reset Assertedarb_lost = 0PASS

All six test cases passed successfully. The simulation log confirms correct behavior for all scenarios. No errors were reported during the test run.

More in Interface Protocols

All Interface Protocols blocks