Skip to main content

TlmFifo

Struct TlmFifo 

Source
pub struct TlmFifo<T: 'static> { /* private fields */ }
Expand description

A bounded (or unbounded) FIFO that is also a component in the hierarchy.

Declare it as a child with #[component] so it appears in the tree, then hand out its exports in connect.

Implementations§

Source§

impl<T: 'static> TlmFifo<T>

Source

pub fn new(size: usize) -> TlmFifo<T>

A FIFO size items deep. Depth 1 is the UVM default and forces the producer to wait for the consumer.

Source

pub fn unbounded() -> TlmFifo<T>

A FIFO with no depth limit: a put never blocks.

Source

pub fn size(&self) -> Option<usize>

The declared depth; None for an unbounded FIFO.

Source

pub fn used(&self) -> usize

How many items are in it now.

Source

pub fn is_empty(&self) -> bool

Source

pub fn is_full(&self) -> bool

Source

pub fn flush(&self)

Throw away everything in the FIFO (UVM flush).

Source

pub fn put_export(&self) -> PutExport<T>

The put side, to connect to a component’s PutPort.

Source

pub fn get_export(&self) -> GetExport<T>

The get side, to connect to a component’s GetPort.

Source

pub fn put_ap(&self) -> TapExport<T>

The tap that fires as each item goes in (uvm_tlm_fifo::put_ap).

Source

pub fn get_ap(&self) -> TapExport<T>

The tap that fires as each item comes out (uvm_tlm_fifo::get_ap).

Source

pub async fn put(&self, item: T)

Source

pub fn try_put(&self, item: T) -> Result<(), T>

Source

pub async fn get(&self) -> T

Source

pub fn try_get(&self) -> Option<T>

Source

pub fn handle(&self) -> TlmFifo<T>

A second handle to the same FIFO (for wiring at construction).

Source§

impl<T: Clone + 'static> TlmFifo<T>

Source

pub fn peek_export(&self) -> PeekExport<T>

The peek side, to connect to a PeekPort. Peek copies rather than removes, which is why it needs T: Clone.

Source

pub async fn peek(&self) -> T

Source

pub fn try_peek(&self) -> Option<T>

Trait Implementations§

Source§

impl<T: 'static> Component for TlmFifo<T>

Source§

fn build(&mut self, ctx: &mut RustdvCtx)

build — top-down. Where a component constructs its children (D6); the gap between “a component exists” and “its children exist” that all late binding lives in. Read more
Source§

fn connect(&mut self, ctx: &mut RustdvCtx)

connect — bottom-up. Wire children together once they exist. Read more
Source§

fn end_of_elaboration(&mut self, ctx: &mut RustdvCtx)

end_of_elaboration — top-down. The hierarchy is final. Read more
Source§

fn start_of_simulation(&mut self, ctx: &mut RustdvCtx)

start_of_simulation — top-down. Last chance before time moves. Read more
Source§

async fn run(&mut self, ctx: &mut RustdvCtx) -> Result<(), TestError>

run — bottom-up, async, objection-gated. The test body; Err fails the test. Read more
Source§

fn extract(&mut self, ctx: &mut RustdvCtx)

extract — top-down, post-run. Read more
Source§

fn check(&mut self, ctx: &mut RustdvCtx, errors: &mut CheckSink)

check — top-down. Report failures into the sink. Read more
Source§

fn report(&mut self, ctx: &mut RustdvCtx)

report — top-down. Read more
Source§

fn final_phase(&mut self, ctx: &mut RustdvCtx)

final_phase — top-down. (final is a Rust keyword.) Read more
Source§

fn start(&mut self, ctx: &mut RustdvCtx)

Transitional spawn hook, pre-dating the restored run traversal. tinyalu_tb and the not-yet-converted chapters still spawn free-running behavior here; it folds into run as each converts. Not part of the nine-phase lifecycle.
Source§

fn comp_name() -> &'static str
where Self: Sized,

This type’s registered short name, used as the factory override key. The last path segment of the type name (Foo from crate::mod::Foo), which matches the name #[derive(Component)] registers.
Source§

fn new_comp() -> RustdvComp
where Self: Sized + Default + ComponentNode + 'static,

Build this component the normal way and drop it in an crate::factory::RustdvComp slot — the analogue of UVM’s new (D75). Not overridable.
Source§

fn create_comp() -> RustdvComp
where Self: Sized + Default + ComponentNode + 'static,

Build this component through the factory — the analogue of UVM’s create (D75). The default is built now and the slot is flagged; the build walk swaps in an override if one applies.
Source§

impl<T: 'static> ComponentNode for TlmFifo<T>

Source§

fn node_name(&self) -> &'static str

The component’s type-level name (hierarchical path is synthesized from field names during traversal).
Source§

fn children_mut(&mut self) -> Vec<(String, &mut (dyn ComponentNode + 'static))>

Direct children as (field-derived name, node) pairs, in declaration order. An owned Vec, not a visit_children-style sync callback: run_all awaits inside the walk, and a higher-ranked closure cannot yield a child borrow that outlives the call, so the borrows have to come back in a value the caller holds. An Option<T> child created during build (D6) appears here only once it is Some.
Source§

fn port_slot(&self, name: &str) -> Option<Rc<dyn Any>>

This node’s port binding cell of the given name, erased (D83). Read more
Source§

fn port_infos(&self) -> Vec<PortInfo>

Every port this node declares, for the elaboration report.
Source§

fn resolve_children(&mut self, ctx: &RustdvCtx)

Resolve factory overrides for this node’s RustdvComp fields (D75). The derive generates this to call field.resolve(ctx, "field") for each RustdvComp field; the default is a no-op for nodes with none. Called by build_all after build, before descending — so a swapped-out default’s own phases never run.
Source§

fn take_children(&mut self) -> Vec<(String, Box<dyn ComponentNode>)>

Move this node’s RustdvComp children out, for the run phase (D82b). Read more
Source§

fn restore_children(&mut self, taken: Vec<(String, Box<dyn ComponentNode>)>)

Put back what ComponentNode::take_children removed, in the same order. Called unconditionally after the run phase — including on error — so the post-run phases walk a whole tree.
Source§

impl<T: 'static> Default for TlmFifo<T>

Source§

fn default() -> Self

Depth 1, the UVM default — and the depth that makes a producer and a consumer take turns, which is what most testbenches want.

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for TlmFifo<T>

§

impl<T> !Send for TlmFifo<T>

§

impl<T> !Sync for TlmFifo<T>

§

impl<T> !UnwindSafe for TlmFifo<T>

§

impl<T> Freeze for TlmFifo<T>

§

impl<T> Unpin for TlmFifo<T>

§

impl<T> UnsafeUnpin for TlmFifo<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> DynPhases for T
where T: Component,

Source§

fn dyn_build(&mut self, ctx: &mut RustdvCtx)

Source§

fn dyn_run<'a>( &'a mut self, ctx: &'a mut RustdvCtx, ) -> Pin<Box<dyn Future<Output = Result<(), TestError>> + 'a>>

The async run, boxed so it can be awaited behind dyn (D48). This is the object-safe shim run_all needs to fire each component’s run.
Source§

fn dyn_connect(&mut self, ctx: &mut RustdvCtx)

Source§

fn dyn_end_of_elaboration(&mut self, ctx: &mut RustdvCtx)

Source§

fn dyn_start_of_simulation(&mut self, ctx: &mut RustdvCtx)

Source§

fn dyn_extract(&mut self, ctx: &mut RustdvCtx)

Source§

fn dyn_check(&mut self, ctx: &mut RustdvCtx, errors: &mut CheckSink)

Source§

fn dyn_report(&mut self, ctx: &mut RustdvCtx)

Source§

fn dyn_final(&mut self, ctx: &mut RustdvCtx)

Source§

fn dyn_start(&mut self, ctx: &mut RustdvCtx)

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.