Skip to content

Commit 65c5e52

Browse files
authored
Merge pull request #1034 from diffblue/sequence_repetition6
SVA: `[*]`, `[+]` and `[*x:y]` require sequence arguments
2 parents 409e8f5 + 2716a5b commit 65c5e52

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
sequence_repetition6.sv
3+
4+
^file .* line 4: sequence required$
5+
^EXIT=2$
6+
^SIGNAL=0$
7+
--
8+
--
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module main(input clk);
2+
3+
// Sequence repetition requires a sequence argument.
4+
assert property ((s_nexttime 1)[*]);
5+
6+
endmodule

src/verilog/verilog_typecheck_sva.cpp

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,26 @@ exprt verilog_typecheck_exprt::convert_unary_sva(unary_exprt expr)
2828
expr.id() == ID_sva_cycle_delay_plus ||
2929
expr.id() == ID_sva_cycle_delay_star || expr.id() == ID_sva_weak ||
3030
expr.id() == ID_sva_strong || expr.id() == ID_sva_nexttime ||
31-
expr.id() == ID_sva_s_nexttime ||
32-
expr.id() == ID_sva_sequence_repetition_plus ||
33-
expr.id() == ID_sva_sequence_repetition_star)
31+
expr.id() == ID_sva_s_nexttime)
3432
{
3533
convert_sva(expr.op());
3634
make_boolean(expr.op());
3735
expr.type() = bool_typet();
3836
return std::move(expr);
3937
}
38+
else if(
39+
expr.id() == ID_sva_sequence_repetition_plus || // x[+]
40+
expr.id() == ID_sva_sequence_repetition_star) // x[*}
41+
{
42+
// These both take a sequence as argument.
43+
// The grammar allows properties to implement and/or over
44+
// sequences. Check here that the argument is a sequence.
45+
convert_sva(expr.op());
46+
require_sva_sequence(expr.op());
47+
make_boolean(expr.op());
48+
expr.type() = bool_typet{};
49+
return std::move(expr);
50+
}
4051
else
4152
{
4253
// not SVA
@@ -260,7 +271,11 @@ exprt verilog_typecheck_exprt::convert_ternary_sva(ternary_exprt expr)
260271
{
261272
auto &repetition = to_sva_sequence_consecutive_repetition_expr(expr);
262273

274+
// This expression takes a sequence as argument.
275+
// The grammar allows properties to implement and/or over
276+
// sequences. Check here that the argument is a sequence.
263277
convert_sva(repetition.op());
278+
require_sva_sequence(repetition.op());
264279
make_boolean(repetition.op());
265280

266281
convert_expr(repetition.from());

0 commit comments

Comments
 (0)