Skip to content

Commit 0bc98d2

Browse files
authored
Merge pull request #366 from diffblue/verilog-replication
Verilog: zero-count replication
2 parents 570a301 + ac27405 commit 0bc98d2

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

regression/verilog/replication1/test.desc renamed to regression/verilog/replication/replication1.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE broken-smt-backend
2-
main.v
3-
--bound 1
2+
replication1.v
3+
--bound 0
44
^EXIT=0$
55
^SIGNAL=0$
66
--

regression/verilog/replication1/main.v renamed to regression/verilog/replication/replication1.v

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@ module main(in);
1313
always assert property2:
1414
{{ 1 { in }}, in } == { in, in };
1515

16-
// replication of something boolean
16+
// 0-replication
1717
always assert property3:
18+
{{ 0 { in }}, in } == { in };
19+
20+
// replication of something boolean
21+
always assert property4:
1822
{{ 1 { 1'b0 }}, in } == in;
1923

2024
endmodule

src/verilog/verilog_typecheck_expr.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1911,7 +1911,7 @@ exprt verilog_typecheck_exprt::convert_replication_expr(replication_exprt expr)
19111911
if(op1.type().id()==ID_bool)
19121912
op1 = typecast_exprt{op1, unsignedbv_typet{1}};
19131913

1914-
unsigned width=get_width(expr.op1().type());
1914+
auto width = get_width(expr.op1().type());
19151915

19161916
mp_integer op0 = convert_integer_constant_expression(expr.op0());
19171917

@@ -1921,12 +1921,8 @@ exprt verilog_typecheck_exprt::convert_replication_expr(replication_exprt expr)
19211921
<< "number of replications must not be negative";
19221922
}
19231923

1924-
if(op0==0)
1925-
{
1926-
// ruled out by IEEE 1364-2001
1927-
throw errort().with_location(expr.source_location())
1928-
<< "number of replications must not be zero";
1929-
}
1924+
// IEEE 1800-2017 explicitly allows replication with
1925+
// count zero.
19301926

19311927
{
19321928
expr.op0()=from_integer(op0, natural_typet());

0 commit comments

Comments
 (0)