Skip to content

Commit 3a1183a

Browse files
authored
Merge pull request #245 from diffblue/synth-values-expr
Verilog: Synthesis now uses exprt for propagating constants
2 parents e61d78d + 7f6c8d9 commit 3a1183a

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/verilog/verilog_synthesis.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ exprt verilog_synthesist::synth_expr(exprt expr, symbol_statet symbol_state)
4949

5050
if(v_it!=values.end())
5151
{
52-
exprt c=from_integer(v_it->second, integer_typet());
52+
exprt c = v_it->second;
5353
c.add_source_location()=expr.source_location();
5454
return c;
5555
}
@@ -1755,10 +1755,9 @@ void verilog_synthesist::synth_assign(
17551755
// elaborate now?
17561756
if(lhs.type().id() == ID_integer)
17571757
{
1758-
mp_integer i;
17591758
simplify(rhs, ns);
17601759

1761-
if(to_integer_non_constant(rhs, i))
1760+
if(!rhs.is_constant())
17621761
{
17631762
error().source_location=rhs.source_location();
17641763
error() << "synthesis expects constant on rhs" << eom;
@@ -1771,8 +1770,8 @@ void verilog_synthesist::synth_assign(
17711770
error() << "synthesis expects symbol on lhs" << eom;
17721771
throw 0;
17731772
}
1774-
1775-
values[to_symbol_expr(lhs).get_identifier()]=i;
1773+
1774+
values[to_symbol_expr(lhs).get_identifier()] = rhs;
17761775
}
17771776
else
17781777
assignment(lhs, rhs, blocking);

src/verilog/verilog_synthesis_class.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ class verilog_synthesist:
291291

292292
// This map contains the values of all variables
293293
// fixed to a constant during synthesis.
294-
typedef std::map<irep_idt, mp_integer> valuest;
294+
typedef std::map<irep_idt, exprt> valuest;
295295
valuest values;
296296

297297
unsigned temporary_counter;

0 commit comments

Comments
 (0)