A compact single-master I2C controller you drop onto your SoC bus
The Zen I2C master is a single-master I2C-bus controller a client instantiates to reach sensors, EEPROMs, PMICs and other I2C peripherals from firmware. It frames transactions on the wire — START, repeated-START and STOP, MSB-first bytes, per-byte ACK/NACK — and decouples firmware from bus timing with byte-wide TX/RX FIFOs and a single aggregated interrupt. It attaches to the common Zen peripheral bus, or to APB4 / AXI4-Lite via the standard frontends. Product / integrator view; every number is sourced from the as-built RTL or marked TBC with an owner.
1. I2C master in one paragraph
The Zen I2C master is a firmware-driven single master. Software programs the control and clock-divider registers once, pushes bytes into the TX FIFO, then issues self-clearing command pulses — START, repeated-START, READ, WRITE, STOP, plus the ACK value to drive on reads — to move each byte on the two-wire bus. It generates START/repeated-START/STOP conditions, shifts bytes MSB-first, and handles per-byte ACK/NACK: it samples the slave's ACK on writes and drives ACK/NACK on reads. When a slave holds SCL low the master stalls and reports the stretch in status, so slow devices never lose a bit. Each line is an open-drain {out, out-enable, in} triple wired to open-drain pads externally — cleanly synthesizable, no tri-state.
- Zen I2C master
- host / I2C bus
- TX / RX FIFOs
2. What it is, at a glance
| Element | Detail | Default | Status |
|---|---|---|---|
| Bus role | single-master I2C controller | — | exists |
| Addressing | 7-bit and 10-bit (selectable) | 7-bit | exists |
| Conditions | START · repeated-START · STOP | — | exists |
| Byte framing | MSB-first; 8 data + 1 ACK bit | — | exists |
| ACK/NACK | sample slave on write, drive on read | — | exists |
| Clock stretching | master stalls when slave holds SCL low | — | exists |
| SCL divider | programmable; SCL period = 4·(CLKDIV+1) clocks | 16-bit | exists |
| TX / RX FIFOs | byte-wide, per direction | 8 | exists |
| Interrupt | 1 aggregated line, 5 sources | — | exists |
| Host frontends | native peripheral bus · APB4 · AXI4-Lite | — | exists |
| Pin model | open-drain {out, oe, in} triple per line | — | exists |
| Max SCL rate / mode dividers | characterized Standard/Fast rates | TBC | TBC |
Sources: Zen I2C product datasheet; as-built RTL.
3. How a client uses it
- Instantiate the core and attach it to your host bus — the native Zen peripheral bus directly, or APB4 / AXI4-Lite through the standard frontend. Wire the open-drain SCL/SDA triples to your open-drain pads.
- Configure once — set the clock divider for your target SCL rate, select 7- or 10-bit addressing, enable the master and the interrupt sources you care about.
- Transfer — push address and data bytes into the TX FIFO, then issue command pulses (START, WRITE/READ, repeated-START for write-then-read, STOP). Reads land in the RX FIFO; writes report the slave's ACK in status.
- Service on interrupt — take the aggregated interrupt for TX-threshold, RX-nonempty, transfer-done and NACK rather than polling the wire; a NACK cleanly aborts to STOP.
4. Verification & provenance
- Methodology: assertion-based cocotb with byte-exact checks; 13 / 13 tests passing. Read and write tests use distinct values so a transfer can't false-pass, the 10-bit test checks the
11110AAfirst byte exactly, and clock-stretch carries a discriminating negative assertion. - Coverage: reset / CTRL read-back, 7-bit and 10-bit addressing both directions, NACK abort, clock stretch (un-stretched and stalled), repeated-START, START/STOP framing, the SCL-period relation 4·(CLKDIV+1), FIFO ordering, and interrupt gating / RW1C behaviour.
- Gates: Verilator DV plus a Yosys synthesis check that is latch-free (zero inferred latches); independently re-run in review.
- Provenance: delivered as a coverage-closed v1 kit, bundled with UART and SPI as the Serial I/O license kit. Internal soft-license, license-ready for external engagements.
Sources read
Sources: Zen I2C product datasheet (overview, features & compliance, functional overview, register map, performance, verification, licensing); as-built RTL.