@@ -2389,23 +2389,40 @@ void verilog_synthesist::synth_force_rec(
2389
2389
}
2390
2390
2391
2391
// get symbol
2392
-
2393
2392
const symbolt &symbol=assignment_symbol (lhs);
2394
2393
2394
+ // turn into combinational assignment
2395
2395
assignmentt &assignment=assignments[symbol.name ];
2396
2396
2397
2397
if (assignment.type ==event_guardt::NONE)
2398
+ {
2398
2399
assignment.type =event_guardt::COMBINATIONAL;
2399
- else if (assignment.type !=event_guardt::COMBINATIONAL)
2400
+ }
2401
+ else if (assignment.type == event_guardt::CLOCK)
2400
2402
{
2401
2403
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
2403
2409
}
2410
+ else
2411
+ DATA_INVARIANT (false , " unexpected assignment type" );
2404
2412
2405
- auto rhs_synth = synth_expr (rhs, symbol_statet::CURRENT);
2413
+ auto rhs_synth = synth_expr (rhs, symbol_statet::CURRENT);
2406
2414
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
+ }
2409
2426
}
2410
2427
2411
2428
/* ******************************************************************\
@@ -3642,7 +3659,7 @@ void verilog_synthesist::synth_assignments(transt &trans)
3642
3659
}
3643
3660
}
3644
3661
}
3645
-
3662
+
3646
3663
for (const auto & it : new_wires)
3647
3664
{
3648
3665
symbolt &symbol=symbol_table_lookup (it);
@@ -3725,7 +3742,7 @@ exprt verilog_synthesist::current_value(
3725
3742
{
3726
3743
return symbol_expr (symbol, CURRENT);
3727
3744
}
3728
- else
3745
+ else if (construct == constructt::INITIAL)
3729
3746
{
3730
3747
// Initial state computation, i.e., this is a value _before_ the
3731
3748
// initial state -- make it non-deterministic
@@ -3734,6 +3751,10 @@ exprt verilog_synthesist::current_value(
3734
3751
result.set (" initial_value" , true );
3735
3752
return result;
3736
3753
}
3754
+ else
3755
+ {
3756
+ DATA_INVARIANT (false , " unexpected assignment construct" );
3757
+ }
3737
3758
}
3738
3759
}
3739
3760
0 commit comments