@@ -2389,23 +2389,40 @@ void verilog_synthesist::synth_force_rec(
23892389 }
23902390
23912391 // get symbol
2392-
23932392 const symbolt &symbol=assignment_symbol (lhs);
23942393
2394+ // turn into combinational assignment
23952395 assignmentt &assignment=assignments[symbol.name ];
23962396
23972397 if (assignment.type ==event_guardt::NONE)
2398+ {
23982399 assignment.type =event_guardt::COMBINATIONAL;
2399- else if (assignment.type !=event_guardt::COMBINATIONAL)
2400+ }
2401+ else if (assignment.type == event_guardt::CLOCK)
24002402 {
24012403 throw errort ().with_location (lhs.source_location ())
2402- << " variable is clocked" ;
2404+ << " variable " << symbol.display_name () << " is clocked" ;
2405+ }
2406+ else if (assignment.type == event_guardt::COMBINATIONAL)
2407+ {
2408+ // leave as is
24032409 }
2410+ else
2411+ DATA_INVARIANT (false , " unexpected assignment type" );
24042412
2405- auto rhs_synth = synth_expr (rhs, symbol_statet::CURRENT);
2413+ auto rhs_synth = synth_expr (rhs, symbol_statet::CURRENT);
24062414
2407- equal_exprt equality (lhs, rhs_synth);
2408- invars.push_back (equality);
2415+ // If it's a variable, synth_assignments will
2416+ // generate the constraint.
2417+ if (symbol.is_state_var )
2418+ {
2419+ assignment.next .value = rhs_synth;
2420+ }
2421+ else
2422+ {
2423+ equal_exprt equality (lhs, rhs_synth);
2424+ invars.push_back (equality);
2425+ }
24092426}
24102427
24112428/* ******************************************************************\
@@ -3642,7 +3659,7 @@ void verilog_synthesist::synth_assignments(transt &trans)
36423659 }
36433660 }
36443661 }
3645-
3662+
36463663 for (const auto & it : new_wires)
36473664 {
36483665 symbolt &symbol=symbol_table_lookup (it);
@@ -3725,7 +3742,7 @@ exprt verilog_synthesist::current_value(
37253742 {
37263743 return symbol_expr (symbol, CURRENT);
37273744 }
3728- else
3745+ else if (construct == constructt::INITIAL)
37293746 {
37303747 // Initial state computation, i.e., this is a value _before_ the
37313748 // initial state -- make it non-deterministic
@@ -3734,6 +3751,10 @@ exprt verilog_synthesist::current_value(
37343751 result.set (" initial_value" , true );
37353752 return result;
37363753 }
3754+ else
3755+ {
3756+ DATA_INVARIANT (false , " unexpected assignment construct" );
3757+ }
37373758 }
37383759}
37393760
0 commit comments