Examples¶
ivl_uvm_examples holds complete testbenches written the way a UVM user writes them. They are
not unit tests: the unit tests in ivl_uvm_tests check one class at a time, an example is a whole
testbench that you can read and copy.
Each example directory has sv_src (the UVC, its DUT and the testbench top) and run_dir (a
Makefile and a file list to run it). The golden logs of the examples are kept in
ivl_uvm_regress/goldLogs with those of the tests, and make check in ivl_uvm_regress/run_dir
runs the examples too, so a framework change that breaks an example shows up there.
APB requester¶
ivl_uvm_examples/apb_requester is an APB requester UVC and a small APB completer (a 256 by 8
memory). A directed test writes eight addresses and reads them back. The terms are the ones Arm
uses for APB in place of master and slave.
File |
Content |
|---|---|
|
The transaction: kind (read or write), address, data. |
|
The sequencer, and the driver that takes items with |
|
Watches the interface and sends each read and write to an |
|
An |
|
The agent (monitor and scoreboard always, driver and sequencer when active) and the environment. |
|
Eight writes, a pause, eight reads, a pause; the test raises and drops an objection around the sequence. |
|
The interface (plain signals, no clocking blocks or modports), the DUT, and the top module
that creates the clock, hands the interface to the agent and calls |
The DUT follows the APB timing: a write is committed at the end of the access cycle, and read data is valid during the access cycle.
Run it¶
cd ivl_uvm_examples/apb_requester/run_dir
make vwapb # run the example, logs and apb_requester.vcd are written here
make check # compare with the golden log
cd ivl_uvm_regress/run_dir
make gold TESTS="apb" # refresh the golden log after an intended change
A good run prints APB: PASS (8 checks, 0 failed) and ends with the UVM report summary and
Test PASSED with NO UVM_ERRORs. The waves are in apb_requester.vcd: the interface signals
and the DUT ports.
Where it differs from a typical UVM testbench¶
uvm_config_dbis not available yet, so the top module puts the virtual interface in a package variable (g_apb_vif) and the agent takes it from there. Because of that, the example has one agent.The environment sets
is_activeon the agent directly.The sequence uses
start_itemandfinish_itemwith fixed values. There is norandomizeand nouvm_do_with.The agent connects the driver to the sequencer through local handles, because a call through a member of a member (
a.b.connect(...)) is not accepted by Icarus.The scoreboard keeps its memory in the package: a fixed-size array inside a class collapses to one element on Icarus.
The example uses
this.get_name()in its messages. An unqualifiedget_name()in user code printsIVL_GO2UVMas the message ID.
The APB example is inspired by the APB2 Master UVC of Go2UVM (https://github.com/go2uvm/go2uvm).