Prerequisites
- IP descriptor present at
docs/ip/{ip_name}.xml (IP-XACT) or equivalent datasheet.
- Project coding conventions readable from
rtl/ip_wrappers/ (existing wrappers) or .claude/rules/rtl-coding-conventions.md.
If missing: WARNING — halt and ask user for IP descriptor location before generating.
Apply steps 1-6 to every requested IP — do not stop after the first.
Task(subagent_type="rtl-agent-team:rtl-architect",
prompt="Read IP descriptor at docs/ip/{ip_name}.xml (or datasheet). List all ports, "
"required tie-offs, and parameter settings. Design wrapper interface: map vendor "
"port names to project convention (i_/o_/io_ prefixes, {domain}_clk, {domain}_rst_n).")
Task(subagent_type="rtl-agent-team:rtl-coder",
prompt="Write rtl/ip_wrappers/{ip_name}wrapper.sv. Instantiate {ip_name} as u{ip_name} "
"with all ports connected per architect spec. Use logic only (no reg/wire). "
"Port prefixes: i_ input, o_ output, io_ bidirectional. "
"Clock: {domain}_clk, reset: {domain}_rst_n. "
"Tied ports: // TIED: reason. Parameters: // PARAM: description.")
</Tool_Usage>
<Examples>
<example index="1">
<scenario>SRAM IP with 32 vendor ports; IP-XACT at docs/ip/sram.xml; project uses AXI4-Lite.</scenario>
<expected_output>rtl-explorer confirms i_/o_ prefix style; rtl-architect maps vendor clk→sys_clk, rst_n→sys_rst_n, din→i_sram_din; rtl-coder writes wrapper with u_sram instance and logic types; lint passes.</expected_output>
</example>
<example index="2">
<scenario>PLL IP with test-mode ports that must be tied off.</scenario>
<expected_output>All functional ports connected; test-mode ports tied to constants with `// TIED: unused test mode input` comments; parameter DATA_WIDTH documented with `// PARAM: AXI data bus width`.</expected_output>
</example>
<example index="3">
<scenario>IP has port width mismatch — vendor provides 36-bit data bus, project interface is 32-bit.</scenario>
<expected_output>rtl-architect flags mismatch to user; wrapper generation halted pending user resolution decision; no auto-truncation performed.</expected_output>
</example>
</Examples>
<Escalation_And_Stop_Conditions>
- IP descriptor not found → halt immediately; ask user for datasheet or IP-XACT file path.
- Port width mismatch between IP and project interface → flag to user; do not auto-resolve.
- Generated wrapper fails lint → fix all errors before delivering; do not suppress warnings without documented rationale.
</Escalation_And_Stop_Conditions>
## Output
- `rtl/ip_wrappers/{ip_name}_wrapper.sv` — convention-compliant wrapper module.
<Final_Checklist>
- [ ] IP port list fully read from descriptor before writing wrapper.
- [ ] All IP ports connected or explicitly tied off with `// TIED: reason` comments.
- [ ] Wrapper ports use `i_`/`o_`/`io_` prefixes (NOT `_i`/`_o` suffix).
- [ ] Clocks use `clk` or `{domain}_clk` naming (NOT `clk_i`).
- [ ] Resets use `rst_n` or `{domain}_rst_n` naming (NOT `rst_ni`).
- [ ] IP instance uses `u_` prefix (e.g., `u_{ip_name}`).
- [ ] `logic` types only — no `reg`/`wire`.
- [ ] Parameters documented with `// PARAM:` comments.
- [ ] Lint passes (Verible + slang) on generated wrapper.
- [ ] Wrapper path reported: `rtl/ip_wrappers/{ip_name}_wrapper.sv`.
</Final_Checklist>
1---2name: rtl-ip-instantiate3description: Generate convention-compliant SV wrapper for third-party IP (memory, PLL, PHY, DSP) — 'instantiate IP', 'IP wrapper', 'integrate third-party IP'.4---56<Purpose>7Generate a convention-compliant SystemVerilog wrapper module that instantiates a third-party IP with correct port connections, parameter settings, and explicit tie-offs. Output: `rtl/ip_wrappers/{ip_name}_wrapper.sv`.8</Purpose>910<Use_When>11- Integrating a new third-party IP (memory, PLL, PHY, DSP block) with an IP-XACT descriptor or datasheet.12- A wrapper with standard AXI/APB or custom interface adaptation is needed.13- Vendor port names must be translated to project naming conventions.14</Use_When>1516<Do_Not_Use_When>17- IP is already instantiated and only parameter changes are needed — edit the file directly.18- IP is first-party RTL developed in this project — no wrapper needed.19- Full IP integration with verification is needed → run `rtl-p5s-func-verify` after this skill.20</Do_Not_Use_When>2122<Why_This_Exists>23IP instantiation is error-prone: wrong port widths, missing tie-offs, and parameter mismatches cause subtle bugs that survive lint. Automated wrapper generation from the authoritative IP descriptor eliminates transcription errors and documents every connection explicitly, making the mapping auditable.24</Why_This_Exists>2526## Prerequisites2728- IP descriptor present at `docs/ip/{ip_name}.xml` (IP-XACT) or equivalent datasheet.29- Project coding conventions readable from `rtl/ip_wrappers/` (existing wrappers) or `.claude/rules/rtl-coding-conventions.md`.3031If missing: WARNING — halt and ask user for IP descriptor location before generating.3233<Assets>34| Path | Role |35|------|------|36| `templates/ip-wrapper-template.sv` | SV wrapper scaffold with `u_` instance, `logic`-only ports, `// TIED:` and `// PARAM:` comment patterns. |37| `scripts/gen_instantiation.py` | Deterministic wrapper skeleton generator: parses the vendor module header (ANSI ports/parameters, CamelCase/ALL-CAPS names allowed), emits a convention-compliant wrapper (`i_`/`o_`/`io_` prefixes, `clk`/`rst_n` naming, parameter pass-through with UPPER_SNAKE_CASE rename, `--tie PORT=VALUE[:reason]` tie-offs + documentation table). Stdlib-only. |38| `references/ip-instantiate-conventions.md` | Port-prefix rules, vendor-to-project mapping table, tie-off/param comment format, anti-patterns. |39| `examples/` | Worked example: `vendor_sram_2p/` (vendor 2-port SRAM stub + raw generated skeleton, regeneration-synced) and `sram_2p_wrapper/` (hand-tuned deliverable with clock merge, functional names, polarity adaptation, documented tie-offs). |40</Assets>4142<Responsibility_Boundary>43- **Scripts** (`gen_instantiation.py`) handle deterministic skeleton generation — vendor-name translation, parameter pass-through, tie-off scaffolding; lint validation (Verible + slang) runs via Bash CLI.44- **LLM** handles port mapping design, tie-off decisions, clock-domain merging, polarity adaptation, and parameter documentation.45- Contract surface: every IP port either connects to a wrapper port or carries a `// TIED: reason` comment; no silent unconnected ports.46</Responsibility_Boundary>4748<Execution>491. Spawn `rtl-explorer` to read existing `rtl/ip_wrappers/` and summarise current naming conventions (port prefixes, clock/reset style, instance prefix).502. Spawn `rtl-architect` to read the IP descriptor — list all ports, tie-off requirements, and parameter settings; design wrapper interface mapping vendor names to project conventions (`i_`/`o_`/`io_` prefixes, `{domain}_clk`, `{domain}_rst_n`).513. If the vendor Verilog/SV header file is available, generate the deterministic skeleton first: `python3 {plugin_root}/skills/rtl-ip-instantiate/scripts/gen_instantiation.py <vendor_header.v> -o rtl/ip_wrappers/{ip_name}_wrapper.sv --tie "PORT=VALUE:reason" ...` (`{plugin_root}` = plugin root resolved from `.rat/state/spawn-context.json`; one `--tie` per port the architect marked unused). If only a datasheet/IP-XACT exists, start from `templates/ip-wrapper-template.sv` instead.524. Spawn `rtl-coder` to hand-tune `rtl/ip_wrappers/{ip_name}_wrapper.sv` per architect spec — merge/rename clock domains, give mapped ports functional names, adapt polarities, resolve all TODO markers. `logic` types only, `u_{ip_name}` instance, all ports connected or `// TIED:`, parameters documented with `// PARAM:`.535. Run lint: `verible-verilog-lint rtl/ip_wrappers/{ip_name}_wrapper.sv && slang rtl/ip_wrappers/{ip_name}_wrapper.sv` — fix all errors before delivering.546. Report wrapper path to the user.5556Apply steps 1-6 to every requested IP — do not stop after the first.57</Execution>5859<Tool_Usage>60```61Task(subagent_type="rtl-agent-team:rtl-explorer",62 prompt="Read rtl/ip_wrappers/ and docs/ for existing wrapper patterns. Summarise: "63 "port naming convention (i_/o_/io_ prefixes), clock naming ({domain}_clk), "64 "reset naming ({domain}_rst_n), instance naming (u_ prefix).")6566Task(subagent_type="rtl-agent-team:rtl-architect",67 prompt="Read IP descriptor at docs/ip/{ip_name}.xml (or datasheet). List all ports, "68 "required tie-offs, and parameter settings. Design wrapper interface: map vendor "69 "port names to project convention (i_/o_/io_ prefixes, {domain}_clk, {domain}_rst_n).")7071Task(subagent_type="rtl-agent-team:rtl-coder",72 prompt="Write rtl/ip_wrappers/{ip_name}_wrapper.sv. Instantiate {ip_name} as u_{ip_name} "73 "with all ports connected per architect spec. Use logic only (no reg/wire). "74 "Port prefixes: i_ input, o_ output, io_ bidirectional. "75 "Clock: {domain}_clk, reset: {domain}_rst_n. "76 "Tied ports: // TIED: reason. Parameters: // PARAM: description.")77```78</Tool_Usage>7980<Examples>81<example index="1">82<scenario>SRAM IP with 32 vendor ports; IP-XACT at docs/ip/sram.xml; project uses AXI4-Lite.</scenario>83<expected_output>rtl-explorer confirms i_/o_ prefix style; rtl-architect maps vendor clk→sys_clk, rst_n→sys_rst_n, din→i_sram_din; rtl-coder writes wrapper with u_sram instance and logic types; lint passes.</expected_output>84</example>8586<example index="2">87<scenario>PLL IP with test-mode ports that must be tied off.</scenario>88<expected_output>All functional ports connected; test-mode ports tied to constants with `// TIED: unused test mode input` comments; parameter DATA_WIDTH documented with `// PARAM: AXI data bus width`.</expected_output>89</example>9091<example index="3">92<scenario>IP has port width mismatch — vendor provides 36-bit data bus, project interface is 32-bit.</scenario>93<expected_output>rtl-architect flags mismatch to user; wrapper generation halted pending user resolution decision; no auto-truncation performed.</expected_output>94</example>95</Examples>9697<Escalation_And_Stop_Conditions>98- IP descriptor not found → halt immediately; ask user for datasheet or IP-XACT file path.99- Port width mismatch between IP and project interface → flag to user; do not auto-resolve.100- Generated wrapper fails lint → fix all errors before delivering; do not suppress warnings without documented rationale.101</Escalation_And_Stop_Conditions>102103## Output104105- `rtl/ip_wrappers/{ip_name}_wrapper.sv` — convention-compliant wrapper module.106107<Final_Checklist>108- [ ] IP port list fully read from descriptor before writing wrapper.109- [ ] All IP ports connected or explicitly tied off with `// TIED: reason` comments.110- [ ] Wrapper ports use `i_`/`o_`/`io_` prefixes (NOT `_i`/`_o` suffix).111- [ ] Clocks use `clk` or `{domain}_clk` naming (NOT `clk_i`).112- [ ] Resets use `rst_n` or `{domain}_rst_n` naming (NOT `rst_ni`).113- [ ] IP instance uses `u_` prefix (e.g., `u_{ip_name}`).114- [ ] `logic` types only — no `reg`/`wire`.115- [ ] Parameters documented with `// PARAM:` comments.116- [ ] Lint passes (Verible + slang) on generated wrapper.117- [ ] Wrapper path reported: `rtl/ip_wrappers/{ip_name}_wrapper.sv`.118</Final_Checklist>