Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions conformance/sv-tests/expected.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -1633,8 +1633,8 @@ chapter-9/9.4.3--event_sequence_controls.sv 2state pass
chapter-9/9.4.3--event_sequence_controls.sv 4state pass
chapter-9/9.4.5--event_blocking_assignment_delay.sv 2state pass
chapter-9/9.4.5--event_blocking_assignment_delay.sv 4state pass
chapter-9/9.4.5--event_nonblocking_assignment_delay.sv 2state fail
chapter-9/9.4.5--event_nonblocking_assignment_delay.sv 4state fail
chapter-9/9.4.5--event_nonblocking_assignment_delay.sv 2state pass
chapter-9/9.4.5--event_nonblocking_assignment_delay.sv 4state pass
chapter-9/9.4.5--event_nonblocking_assignment_event.sv 2state pass
chapter-9/9.4.5--event_nonblocking_assignment_event.sv 4state pass
chapter-9/9.4.5--event_nonblocking_assignment_repeat.sv 2state pass
Expand Down
12 changes: 11 additions & 1 deletion crates/celox-design/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,8 @@ pub enum ProcessStatus {
/// ran no statement and waits at the same site.
Pending,
/// The process staged one nonblocking assignment. The delay slot holds
/// the index of its [`NbaSite`]. The runtime queues the staged value and
/// the index of its [`NbaSite`]. The runtime queues the staged value for
/// the site's update time and
/// resumes the process at once.
Nba,
/// The process returned so the runtime can charge its time-slot budget.
Expand Down Expand Up @@ -482,6 +483,9 @@ pub enum ProcessStatus {
AssertionObserved,
/// Resume an assertion action in Reactive after every Observed predicate.
AssertionReactive,
/// Continue in the same Active/Reactive region after other runnable work.
/// This is an implementation scheduling boundary, not an HDL wait (4.7).
DeferActive,
}

impl ProcessStatus {
Expand All @@ -507,6 +511,7 @@ impl ProcessStatus {
Self::EventProbe => 16,
Self::AssertionObserved => 17,
Self::AssertionReactive => 18,
Self::DeferActive => 19,
}
}

Expand All @@ -530,6 +535,7 @@ impl ProcessStatus {
16 => Some(Self::EventProbe),
17 => Some(Self::AssertionObserved),
18 => Some(Self::AssertionReactive),
19 => Some(Self::DeferActive),
_ => None,
}
}
Expand Down Expand Up @@ -1117,6 +1123,9 @@ impl<A: Copy> WaitSite<A> {
/// sites in its delay slot.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct NbaSite<A> {
/// Global precision ticks from evaluation to the NBA update.
#[serde(default)]
pub delay: u64,
/// Index of the process in [`RuntimeSchema::processes`].
pub process: usize,
/// The assigned object and the static part of the assigned bit range.
Expand Down Expand Up @@ -1147,6 +1156,7 @@ pub struct NbaSite<A> {
impl<A: Copy> NbaSite<A> {
pub fn map<B>(&self, mut map: impl FnMut(A) -> B) -> NbaSite<B> {
NbaSite {
delay: self.delay,
process: self.process,
target: map(self.target),
lsb: self.lsb,
Expand Down
11 changes: 9 additions & 2 deletions crates/celox-frontend-core/src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,13 @@ impl<A: Copy> ProcessKernelBuilder<A> {
self.suspend(ProcessStatus::Yield)
}

/// Give other runnable work priority before the next statement, without
/// leaving the current Active/Reactive region (IEEE 1800-2023 4.7).
pub fn defer_active(&mut self) -> Result<(), ProcessKernelError> {
self.slots.const_delays = false;
self.suspend(ProcessStatus::DeferActive)
}

/// Reserve one entry point for each child, then return to the runtime to spawn them.
/// The caller lowers each child into its entry block and ends it with `complete`.
pub fn fork(
Expand Down Expand Up @@ -364,8 +371,8 @@ impl<A: Copy> ProcessKernelBuilder<A> {
}

/// The nonblocking assignment of nonblocking site `index` of this
/// process, described by `site`: schedule a value for the NBA region of
/// the current time (IEEE 1800-2023 10.4.2). `lower` lowers the
/// process, described by `site`: schedule a value for the NBA region at
/// the current time plus `site.delay` (IEEE 1800-2023 10.4.2). `lower` lowers the
/// right-hand side at the open block and returns the value, a register
/// of `site.width` bits, and for a site with a run-time position the bit
/// offset and the number of bits written, unsigned two-state registers
Expand Down
1 change: 1 addition & 0 deletions crates/celox-frontend-core/src/sdk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1422,6 +1422,7 @@ fn lower_statements(
.contains(&target.signal())
.then(|| lowering.hidden.declare(name("pending"), 1, false));
let site = NbaSite {
delay: 0,
process: lowering.process,
target: source_id(target.signal()),
lsb: target.lsb(),
Expand Down
6 changes: 4 additions & 2 deletions crates/celox-frontend-core/src/symbolic/assembly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4442,10 +4442,12 @@ fn select_nba_paths(
processes: &mut [RelocatedProcess],
) {
let mut staged = staged.clone();
// Fork activations can reach one NBA site concurrently. Always queue its
// Future updates must be queued at issue time rather than staged for
// publication in the current slot. Fork activations can reach one NBA site
// concurrently. Always queue its
// captured value, rather than leaving one shared pending slot per kernel.
for site in &timing.nba_sites {
if processes[site.process].frame.is_some() {
if site.delay > 0 || processes[site.process].frame.is_some() {
for switch in &timing.nba_switches {
if switch.value == site.value {
staged.remove(&switch.switch);
Expand Down
Loading
Loading