From 18a72ac3f0bbfd631f404da2609a79c4e06906d3 Mon Sep 17 00:00:00 2001 From: tignear Date: Thu, 22 Oct 2026 11:47:48 +0900 Subject: [PATCH 1/4] fix(sv): lower always @(list) like always @* when it lists every read An always whose edgeless event list names exactly the variables @* would compute for its statement (IEEE 1800-2023 9.4.2.2), and whose statement neither suspends nor makes a nonblocking assignment, is lowered like always @*, so an untimed Simulator runs it. When such a block closes a combinational loop, the scheduler reports the loop's members, and only the blocks that drive them run as processes. Change-Id: I72eb16b617333506ba2aaaf58a961b0cef5c0903 --- .../src/symbolic/assembly.rs | 48 +++ crates/celox-frontend-sv/src/lowering.rs | 407 ++++++++++++++---- .../src/lowering/procedural.rs | 62 +++ crates/celox-sv-analyzer/src/ir.rs | 74 ++++ 4 files changed, 507 insertions(+), 84 deletions(-) diff --git a/crates/celox-frontend-core/src/symbolic/assembly.rs b/crates/celox-frontend-core/src/symbolic/assembly.rs index 450145040e9..06471f99e5f 100644 --- a/crates/celox-frontend-core/src/symbolic/assembly.rs +++ b/crates/celox-frontend-core/src/symbolic/assembly.rs @@ -548,7 +548,45 @@ fn scheduler_source_locations( .collect() } +#[allow(clippy::too_many_arguments)] pub fn schedule_symbolic_rtl( + symbolic: SymbolicRtl, + fused_ff_factory: Option<&dyn FusedFfLoweringFactory>, + ignored_loops: &[( + (Vec<(String, usize)>, Vec), + (Vec<(String, usize)>, Vec), + )], + true_loops: &[( + (Vec<(String, usize)>, Vec), + (Vec<(String, usize)>, Vec), + usize, + )], + four_state: bool, + parallel: &ParallelScheduleOptions, + trace_opts: &FrontendTraceOptions, + trace: Option<&mut FrontendTrace>, +) -> Result { + schedule_symbolic_rtl_reporting_loops( + symbolic, + fused_ff_factory, + ignored_loops, + true_loops, + four_state, + parallel, + trace_opts, + trace, + &mut Vec::new(), + ) +} + +/// A range a block of a combinational loop writes, in the module that +/// declares it. +pub type LoopMember = (ModuleId, VarAtomBase); + +/// [`schedule_symbolic_rtl`], which also reports the ranges the blocks of a +/// combinational loop write when the scheduler rejects one. +#[allow(clippy::too_many_arguments)] +pub fn schedule_symbolic_rtl_reporting_loops( symbolic: SymbolicRtl, fused_ff_factory: Option<&dyn FusedFfLoweringFactory>, ignored_loops: &[( @@ -564,6 +602,7 @@ pub fn schedule_symbolic_rtl( parallel: &ParallelScheduleOptions, trace_opts: &FrontendTraceOptions, mut trace: Option<&mut FrontendTrace>, + loop_members: &mut Vec, ) -> Result { use std::sync::atomic::{AtomicU64, Ordering}; static NEXT_SOURCE_PROGRAM: AtomicU64 = AtomicU64::new(1); @@ -1152,6 +1191,15 @@ pub fn schedule_symbolic_rtl( package_instances: package_instances.values().copied().collect(), }; let source_locations = scheduler_source_locations(&error, &modules, &instance_modules); + if let SchedulerError::CombinationalLoop { blocks } = &error { + loop_members.extend(blocks.iter().filter_map(|block| { + let var = block.target.var()?; + Some(( + *instance_modules.get(&var.id.instance_id)?, + VarAtomBase::new(var.id.var_id, var.access.lsb, var.access.msb), + )) + })); + } let mut target_arena = SLTNodeArena::new(); let error = error.map_addr(&global_arena, &mut target_arena, &|addr| { frontend_lookup.get_path(addr) diff --git a/crates/celox-frontend-sv/src/lowering.rs b/crates/celox-frontend-sv/src/lowering.rs index 908fa9d4863..e5b24632668 100644 --- a/crates/celox-frontend-sv/src/lowering.rs +++ b/crates/celox-frontend-sv/src/lowering.rs @@ -140,6 +140,9 @@ pub(crate) struct LoweredSvModule { /// The continuous assignments of the event expressions the processes /// wait on, by their hidden target `$event[k]`. event_assignments: Vec<(SourceVarId, Vec)>, + /// The creation orders of the `always @(list)` processes lowered like + /// `always @*`. + level_lists_lowered: Vec, } #[derive(Clone)] @@ -295,7 +298,15 @@ fn interface_signatures_collecting( .into_iter() .map(|prototype| { warnings.extend(crate::warning::analyzer_warnings(&prototype.warnings)); - let lowered = lower_module(&prototype.module, false, true, false, warnings, &[])?; + let lowered = lower_module( + &prototype.module, + false, + true, + false, + warnings, + &[], + LevelLists::Processes, + )?; Ok(InterfaceSignature { name: prototype.name, module: lowered.source, @@ -811,7 +822,15 @@ fn lower_package_states( .into_iter() .enumerate() .map(|(index, module)| { - let mut lowered = lower_module(module, four_state, true, ff_parts, warnings, &[])?; + let mut lowered = lower_module( + module, + four_state, + true, + ff_parts, + warnings, + &[], + LevelLists::Processes, + )?; lowered.sim_module.time_precision = Some( celox_design::TimePrecision::try_from(packages.global_time_precision()) .map_err(|reason| sv::AnalyzerError::Unsupported(reason.to_string()))?, @@ -1549,6 +1568,7 @@ fn prepare_external_hierarchy_collecting( // The foreign module's own combinational blocks carry its copies. event_copies: Vec::new(), event_assignments: Vec::new(), + level_lists_lowered: Vec::new(), } }; let foreign_modules: HashMap<_, _> = foreign @@ -1687,7 +1707,14 @@ fn prepare_external_hierarchy_collecting( let base = analyzed .get(&key.name) .ok_or_else(|| unsupported_sv_instance(key.name.clone()))?; - let lowered = specialize_module(base, &key, four_state, false, warnings)?; + let lowered = specialize_module( + base, + &key, + four_state, + false, + warnings, + LevelLists::Processes, + )?; for instance in &lowered.instances { let child_key = LoweredSvModuleKey::instance_key(instance); if !analyzed.contains_key(&child_key.name) @@ -1724,7 +1751,14 @@ fn prepare_external_hierarchy_collecting( .ok_or_else(|| unsupported_sv_instance(key.name.clone()))?; Ok(( module_id, - specialize_module(base, key, four_state, false, warnings)?, + specialize_module( + base, + key, + four_state, + false, + warnings, + LevelLists::Processes, + )?, )) }) .collect::, FrontendError>>()?; @@ -2180,7 +2214,14 @@ fn schedule_sources_collecting( let base = analyzed .get(&key.name) .ok_or_else(|| unsupported_sv_instance(key.name.clone()))?; - let lowered = specialize_module(base, &key, four_state, false, warnings)?; + let lowered = specialize_module( + base, + &key, + four_state, + false, + warnings, + LevelLists::Processes, + )?; for instance in &lowered.instances { let child_key = LoweredSvModuleKey::instance_key(instance); if !analyzed.contains_key(&child_key.name) { @@ -2201,95 +2242,170 @@ fn schedule_sources_collecting( } } - let lowered_modules = module_ids - .iter() - .map(|(key, &module_id)| { - let base = analyzed - .get(&key.name) - .ok_or_else(|| unsupported_sv_instance(key.name.clone()))?; - let lowered = specialize_module(base, key, four_state, parallel.enabled(), warnings) + // A combinational loop through an `always @(list)` lowered like + // `always @*` may converge as a process: demote the lists in the loop + // and schedule again, until no lowered list takes part in it. + let no_demotions = HashSet::default(); + let mut demoted: HashMap> = HashMap::default(); + let mut trace = trace; + loop { + let lowered_modules = module_ids + .iter() + .map(|(key, &module_id)| { + let base = analyzed + .get(&key.name) + .ok_or_else(|| unsupported_sv_instance(key.name.clone()))?; + let level_lists = LevelLists::Lowered { + demoted: demoted.get(&module_id).unwrap_or(&no_demotions), + }; + let lowered = specialize_module( + base, + key, + four_state, + parallel.enabled(), + warnings, + level_lists, + ) .map_err(FrontendError::from)?; - Ok((module_id, lowered)) - }) - .collect::, FrontendError>>()?; - validate_specialized_instance_net_drivers(&module_ids, &lowered_modules)?; - let root = &lowered_modules[&root_id]; - if let Some(port) = root - .port_order - .iter() - .map(|port_id| &root.variables[port_id]) - .find(|port| port.kind == VariableKind::Inout) - { - return Err(unsupported_sv_inout(port.path.join(".")).into()); - } - validate_sv_module_graph( - &root_key, - &module_ids, - &lowered_modules, - &mut HashSet::default(), - &mut HashSet::default(), - )?; - - let mut modules = HashMap::default(); - let mut module_names = HashMap::default(); - for (key, &module_id) in &module_ids { - let lowered = &lowered_modules[&module_id]; - let mut sim_module = lowered.sim_module.clone(); - attach_instance_glue( - &mut sim_module, - lowered, - key, + Ok((module_id, lowered)) + }) + .collect::, FrontendError>>()?; + validate_specialized_instance_net_drivers(&module_ids, &lowered_modules)?; + let root = &lowered_modules[&root_id]; + if let Some(port) = root + .port_order + .iter() + .map(|port_id| &root.variables[port_id]) + .find(|port| port.kind == VariableKind::Inout) + { + return Err(unsupported_sv_inout(port.path.join(".")).into()); + } + validate_sv_module_graph( + &root_key, &module_ids, &lowered_modules, + &mut HashSet::default(), + &mut HashSet::default(), + )?; + + let mut modules = HashMap::default(); + let mut module_names = HashMap::default(); + for (key, &module_id) in &module_ids { + let lowered = &lowered_modules[&module_id]; + let mut sim_module = lowered.sim_module.clone(); + attach_instance_glue( + &mut sim_module, + lowered, + key, + &module_ids, + &lowered_modules, + four_state, + allow_inferred_latches, + warnings, + )?; + module_names.insert(module_id, key.name.clone()); + modules.insert(module_id, sim_module); + } + + let package_states = lower_package_states( + &analyzed[&top].packages, + module_ids.len(), four_state, - allow_inferred_latches, + parallel.enabled(), warnings, )?; - module_names.insert(module_id, key.name.clone()); - modules.insert(module_id, sim_module); + validate_package_variable_drivers([&root_key], &module_ids, &lowered_modules)?; + let mut packages = Vec::new(); + for (name, module_id, lowered) in &package_states { + module_names.insert(*module_id, name.clone()); + modules.insert(*module_id, lowered.sim_module.clone()); + packages.push((name.clone(), *module_id)); + } + bind_package_variables( + &mut modules, + lowered_modules + .iter() + .map(|(&module_id, lowered)| (module_id, lowered)), + &package_states, + )?; + for (key, id) in &module_ids { + restore_interface_member_paths(modules.get_mut(id).unwrap(), &analyzed[&key.name]); + } + let symbolic = SymbolicRtl { + modules, + module_names, + root_id, + packages, + }; + let mut loop_members = Vec::new(); + let scheduled = + celox_frontend_core::symbolic::assembly::schedule_symbolic_rtl_reporting_loops( + symbolic, + None, + ignored_loops, + true_loops, + four_state, + parallel, + trace_options, + trace.as_deref_mut(), + &mut loop_members, + ); + let error = match scheduled { + Ok(scheduled) => return Ok(scheduled), + Err(error) => error, + }; + if !demote_level_lists(&loop_members, &lowered_modules, &mut demoted) { + return Err(error.into()); + } } +} - let package_states = lower_package_states( - &analyzed[&top].packages, - module_ids.len(), - four_state, - parallel.enabled(), - warnings, - )?; - validate_package_variable_drivers([&root_key], &module_ids, &lowered_modules)?; - let mut packages = Vec::new(); - for (name, module_id, lowered) in &package_states { - module_names.insert(*module_id, name.clone()); - modules.insert(*module_id, lowered.sim_module.clone()); - packages.push((name.clone(), *module_id)); - } - bind_package_variables( - &mut modules, - lowered_modules +/// Demote the `always @(list)` processes lowered like `always @*` which +/// drive a range of a combinational loop. Whether any was demoted. +fn demote_level_lists( + loop_members: &[celox_frontend_core::symbolic::assembly::LoopMember], + lowered_modules: &HashMap, + demoted: &mut HashMap>, +) -> bool { + let mut changed = false; + for (module_id, member) in loop_members { + let Some(lowered) = lowered_modules.get(module_id) else { + continue; + }; + let Some(signal_name) = lowered + .signal_names .iter() - .map(|(&module_id, lowered)| (module_id, lowered)), - &package_states, - )?; - for (key, id) in &module_ids { - restore_interface_member_paths(modules.get_mut(id).unwrap(), &analyzed[&key.name]); + .find_map(|(name, &id)| (id == member.id).then_some(name.as_str())) + else { + continue; + }; + let scan = DriverScan { + signal_name, + subroutines: lowered.source.subroutines(), + range: &|_| None, + }; + for process in lowered.source.comb_processes() { + let creation_order = process.creation_order(); + if process.kind() != sv::ir::CombProcessKind::AlwaysStar + || !lowered.level_lists_lowered.contains(&creation_order) + || demoted + .get(module_id) + .is_some_and(|demoted| demoted.contains(&creation_order)) + { + continue; + } + let mut drivers = Vec::new(); + body_driver_ranges(&mut drivers, process.body(), 0, &scan); + if !drivers.is_empty() { + demoted + .entry(*module_id) + .or_default() + .insert(creation_order); + changed = true; + } + } } - let symbolic = SymbolicRtl { - modules, - module_names, - root_id, - packages, - }; - celox_frontend_core::symbolic::assembly::schedule_symbolic_rtl( - symbolic, - None, - ignored_loops, - true_loops, - four_state, - parallel, - trace_options, - trace, - ) - .map_err(FrontendError::from) + changed } // Use elaboration provenance rather than treating every '$' as a separator: @@ -2372,6 +2488,7 @@ fn specialize_module( four_state: bool, ff_parts: bool, warnings: &mut Vec, + level_lists: LevelLists<'_>, ) -> Result { let overrides = evaluated_parameter_overrides(&key.parameter_overrides)?; // Type bindings are already resolved in the caller scope. @@ -2421,6 +2538,7 @@ fn specialize_module( ff_parts, warnings, &local_forces, + level_lists, )?; for instance in &mut lowered.instances { let name = if let Some((index, _)) = instance.array_element { @@ -2471,6 +2589,7 @@ fn lower_module( ff_parts: bool, warnings: &mut Vec, force_signals: &[String], + level_lists: LevelLists<'_>, ) -> Result { lower_module_with_overrides( module, @@ -2480,9 +2599,21 @@ fn lower_module( ff_parts, warnings, force_signals, + level_lists, ) } +/// Which `always @(list)` processes are lowered like `always @*`. +#[derive(Clone, Copy)] +enum LevelLists<'a> { + /// All of them stay processes. + Processes, + /// Every one whose list is its implicit event expression, except the + /// demoted ones, by creation order, which take part in a combinational + /// loop as `always @*`. + Lowered { demoted: &'a HashSet }, +} + fn needs_host_request( module: &sv::ir::Module, body: &[sv::ir::Stmt], @@ -2540,6 +2671,7 @@ struct FfEventRole { /// `ff_parts` additionally keeps every `always_ff` process as an /// independently evaluated part, for lane-partitioned builds. +#[allow(clippy::too_many_arguments)] fn lower_module_with_overrides( module: &sv::ir::Module, parameter_overrides: &[LoweredSvParameterOverride], @@ -2548,6 +2680,7 @@ fn lower_module_with_overrides( ff_parts: bool, warnings: &mut Vec, force_signals: &[String], + level_lists: LevelLists<'_>, ) -> Result { let mut ff_event_roles = Vec::new(); for process in module.ff_processes() { @@ -2852,6 +2985,41 @@ fn lower_module_with_overrides( &constants, ¶meter_types, )?; + // `always @(list)` naming exactly the reads of its statement is + // `always @*` (IEEE 1800-2023 9.4.2.2), which needs no process. + let mut level_lists_lowered = Vec::new(); + let level_sensitive = match level_lists { + LevelLists::Processes => None, + LevelLists::Lowered { demoted } => Some(demoted), + } + .filter(|_| { + module + .initial_processes() + .iter() + .any(|process| process.level_sensitive().is_some()) + }) + .map(|demoted| { + let pm = procedural::ProcModule::new( + module, + &mut variables, + &mut name_to_id, + &constants, + ¶meter_types, + four_state, + warnings, + ); + module.clone().lower_level_sensitive_processes(|process| { + let selected = !demoted.contains(&process.creation_order()) + && process + .level_sensitive() + .is_some_and(|(items, body)| pm.is_implicit_event_list(items, body)); + if selected { + level_lists_lowered.push(process.creation_order()); + } + selected + }) + }); + let module = level_sensitive.as_ref().unwrap_or(module); let ( ( eval_only_ff_blocks, @@ -3022,6 +3190,7 @@ fn lower_module_with_overrides( package_variables, event_copies: event_vars.copies, event_assignments, + level_lists_lowered, }) } @@ -8489,6 +8658,76 @@ pub(crate) fn unsupported_sv_inout(path: String) -> ParserError { mod tests { use super::*; + /// The process kernels of `source`, other than declaration initializers. + fn procedure_kernels(source: &str) -> usize { + let scheduled = schedule_sources( + &[(source, Path::new("top.sv"))], + "Top", + &[], + &[], + &[], + false, + &celox_frontend_core::ParallelScheduleOptions::default(), + &FrontendTraceOptions::default(), + None, + &mut Vec::new(), + ) + .unwrap_or_else(|error| panic!("{error}")); + scheduled + .scheduled + .runtime_schema + .processes + .iter() + .filter(|process| !process.is_initializer) + .count() + } + + /// Only the `always @(list)` processes of a combinational loop stay + /// processes; one `initial` block drives each design. + #[test] + fn level_lists_in_a_combinational_loop_stay_processes() { + for (source, kernels) in [ + ( + "module Top(output bit [7:0] a, b, c); + bit [7:0] s; + initial begin #1; s = 1; end + always @(s, b) a = b + s; + always @(a) c = a; + endmodule", + 1, + ), + ( + "module Top(output bit [7:0] a, b); + initial begin #1; a = 1; end + always @(a) if (a < 4) b = a; + always @(b) if (b < 4) a = b + 1; + endmodule", + 3, + ), + ( + "module Top(output bit [7:0] a, b); + bit [7:0] s; + initial begin #1; s = 1; end + always @(s or b) a = (b < 4) ? b + s : b; + always_comb b = (a < 4) ? a : 8'd3; + endmodule", + 2, + ), + ( + "module Top(output bit [7:0] a, b, c); + bit [7:0] s; + initial begin #1; s = 1; end + always @(s or b) a = (b < 4) ? b + s : b; + assign b = (a < 4) ? a : 8'd3; + always @(b) c = b + 8'd10; + endmodule", + 2, + ), + ] { + assert_eq!(procedure_kernels(source), kernels, "{source}"); + } + } + #[test] fn select_sources_adds_nested_offsets_and_keeps_computed_dependencies() { let nested = sv::ir::Expr::Select { diff --git a/crates/celox-frontend-sv/src/lowering/procedural.rs b/crates/celox-frontend-sv/src/lowering/procedural.rs index 68eec7b2149..03c02758893 100644 --- a/crates/celox-frontend-sv/src/lowering/procedural.rs +++ b/crates/celox-frontend-sv/src/lowering/procedural.rs @@ -258,6 +258,68 @@ impl<'a> ProcModule<'a> { false } + /// Whether `always @(items) body` is `always @* body`: no item has an edge + /// or a select, the items name exactly the variables the implicit event + /// expression of `body` has (IEEE 1800-2023 9.4.2.2), and the body neither + /// suspends nor makes a nonblocking assignment, directly or in a call. + pub fn is_implicit_event_list( + &self, + items: &[sv::ir::EventItem], + body: &[sv::ir::Stmt], + ) -> bool { + let mut listed = HashSet::default(); + for item in items { + let sv::ir::Expr::Ident(name) = &item.expr else { + return false; + }; + let Some(id) = self.id(name).filter(|id| !self.is_hidden(*id)) else { + return false; + }; + listed.insert(VarAtomBase::new(id, 0, self.var(id).width - 1)); + } + !self.suspends_or_defers(body) && listed == self.implicit_reads(body, false) + } + + fn suspends_or_defers(&self, body: &[sv::ir::Stmt]) -> bool { + let mut found = false; + let mut calls = Vec::new(); + let mut visit = |stmt: &sv::ir::Stmt, calls: &mut Vec<_>| { + found |= matches!( + stmt, + sv::ir::Stmt::Delay { .. } + | sv::ir::Stmt::WaitEvent(_) + | sv::ir::Stmt::Wait(_) + | sv::ir::Stmt::Assign { + nonblocking: true, + .. + } + | sv::ir::Stmt::AssignConcat { + nonblocking: true, + .. + } + ); + stmt_calls(stmt, calls); + }; + for stmt in body { + stmt.walk(&mut |stmt| visit(stmt, &mut calls)); + } + let mut visited = HashSet::default(); + while let Some((callee, args)) = calls.pop() { + let sv::ir::Callee::Subroutine(name) = callee else { + continue; + }; + if let Some(subroutine) = self.subroutine(&name) { + default_calls(subroutine, &args, &mut calls); + if visited.insert(name) { + for stmt in &subroutine.body { + stmt.walk(&mut |stmt| visit(stmt, &mut calls)); + } + } + } + } + found + } + /// Syntactic implicit sensitivity, including branches that constant folding /// will remove. `always @*` sees arguments; `always_comb` also sees function bodies. pub fn implicit_reads( diff --git a/crates/celox-sv-analyzer/src/ir.rs b/crates/celox-sv-analyzer/src/ir.rs index 8dd8ac14472..70d351e7b4f 100644 --- a/crates/celox-sv-analyzer/src/ir.rs +++ b/crates/celox-sv-analyzer/src/ir.rs @@ -118,6 +118,34 @@ impl Module { self } + /// Represent selected [`InitialProcess::level_sensitive`] processes as + /// `always @*`. The caller selects a process only when its list is the + /// implicit event expression of its statement (IEEE 1800-2023 9.4.2.2). + pub fn lower_level_sensitive_processes( + mut self, + mut select: impl FnMut(&InitialProcess) -> bool, + ) -> Self { + let mut retained = Vec::new(); + for process in std::mem::take(&mut self.initial_processes) { + let Some(body) = process + .level_sensitive() + .filter(|_| select(&process)) + .map(|(_, body)| body.to_vec()) + else { + retained.push(process); + continue; + }; + let at = self + .comb_processes + .partition_point(|comb| comb.creation_order <= process.creation_order); + let mut comb = CombProcess::new(CombProcessKind::AlwaysStar, None, Vec::new(), body); + comb.creation_order = process.creation_order; + self.comb_processes.insert(at, comb); + } + self.initial_processes = retained; + self + } + #[allow(clippy::too_many_arguments)] pub(crate) fn new( id: ModuleId, @@ -1057,6 +1085,34 @@ impl InitialProcess { self.repeats } + /// The event list and statement of `always @(list) statement`, when no + /// list item has an edge. + pub fn level_sensitive(&self) -> Option<(&[EventItem], &[Stmt])> { + if !self.repeats || self.scheduled_edge || self.condition.is_some() { + return None; + } + let [ + Stmt::Loop { + kind: LoopKind::Forever, + init, + condition: None, + step, + body, + }, + ] = self.body.as_slice() + else { + return None; + }; + let (Stmt::WaitEvent(items), body) = body.split_first()? else { + return None; + }; + (init.is_empty() + && step.is_empty() + && items.iter().all(|item| item.edge == EventEdge::Any) + && !leaves_the_process_loop(body)) + .then_some((items.as_slice(), body)) + } + /// The condition of the enclosing conditional generate block, if any. pub fn condition(&self) -> Option<&ConstExpr> { self.condition.as_ref() @@ -1067,6 +1123,24 @@ impl InitialProcess { } } +/// Whether `body` has a `break`, `continue` or `return` outside its own +/// loops, which would leave the loop of its `always` process. +fn leaves_the_process_loop(body: &[Stmt]) -> bool { + body.iter().any(|stmt| match stmt { + Stmt::Break | Stmt::Continue | Stmt::Return(_) => true, + Stmt::If { + then_body, + else_body, + .. + } => leaves_the_process_loop(then_body) || leaves_the_process_loop(else_body), + Stmt::Case { items, default, .. } => { + items.iter().any(|item| leaves_the_process_loop(&item.body)) + || default.as_deref().is_some_and(leaves_the_process_loop) + } + _ => false, + }) +} + #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum FfEdge { Pos, From 568b4db932a472116a3c13b0693854680983ff7c Mon Sep 17 00:00:00 2001 From: tignear Date: Thu, 22 Oct 2026 11:47:48 +0900 Subject: [PATCH 2/4] test(sv): cover event lists lowered like always @* and those kept as processes Verilator runs edgeless event-list always blocks at time zero; the two affected cases are excluded with an adapter-free reproduction. Change-Id: I72c16f4b9aa69f06a7ea37bfa5635b972ffbb703 --- crates/celox-test-suite/LIMITATIONS.md | 9 ++ .../src/sv/cases/always_comb.vtest | 25 ++++ .../src/sv/cases/timing.vtest | 117 ++++++++++++++++++ .../repros/event_list_declaration_startup.sv | 15 +++ ...nt_list_declaration_startup_verilator.json | 39 ++++++ .../verification/sv/limitations.json | 19 +++ .../frontends/systemverilog/always_comb.rs | 6 + .../tests/frontends/systemverilog/timing.rs | 6 + 8 files changed, 236 insertions(+) create mode 100644 crates/celox-test-suite/verification/repros/event_list_declaration_startup.sv create mode 100644 crates/celox-test-suite/verification/repros/event_list_declaration_startup_verilator.json diff --git a/crates/celox-test-suite/LIMITATIONS.md b/crates/celox-test-suite/LIMITATIONS.md index 20c306de17f..45d61219ceb 100644 --- a/crates/celox-test-suite/LIMITATIONS.md +++ b/crates/celox-test-suite/LIMITATIONS.md @@ -365,6 +365,15 @@ The same startup disagreement affects the complete body in and [standalone comparison](verification/repros/wildcard_task_sensitivity_verilator.json) show Verilator failing the startup assertion and Icarus completing it. +Verilator 5.052 also executes an `always` with an edgeless variable event list +at time zero, in `timing::explicit_list_of_every_read_waits_for_a_change` and +`timing::list_with_an_extra_signal_wakes_on_it`. Its event control waits for a +value change (IEEE 1800-2023 9.4.2), and declaration initializers precede it +(6.8). The [adapter-free reproduction](verification/repros/event_list_declaration_startup.sv) +fails its startup assertion in Verilator and passes in Icarus 13.0, which also +passes the unchanged shared assertions. The [retained observation](verification/repros/event_list_declaration_startup_verilator.json) +records both failures; `--include-ignored` retains their assertions. + Verilator 5.052 repeats activation of the self-reading latch in `latch::guarded_activation`, producing 3 where one `seed`/`en` change should produce 1. The [adapter-free reproduction](verification/repros/latch_activation.sv) diff --git a/crates/celox-test-suite/src/sv/cases/always_comb.vtest b/crates/celox-test-suite/src/sv/cases/always_comb.vtest index 9d802ae2951..fd365ba0700 100644 --- a/crates/celox-test-suite/src/sv/cases/always_comb.vtest +++ b/crates/celox-test-suite/src/sv/cases/always_comb.vtest @@ -80,3 +80,28 @@ (for (index expected) (list (0 0xaa) (1 0xbb) (2 0xcc) (3 0xdd)) (modify (set i index)) (assert_eq o expected))) + +; An event list naming exactly the variables the statement reads is the +; implicit event expression of that statement (IEEE 1800-2023 9.4.2.2), in +; either order and with `or` or a comma. +(case explicit_list_of_every_read_settles_like_a_wildcard + (source "level_list.sv" #" + module Top( + input logic [7:0] a, + input logic [7:0] b, + output logic [7:0] y, + output logic [7:0] z + ); + always @(a or b) y = a + b; + always @(b, a) z = a - b; + endmodule + "#) + (top Top) + (modify + (set a 3) + (set b 5)) + (assert_eq y 8) + (assert_eq z 0xfe) + (modify (set a 10)) + (assert_eq y 15) + (assert_eq z 5)) diff --git a/crates/celox-test-suite/src/sv/cases/timing.vtest b/crates/celox-test-suite/src/sv/cases/timing.vtest index c6c9106baca..e0ba72e8c07 100644 --- a/crates/celox-test-suite/src/sv/cases/timing.vtest +++ b/crates/celox-test-suite/src/sv/cases/timing.vtest @@ -170,6 +170,91 @@ (run_to_finish) (assert_eq y 9)) +(case explicit_list_of_every_read_waits_for_a_change + ; Like `always @*`, the list waits before its first run: neither the + ; declaration initializers nor the write of `y` wake it (9.4.2). + (source "level_list.sv" #" + module Top(output logic [7:0] y); + logic [7:0] a = 8'd0; + logic [7:0] b = 8'd0; + initial y = 8'd1; + always @(b, a) y = a + b; + initial begin + #2 a = 8'd3; + #2 b = 8'd5; + #2 $finish; + end + endmodule + "#) + (top Top) + (run_until 1) + (assert_eq y 1) + (run_until 3) + (assert_eq y 3) + (run_to_finish) + (assert_eq y 8)) + +(case list_missing_a_read_does_not_wake_on_it + (source "missing_read.sv" #" + module Top(output logic [7:0] y); + logic [7:0] a = 8'd0; + logic [7:0] b = 8'd0; + initial y = 8'd0; + always @(a) y = a + b; + initial begin + #2 a = 8'd3; + #2 b = 8'd4; + #2 a = 8'd5; + #2 $finish; + end + endmodule + "#) + (top Top) + (run_until 3) + (assert_eq y 3) + (run_until 5) + (assert_eq y 3) + (run_to_finish) + (assert_eq y 9)) + +(case list_with_an_extra_signal_wakes_on_it + (source "extra_signal.sv" #" + module Top; + logic [7:0] a = 8'd0; + logic [7:0] b = 8'd0; + logic c = 1'b0; + always @(a or b or c) $display("sum=%0d", a + b); + initial begin + #2 a = 8'd3; + #2 c = 1'b1; + #2 $finish; + end + endmodule + "#) + (top Top) + (run_to_finish) + (expect_output "sum=3\nsum=3\n")) + +(case list_of_every_read_with_a_nonblocking_body_runs + (source "nonblocking_list.sv" #" + module Top(output logic [7:0] y); + logic [7:0] a = 8'd0; + logic [7:0] b = 8'd0; + initial y = 8'd0; + always @(a or b) y <= a + b; + initial begin + #2 a = 8'd3; + #2 b = 8'd5; + #2 $finish; + end + endmodule + "#) + (top Top) + (run_until 3) + (assert_eq y 3) + (run_to_finish) + (assert_eq y 8)) + (case processes_wake_each_other_at_the_same_time (source "handshake.sv" #" module Top(output logic [7:0] y); @@ -578,6 +663,38 @@ (assert_eq a 4) (assert_eq b 3)) +(case list_in_a_loop_through_always_comb_converges + ; As `always @*` the list would close a combinational loop with the + ; always_comb, so it runs as a process and the loop converges. + (source "comb_feedback.sv" #" + module Top(output bit [7:0] a, b); + bit [7:0] s; + initial begin #1; s = 1; end + always @(s or b) a = (b < 4) ? b + s : b; + always_comb b = (a < 4) ? a : 8'd3; + endmodule + "#) + (top Top) + (run_until 1) + (assert_eq a 4) + (assert_eq b 3)) + +(case list_outside_a_loop_keeps_its_value + (source "partial_feedback.sv" #" + module Top(output bit [7:0] a, b, c); + bit [7:0] s; + initial begin #1; s = 1; end + always @(s or b) a = (b < 4) ? b + s : b; + assign b = (a < 4) ? a : 8'd3; + always @(b) c = b + 8'd10; + endmodule + "#) + (top Top) + (run_until 1) + (assert_eq a 4) + (assert_eq b 3) + (assert_eq c 13)) + (case pure_function_rhs_preserves_distinct_write_times (source "pure-timed-writes.sv" #" module Child(output bit[1:0]q); diff --git a/crates/celox-test-suite/verification/repros/event_list_declaration_startup.sv b/crates/celox-test-suite/verification/repros/event_list_declaration_startup.sv new file mode 100644 index 00000000000..bebc402d47e --- /dev/null +++ b/crates/celox-test-suite/verification/repros/event_list_declaration_startup.sv @@ -0,0 +1,15 @@ +module Top; + logic [7:0] a = 8'd0; + logic [7:0] b = 8'd0; + logic c = 1'b0; + logic [7:0] y; + initial y = 8'd1; + always @(b, a) y = a + b; + always @(a or b or c) $display("sum=%0d", a + b); + initial begin + #1; if (y !== 1) $fatal(1, "declarations do not trigger event list process"); + a = 8'd3; + #1; if (y !== 3) $fatal(1, "later change triggers event list process"); + $finish; + end +endmodule diff --git a/crates/celox-test-suite/verification/repros/event_list_declaration_startup_verilator.json b/crates/celox-test-suite/verification/repros/event_list_declaration_startup_verilator.json new file mode 100644 index 00000000000..7af1f2b24bf --- /dev/null +++ b/crates/celox-test-suite/verification/repros/event_list_declaration_startup_verilator.json @@ -0,0 +1,39 @@ +{ + "schema_version": 3, + "suite_version": "0.11.0", + "tool": "verilator", + "version": "Verilator 5.052 2026-09-05 rev v5.052", + "cases": [ + { + "category": "Sequential", + "detail": "timing::explicit_list_of_every_read_waits_for_a_change at 191:3: assert_eq y: expected 0x1, got 0x0", + "expectation": "Simulation", + "name": "timing::explicit_list_of_every_read_waits_for_a_change", + "phase": "execute", + "status": "mismatch", + "stronger_than_sv": false, + "tag_reasons": {}, + "tags": [] + }, + { + "category": "Sequential", + "detail": "timing::list_with_an_extra_signal_wakes_on_it at 236:3: expect_output: expected [115, 117, 109, 61, 51, 10, 115, 117, 109, 61, 51, 10], got [115, 117, 109, 61, 48, 10, 115, 117, 109, 61, 51, 10, 115, 117, 109, 61, 51, 10]", + "expectation": "Simulation", + "name": "timing::list_with_an_extra_signal_wakes_on_it", + "phase": "execute", + "status": "mismatch", + "stronger_than_sv": false, + "tag_reasons": {}, + "tags": [] + } + ], + "standard": "IEEE 1800-2023 6.8 initializes static declarations before initial/always procedures start; 9.4.2 makes an event control wait for a value change of its expressions. Declaration-initialized a, b, c do not trigger these processes, so y keeps the value its initial procedure wrote and nothing is displayed until a later change of a.", + "adapter_free": { + "source": "verification/repros/event_list_declaration_startup.sv", + "verilator_command": "verilator --binary --timing -Wno-fatal --top-module Top --Mdir event_list_declaration_startup.sv", + "verilator_output": "sum=0\n[1] %Fatal: event_list_declaration_startup.sv:10: Assertion failed in Top: declarations do not trigger event list process", + "icarus_command": "iverilog -g2012 -s Top -o event_list_declaration_startup.sv; vvp ", + "icarus_version": "Icarus Verilog version 13.0", + "icarus_output": "sum=3\nevent_list_declaration_startup.sv:13: $finish called at 2 (1s)" + } +} diff --git a/crates/celox-test-suite/verification/sv/limitations.json b/crates/celox-test-suite/verification/sv/limitations.json index 49ce5c92e65..ed23080b090 100644 --- a/crates/celox-test-suite/verification/sv/limitations.json +++ b/crates/celox-test-suite/verification/sv/limitations.json @@ -1617,6 +1617,25 @@ ] } }, + { + "id": "sv_verilator_event_list_timezero", + "category": "simulator_disagreement", + "phase": "execute", + "observed_version": "Verilator 5.052 2026-09-05 rev v5.052; Icarus 13.0", + "reason": "Verilator executes an always procedure whose event control lists variables without edges at time zero, before any listed variable changes: y loses the value its initial procedure wrote, and a $display body prints once more. IEEE 1800-2023 6.8 initializes static declarations before initial/always processes start, and 9.4.2 makes the event control wait for a value change. Icarus passes the unchanged shared assertions; the adapter-free source reproduces the Verilator failure.", + "upstream": [], + "evidence": [ + "verification/repros/event_list_declaration_startup_verilator.json", + "verification/repros/event_list_declaration_startup.sv", + "LIMITATIONS.md#systemverilog-suite" + ], + "cases": { + "verilator": [ + "timing::explicit_list_of_every_read_waits_for_a_change", + "timing::list_with_an_extra_signal_wakes_on_it" + ] + } + }, { "id": "sv_verilator_latch_pulse_self_activation", "category": "simulator_disagreement", diff --git a/crates/celox/tests/frontends/systemverilog/always_comb.rs b/crates/celox/tests/frontends/systemverilog/always_comb.rs index b3e35621d1c..217da03437b 100644 --- a/crates/celox/tests/frontends/systemverilog/always_comb.rs +++ b/crates/celox/tests/frontends/systemverilog/always_comb.rs @@ -21,3 +21,9 @@ sv_backends! { @case "always_comb::orders_dynamic_array_read_after_its_writer"; } } + +sv_backends! { + fn explicit_list_of_every_read_settles_like_a_wildcard(sim) { + @case "always_comb::explicit_list_of_every_read_settles_like_a_wildcard"; + } +} diff --git a/crates/celox/tests/frontends/systemverilog/timing.rs b/crates/celox/tests/frontends/systemverilog/timing.rs index 70aabb29492..8e6b8781778 100644 --- a/crates/celox/tests/frontends/systemverilog/timing.rs +++ b/crates/celox/tests/frontends/systemverilog/timing.rs @@ -64,6 +64,10 @@ timed_cases! { fn any_change_waits_wake_on_every_value_change = "timing::any_change_waits_wake_on_every_value_change"; fn wait_statements_block_until_their_condition_holds = "timing::wait_statements_block_until_their_condition_holds"; fn level_sensitive_always_runs_as_a_process = "timing::level_sensitive_always_runs_as_a_process"; + fn explicit_list_of_every_read_waits_for_a_change = "timing::explicit_list_of_every_read_waits_for_a_change"; + fn list_missing_a_read_does_not_wake_on_it = "timing::list_missing_a_read_does_not_wake_on_it"; + fn list_with_an_extra_signal_wakes_on_it = "timing::list_with_an_extra_signal_wakes_on_it"; + fn list_of_every_read_with_a_nonblocking_body_runs = "timing::list_of_every_read_with_a_nonblocking_body_runs"; fn processes_wake_each_other_at_the_same_time = "timing::processes_wake_each_other_at_the_same_time"; fn tasks_with_timing_controls_run_in_processes = "timing::tasks_with_timing_controls_run_in_processes"; fn edge_waits_see_the_signals_the_script_drives = "timing::edge_waits_see_the_signals_the_script_drives"; @@ -87,6 +91,8 @@ timed_cases! { fn inactive_time_directives_do_not_change_scheduler_units = "timing::inactive_time_directives_do_not_change_scheduler_units"; fn blocking_concatenation_publishes_one_event_update = "timing::blocking_concatenation_publishes_one_event_update"; fn finite_active_feedback_preserves_convergence = "timing::finite_active_feedback_preserves_convergence"; + fn list_in_a_loop_through_always_comb_converges = "timing::list_in_a_loop_through_always_comb_converges"; + fn list_outside_a_loop_keeps_its_value = "timing::list_outside_a_loop_keeps_its_value"; fn pure_function_rhs_preserves_distinct_write_times = "timing::pure_function_rhs_preserves_distinct_write_times"; fn conditional_writes_preserve_distinct_activation_times = "timing::conditional_writes_preserve_distinct_activation_times"; fn case_writes_preserve_distinct_activation_times = "timing::case_writes_preserve_distinct_activation_times"; From 119fe669802f1f91019ea52709859a82ae3f36a6 Mon Sep 17 00:00:00 2001 From: tignear Date: Thu, 22 Oct 2026 12:59:51 +0900 Subject: [PATCH 3/4] test(sv): retain the Verilator event-list time-zero exclusions Change-Id: I7fb7b8ea84d8192a21b47b54d33b91574d8d8d7f --- .../verification/sv/verilator/timing.json | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/crates/celox-test-suite/verification/sv/verilator/timing.json b/crates/celox-test-suite/verification/sv/verilator/timing.json index 6058dfc509d..ad8a2963e8d 100644 --- a/crates/celox-test-suite/verification/sv/verilator/timing.json +++ b/crates/celox-test-suite/verification/sv/verilator/timing.json @@ -297,6 +297,30 @@ "tag_reasons": {}, "tags": [] }, + { + "category": "Sequential", + "detail": "Verilator executes an always procedure whose event control lists variables without edges at time zero, before any listed variable changes: y loses the value its initial procedure wrote, and a $display body prints once more. IEEE 1800-2023 6.8 initializes static declarations before initial/always processes start, and 9.4.2 makes the event control wait for a value change. Icarus passes the unchanged shared assertions; the adapter-free source reproduces the Verilator failure.", + "expectation": "Simulation", + "known_issue": { + "category": "simulator_disagreement", + "evidence": [ + "verification/repros/event_list_declaration_startup_verilator.json", + "verification/repros/event_list_declaration_startup.sv", + "LIMITATIONS.md#systemverilog-suite" + ], + "id": "sv_verilator_event_list_timezero", + "observed_version": "Verilator 5.052 2026-09-05 rev v5.052; Icarus 13.0", + "phase": "execute", + "reason": "Verilator executes an always procedure whose event control lists variables without edges at time zero, before any listed variable changes: y loses the value its initial procedure wrote, and a $display body prints once more. IEEE 1800-2023 6.8 initializes static declarations before initial/always processes start, and 9.4.2 makes the event control wait for a value change. Icarus passes the unchanged shared assertions; the adapter-free source reproduces the Verilator failure.", + "upstream": [] + }, + "name": "timing::explicit_list_of_every_read_waits_for_a_change", + "phase": "skip", + "status": "ignored", + "stronger_than_sv": false, + "tag_reasons": {}, + "tags": [] + }, { "category": "Sequential", "detail": "", @@ -441,6 +465,30 @@ "tag_reasons": {}, "tags": [] }, + { + "category": "Sequential", + "detail": "Verilator executes an always procedure whose event control lists variables without edges at time zero, before any listed variable changes: y loses the value its initial procedure wrote, and a $display body prints once more. IEEE 1800-2023 6.8 initializes static declarations before initial/always processes start, and 9.4.2 makes the event control wait for a value change. Icarus passes the unchanged shared assertions; the adapter-free source reproduces the Verilator failure.", + "expectation": "Simulation", + "known_issue": { + "category": "simulator_disagreement", + "evidence": [ + "verification/repros/event_list_declaration_startup_verilator.json", + "verification/repros/event_list_declaration_startup.sv", + "LIMITATIONS.md#systemverilog-suite" + ], + "id": "sv_verilator_event_list_timezero", + "observed_version": "Verilator 5.052 2026-09-05 rev v5.052; Icarus 13.0", + "phase": "execute", + "reason": "Verilator executes an always procedure whose event control lists variables without edges at time zero, before any listed variable changes: y loses the value its initial procedure wrote, and a $display body prints once more. IEEE 1800-2023 6.8 initializes static declarations before initial/always processes start, and 9.4.2 makes the event control wait for a value change. Icarus passes the unchanged shared assertions; the adapter-free source reproduces the Verilator failure.", + "upstream": [] + }, + "name": "timing::list_with_an_extra_signal_wakes_on_it", + "phase": "skip", + "status": "ignored", + "stronger_than_sv": false, + "tag_reasons": {}, + "tags": [] + }, { "category": "Sequential", "detail": "", From 32fa9c4584e369a10f2f432ffc6bbbe66523bac7 Mon Sep 17 00:00:00 2001 From: tignear Date: Thu, 22 Oct 2026 13:30:50 +0900 Subject: [PATCH 4/4] docs(sv): document event lists that simulate like always @* Change-Id: I7add15ad54316af2cffff68d1b3cb7fafd18d0be --- docs/guide/systemverilog-reference.md | 14 ++++++++++---- docs/guide/systemverilog.md | 5 +++-- docs/ja/guide/systemverilog-reference.md | 7 ++++++- docs/ja/guide/systemverilog.md | 3 ++- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/docs/guide/systemverilog-reference.md b/docs/guide/systemverilog-reference.md index cbe8d605be0..323a333712f 100644 --- a/docs/guide/systemverilog-reference.md +++ b/docs/guide/systemverilog-reference.md @@ -53,10 +53,16 @@ In a timed `Simulation`, `initial` and plain `always` processes can suspend: | `wait (condition)` | any condition; an X or Z condition counts as false | | Assignments | blocking and nonblocking; nonblocking updates take effect in the NBA region of the time slot | -An `always` with a sensitivity list other than `@*`, such as -`always @(a or b)`, runs as a process too. A `Simulator` runs no processes, -so such a design simulates without them there; use `Simulation`, or write -`always @*` or `always_comb` ([#1712](https://github.com/celox-sim/celox/issues/1712)). +An `always` whose sensitivity list names exactly the variables its statement +reads, as `@*` would (IEEE 1800-2023 9.4.2.2), simulates like `always @*` in +both `Simulator` and `Simulation`: `always @(a or b) y = a + b;` or +`always @(b, a) y = a + b;`. The statement must not contain a timing control +or a nonblocking assignment. Any other sensitivity list without edges runs as +a process: `always @(a) y = a + b;` leaves `y` unchanged when only `b` +changes. So does a list that, as `always @*`, would close a combinational +loop with other logic. A `Simulator` runs no processes, so such a design simulates without them there; +use `Simulation`, or write `always @*` or `always_comb` +([#1712](https://github.com/celox-sim/celox/issues/1712)). ### Timed task calls diff --git a/docs/guide/systemverilog.md b/docs/guide/systemverilog.md index 7623b7ee719..3bd77d40462 100644 --- a/docs/guide/systemverilog.md +++ b/docs/guide/systemverilog.md @@ -61,8 +61,9 @@ compilation unit; choose the top by its SystemVerilog module name. `Simulator::tick` drives the rising edge of the selected event. `Simulation` tracks time and runs scheduled edges. Constant initialization applies to both. `initial` blocks that read design state or call system tasks, processes with -timing controls and `always` blocks with a sensitivity list other than `@*` run -as processes and need `Simulation`; a `Simulator` does not run them +timing controls and `always` blocks whose sensitivity list is neither `@*` nor +[the variables they read](./systemverilog-reference#timing-controls) run as +processes and need `Simulation`; a `Simulator` does not run them ([#1712](https://github.com/celox-sim/celox/issues/1712)). Use `.four_state(true)` on the builder when your test needs X/Z values. The diff --git a/docs/ja/guide/systemverilog-reference.md b/docs/ja/guide/systemverilog-reference.md index 50ec446cad0..69135ca1087 100644 --- a/docs/ja/guide/systemverilog-reference.md +++ b/docs/ja/guide/systemverilog-reference.md @@ -52,7 +52,12 @@ outline: [2, 3] | `wait (condition)` | 任意の条件。X / Z の条件は偽として扱う | | 代入 | ブロッキング代入とノンブロッキング代入。ノンブロッキング代入はそのタイムスロットの NBA 領域で反映 | -`always @(a or b)` のように `@*` 以外のセンシティビティリストを持つ `always` も +文が読む変数をちょうど並べたセンシティビティリスト(`@*` が求めるもの、IEEE 1800-2023 9.4.2.2)を持つ +`always` は、`always @(a or b) y = a + b;` や `always @(b, a) y = a + b;` のように、 +`Simulator` でも `Simulation` でも `always @*` と同様にシミュレーションします。 +文にはタイミング制御とノンブロッキング代入を含められません。エッジを持たないそれ以外の +センシティビティリストを持つ `always` はプロセスとして実行します。`always @(a) y = a + b;` は +`b` だけが変化しても `y` を更新しません。`always @*` として扱うと他の論理と組み合わせループを作るリストも プロセスとして実行します。`Simulator` はプロセスを実行しないため、そこではこのプロセス抜きで シミュレーションされます。`Simulation` を使うか、`always @*` / `always_comb` で記述してください ([#1712](https://github.com/celox-sim/celox/issues/1712))。 diff --git a/docs/ja/guide/systemverilog.md b/docs/ja/guide/systemverilog.md index c341643e4eb..16a0ceab3d1 100644 --- a/docs/ja/guide/systemverilog.md +++ b/docs/ja/guide/systemverilog.md @@ -58,7 +58,8 @@ assert_eq!(sim.get(q), 1u8.into()); `Simulator::tick` は指定イベントの立ち上がりエッジを駆動します。 `Simulation` は時刻を管理し、スケジュールされたエッジを実行します。 定数による初期化はどちらにも適用されます。デザインの状態を読む、またはシステムタスクを呼ぶ -`initial` ブロック、タイミング制御を持つプロセス、`@*` 以外のセンシティビティリストを持つ +`initial` ブロック、タイミング制御を持つプロセス、`@*` でも +[文が読む変数](./systemverilog-reference#timing-controls)でもないセンシティビティリストを持つ `always` はプロセスとして実行するため `Simulation` が必要です。`Simulator` はこれらを実行しません ([#1712](https://github.com/celox-sim/celox/issues/1712))。