IVL_UVM: a complete APB testbench runs on Icarus Verilog
A full UVM-style testbench now runs on Icarus Verilog with IVL_UVM: an APB requester UVC with an agent, driver, sequencer, monitor and scoreboard, a sequence and a test, driving an APB completer. We wrote it the way a UVM user writes it, so you can read it, run it and copy it for your own UVC.
What works today
- Agent, driver, sequencer: the usual
get_next_item/item_donehandshake, withstart_item/finish_itemin the sequence. - Monitor: sends every read and write through an
uvm_analysis_port. - Scoreboard: an
uvm_scoreboardwith anuvm_analysis_imp. It remembers every write and checks every read. - Directed test: eight writes, then eight reads of the same addresses, with objections raised and dropped around the sequence.
- DUT: a small APB2 completer with a 256 x 8 memory.
Try it
cd ivl_uvm_examples/apb_requester/run_dir make vwapb
Code: github.com/AsFigo/ivl_uvm
Docs: asfigo.github.io/ivl_uvm (Examples page)
You need a recent Icarus development build, not the stable v11.0 release.
Familiar output
(Trimmed: file names and line numbers removed from the UVM_INFO prefix.)
UVM_INFO @ 0 ns [RNTST] Running test apb_req_directed_test... UVM_INFO @ 0 ns [apb_req_directed_seq] Sequence is running UVM_INFO @ 76 ns [apb_req_driver] Driving item: WR addr=0x3 data=0x1 ... UVM_INFO @ 404 ns [apb_req_scoreboard] PASS read addr=0x3 data=0x1 UVM_INFO @ 444 ns [apb_req_scoreboard] PASS read addr=0x6 data=0x2 ... UVM_INFO @ 684 ns [apb_req_scoreboard] PASS read addr=0x11 data=0x64 UVM_INFO @ 784 ns [apb_req_directed_seq] Sequence is complete UVM_INFO @ 784 ns [apb_req_scoreboard] APB: PASS (8 checks, 0 failed) --- UVM Report Summary --- ** Report counts by severity UVM_INFO : 100 UVM_WARNING : 0 UVM_ERROR : 0 UVM_FATAL : 0 *** Congratulations! Test PASSED with NO UVM_ERRORs ***
A test now ends with the standard UVM report summary, as it does in the Accellera library.
The waves
The run writes apb_requester.vcd. In GTKWave you can see the eight writes (pwrite high, paddr 03 09 06 20 1D 1E 1F 11 with pwdata 01 03 02 68 C8 28 32 64), a pause, then the eight reads, with prdata returning exactly what was written. Every transfer is a setup cycle (pselx), then an access cycle (penable).
What made it possible
Recent Icarus development builds brought virtual interfaces and events in classes. On our side, the sequencer-driver and analysis TLM ports are built on a typed mailbox, thanks to Ajeetha Kumari Venkatesan.
Not there yet
uvm_config_db: the top module hands the virtual interface to the agent through a package variable, so the example has one agent.randomizeanduvm_do_with: the sequence sends fixed values.- Call through a member of a member:
a.b.connect(...)is not accepted by Icarus yet, so the example uses a local handle.
Next in the series
A second UVC (SPI, I2C or an ALU), to find out what else a real testbench needs. Feedback and issues are welcome in the repo.
The APB example is inspired by the APB2 Master UVC of Go2UVM (github.com/go2uvm/go2uvm). "Requester" and "completer" are the terms Arm uses for APB in place of master and slave. IVL_UVM is licensed under Apache-2.0 and is not affiliated with or endorsed by Accellera.
Comments
Post a Comment