Main Content

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.

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.

  1. 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 to systemverilog_dpi_ert.tlc.

  2. Create a data object for your parameter by using the Simulink.Parameter (Simulink) object. For example, to create a parameter named dataValue, 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, or ExportedGlobal.

      Use Model default when your parameter is instance-specific. Use either SimulinkGlobal or ExportedGlobal to generate a global variable. Setting Storage class to Auto optimizes the parameter during code generation, and is not recommended.

  3. 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 test bench. In addition to the files regularly generated by uvmbuild, the function adds these generated files.

  • top_model_name_uvmbuild/uvm_testbench/scoreboard/ – 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/ – The function start_of_simulation_phase sets the configuration object.

  • top_model_name_uvmbuild/uvm_testbench/uvm_artifacts/ – The test instantiates the configuration object in the build phase.

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'
Alternatively, you can set the parameter value in the configuration object file.

See Also

Related Topics