Skip to content

Commit

Permalink
SVA followed-by operators
Browse files Browse the repository at this point in the history
This adds the SVA operators #=# and #-#.
  • Loading branch information
kroening committed Jun 8, 2024
1 parent 1d075d4 commit 2af35ab
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/hw_cbmc_irep_ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ IREP_ID_ONE(sva_until)
IREP_ID_ONE(sva_s_until)
IREP_ID_ONE(sva_until_with)
IREP_ID_ONE(sva_s_until_with)
IREP_ID_ONE(sva_overlapped_followed_by)
IREP_ID_ONE(sva_nonoverlapped_followed_by)
IREP_ID_ONE(sva_overlapped_implication)
IREP_ID_ONE(sva_non_overlapped_implication)
IREP_ID_ONE(module_instance)
Expand Down
6 changes: 6 additions & 0 deletions src/verilog/expr2verilog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,12 @@ std::string expr2verilogt::convert(
else if(src.id() == ID_sva_cycle_delay_plus)
return convert_sva_unary("##[+]", to_unary_expr(src));

else if(src.id() == ID_sva_overlapped_followed_by)
return precedence = 0, convert_sva_binary("#-#", to_binary_expr(src));

else if(src.id() == ID_sva_nonoverlapped_followed_by)
return precedence = 0, convert_sva_binary("#=#", to_binary_expr(src));

else if(src.id()==ID_sva_cycle_delay)
return convert_sva_cycle_delay(to_ternary_expr(src), precedence = 0);
// not sure about precedence
Expand Down
2 changes: 2 additions & 0 deletions src/verilog/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -2059,6 +2059,8 @@ property_expr_proper:
| property_expr "and" property_expr { init($$, ID_and); mto($$, $1); mto($$, $3); }
| property_expr "|->" property_expr { init($$, ID_sva_overlapped_implication); mto($$, $1); mto($$, $3); }
| property_expr "|=>" property_expr { init($$, ID_sva_non_overlapped_implication); mto($$, $1); mto($$, $3); }
| sequence_expr "#-#" property_expr { init($$, ID_sva_overlapped_followed_by); mto($$, $1); mto($$, $3); }
| sequence_expr "#=#" property_expr { init($$, ID_sva_nonoverlapped_followed_by); mto($$, $1); mto($$, $3); }
| "nexttime" property_expr
{ init($$, "sva_nexttime"); stack_expr($$).add_to_operands(nil_exprt()); mto($$, $2); }
| "nexttime" '[' constant_expression ']' property_expr %prec "nexttime"
Expand Down
13 changes: 7 additions & 6 deletions src/verilog/verilog_typecheck_expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2260,12 +2260,13 @@ exprt verilog_typecheck_exprt::convert_binary_expr(binary_exprt expr)

return std::move(expr);
}
else if(expr.id()==ID_sva_overlapped_implication ||
expr.id()==ID_sva_non_overlapped_implication ||
expr.id()==ID_sva_until ||
expr.id()==ID_sva_s_until ||
expr.id()==ID_sva_until_with ||
expr.id()==ID_sva_s_until_with)
else if(
expr.id() == ID_sva_overlapped_implication ||
expr.id() == ID_sva_non_overlapped_implication ||
expr.id() == ID_sva_overlapped_followed_by ||
expr.id() == ID_sva_nonoverlapped_followed_by ||
expr.id() == ID_sva_until || expr.id() == ID_sva_s_until ||
expr.id() == ID_sva_until_with || expr.id() == ID_sva_s_until_with)
{
convert_expr(expr.op0());
make_boolean(expr.op0());
Expand Down

0 comments on commit 2af35ab

Please sign in to comment.