Skip to content

Commit d13de53

Browse files
authored
Merge pull request #239 from diffblue/ports4
Verilog: fix module port binding
2 parents 3846452 + d31784d commit d13de53

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
ports4.v
3+
--bound 0
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
--

regression/verilog/modules/ports4.v

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module submodule(input [7:0] data);
2+
3+
always assert p0: data == 123;
4+
5+
endmodule
6+
7+
module main#(parameter MY_PARAMETER = 123)();
8+
9+
submodule instance(MY_PARAMETER);
10+
11+
always assert p1: MY_PARAMETER == 123;
12+
13+
endmodule

src/verilog/verilog_synthesis.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -964,8 +964,11 @@ void verilog_synthesist::instantiate_port(
964964
throw 0;
965965
}
966966

967+
auto value_synthesized = synth_expr(value, symbol_statet::SYMBOL);
968+
967969
trans.invar().add_to_operands(equal_exprt(
968-
typecast_exprt::conditional_cast(it->second, value.type()), value));
970+
typecast_exprt::conditional_cast(it->second, value_synthesized.type()),
971+
value_synthesized));
969972
}
970973

971974
/*******************************************************************\

0 commit comments

Comments
 (0)