Skip to content

Commit b20df19

Browse files
authored
Merge pull request #505 from diffblue/always_comb
Verilog: fix always_comb synthesis
2 parents 263aafa + 3105b00 commit b20df19

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
always_comb3.sv
3+
--bound 1
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
--
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module main(input clk);
2+
reg q;
3+
4+
reg w;
5+
6+
// ff
7+
always @(posedge clk)
8+
q = !q;
9+
10+
always_comb
11+
w = q;
12+
13+
p1: assert property (@(posedge clk) w == q);
14+
15+
endmodule

src/verilog/verilog_synthesis.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3023,11 +3023,15 @@ exprt verilog_synthesist::current_value(
30233023

30243024
if(
30253025
construct == constructt::ALWAYS || construct == constructt::ALWAYS_FF ||
3026-
construct == constructt::ALWAYS_LATCH)
3026+
construct == constructt::ALWAYS_LATCH ||
3027+
construct == constructt::ALWAYS_COMB)
3028+
{
30273029
return symbol_expr(symbol, CURRENT);
3030+
}
30283031
else
30293032
{
3030-
// make it some non-deterministic value
3033+
// Initial state computation, i.e., this is a value _before_ the
3034+
// initial state -- make it non-deterministic
30313035
exprt result=exprt(ID_nondet_symbol, symbol.type);
30323036
result.set(ID_identifier, symbol.name);
30333037
result.set("initial_value", true);

0 commit comments

Comments
 (0)