Generated: 2026-06-23
Commit: 99a51d3
Branch: master
vhost is a Rust verification-host library that bridges mailbox_rs, SystemVerilog DPI/UVM code, optional Python callbacks, and localhost socket helpers. It is library/FFI infrastructure, not a CLI app.
vhost/
|-- src/ # Rust crate: public API, memory model, RPC bridge, socket ABI
|-- python/ # Source Python callback shims copied by build.rs
|-- sv/mailbox_sv/ # Source SystemVerilog mailbox/DPI runtime copied by build.rs
|-- build.rs # Stages python/ and sv/ into Cargo OUT_DIR
|-- Cargo.toml # Feature matrix and git dependencies
`-- target/ # Generated Cargo output; never edit as source
| Task | Location | Notes |
|---|---|---|
| Public Rust API / boot flow | src/lib.rs |
mailbox_init, mb_server_run, __mb_call |
| Memory model / parser | src/mem/common.rs |
Core hotspot; YAML to DPIShareMem |
| Memory backend selection | src/mem/mod.rs |
mem_uvm, mem_api, mem_static, else default |
| Python callback bridge | src/rpcs/py_calls.rs, python/*/pymb_rpc.py |
Feature-gated through PyO3 |
| Socket ABI | src/sockets/mod.rs |
Exported c_skt_* functions |
| SV mailbox runtime | sv/mailbox_sv/mailbox.sv |
DPI imports/exports and state machine |
| Build asset staging | build.rs |
Copies python/ and sv/ into target/.../out/vhost |
| Symbol | Type | Location | Refs | Role |
|---|---|---|---|---|
mailbox_init |
function | src/lib.rs |
unmeasured | Builds memory spaces/channels from env-config files |
__mb_call |
extern "C" |
src/lib.rs |
unmeasured | Routes mailbox calls to Python first, SV fallback |
mb_server_run |
function | src/lib.rs |
unmeasured | Returns wake + serve futures for mailbox server |
DPIShareMemParser |
parser | src/mem/common.rs |
unmeasured | Parses YAML memory definitions |
DPIShareMem |
enum | src/mem/common.rs |
unmeasured | Dispatches BlackBox, Direct, Banked memory |
DPIBankedShareMem |
struct | src/mem/common.rs |
unmeasured | Bank geometry and address mapping |
StaticMemSink |
trait | src/mem/static_mem.rs |
unmeasured | Downstream-defined static memory output sink |
poll_py_call |
function | src/rpcs/py_calls.rs |
unmeasured | Calls Python pymb_rpcs.poll under GIL |
SktWrapper |
struct | src/sockets/mod.rs |
unmeasured | TCP listener and 1-based client streams |
Mailbox |
SV class | sv/mailbox_sv/mailbox.sv |
unmeasured | SV-side channel/method registry and polling |
rust-analyzer was unavailable in this environment and no codegraph_* tools were registered, so symbol references are intentionally marked unmeasured.
- Requires nightly Rust:
src/lib.rsuses#![feature(io_error_more)]and#![feature(map_try_insert)]. - Runtime env contract:
MEM_CFG_FILE,MAILBOX_CFG_FILE,MAILBOX_FS_ROOTmust exist beforemailbox_init. - Cargo features define behavior:
python,mem_uvm,mem_api,mem_static,ptr32,ptr64,cache_line_{32,64,128,256}. - Memory backend features still require an explicit mailbox pointer-width feature such as
ptr32orptr64;mem_staticdoes not select one implicitly. python/andsv/are source inputs even though they are copied intotarget/during builds.- Memory tests are inline Rust unit tests in
src/mem/common.rsand feature-gated static backend tests insrc/mem/static_mem_tests.rs; no separatetests/tree exists.
- Do not edit
target/debug/build/**,target/debug/.fingerprint/**, or.omo/**as source. - Do not treat generated
target/.../out/vhost/**copies as authoritative; editpython/orsv/mailbox_sv/instead. - Do not assume
src/rpcsis active unless PyO3/Python features are enabled. - Do not add generic Python packaging assumptions; there is no
pyproject.toml,setup.py, or package scaffold.
- FFI boundaries use
#[no_mangle] extern "C"in Rust and DPI imports/exports in SV. - Parser errors are
Result<_, String>; socket errors useanyhow. - Several unsupported feature/backend combinations intentionally
panic!; do not replace those with broad fallback paths without changing the contract. - The default memory backend logs sync/flush activity with
println!rather than performing simulator I/O. mem_staticbuffers writes per HDL memory instance and flushes through downstreamStaticMemSink; it does not choose hex/bin/file layout.
cargo build
cargo test
cargo build --features python
cargo test --features mem_uvm
cargo test --features mem_api
cargo test --features "mem_static ptr64"Cargo.lockexists but.gitignorealso lists it; treat this as a library-style crate unless policy changes.build.rsusesv_build_utils::OtherDir; adding assets underpython/orsv/affects Cargo build output.py_calls_init()only warns when optionalmbpy_calls_init.mbpy_calls_init()is missing.src/mem/common.rsis the main maintainability hotspot: 1k+ lines, parser, geometry, buffer math, and tests in one file.