RTL Studio Open IDE

Interface Protocols

I2C Start/Stop Detector

Detects I2C Start and Stop conditions synchronously on the SCL rising edge.

About this block

Simulate it in the Verilog IDE

Mediumverilogsimsyn

I2C Start/Stop 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 core detects I2C Start and Stop conditions on the SDA and SCL lines. It operates synchronously to the SCL rising edge, outputting a pulse when a Start condition (SDA High-to-Low while SCL High) or a Stop condition (SDA Low-to-High while SCL High) is detected.

The design is fully synchronous and suitable for integration into I2C master or slave controllers.

  1. Choose Open in IDE. RTL Studio loads the packaged workspace for I2C Start/Stop Detector.
  2. Read the Verilog module in the editor. The catalog line for this block: Detects I2C Start and Stop conditions synchronously on the SCL rising edge.
  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.

Interface

The module has four ports as defined in the table below.

Port NameDirectionWidthDescription
sda_iInput1I2C Data Line
scl_iInput1I2C Clock Line
start_oOutput1Active High when Start condition is detected
stop_oOutput1Active High when Stop condition is detected

Architecture

The detector operates synchronously to the SCL rising edge. It samples the SDA line on each rising edge of SCL. A Start condition is identified when SDA transitions from High to Low while SCL is High. A Stop condition is identified when SDA transitions from Low to High while SCL is High.

Verification

The testbench verifies the following scenarios:

Test CaseDescriptionExpected Result
TC1Idle State CheckBoth outputs are Low
TC2Start Conditionstart_o goes High
TC3Stop Conditionstop_o goes High
TC4No Detection on SCL LowBoth outputs remain Low
TC5Reset FunctionalityOutputs return to Idle state

All tests passed successfully in the simulation log.

More in Interface Protocols

All Interface Protocols blocks