Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Appendix C: SystemVerilog-UVM → rustdv Translations

For readers coming from SystemVerilog UVM (and The UVM Primer): where each piece of your working vocabulary went. Python readers want Appendix B, this table’s twin.

Language level

SystemVerilogRustChapter
byte, shortint, intu8/i8, u16/i16, u32/i32 — no silent truncation3
logic four-state valuesLogic enum / LogicArray — no x in arithmetic7, 17
typedef enum (an int in disguise)enum — a real type; exhaustively matched7
case + default (+ unique warnings)match — missing cases are compile errors4
class ... extends, virtual, super.new()traits, default methods, composition + delegation10
pure virtual function in a virtual classa required trait method, checked at the impl10
parameterized class #(type T = int)generics <T: Bound>, checked at definition11
class ... #(type REQ, type RSP = REQ)SeqItemPort<REQ, RSP = REQ> — same convention11
local / protectedprivate-by-default, pub to export14
null handle, $castOption<T>, exhaustive match — no null, no cast9
status flags and sentinel returnsResult<T, E> + ? — failure in the signature9
$sformatfformat!8
fork / join_none / disablespawn(future)TaskHandle; handle.cancel()16
foreverloop (an expression — it can break with a value)4
mailbox #(T), try_put/try_getsim::Queue<T> — same names, Result/Option answers16
named event, ->done, @(done)sim::Eventset() / wait().await16
semaphore (one key)sim::Lock — FIFO-fair, RAII guard16
@(posedge clk), #2nsclk.rising_edge().await, Timer::ns(2).await15, 17
`define-style codegen (`uvm_*_utils)attribute + derive macros — syntax trees, not text21
package + .f file + vendor tarballcrate + Cargo.toml + crates.io14
(no equivalent)cargo test — unit tests with no simulator14

Methodology level

SystemVerilog UVMrustdvChapter
class my_test extends uvm_test + run_test()#[rustdv::test] on a struct; the runner drives its phases23
phase.raise_objection(this) / drop_objectionctx.raise_objection(..) → RAII ObjectionGuard; drop releases23
uvm_component(name, parent) treechildren are struct fields; #[derive(Component)]; paths derived by the walk24
build_phase (top-down) / connect_phase (bottom-up)fn build(&mut self, ctx) / fn connect(&mut self, ctx) — real phases, same directions24
run_phase (objection-gated task)async fn run — concurrent across the tree; ends when objections drain24, 31
elaboration + post-run phasessame names; top-down, where SV runs them bottom-up24
`uvm_info(id, msg, verbosity)ctx.info(..) — same time/level/[path] line format26
set_report_verbosity_level_hier()ctx.set_logging_level_hier(..)26
uvm_config_db#(T)::set/get, wildcardsConfigDb::set(ctx, glob, key, v) / getResult — one key, no type in the address25, 27
virtual interface via config databaseRc<TinyAluBfm> in the ConfigDb25
a failed get() (silent return 0)ConfigError naming which failure; #[must_use]27, 28
print_config() / +UVM_CONFIG_DB_TRACEConfigDb::print() / ConfigDb::set_tracing(true)28
`uvm_component_utils registration#[derive(Component)] registers by name, universally21, 29
type_id::create("name", this)Foo::create_comp() — overridable (new_comp() = new, fixed)29
set_type_override_by_type / _by_name / instanceFactory::set_type_override::<A, B>() / _by_name / set_inst_override29, 30
uvm_factory::get().print()Factory::print()29
TLM-1 put/get/peek port + export + connect()PutPort/GetPort/PeekPort + fifo.put_export().connect(comp, PORT_NAME)31
uvm_tlm_fifo (with built-in taps)TlmFifo<T> (with put_ap()/get_ap())31
try_put() returns a bittry_put(T)Result<(), T> — a refused item comes back31
unconnected port found at first useelaboration sweep names every unwired port before run31
uvm_analysis_port.write()PublishPort<T>::write(&T), brokered by an AnalysisBus hub32
uvm_subscriber (one write per class)a Subscriber<T> impl per stream — two streams, two impls, no imp_decl32, 34
uvm_tlm_analysis_fifo in scoreboardsabsent — the subscriber owns its storage32
uvm_agent + is_activeenv reads Active from the ConfigDb; a passive env leaves the driver slot empty40
do_copy / do_compare / convert2string#[derive(Clone, PartialEq, Debug)] + hand-written Display10, 35
copy(other) / clone()clone_from(&mut self, src) / clone()35
uvm_field_* macros (runtime field walking)derive — the same generation, at compile time21, 35
uvm_sequence #(REQ, RSP), body()impl Sequencetype Req/type Rsp, async fn body(ctx)36
start_item(req) / finish_item(req)ctx.start_item(&mut req) / ctx.finish_item(req) → ticket36
seq_item_port.get_next_item() / item_done()same names; item_done(Some(rsp)) answers36, 38
try_next_item() (absent from pyuvm)try_next_item()Option<SeqItem<REQ>>37
rsp.set_id_info(req) + get_response()auto-tagged; get_response(Some(ticket)) / try_get_response37, 38
seq.start(seqr) / virtual sequence with no sequencerseq.start(&seqr) / start_virtual()36, 39
sequencer grab/lock/priority arbitrationunported (FIFO arbitration only) — a recorded gap36
assert (prints, simulation continues)assert! (panic = test fails, on the spot)9
uvm_error vs uvm_fatal (convention)CheckSink::error = DUT check; panic! = testbench bug9, 24