Skip to content

Commit 4901b07

Browse files
authored
Merge pull request #1360 from diffblue/synth-with
2 parents 941b266 + 60e77f6 commit 4901b07

File tree

1 file changed

+7
-21
lines changed

1 file changed

+7
-21
lines changed

src/verilog/verilog_synthesis.cpp

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -555,9 +555,7 @@ void verilog_synthesist::assignment_rec(
555555

556556
if(it->type().id()==ID_bool)
557557
{
558-
exprt bit_extract(ID_extractbit, it->type());
559-
bit_extract.add_to_operands(rhs);
560-
bit_extract.add_to_operands(offset_constant);
558+
exprt bit_extract = extractbit_exprt{rhs, offset_constant};
561559
++offset;
562560

563561
assignment_rec(*it, bit_extract, blocking);
@@ -771,18 +769,12 @@ exprt verilog_synthesist::assignment_rec(const exprt &lhs, const exprt &rhs)
771769
{
772770
exprt offset = from_integer(i - from, integer_typet());
773771

774-
exprt rhs_extractbit(ID_extractbit, bool_typet());
775-
rhs_extractbit.reserve_operands(2);
776-
rhs_extractbit.add_to_operands(rhs);
777-
rhs_extractbit.add_to_operands(std::move(offset));
772+
exprt rhs_extractbit = extractbit_exprt{rhs, std::move(offset)};
778773

779774
exprt count = from_integer(i, integer_typet());
780775

781-
exprt new_rhs(ID_with, lhs_src.type());
782-
new_rhs.reserve_operands(3);
783-
new_rhs.add_to_operands(synth_lhs_src);
784-
new_rhs.add_to_operands(std::move(count));
785-
new_rhs.add_to_operands(std::move(rhs_extractbit));
776+
exprt new_rhs =
777+
with_exprt{synth_lhs_src, std::move(count), std::move(rhs_extractbit)};
786778

787779
// do the value
788780
exprt new_value = assignment_rec(lhs_src, new_rhs); // recursive call
@@ -851,18 +843,12 @@ exprt verilog_synthesist::assignment_rec(const exprt &lhs, const exprt &rhs)
851843
{
852844
exprt offset = from_integer(i - index, integer_typet());
853845

854-
exprt rhs_extractbit(ID_extractbit, bool_typet());
855-
rhs_extractbit.reserve_operands(2);
856-
rhs_extractbit.add_to_operands(rhs);
857-
rhs_extractbit.add_to_operands(std::move(offset));
846+
exprt rhs_extractbit = extractbit_exprt{rhs, std::move(offset)};
858847

859848
exprt count = from_integer(i, integer_typet());
860849

861-
exprt new_rhs(ID_with, lhs_src.type());
862-
new_rhs.reserve_operands(3);
863-
new_rhs.add_to_operands(synth_lhs_src);
864-
new_rhs.add_to_operands(std::move(count));
865-
new_rhs.add_to_operands(std::move(rhs_extractbit));
850+
exprt new_rhs =
851+
with_exprt{synth_lhs_src, std::move(count), std::move(rhs_extractbit)};
866852

867853
// do the value
868854
exprt new_value = assignment_rec(lhs_src, new_rhs); // recursive call

0 commit comments

Comments
 (0)