Rtl conformance test

From babyworm/rtl-agent-team · View interactive version

Rtl conformance test is an AI agent skill from the GitHub repository babyworm/rtl-agent-team. Final codec standards compliance gate: bitexact RTL bitstream check against JM/HM reference. Triggers: 'conformance test', 'H.264/H.265 conformance'.

How to use this skill

Skill file

<Purpose>

Verify that RTL-encoded or decoded bitstreams match JM (H.264) or HM (H.265) reference output with 100% bitexact accuracy. This is the final standards compliance gate before tape-out sign-off. Outputs: sim/conformance/results.json with per-vector PASS/FAIL and divergence details.

</Purpose>

<Use_When>

</Use_When>

<Do_Not_Use_When>

</Do_Not_Use_When>

<Why_This_Exists>

Standards compliance cannot be inferred from internal functional verification. JM/HM produce the normative reference bitstreams, and bitexact match is the only accepted evidence of conformance for codec IP submitted to standards bodies or licensees.

</Why_This_Exists>

Prerequisites

If missing: WARNING — halt and instruct user to resolve the missing prerequisite before proceeding.

<Assets>

| Path | Role |

|------|------|

| scripts/conformance_compare.py | Bitexact binary comparison; emits per-vector PASS/FAIL with divergence byte offset, expected/actual hex. |

| templates/golden-metadata.json | Stream metadata schema: standard, profile, level, JM/HM version, width, height, frame count. |

| references/conformance-test-conventions.md | Naming rules, results.json schema, bitexact criteria, block-level decoder guidance, anti-patterns. |

| examples/README.md | Explains why binary conformance bitstreams are intentionally excluded from the repo and documents the vector acquisition flow. |

</Assets>

<Responsibility_Boundary>

</Responsibility_Boundary>

<Execution>

  1. Spawn vcodec-syntax-entropy-expert to select the applicable conformance test vectors (JVT suite or project-specific) for the target standard and profile/level.
  2. Spawn video-processing-expert to validate vector coverage against requirements.
  3. Spawn eda-runner to simulate each vector via Bash CLI; capture RTL output bitstream per vector. Testbench must use i_/o_ port prefixes and {domain}_clk/{domain}_rst_n naming.
  4. For each vector, run python3 {plugin_root}/skills/rtl-conformance-test/scripts/conformance_compare.py rtl_output.bin ref_output.bin ({plugin_root} = plugin root resolved from .rat/state/spawn-context.json) (or cmp -l); record PASS/FAIL with divergence byte, expected/actual hex on FAIL.
  5. Spawn func-verifier to validate sim/conformance/results.json completeness — all vectors present, all have status, FAILs have byte offsets.
  6. Write sim/conformance/results.json with JM/HM version, standard, profile/level, and per-vector entries.
  7. For decoder designs, also run block-level conformance at each pipeline stage (CABAC, inverse TQ, prediction, reconstruction, deblocking, SAO) using C reference model output as oracle.

Apply steps 1-7 to every requested vector suite — do not stop after the first.

</Execution>

<Tool_Usage>

Task(subagent_type="rtl-agent-team:vcodec-syntax-entropy-expert",
     prompt="Select H.264 conformance test vectors applicable to CABAC encoder. "
            "List vector files and JM version to use.")

Task(subagent_type="rtl-agent-team:eda-runner",
     prompt="Run RTL conformance simulation via Bash CLI for each vector in "
            "sim/conformance/vectors/. Compile and run: "
            "scripts/run_sim.sh --sim iverilog --top tb_cabac_conformance "
            "--outdir sim/conformance --trace rtl/cabac_encoder/cabac_encoder.sv "
            "sim/top/tb_cabac_conformance.sv. "
            "Compare output with JM 19.0: "
            "cmp -l sim/conformance/rtl_output.bin sim/conformance/ref/jm_output.bin. "
            "Report PASS/FAIL per vector with divergence byte offset.")

Task(subagent_type="rtl-agent-team:func-verifier",
     prompt="Validate sim/conformance/results.json: verify all vectors ran, all have status, "
            "every FAIL has divergence_byte and expected_hex/actual_hex fields.")

</Tool_Usage>

<Examples>

<example index="1">

<scenario>500 ITU-T H.264 vectors; CABAC encoder RTL; JM 19.0 reference.</scenario>

<expected_output>498 PASS; 2 FAIL at byte offset 1024 (spec §9.3.4.6); vcodec-syntax-entropy-expert identifies CABAC flush bug; RTL fix applied; re-run: all 500 PASS; results.json updated.</expected_output>

</example>

<example index="2">

<scenario>H.265 codec with both encoder and decoder paths; HM 16.20 available.</scenario>

<expected_output>Encoder conformance (RTL→JM decode) and decoder conformance (HM encode→RTL) both run; results.json records HM 16.20 version; 100% bitexact achieved on both paths.</expected_output>

</example>

<example index="3">

<scenario>12 of 500 vectors fail — likely systemic issue.</scenario>

<expected_output>Escalation to ref-model review triggered (>10 failures threshold); root cause traced to ref model feature gap rather than isolated RTL bug; ref-model updated; conformance re-run after ref-model gate passes.</expected_output>

</example>

</Examples>

<Escalation_And_Stop_Conditions>

</Escalation_And_Stop_Conditions>

Output

<Final_Checklist>

</Final_Checklist>

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.