pub struct Transaction {
pub addr: u32,
pub width: Width,
pub write: bool,
pub phase: Phase,
pub remaining: u32,
}Expand description
A bus transaction in progress.
Modeled as a small state machine rather than an atomic operation, so the scheduler can advance the RCP between the address and data phases — the property that makes a device able to observe the bus mid-transaction.
Fields§
§addr: u32Physical address.
width: WidthTransfer size.
write: boolIs this a write? Writes are throttled by EOK rather than waiting for
Evalid.
phase: PhaseWhich phase is on the wire.
remaining: u32SClock cycles remaining in the current phase.
Implementations§
Source§impl Transaction
impl Transaction
Sourcepub const fn begin(addr: u32, width: Width, write: bool) -> Self
pub const fn begin(addr: u32, width: Width, write: bool) -> Self
Begin a transaction. It starts in the address phase, which occupies one
SClock cycle.
Sourcepub const fn step(&mut self, service_cycles: u32) -> bool
pub const fn step(&mut self, service_cycles: u32) -> bool
Advance one SClock cycle. Returns true once the transaction completes.
service_cycles is the target’s latency — the unbounded wait between the
phases, and where M lives (docs/accuracy-ledger.md C-1). It is a
parameter rather than a constant precisely so it cannot be quietly tuned:
the caller must supply a value it can justify.
Sourcepub const fn total_cycles(width: Width, service_cycles: u32) -> u32
pub const fn total_cycles(width: Width, service_cycles: u32) -> u32
Total SClock cycles this transaction occupies, given a target latency.
One address cycle, the target’s service time, then one cycle per beat.
Trait Implementations§
Source§impl Clone for Transaction
impl Clone for Transaction
Source§fn clone(&self) -> Transaction
fn clone(&self) -> Transaction
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more