Modify $realtime to use vpiScaledRealTime

$realtime should use vpiScaledRealTime instead of scaling the
time itself. This also allows it to work for time over 32 bits.
This commit is contained in:
Cary R 2008-09-11 16:25:36 -07:00 committed by Stephen Williams
parent 1e60754ff0
commit 1f9f73a4be
1 changed files with 3 additions and 8 deletions

View File

@ -86,22 +86,17 @@ static PLI_INT32 sys_realtime_calltf(PLI_BYTE8*name)
s_vpi_time now;
vpiHandle call_handle;
vpiHandle mod;
int units, prec;
call_handle = vpi_handle(vpiSysTfCall, 0);
assert(call_handle);
mod = sys_func_module(call_handle);
now.type = vpiSimTime;
vpi_get_time(0, &now);
units = vpi_get(vpiTimeUnit, mod);
prec = vpi_get(vpiTimePrecision, 0);
now.type = vpiScaledRealTime;
vpi_get_time(mod, &now);
val.format = vpiRealVal;
val.value.real = pow(10.0, prec-units) * now.low;
assert(now.high == 0);
val.value.real = now.real;
vpi_put_value(call_handle, &val, 0, vpiNoDelay);