一键导入
generate
Turn a natural language hardware description into Chisel source files. Parses requirements, confirms spec, and generates Scala code (no compile/lint/sim).
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Turn a natural language hardware description into Chisel source files. Parses requirements, confirms spec, and generates Scala code (no compile/lint/sim).
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | generate |
| description | Turn a natural language hardware description into Chisel source files. Parses requirements, confirms spec, and generates Scala code (no compile/lint/sim). |
| disable-model-invocation | true |
| allowed-tools | ["Bash","Read","Write","Edit","Grep","Glob"] |
Turn a natural language hardware description into Chisel source files.
Given a plain-English description of a digital hardware module, this command parses the requirements, confirms the spec, and generates Chisel Scala source code. It does NOT compile, lint, or simulate -- use /chip-agent:workflow for the full pipeline.
/chip-agent:generate <hardware description>
Example:
/chip-agent:generate An 8-bit ALU that supports ADD, SUB, AND, OR, XOR, and SLT operations with a zero flag output
Determine the project root directory by finding the nearest ancestor directory of this skill file that contains .claude. Use that directory as the base for all relative paths below.
After the module name is determined from the spec (Step 1), run the project-init subagent to set up the per-module project structure inside the MyDesign/ container.
Bash commands to execute:
PROJECT_ROOT="<project-root>" # e.g. /home/aa/snap/ChipAgent-main
CONTAINER="MyDesign" # all projects live inside this folder
MODULE="<ModuleName>" # e.g. ALU8
PROJECT_DIR="$PROJECT_ROOT/$CONTAINER/$MODULE"
WORKSPACE_DIR="$PROJECT_DIR/workspace"
# Create MyDesign container if it doesn't exist
mkdir -p "$PROJECT_ROOT/$CONTAINER"
# Create project folder and workspace
mkdir -p "$WORKSPACE_DIR/generated" "$WORKSPACE_DIR/sim/logs"
# Symlink chisel-project (three levels up from MyDesign/<Module>/)
rm -f "$PROJECT_DIR/chisel-project"
ln -s "../../chisel-project" "$PROJECT_DIR/chisel-project"
echo "Project initialized: $PROJECT_DIR"
Project folder structure:
<project-root>/
├── chisel-project/ ← shared, all module source lives here
├── MyDesign/ ← project container
│ ├── ALU8/
│ │ ├── chisel-project/ ← symlink → ../../chisel-project
│ │ └── workspace/
│ │ ├── generated/
│ │ ├── sim/
│ │ └── spec.json
│ ├── ALU4/
│ │ ├── chisel-project/ ← symlink → ../../chisel-project
│ │ └── workspace/
│ └── PriorityEncoder4/
│ ├── chisel-project/
│ └── workspace/
If the project folder already exists inside MyDesign/, skip creation and continue.
Read the requirement-parser agent definition at agents/requirement-parser.md (relative to project root) and follow its rules to extract a structured JSON spec from the user's hardware description ($ARGUMENTS).
The agent returns a JSON object. For simple designs: moduleName, type: "simple", ports, operations, flags, and constraints. For complex designs: moduleName, type: "complex", modules[], and topModule.
Validation: Verify the JSON is valid -- moduleName is PascalCase, all ports have direction/type/width, operations have opcodes. For complex specs, verify that topModule.submodules matches the names in modules[]. If the JSON is malformed, retry the parser once.
Step 0 MUST run first to create the project folder before writing spec.json.
Write spec to disk using the Write tool:
MyDesign/<ModuleName>/workspace/spec.json
The requirement-parser agent returns JSON to conversation only -- it does NOT write files. This step MUST capture the JSON and write it to disk so that all downstream steps can read it.
Before generating code, present the parsed spec to the user for approval.
Format the spec preview:
Ask for confirmation using AskUserQuestion with these options:
Only proceed to Step 2 after the user selects "Approve and generate".
Read the chisel-generator agent definition at agents/chisel-generator.md (relative to project root) and follow its rules with the JSON spec to produce Chisel source files. There is no /chip-agent:chisel-generate sub-skill -- this step calls the agent directly (inline).
For simple specs (type: "simple"):
The agent writes two files:
MyDesign/<ModuleName>/chisel-project/src/main/scala/chipagent/<ModuleName>.scalaGenerate.scala with the new module in the match statementFor complex specs (type: "complex"):
The agent writes N+1 files:
MyDesign/<ModuleName>/chisel-project/src/main/scala/chipagent/<SubModuleName>.scala for each entry in modules[]MyDesign/<ModuleName>/chisel-project/src/main/scala/chipagent/<TopModuleName>.scala that instantiates and wires all sub-modulesGenerate.scala with the top module name (the top module pulls in sub-modules automatically)| # | Stage | Description |
|---|---|---|
| 0 | Initialize Project | Create per-module folder with symlink + workspace |
| 1 | Parse Requirements | Extract module name, ports, operations from NL |
| 1.5 | Confirm Spec | Present parsed spec for user approval |
| 2 | Generate Chisel | Produce Chisel source from structured spec |
$ARGUMENTS
A natural language description of a digital hardware module. The description should include:
Upon completion, the following artifacts are produced in MyDesign/<ModuleName>/:
workspace/spec.json -- structured JSON specificationchisel-project/src/main/scala/chipagent/<ModuleName>.scala -- Chisel source file(s)chisel-project/src/main/scala/chipagent/Generate.scala -- updated with new module entryRun full Chipyard-to-ORFS PnR flow for large designs (SmallBOOM etc.) using All-Mock memory blackboxing in Docker: generate RTL, preprocess nosram, run multi-round ORFS synth->finish with mock SRAMs to avoid OOM.
Docker Chipyard flow: generate RTL from a Chipyard config via Docker, run SRAM mapping, stage artifacts into MyDesign, and hand off to PnR.
Run full Chipyard-to-ORFS PnR flow with multi-round parameter iteration in Docker: generate RTL from Chipyard Docker, preprocess nosram+SRAM override, run 3 rounds of ORFS synth→finish on sky130hd with progressive clock/utilization/density tuning for optimal PPA.
Run full Chipyard-to-ORFS PnR flow with multi-round parameter iteration: generate RTL from Chipyard with ENABLE_YOSYS_FLOW, preprocess nosram+SRAM override, run 3 rounds of ORFS synth→finish on sky130hd with progressive clock/utilization/density tuning for optimal PPA.
Unified Chipyard PnR flow: automatically routes to local or Docker workflow based on backend_mode setting.
Unified Chipyard flow: automatically routes to local or Docker workflow based on backend_mode setting.