Main Content

sltest.xil.framework.TestVariable class

Package: sltest.xil.framework

Read and write variable mapped to test bench

Description

Use the sltest.xil.framework.TestVariable methods to read the current value of a variable from or write a value to the test bench. Before reading or writing a test variable, use the addTestVariableMapping method of the sltest.xil.framework.FrameworkConfiguration class to map the test variables to variables on the test bench. Then, use the createVariable method of the sltest.xil.framework.Framework class to create an instance of the variable.

When you use addTestVariableMapping, you can also specify a task for the variable. Tasks are the rates at which data logging, which is controlled through the Acquisition class, occurs for the variable. If you don't specify a task for a variable, it is logged using the first task value returned by the displayAllTaskInfo method of sltest.xil.framework.Framework.

The sltest.xil.framework.TestVariable class is a handle class.

Creation

You cannot create an sltest.xil.framework.TestVariable object. The createVariable method of the sltest.xil.framework.Framework object creates the TestVariable objects.

Methods

expand all

Examples

collapse all

This example shows how to

  • Create a Framework object

  • Add a model access port

  • Map the RPM variable to a the simpleXIL/Gain1 variable on the test bench

  • initialize the test bench

  • Create the rpm variable

  • Start the simulation

  • Display the value of the rpm variable

import sltest.xil.framework.*
frm = Framework;

frm.Configuration.addModelAccessPort(...
    'MAPort1','asamxil.v2_1',...
    VendorName='ABC Co.'...
    ProductName='ABC Test Bench',...
    ProductVersion='1.7',...
    PortConfigFile=fullfile(pwd,'myConfigFile.xml'));

frm.Configuration.addTestVariableMapping(...
    'RPM','MAPort1','simpleXIL/Gain:1');

frm.init;
rpm = frm.createVariable('RPM');
frm.start;
disp(rpm.read)
frm.stop

Version History

Introduced in R2022a