Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
163 commits
Select commit Hold shift + click to select a range
df1e561
test(suite): drive timed designs from shared cases
tignear Oct 9, 2026
c81c057
Merge branch 'feature/1123' into feature/1123-vtest
tignear Oct 10, 2026
35da5a8
Merge branch 'feature/1123' into feature/1123-vtest
tignear Oct 10, 2026
5c9b14c
fix(suite): align the generated timed testbench with the Celox adapter
tignear Oct 10, 2026
d56c1ba
style(suite): satisfy clippy in the testbench generator
tignear Oct 10, 2026
ef89279
Merge branch 'feature/1123' into feature/1123-vtest
tignear Oct 10, 2026
c98c668
fix(suite): keep settle's result shape after poll_waiting reports pro…
tignear Oct 10, 2026
efa7b07
Merge branch 'feature/1123' into feature/1123-vtest
tignear Oct 10, 2026
641831c
Merge branch 'feature/1123' into feature/1123-vtest
tignear Oct 10, 2026
fba52a3
Merge branch 'feature/1123' into feature/1123-vtest
tignear Oct 10, 2026
e409abd
Merge feature/1123 into feature/1123-vtest
tignear Oct 11, 2026
ed99110
fix(suite): settle timed cases without advancing time
tignear Oct 11, 2026
756ae2e
Merge updated feature/1123 into feature/1123-vtest
tignear Oct 11, 2026
2fa8376
Merge updated process event fixes into feature/1123-vtest
tignear Oct 11, 2026
10b3991
fix(suite): stage always processes and avoid control-name collisions
tignear Oct 11, 2026
fe9bcae
Merge commit 'bdaacdb13' into HEAD
tignear Oct 11, 2026
9f69956
fix(suite): gate event processes and reject finishes before completio…
tignear Oct 12, 2026
aeff36f
Merge commit '577836a19' into HEAD
tignear Oct 12, 2026
c2ba17f
fix(suite): defer startup FF actions while retaining setup edges
tignear Oct 12, 2026
ec24cf3
Merge commit '193f26f4cddb35c7b6f4ab56f3fe5a5a8bf9badb' into HEAD
tignear Oct 12, 2026
6517cb2
fix(suite): stage edge-only always and preserve qualified macro bodies
tignear Oct 12, 2026
b8ec510
Merge commit '59ce7f842' into HEAD
tignear Oct 12, 2026
edc168a
fix(suite): stage expanded and timed always bodies correctly
tignear Oct 12, 2026
5d89e75
Merge commit '870cb1ff4' into HEAD
tignear Oct 12, 2026
781cf3e
Merge commit 'c96fd092a' into HEAD
tignear Oct 12, 2026
246a74c
Merge commit '4135d280e' into HEAD
tignear Oct 12, 2026
1515e0a
fix(suite): resolve timed task scopes and retain automatic FF staging
tignear Oct 12, 2026
e74b945
fix(suite): import only the generated timed finish helper
tignear Oct 12, 2026
6dae27a
Merge commit '371ff0c29' into HEAD
tignear Oct 12, 2026
202cc9f
test(suite): cover blocking and nonblocking FF publication
tignear Oct 12, 2026
582ca99
fix(suite): preserve qualified tasks and complete staged actions
tignear Oct 12, 2026
bcce47b
Merge commit '049e5d735' into HEAD
tignear Oct 12, 2026
bdf1746
Merge commit '8ed321989' into HEAD
tignear Oct 12, 2026
715b311
Merge commit '12bae351b' into HEAD
tignear Oct 12, 2026
6805e47
fix(suite): resolve callable scopes and reject unexpected finishes
tignear Oct 12, 2026
df6e2c5
Merge commit '62e61a64b' into HEAD
tignear Oct 12, 2026
4da2d0e
Merge commit 'eaf86b9c721f8f52b8dd791c90893233c266b06a' into HEAD
tignear Oct 12, 2026
1f11ed5
fix(suite): preserve generate names and lexical task imports
tignear Oct 12, 2026
b886ae2
Merge commit 'b2ecae4be' into HEAD
tignear Oct 12, 2026
13bf52d
Merge commit '7c48f02e8' into HEAD
tignear Oct 12, 2026
488ad2a
fix(suite): preserve case arms and adapter macro scopes
tignear Oct 12, 2026
80c5b89
Merge commit '20045839f' into HEAD
tignear Oct 12, 2026
7ddff6d
fix(suite): preserve timed callable and harness identities
tignear Oct 12, 2026
ca73190
Merge validated finish and active-region fixes from #1158
tignear Oct 12, 2026
5da31b7
Merge commit '9c1881a13e764a01c8b621732d9fa1345cf85616' into HEAD
tignear Oct 12, 2026
bcda630
fix(suite): preserve generate scopes, attributes and source line numbers
tignear Oct 13, 2026
3ae82bb
Merge master byte-output contracts while retaining timed protocols
tignear Oct 13, 2026
b6d2528
Merge commit 'f47c0e681' into HEAD
tignear Oct 13, 2026
b02f9a0
fix(suite): avoid an idle evaluation after draining current events
tignear Oct 13, 2026
25ebe05
fix(suite): adapt scoped callable keys and byte output assertions
tignear Oct 13, 2026
504ba19
style: format byte-output merge resolutions
tignear Oct 13, 2026
28c4823
Merge commit '435599a61' into HEAD
tignear Oct 13, 2026
803f117
fix(suite): retain FF attributes and predefine adapter macros without…
tignear Oct 13, 2026
5eea0cc
Merge commit '7a8ac7d2f0c6b1304c2021d1901d18a29368b363' into HEAD
tignear Oct 13, 2026
5226c51
fix(suite): retain source identities and reject early finish and buff…
tignear Oct 13, 2026
3cb4bc6
Merge commit '306f02a1f' into HEAD
tignear Oct 13, 2026
8a1ca30
fix(runtime): retain four-state host edge baselines across snapshots
tignear Oct 13, 2026
b9f8483
Merge commit '1cb58758f' into HEAD
tignear Oct 13, 2026
0029e0c
Merge commit '5b12a88fa' into HEAD
tignear Oct 13, 2026
d3ddd22
fix(suite): resolve generate-scoped imports and exported or unit task…
tignear Oct 13, 2026
7d9a1ae
Merge commit '5f1ef9fc0' into HEAD
tignear Oct 13, 2026
72a3081
Merge commit 'c7b628364' into HEAD
tignear Oct 13, 2026
922fd8c
fix(runtime): retain inactive edges and reconstruct legacy clock base…
tignear Oct 13, 2026
48ae936
Merge commit 'e3c0c04d1' into HEAD
tignear Oct 13, 2026
7074d39
fix(suite): preserve callable and output identity during staging
tignear Oct 13, 2026
bf18686
Merge commit '14aa74c452ebd7828cecadbca3a7c33407beab84' into HEAD
tignear Oct 13, 2026
0848452
fix(runtime): preserve pending host edges across setup and restore
tignear Oct 13, 2026
5d600d4
Merge commit '36ba03dfff5238628a20178f269edfeac18cc3c3' into HEAD
tignear Oct 13, 2026
fddb5ac
Merge commit 'eb4fabbdabe3a0c7b5c496eb10cebdff0fa7c816' into HEAD
tignear Oct 13, 2026
53a2bf0
fix(suite): share FF control classification with the analyzer
tignear Oct 13, 2026
203c7f2
fix(runtime): settle pending host edges and preserve legacy baselines
tignear Oct 14, 2026
52f88e4
Merge commit 'be9b12323' into HEAD
tignear Oct 14, 2026
eeb06ce
Merge commit 'c86f364a5' into HEAD
tignear Oct 14, 2026
ce62399
fix(suite): distinguish named arguments from timed calls
tignear Oct 14, 2026
47855c5
Merge commit 'ef0128dcc' into HEAD
tignear Oct 14, 2026
1237157
fix(suite): recognize bare timed calls after do
tignear Oct 14, 2026
561e95f
fix(suite): preserve named-block timing and reject past by-ID events
tignear Oct 14, 2026
ac34683
Merge commit '650592d29' into HEAD
tignear Oct 14, 2026
1a729ec
fix(suite): retain the reviewed Icarus unit-scope exclusion
tignear Oct 14, 2026
d994f04
fix(suite): derive timing from parsed calls and active preprocessing
tignear Oct 14, 2026
0219560
Merge commit '7bc0900af' into HEAD
tignear Oct 14, 2026
5c77e10
Merge commit '6adc093c4' into HEAD
tignear Oct 14, 2026
843e54d
test(vcd): sample inactive host transitions at their timestamp
tignear Oct 14, 2026
5db4882
fix(suite): preserve commented callable headers and finish stepping
tignear Oct 14, 2026
721d8a0
fix(suite): resolve imports from AST within source units
tignear Oct 14, 2026
b5bc0ad
Merge commit '23372aac3' into HEAD
tignear Oct 14, 2026
f6dd4f6
fix(runtime): coerce saved edge baselines and resolve interface methods
tignear Oct 14, 2026
6459216
Merge commit '495538f55' into HEAD
tignear Oct 14, 2026
d98eb7d
Merge commit 'f4b9d1d648f589816681e871b0b5b8b21567f23c' into HEAD
tignear Oct 14, 2026
c427930
test(suite): cover atomic blocking concatenations and finite feedback
tignear Oct 14, 2026
f249e1a
Merge commit '4c67a408a577bc4113316658bc18a0d63817a0b8' into HEAD
tignear Oct 14, 2026
30d87d3
fix(suite): resolve interface modport receivers for timed staging
tignear Oct 14, 2026
91c2b89
test(suite): retain reviewed interface evidence formatting
tignear Oct 14, 2026
70b902c
test(suite): keep simulator phase disagreement outside portable cases
tignear Oct 14, 2026
889e874
Merge commit 'fc7c1245964d41ab6311c6b740a466d7a8ee650f' into HEAD
tignear Oct 14, 2026
8612b02
fix(suite): use specialized generic and inherited interface bindings
tignear Oct 14, 2026
f6315c5
Merge commit '20f88f7ee0cafa511c1a474c60418188ac3bc787' into HEAD
tignear Oct 14, 2026
d6d1d87
Merge commit '4d0deabae23923bc33fe4e21700a944b0ff26043' into HEAD
tignear Oct 14, 2026
9fa2363
fix(runtime): synchronize lazy-read finish when settling
tignear Oct 14, 2026
550102f
Merge commit '1b1f04b567f733dda0c8f1fe4109035273385f5e' into HEAD
tignear Oct 14, 2026
c904573
test(sv): cover conditional writes at distinct activation times
tignear Oct 14, 2026
2ded3f4
Merge commit '4067e88e7a0ad16042efa9802e00a3d22ec372d5' into HEAD
tignear Oct 14, 2026
81929f9
test(sv): cover fixed activation times across case branches
tignear Oct 14, 2026
303c9fe
Merge commit 'e63ae59e0' into HEAD
tignear Oct 14, 2026
123bedd
Merge commit '6310babfec8fa8a103d9aa283d21a2a1822e2720' into HEAD
tignear Oct 14, 2026
7fab938
fix(test): settle staged finish within run_to_finish and cover proces…
tignear Oct 14, 2026
f972be4
fix(runtime): report falling any-change host domains as active
tignear Oct 14, 2026
576ed72
Merge commit '9fa62669d4035e1a86117113590a24d27b804ffb' into HEAD
tignear Oct 14, 2026
97e0c8f
fix(timing): defer initial comb finish until design startup
tignear Oct 14, 2026
6c88018
Merge commit '090f95341' into HEAD
tignear Oct 14, 2026
35a8f8e
Merge commit 'e7f89d03e' into HEAD
tignear Oct 14, 2026
ed95110
test(timing): cover bounded for waves and saved host edges
tignear Oct 14, 2026
8ed1f9e
Merge commit 'e7f2b55a4' into HEAD
tignear Oct 14, 2026
fd911e5
Merge commit '4e656b890' into HEAD
tignear Oct 14, 2026
f1e05de
test(sv): share untimed task activation regressions
tignear Oct 14, 2026
e3c4b91
fix(timing): stage combinational effects and validate loaded schedules
tignear Oct 14, 2026
4bb5c85
Merge commit 'b0e2c0874' into HEAD
tignear Oct 14, 2026
47ee213
Merge commit 'c71bfc10154eab9697cd69357a632ae24313af3e' into HEAD
tignear Oct 14, 2026
4a59345
test(suite): fail timed runs on continuing assertions
tignear Oct 14, 2026
4d7ae3e
Merge commit '9c523ba3c' into HEAD
tignear Oct 14, 2026
38b2171
Merge commit '5910e4924' into HEAD
tignear Oct 14, 2026
b8a2e15
test(suite): register staged and NBA waiter timing cases
tignear Oct 14, 2026
a650205
fix(runtime): preserve any-change domains in mixed event batches
tignear Oct 14, 2026
43f6646
Merge commit 'd27aa7e87df64f0ff4b505196f6b33d47c6c1904' into HEAD
tignear Oct 14, 2026
818ba90
Merge commit '4d33fc2c63fe50e72ba133d978ca8c91c28c90f0' into HEAD
tignear Oct 15, 2026
6511bef
Merge commit '20f069c57a8265ee269d5125d25587ee33da0e7b' into HEAD
tignear Oct 15, 2026
b7daa32
Merge commit '684ccd8c5' into HEAD
tignear Oct 15, 2026
c5160a8
test(sv): cover signed repeat counts and retain timing exclusions
tignear Oct 15, 2026
a26c6e4
Merge commit '4e536decb' into HEAD
tignear Oct 15, 2026
b7388a9
fix(simulation): report finish after current-time dispatch
tignear Oct 15, 2026
7b2214d
Merge commit '92ec1121e67dff2e80c2717416a9cc745ad43cd8' into HEAD
tignear Oct 15, 2026
8f5599b
Merge commit 'f23c6742d288362d1548a88e449afd580b15da90' into HEAD
tignear Oct 15, 2026
23fb4ad
fix(suite): gate untimed wildcard effects until setup completes
tignear Oct 15, 2026
bde8b76
Merge commit 'a7bcfb0b88e2ffcd4d8537219273d55ee0965496' into HEAD
tignear Oct 15, 2026
4aaa61f
Merge selected-case timing repair from #1158
tignear Oct 15, 2026
44f0b92
Merge first-iteration exit timing repair from #1158
tignear Oct 15, 2026
7cdbacd
Merge typed loop-count proof repair from #1158
tignear Oct 15, 2026
13ad4e8
fix(suite): defer continuous driver calls until staged startup
tignear Oct 15, 2026
546cce2
Merge commit 'dda74cacc5a13cce243585453cd9f7e0d610cdb4' into HEAD
tignear Oct 15, 2026
b9930d2
test(suite): preserve all waiters on propagated blocking FF edges
tignear Oct 15, 2026
6c88e82
Merge commit '593bd6f992d0eb0a15f7a7821ffa8c990aee8641' into HEAD
tignear Oct 15, 2026
6a44fa4
test(suite): cover direct blocking FF waiters alongside hierarchy
tignear Oct 15, 2026
0a3349e
fix(suite): stage dynamic declaration initialization before procedures
tignear Oct 15, 2026
ecdeb90
fix(suite): preserve bare calls and escaped continuous destinations
tignear Oct 15, 2026
74edfc0
Merge active-region review fixes from feature/1123
tignear Oct 15, 2026
7f0b83c
test(suite): cover active batches and terminal waits portably
tignear Oct 15, 2026
f48ea9d
fix(suite): keep value bindings from becoming bare calls
tignear Oct 15, 2026
c5affcf
fix(suite): scope initializer effects and stage callable input connec…
tignear Oct 15, 2026
a51bc36
fix(suite): reject dynamic const initialization during timed staging
tignear Oct 15, 2026
78e91c7
fix(suite): preserve callable connection shapes and driver types
tignear Oct 15, 2026
59a23b7
Merge commit '947c6774cc088a4178e3e35343b8b75d088eab24' into HEAD
tignear Oct 15, 2026
24c0a54
test(sv): register constant pulse and typed driver regressions
tignear Oct 15, 2026
dfa26c1
fix(suite): preserve ordered macros throughout timed staging
tignear Oct 15, 2026
2c4f745
Merge commit '41741431aed1b56d6464738061d213766c146379' into HEAD
tignear Oct 15, 2026
ea9be79
fix(suite): retain nominal types in callable input drivers
tignear Oct 15, 2026
2c69da9
Merge commit 'f931d6d5e28f5dadc56f699cc454ebb4130c6c9c' into HEAD
tignear Oct 15, 2026
e87c219
test(runtime): initialize host readiness in custom states
tignear Oct 15, 2026
577b4fd
ci: restore focused validation from feature/1123
tignear Oct 15, 2026
48a50be
fix(suite): retain package context and publish direct host writes
tignear Oct 15, 2026
4b9cbf5
Merge commit 'cb2ea7786dbfe2a90a897b6045a346cbb1cccd41' into HEAD
tignear Oct 15, 2026
e2ae1ec
Merge remote-tracking branch 'origin/feature/1123-vtest' into HEAD
tignear Oct 15, 2026
d33b1be
Merge commit '46f3cf1d7845f21ed96844290dc7f34612c85992' into HEAD
tignear Oct 15, 2026
bc01dea
ci: inherit the corrected Mergify CLI action reference
tignear Oct 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 27 additions & 2 deletions crates/celox-runtime/src/simulation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,25 @@ impl<B: SimBackend> SimulationState<B> {
Ok(())
}

/// Whether a clock/reset differs from the last settled scheduler state.
/// Host reads may have already cleared backend trigger bits.
pub fn has_unsettled_edges(&self, backend: &B) -> bool {
self.topo_signals.iter().any(|(signal, id, _)| {
*id != usize::MAX
&& (
self.last_clock_values.contains(*id),
self.unknown_clock_values.contains(*id),
) != sample_event_signal(backend, *signal)
})
}

/// Whether a pending transition activates its clock/reset domain.
pub fn has_unsettled_active_edges(&self, backend: &B) -> bool {
self.topo_signals
.iter()
.any(|(_, id, _)| *id != usize::MAX && self.stable_edge_triggered(backend, *id))
}

/// Whether any process is suspended on an event or a condition.
pub fn has_waiting_processes(&self) -> bool {
!self.waiting.is_empty()
Expand All @@ -528,8 +547,6 @@ impl<B: SimBackend> SimulationState<B> {
return Ok(false);
}
let time = self.scheduler.time;
// A due clock belongs to the same batch; consume its periodic marker
// through step before processing captured host edges or continuations.
if self
.scheduler
.next_event_time()
Expand Down Expand Up @@ -809,6 +826,14 @@ impl<B: SimBackend> SimulationState<B> {
}
let mut scheduled_edges: BitSet = host_edges.keys().copied().collect();
let mut early_settle_edges = BitSet::with_capacity(num_events);
// Pending host writes share this round with current-time scheduled
// edges. Record their net transitions before scheduled values replace
// them and before clearing the backend's transient trigger hints.
for (_, id, _) in &self.topo_signals {
if *id != usize::MAX && self.stable_edge_triggered(executor.backend(), *id) {
scheduled_edges.insert(*id);
}
}
// Early settling can expose a derived edge that a later source store
// or awakened process restores. Capture every update we settle early.
let capture_batch_edges = events_to_process.len() > 1 || !host_edges.is_empty();
Expand Down
166 changes: 166 additions & 0 deletions crates/celox-sv-analyzer/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2441,6 +2441,14 @@ fn generate_scope_head(name: &str) -> Option<&str> {
Some(&name[..end])
}

/// Source ranges of generate scopes, including single-item bodies.
/// Offsets refer to the parsed, preprocessed source text.
pub fn generate_scope_ranges(tree: &SyntaxTree) -> Vec<(usize, usize)> {
tree.into_iter()
.flat_map(imports::generate_blocks)
.collect()
}

/// Source offsets of always constructs whose controls have the supported FF
/// shape. Adapter callable analysis separately excludes timed task calls.
pub fn ff_always_offsets(syntax_tree: &SyntaxTree) -> Vec<usize> {
Expand All @@ -2465,3 +2473,161 @@ pub fn ff_always_offsets(syntax_tree: &SyntaxTree) -> Vec<usize> {
})
.collect()
}

/// Actual call identifiers, excluding named argument labels and declarations.
/// Bare identifiers in expressions are not call sites; bare statement calls are.
pub fn procedural_call_sites(tree: &SyntaxTree) -> Vec<(usize, String)> {
let mut sites = Vec::new();
for node in tree {
let identifier = match node {
RefNode::TfCall(call) if call.nodes.2.is_some() => {
Some(RefNode::PsOrHierarchicalTfIdentifier(&call.nodes.0))
}
RefNode::SubroutineCallStatement(
sv_parser::SubroutineCallStatement::SubroutineCall(statement),
) => match &statement.0 {
sv_parser::SubroutineCall::TfCall(call) => {
Some(RefNode::PsOrHierarchicalTfIdentifier(&call.nodes.0))
}
_ => None,
},
RefNode::MethodCallBodyUser(call) => Some(RefNode::MethodIdentifier(&call.nodes.0)),
_ => None,
};
if let Some(identifier) = identifier {
let name = identifier
.into_iter()
.filter_map(|node| match node {
RefNode::SimpleIdentifier(id) => tree
.get_str(&id.nodes.0)
.map(|text| (id.nodes.0.offset, text.trim().to_owned())),
RefNode::EscapedIdentifier(id) => tree
.get_str(&id.nodes.0)
.map(|text| (id.nodes.0.offset, text.trim().to_owned())),
_ => None,
})
.last();
if let Some(name) = name {
sites.push(name);
}
}
}
sites.sort_unstable();
sites.dedup();
sites
}

/// Parsed import/export clauses, keyed by the declaration keyword offset.
/// A missing package/member denotes a wildcard; comments never become items.
pub fn package_import_export_clauses(
tree: &SyntaxTree,
) -> std::collections::BTreeMap<usize, Vec<(Option<String>, Option<String>)>> {
let mut clauses = std::collections::BTreeMap::new();
for node in tree {
let (offset, declaration) = match node {
RefNode::PackageImportDeclaration(item) => (
item.nodes.0.nodes.0.offset,
RefNode::PackageImportDeclaration(item),
),
RefNode::PackageExportDeclaration(sv_parser::PackageExportDeclaration::Item(item)) => (
item.nodes.0.nodes.0.offset,
RefNode::PackageExportDeclarationItem(item),
),
RefNode::PackageExportDeclaration(sv_parser::PackageExportDeclaration::Asterisk(
item,
)) => {
clauses.insert(item.nodes.0.nodes.0.offset, vec![(None, None)]);
continue;
}
_ => continue,
};
let items = declaration
.into_iter()
.filter_map(|node| match node {
RefNode::PackageImportItem(sv_parser::PackageImportItem::Identifier(item)) => {
Some((
identifier_text(RefNode::PackageIdentifier(&item.nodes.0), tree),
identifier_text(RefNode::Identifier(&item.nodes.2), tree),
))
}
RefNode::PackageImportItem(sv_parser::PackageImportItem::Asterisk(item)) => Some((
identifier_text(RefNode::PackageIdentifier(&item.nodes.0), tree),
None,
)),
_ => None,
})
.collect();
clauses.insert(offset, items);
}
clauses
}

/// Instance bindings retain their declared type across parameter assignments.
pub fn instance_type_sites(tree: &SyntaxTree) -> Vec<(usize, String, String)> {
let mut sites = Vec::new();
let mut inherited = None;
for node in tree {
if matches!(node, RefNode::ModuleDeclarationAnsi(_)) {
inherited = None;
}
if let RefNode::AnsiPortDeclarationNet(port) = node.clone() {
if let Some(header) = &port.nodes.0 {
inherited = match header {
sv_parser::NetPortHeaderOrInterfacePortHeader::InterfacePortHeader(header) => {
match &**header {
sv_parser::InterfacePortHeader::Identifier(header) => {
identifier_text(RefNode::InterfaceIdentifier(&header.nodes.0), tree)
}
_ => None,
}
}
_ => None,
};
}
if let Some(module) = inherited.clone()
&& let Some(identifier) =
identifier_text(RefNode::PortIdentifier(&port.nodes.1), tree)
&& let Some(offset) =
RefNode::PortIdentifier(&port.nodes.1)
.into_iter()
.find_map(|node| {
if let RefNode::Locate(loc) = node {
Some(loc.offset)
} else {
None
}
})
{
sites.push((offset, identifier, module));
}
} else if matches!(node, RefNode::AnsiPortDeclarationVariable(_)) {
inherited = None;
}

let RefNode::ModuleInstantiation(instance) = node else {
continue;
Comment thread
tignear marked this conversation as resolved.
Resolved
};
let Some(module) = identifier_text(RefNode::ModuleIdentifier(&instance.nodes.0), tree)
else {
continue;
};
for child in RefNode::ModuleInstantiation(instance) {
if let RefNode::NameOfInstance(name) = child {
let node = RefNode::InstanceIdentifier(&name.nodes.0);
let Some(identifier) = identifier_text(node.clone(), tree) else {
continue;
};
if let Some(offset) = node.into_iter().find_map(|node| {
if let RefNode::Locate(loc) = node {
Some(loc.offset)
} else {
None
}
}) {
sites.push((offset, identifier, module.clone()));
}
}
}
}
sites
}
2 changes: 1 addition & 1 deletion crates/celox-sv-analyzer/src/ast/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ pub(super) fn node_range(node: RefNode<'_>) -> (usize, usize) {

/// The source ranges of the generate blocks under a module `node`: each is a
/// scope of its own (IEEE 1800-2023 27.5).
fn generate_blocks(node: RefNode<'_>) -> Vec<(usize, usize)> {
pub(super) fn generate_blocks(node: RefNode<'_>) -> Vec<(usize, usize)> {
if !matches!(
node,
RefNode::ModuleDeclarationAnsi(_) | RefNode::ModuleDeclarationNonansi(_)
Expand Down
14 changes: 13 additions & 1 deletion crates/celox-sv-analyzer/src/ast/interfaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ pub struct InterfaceElaboration {
pub sources: Option<Vec<String>>,
pub root_names: HashMap<String, String>,
pub interface_ports: HashMap<String, HashSet<String>>,
/// Concrete generic port types encountered during specialization.
pub generic_bindings: HashMap<(String, String), HashSet<String>>,
}

pub fn elaborate_interfaces_with_metadata(
Expand Down Expand Up @@ -398,8 +400,11 @@ pub fn elaborate_interfaces_with_metadata_and_roots(
)
})
.collect();
let mut generic_bindings = HashMap::default();
let sources = design.elaborate_with_roots(clones, scales, &mut generic_bindings)?;
Ok(InterfaceElaboration {
sources: Some(design.elaborate_with_roots(clones, scales)?),
sources: Some(sources),
generic_bindings,
root_names: names,
interface_ports,
})
Expand Down Expand Up @@ -1520,6 +1525,7 @@ impl<'a> Design<'a> {
&self,
mut clones: Vec<(String, Vec<(String, String)>)>,
scales: &super::timescales::Timescales,
generic_bindings: &mut HashMap<(String, String), HashSet<String>>,
) -> Result<Vec<String>, AnalyzerError> {
let mut edits: Vec<Vec<Edit>> = vec![Vec::new(); self.files.len()];
let mut names: Vec<String> = self.modules.keys().cloned().collect();
Expand All @@ -1544,6 +1550,12 @@ impl<'a> Design<'a> {
}
}
while let Some((name, bindings)) = clones.pop() {
for (port, interface) in &bindings {
generic_bindings
.entry((name.clone(), port.clone()))
.or_default()
.insert(interface.clone());
}
let clone_name = clone_module_name(&name, &bindings);
if !cloned.insert(clone_name.clone()) {
continue;
Expand Down
17 changes: 16 additions & 1 deletion crates/celox-sv-analyzer/src/syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,22 @@ use crate::AnalyzerError;

/// Parse a SystemVerilog source string into an `sv-parser` syntax tree.
pub fn parse_source(code: &str, path: &Path) -> Result<SyntaxTree, AnalyzerError> {
let defines: Defines<FxBuildHasher> = HashMap::<String, Option<Define>>::default();
parse_source_with_defines(code, path, &[])
}

/// Parse with predefined empty macros without adding lines to the source.
pub fn parse_source_with_defines(
code: &str,
path: &Path,
names: &[&str],
) -> Result<SyntaxTree, AnalyzerError> {
let mut defines: Defines<FxBuildHasher> = HashMap::default();
for name in names {
defines.insert(
(*name).to_owned(),
Some(Define::new((*name).to_owned(), Vec::new(), None)),
);
}
let includes: Vec<&Path> = Vec::new();
let (syntax_tree, _) = parse_sv_str(code, path, &defines, &includes, true, false)
.map_err(|error| AnalyzerError::Parse(error.to_string()))?;
Expand Down
1 change: 1 addition & 0 deletions crates/celox-test-suite/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ name = "inspect-mismatch-ir"
required-features = ["emit"]

[dependencies]
sv-parser.workspace = true
veryl-analyzer = { workspace = true, optional = true }
veryl-emitter = { workspace = true, optional = true }
veryl-parser = { workspace = true, optional = true }
Expand Down
1 change: 1 addition & 0 deletions crates/celox-test-suite/LIMITATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ four-state expectations; the assertions remain enabled on all Celox variants.

| Group | Stage | Tool | Cases | Reason |
| --- | --- | --- | ---: | --- |
| `sv_icarus_qualified_unit_task` | compile | icarus | 1 | Icarus 13.0 rejects a `$unit::` qualified task call permitted by IEEE 1800-2023 3.12.1. Celox and Verilator pass the unchanged timed case. The [pre-exclusion diagnostic](verification/repros/sv_timed_unit_icarus.json) records the malformed-statement error. |
| `sv_icarus_genvar_dimensions` | execute | icarus | 1 | Icarus 13.0 returns 0 for `$dimensions` of a generated loop index's implicit integer localparam; IEEE 1800-2023 27.4 and 20.7 require one packed dimension. Celox and Verilator pass the unchanged assertions. The [standalone reproducer and pre-exclusion result](verification/repros/sv_genvar_dimensions.json) retain the observed disagreement. |
| `sv_icarus_constant_array_queries` | compile | icarus | 1 | Icarus 13.0 rejects array queries of variables in constant expressions and typedef operands; IEEE 1800-2023 20.7 permits them. Verilator passes. |
| `sv_icarus_runtime_array_queries` | execute | icarus | 1 | Icarus 13.0 aborts on a runtime dimension argument. A standalone reproducer also rejects an integer variable as the dimension. IEEE 1800-2023 20.7 permits querying fixed-size dimensions with runtime expressions. |
Expand Down
31 changes: 31 additions & 0 deletions crates/celox-test-suite/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,17 @@ behavioral model and verifies that incorrect results are rejected.
changes. `read` observes settled values, including after a direct write.
`tick` executes the named event once and settles its consequences. Event names
can refer to clocks or asynchronous resets; use the declaration's polarity.
- A design with `Design::timed` is driven by `run_until` and `run_to_finish`
instead of `tick`: the simulator runs the design's own processes, delays
and clocks. `run_until` advances to the given time in the design's time
units and fails when the design has finished by then; `run_to_finish` rejects
an already-finished design, runs until a process calls `$finish`, and fails
when the events run out first. A
`write` in a timed case takes effect at the current time, and `eval_comb`
also resumes the processes it woke, as a simulator's settle step does. A
time later than `RUN_UNTIL_LIMIT` (`i64::MAX / 1000`) is out of range in
every adapter. The optional methods' defaults return an
unsupported-operation error.
- Start each design with fresh storage: zero for two-state signals and X for
four-state signals. Initial combinational outputs must be readable before an
input is written. Generic clock/reset types use Veryl's defaults (positive
Expand Down Expand Up @@ -237,6 +248,26 @@ static). Script values are integers of unbounded width, so an expectation never
depends on the simulator's width or X rules; arithmetic on unknown bits is an
error.

A case whose design has processes with delays or event controls, or a clock
it generates itself, advances time with `run_until` and `run_to_finish` and
checks the design's output with `expect_output`. Design delays count time
units with the injected 1 ns / 1 ps scale. Explicit `timescale`, `timeunit`
and `timeprecision` declarations, and `resetall`, are rejected consistently by the Celox and
external adapters. `tick` cannot be mixed with timed operations.

Reads, output collection and `eval` settle processes due at the current
timestamp without advancing time. External scripted adapters use an Icarus
read/write synchronization callback or a Verilator clocking event sampled in
the observed region. Initial blocks and all `always` processes start after
pre-run input writes settle. `always_ff` listeners retain setup edges and defer
their actions until startup, preserving initial reads before queued NBAs. Internal control names are chosen to avoid source
identifiers.
`run_until` drains its target timestamp before subsequent writes. Only checks
may follow `run_to_finish`; they run in a `final` block that sees the script's
top-level bindings. There is no simulated-time deadline: final checks require
that the script reached the operation and that the design called `$finish`.
Event exhaustion before explicit completion fails the case.

For an invalid design, write `(expect reject)` and no statements.
`TestCase::expectation` lets consumers select these separately. For additional
SV expectations, add `(tags evaluation_order)` (or other `TestTag` names).
Expand Down
Loading
Loading