@@ -616,20 +616,22 @@ void verilog_synthesist::assignment_rec(
616
616
exprt new_rhs (rhs), new_value;
617
617
assignment_rec (lhs, new_rhs, new_value); // start of recursion
618
618
619
- // These can explode if the symbol is assigned more than once
620
- // and also used more than once, e.g., in a multi-dimensional array.
621
- // We add a fresh symbol for anything that is not trivial
622
- // to prevent that.
623
- if (new_value.id ()!=ID_symbol &&
624
- new_value.id ()!=ID_constant)
619
+ if (new_value.is_not_nil ())
625
620
{
626
- replace_by_wire (new_value, symbol);
627
- }
621
+ // These can explode if the symbol is assigned more than once
622
+ // and also used more than once, e.g., in a multi-dimensional array.
623
+ // We add a fresh symbol for anything that is not trivial
624
+ // to prevent that.
625
+ if (new_value.id () != ID_symbol && new_value.id () != ID_constant)
626
+ {
627
+ replace_by_wire (new_value, symbol);
628
+ }
628
629
629
- if (blocking)
630
- value_map->current .assign (symbol.name , new_value);
630
+ if (blocking)
631
+ value_map->current .assign (symbol.name , new_value);
631
632
632
- value_map->final .assign (symbol.name , new_value);
633
+ value_map->final .assign (symbol.name , new_value);
634
+ }
633
635
}
634
636
}
635
637
@@ -926,6 +928,8 @@ void verilog_synthesist::replace_by_wire(
926
928
exprt &what,
927
929
const symbolt &base)
928
930
{
931
+ PRECONDITION (what.is_not_nil ());
932
+
929
933
symbolt new_symbol;
930
934
931
935
do
@@ -935,7 +939,7 @@ void verilog_synthesist::replace_by_wire(
935
939
new_symbol.base_name =id2string (base.base_name )+" _aux" +std::to_string (c);
936
940
}
937
941
while (symbol_table.symbols .find (new_symbol.name )!=symbol_table.symbols .end ());
938
-
942
+
939
943
new_symbol.type =what.type ();
940
944
new_symbol.module =base.module ;
941
945
new_symbol.mode =base.mode ;
@@ -3358,7 +3362,9 @@ void verilog_synthesist::synth_assignments(
3358
3362
3359
3363
// see if wire is used to define itself
3360
3364
if (!symbol.is_state_var )
3365
+ {
3361
3366
post_process_wire (symbol.name , new_value);
3367
+ }
3362
3368
3363
3369
auto lhs = symbol_expr (symbol, curr_or_next);
3364
3370
@@ -3430,6 +3436,9 @@ void verilog_synthesist::synth_assignments(transt &trans)
3430
3436
symbolt &symbol=symbol_table_lookup (it);
3431
3437
assignmentt &assignment=assignments[symbol.name ];
3432
3438
3439
+ DATA_INVARIANT (
3440
+ assignment.next .value .is_not_nil (), " must have assignment value" );
3441
+
3433
3442
synth_assignments (symbol, CURRENT,
3434
3443
assignment.next .value ,
3435
3444
trans.invar ());
0 commit comments