You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to get a existing design loaded into Synlig, but I notice that $size of a unpacked array was returning the size in bits of the full memory, instead of just the number of elements.
I am not sure if I should have filled this issue on Synlig, Surelog or here, but, from what I can tell, the code responsible for evaluating $size is mostly here.
The patch below makes $size return the expected value in the case above, but I not sure if it will break others results, or if the function will still be wrong for other types.
diff --git a/templates/ExprEval.cpp b/templates/ExprEval.cpp
index 51ef9b3..171dc0e 100644
--- a/templates/ExprEval.cpp+++ b/templates/ExprEval.cpp@@ -1272,7 +1272,9 @@ uint64_t ExprEval::size(const any *ts, bool &invalidValue, const any *inst,
case UHDM_OBJECT_TYPE::uhdmarray_typespec: {
array_typespec *lts = (array_typespec *)ts;
ranges = lts->Ranges();
- if (const ref_typespec *rt = lts->Elem_typespec()) {+ if (!full) {+ bits = 1;+ } else if (const ref_typespec *rt = lts->Elem_typespec()) {
bits = size(rt->Actual_typespec(), invalidValue, inst, pexpr, full);
}
break;
The text was updated successfully, but these errors were encountered:
Description
I was trying to get a existing design loaded into Synlig, but I notice that
$size
of a unpacked array was returning the size in bits of the full memory, instead of just the number of elements.I am not sure if I should have filled this issue on Synlig, Surelog or here, but, from what I can tell, the code responsible for evaluating
$size
is mostly here.Reproduction
If I have the file
testsize.sv
below:And in the Surelog repository I run:
I can see from the output that the
vpiSize
ofb
is 8, where it should be 2.Full Output
Fix?
The patch below makes
$size
return the expected value in the case above, but I not sure if it will break others results, or if the function will still be wrong for other types.The text was updated successfully, but these errors were encountered: