Set undriven bits to zero when only driving one part of a 2-state net.
Arguably this should be done in the target code generator, as the code generator can infer the value for undriven bits from the net type. But in practice it is quite hard to do this in the vvp code generator. So adapt the cprop functor that concatenates part selects to do this as well. This fixes issue #1047 and issue #1083.
This commit is contained in:
parent
b037d6aef9
commit
ab275a0841
7
cprop.cc
7
cprop.cc
|
|
@ -251,7 +251,12 @@ void cprop_functor::lpm_part_select(Design*des, NetPartSelect*obj)
|
|||
obj_set.push_back(cur_obj);
|
||||
}
|
||||
|
||||
if (obj_set.size() < 2)
|
||||
// When driving a 4-state signal, we only want to create a
|
||||
// concatenation if we have more than one part select. But
|
||||
// when driving a 2-state signal, create a concatenation
|
||||
// even if there's only one part select, which forces the
|
||||
// undriven bits to zero without needing an explicit cast.
|
||||
if ((obj_set.size() == 0) || ((obj_set.size() == 1) && !output_2_state))
|
||||
return;
|
||||
|
||||
if (debug_optimizer)
|
||||
|
|
|
|||
Loading…
Reference in New Issue