Table of Contents Previous page Next page Index

ModelSim Documentation Bookcase

Model Technology Inc.


to_real()

to_real() converts the physical type time value into a real value with respect to the current simulator resolution. The precision of the converted value is determined by the simulator resolution. For example, if you were converting 1900 fs to a real and the simulator resolution was ps, then the real value would be 2.0 (i.e. 2 ps).

Syntax

realval := to_real(timeval); 

Returns

Name
Type
Description
realval
real

The time value represented as a real with respect to the simulator resolution

Arguments

Name
Type
Description
timeval
time

The value of the physical type time

Related functions

get_resolution()

to_time()

Example

If the simulator resolution is set to ps, and you enter the following function:

realval := to_real(12.99 ns); 

then the value returned to realval would be 12990.0. If you wanted the returned value to be in units of nanoseconds (ns) instead, you would use the get_resolution() function to recalculate the value:

realval := 1e+9 * (to_real(12.99 ns)) * get_resolution(); 

If you wanted the returned value to be in units of femtoseconds (fs), you would enter the function this way:

realval := 1e+15 * (to_real(12.99 ns)) * get_resolution(); 

Model Technology Inc.
Model Technology Incorporated
Voice: (503) 641-1340
Fax: (503)526-5410
www.model.com
sales@model.com
Table of Contents Previous page Next page Index

ModelSim Documentation Bookcase