You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Host writes during a $stop-suspended time step are lost at the edge process's NBA commit #1886
Follow-up to #1864 / #1884. When $stop suspends a time step after an edge process was evaluated but before its NBA region, a host write to a variable of that process (a raw state write noted with note_raw_writes, or a VPI vpi_put_value) is overwritten when the step resumes. The commit copies back the whole range the process may write, even where no nonblocking assignment executed.
A vpiNoDelay put sets the object to the value immediately (IEEE 1800-2023 38.34). $stop (20.2) suspends the simulation without discarding scheduled events. The NBA update that follows changes only the bits its lvalue names (10.4.2), so the host's value should remain.
let source = r#" `timescale 1ns/1ns module Top(output bit [31:0] q); bit clk = 0; bit en = 0; always #1 clk = ~clk; always @(posedge clk) if (en) q <= 32'h11; initial begin @(posedge clk); #0; $stop; end endmodule"#;letmut sim = Simulation::from_sv_sources(vec![(source,Path::new("stop.sv"))],"Top").build_cranelift().unwrap();let q = sim.signal("q");
sim.run_until(1).unwrap();assert!(sim.is_stopped());let(memory, size) = sim.memory_as_mut_ptr();assert!(q.offset + 4 <= size);unsafe{ std::ptr::copy_nonoverlapping(0x22u32.to_le_bytes().as_ptr(), memory.add(q.offset),4)};
sim.note_raw_writes();
sim.run_until(1).unwrap();assert_eq!(sim.get(q),0x22u32.into());// fails: q == 0
Observed with #1884 on cranelift, two-state: q == 0.
#1884 gates the exact (masked) publication on process kernels that may write after suspending (kernel_window_writes). The host is a writer of any variable, so gating on it would stage every edge-process target (a whole-design slow path). Options: let the runtime keep evaluated-but-unpublished domains apart from host writes made during a stop, e.g. by re-evaluating the suspended domains or merging only changed bits at resume. Alternatively, publish the evaluated domains before handing control to the host.
Activity