V0.9: To reduce error divide by an integer vs multiple by a fraction.
This same change was done in the vpi directory. This patch fixes the issues in the libveriuser directory. This fixed a fail in the vpi timescale test under MinGW.
This commit is contained in:
parent
2b67a6d465
commit
e1789e7fb9
|
|
@ -36,8 +36,8 @@ scale(int high, int low, void*obj) {
|
||||||
|
|
||||||
scaled = high;
|
scaled = high;
|
||||||
scaled = (scaled << 32) | low;
|
scaled = (scaled << 32) | low;
|
||||||
scaled *= pow(10, vpi_get(vpiTimePrecision,0) -
|
scaled /= pow(10, vpi_get(vpiTimeUnit,obj ? (vpiHandle)obj : hand) -
|
||||||
vpi_get(vpiTimeUnit,obj ? (vpiHandle)obj : hand));
|
vpi_get(vpiTimePrecision,0));
|
||||||
|
|
||||||
return scaled;
|
return scaled;
|
||||||
}
|
}
|
||||||
|
|
@ -129,8 +129,8 @@ void tf_scale_realdelay(void*obj, double real, double *areal)
|
||||||
{
|
{
|
||||||
vpiHandle hand = vpi_handle(vpiScope, vpi_handle(vpiSysTfCall,0));
|
vpiHandle hand = vpi_handle(vpiScope, vpi_handle(vpiSysTfCall,0));
|
||||||
|
|
||||||
*areal = real * pow(10, vpi_get(vpiTimePrecision, 0) -
|
*areal = real / pow(10, vpi_get(vpiTimeUnit, hand) -
|
||||||
vpi_get(vpiTimeUnit, hand));
|
vpi_get(vpiTimePrecision, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void tf_unscale_realdelay(void*obj, double real, double *areal)
|
void tf_unscale_realdelay(void*obj, double real, double *areal)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2002-2009 Michael Ruff (mruff at chiaro.com)
|
* Copyright (c) 2002-2011 Michael Ruff (mruff at chiaro.com)
|
||||||
* Michael Runyan (mrunyan at chiaro.com)
|
* Michael Runyan (mrunyan at chiaro.com)
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
|
|
@ -403,7 +403,7 @@ PLI_INT32 tf_isetrealdelay(double dly, void*obj)
|
||||||
|
|
||||||
/* Scale delay to SimTime */
|
/* Scale delay to SimTime */
|
||||||
ivl_u64_t delay = ((dly
|
ivl_u64_t delay = ((dly
|
||||||
* pow(10, tf_gettimeprecision() - tf_gettimeunit()))
|
/ pow(10, tf_gettimeunit() - tf_gettimeprecision()))
|
||||||
+ 0.5);
|
+ 0.5);
|
||||||
ti.high = delay >> 32 & 0xffffffff;
|
ti.high = delay >> 32 & 0xffffffff;
|
||||||
ti.low = delay & 0xffffffff;
|
ti.low = delay & 0xffffffff;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue