From 3a758fe314e2a01a4e903506d9063ec4451d7c4e Mon Sep 17 00:00:00 2001 From: tignear Date: Thu, 22 Oct 2026 12:19:59 +0900 Subject: [PATCH 1/2] fix(sv): scale and round real-valued delays A real delay used its IEEE bit pattern as an integral delay. Scale it to precision steps of its scope, round ties away from zero (IEEE 1800-2023 3.14.1, 6.12.1), and read a negative result as a two's-complement time (9.4.1); a NaN delay waits zero. Unparenthesized real literals such as #1.5 are accepted as delay values. Fixes #1707. Change-Id: I3456fc82b11d94301a99a1f26713e53cedc36b02 --- crates/celox-frontend-sv/src/lowering/ff.rs | 70 +++++++++++++++---- .../src/ast/procedural/timing.rs | 9 +++ .../celox-sv-analyzer/src/ast/timescales.rs | 62 ++++++++++------ crates/celox-sv-analyzer/src/procedural.rs | 5 ++ crates/celox-sv-analyzer/src/tests.rs | 2 +- .../src/sv/cases/timing.vtest | 50 +++++++++++++ .../verification/sv/icarus/timing.json | 22 ++++++ .../verification/sv/verilator/timing.json | 22 ++++++ .../tests/frontends/systemverilog/timing.rs | 54 ++++++++++++++ 9 files changed, 263 insertions(+), 33 deletions(-) diff --git a/crates/celox-frontend-sv/src/lowering/ff.rs b/crates/celox-frontend-sv/src/lowering/ff.rs index 860fdbc1da6..b4f303d5bc4 100644 --- a/crates/celox-frontend-sv/src/lowering/ff.rs +++ b/crates/celox-frontend-sv/src/lowering/ff.rs @@ -2600,8 +2600,9 @@ impl<'p, 'a> Ff<'p, 'a> { sv::ir::Stmt::Delay { amount, ticks_per_unit, + ticks_per_precision, } => { - self.delay(amount, *ticks_per_unit)?; + self.delay(amount, *ticks_per_unit, *ticks_per_precision)?; Ok(true) } sv::ir::Stmt::WaitEvent(items) => { @@ -4364,21 +4365,30 @@ impl Ff<'_, '_> { &mut self, amount: &sv::ir::Expr, ticks_per_unit: u64, + ticks_per_precision: u64, ) -> 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 mut delay = self.zero_if_unknown(delay, original); - if ticks_per_unit > 1 { + let (mut delay, ticks_per_step) = match self.m.expr_float_precision(amount) { + Some(precision) => ( + self.real_delay(amount, precision, ticks_per_unit / ticks_per_precision)?, + ticks_per_precision, + ), + None => { + 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)?; + (self.zero_if_unknown(delay, original), ticks_per_unit) + } + }; + if ticks_per_step > 1 { // Check before multiplying so the 64-bit delay slot cannot wrap. let limit = self.b.alloc_bit(PROCESS_DELAY_WIDTH, false); self.b.emit(SIRInstruction::Imm( limit, - SIRValue::new(u64::MAX / ticks_per_unit), + SIRValue::new(u64::MAX / ticks_per_step), )); let overflow = self.b.alloc_bit(1, false); self.b.emit(SIRInstruction::Binary( @@ -4402,7 +4412,7 @@ impl Ff<'_, '_> { self.b.switch_to_block(scaled); let factor = self.b.alloc_bit(PROCESS_DELAY_WIDTH, false); self.b - .emit(SIRInstruction::Imm(factor, SIRValue::new(ticks_per_unit))); + .emit(SIRInstruction::Imm(factor, SIRValue::new(ticks_per_step))); let product = self.b.alloc_bit(PROCESS_DELAY_WIDTH, false); self.b.emit(SIRInstruction::Binary( product, @@ -4416,6 +4426,42 @@ impl Ff<'_, '_> { .map_err(kernel_error) } + /// A real delay `amount` in precision steps of the declaring scope: + /// scaled from time units by `steps_per_unit`, rounded to the nearest + /// step with ties away from zero (3.14.1, 6.12.1), and read as an + /// unsigned 64-bit time like an integral delay (9.4.1). A NaN or + /// infinite delay is zero, as an unknown integral one is. + fn real_delay( + &mut self, + amount: &sv::ir::Expr, + precision: celox_sir::FloatPrecision, + steps_per_unit: u64, + ) -> Result { + let scaled = if steps_per_unit > 1 { + sv::ir::Expr::Binary { + left: Box::new(amount.clone()), + op: sv::ir::BinaryOp::Mul, + right: Box::new(sv::ir::Expr::Literal(format!("{steps_per_unit}.0"))), + } + } else { + amount.clone() + }; + let precision = self.m.expr_float_precision(&scaled).unwrap_or(precision); + let mut arena = SLTNodeArena::new(); + let node = self.expr_slt(&scaled, None, &mut arena)?; + let node = floating::convert( + &mut arena, + node, + Some(precision), + None, + PROCESS_DELAY_WIDTH, + true, + true, + ) + .ok_or_else(|| unsupported("real delay conversion"))?; + self.lower_slt(&arena, node) + } + /// `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 { diff --git a/crates/celox-sv-analyzer/src/ast/procedural/timing.rs b/crates/celox-sv-analyzer/src/ast/procedural/timing.rs index 70494ce65d2..1389fa550f7 100644 --- a/crates/celox-sv-analyzer/src/ast/procedural/timing.rs +++ b/crates/celox-sv-analyzer/src/ast/procedural/timing.rs @@ -20,11 +20,13 @@ impl BodyBuilder<'_, '_, '_> { return Ok(Stmt::Delay { amount: Expr::Literal(format!("64'd{ticks}")), ticks_per_unit: 1, + ticks_per_precision: 1, }); } Ok(Stmt::Delay { amount: self.native_delay(*value, *parenthesized)?, ticks_per_unit: timescales::time_divisor(*value, self.tree)?, + ticks_per_precision: timescales::precision_divisor(*value, self.tree)?, }) } TimingControlKind::Event(event) => { @@ -87,6 +89,13 @@ impl BodyBuilder<'_, '_, '_> { ExprKind::Literal(text) if text.chars().all(|c| c.is_ascii_digit() || c == '_') => { Ok(Expr::Literal(text.replace('_', ""))) } + // A real_number delay value such as `#1.5` (A.2.2.3). + ExprKind::Literal(text) + if text.contains(['.', 'e', 'E']) + && text.replace('_', "").parse::().is_ok() => + { + Ok(Expr::Literal(text.replace('_', ""))) + } ExprKind::Name(name) => { let mut result = Expr::Ident(instances::normalize_identifier(&name.spelling)); self.rename_expr(&mut result); diff --git a/crates/celox-sv-analyzer/src/ast/timescales.rs b/crates/celox-sv-analyzer/src/ast/timescales.rs index 6a2096d3e65..7399cb91030 100644 --- a/crates/celox-sv-analyzer/src/ast/timescales.rs +++ b/crates/celox-sv-analyzer/src/ast/timescales.rs @@ -794,12 +794,24 @@ impl Timescales { /// The time units of the simulation, which counts the global time /// precision (3.14.3), in one time unit of the scope of `node`. fn time_divisor_in_unit(&self, at: usize, unit: &Unit) -> u64 { + self.ticks_in(at, unit, |scale| scale.unit) + } + + /// The time units of the simulation in one time precision step of the + /// scope of `node` (3.14.1). + fn precision_divisor_in_unit(&self, at: usize, unit: &Unit) -> u64 { + self.ticks_in(at, unit, |scale| scale.precision) + } + + /// The time units of the simulation in `10^exponent(scale)` seconds, + /// where `scale` is the time scale of the scope at `at`. + fn ticks_in(&self, at: usize, unit: &Unit, exponent: impl Fn(&Scale) -> i32) -> u64 { let scale = scope_at(&unit.scopes, &unit.parents, at).map_or(unit.scale, |i| unit.scopes[i].scale); let precision = self.precision.unwrap_or(DEFAULT.precision); // A scope's precision is not coarser than its unit, and no unit is // longer than 100 s or precision finer than 1 fs. - 10u64.pow((scale.unit - precision.min(scale.precision)) as u32) + 10u64.pow((exponent(&scale) - precision.min(scale.precision)) as u32) } fn resolve( @@ -1009,27 +1021,37 @@ pub(super) fn time_divisor( node: celox_sv_syntax::ExprId, tree: &AnalysisContext<'_>, ) -> Converted { + divisor(node, tree, Timescales::time_divisor_in_unit) +} + +/// The simulation's time units in one time precision step of the scope of +/// `node`, at which a real delay is rounded (3.14.1). +pub(super) fn precision_divisor( + node: celox_sv_syntax::ExprId, + tree: &AnalysisContext<'_>, +) -> Converted { + divisor(node, tree, Timescales::precision_divisor_in_unit) +} + +fn divisor( + node: celox_sv_syntax::ExprId, + tree: &AnalysisContext<'_>, + in_unit: fn(&Timescales, usize, &Unit) -> u64, +) -> Converted { + let context = tree.state.timescales.design.borrow(); + let at = tree.declarations().expression(node).tokens.start; + if let Some(prepared) = &context.prepared + && prepared.address == tree.syntax_tree as *const SyntaxTree as usize { - let context = tree.state.timescales.design.borrow(); - if let Some(prepared) = &context.prepared - && prepared.address == tree.syntax_tree as *const SyntaxTree as usize - { - return Ok(context.design.time_divisor_in_unit( - tree.declarations().expression(node).tokens.start, - &prepared.unit, - )); - } - let design = &context.design; - let source = key(tree); - let extended = (!design.units.contains_key(&source)) - .then(|| design.including_tree(tree)) - .transpose()?; - let design = extended.as_ref().unwrap_or(design); - Ok(design.time_divisor_in_unit( - tree.declarations().expression(node).tokens.start, - &design.units[&source], - )) + return Ok(in_unit(&context.design, at, &prepared.unit)); } + let design = &context.design; + let source = key(tree); + let extended = (!design.units.contains_key(&source)) + .then(|| design.including_tree(tree)) + .transpose()?; + let design = extended.as_ref().unwrap_or(design); + Ok(in_unit(design, at, &design.units[&source])) } /// A standalone time literal used as a delay: round at the declaring diff --git a/crates/celox-sv-analyzer/src/procedural.rs b/crates/celox-sv-analyzer/src/procedural.rs index d3c5d154662..a5940ca627c 100644 --- a/crates/celox-sv-analyzer/src/procedural.rs +++ b/crates/celox-sv-analyzer/src/procedural.rs @@ -87,6 +87,9 @@ pub enum StmtBase { amount: E, /// Global-precision ticks in one time unit of the declaring scope. ticks_per_unit: u64, + /// Global-precision ticks in one time precision step of the + /// declaring scope, to which a real amount is rounded (3.14.1). + ticks_per_precision: u64, }, /// `@(items)`: suspend the process until one of the events occurs /// (9.4.2). @@ -304,9 +307,11 @@ impl StmtBase { StmtBase::Delay { amount, ticks_per_unit, + ticks_per_precision, } => StmtBase::Delay { amount: fe(amount), ticks_per_unit, + ticks_per_precision, }, StmtBase::WaitEvent(items) => StmtBase::WaitEvent( items diff --git a/crates/celox-sv-analyzer/src/tests.rs b/crates/celox-sv-analyzer/src/tests.rs index 7f81f933cb9..c08bf462526 100644 --- a/crates/celox-sv-analyzer/src/tests.rs +++ b/crates/celox-sv-analyzer/src/tests.rs @@ -3509,7 +3509,6 @@ fn rejects_unimplemented_timing_constructs() { "intra-assignment timing control", ), ("initial begin : b disable b; end", "disable statement"), - ("initial #1.5;", "delay value"), ( "logic a, y; always_latch y <= a;", "nonblocking assignment inside always_latch", @@ -6316,6 +6315,7 @@ fn time_literal_delays_accept_numeric_separators() { let ir::Stmt::Delay { amount, ticks_per_unit, + .. } = &ir.modules()[0].initial_processes()[0].body()[0] else { panic!("delay"); diff --git a/crates/celox-test-suite/src/sv/cases/timing.vtest b/crates/celox-test-suite/src/sv/cases/timing.vtest index c6c9106baca..026c47a993a 100644 --- a/crates/celox-test-suite/src/sv/cases/timing.vtest +++ b/crates/celox-test-suite/src/sv/cases/timing.vtest @@ -1057,6 +1057,56 @@ module Top(input bit clk,output bit[7:0]seen);bit q;Child c(clk,q);initial forev (run_to_finish) (assert_eq count 8)) +(case real_delays_round_at_the_scope_precision + ; IEEE 1800-2023 3.14.1: a delay is rounded at the scope's precision, here + ; the default 1 ps, and 6.12.1 rounds a real tie away from zero: 0.0625 ns + ; waits 63 ps. A NaN delay counts as zero, as Icarus 13.0 and Verilator + ; 5.052 do. + (source "real_delays.sv" #" + module Top(output bit a_before, a_after, b_before, b_after, c_before, + c_after, d_after, e_before, e_after); + real r = 2.75, tie = 0.0625, zero = 0.0, nan; + shortreal quarter = 0.25; + bit a, b, c, d, e; + initial begin #r a = 1; end + initial begin #2749ps a_before = a; #2ps a_after = a; end + initial begin #3; #tie b = 1; end + initial begin #3062ps b_before = b; #2ps b_after = b; end + initial begin #5; #quarter c = 1; end + initial begin #5249ps c_before = c; #2ps c_after = c; end + initial begin nan = zero / zero; #6; #nan d = 1; end + initial begin #6001ps d_after = d; end + initial begin #7; #(r * 2) e = 1; end + initial begin #12499ps e_before = e; #2ps e_after = e; end + initial #20 $finish; + endmodule + "#) + (top Top) + (run_to_finish) + (assert_eq a_before 0) + (assert_eq a_after 1 "2.75 waits 2750 ps") + (assert_eq b_before 0) + (assert_eq b_after 1 "0.0625 waits 63 ps") + (assert_eq c_before 0) + (assert_eq c_after 1 "shortreal 0.25 waits 250 ps") + (assert_eq d_after 1 "a NaN delay waits zero") + (assert_eq e_before 0) + (assert_eq e_after 1 "r * 2 waits 5.5 ns")) + +(case negative_real_delays_wait_their_twos_complement + ; IEEE 1800-2023 9.4.1: a negative delay is read as a two's-complement + ; unsigned time, so -1.5 waits about 2^64 precision steps. + (source "negative_real_delay.sv" #" + module Top(output bit woke); + real r = -1.5; + initial begin #r woke = 1; end + initial #10 $finish; + endmodule + "#) + (top Top) + (run_to_finish) + (assert_eq woke 0)) + (case expression_events_see_pulses_within_a_time_slot ; IEEE 1800-2023 9.4.2: each change of the expression's value is an ; event, also one the slot undoes before it ends. The waits begin after diff --git a/crates/celox-test-suite/verification/sv/icarus/timing.json b/crates/celox-test-suite/verification/sv/icarus/timing.json index df08045c942..bdda61cc112 100644 --- a/crates/celox-test-suite/verification/sv/icarus/timing.json +++ b/crates/celox-test-suite/verification/sv/icarus/timing.json @@ -485,6 +485,17 @@ "tag_reasons": {}, "tags": [] }, + { + "category": "Sequential", + "detail": "", + "expectation": "Simulation", + "name": "timing::negative_real_delays_wait_their_twos_complement", + "phase": "execute", + "status": "passed", + "stronger_than_sv": false, + "tag_reasons": {}, + "tags": [] + }, { "category": "Sequential", "detail": "", @@ -584,6 +595,17 @@ "tag_reasons": {}, "tags": [] }, + { + "category": "Sequential", + "detail": "", + "expectation": "Simulation", + "name": "timing::real_delays_round_at_the_scope_precision", + "phase": "execute", + "status": "passed", + "stronger_than_sv": false, + "tag_reasons": {}, + "tags": [] + }, { "category": "Sequential", "detail": "", diff --git a/crates/celox-test-suite/verification/sv/verilator/timing.json b/crates/celox-test-suite/verification/sv/verilator/timing.json index 6058dfc509d..db973636cdb 100644 --- a/crates/celox-test-suite/verification/sv/verilator/timing.json +++ b/crates/celox-test-suite/verification/sv/verilator/timing.json @@ -485,6 +485,17 @@ "tag_reasons": {}, "tags": [] }, + { + "category": "Sequential", + "detail": "", + "expectation": "Simulation", + "name": "timing::negative_real_delays_wait_their_twos_complement", + "phase": "execute", + "status": "passed", + "stronger_than_sv": false, + "tag_reasons": {}, + "tags": [] + }, { "category": "Sequential", "detail": "", @@ -584,6 +595,17 @@ "tag_reasons": {}, "tags": [] }, + { + "category": "Sequential", + "detail": "", + "expectation": "Simulation", + "name": "timing::real_delays_round_at_the_scope_precision", + "phase": "execute", + "status": "passed", + "stronger_than_sv": false, + "tag_reasons": {}, + "tags": [] + }, { "category": "Sequential", "detail": "", diff --git a/crates/celox/tests/frontends/systemverilog/timing.rs b/crates/celox/tests/frontends/systemverilog/timing.rs index 70aabb29492..944a77ccadc 100644 --- a/crates/celox/tests/frontends/systemverilog/timing.rs +++ b/crates/celox/tests/frontends/systemverilog/timing.rs @@ -119,6 +119,8 @@ timed_cases! { 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"; + fn real_delays_round_at_the_scope_precision = "timing::real_delays_round_at_the_scope_precision"; + fn negative_real_delays_wait_their_twos_complement = "timing::negative_real_delays_wait_their_twos_complement"; fn expression_events_see_pulses_within_a_time_slot = "timing::expression_events_see_pulses_within_a_time_slot"; fn real_expression_events_see_fractional_changes = "timing::real_expression_events_see_fractional_changes"; fn bit_select_edges_follow_the_selected_bit = "timing::bit_select_edges_follow_the_selected_bit"; @@ -219,6 +221,58 @@ fn time_literal_delays_round_at_scope_precision() { assert_eq!(sim.get(coarse), 1u8.into()); } +/// A real delay is rounded at its scope's precision with ties away from +/// zero (IEEE 1800-2023 3.14.1, 6.12.1): 2.7505 ns waits 2751 ps at 1 ps, +/// and 2.75 ns waits 2.8 ns at 100 ps. +#[test] +fn real_delays_round_at_scope_precision() { + let source = r#" + module Fine(output int stage); + timeunit 1ns / 1ps; + real r = 2.7505; + initial begin #r stage = 1; #1.5 stage = 2; end + endmodule + module Coarse(output int stage); + timeunit 1ns / 100ps; + real r = 2.75; + shortreal half = 0.05; + initial begin #r stage = 1; #1.25 stage = 2; #half stage = 3; end + endmodule + module Top(output int fine, coarse); + timeunit 1ns / 1ps; + Fine f(fine); Coarse c(coarse); + endmodule + "#; + for level in [celox::OptLevel::O0, celox::OptLevel::O1] { + let mut sim = celox::Simulation::from_sv_sources( + vec![(source, std::path::Path::new("real_delays.sv"))], + "Top", + ) + .opt_level(level) + .build() + .unwrap(); + let fine = sim.signal("fine"); + let coarse = sim.signal("coarse"); + // (time in ps, fine stage, coarse stage) + for (time, f, c) in [ + (2750u64, 0u32, 0u32), + (2751, 1, 0), + (2799, 1, 0), + (2800, 1, 1), + (4099, 1, 1), + (4100, 1, 2), + (4199, 1, 2), + (4200, 1, 3), + (4250, 1, 3), + (4251, 2, 3), + ] { + sim.run_until(time).unwrap(); + assert_eq!(sim.get(fine), f.into(), "{level:?} fine at {time}"); + assert_eq!(sim.get(coarse), c.into(), "{level:?} coarse at {time}"); + } + } +} + /// The variables of an event expression, `$event[k]` and its copies of /// process-local operands, are state like the process slots: a state file /// keeps them, while the signal listing and the waveform leave them out. From 3e1f2dd0afd7ec68344f85d03640f4cde8290de4 Mon Sep 17 00:00:00 2001 From: tignear Date: Thu, 22 Oct 2026 12:57:54 +0900 Subject: [PATCH 2/2] docs(sv): describe real-valued delays Change-Id: I16e53bbe8443848786f4d8debb9e84409384645e --- docs/guide/systemverilog-reference.md | 10 ++++++---- docs/guide/systemverilog.md | 5 ++--- docs/ja/guide/systemverilog-reference.md | 7 ++++--- docs/ja/guide/systemverilog.md | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/docs/guide/systemverilog-reference.md b/docs/guide/systemverilog-reference.md index cbe8d605be0..e5b182f7fa9 100644 --- a/docs/guide/systemverilog-reference.md +++ b/docs/guide/systemverilog-reference.md @@ -48,7 +48,7 @@ In a timed `Simulation`, `initial` and plain `always` processes can suspend: | Control | Supported | | --- | --- | -| `#delay` | integral delays, `#(min:typ:max)` (the typical value) and [time literals](#time-literal-delays); an X or Z delay counts as zero | +| `#delay` | integral and real delays, `#(min:typ:max)` (the typical value) and [time literals](#time-literal-delays); an X or Z delay counts as zero | | `@(...)` | variables, `posedge` / `negedge` / `edge`, items joined by `or` or `,`, bit, part and run-time index selects, any expression including calls of pure functions, and `@*` / `@(*)`, which waits on the variables its statement reads | | `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 | @@ -94,8 +94,10 @@ constants, selects and concatenation arguments are unsupported and rejected. Standalone delay controls accept time literals such as `#5ns`, `#(2.75ns)` and `#40ps`, with all six units from `fs` to `s`. Values round at the declaring -scope's precision before conversion to scheduler ticks (5.8, 3.14.1). Real-valued -delays are not supported yet ([#1707](https://github.com/celox-sim/celox/issues/1707)). +scope's precision before conversion to scheduler ticks (5.8, 3.14.1). A real +delay such as `#1.5` or `#r` rounds the same way, with ties away from zero +(6.12.1); a negative one waits its two's complement (9.4.1), and a NaN one +waits zero. ### Built-in functions and tasks @@ -123,7 +125,7 @@ constructs without a dedicated issue point to the frontend roadmap, [#88](https: delayed continuous assignments ([#444](https://github.com/celox-sim/celox/issues/444)), named events and `->`, `fork` / `join`, `wait fork` / `disable fork`, concurrent assertions, `force` / `release`. - Timing controls in processes: `iff` qualifiers ([#1444](https://github.com/celox-sim/celox/issues/1444)), - real-valued delays ([#1707](https://github.com/celox-sim/celox/issues/1707)), package-scoped delay values + package-scoped delay values ([#1710](https://github.com/celox-sim/celox/issues/1710)), impure function calls in event expressions, and `wait` or event expressions reading a static task argument. Nonblocking assignments in a process cannot yet target an unpacked array element, a diff --git a/docs/guide/systemverilog.md b/docs/guide/systemverilog.md index 7623b7ee719..b78bf2a0674 100644 --- a/docs/guide/systemverilog.md +++ b/docs/guide/systemverilog.md @@ -92,9 +92,8 @@ ports, types, statements or system functions before porting a design. Common reasons a design needs changes are: - Class-based verification and concurrent assertions. -- `fork` / `join`, named events, intra-assignment timing such as `a = #1 b`, - `iff` in event controls ([#1444](https://github.com/celox-sim/celox/issues/1444)) and real-valued delays - ([#1707](https://github.com/celox-sim/celox/issues/1707)). +- `fork` / `join`, named events, intra-assignment timing such as `a = #1 b` + and `iff` in event controls ([#1444](https://github.com/celox-sim/celox/issues/1444)). - Nonblocking latch assignments, multiple drivers and tri-state buses. Inferred latches in `always_comb` require `inferred_latch = "warn"` or `"allow"` in the common `[diagnostics]` configuration. - Non-ANSI module ports, wildcard `.*` connections, gate primitives and `bind`. - Strings, `real`, unpacked structs and several interface features. diff --git a/docs/ja/guide/systemverilog-reference.md b/docs/ja/guide/systemverilog-reference.md index 50ec446cad0..11966f17216 100644 --- a/docs/ja/guide/systemverilog-reference.md +++ b/docs/ja/guide/systemverilog-reference.md @@ -47,7 +47,7 @@ outline: [2, 3] | 制御 | 対応範囲 | | --- | --- | -| `#delay` | 整数の遅延、`#(min:typ:max)`(typ の値)、[時間リテラル](#time-literal-delays)。X / Z の遅延は 0 として扱う | +| `#delay` | 整数と実数の遅延、`#(min:typ:max)`(typ の値)、[時間リテラル](#time-literal-delays)。X / Z の遅延は 0 として扱う | | `@(...)` | 変数、`posedge` / `negedge` / `edge`、`or` または `,` で並べた項目、ビット選択・部分選択・実行時添字の選択、pure な関数呼び出しを含む任意の式、文が読む変数を待つ `@*` / `@(*)` | | `wait (condition)` | 任意の条件。X / Z の条件は偽として扱う | | 代入 | ブロッキング代入とノンブロッキング代入。ノンブロッキング代入はそのタイムスロットの NBA 領域で反映 | @@ -88,7 +88,8 @@ select・連結式の引数は未対応として拒否します。 遅延制御の時間リテラルは `#5ns`、`#(2.75ns)`、`#40ps` など、`fs` から `s` の6単位に 対応します。宣言スコープの時間精度で丸めてから scheduler の tick に変換します -(5.8、3.14.1)。実数の遅延はまだ未対応です([#1707](https://github.com/celox-sim/celox/issues/1707))。 +(5.8、3.14.1)。`#1.5` や `#r` などの実数の遅延も同様に丸め、ちょうど中間の値は 0 から遠い方に +丸めます(6.12.1)。負の遅延は2の補数として待ち(9.4.1)、NaN の遅延は 0 として扱います。 ### 組み込み関数とタスク @@ -117,7 +118,7 @@ SystemVerilog に対しても、共有の Veryl 適合性スイートを実行 - 振る舞い記述・検証向けの構文:`final`、代入内のタイミング制御(`a = #1 b`)、遅延付き継続代入([#444](https://github.com/celox-sim/celox/issues/444))、 named event と `->`、`fork` / `join`、`wait fork` / `disable fork`、並行アサーション、`force` / `release`。 - プロセス内のタイミング制御:`iff` 修飾([#1444](https://github.com/celox-sim/celox/issues/1444))、 - 実数の遅延([#1707](https://github.com/celox-sim/celox/issues/1707))、package スコープの遅延値 + package スコープの遅延値 ([#1710](https://github.com/celox-sim/celox/issues/1710))、イベント式内の impure な関数呼び出し、 static task 引数を読む `wait` 条件とイベント式。プロセス内のノンブロッキング代入は、 unpacked 配列の要素、実行時に決まる位置、代入先の範囲外の定数位置をまだ代入先にできません diff --git a/docs/ja/guide/systemverilog.md b/docs/ja/guide/systemverilog.md index c341643e4eb..1125011e7cc 100644 --- a/docs/ja/guide/systemverilog.md +++ b/docs/ja/guide/systemverilog.md @@ -88,7 +88,7 @@ X/Z を扱う場合は builder に `.four_state(true)` を指定します。 - クラスを使う検証、並行アサーション。 - `fork` / `join`、named event、`a = #1 b` のような代入内のタイミング制御、 - イベント制御の `iff`([#1444](https://github.com/celox-sim/celox/issues/1444))、実数の遅延([#1707](https://github.com/celox-sim/celox/issues/1707))。 + イベント制御の `iff`([#1444](https://github.com/celox-sim/celox/issues/1444))。 - ラッチ内のノンブロッキング代入、複数ドライバ、トライステートバス。`always_comb` の暗黙のラッチ推論は 共通の `[diagnostics]` 設定で `inferred_latch = "warn"` または `"allow"` を指定して許可します。 - 非 ANSI モジュールポート、ワイルドカード `.*` 接続、ゲートプリミティブ、`bind`。 - 文字列、`real`、unpacked 構造体、interface の一部の機能。