Skip to main content

RustdvCtx

Struct RustdvCtx 

Source
pub struct RustdvCtx { /* private fields */ }
Expand description

Handed to each test. Since step 4 this is the one universal context (D47): the old TestCtx and RunCtx merged into RustdvCtx, which lives in rustdv-methodology beside the Component trait that receives it. Everything a running testbench is handed: the DUT, randomization, the objection registry, and the component’s path.

One type, not one per phase. D8 wanted BuildCtx/ConnectCtx/ RunCtx so that build_child during run would fail to compile. D47 gives that up: Part II teaches a testbench with no components and therefore no phases, and naming the type after a phase names a concept the reader has not met. Phase-illegal operations are caught at run time, as UVM catches them.

Clone is deliberate — the objection registry is Rc-shared, so a clone objects to the same test. D9’s per-node context, when the build phase arrives, is that clone with the path extended.

Implementations§

Source§

impl RustdvCtx

Source

pub fn new(path: &str, dut: HierarchyHandle, seed: u64) -> RustdvCtx

Built by the runner, once per test, with path the test’s registered name (D49 — UVM’s fixed uvm_test_top is not ported).

Source

pub fn child(&self, name: &str) -> RustdvCtx

A child context: same services, path extended by name (D9). The phase traversals hand each child its own context so a component’s ctx.info() logs the path the walk derived, never a stored string.

Source

pub fn dut(&self) -> HierarchyHandle

Source

pub fn seed(&self) -> u64

Source

pub fn rng(&self) -> Rng

A deterministic RNG seeded from RUSTDV_RANDOM_SEED + test index.

Source

pub fn path(&self) -> &str

This component’s path — derived by the walk, never stored on the component itself (D7).

Source

pub fn rustdv_path(&self) -> &RustdvPath

This component’s path as segments. The connection registry (D83) addresses components by this, so a port key cannot be hand-typed.

Source

pub fn debug(&self, msg: &str)

Source

pub fn info(&self, msg: &str)

Source

pub fn warning(&self, msg: &str)

Source

pub fn error(&self, msg: &str)

Source

pub fn critical(&self, msg: &str)

Source

pub fn logger(&self) -> &Logger

The logger itself, for code that wants to hold one.

Source

pub fn set_logging_level_hier(&self, level: Level)

Port of set_logging_level_hier(level).

Source

pub fn disable_logging_hier(&self)

Port of disable_logging_hier().

Source

pub fn add_file_handler_hier( &self, file: &str, append: bool, ) -> Result<(), Error>

Port of add_logging_handler_hier(logging.FileHandler(path)) — this subtree’s messages are also written to file.

Source

pub fn remove_console_hier(&self)

Port of remove_streaming_handler_hier() — stop printing this subtree to the console (file handlers keep receiving it).

Source

pub fn raise_objection(&self, description: &str) -> ObjectionGuard

Port of raise_objection, returning a guard whose Drop is drop_objection (pyuvm: uvm_component.objection()).

Source

pub fn objections(&self) -> &ObjectionRegistry

Source

pub async fn all_objections_dropped(&self)

Wait until every raised objection has been dropped. Logs the pyuvm “you never objected” warning if nothing was ever raised.

Trait Implementations§

Source§

impl Clone for RustdvCtx

Source§

fn clone(&self) -> RustdvCtx

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.