C910 Bugcase + Fix Workflow
Use this skill when the user wants an end-to-end flow: detect a C910 simulation error, generate a minimal repro case, fix wolf-sv-parser, and document the fix for human review.
Inputs
- •Optional
CASE_ID: if the user requests a specific case number; otherwise choose the next availablecase_XXX. - •Optional
USER_LOG: a user-provided log file path or pasted snippet. Use it to seed repro if provided.
Workflow
- •Entry paths:
- •If the user provides
USER_LOG, read it first and extract warnings/errors (focus on error/critical lines, then warnings). Use these messages to identify likely RTL files/modules and the failure signature to reproduce. - •If no
USER_LOGis provided or it lacks actionable error context, runmake run_c910_testfrom repo root and capture stdout/stderr to a log file (e.g.build/artifacts/c910_run.log). Use this log path for all subsequent steps.
- •If the user provides
- •Read the chosen log (user-provided or freshly generated). Extract the error snippet and locate the referenced RTL file/module.
- •Prefer the RTL file path and module name mentioned in the error or warning.
- •Determine
DUT_TOPand minimal RTL sources.- •Use
rg -n "module <DUT_TOP>"intests/data/openc910/C910_RTL_FACTORYto find the module file. - •Keep
filelist.fminimal; prefer existing RTL paths. Addstub_modules.vonly when needed.
- •Use
- •Create a new case directory
tests/data/openc910/bug_cases/case_XXX.- •Choose the next available index unless
CASE_IDis provided.
- •Choose the next available index unless
- •Create files (no
tb_case_xxx.v; test the module directly):- •
filelist.f(RTL only) - •
tb_case_xxx.cpp(drives DUT directly) - •
Makefile - •
bug_report.md - •
coverage_check.py - •optional
stub_modules.vUse templates fromassets/and replace placeholders: - •
CASE_ID->001(or chosen index) - •
DUT_TOP-> module name - •
__DUT_TOP__-> module name (forV<top>symbols)
- •
- •TB requirements:
- •Include
V<DUT_TOP>.h, implement clock/reset, deterministic stimulus, and at least one correctness check. - •Ensure the stimulus exercises enough logic so that coverage is close to 90% when running
run_c910_bug_case_ref. - •TB validates module behavior; treat the original ref RTL as the gold standard for expected behavior.
- •TB is driven by the ref flow; do not modify TB to accommodate wolf output or wolf-only failures.
- •When
VM_COVERAGEis enabled, write coverage toVERILATOR_COV_FILE.
- •Include
- •Makefile requirements:
- •Targets:
run,run_c910_bug_case_ref,run_c910_bug_case,clean. - •
runuses--top $(DUT_TOP)to emitwolf_emit.sv. - •
run_c910_bug_case_refruns RTL directly;run_c910_bug_caserunswolf_emit.sv. - •Coverage enabled with
COVERAGE=1; enforceCOV_MIN(default 90%) for the ref run only. - •For the wolf run, report coverage but do not fail the run (e.g. use
COV_MIN=0when invoking it). - •Outputs under
build/c910_bug_case/case_xxx/{rtl,wolf}only.
- •Targets:
- •Fill
bug_report.mdwith the error summary, repro commands, expected vs actual, and minimization notes (include the log path and a snippet). - •Validate behavior:
- •
make -C tests/data/openc910/bug_cases/case_XXX run_c910_bug_case_refmust complete without errors and coverage should be close to 90% (adjust TB stimulus to raise coverage; keepCOV_MINat 90 unless absolutely necessary). - •
make -C tests/data/openc910/bug_cases/case_XXX run_c910_bug_casemust reproduce the same class of error message seen in the log (e.g., the same “Value already has a defining operation” failure). If it does not, refine the filelist; do not change TB for wolf-only behavior.
- •
- •Diagnose the root cause in
wolf-sv-parser:- •Locate the failing code path (parser, elaborator, or emitter) using the error signature and minimal repro case.
- •Prefer the smallest fix that preserves existing behavior; update or add tests if the fix changes expected output.
- •Apply the fix:
- •Edit
src/and/orinclude/as needed. - •Rebuild with
cmake --build build -j$(nproc)(configure withcmake -S . -B buildif needed).
- •Edit
- •Verify the fix:
- •Re-run
make -C tests/data/openc910/bug_cases/case_XXX run_c910_bug_caseand confirm the previous error no longer reproduces (report coverage only; do not enforceCOV_MIN). - •Run
ctest --test-dir build --output-on-failureif the fix affects shared logic.
- •Re-run
- •Write a fix report for human review under
docs/c910/(e.g.,docs/c910/case_XXX_fix_report.md):- •Problem summary and original failure signature (include log path and a short snippet).
- •Minimal repro details (case path, DUT top, coverage status).
- •Root cause analysis in
wolf-sv-parser. - •Fix details (files changed, rationale, risks).
- •Validation results (commands and outcomes).
- •Open questions or follow-ups.
- •Stop after report creation. Do not assume the fix is accepted; the human reviewer decides.
References
- •
docs/c910/openc910调试方案.md
Templates
- •
assets/Makefile.template - •
assets/tb_case_xxx.cpp.template - •
assets/bug_report.md.template - •
assets/coverage_check.py