Main Content

uvmbuild

Generate UVM test bench from Simulink model

Description

example

uvmbuild(dut,sequence,scoreboard) generates a SystemVerilog top module, which includes a Universal Verification Methodology (UVM) test bench and a behavioral design under test (DUT). The UVM test bench includes a sequence, a scoreboard, monitors, and drivers. The uvmbuild function maps:

  • The Simulink® DUT subsystem to a generated SystemVerilog DPI behavioral DUT

  • The Simulink sequence subsystem to a UVM sequence block

  • The Simulink scoreboard subsystem to a UVM scoreboard

uvmbuild(___,Name,Value) ) specifies options using one or more name-value pair arguments in addition to the input arguments in the previous syntax. For example, 'Driver','mySLTopModule/myDriver' generates a UVM driver from the Simulink subsystem specified as 'mySLTopModule/myDriver'.

Examples

collapse all

Simulink Model Structure

This example uses a Simulink® model, that includes these three subsystems.

  • A sequence subsystem, which generates stimulus for the DUT.

  • A DUT subsystem, which represents your HDL design.

  • A scoreboard subsystem, which collects the outputs and checks them. In this example the DUT is a simple delay block.

open_system('hdlv_uvmbuild');

Generate UVM Test Bench

Generate a UVM test bench from this Simulink model, specifying the paths to the DUT, sequence, and scoreboard subsystems.

uvmbuild('hdlv_uvmbuild/DUT','hdlv_uvmbuild/Sequence','hdlv_uvmbuild/Scoreboard');

Observe Generated Output

The uvmbuild function creates a directory named hdlv_uvmbuild_uvmbuild containing the uvm_testbench directory. The uvm_testbench directory includes these subdirectories.

  • The top directory includes a SystemVerilog top module and generated scripts to execute in your HDL simulation environment.

  • The DPI_dut directory contains the SystemVerilog-DPI behavioral DUT.

  • The sequence directory contains the generated sequence transaction type and a UVM sequencer, which drives the transaction to the DUT.

  • The scoreboard directory contains the generated UVM scoreboard.

  • The uvm_artifacts directory contains UVM components, such as monitors, drivers, and agents, required for the UVM environment.

Run Generated UVM Test Bench

  1. Start Modelsim® or Questasim in GUI mode.

  2. In the HDL simulator, navigate to the top directory: cd hdlv_uvmbuild_uvmbuild\uvm_testbench\top\

  3. In the HDL simulator, enter this command to run your simulation: do run_tb_mq.do

Input Arguments

collapse all

Design under test subsystem, specified as a character vector or string scalar representing a DUT-subsystem name or full block path.

Example: 'hdlv_uvmbuild/DUT'

Data Types: char | string

Sequence subsystem, specified as a character vector or string scalar representing a sequence-subsystem name or full block path.

Example: 'hdlv_uvmbuild/sequence'

Data Types: char | string

Scoreboard subsystem, specified as a character vector or string scalar representing a scoreboard-subsystem name or full block path.

Example: 'hdlv_uvmbuild/scoreboard'

Data Types: char | string

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: uvmbuild('top/dut','top/seq','top/scr','Driver','top/drv','Monitor','top/mon')

Driver subsystem, specified as a character vector or string scalar representing a driver-subsystem name or full block path. By default, the uvmbuild function generates a passthrough UVM driver.

Example: 'hdlv_uvmbuild/driver'

Data Types: char | string

Monitor subsystem, specified as a character vector or string scalar representing a monitor-subsystem name or full block path. By default, the uvmbuild function generates a passthrough UVM monitor.

Example: 'hdlv_uvmbuild/monitor'

Data Types: char | string

UVM configuration parameters, specified as the comma-separated pair consisting of 'Config' and a uvmcodegen.uvmconfig configuration object. Use this value to configure the generated UVM test bench.

Data Types: char | string

Introduced in R2019b