Expand description
Component lifecycle and hierarchy traversal (design-doc §5.2/§5.3).
Superseded, being replaced — do not build on it. What this file still implements is review-memo R3: build/connect as constructor conventions rather than phases, a component’s
new(config, ...)constructing its children (// build:) and taking channel endpoints as arguments (// connect:), with only the runtime lifecycle left as a trait.D5 and D6 reverse that, and the reversal has begun.
build(top-down) andconnect(bottom-up) are real phase methods again (D51), because the gap between “a component exists” and “its children exist” is where all late binding lives — path-addressed configuration, factory overrides, TLM connection. TheComponenttrait below now carries all nine phases andrun_component_testdrives them.new(config, ...)-style construction survives only in not-yet- converted testbenches (tinyalu_tb), not as the design.
What has landed. Step 4 (D46–D49): a test is a component with an
async fn run, receiving the one universal RustdvCtx. Ch24 first
half (D51/D52): the nine phases, the phaser, path-aware phase logging.
Ch24 second half: two-stage construction (a parent creates children as
Option<T>/Vec<T> in its own build) and the bottom-up run_all
traversal firing every component’s run.
Structs§
- Check
Sink - Collector for
check-phase failures (design-doc §5.3 signature). - Rustdv
Ctx - Everything a running testbench is handed: the DUT, randomization, the objection registry, and the component’s path.
Enums§
- Active
- Agent activity (pyuvm’s ConfigDB
is_activeint becomes an enum — mapping row 42; illegal values are unrepresentable).
Traits§
- Component
- 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_componentdoes.buildandconnectare real phases again, not the “constructor conventions” R3 collapsed them into; restoring them is the point of this chapter. - Component
Node - Structural traversal over the ownership tree (design-doc D5.2).
Generated by
#[derive(Component)]for structs whose children are fields marked#[component]; hand-implementable by design (OQ-15: the derive is convenience, not requirement). - DynPhases
- Dyn-safe mirror of
Component’s non-async phases (D48).
Functions§
- build_
all - Top-down:
builda node, then build the children it just created (D6). Readingchildren_mutafterbuildis what lets a parent construct them in its own build phase and have the walk descend into them. - check_
all - Top-down.
- check_
connections - Run the connection sweep and turn any misses into one error listing them
all. Called by the runner between
connectandend_of_elaboration. - connect_
all - Bottom-up: children
connectbefore parents. - end_
of_ elaboration_ all - Top-down.
- extract_
all - Top-down.
- final_
all - Top-down.
- print_
hierarchy - Debug printer: the child walker serving pyuvm’s hierarchy print (design-doc §5.2).
- report_
all - Top-down.
- run_all
- Bottom-up: every component’s
runfires, children first (D48). The walk is boxed-recursive becausedyn_runyields a boxed future we await, and the children’s borrows are held across those awaits. - run_
component_ test - The full phaser: drive every UVM phase over a component tree, in order
(D51) — the analog of pyuvm handing the test class to its phaser. The
runner calls this for a
#[rustdv::test]struct, so the test body is just the phase methods; no hand-rolledstart_all. - run_
extract_ check_ report - The standard post-run tail: extract → check → report → final, returning
Errif any check failed (anErrfails the test, design-doc §0.6). - start_
all - Bottom-up: children start before parents (transitional spawn hook).
- start_
of_ simulation_ all - Top-down.
- unconnected_
ports - Every required port in the tree that nobody connected, as
path.name (kind).