Skip to content

Commit 2af35ab

Browse files
committed
SVA followed-by operators
This adds the SVA operators #=# and #-#.
1 parent 1d075d4 commit 2af35ab

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

src/hw_cbmc_irep_ids.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ IREP_ID_ONE(sva_until)
3636
IREP_ID_ONE(sva_s_until)
3737
IREP_ID_ONE(sva_until_with)
3838
IREP_ID_ONE(sva_s_until_with)
39+
IREP_ID_ONE(sva_overlapped_followed_by)
40+
IREP_ID_ONE(sva_nonoverlapped_followed_by)
3941
IREP_ID_ONE(sva_overlapped_implication)
4042
IREP_ID_ONE(sva_non_overlapped_implication)
4143
IREP_ID_ONE(module_instance)

src/verilog/expr2verilog.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,6 +1141,12 @@ std::string expr2verilogt::convert(
11411141
else if(src.id() == ID_sva_cycle_delay_plus)
11421142
return convert_sva_unary("##[+]", to_unary_expr(src));
11431143

1144+
else if(src.id() == ID_sva_overlapped_followed_by)
1145+
return precedence = 0, convert_sva_binary("#-#", to_binary_expr(src));
1146+
1147+
else if(src.id() == ID_sva_nonoverlapped_followed_by)
1148+
return precedence = 0, convert_sva_binary("#=#", to_binary_expr(src));
1149+
11441150
else if(src.id()==ID_sva_cycle_delay)
11451151
return convert_sva_cycle_delay(to_ternary_expr(src), precedence = 0);
11461152
// not sure about precedence

src/verilog/parser.y

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2059,6 +2059,8 @@ property_expr_proper:
20592059
| property_expr "and" property_expr { init($$, ID_and); mto($$, $1); mto($$, $3); }
20602060
| property_expr "|->" property_expr { init($$, ID_sva_overlapped_implication); mto($$, $1); mto($$, $3); }
20612061
| property_expr "|=>" property_expr { init($$, ID_sva_non_overlapped_implication); mto($$, $1); mto($$, $3); }
2062+
| sequence_expr "#-#" property_expr { init($$, ID_sva_overlapped_followed_by); mto($$, $1); mto($$, $3); }
2063+
| sequence_expr "#=#" property_expr { init($$, ID_sva_nonoverlapped_followed_by); mto($$, $1); mto($$, $3); }
20622064
| "nexttime" property_expr
20632065
{ init($$, "sva_nexttime"); stack_expr($$).add_to_operands(nil_exprt()); mto($$, $2); }
20642066
| "nexttime" '[' constant_expression ']' property_expr %prec "nexttime"

src/verilog/verilog_typecheck_expr.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2260,12 +2260,13 @@ exprt verilog_typecheck_exprt::convert_binary_expr(binary_exprt expr)
22602260

22612261
return std::move(expr);
22622262
}
2263-
else if(expr.id()==ID_sva_overlapped_implication ||
2264-
expr.id()==ID_sva_non_overlapped_implication ||
2265-
expr.id()==ID_sva_until ||
2266-
expr.id()==ID_sva_s_until ||
2267-
expr.id()==ID_sva_until_with ||
2268-
expr.id()==ID_sva_s_until_with)
2263+
else if(
2264+
expr.id() == ID_sva_overlapped_implication ||
2265+
expr.id() == ID_sva_non_overlapped_implication ||
2266+
expr.id() == ID_sva_overlapped_followed_by ||
2267+
expr.id() == ID_sva_nonoverlapped_followed_by ||
2268+
expr.id() == ID_sva_until || expr.id() == ID_sva_s_until ||
2269+
expr.id() == ID_sva_until_with || expr.id() == ID_sva_s_until_with)
22692270
{
22702271
convert_expr(expr.op0());
22712272
make_boolean(expr.op0());

0 commit comments

Comments
 (0)