Controlling Callback Timing from a MATLAB Test Bench Function

You can control the callback timing of a MATLAB test bench function by using that function's tnext input parameter. This parameter passes a time value to ModelSim, which gets added to the MATLAB function's simulation schedule. If the function returns a null value ([]) , no new entries are added to the schedule.

You can set the value of tnext to a string or value of type double or int64. The following table explains how the interface converts each type of data for use in the ModelSim environment.

Time Representations for tnext Parameter

If You Specify a...The Interface...
String that includes a unit specificationParses the string as a scaled time value with units of fs (femtoseconds), ps (picoseconds), ns (nanoseconds), us (microseconds), ms (milliseconds), or sec (seconds). The value is scaled to the nearest multiple of the current time value resolution. For example, the following string scales to the simulation time nearest to 12.2 nanoseconds as a multiple of the current ModelSim time resolution.
tnext = '12.2 nsec'
String that does not specify unitsParses the string as the number of ticks based on the ModelSim time resolution limit. For example, the following string parses to 100 ticks of the current time resolution.
tnext = 'le2'
double value Converts the value to seconds. For example, the following value converts to the simulation time nearest to 1 nanosecond as a multiple of the current ModelSim time resolution.
 tnext = 1e-9
int64 valueConverts to an integer multiple of the current ModelSim time resolution limit. For example, the following value converts to 100 ticks of the current time resolution.

tnext=int64(100)


Learn more about the latest releases of MathWorks products:

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