diff --git a/conformance/sv-tests/expected.tsv b/conformance/sv-tests/expected.tsv index df1c18dab94..52245a05b56 100644 --- a/conformance/sv-tests/expected.tsv +++ b/conformance/sv-tests/expected.tsv @@ -16,7 +16,7 @@ chapter-11/11.10.1--string_concat.sv fail chapter-11/11.10.1--string_copy.sv fail chapter-11/11.10.3--empty_string-sim.sv fail chapter-11/11.10.3--empty_string.sv fail -chapter-11/11.11--min_max_avg_delay.sv fail +chapter-11/11.11--min_max_avg_delay.sv pass chapter-11/11.12--let_construct.sv fail chapter-11/11.3.5--expr_short_circuit.sv pass chapter-11/11.3.6--assign_in_exp-sim.sv fail @@ -726,7 +726,7 @@ chapter-9/9.3.5--statement_labels_par.sv fail chapter-9/9.3.5--statement_labels_seq.sv pass chapter-9/9.4.1--delay_control-sim.sv fail chapter-9/9.4.1--delay_control-two-blocks-sim.sv fail -chapter-9/9.4.1--delay_control.sv fail +chapter-9/9.4.1--delay_control.sv pass chapter-9/9.4.2--event_control_edge.sv fail chapter-9/9.4.2--event_control_negedge.sv pass chapter-9/9.4.2--event_control_posedge.sv pass @@ -737,7 +737,7 @@ chapter-9/9.4.2.1--event_or_op.sv fail chapter-9/9.4.2.2--event_implicit.sv pass chapter-9/9.4.2.3--event_conditional.sv fail chapter-9/9.4.2.4--event_sequence.sv fail -chapter-9/9.4.3--event_sequence_controls.sv fail +chapter-9/9.4.3--event_sequence_controls.sv pass chapter-9/9.4.5--event_blocking_assignment_delay.sv fail chapter-9/9.4.5--event_nonblocking_assignment_delay.sv fail chapter-9/9.4.5--event_nonblocking_assignment_event.sv fail diff --git a/crates/celox-frontend-sv/src/lowering.rs b/crates/celox-frontend-sv/src/lowering.rs index 10a5f1f5b66..a5b83f3e2fd 100644 --- a/crates/celox-frontend-sv/src/lowering.rs +++ b/crates/celox-frontend-sv/src/lowering.rs @@ -13,7 +13,7 @@ use celox_design::{ BinaryOp, BitAccess, DisplaySizing, DomainKind, ExternFunction, ExternSignature, ExternType, InitialStateData, InitialStateValue, ModuleId, PROCESS_DELAY_WIDTH, PROCESS_STATUS_WIDTH, PortTypeKind, ProcessSlots, RegionedVarAddrBase, RuntimeErrorInfo, RuntimeEventKind, - RuntimeEventSite, STABLE_REGION, TriggerSet, UnaryOp, VarAtomBase, WORKING_REGION, + RuntimeEventSite, STABLE_REGION, TriggerSet, UnaryOp, VarAtomBase, WORKING_REGION, WaitSite, }; use celox_frontend_core::process::PROCESS_RESUME_WIDTH; use celox_frontend_core::symbolic::artifact::{ @@ -1977,7 +1977,7 @@ fn lower_module_with_overrides( ) }; mark_ff_event_domains(&event_vars, &mut variables); - let (initial_values, processes) = lower_initial_processes( + let (initial_values, processes, wait_sites) = lower_initial_processes( module, &mut variables, &mut name_to_id, @@ -2082,7 +2082,7 @@ fn lower_module_with_overrides( processes, package_bindings: HashMap::default(), counter_slots: Vec::new(), - wait_sites: Vec::new(), + wait_sites, nba_sites: Vec::new(), }, variables, @@ -2740,9 +2740,16 @@ fn lower_initial_processes( runtime_event_sites: &mut Vec, runtime_errors: &mut HashMap>, extern_functions: &mut Vec, -) -> Result<(Vec>, Vec), sv::AnalyzerError> { +) -> Result< + ( + Vec>, + Vec, + Vec>, + ), + sv::AnalyzerError, +> { if module.initial_processes().is_empty() { - return Ok((Vec::new(), Vec::new())); + return Ok((Vec::new(), Vec::new(), Vec::new())); } let mut values = Vec::new(); let mut runtime = Vec::new(); @@ -2790,7 +2797,7 @@ fn lower_initial_processes( } } if runtime.is_empty() { - return Ok((values, Vec::new())); + return Ok((values, Vec::new(), Vec::new())); } let mut next_id = SourceVarId( @@ -2844,21 +2851,25 @@ fn lower_initial_processes( pm.runtime_event_sites = std::mem::take(runtime_event_sites); pm.runtime_errors = std::mem::take(runtime_errors); pm.extern_functions = std::mem::take(extern_functions); + let mut wait_sites = Vec::new(); let processes = runtime .into_iter() .zip(slots) - .map(|((process, random_seed), slots)| { - Ok(SymbolicProcess { - kernel: ff::Ff::new(&mut pm, random_seed) - .lower_initial_kernel(process.body(), slots)?, + .enumerate() + .map(|(index, ((process, random_seed), slots))| { + let (kernel, sites) = ff::Ff::new(&mut pm, random_seed).lower_initial_kernel( + process.body(), slots, - }) + index, + )?; + wait_sites.extend(sites); + Ok(SymbolicProcess { kernel, slots }) }) .collect::, sv::AnalyzerError>>(); *runtime_event_sites = std::mem::take(&mut pm.runtime_event_sites); *runtime_errors = std::mem::take(&mut pm.runtime_errors); *extern_functions = std::mem::take(&mut pm.extern_functions); - Ok((values, processes?)) + Ok((values, processes?, wait_sites)) } fn lower_comb_processes( diff --git a/crates/celox-frontend-sv/src/lowering/comb.rs b/crates/celox-frontend-sv/src/lowering/comb.rs index bb8fdea1ce8..1595e3eacc0 100644 --- a/crates/celox-frontend-sv/src/lowering/comb.rs +++ b/crates/celox-frontend-sv/src/lowering/comb.rs @@ -1788,6 +1788,10 @@ impl<'p, 'a> Comb<'p, 'a> { self.assign_concat(&mut store, frames, parts, rhs)?; Ok(store) } + // A timing control suspends a process; this lowering has none. + sv::ir::Stmt::Delay(_) | sv::ir::Stmt::WaitEvent(_) | sv::ir::Stmt::Wait(_) => { + Err(unsupported("procedural timing control")) + } sv::ir::Stmt::Local { name, init } => { let id = self .m diff --git a/crates/celox-frontend-sv/src/lowering/ff.rs b/crates/celox-frontend-sv/src/lowering/ff.rs index 90d3adfda0d..745321e9274 100644 --- a/crates/celox-frontend-sv/src/lowering/ff.rs +++ b/crates/celox-frontend-sv/src/lowering/ff.rs @@ -11,7 +11,8 @@ use super::procedural::*; use super::*; -use celox_frontend_core::process::ProcessKernelBuilder; +use celox_design::{CounterKind, WaitSite}; +use celox_frontend_core::process::{ProcessKernelBuilder, ProcessKernelError}; use celox_sir::{RegisterId, RegisterType}; use celox_slt::SLTToSIRLowerer; use num_traits::{ToPrimitive, Zero}; @@ -57,6 +58,10 @@ pub(super) struct Ff<'p, 'a> { /// body is lowered, and the process reads and writes stable state /// directly. kernel: Option, + /// The index of the process being lowered among the module's kernels. + process: usize, + /// The wait sites of the process, by local index. + wait_sites: Vec>, direct: bool, } @@ -101,6 +106,8 @@ impl<'p, 'a> Ff<'p, 'a> { dist_seed: None, kernel: None, direct: false, + process: 0, + wait_sites: Vec::new(), } } @@ -1811,6 +1818,18 @@ impl<'p, 'a> Ff<'p, 'a> { self.assign_concat(parts, rhs)?; Ok(true) } + sv::ir::Stmt::Delay(amount) => { + self.delay(amount)?; + Ok(true) + } + sv::ir::Stmt::WaitEvent(items) => { + self.wait_event(items)?; + Ok(true) + } + sv::ir::Stmt::Wait(condition) => { + self.wait_level(condition)?; + Ok(true) + } sv::ir::Stmt::Local { name, init } => { let id = self .m @@ -2353,7 +2372,32 @@ impl<'p, 'a> Ff<'p, 'a> { sv::ir::LoopKind::Repeat(count) => { let signed = self.expr_signed(count); let (id, name) = self.m.temp("repeat", 64, false, false); - let value = self.eval(count, Some((64, signed)))?; + let value = if self.kernel.is_some() { + // A count with an unknown bit, or a negative one, runs + // the body zero times (IEEE 1800-2023 12.7.2). + let count = if signed { + sv::ir::Expr::Mux { + condition: Box::new(sv::ir::Expr::Binary { + left: Box::new(count.clone()), + op: sv::ir::BinaryOp::Lt, + right: Box::new(sv::ir::Expr::Literal("0".to_string())), + }), + then_expr: Box::new(sv::ir::Expr::Literal("0".to_string())), + else_expr: Box::new(count.clone()), + } + } else { + count.clone() + }; + let mut arena = SLTNodeArena::new(); + let node = self.expr_slt(&count, None, &mut arena)?; + let original = self.lower_slt(&arena, node)?; + let node = + coerce_node_width(&mut arena, node, Some(64), signed).map_err(slt_error)?; + let value = self.lower_slt(&arena, node)?; + self.zero_if_unknown(value, original) + } else { + self.eval(count, Some((64, signed)))? + }; self.store(id, SIROffset::Static(0), 64, value); Some(name) } @@ -2409,6 +2453,14 @@ impl<'p, 'a> Ff<'p, 'a> { if falls? { self.jump(latch); } + // A kernel loop that may not suspend yields now and then, so the + // runtime charges it against the time slot's budget instead of + // spinning in the kernel. + let header = if self.kernel.is_some() && !always_suspends(body) { + self.yielding_back_edge(header)? + } else { + header + }; // Latch: the step, then the condition again. A counted loop whose // step leaves its variable unchanged would never end; it stops the // simulation with an error instead. @@ -2847,7 +2899,9 @@ impl Ff<'_, '_> { mut self, body: &[sv::ir::Stmt], slots: ProcessSlots, - ) -> Result, sv::AnalyzerError> { + process: usize, + ) -> Result<(ExecutionUnit, Vec>), sv::AnalyzerError> { + self.process = process; // A nonblocking update would take effect in a later region of the // time step, after the process has run on. for stmt in body { @@ -2878,10 +2932,267 @@ impl Ff<'_, '_> { std::mem::swap(&mut self.b, kernel.builder()); let mut unit = kernel.build(); prune_unreachable_blocks(&mut unit); - Ok(unit) + Ok((unit, self.wait_sites)) + } + + /// `#amount` (IEEE 1800-2023 9.4.1). The amount is self-determined and + /// read as an unsigned 64-bit time: a negative value as its two's + /// complement, and a value with an unknown bit as zero. `#0` resumes in + /// the inactive region. + fn delay(&mut self, amount: &sv::ir::Expr) -> Result<(), sv::AnalyzerError> { + let signed = self.expr_signed(amount); + let mut arena = SLTNodeArena::new(); + let node = self.expr_slt(amount, None, &mut arena)?; + let original = self.lower_slt(&arena, node)?; + let node = coerce_node_width(&mut arena, node, Some(PROCESS_DELAY_WIDTH), signed) + .map_err(slt_error)?; + let delay = self.lower_slt(&arena, node)?; + let delay = self.zero_if_unknown(delay, original); + self.with_kernel(|kernel| kernel.inactive_delay(delay)) + .map_err(kernel_error) + } + + /// `value` as a two-state register that is zero when `source` has an + /// unknown bit. + fn zero_if_unknown(&mut self, value: RegisterId, source: RegisterId) -> RegisterId { + let width = self.b.register(&value).width(); + if !matches!(self.b.register(&source), RegisterType::Logic { .. }) { + return value; + } + // The reduction XOR of a value is unknown exactly when a bit is. + let reduced = self.b.alloc_logic(1); + self.b + .emit(SIRInstruction::Unary(reduced, UnaryOp::Xor, source)); + let zero = self.b.alloc_bit(1, false); + self.b.emit(SIRInstruction::Imm(zero, SIRValue::new(0u8))); + let one = self.b.alloc_bit(1, false); + self.b.emit(SIRInstruction::Imm(one, SIRValue::new(1u8))); + let is_zero = self.b.alloc_bit(1, false); + self.b.emit(SIRInstruction::Binary( + is_zero, + reduced, + BinaryOp::EqCase, + zero, + )); + let is_one = self.b.alloc_bit(1, false); + self.b.emit(SIRInstruction::Binary( + is_one, + reduced, + BinaryOp::EqCase, + one, + )); + let known = self.b.alloc_bit(1, false); + self.b + .emit(SIRInstruction::Binary(known, is_zero, BinaryOp::Or, is_one)); + let value = match *self.b.register(&value) { + RegisterType::Logic { width } => { + let two_state = self.b.alloc_bit(width, false); + self.b + .emit(SIRInstruction::Unary(two_state, UnaryOp::ToTwoState, value)); + two_state + } + _ => value, + }; + let zero = self.b.alloc_bit(width, false); + self.b.emit(SIRInstruction::Imm(zero, SIRValue::new(0u8))); + let result = self.b.alloc_bit(width, false); + self.b.emit(SIRInstruction::Mux(result, known, value, zero)); + result + } + + /// `@(items)` (IEEE 1800-2023 9.4.2): the process waits for an + /// occurrence of any item, which the runtime detects on the watched + /// signals themselves, so nothing is left to check when it resumes. + fn wait_event(&mut self, items: &[sv::ir::EventItem]) -> Result<(), sv::AnalyzerError> { + let mut terms = Vec::new(); + for item in items { + let id = match &item.expr { + sv::ir::Expr::Ident(name) => self.m.id(name).filter(|&id| !self.m.is_hidden(id)), + _ => None, + } + .ok_or_else(|| unsupported("event expression other than a variable"))?; + match item.edge { + sv::ir::EventEdge::Any => terms.push((id, CounterKind::Changes)), + sv::ir::EventEdge::Pos => terms.push((id, CounterKind::Rises)), + sv::ir::EventEdge::Neg => terms.push((id, CounterKind::Falls)), + sv::ir::EventEdge::Both => { + terms.push((id, CounterKind::Rises)); + terms.push((id, CounterKind::Falls)); + } + } + } + let site = self.wait_site(terms); + self.with_kernel(|kernel| -> Result<(), ProcessKernelError> { + kernel.suspend_wait(site)?; + let woken = kernel.builder().alloc_bit(1, false); + kernel + .builder() + .emit(SIRInstruction::Imm(woken, SIRValue::new(1u8))); + kernel.wake_if(woken); + Ok(()) + }) + .map_err(kernel_error) + } + + /// `wait (condition)` (IEEE 1800-2023 9.4.3): the process goes on at once + /// if the condition holds, and otherwise checks it again whenever a + /// variable it reads changes. + fn wait_level(&mut self, condition: &sv::ir::Expr) -> Result<(), sv::AnalyzerError> { + let mut names = HashSet::default(); + expr_idents(condition, &mut names); + subroutine_reads(self.m, condition, &mut names); + let mut ids: Vec<_> = names + .iter() + .filter_map(|name| self.m.id(name)) + .filter(|&id| !self.m.is_hidden(id)) + .collect(); + ids.sort_unstable(); + ids.dedup(); + let site = self.wait_site( + ids.into_iter() + .map(|id| (id, CounterKind::Changes)) + .collect(), + ); + // The condition is lowered once per check: before the process + // suspends and at every resume. + let mut error = None; + let mut kernel = self.kernel.take().expect("lowering a process kernel"); + std::mem::swap(&mut self.b, kernel.builder()); + // The kernel is out of `self` while it builds the checks; reads go + // to stable state all the same. + let direct = std::mem::replace(&mut self.direct, true); + let result = kernel.wait_level(site, |builder| { + std::mem::swap(&mut self.b, builder); + let truth = self.eval_truth(condition).map(|(truth, _)| truth); + std::mem::swap(&mut self.b, builder); + truth.unwrap_or_else(|e| { + error = Some(e); + let never = builder.alloc_bit(1, false); + builder.emit(SIRInstruction::Imm(never, SIRValue::new(0u8))); + never + }) + }); + self.direct = direct; + std::mem::swap(&mut self.b, kernel.builder()); + self.kernel = Some(kernel); + result.map_err(kernel_error)?; + error.map_or(Ok(()), Err) + } + + /// Declare a wait site of the process with the given terms and return + /// its local index. + fn wait_site(&mut self, terms: Vec<(SourceVarId, CounterKind)>) -> u32 { + let index = self.wait_sites.len() as u32; + self.wait_sites.push(WaitSite { + process: self.process, + terms, + }); + index + } + + /// The back edge of a kernel loop that may not suspend: count the + /// iteration, yield every 2^[`LOOP_YIELD_BITS`] of them, and continue at + /// `header`. Returns the block the loop's back edges jump to. + fn yielding_back_edge(&mut self, header: BlockId) -> Result { + let back = self.b.new_block(); + let (counter, _) = self.m.temp("loop", LOOP_YIELD_BITS, false, false); + self.b.switch_to_block(back); + let count = self.b.alloc_bit(LOOP_YIELD_BITS, false); + self.b.emit(SIRInstruction::Load( + count, + stable(counter), + SIROffset::Static(0), + LOOP_YIELD_BITS, + )); + let one = self.b.alloc_bit(LOOP_YIELD_BITS, false); + self.b.emit(SIRInstruction::Imm(one, SIRValue::new(1u8))); + let next = self.b.alloc_bit(LOOP_YIELD_BITS, false); + self.b + .emit(SIRInstruction::Binary(next, count, BinaryOp::Add, one)); + self.store(counter, SIROffset::Static(0), LOOP_YIELD_BITS, next); + let zero = self.b.alloc_bit(LOOP_YIELD_BITS, false); + self.b.emit(SIRInstruction::Imm(zero, SIRValue::new(0u8))); + let wrapped = self.b.alloc_bit(1, false); + self.b + .emit(SIRInstruction::Binary(wrapped, next, BinaryOp::Eq, zero)); + let yield_block = self.b.new_block(); + self.b.seal_block(SIRTerminator::Branch { + cond: wrapped, + true_block: (yield_block, Vec::new()), + false_block: (header, Vec::new()), + }); + self.b.switch_to_block(yield_block); + self.with_kernel(ProcessKernelBuilder::yield_now) + .map_err(kernel_error)?; + self.jump(header); + Ok(back) } } +/// Iterations, as a power of two, between the yields of a kernel loop that +/// may not suspend. +const LOOP_YIELD_BITS: usize = 16; + +/// Whether every pass through `stmts` suspends the process. +fn always_suspends(stmts: &[sv::ir::Stmt]) -> bool { + stmts + .iter() + .any(|stmt| matches!(stmt, sv::ir::Stmt::Delay(_) | sv::ir::Stmt::WaitEvent(_))) +} + +/// The module variables the subroutines `expr` calls read, directly or +/// through further calls, besides their own formals and locals. +fn subroutine_reads(pm: &ProcModule<'_>, expr: &sv::ir::Expr, names: &mut HashSet) { + let mut pending = Vec::new(); + collect_call_names(expr, &mut pending); + let mut visited = HashSet::default(); + while let Some(name) = pending.pop() { + if !visited.insert(name.clone()) { + continue; + } + let Some(subroutine) = pm.subroutine(&name) else { + continue; + }; + for param in &subroutine.params { + if let Some(default) = ¶m.default { + expr_idents(default, names); + } + } + for stmt in &subroutine.body { + let mut stmt = stmt.clone(); + stmt.visit_mut( + &mut |expr| { + expr_idents(expr, names); + collect_call_names(expr, &mut pending); + }, + &mut |_| {}, + &mut |_| {}, + ); + stmt.walk(&mut |stmt| { + if let sv::ir::Stmt::Call { name, .. } = stmt { + pending.push(name.clone()); + } + }); + } + } +} + +/// The names of the user subroutines `expr` calls. +fn collect_call_names(expr: &sv::ir::Expr, names: &mut Vec) { + let called = std::cell::RefCell::new(Vec::new()); + expr_calls(expr, &|callee| { + if let Some(name) = callee.subroutine() { + called.borrow_mut().push(name.to_string()); + } + false + }); + names.extend(called.into_inner()); +} + +fn kernel_error(error: ProcessKernelError) -> sv::AnalyzerError { + unsupported(error.to_string()) +} + fn seal_drained(mut builder: SIRBuilder) -> ExecutionUnit { let (blocks, register_map, _) = builder.drain(); let mut unit = ExecutionUnit { diff --git a/crates/celox-sv-analyzer/src/ast/const_functions.rs b/crates/celox-sv-analyzer/src/ast/const_functions.rs index 71898334e11..f4edb75fc48 100644 --- a/crates/celox-sv-analyzer/src/ast/const_functions.rs +++ b/crates/celox-sv-analyzer/src/ast/const_functions.rs @@ -969,6 +969,8 @@ impl Frame<'_> { // Messages have no effect on the value. Unknown and unsupported // system tasks are rejected before elaboration. Stmt::SystemTask { .. } => {} + // A function has no timing controls (IEEE 1800-2023 13.4). + Stmt::Delay(_) | Stmt::WaitEvent(_) | Stmt::Wait(_) => return None, Stmt::AssignConcat { .. } | Stmt::Call { .. } => return None, } Some(Flow::Next) diff --git a/crates/celox-sv-analyzer/src/ast/lifetimes.rs b/crates/celox-sv-analyzer/src/ast/lifetimes.rs index 84b66629b3a..d468b131f69 100644 --- a/crates/celox-sv-analyzer/src/ast/lifetimes.rs +++ b/crates/celox-sv-analyzer/src/ast/lifetimes.rs @@ -527,6 +527,16 @@ impl Flow<'_> { } Ok(Exits::next(written)) } + Stmt::Delay(expr) | Stmt::Wait(expr) => { + self.read(expr, written)?; + Ok(Exits::next(written)) + } + Stmt::WaitEvent(items) => { + for item in items { + self.read(&item.expr, written)?; + } + Ok(Exits::next(written)) + } } } @@ -660,6 +670,8 @@ fn stmt_exprs(stmt: &Stmt) -> Vec<&Expr> { }) .collect(), Stmt::Local { init, .. } => init.iter().collect(), + Stmt::Delay(expr) | Stmt::Wait(expr) => vec![expr], + Stmt::WaitEvent(items) => items.iter().map(|item| &item.expr).collect(), Stmt::Break | Stmt::Continue => Vec::new(), } } diff --git a/crates/celox-sv-analyzer/src/ast/procedural.rs b/crates/celox-sv-analyzer/src/ast/procedural.rs index 5961e9ffe82..ddc173a2fda 100644 --- a/crates/celox-sv-analyzer/src/ast/procedural.rs +++ b/crates/celox-sv-analyzer/src/ast/procedural.rs @@ -8,7 +8,8 @@ use super::*; use crate::procedural::{ - CaseItemBase, CaseKind, CaseLabel, LoopKind, ParamDirection, SystemTaskArg, + CaseItemBase, CaseKind, CaseLabel, EventEdge, EventItemBase, LoopKind, ParamDirection, + SystemTaskArg, }; /// One lexical scope: the locals it declares and the bindings they shadow. @@ -569,11 +570,23 @@ impl<'s, 't, 'a> BodyBuilder<'s, 't, 'a> { sv_parser::StatementItem::ProceduralAssertionStatement(assertion) => { self.assertion(assertion) } - sv_parser::StatementItem::ProceduralTimingControlStatement(_) - | sv_parser::StatementItem::WaitStatement(_) - | sv_parser::StatementItem::EventTrigger(_) => { - Err(unsupported("procedural timing control")) + sv_parser::StatementItem::ProceduralTimingControlStatement(timing) => { + let mut stmts = vec![self.timing_control(&timing.nodes.0)?]; + stmts.extend(self.statement_or_null(&timing.nodes.1)?); + Ok(stmts) } + sv_parser::StatementItem::WaitStatement(wait) => match &**wait { + sv_parser::WaitStatement::Wait(wait) => { + self.allow_timing("wait statement")?; + let condition = self.expr(&wait.nodes.1.nodes.1)?; + let mut stmts = vec![Stmt::Wait(condition)]; + stmts.extend(self.statement_or_null(&wait.nodes.2)?); + Ok(stmts) + } + sv_parser::WaitStatement::Fork(_) => Err(unsupported("wait fork statement")), + sv_parser::WaitStatement::Order(_) => Err(unsupported("wait order statement")), + }, + sv_parser::StatementItem::EventTrigger(_) => Err(unsupported("event trigger")), sv_parser::StatementItem::ProceduralContinuousAssignment(_) => { Err(unsupported("procedural continuous assignment")) } @@ -583,6 +596,137 @@ impl<'s, 't, 'a> BodyBuilder<'s, 't, 'a> { } } + /// Timing controls suspend the process that executes them. An `initial` + /// body runs as a process; `always` bodies with timing controls and + /// subroutines with them are not lowered yet. + fn allow_timing(&self, construct: &str) -> Result<(), AnalyzerError> { + match self.body { + system_functions::Body::Initial => Ok(()), + system_functions::Body::Always => Err(unsupported(format!( + "always and always_latch processes with a {construct}" + ))), + system_functions::Body::Subroutine => { + Err(unsupported(format!("{construct} in a subroutine"))) + } + } + } + + /// The suspension a procedural timing control stands for: a delay or an + /// event control. + fn timing_control( + &self, + control: &sv_parser::ProceduralTimingControl, + ) -> Result { + match control { + sv_parser::ProceduralTimingControl::DelayControl(delay) => { + self.allow_timing("delay control")?; + self.delay_control(delay).map(Stmt::Delay) + } + sv_parser::ProceduralTimingControl::EventControl(control) => { + self.allow_timing("event control")?; + self.event_control(control).map(Stmt::WaitEvent) + } + sv_parser::ProceduralTimingControl::CycleDelay(_) => Err(unsupported("cycle delay")), + } + } + + /// The amount of a `#` delay control, in time units. Of a + /// `min:typ:max` delay the typical value is used, as simulators do by + /// default. + fn delay_control(&self, delay: &sv_parser::DelayControl) -> Result { + match delay { + sv_parser::DelayControl::Delay(delay) => match &delay.nodes.1 { + sv_parser::DelayValue::UnsignedNumber(number) => Ok(Expr::Literal( + self.tree + .get_str(&number.nodes.0) + .ok_or_else(|| unsupported("delay value"))? + .replace('_', ""), + )), + sv_parser::DelayValue::PsIdentifier(identifier) => { + if identifier.nodes.0.is_some() { + return Err(unsupported("package-scoped delay value")); + } + let name = identifier_text(RefNode::Identifier(&identifier.nodes.1), self.tree) + .ok_or_else(|| unsupported("delay value"))?; + let mut expr = Expr::Ident(name); + self.rename_expr(&mut expr); + Ok(expr) + } + sv_parser::DelayValue::HierarchicalIdentifier(identifier) => { + let name = + identifier_text(RefNode::HierarchicalIdentifier(identifier), self.tree) + .ok_or_else(|| unsupported("delay value"))?; + let mut expr = Expr::Ident(name); + self.rename_expr(&mut expr); + Ok(expr) + } + sv_parser::DelayValue::RealNumber(_) + | sv_parser::DelayValue::TimeLiteral(_) + | sv_parser::DelayValue::Step1(_) => Err(unsupported("delay value")), + }, + sv_parser::DelayControl::Mintypmax(delay) => match &delay.nodes.1.nodes.1 { + sv_parser::MintypmaxExpression::Expression(expr) => self.expr(expr), + sv_parser::MintypmaxExpression::Ternary(ternary) => self.expr(&ternary.nodes.2), + }, + } + } + + /// The items of an `@` event control. + fn event_control( + &self, + control: &sv_parser::EventControl, + ) -> Result>, AnalyzerError> { + match control { + sv_parser::EventControl::EventExpression(control) => { + let mut items = Vec::new(); + self.event_items(&control.nodes.1.nodes.1, &mut items)?; + Ok(items) + } + sv_parser::EventControl::EventIdentifier(_) => Err(unsupported("named event")), + sv_parser::EventControl::Asterisk(_) | sv_parser::EventControl::ParenAsterisk(_) => { + Err(unsupported("`@*` event control in a process")) + } + sv_parser::EventControl::SequenceIdentifier(_) => { + Err(unsupported("sequence event control")) + } + } + } + + fn event_items( + &self, + expr: &sv_parser::EventExpression, + items: &mut Vec>, + ) -> Result<(), AnalyzerError> { + match expr { + sv_parser::EventExpression::Expression(expr) => { + if expr.nodes.2.is_some() { + return Err(unsupported("iff-qualified event")); + } + let edge = match &expr.nodes.0 { + None => EventEdge::Any, + Some(sv_parser::EdgeIdentifier::Posedge(_)) => EventEdge::Pos, + Some(sv_parser::EdgeIdentifier::Negedge(_)) => EventEdge::Neg, + Some(sv_parser::EdgeIdentifier::Edge(_)) => EventEdge::Both, + }; + let expr = self.expr(&expr.nodes.1)?; + items.push(EventItemBase { edge, expr }); + Ok(()) + } + sv_parser::EventExpression::Or(expr) => { + self.event_items(&expr.nodes.0, items)?; + self.event_items(&expr.nodes.2, items) + } + sv_parser::EventExpression::Comma(expr) => { + self.event_items(&expr.nodes.0, items)?; + self.event_items(&expr.nodes.2, items) + } + sv_parser::EventExpression::Paren(expr) => { + self.event_items(&expr.nodes.0.nodes.1, items) + } + sv_parser::EventExpression::Sequence(_) => Err(unsupported("sequence event")), + } + } + fn seq_block(&mut self, block: &sv_parser::SeqBlock) -> Result, AnalyzerError> { let mut stmts = Vec::new(); for item in &block.nodes.2 { diff --git a/crates/celox-sv-analyzer/src/ast/validation.rs b/crates/celox-sv-analyzer/src/ast/validation.rs index 7111b507008..1fc7e5624ca 100644 --- a/crates/celox-sv-analyzer/src/ast/validation.rs +++ b/crates/celox-sv-analyzer/src/ast/validation.rs @@ -353,6 +353,20 @@ fn reject_silently_ignored_constructs_with_dimensions( .flat_map(|root| root.into_iter()) .filter(|child| matches!(child, RefNode::Cast(_))) .collect(); + // The `min:typ:max` value of a procedural delay control is lowered as its + // typical value; any other one is not supported. + let delay_mintypmax: Vec<_> = validation_nodes(node.clone(), is_module) + .flat_map(|root| root.into_iter()) + .filter_map(|child| match child { + RefNode::DelayControlMintypmax(delay) => Some(delay), + _ => None, + }) + .flat_map(|delay| RefNode::DelayControlMintypmax(delay).into_iter()) + .filter_map(|child| match child { + RefNode::MintypmaxExpressionTernary(ternary) => Some(ternary), + _ => None, + }) + .collect(); // Procedure locals, parameters and loop indices are installed by // BodyBuilder. Validate their queries while lowering that scoped body. let procedural_queries: Vec<_> = validation_nodes(node.clone(), is_module) @@ -587,6 +601,8 @@ fn reject_silently_ignored_constructs_with_dimensions( RefNode::SpecifyBlock(_) => { return Err(AnalyzerError::Unsupported("specify block".to_string())); } + RefNode::MintypmaxExpressionTernary(ternary) + if delay_mintypmax.iter().any(|delay| std::ptr::eq(*delay, ternary)) => {} RefNode::MintypmaxExpressionTernary(_) | RefNode::ConstantMintypmaxExpressionTernary(_) => { return Err(AnalyzerError::Unsupported( diff --git a/crates/celox-sv-analyzer/src/ir.rs b/crates/celox-sv-analyzer/src/ir.rs index 715559ec782..ee3f523ec73 100644 --- a/crates/celox-sv-analyzer/src/ir.rs +++ b/crates/celox-sv-analyzer/src/ir.rs @@ -3,7 +3,7 @@ use crate::{ast, symbol::ModuleId, typecheck}; pub use crate::procedural::{ - CaseKind, CaseLabel, LoopKind, ParamDirection, StmtBase, SystemTaskArg, + CaseKind, CaseLabel, EventEdge, LoopKind, ParamDirection, StmtBase, SystemTaskArg, }; pub use crate::system_functions::{ ArrayQuery, Callee, MemoryFormat, Radix, Severity, SystemFunction, SystemTask, @@ -12,6 +12,7 @@ pub use crate::system_functions::{ /// A procedural statement of the analyzed IR. pub type Stmt = StmtBase; pub type CaseItem = crate::procedural::CaseItemBase; +pub type EventItem = crate::procedural::EventItemBase; pub type LocalVariable = crate::procedural::LocalVariableBase; pub type Subroutine = crate::procedural::SubroutineBase; pub type SubroutineParam = crate::procedural::SubroutineParamBase; diff --git a/crates/celox-sv-analyzer/src/lib.rs b/crates/celox-sv-analyzer/src/lib.rs index 2ad5920849f..75a1072e02e 100644 --- a/crates/celox-sv-analyzer/src/lib.rs +++ b/crates/celox-sv-analyzer/src/lib.rs @@ -142,6 +142,7 @@ const UNSUPPORTED_CONSTRUCT_ISSUES: &[(&str, u32)] = &[ ("streaming concatenation", 447), ("loop-generate unroll limit exceeded", 448), ("iff-qualified always_ff event", 452), + ("iff-qualified event", 1444), ("nonblocking assignment inside always_comb", 453), ("genvar update operator", 455), ("reduction operator in parameter expression", 456), diff --git a/crates/celox-sv-analyzer/src/procedural.rs b/crates/celox-sv-analyzer/src/procedural.rs index f832b8def25..991b1f790ac 100644 --- a/crates/celox-sv-analyzer/src/procedural.rs +++ b/crates/celox-sv-analyzer/src/procedural.rs @@ -70,6 +70,36 @@ pub enum StmtBase { name: String, init: Option, }, + /// `#amount`: suspend the process for `amount` time units (IEEE + /// 1800-2023 9.4.1). + Delay(E), + /// `@(items)`: suspend the process until one of the events occurs + /// (9.4.2). + WaitEvent(Vec>), + /// `wait (condition)`: suspend the process until the condition is true + /// (9.4.3). + Wait(E), +} + +/// One item of an event control, `[edge] expr`. +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct EventItemBase { + pub edge: EventEdge, + pub expr: E, +} + +/// Which transitions of an event expression are events (IEEE 1800-2023 +/// 9.4.2, Table 9-2). +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum EventEdge { + /// Any change of the value. + Any, + /// `posedge`: the least significant bit rises. + Pos, + /// `negedge`: the least significant bit falls. + Neg, + /// `edge`: the least significant bit rises or falls. + Both, } /// How a case statement compares its selector with the item labels. @@ -255,6 +285,17 @@ impl StmtBase { name, init: init.map(fe), }, + StmtBase::Delay(amount) => StmtBase::Delay(fe(amount)), + StmtBase::WaitEvent(items) => StmtBase::WaitEvent( + items + .into_iter() + .map(|item| EventItemBase { + edge: item.edge, + expr: fe(item.expr), + }) + .collect(), + ), + StmtBase::Wait(condition) => StmtBase::Wait(fe(condition)), } } @@ -360,6 +401,13 @@ impl StmtBase { fe(init); } } + StmtBase::Delay(amount) => fe(amount), + StmtBase::WaitEvent(items) => { + for item in items { + fe(&mut item.expr); + } + } + StmtBase::Wait(condition) => fe(condition), } } diff --git a/crates/celox-sv-analyzer/src/tests.rs b/crates/celox-sv-analyzer/src/tests.rs index b7f22392912..fd5de9e924c 100644 --- a/crates/celox-sv-analyzer/src/tests.rs +++ b/crates/celox-sv-analyzer/src/tests.rs @@ -3485,6 +3485,67 @@ fn rejects_unlowered_constructs() { assert!(matches!(error, AnalyzerError::Unsupported(_)), "{error:?}"); } +/// Timing constructs that remain unimplemented are rejected with their +/// own construct names, not as a generic timing control. +#[test] +fn rejects_unimplemented_timing_constructs() { + for (body, construct) in [ + ("initial begin fork #1; join end", "fork-join block"), + ("initial wait fork;", "wait fork statement"), + // The `event` data type is rejected before its uses. + ("event e; initial @e;", "unsupported internal data type"), + ("event e; initial ->e;", "unsupported internal data type"), + ( + "logic clk, en; initial @(posedge clk iff en);", + "iff-qualified event", + ), + ( + "logic a, b; initial a = #1 b;", + "intra-assignment timing control", + ), + ( + "logic a, b; initial a <= #1 b;", + "intra-assignment timing control", + ), + ("initial begin : b disable b; end", "disable statement"), + ("initial #1.5;", "delay value"), + ( + "logic a; initial @* a = 1;", + "`@*` event control in a process", + ), + ( + "logic clk; always @(posedge clk) #1;", + "always and always_latch processes", + ), + ( + "task automatic t; #1; endtask", + "delay control in a subroutine", + ), + ] { + let code = format!("module Top; {body} endmodule"); + let error = analyze_source(&code, Path::new("timing.sv")) + .expect_err(&format!("`{body}` must be rejected")); + assert!( + matches!(&error, AnalyzerError::Unsupported(text) if text.starts_with(construct)), + "`{body}`: {error:?}" + ); + } + assert_eq!( + AnalyzerError::Unsupported("iff-qualified event".to_string()).tracking_issue(), + 1444 + ); +} + +/// Delays, event controls and waits in an `initial` block keep their +/// statement structure in the IR. +#[test] +fn analyzes_timing_controls_in_initial_blocks() { + let code = "module Top(input logic clk, output logic [7:0] y);\n\ + initial begin #3; @(posedge clk or negedge clk, y); @(edge clk); #(1:2:3); wait (y > 1); end\n\ + endmodule"; + analyze_source(code, Path::new("timing.sv")).expect("timing controls in an initial block"); +} + #[test] fn analyzes_veryl_emitted_fifo_with_runtime_casts() { analyze_source( diff --git a/crates/celox-test-suite/src/sv/cases/timing.vtest b/crates/celox-test-suite/src/sv/cases/timing.vtest index e441ec138e7..a4a71ae644b 100644 --- a/crates/celox-test-suite/src/sv/cases/timing.vtest +++ b/crates/celox-test-suite/src/sv/cases/timing.vtest @@ -684,6 +684,62 @@ module Top(input bit clk,output bit[7:0]seen);bit q;Child c(clk,q);initial forev module Top(output wire[7:0]qualified,imported);Qualified a(qualified);Imported b(imported);initial #2 $finish;endmodule "#)(top Top)(run_until 0)(assert_eq qualified 0)(assert_eq imported 0)(run_until 1)(assert_eq qualified 0)(assert_eq imported 0)(run_to_finish)) +(case edge_waits_wake_on_rising_and_falling_edges + (source "edge.sv" #" + module Top(output logic [7:0] seen); + logic clk = 1'b0; + initial begin + #3 clk = 1'b1; + #3 clk = 1'b0; + #3 clk = 1'b1; + end + initial begin + seen = 8'd0; + forever @(edge clk) seen = seen + 8'd1; + end + endmodule + "#) + (top Top) + (run_until 2) + (assert_eq seen 0) + (run_until 3) + (assert_eq seen 1) + (run_until 6) + (assert_eq seen 2 "a falling edge is an edge") + (run_until 9) + (assert_eq seen 3)) + +(case min_typ_max_delays_wait_the_typical_value + (source "mintypmax.sv" #" + module Top(output logic [7:0] a); + initial begin + a = 8'd1; + #(2:5:9) a = 8'd2; + end + endmodule + "#) + (top Top) + (run_until 4) + (assert_eq a 1) + (run_until 5) + (assert_eq a 2)) + +(case long_process_loops_finish_within_one_time_slot + (source "long_loop.sv" #" + module Top(output logic [31:0] count); + initial begin + count = 32'd0; + for (int i = 0; i < 200000; i++) count = count + 32'd1; + #1 count = count + 32'd1; + end + endmodule + "#) + (top Top) + (run_until 0) + (assert_eq count 200000) + (run_until 1) + (assert_eq count 200001)) + (case initial_blocks_run_at_time_zero (source "time_zero.sv" #" module Top(output bit [7:0] y); diff --git a/crates/celox/tests/frontends/systemverilog/suite.rs b/crates/celox/tests/frontends/systemverilog/suite.rs index f4126b657a6..e5d20fd137c 100644 --- a/crates/celox/tests/frontends/systemverilog/suite.rs +++ b/crates/celox/tests/frontends/systemverilog/suite.rs @@ -7,7 +7,7 @@ struct CeloxBackend(Simulator); /// A timed case: the design's own processes and clocks run in a /// [`Simulation`]. A host write is settled at the current time by the next -/// run operation. +/// run operation, read, eval or output collection. struct TimedBackend { sim: Simulation, /// Runtime events not yet taken as output. @@ -60,6 +60,20 @@ impl TimedBackend { } } + /// Settle host writes and the work they wake at the current time, as + /// the reference simulators do before a read, then capture events. + fn settled(&mut self, operation: &str) -> Result<()> { + let finished = self.finished; + if !finished { + self.sim.run_until(self.sim.time())?; + } + self.capture_events()?; + if !finished && self.finished { + return Err(format!("the design finished during {operation}").into()); + } + Ok(()) + } + /// Capture events after an operation that does not advance time. fn checked(&mut self, operation: &str) -> Result<()> { let finished = self.finished; @@ -104,14 +118,14 @@ impl Backend for TimedBackend { } fn read(&mut self, path: &SignalPath) -> Result<(BigUint, BigUint)> { - self.checked("a read")?; + self.settled("a read")?; let signal = self.signal(path); Ok(self.sim.get_four_state(signal)) } fn eval_comb(&mut self) -> Result<()> { self.sim.eval_comb()?; - self.checked("eval") + self.settled("eval") } fn tick(&mut self, _event: &str) -> Result<()> { @@ -119,7 +133,7 @@ impl Backend for TimedBackend { } fn take_output(&mut self) -> Result> { - self.checked("output collection")?; + self.settled("output collection")?; collect_output(std::mem::take(&mut self.events)) } diff --git a/crates/celox/tests/frontends/systemverilog/timing.rs b/crates/celox/tests/frontends/systemverilog/timing.rs index 291bb088484..27dfb7c846c 100644 --- a/crates/celox/tests/frontends/systemverilog/timing.rs +++ b/crates/celox/tests/frontends/systemverilog/timing.rs @@ -49,112 +49,86 @@ macro_rules! timed_cases { } timed_cases! { - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] fn delays_resume_initial_blocks_at_later_times = "timing::delays_resume_initial_blocks_at_later_times"; #[ignore = "the SV analyzer rejects plain always processes (#431)"] fn always_with_a_delay_generates_a_clock = "timing::always_with_a_delay_generates_a_clock"; #[ignore = "the SV analyzer rejects plain always processes (#431)"] fn edge_waits_resume_before_the_registers_of_that_edge_update = "timing::edge_waits_resume_before_the_registers_of_that_edge_update"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] fn any_change_waits_wake_on_every_value_change = "timing::any_change_waits_wake_on_every_value_change"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] fn wait_statements_block_until_their_condition_holds = "timing::wait_statements_block_until_their_condition_holds"; #[ignore = "the SV analyzer rejects plain always processes (#431)"] fn level_sensitive_always_runs_as_a_process = "timing::level_sensitive_always_runs_as_a_process"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] fn processes_wake_each_other_at_the_same_time = "timing::processes_wake_each_other_at_the_same_time"; #[ignore = "the SV analyzer rejects plain always processes (#431)"] fn tasks_with_timing_controls_run_in_processes = "timing::tasks_with_timing_controls_run_in_processes"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] fn edge_waits_see_the_signals_the_script_drives = "timing::edge_waits_see_the_signals_the_script_drives"; #[ignore = "the SV analyzer rejects plain always processes (#431)"] fn finish_in_an_always_process_ends_the_simulation = "timing::finish_in_an_always_process_ends_the_simulation"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] fn waiting_processes_do_not_keep_an_idle_simulation_running = "timing::waiting_processes_do_not_keep_an_idle_simulation_running"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] + #[ignore = "flip-flop domains miss edges to and from z on a four-state clock (#1472)"] fn four_state_edges_count_transitions_through_unknown = "timing::four_state_edges_count_transitions_through_unknown"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] fn unknown_delays_and_conditions_count_as_zero_and_false = "timing::unknown_delays_and_conditions_count_as_zero_and_false"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] fn direct_reads_settle_waiting_processes = "timing::direct_reads_settle_waiting_processes"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] fn output_reads_settle_waiting_processes = "timing::output_reads_settle_waiting_processes"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] fn run_until_drains_target_time_before_later_writes = "timing::run_until_drains_target_time_before_later_writes"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] fn repeated_settles_do_not_advance_design_time = "timing::repeated_settles_do_not_advance_design_time"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] fn run_to_finish_has_no_simulated_time_deadline = "timing::run_to_finish_has_no_simulated_time_deadline"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] + #[ignore = "blocking stores of an edge-triggered always are not visible before the inactive region (#1123)"] fn blocking_ff_stores_are_visible_before_inactive_work = "timing::blocking_ff_stores_are_visible_before_inactive_work"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] fn nonblocking_ff_stores_remain_pending_during_inactive_work = "timing::nonblocking_ff_stores_remain_pending_during_inactive_work"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] + #[ignore = "blocking stores of an edge-triggered always are not visible before the inactive region (#1123)"] fn mixed_ff_stores_keep_their_active_and_nba_values = "timing::mixed_ff_stores_keep_their_active_and_nba_values"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] fn printed_finish_notice_is_design_output = "timing::printed_finish_notice_is_design_output"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] fn combinational_finish_ends_timed_execution = "timing::combinational_finish_ends_timed_execution"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] fn inactive_time_directives_do_not_change_scheduler_units = "timing::inactive_time_directives_do_not_change_scheduler_units"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] + #[ignore = "the SV frontend lowers only variables as event expressions (#1123)"] fn blocking_concatenation_publishes_one_event_update = "timing::blocking_concatenation_publishes_one_event_update"; #[ignore = "the SV analyzer rejects plain always processes (#431)"] fn finite_active_feedback_preserves_convergence = "timing::finite_active_feedback_preserves_convergence"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] + #[ignore = "the SV frontend lowers only variables as event expressions (#1123)"] fn pure_function_rhs_preserves_distinct_write_times = "timing::pure_function_rhs_preserves_distinct_write_times"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] + #[ignore = "the SV frontend lowers only variables as event expressions (#1123)"] fn conditional_writes_preserve_distinct_activation_times = "timing::conditional_writes_preserve_distinct_activation_times"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] + #[ignore = "the SV frontend lowers only variables as event expressions (#1123)"] fn case_writes_preserve_distinct_activation_times = "timing::case_writes_preserve_distinct_activation_times"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] + #[ignore = "the SV frontend lowers only variables as event expressions (#1123)"] fn constant_repeat_writes_preserve_distinct_activation_times = "timing::constant_repeat_writes_preserve_distinct_activation_times"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] + #[ignore = "the SV frontend lowers only variables as event expressions (#1123)"] fn separate_comb_assignments_preserve_selected_dependencies = "timing::separate_comb_assignments_preserve_selected_dependencies"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] + #[ignore = "the SV frontend lowers only variables as event expressions (#1123)"] fn constant_for_writes_preserve_distinct_activation_times = "timing::constant_for_writes_preserve_distinct_activation_times"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] + #[ignore = "the SV frontend lowers only variables as event expressions (#1123)"] fn untimed_tasks_preserve_distinct_activation_times = "timing::untimed_tasks_preserve_distinct_activation_times"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] + #[ignore = "the SV frontend lowers only variables as event expressions (#1123)"] fn untimed_task_copyback_preserves_distinct_activation_times = "timing::untimed_task_copyback_preserves_distinct_activation_times"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] + #[ignore = "the SV frontend lowers only variables as event expressions (#1123)"] fn statically_satisfied_waits_preserve_distinct_activation_times = "timing::statically_satisfied_waits_preserve_distinct_activation_times"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] + #[ignore = "the SV frontend lowers only variables as event expressions (#1123)"] fn nba_woken_waiters_sample_before_continuations = "timing::nba_woken_waiters_sample_before_continuations"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] fn negative_repeat_counts_do_not_run_the_body = "timing::negative_repeat_counts_do_not_run_the_body"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] + #[ignore = "the SV frontend lowers only variables as event expressions (#1123)"] fn blocking_ff_woken_waiters_sample_before_continuations = "timing::blocking_ff_woken_waiters_sample_before_continuations"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] + #[ignore = "the SV frontend lowers only variables as event expressions (#1123)"] fn direct_blocking_ff_woken_waiters_sample_before_continuations = "timing::direct_blocking_ff_woken_waiters_sample_before_continuations"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] fn constant_variable_initializers_do_not_invent_clock_edges = "timing::constant_variable_initializers_do_not_invent_clock_edges"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] fn repeated_active_edges_share_one_nba_batch = "timing::repeated_active_edges_share_one_nba_batch"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] + #[ignore = "the SV frontend lowers only variables as event expressions (#1123)"] fn false_wait_preserves_separate_hierarchical_write_times = "timing::false_wait_preserves_separate_hierarchical_write_times"; #[ignore = "the SV analyzer rejects plain always processes (#431)"] fn always_timed_task_without_inline_timing_executes = "timing::always_timed_task_without_inline_timing_executes"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] fn constant_comb_if_discards_unreachable_pulse_branch = "timing::constant_comb_if_discards_unreachable_pulse_branch"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] fn constant_child_ff_case_discards_unreachable_pulse_arm = "timing::constant_child_ff_case_discards_unreachable_pulse_arm"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] fn constant_child_loop_exit_keeps_one_write = "timing::constant_child_loop_exit_keeps_one_write"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] fn constant_child_case_exit_keeps_one_write = "timing::constant_child_case_exit_keeps_one_write"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] fn four_state_child_if_keeps_one_write = "timing::four_state_child_if_keeps_one_write"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] fn selected_child_dependency_ignores_unreachable_reads = "timing::selected_child_dependency_ignores_unreachable_reads"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] fn selected_child_loop_exit_ignores_unreachable_suffix = "timing::selected_child_loop_exit_ignores_unreachable_suffix"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] fn finite_process_loop_preserves_continuation_values = "timing::finite_process_loop_preserves_continuation_values"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] fn zero_trip_child_dependencies_ignore_body_and_step = "timing::zero_trip_child_dependencies_ignore_body_and_step"; - #[ignore = "the SV analyzer rejects procedural timing controls (#88)"] fn cross_file_package_initializers_keep_static_clock_baseline = "timing::cross_file_package_initializers_keep_static_clock_baseline"; + fn edge_waits_wake_on_rising_and_falling_edges = "timing::edge_waits_wake_on_rising_and_falling_edges"; + fn min_typ_max_delays_wait_the_typical_value = "timing::min_typ_max_delays_wait_the_typical_value"; + fn long_process_loops_finish_within_one_time_slot = "timing::long_process_loops_finish_within_one_time_slot"; fn initial_blocks_run_at_time_zero = "timing::initial_blocks_run_at_time_zero"; fn host_edges_after_time_zero_clock_flip_flops = "timing::host_edges_after_time_zero_clock_flip_flops"; }