Handle scaled time is acc functions for non-scope objects
The tf_igetlongtime function may pass in any kind of object, so the scale() function may need to convert an object handle to the handle for the objects parent scope.
This commit is contained in:
parent
c8b20da4be
commit
3a77537ed8
|
|
@ -43,10 +43,31 @@ scale(int high, int low, void*obj) {
|
|||
vpiHandle hand = vpi_handle(vpiScope, vpi_handle(vpiSysTfCall,0));
|
||||
ivl_u64_t scaled;
|
||||
|
||||
vpiHandle use_obj = obj;
|
||||
if (use_obj == 0) {
|
||||
/* If object is not passed in, then use current scope. */
|
||||
use_obj = hand;
|
||||
} else {
|
||||
/* If object IS passed in, make sure it is a scope. If
|
||||
it is not, then get the scope of the object. We need
|
||||
a scope handle to go on. */
|
||||
switch (vpi_get(vpiType,use_obj)) {
|
||||
case vpiModule:
|
||||
case vpiGenScope:
|
||||
case vpiFunction:
|
||||
case vpiTask:
|
||||
case vpiNamedBegin:
|
||||
case vpiNamedFork:
|
||||
break;
|
||||
default:
|
||||
use_obj = vpi_handle(vpiScope, use_obj);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
scaled = high;
|
||||
scaled = (scaled << 32) | low;
|
||||
scaled /= pow10u(vpi_get(vpiTimeUnit,obj ? (vpiHandle)obj : hand) -
|
||||
vpi_get(vpiTimePrecision,0));
|
||||
scaled /= pow10u(vpi_get(vpiTimeUnit, use_obj) - vpi_get(vpiTimePrecision,0));
|
||||
|
||||
return scaled;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue