added vpRealVal support

This commit is contained in:
Jitesh 2024-09-30 00:02:46 +05:30
parent dcf92c82ec
commit d9a93d9bf1
No known key found for this signature in database

View File

@ -2850,7 +2850,7 @@ bool vl_check_array_format(const VerilatedVar* varp, const p_vpi_arrayvalue arra
} }
} else if (arrayvalue_p->format == vpiRealVal) { } else if (arrayvalue_p->format == vpiRealVal) {
switch (varp->vltype()) { switch (varp->vltype()) {
case VLVT_REAL: case VLVT_UINT64:
return status; return status;
default: default:
status = false; status = false;
@ -3000,6 +3000,25 @@ void vl_get_value_array(vpiHandle object, p_vpi_arrayvalue arrayvalue_p,
return; return;
} }
else if(arrayvalue_p->format==vpiRealVal) {
double *reals;
if (arrayvalue_p->flags & vpiUserAllocFlag) {
reals = arrayvalue_p->value.reals;
} else {
reals = (double*)malloc(num * 8);
arrayvalue_p->value.reals = reals;
}
if(varp->vltype()==VLVT_UINT64) {
QData *ptr = reinterpret_cast<QData*>(vop->varDatap());
for (int i = 0; i < num; i++) {
reals[i] = ptr[index++];
index = index % size;
}
}
return;
}
VL_VPI_ERROR_(__FILE__, __LINE__, "%s: Unsupported format (%s) as requested for %s", __func__, VL_VPI_ERROR_(__FILE__, __LINE__, "%s: Unsupported format (%s) as requested for %s", __func__,
VerilatedVpiError::strFromVpiVal(arrayvalue_p->format), vop->fullname()); VerilatedVpiError::strFromVpiVal(arrayvalue_p->format), vop->fullname());