Prerequisites
sim/coverage/coverage.xml, .dat, or merged.info must exist from a prior rtl-p5s-func-verify run.
If prerequisite is missing: WARNING — recommend running /rtl-agent-team:rtl-p5s-func-verify first. Proceed with available artifacts; orchestrator adapts scope.
Apply steps 1-6 to every requested module — do not stop after the first.
Do not perform analysis work directly — the orchestrator manages 3-round iterative coverage analysis, directed test generation, and coverage convergence tracking.
Output
reviews/phase-5-verify/{module}-coverage-report.md — raw and post-exclusion coverage numbers, prioritized gap list, and PASS/FAIL verdict.
sim/coverage/test_coverage_fill.py — directed tests generated to close identified high-value gaps.
1---2name: rtl-p5s-coverage-analyze3description: P5 coverage closure: prioritizes coverage gaps and generates directed tests. Triggers 'coverage gaps', 'coverage below target', 'uncovered branches'.4---56<Purpose>7Analyze simulation coverage data to identify uncovered lines, branches, and FSM states. Prioritize gaps by reachability and architectural significance, generate directed tests to close high-value gaps, and produce a convergence report. Outputs: `reviews/phase-5-verify/{module}-coverage-report.md` (gap list + PASS/FAIL verdict) and `sim/coverage/test_coverage_fill.py` (directed tests targeting identified gaps).8</Purpose>910<Use_When>11- A coverage report exists from a `rtl-p5s-func-verify` run.12- Coverage is below target (90% line, 80% toggle, 70% FSM).13- Preparing for a verification closure milestone.14</Use_When>1516<Do_Not_Use_When>17- No coverage data exists yet — run `rtl-p5s-func-verify` first.18- Functional failures remain — fix failures before analyzing coverage.19- Only a single targeted test is needed — write it directly with `testbench-dev`.20</Do_Not_Use_When>2122<Why_This_Exists>23Raw coverage reports are verbose and hard to prioritize. `coverage-analyst` identifies which uncovered areas are high-value vs unreachable, and `testbench-dev` writes targeted tests for the high-value gaps. This makes coverage closure systematic rather than relying on ad-hoc test addition. The iterative 3-round loop ensures convergence is tracked across test additions.24</Why_This_Exists>2526## Prerequisites2728- `sim/coverage/coverage.xml`, `.dat`, or `merged.info` must exist from a prior `rtl-p5s-func-verify` run.2930If prerequisite is missing: WARNING — recommend running `/rtl-agent-team:rtl-p5s-func-verify` first. Proceed with available artifacts; orchestrator adapts scope.3132<Assets>33| Path | Role |34|------|------|35| `templates/coverage-gap-report.md` | Gap report scaffold: summary section, high-value gap table, unreachable table, directed tests list, exclusions section. |36| `scripts/parse_coverage.py` | Deterministic coverage parser: reads lcov `.info` (from `merge_coverage.sh`) or raw Verilator `coverage.dat`, emits JSON with per-file/per-metric coverage %, ranked uncovered bins, and PASS/FAIL vs project targets. |37| `references/coverage-conventions.md` | Coverage targets, report schema, directed test style, exclusion approval rules, anti-patterns. |38| `examples/` | Worked examples: `merged.info` (lcov) + `coverage.dat` (Verilator native) inputs with committed expected JSON — see `examples/README.md`. |39</Assets>4041<Responsibility_Boundary>42- **Scripts** handle deterministic parsing: coverage XML/DAT extraction produces line, toggle, and FSM coverage numbers per module.43- **LLM** handles interpretive analysis: gap prioritization (reachable vs unreachable), directed test design, and exclusion justification for the `rtl-coverage-exclusion-gate.sh` approval flow.44- Contract surface: report structure and coverage targets documented in `references/coverage-conventions.md`.45</Responsibility_Boundary>4647<Execution>481. Read `references/coverage-conventions.md` for coverage targets, report structure, and exclusion approval rules.492. Spawn `p5s-coverage-orchestrator` (see Tool_Usage) to run 3-round iterative analysis: parse the coverage report (deterministic extraction via `scripts/parse_coverage.py` — supports lcov `.info` and Verilator `coverage.dat`; `v_user` points count as the fsm metric), identify and prioritize gaps, generate directed tests, re-run simulation, and track convergence.503. The orchestrator writes `reviews/phase-5-verify/{module}-coverage-report.md` using `templates/coverage-gap-report.md` as scaffold, populating high-value and unreachable gap tables.514. The orchestrator writes `sim/coverage/test_coverage_fill.py` with one test function per targeted gap.525. Any coverage exclusion bins (unreachable items) must go through the `rtl-coverage-exclusion-gate.sh` approval flow — do not apply exclusions silently.536. Report the overall PASS/FAIL verdict and both output paths to the user.5455Apply steps 1-6 to every requested module — do not stop after the first.56</Execution>5758<Tool_Usage>59Coverage gap analysis orchestration:60```61Task(subagent_type="rtl-agent-team:p5s-coverage-orchestrator",62 prompt="Execute coverage gap analysis. User input: $ARGUMENTS")63```6465Do not perform analysis work directly — the orchestrator manages 3-round iterative coverage analysis, directed test generation, and coverage convergence tracking.66</Tool_Usage>6768<Examples>69<example index="1">70<scenario>Module has 85% line coverage and 65% FSM coverage after initial functional verification pass.</scenario>71<reference>examples/</reference>72<expected_output>Gap report identifies 3 high-value uncovered FSM transitions and 2 uncovered error-handling branches; `test_coverage_fill.py` adds 5 directed tests; after re-run coverage reaches 91% line and 73% FSM — overall PASS.</expected_output>73</example>7475<example index="2">76<scenario>Several uncovered branches are in dead-code paths gated by a compile-time parameter.</scenario>77<reference>examples/</reference>78<expected_output>Unreachable table lists the dead-code branches with justification; exclusion request routed through `rtl-coverage-exclusion-gate.sh` before applying. Report notes exclusions pending user approval.</expected_output>79</example>8081<example index="3">82<scenario>Coverage data file is absent — `sim/coverage/coverage.xml` does not exist.</scenario>83<reference>examples/</reference>84<expected_output>WARNING emitted: `sim/coverage/coverage.xml` not found — recommend running `/rtl-agent-team:rtl-p5s-func-verify` first. Skill does not proceed to gap analysis.</expected_output>85</example>86</Examples>8788<Escalation_And_Stop_Conditions>89- Coverage data absent → emit WARNING; do not fabricate numbers; stop.90- Functional failures remain → refuse to run; report that coverage from a failing simulation is unreliable.91- Exclusion of unreachable bins needed → route through `rtl-coverage-exclusion-gate.sh`; never apply silently.92- After 3 rounds coverage is still below target → report the residual gaps and recommend user review of the exclusion candidates.93</Escalation_And_Stop_Conditions>9495## Output9697- `reviews/phase-5-verify/{module}-coverage-report.md` — raw and post-exclusion coverage numbers, prioritized gap list, and PASS/FAIL verdict.98- `sim/coverage/test_coverage_fill.py` — directed tests generated to close identified high-value gaps.99100<Final_Checklist>101- [ ] Coverage data read from `sim/coverage/coverage.xml` or `.dat` — no fabricated numbers.102- [ ] Gaps prioritized into high-value (reachable) and unreachable tables.103- [ ] Directed tests written in `test_coverage_fill.py` targeting high-value gaps only.104- [ ] Coverage exclusions routed through `rtl-coverage-exclusion-gate.sh` — none applied silently.105- [ ] `reviews/phase-5-verify/{module}-coverage-report.md` written with PASS/FAIL verdict.106- [ ] RTL source not modified.107</Final_Checklist>