🧭 Hierarchical Reference #
Hierarchical reference allows accessing signals or instances inside submodules. It’s useful in testbenches, force/release operations, or debugging.
✅ Example: #
top.dut.internal_reg = 8'hA5; // Accessing signal from testbench
top
: top-level moduledut
: instance name of your DUTinternal_reg
: a signal declared insidedut
⚡ force
and release
— For Simulation Overrides
#
You can override the value of a signal during simulation using force
, and restore normal behavior using release
.
force top.dut.internal_reg = 8'hFF; // Override value
#100 release top.dut.internal_reg; // Return control to simulation
This is useful to:
- Set internal states in testbenches
- Simulate fault injection or error recovery
- Debug hard-to-reach logic
🔧 Use Cases #
- Forcing signal values in simulation
- Observing internal signals not exposed via ports
- Writing testbenches that interact deeply with module internals
⚠️ Avoid using hierarchical references or
force/release
in synthesizable code — they break module encapsulation and are not synthesizable.