24.03.2013 Views

ModelSim SE User's Manual - Electrical and Computer Engineering

ModelSim SE User's Manual - Electrical and Computer Engineering

ModelSim SE User's Manual - Electrical and Computer Engineering

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

UM-98 4 - VHDL simulation<br />

to_real()<br />

<strong>ModelSim</strong> <strong>SE</strong> User’s <strong>Manual</strong><br />

to_real() converts the physical type time value into a real value with respect to the current<br />

simulator resolution. The precision of the converted value is determined by the simulator<br />

resolution. For example, if you were converting 1900 fs to a real <strong>and</strong> the simulator<br />

resolution was ps, then the real value would be 2.0 (i.e., 2 ps).<br />

Syntax<br />

realval := to_real(timeval);<br />

Returns<br />

Name Type Description<br />

realval real The time value represented as a real with<br />

respect to the simulator resolution<br />

Arguments<br />

Name Type Description<br />

timeval time The value of the physical type time<br />

Related functions<br />

get_resolution (UM-96)<br />

to_time() (UM-99)<br />

Example<br />

If the simulator resolution is set to ps, <strong>and</strong> you enter the following function:<br />

realval := to_real(12.99 ns);<br />

then the value returned to realval would be 12990.0. If you wanted the returned value to be<br />

in units of nanoseconds (ns) instead, you would use the get_resolution (UM-96) function to<br />

recalculate the value:<br />

realval := 1e+9 * (to_real(12.99 ns)) * get_resolution();<br />

If you wanted the returned value to be in units of femtoseconds (fs), you would enter the<br />

function this way:<br />

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

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!