Spinal Pro
Target SpinalHDL version: 1.10+ (rules and APIs validated against the
master branch of SpinalDoc-RTD).
When To Use
Load this skill when the task involves:
- writing or modifying SpinalHDL RTL
- reviewing SpinalHDL for semantic bugs, interface bugs, timing-risky
structure, or maintainability issues
- explaining SpinalHDL DSL behavior (
:=, \=, <>, when, switch,
ClockDomain, Stream, Flow, Bundle, Vec, StateMachine, Mem)
- decoding SpinalHDL elaboration errors (
WIDTH MISMATCH, LATCH DETECTED, CLOCK CROSSING VIOLATION, …)
- designing parameterized blocks, buses, peripherals, plugin-oriented
components, or CPU/SoC structure
- validating SpinalHDL work through
SimConfig / doSim, focused
simulation, or repo-native tests
- using VexRiscv as a pattern source for larger architecture decisions
Do Not Use
Do not load this skill for tasks that are purely about general Scala,
vendor EDA flows, RTL in non-SpinalHDL languages, or unrelated hardware
topics — unless SpinalHDL semantics or SpinalHDL code is central to the
task.
Workflow
- Identify the task type: generate, modify, review, explain,
retrieve, or design.
- Open the relevant references for the task type (see table below).
- Inspect the local repository if the task touches code:
target file(s), build entry points, tests, generators, simulation
hooks, and nearby conventions. Skip this step for pure
explanation/retrieval tasks.
- Use evidence in priority order: official SpinalHDL semantics for
language rules, project-local conventions for style, VexRiscv-style
examples for architecture and engineering patterns.
- Produce the smallest evidence-backed answer or change that solves
the task.
- Validate locally when feasible (elaboration → focused sim → repo
regression).
- Return an auditable result with source tags, assumptions, and the
next verification step.
Reference Selection
Open the most relevant file first. If the task crosses categories, open
all that apply.
| Task type |
Open first |
Open also |
| Explain a DSL construct or rule |
references/language-semantics.md |
references/errors-cheatsheet.md for related errors |
| Decode an elaboration error message |
references/errors-cheatsheet.md |
references/language-semantics.md for the rule citation |
| Write a new module or peripheral |
references/rtl-recipes.md |
references/language-semantics.md for tricky rules |
| Add a register bank or memory-mapped block |
references/rtl-recipes.md (BusSlaveFactory + Mem) |
references/architecture-patterns.md (SoC integration) |
| Build or modify a pipeline |
references/architecture-patterns.md (Pipeline library) |
references/vexriscv-casebook.md only if studying VexRiscv |
| Add or restructure a plugin / service |
references/architecture-patterns.md (Plugin composition) |
references/vexriscv-casebook.md for stage interactions |
| Code review, bug triage |
references/review-checklist.md |
references/errors-cheatsheet.md, references/language-semantics.md |
| Write or extend a testbench |
references/simulation-validation.md |
references/rtl-recipes.md for the DUT pattern |
| Study mature CPU/SoC patterns |
references/vexriscv-casebook.md |
references/architecture-patterns.md |
If a referenced local corpus (SpinalDoc-RTD/, VexRiscv/) is not
present in the environment, fall back to the URL listed next to each
anchor (https://spinalhdl.github.io/SpinalDoc-RTD/master/... for
docs, https://github.com/SpinalHDL/... for VexRiscv). If both the
local path and the URL are unreachable, say so in the response — do not
paraphrase from memory.
High-Risk Guardrails
Treat the following as high-risk and require explicit evidence plus
tighter validation:
- clock and reset strategy, including clock-domain boundaries
Stream / Flow / bus handshake correctness
- width inference, truncation, sign extension, literal sizing, resize behavior
- combinational vs sequential boundaries, latch risk, combinational loops
- parameter-driven structural changes
- plugin interactions, stage coupling, hidden side effects
- major CPU or SoC refactors that weaken validation coverage
Detection triggers — when any of these appear in the diff or question,
escalate to high-risk mode:
.resized, .resize(...) across module boundaries
.asUInt / .asSInt / assignFromBits(...)
allowOverride, allowUnsetRegToAvoidLatch, comb-loop suppression
setAsReg(), randBoot()
- new
ClockDomain(...) or ClockingArea(...)
BufferCC, PulseCCByToggle, StreamCCByToggle, FlowCCUnsafeByToggle
Mem(...) with readUnderWrite = writeFirst
\= on anything that might be a register
For high-risk tasks:
- prefer smaller patches over broad rewrites
- state assumptions instead of guessing
- preserve existing interfaces unless evidence supports a change
- avoid cargo-culting from VexRiscv without matching stage timing, reset
behavior, and service dependencies
- strengthen validation before declaring the result safe
Output Contract
Annotate every load-bearing claim with one of these source tags so a
reviewer can audit at a glance:
[Doc] — pinned by an official SpinalDoc rule (cite the anchor or URL)
[Repo] — derived from the current repository's code or conventions
[VexRiscv-pattern] — derived from a mature SpinalHDL codebase
[Inference] — your interpretation; flag remaining uncertainty
Depth heuristic — pick one of three modes based on what the user
demonstrates:
- Direct: experienced user, terse question → short answer with code
and one citation; skip background.
- Guided: mixed or unclear → answer + a one-line "why this matters"
- Teaching: clear beginner cue (asks what
:= is, what Bundle
means, etc.) → answer + minimal example + the rule citation, but stop
short of unrelated background.
End any non-trivial output with:
- a one-line statement of which source category dominated the answer
- unresolved risks or assumptions, if any
- the next verification step (a sim command, a file to inspect, a
reviewer to flag) when certainty is incomplete
Recipes Directory
references/
├── language-semantics.md # DSL rules, operators, width, registers, when/switch, Bundle/Vec
├── rtl-recipes.md # Module skeletons, Stream toolkit, Mem, BusSlaveFactory, FSM, CDC, SpinalConfig
├── architecture-patterns.md # Decomposition, Pipeline library, plugin composition, SoC patterns
├── review-checklist.md # Review order, detection signals, output pattern
├── errors-cheatsheet.md # One-screen error → cause → fix lookups
├── simulation-validation.md # SpinalSim API, testbench templates, validation ladder
└── vexriscv-casebook.md # VexRiscv patterns with preconditions and anti-patterns
Evidence Sources
1---2name: spinal-pro3description: End-to-end SpinalHDL skill for generating, reviewing, explaining, and validating RTL (Scala HDL). Covers DSL semantics (`:=`, `<>`, `Reg`, `Stream`, `Flow`, `Bundle`, `Vec`, `ClockDomain`, `StateMachine`, `Mem`, `BusSlaveFactory`), pipeline and plugin composition (`spinal.lib.misc.pipeline`, `spinal.lib.misc.plugin`), simulation with `SimConfig`/`doSim`, and architecture patterns drawn from official SpinalHDL docs and VexRiscv. Load for SpinalHDL DSL questions, module implementation, interface design, SoC integration, bug hunting, error-message decoding, and simulation or build validation.4---56# Spinal Pro78Target SpinalHDL version: 1.10+ (rules and APIs validated against the9`master` branch of SpinalDoc-RTD).1011## When To Use1213Load this skill when the task involves:1415- writing or modifying SpinalHDL RTL16- reviewing SpinalHDL for semantic bugs, interface bugs, timing-risky17 structure, or maintainability issues18- explaining SpinalHDL DSL behavior (`:=`, `\=`, `<>`, `when`, `switch`,19 `ClockDomain`, `Stream`, `Flow`, `Bundle`, `Vec`, `StateMachine`, `Mem`)20- decoding SpinalHDL elaboration errors (`WIDTH MISMATCH`, `LATCH21 DETECTED`, `CLOCK CROSSING VIOLATION`, …)22- designing parameterized blocks, buses, peripherals, plugin-oriented23 components, or CPU/SoC structure24- validating SpinalHDL work through `SimConfig` / `doSim`, focused25 simulation, or repo-native tests26- using VexRiscv as a pattern source for larger architecture decisions2728## Do Not Use2930Do not load this skill for tasks that are purely about general Scala,31vendor EDA flows, RTL in non-SpinalHDL languages, or unrelated hardware32topics — unless SpinalHDL semantics or SpinalHDL code is central to the33task.3435## Workflow36371. **Identify the task type**: generate, modify, review, explain,38 retrieve, or design.392. **Open the relevant references** for the task type (see table below).403. **Inspect the local repository** *if* the task touches code:41 target file(s), build entry points, tests, generators, simulation42 hooks, and nearby conventions. Skip this step for pure43 explanation/retrieval tasks.444. **Use evidence in priority order**: official SpinalHDL semantics for45 language rules, project-local conventions for style, VexRiscv-style46 examples for architecture and engineering patterns.475. **Produce the smallest evidence-backed answer or change** that solves48 the task.496. **Validate locally** when feasible (elaboration → focused sim → repo50 regression).517. **Return an auditable result** with source tags, assumptions, and the52 next verification step.5354## Reference Selection5556Open the most relevant file first. If the task crosses categories, open57all that apply.5859| Task type | Open first | Open also |60| --- | --- | --- |61| Explain a DSL construct or rule | `references/language-semantics.md` | `references/errors-cheatsheet.md` for related errors |62| Decode an elaboration error message | `references/errors-cheatsheet.md` | `references/language-semantics.md` for the rule citation |63| Write a new module or peripheral | `references/rtl-recipes.md` | `references/language-semantics.md` for tricky rules |64| Add a register bank or memory-mapped block | `references/rtl-recipes.md` (BusSlaveFactory + Mem) | `references/architecture-patterns.md` (SoC integration) |65| Build or modify a pipeline | `references/architecture-patterns.md` (Pipeline library) | `references/vexriscv-casebook.md` only if studying VexRiscv |66| Add or restructure a plugin / service | `references/architecture-patterns.md` (Plugin composition) | `references/vexriscv-casebook.md` for stage interactions |67| Code review, bug triage | `references/review-checklist.md` | `references/errors-cheatsheet.md`, `references/language-semantics.md` |68| Write or extend a testbench | `references/simulation-validation.md` | `references/rtl-recipes.md` for the DUT pattern |69| Study mature CPU/SoC patterns | `references/vexriscv-casebook.md` | `references/architecture-patterns.md` |7071If a referenced local corpus (`SpinalDoc-RTD/`, `VexRiscv/`) is not72present in the environment, fall back to the URL listed next to each73anchor (`https://spinalhdl.github.io/SpinalDoc-RTD/master/...` for74docs, `https://github.com/SpinalHDL/...` for VexRiscv). If both the75local path and the URL are unreachable, say so in the response — do not76paraphrase from memory.7778## High-Risk Guardrails7980Treat the following as high-risk and require explicit evidence plus81tighter validation:8283- clock and reset strategy, including clock-domain boundaries84- `Stream` / `Flow` / bus handshake correctness85- width inference, truncation, sign extension, literal sizing, resize behavior86- combinational vs sequential boundaries, latch risk, combinational loops87- parameter-driven structural changes88- plugin interactions, stage coupling, hidden side effects89- major CPU or SoC refactors that weaken validation coverage9091Detection triggers — when any of these appear in the diff or question,92escalate to high-risk mode:9394- `.resized`, `.resize(...)` across module boundaries95- `.asUInt` / `.asSInt` / `assignFromBits(...)`96- `allowOverride`, `allowUnsetRegToAvoidLatch`, comb-loop suppression97- `setAsReg()`, `randBoot()`98- new `ClockDomain(...)` or `ClockingArea(...)`99- `BufferCC`, `PulseCCByToggle`, `StreamCCByToggle`, `FlowCCUnsafeByToggle`100- `Mem(...)` with `readUnderWrite = writeFirst`101- `\=` on anything that might be a register102103For high-risk tasks:104105- prefer smaller patches over broad rewrites106- state assumptions instead of guessing107- preserve existing interfaces unless evidence supports a change108- avoid cargo-culting from VexRiscv without matching stage timing, reset109 behavior, and service dependencies110- strengthen validation before declaring the result safe111112## Output Contract113114Annotate every load-bearing claim with one of these source tags so a115reviewer can audit at a glance:116117- `[Doc]` — pinned by an official SpinalDoc rule (cite the anchor or URL)118- `[Repo]` — derived from the current repository's code or conventions119- `[VexRiscv-pattern]` — derived from a mature SpinalHDL codebase120- `[Inference]` — your interpretation; flag remaining uncertainty121122Depth heuristic — pick one of three modes based on what the user123demonstrates:124125- **Direct**: experienced user, terse question → short answer with code126 and one citation; skip background.127- **Guided**: mixed or unclear → answer + a one-line "why this matters"128 + one citation.129- **Teaching**: clear beginner cue (asks what `:=` is, what `Bundle`130 means, etc.) → answer + minimal example + the rule citation, but stop131 short of unrelated background.132133End any non-trivial output with:134135- a one-line statement of which source category dominated the answer136- unresolved risks or assumptions, if any137- the next verification step (a sim command, a file to inspect, a138 reviewer to flag) when certainty is incomplete139140## Recipes Directory141142```143references/144├── language-semantics.md # DSL rules, operators, width, registers, when/switch, Bundle/Vec145├── rtl-recipes.md # Module skeletons, Stream toolkit, Mem, BusSlaveFactory, FSM, CDC, SpinalConfig146├── architecture-patterns.md # Decomposition, Pipeline library, plugin composition, SoC patterns147├── review-checklist.md # Review order, detection signals, output pattern148├── errors-cheatsheet.md # One-screen error → cause → fix lookups149├── simulation-validation.md # SpinalSim API, testbench templates, validation ladder150└── vexriscv-casebook.md # VexRiscv patterns with preconditions and anti-patterns151```152153## Evidence Sources154155| Source | URL |156| --- | --- |157| SpinalHDL documentation (master) | https://spinalhdl.github.io/SpinalDoc-RTD/master/index.html |158| SpinalHDL source | https://github.com/SpinalHDL/SpinalHDL |159| SpinalHDL documentation source | https://github.com/SpinalHDL/SpinalDoc-RTD |160| VexRiscv | https://github.com/SpinalHDL/VexRiscv |161| NaxRiscv (newer plugin/fiber style) | https://github.com/SpinalHDL/NaxRiscv |