Setting up Expected Parameters

The Link for ModelSim interface expects a MATLAB test bench function to be defined with the following function definition line:

function [iport, tnext] = MyFunctionName(oport, tnow, portinfo)

The data that gets passed into the function through the output parameters is defined by the structure of the corresponding VHDL entity. The following table explains the purpose of each parameter:

ParameterPurpose
iportStructure that forces (by deposit) values onto signals connected to ports of the associated VHDL entity.
tnextSpecifies an optional time at which the MATLAB function is to be called back. If you leave this parameter unassigned or if you assign it an empty value ([]), no new entries are added to the simulation schedule. By default, time is represented in seconds. The interface accepts 64–bit integers, which are interpreted as multiples of the ModelSim resolution limit.
oportStructure that receives VHDL signal values from the output ports defined for the associated VHDL entity at the time specified by tnow.
tnowReceives the simulation time at which the MATLAB function is called. By default, time is represented in seconds. The interface also supports full 64–bit time resolution. For more information see Starting the MATLAB Server.
portinfoFor the first invocation of the function (at the start of the simulation) only, receives an array of information that describes the ports defined for the associated VHDL entity. For each port, the array identifies information such as the port's type, direction, and size. The information passed to this parameter is useful for validating the entity under test. You might also consider using the port information to create a generic MATLAB function that operates differently depending on the port information supplied at startup.

For more information on using tnext and tnow for simulation scheduling, see Deciding on Test Bench Scheduling Options and Controlling Callback Timing from a MATLAB Test Bench Function. For an example of how to use these parameters, see Sample MATLAB Test Bench Function. For more information on port data, see Gaining Access to and Applying Port Information.


Learn more about the latest releases of MathWorks products:

 © 1994-2009 The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS