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§
Sourcefn build(&mut self, ctx: &mut RustdvCtx)
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.
Sourcefn connect(&mut self, ctx: &mut RustdvCtx)
fn connect(&mut self, ctx: &mut RustdvCtx)
connect— bottom-up. Wire children together once they exist.
Sourcefn end_of_elaboration(&mut self, ctx: &mut RustdvCtx)
fn end_of_elaboration(&mut self, ctx: &mut RustdvCtx)
end_of_elaboration— top-down. The hierarchy is final.
Sourcefn start_of_simulation(&mut self, ctx: &mut RustdvCtx)
fn start_of_simulation(&mut self, ctx: &mut RustdvCtx)
start_of_simulation— top-down. Last chance before time moves.
Sourceasync fn run(&mut self, ctx: &mut RustdvCtx) -> Result<(), TestError>
async fn run(&mut self, ctx: &mut RustdvCtx) -> Result<(), TestError>
run— bottom-up, async, objection-gated. The test body;Errfails the test.
async fn in a trait costs dyn-compatibility, which is why the sync
phases are mirrored onto DynPhases for traversal (D48).
Sourcefn check(&mut self, ctx: &mut RustdvCtx, errors: &mut CheckSink)
fn check(&mut self, ctx: &mut RustdvCtx, errors: &mut CheckSink)
check— top-down. Report failures into the sink.
Sourcefn final_phase(&mut self, ctx: &mut RustdvCtx)
fn final_phase(&mut self, ctx: &mut RustdvCtx)
final_phase— top-down. (finalis a Rust keyword.)
Sourcefn start(&mut self, ctx: &mut RustdvCtx)
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.
Sourcefn comp_name() -> &'static strwhere
Self: Sized,
fn comp_name() -> &'static strwhere
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.
Sourcefn new_comp() -> RustdvComp
fn new_comp() -> RustdvComp
Build this component the normal way and drop it in an crate::factory::RustdvComp
slot — the analogue of UVM’s new (D75). Not overridable.
Sourcefn create_comp() -> RustdvComp
fn create_comp() -> RustdvComp
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".