agent-r2g
A Claude Code skill that drives an open-source RTL-to-GDS flow — from natural-language spec (or existing RTL) through synthesis, place-and-route, and full signoff (DRC, LVS, RCX) — using Yosys, OpenROAD-flow-scripts, KLayout, and OpenRCX.
Install the r2g-rtl2gds skill, then ask Claude: "synthesize this UART at 100 MHz on nangate45" — it handles everything from RTL generation to GDSII.
Prerequisites
| Tool | Required | Purpose |
|---|
| Python 3.10+ | yes | skill scripts |
| Yosys | yes | synthesis |
| iverilog / vvp | yes | simulation |
| OpenROAD + ORFS | yes | place & route, RCX |
| Verilator | optional | faster lint |
| KLayout | optional | GDS viewer, DRC, LVS |
| Magic + Netgen | optional | sky130 DRC / LVS |
| OpenSTA | optional | standalone STA |
| sky130A PDK | optional | sky130 signoff |
Install the skill
git clone https://github.com/ShenShan123/agent-r2g.git
cd agent-r2g
./install.sh --user # copy to ~/.claude/skills/r2g-rtl2gds
Restart Claude Code (or run /reload) after install.
Other options:
./install.sh --user # global — available in every Claude Code session (default)
./install.sh --project . # local — scoped to the current project directory
./install.sh --link --user # symlink — edits are picked up without reinstalling
./install.sh --force --user # overwrite an existing install
./install.sh --uninstall # remove
Installing from the skill directory alone (no full repo clone needed):
cd r2g-rtl2gds
./install.sh --user
Configure the OpenROAD toolchain
The skill autodetects every tool on first use. No source or export is required if your tools land in standard locations. Use check_env.sh to see exactly what was found (see Verify).
Choose the path that matches your situation.
Path A — Shared EDA server with a pre-built toolchain (fastest)
If /opt/openroad_tools_env.sh exists (e.g. a shared EDA workstation), the skill sources it automatically. Jump straight to Verify.
Path B — Build ORFS from source (recommended for a clean Linux install)
OpenROAD-flow-scripts builds its own openroad and yosys, so one clone gives you the whole flow.
1. System packages (run once as root — Debian / Ubuntu):
sudo apt update
sudo apt install build-essential cmake git python3 python3-pip \
iverilog klayout tcl-dev libboost-dev flex bison
For RHEL / Fedora / CentOS, replace apt with dnf / yum and adjust package names accordingly.
2. Clone and build ORFS (~30 min on 8 cores):
git clone --recursive https://github.com/The-OpenROAD-Project/OpenROAD-flow-scripts \
~/OpenROAD-flow-scripts
cd ~/OpenROAD-flow-scripts
sudo ./etc/DependencyInstaller.sh # installs remaining build deps
./build_openroad.sh --local # builds openroad + yosys under tools/install/
After the build, the skill autodetects both binaries from $ORFS_ROOT/tools/install/ if you set ORFS_ROOT. Do that in env.local.sh (one line):
cp ~/.claude/skills/r2g-rtl2gds/references/env.local.sh.template \
~/.claude/skills/r2g-rtl2gds/references/env.local.sh
# Add this one line to env.local.sh:
echo 'export ORFS_ROOT="$HOME/OpenROAD-flow-scripts"' \
>> ~/.claude/skills/r2g-rtl2gds/references/env.local.sh
Path C — OSS-CAD-Suite + separate OpenROAD binary
OSS-CAD-Suite provides pre-built Yosys, iverilog, and Verilator. Pair it with a pre-built OpenROAD binary (from the OpenROAD releases page or your distro).
# Download OSS-CAD-Suite (check https://github.com/YosysHQ/oss-cad-suite-build for latest tag)
curl -LO https://github.com/YosysHQ/oss-cad-suite-build/releases/latest/download/oss-cad-suite-linux-x64.tgz
tar -xf oss-cad-suite-linux-x64.tgz -C "$HOME" # extracts to ~/oss-cad-suite
# Install OpenROAD binary (Debian / Ubuntu)
sudo apt install openroad
# Clone ORFS for the flow Makefile (no build needed here)
git clone --recursive https://github.com/The-OpenROAD-Project/OpenROAD-flow-scripts \
~/OpenROAD-flow-scripts
Then set all paths in env.local.sh:
export ORFS_ROOT="$HOME/OpenROAD-flow-scripts"
export YOSYS_EXE="$HOME/oss-cad-suite/bin/yosys"
export IVERILOG_EXE="$HOME/oss-cad-suite/bin/iverilog"
export VVP_EXE="$HOME/oss-cad-suite/bin/vvp"
export VERILATOR_EXE="$HOME/oss-cad-suite/bin/verilator"
export OPENROAD_EXE="/usr/bin/openroad"
export KLAYOUT_CMD="/usr/bin/klayout"
env.local.sh — full reference
The file lives at ~/.claude/skills/r2g-rtl2gds/references/env.local.sh. Copy it from the template and edit:
cp ~/.claude/skills/r2g-rtl2gds/references/env.local.sh.template \
~/.claude/skills/r2g-rtl2gds/references/env.local.sh
All keys are optional — uncomment only the lines that the autodetect gets wrong.