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

apb_req_xactn.svh

The transaction: kind (read or write), address, data.

apb_req_sequencer.svh, apb_req_driver.svh

The sequencer, and the driver that takes items with get_next_item and drives the interface: setup cycle, access cycle, then idle.

apb_req_input_monitor.svh

Watches the interface and sends each read and write to an uvm_analysis_port.

apb_req_scoreboard.svh

An uvm_scoreboard with an uvm_analysis_imp. It keeps the data of each write and checks each read against it.

apb_req_agent.svh, apb_req_env.svh

The agent (monitor and scoreboard always, driver and sequencer when active) and the environment.

apb_req_directed_seq.svh, apb_req_directed_test.svh

Eight writes, a pause, eight reads, a pause; the test raises and drops an objection around the sequence.

apb_req_if.sv, apb_completer_dut.sv, apb_req_tb_dut_top.sv

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 run_test.

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_db is 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_active on the agent directly.

  • The sequence uses start_item and finish_item with fixed values. There is no randomize and no uvm_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 unqualified get_name() in user code prints IVL_GO2UVM as the message ID.

The APB example is inspired by the APB2 Master UVC of Go2UVM (https://github.com/go2uvm/go2uvm).