The SoC pin controller that handles direction, atomic drive, and per-pin interrupts
The Zen GPIO Controller is the ubiquitous general-purpose I/O block every SoC needs, delivered as a single parameterized core. It gives firmware per-pin direction, race-free atomic output set/clear/toggle, metastability-safe synchronized input, five per-pin interrupt modes, and per-pin open-drain drive — enough to run resets, straps, LEDs, buttons, and bit-banged shared-bus lines without read-modify-write hazards. Product / integrator view; every number is sourced from the as-built RTL or marked TBC with an owner.
1. The controller in one paragraph
The Zen GPIO Controller is a parameterized WIDTH-pin I/O block — 32 pins by default — that a client drops into any SoC as its pin controller. Each pin has a direction bit, a push-pull output value, and a synchronized input read back through a 2-FF synchronizer so the SoC never samples a metastable pad. Output is updated either directly or through three atomic operations — set, clear, and toggle — each landing in one bus write, so multiple agents can share a port with no read-modify-write race. Every pin also carries its own interrupt: pick one of five modes (rising, falling, both-edge, high-level, low-level), enable it, and the block folds all enabled pending pins into a single aggregated interrupt line. Any pin can be switched to open-drain for wired-OR and bit-banged shared-bus signalling. The core attaches over the common Zen peripheral bus and reaches a SoC's APB4 or AXI4-Lite map through the standard bus-fabric frontend.
- GPIO controller
- host / pads / interrupt sink
clk_i cycles after it happens at the pad. This is the metastability guard, not a defect — budget it when timing fast handshakes. Per-pin debounce is not built in.2. What it is, at a glance
| Element | Detail | Default | Status |
|---|---|---|---|
| Pin count | parameterized WIDTH | 32 | exists |
| Per-pin direction | 1 = output, 0 = input | input | exists |
| Output drive | push-pull output data register | — | exists |
| Atomic output ops | set (W1S), clear (W1C), toggle — each one bus write | — | exists |
| Synchronized input | 2-FF synchronizer per pin, read-only | — | exists |
| Per-pin open-drain | release on '1', drive low on '0' | push-pull | exists |
| Interrupt modes | rising / falling / both-edge / high-level / low-level | — | exists |
| Per-pin interrupt enable | gates each pin into the aggregate | disabled | exists |
| Pending + clear | per-pin pending bit, write-1-clears | — | exists |
| Aggregated interrupt | single line = OR of (pending AND enable) | — | exists |
| Register access | single-cycle registered handshake | — | exists |
| Host frontend | APB4 / AXI4-Lite via bus-fabric frontend | — | TBC |
Post-synthesis fmax / timing | functional sign-off shipped; timing closure downstream | TBC | TBC |
Sources: Zen GPIO product datasheet; as-built RTL.
3. How a client uses it
- Instantiate the core at your chosen pin
WIDTHand attach it through an APB4 or AXI4-Lite bus-fabric frontend; wire the per-pin output-enable, output-value, and input triples out to your pads. - Drive outputs — set direction to output, then write the output register directly, or use the atomic set / clear / toggle ops to change only the pins you name with no read-modify-write.
- Read inputs — leave a pin as input and read its synchronized state from the input register; the value is glitch-safe through the 2-FF synchronizer.
- Take interrupts — program each pin's interrupt mode, enable it, route the aggregated interrupt line to your interrupt controller, then on assertion read the pending register, service the pin, and write 1 to clear it.
- Share a bus line — set a pin to output with open-drain enabled: drive the output low to pull the line down, release it high for the external pull-up — the pattern for bit-banged I²C-class lines and wired-OR handshakes.
4. Verification & provenance
- Compliance suite: 11 of 11 assertion-based tests pass, independently re-run by the architecture lead — covering reset and direction-to-output-enable, atomic set/clear/toggle bitwise-exact on the output, 2-FF input latency and tracking, all five interrupt modes with enable-gating and write-1-clear, open-drain release/drive behaviour, and multi-pin independence.
- Method & tooling: assertion-based cocotb with bitwise-exact checks over a shared peripheral-bus VIP; gated on a green Verilator run and the mandatory Yosys synth-check (latch-free, clean exit). Post-synthesis
fmaxis a physical-design characterization item, TBC with owner PD. - Deliverable: parameterized RTL, the peripheral-bus package, the verification IP, the 11-test compliance testbench, the micro-architecture specification, and this datasheet — shipped as one coverage-closed kit. Internal soft-license by default; structured license-ready for external engagement.
Sources: Zen GPIO product datasheet; as-built RTL.