Skip to main content

Component

Trait Component 

Source
pub trait Component {
Show 13 methods // Provided methods fn build(&mut self, ctx: &mut RustdvCtx) { ... } fn connect(&mut self, ctx: &mut RustdvCtx) { ... } fn end_of_elaboration(&mut self, ctx: &mut RustdvCtx) { ... } fn start_of_simulation(&mut self, ctx: &mut RustdvCtx) { ... } async fn run(&mut self, ctx: &mut RustdvCtx) -> Result<(), TestError> { ... } fn extract(&mut self, ctx: &mut RustdvCtx) { ... } fn check(&mut self, ctx: &mut RustdvCtx, errors: &mut CheckSink) { ... } fn report(&mut self, ctx: &mut RustdvCtx) { ... } fn final_phase(&mut self, ctx: &mut RustdvCtx) { ... } fn start(&mut self, ctx: &mut RustdvCtx) { ... } fn comp_name() -> &'static str where Self: Sized { ... } fn new_comp() -> RustdvComp where Self: Sized + Default + ComponentNode + 'static { ... } fn create_comp() -> RustdvComp where Self: Sized + Default + ComponentNode + 'static { ... }
}
Expand description

The UVM phase lifecycle (design-doc §5.3, D51), restored in full. Nine phases, each a method with a default no-op body — override only what you use, exactly as pyuvm’s uvm_component does. build and connect are real phases again, not the “constructor conventions” R3 collapsed them into; restoring them is the point of this chapter.

Every phase receives the context so it can log with the component’s derived path (D52/D7). The runner drives the whole sequence over the tree (see run_component_test), so a component author never calls a phase by hand.

Provided Methods§

Source

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

  1. 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.
Source

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

  1. connect — bottom-up. Wire children together once they exist.
Source

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

  1. end_of_elaboration — top-down. The hierarchy is final.
Source

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

  1. start_of_simulation — top-down. Last chance before time moves.
Source

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

  1. run — bottom-up, async, objection-gated. The test body; Err fails the test.

async fn in a trait costs dyn-compatibility, which is why the sync phases are mirrored onto DynPhases for traversal (D48).

Source

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

  1. extract — top-down, post-run.
Source

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

  1. check — top-down. Report failures into the sink.
Source

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

  1. report — top-down.
Source

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

  1. final_phase — top-down. (final is a Rust keyword.)
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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<REQ: 'static, RSP: 'static> Component for Sequencer<REQ, RSP>

Source§

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

Source§

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