From rtl-agent-team
Defines Tier 2 RTL unit testing policies: SystemVerilog testbench coding conventions, reference comparison modes (DPI-C/file), execution rules, and result JSON schema.
npx claudepluginhub babyworm/rtl-agent-team --plugin rtl-agent-teamThis skill uses the workspace's default tool permissions.
Testbenches MUST follow project conventions:
Generates design tokens/docs from CSS/Tailwind/styled-components codebases, audits visual consistency across 10 dimensions, detects AI slop in UI.
Records polished WebM UI demo videos of web apps using Playwright with cursor overlay, natural pacing, and three-phase scripting. Activates for demo, walkthrough, screen recording, or tutorial requests.
Delivers idiomatic Kotlin patterns for null safety, immutability, sealed classes, coroutines, Flows, extensions, DSL builders, and Gradle DSL. Use when writing, reviewing, refactoring, or designing Kotlin code.
Testbenches MUST follow project conventions:
i_ prefix for inputs, o_ prefix for outputs, io_ for bidirectionalclk (single domain) or {domain}_clk (multiple, e.g., sys_clk) — NOT clk_irst_n (single domain) or {domain}_rst_n (multiple, e.g., sys_rst_n) — NOT rst_nilogic only (NOT reg/wire)u_ prefix (e.g., u_dut)tb_{module}.sv| Mode | Condition | Method |
|---|---|---|
| A: DPI-C | refc/build/lib{module}_ref.so exists | SV TB calls ref functions via DPI-C, cycle-level comparison |
| B: File | DPI-C unavailable | RTL sim → output file, ref binary → output file, diff comparison |
DPI-C setup:
cd refc && mkdir -p build
gcc -std=c11 -shared -fPIC -o build/lib{module}_ref.so src/{module}_ref.c
Each feature entry supports an optional ac_ids field for acceptance criteria traceability:
ac_ids: array of AC IDs covered by this test (e.g., ["REQ-U-012.AC-1", "REQ-U-012.AC-2"])acceptance_criteria (structured object array with ac_id fields) in
iron-requirements.json, ac_ids MUST be populated for each covered criterion.acceptance_criteria is absent or an empty array [], ac_ids may be omitted (backward compatible).{
"module": "{module}",
"tier": 2,
"ref_mode": "A_DPI" | "B_FILE",
"features": [
{"name": "fsm_idle_to_active", "status": "PASS", "req_ids": ["REQ-U-003"], "ac_ids": ["REQ-U-003.AC-1"]},
{"name": "pipeline_latency_3cyc", "status": "PASS", "req_ids": ["REQ-U-007"], "ac_ids": ["REQ-U-007.AC-1", "REQ-U-007.AC-2"]},
{"name": "valid_ready_handshake", "status": "PASS", "req_ids": ["REQ-U-012"], "ac_ids": ["REQ-U-012.AC-1"]},
{"name": "transform_accuracy", "status": "FAIL", "mismatch_cycle": 47, "req_ids": ["REQ-U-015"]}
],
"ref_mismatches": 0,
"pass_count": 5,
"fail_count": 0,
"total": 5,
"gap_fill_round": {
"executed": true,
"before": {"line_pct": 52.1, "fsm_pct": 40.0},
"after": {"line_pct": 67.3, "fsm_pct": 55.0}
},
// When gap-fill NOT triggered: {"executed": false, "before": null, "after": null}
"coverage": {
"line_pct": 67.3,
"fsm_pct": 55.0,
"toggle_pct": 42.1
},
"func_coverage": {
"covergroups_defined": 2,
"bins_hit": 14,
"bins_total": 20
},
"codec_conformance": "PASS" | "FAIL" | "N/A"
}
ifdef guards for portability (FSDB_DUMP, SHM_DUMP, VCD_DUMP). No dump by default for fast regression. Enable per-run via +define+FSDB_DUMP etc.$urandom for broader coveragealways_ff, always_comb in testbench helper modules (never always @*)These are intentionally lower than P5 targets (90%/80%/70%) to keep Tier 2 fast while ensuring meaningful depth:
Structural coverage:
Functional coverage (Tier 2):
Gate-enforced (hard):
covergroups_defined >= 1 in results JSON)Recommended guidance (not gate-enforced — P5 coverage-analyst verifies these):
Traceability:
docs/phase-3-uarch/iron-requirements.jsonEvery Tier 2 unit test MUST include at minimum these error injection scenarios where the module interface supports them:
| Category | Condition | Mandatory Test |
|---|---|---|
| Reset recovery | All modules | Assert rst_n=0 during active operation → verify FSM returns to reset state, no residual data |
| Backpressure stress | Modules with valid/ready interface | Hold ready low ≥16 cycles during valid=1 → verify data integrity preserved |
| Boundary arithmetic | Modules with datapath operations | Input at min/max boundary values → verify no overflow/underflow corruption |
Applicability: If a module lacks the interface for a category (e.g., no valid/ready), that category is N/A. At least ONE error injection test must be present per module.
Gate: unit_results.json features array must contain at least one entry with
name containing "error_" or "err_" or "reset_" or "backpressure_" or "overflow_" prefix.
Absence of any error injection test → WARNING (advisory at Tier 2, enforced at Tier 3).
i_/o_ port prefixes, sys_clk/sys_rst_n, u_dutreq_ids tracingfunc_coverage.covergroups_defined >= 1 per module