Verification¶
This guide explains the verification flow used in this project. The main entry point is the helper script bin/hsid-coverage.sh, which:
- Invokes the FuseSoC
coveragetarget for a selected module - Runs a QuestaSim/ModelSim simulation configured for coverage
- Executes the module-specific TCL script to save coverage and generate reports
- Collects the resulting reports into a single folder for easy browsing
The flow is repeatable per module (e.g., hsid_divider, hsid_main, …).
End-to-end workflow¶
1) Choose a module and run the coverage helper script
# General form (from repo root)
bin/hsid-coverage.sh MODULE_NAME [-- FUSESOC_ARGS...]
# Examples
bin/hsid-coverage.sh hsid_divider
bin/hsid-coverage.sh hsid_main -- --K=32 # pass parameters through to FuseSoC
bin/hsid-coverage.sh -h # show help
2) What the script does under the hood
- Calls FuseSoC with the
coveragetarget for the selected core, e.g.:fusesoc run --no-export --target coverage uclm:hspecidx:hsid_main [FUSESOC_ARGS...]
- The core’s
coveragetarget (see*.core) configures the ModelSim backend to enable coverage and points to the module’s coverage TCL:+cover=bcestfenables block, condition, expression, statement, toggle, and FSM code coverage-coverage -assertdebugenables collection of UCDB and assertion data-do .../hw/tcl/modelsim-do/<module>_coverage.tclruns the post-sim reporting
- After the simulation completes, the TCL script saves the UCDB and emits multiple reports.
- Finally,
hsid-coverage.shcopies the generated reports into a consolidated output folder.
3) Where results are stored
- By default,
hsid-coverage.shcopies artifacts to:reports/<MODULE_NAME>/
Module–specific TCL and core wiring (example: hsid_main)¶
-
Core file:
hsid_main.coretargets.coverage.tools.modelsimsets:vlog_options: +cover=bcestf +accvsim_options: -onfinish stop -coverage -assertdebug -do ../../../hw/tcl/modelsim-do/hsid_main_coverage.tcl
- Top-level for coverage:
hsid_main_tb
-
TCL driver:
hw/tcl/modelsim-do/hsid_main_coverage.tcl- Runs the full test (
run -all) - Saves UCDB:
coverage save -testname $top report/$top.ucdb - Generates reports (text, XML, HTML)
- Focuses DUT code coverage using instances
/$top/dutand/$top/dut/fsm
- Runs the full test (
The divider module follows the same pattern (see hsid_divider_coverage.tcl).
Generated files and their meaning¶
The coverage TCL scripts emit the following artifacts (paths shown relative to the working run directory; copies end up under reports/<MODULE_NAME>/):
-
UCDB database
report/<top>.ucdb— Unified coverage database containing SVA, CVG, and code coverage.
-
Global summary (text)
report/summary.txt— Coverage summary across assertions, functional coverage, and code coverage.
-
Assertions (SVA)
report/sva_details.txt— Detailed assertion status (concurrent SVA), pass/fail/hit counts.report/sva_details.xml— Same as above in XML format for tooling.
-
Functional coverage (CVG)
report/cvg_details.txt— Detailed covergroups/coverpoints/crosses and bin hits.report/cvg_details.xml— XML version for tooling.
-
Code coverage (by DUT instance)
- Text:
report/dut_code.txt - XML:
report/dut_code.xml - Instances:
- Divider flow:
/$top/dut - Main flow:
/$top/dutand/$top/dut/fsm
- Divider flow:
- Text:
-
HTML report
report/html/index.html— Browsable HTML including SVA, CVG, and code coverage views.
Code coverage categories (bcestf)¶
The -code bcestf option enables:
- b: Block coverage
- c: Condition coverage
- e: Expression coverage
- s: Statement coverage
- t: Toggle coverage
- f: FSM coverage
This combination offers a thorough view of RTL execution and logic activation.
How to interpret results¶
- Start with
summary.txtfor a global picture of SVA/CVG/code coverage. - Drill into
sva_details.txt/.xmlto inspect assertion quality. - Use
cvg_details.txt/.xmlto identify unhit bins and coverage holes in your test intent. - Use
dut_code.txt/.xmland the HTML report to locate uncovered RTL constructs (by block/condition/expression/statement/toggle/FSM) and specific instances (e.g., DUT and FSM submodule).
Troubleshooting¶
- If no UCDB is created, ensure the coverage target is used and ModelSim is invoked with
-coverageand compile with+cover=bcestf. - If reports are empty, check that the test actually runs to completion (
run -all) and that the TCL is executed (-do <module>_coverage.tcl). - If outputs don’t appear under
reports/<MODULE_NAME>/, verify thathsid-coverage.shfinished successfully; artifacts originate frombuild/uclm_hspecidx_<MODULE_NAME>_0/coverage-modelsim/report/.