TODO section 21, round 2 of coverage_gaps C1, closing it. A covergroup
was a flat token scan into verbatim text; now ItemKind::Covergroup with
CoverItemKind::{Coverpoint, Cross, Option, Directive, Empty}, BinDecl
(wildcard, kind, array, spec: Values / Transitions / Default /
DefaultSequence / Select, with, iff) and SelectExpr for binsof ...
intersect ... && !binsof - behind the same Rewind fallback as
constraints (v0.27.0's scan re-run character for character on any
failure), no keywords reserved. The bin '(' ambiguity is settled by
position, the LRM's own rule, which replaced a lookahead scan and took
the fallback count to zero. Two guards in shared expression machinery -
an index cannot begin with *, -> or =; a bin's own with (...) filter is
not an array-method iterator argument - both attacked across the corpus
and the opentitan tree. Canonical layout, verify.rs untouched, thirteen
attack pairs. Every sampled expression binds to the class's properties;
cg_inst.cp resolves cross-file; FACTS_FORMAT 11 -> 12. The gap fuzzer
was built in from day one and its classification is asserted, not
claimed.
Opentitan: 544/544 structured, 87/87 DV covergroup files idempotent
with comment streams byte-identical, sweep and per-file diagnostics
identical. Corpus +1139 references, 1135 answered.
docs/features/covergroup-bodies/README.md.
Co-Authored-By: Claude Fable 5 <[email protected]>
55 lines
1.8 KiB
Rust
55 lines
1.8 KiB
Rust
//! A read-only sweep probe: set CENSUS to a directory and this prints the
|
|
//! covergroup structured/fallback counts and the tolerant diagnostics over
|
|
//! every `.sv`/`.svh` under it. Ignored; run by hand for the feature README.
|
|
use std::path::{Path, PathBuf};
|
|
|
|
fn collect(dir: &Path, out: &mut Vec<PathBuf>) {
|
|
let Ok(entries) = std::fs::read_dir(dir) else { return };
|
|
for e in entries.flatten() {
|
|
let p = e.path();
|
|
if p.is_dir() {
|
|
collect(&p, out);
|
|
} else if matches!(p.extension().and_then(|s| s.to_str()), Some("sv") | Some("svh")) {
|
|
out.push(p);
|
|
}
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
#[ignore]
|
|
fn census() {
|
|
std::thread::Builder::new()
|
|
.stack_size(vlog_parser::PARSE_STACK_SIZE)
|
|
.spawn(run)
|
|
.expect("spawn")
|
|
.join()
|
|
.expect("join");
|
|
}
|
|
|
|
fn run() {
|
|
let root = std::env::var("CENSUS").expect("CENSUS");
|
|
let mut files = Vec::new();
|
|
collect(Path::new(&root), &mut files);
|
|
files.sort();
|
|
let (mut cg, mut fb, mut cf, mut diags, mut with_diags) = (0u64, 0u64, 0u64, 0u64, 0u64);
|
|
for p in &files {
|
|
let Ok(src) = std::fs::read_to_string(p) else { continue };
|
|
let (file, ds) = vlog_parser::parse_source_tolerant(&src);
|
|
cg += u64::from(file.covergroups);
|
|
fb += u64::from(file.covergroup_fallbacks);
|
|
cf += u64::from(file.constraint_fallbacks);
|
|
if file.covergroup_fallbacks > 0 {
|
|
println!("FALLBACK {} {}", p.display(), file.covergroup_fallbacks);
|
|
}
|
|
if !ds.is_empty() {
|
|
with_diags += 1;
|
|
println!("DIAGS {} {}", p.display(), ds.len());
|
|
}
|
|
diags += ds.len() as u64;
|
|
}
|
|
println!(
|
|
"files={} covergroups={cg} covergroup_fallbacks={fb} constraint_fallbacks={cf} diagnostics={diags} files_with_diagnostics={with_diags}",
|
|
files.len()
|
|
);
|
|
}
|