wokwi-customchip

Generate and test Wokwi custom simulation chips in Zig 0.16 compiled to WebAssembly.

Updated Mar 15, 2026
One-click install
npx skills add https://github.com/mohankumargupta/skills --skill wokwi-customchip-mohankumargupta
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: wokwi-customchip
Source: https://github.com/mohankumargupta/skills/tree/main/wokwi-customchip
Command: npx skills add https://github.com/mohankumargupta/skills --skill wokwi-customchip-mohankumargupta

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and assets (resource) components.

What problem does it solve? Writing a Wokwi custom chip requires correctly modeling a device's register encoding, pin behavior, and bus protocol against the Wokwi Chips API, and small encoding mistakes silently produce wrong simulation results. This Skill provides a deterministic pipeline that reuses validated conversion functions, enforces unit-tested register encoding, and validates the chip with zig build test before delivery. ## Core Features & Use Cases - Zig 0.16 chip generation: Produces chip.zig implementing the Wokwi Custom Chips API (GPIO, I2C, SPI, UART, attributes, timers) compiled to WebAssembly. - Canonical conversion reuse: Ports previously validated register-to-real-world-value conversion functions verbatim instead of re-deriving encodings from potentially inconsistent datasheets. - Mandatory unit testing: Requires test blocks asserting exact encoded register values, validated via zig fmt, zig build, and zig build test before outputs are copied. - Use Case: Given a device spec and test spec for a temperature sensor like the TMP102, generate a Wokwi I2C custom chip whose temperature register encoding is unit-tested against known values, with the address derived from a strapped ADD0 pin rather than a fake attribute. ## Quick Start Create a Wokwi custom chip for the tmp102 device in Zig 0.16 using the spec and test spec in the outputs directory.

Frequently Asked Questions about wokwi-customchip

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a Wokwi custom chip in Zig?▼

Write a chip.zig implementing chip_init against the Wokwi Custom Chips API, compile it to WebAssembly with zig build, and define the pinout in a chip.json file. This Skill generates the Zig 0.16 code from a device spec and validates it with zig build test.

How do I simulate an I2C sensor in Wokwi?▼

Use the Wokwi I2C Device API: call i2c_init with the device address, SCL/SDA pins, and connect/read/write callbacks. The chip responds to bus transactions and returns register bytes encoding the current sensor value.

Can Wokwi custom chips be written in languages other than C?▼

Yes, any language compiling to WebAssembly works, including Zig, Rust, and AssemblyScript. This Skill targets Zig 0.16 using a Zig port of the wokwi-api.h C header.

Why should chip attributes not be used for I2C address configuration?▼

Addresses on real hardware are set by strapping pins like ADD0, so they should be modeled as input pins read at chip_init, not attrInit attributes. Exposing them as attributes invites diagram.json authors to override them incorrectly.

Why does the chip require unit tests for register encoding?▼

Datasheet register-map tables can contradict their own bit-field tables, so re-derived encodings can be silently wrong. Unit tests asserting exact encoded bytes against validated conversion functions catch these errors before simulation.