Tunable Parameters in Scoreboard Subsystem
When a Simulink® scoreboard subsystem includes tunable parameters, the uvmbuild
function
generates a scoreboard configuration object that contains a SystemVerilog parameter for each
tunable parameter. This feature enables you to generalize the scoreboard components, promoting
reuse of the same SystemVerilog scoreboard across different scenarios by changing the
parameter value as a command line argument.
Note
This feature requires the ASIC Testbench for HDL Verifier add-on.
Prepare Scoreboard for UVM Generation with Tunable Parameters
To prepare the scoreboard subsystem for Universal Verification Methodology (UVM) generation with tunable parameters, take these steps.
Set up your Simulink model for DPI and UVM generation. On the Modeling tab in Simulink, click Model Settings. In the Configuration Parameters dialog box, select Code Generation on the left pane. Then, set System target file to
systemverilog_dpi_grt.tlc
If you have the Embedded Coder® product you can alternatively set this value tosystemverilog_dpi_ert.tlc
.Create a data object for your parameter by using the
Simulink.Parameter
(Simulink) object. For example, to create a parameter nameddataValue
, enter this code at the MATLAB command prompt.dataValue = Simulink.Parameter open dataValue
Define properties for the
dataValue
parameter. In the Simulink.Parameter window, set these values.Value – Set the default value for the generated UVM parameter.
Data type – Set the data type for the generated UVM parameter. For the sequence subsystem, note the difference between using integer and floating point data types for constrained random parameters.
Storage class – Select
Model default
,SimulinkGlobal
, orExportedGlobal
.Use
Model default
when your parameter is instance-specific. Use eitherSimulinkGlobal
orExportedGlobal
to generate a global variable. Setting Storage class toAuto
optimizes the parameter during code generation, and is not recommended.
Use the parameter you created in the scoreboard subsystem of your Simulink model. Control the parameter value from the command line to test different scenarios.
Generate UVM Scoreboard
Use the uvmbuild
function
to generate a UVM testbench. In addition to the files regularly generated by
uvmbuild
, the function adds these generated files.
– This file contains a configuration object for the scoreboard. It defines the default value for the tunable parameter as the value you set in the Simulink parameter.top_model_name
_uvmbuild/uvm_testbench/scoreboard/mw_DUT
_scoreboard_cfg_obj.sv
– The functiontop_model_name
_uvmbuild/uvm_testbench/scoreboard/mw_DUT
_scoreboard.svstart_of_simulation_phase
sets the configuration object.
– The test instantiates the configuration object in the build phase.top_model_name
_uvmbuild/uvm_testbench/uvm_artifacts/mw_DUT
_test.sv
For more information about the files generated by the uvmbuild
function, see Generated Files and Folder Structure.
Control Scoreboard Parameters in UVM Simulation
After generating UVM components for your system, you can control the parameter value by
using SystemVerilog command line arguments (plusargs). For example, for a parameter named
GoldenVal
that was created using the
Simulink.Parameter
object, you can set its value to
10
by entering this code in the HDL-simulator command
prompt.
setenv EXTRA_UVM_SIM_ARGS '+RTWStructParam_GoldenVal=10'