acdb2lcov
A small Rust tool that converts Aldec's acdb report -txt output to lcov .info format. Same code powers riviera_sim_test's coverage post-processing.
Where it lives
- Binary:
//tools/acdb2lcov:acdb2lcov_cli— arust_binaryCLI wrapper around theacdb2lcovlibrary. - Library:
//tools/acdb2lcov:acdb2lcov— the parser + emitter, exposed as arust_libraryfor anyone who wants to embed it. - Tests:
//tools/acdb2lcov:acdb2lcov_test— arust_testover the library, runnable without a Riviera install.
CLI usage
bazel run @rules_riviera//tools/acdb2lcov:acdb2lcov_cli -- \
--input coverage.txt --output coverage.info
Both flags take filesystem paths. //tools/acdb2lcov:cli is an alias for the same binary; :acdb2lcov is the library and is not runnable.
Format notes
The launcher runs acdb report -txt -i coverage.acdb -o coverage.txt inside vsimsa after the sim ends, producing a human-readable table report. acdb2lcov walks that table:
- Statement Coverage tables carry
| <line> | <hits> | ... |rows keyed by a| Line | Hits | Source: /path/to/foo.sv |header. Rows with an emptyhitscell are treated as non-coverable and skipped so they don't count as missed lines. - Branch Coverage tables carry
IF branch#<line>#<idx>#parent rows followed by one arm-name row per branch arm; each arm becomes aBRDAentry.
The report states the same coverage twice — once under a DESIGN HIERARCHY banner (one block per elaborated instance) and again under DESIGN UNITS (one block per module / entity). Only the instance-based part is counted; it is the finer-grained of the two, since a module instantiated N times contributes N tables whose hits sum to the real execution count. Reports generated without it fall back to the design-unit part. Within the part that is counted, repeated tables for the same source are additive, and each branch arm stays a single BRDA entry.
Source paths in the report are absolute (/execroot/<workspace>/bazel-out/<config>/bin/<pkg>/<pkg>/<workspace-relative>); the parser normalizes them back to a workspace-relative form so Bazel's lcov merger matches them against the baseline report.
Coverage types beyond Statement and Branch (Covergroup, Expression, Condition, FSM, Toggle, Assertion, Path) are silently skipped — they're not representable in lcov and acdb report -txt doesn't include them by default.