vvp: Fix initial value propagation for 2-state non-automatic arrays

For 2-state non-automatic arrays currently real 0.0 value is propagated as
the initial value. This will cause an assert at the downstream receivers
which expect a vector.

Make sure that the vector value 0 is propagated instead for 2-state
vectors.

Signed-off-by: Lars-Peter Clausen <[email protected]>
This commit is contained in:
Lars-Peter Clausen
2023-09-23 05:40:13 -07:00
parent 778b6d937e
commit 0eb01fff1e
+8 -4
View File
@@ -1261,11 +1261,15 @@ static void array_attach_port(vvp_array_t array, vvp_fun_arrayport*fun)
array->ports_ = fun;
if (!array->get_scope()->is_automatic()) {
/* propagate initial values for variable arrays */
if (array->vals4) {
vvp_vector4_t tmp(array->vals_width, BIT4_X);
if (!vpi_array_is_real(array)) {
vvp_bit4_t init;
if (array->vals4)
init = BIT4_X;
else
init = BIT4_0;
vvp_vector4_t tmp(array->vals_width, init);
schedule_init_propagate(fun->net_, tmp);
}
if (array->vals) {
} else {
schedule_init_propagate(fun->net_, 0.0);
}
}