@@ -994,38 +994,48 @@ static inline sva_followed_by_exprt &to_sva_followed_by_expr(exprt &expr)
994994 return static_cast <sva_followed_by_exprt &>(expr);
995995}
996996
997- class sva_cycle_delay_exprt : public ternary_exprt
997+ // / lhs ##n rhs
998+ // / lhs ##[from:to] rhs
999+ // / lhs ##[from:$] rhs
1000+ // / The lhs is optional, indicated by 'nil'
1001+ class sva_cycle_delay_exprt : public exprt
9981002{
9991003public:
10001004 // / The upper bound may be $
1001- sva_cycle_delay_exprt (constant_exprt from, exprt to, exprt op )
1002- : ternary_exprt(
1005+ sva_cycle_delay_exprt (exprt lhs, constant_exprt from, exprt to, exprt rhs )
1006+ : exprt{
10031007 ID_sva_cycle_delay,
1004- std::move (from),
1005- std::move(to),
1006- std::move(op),
1007- verilog_sva_sequence_typet{})
1008+ verilog_sva_sequence_typet{},
1009+ {std::move (lhs), std::move (from), std::move (to), std::move (rhs)}}
10081010 {
10091011 }
10101012
1011- sva_cycle_delay_exprt (constant_exprt cycles, exprt op )
1012- : ternary_exprt(
1013+ sva_cycle_delay_exprt (constant_exprt cycles, exprt rhs )
1014+ : exprt{
10131015 ID_sva_cycle_delay,
1014- std::move (cycles),
1015- nil_exprt{},
1016- std::move (op),
1017- verilog_sva_sequence_typet{})
1016+ verilog_sva_sequence_typet{},
1017+ {nil_exprt{}, std::move (cycles), nil_exprt{}, std::move (rhs)}}
1018+ {
1019+ }
1020+
1021+ const exprt &lhs () const
1022+ {
1023+ return operands ()[0 ];
1024+ }
1025+
1026+ exprt &lhs ()
10181027 {
1028+ return operands ()[0 ];
10191029 }
10201030
10211031 const constant_exprt &from () const
10221032 {
1023- return static_cast <const constant_exprt &>(op0 () );
1033+ return static_cast <const constant_exprt &>(operands ()[ 1 ] );
10241034 }
10251035
10261036 constant_exprt &from ()
10271037 {
1028- return static_cast <constant_exprt &>(op0 () );
1038+ return static_cast <constant_exprt &>(operands ()[ 1 ] );
10291039 }
10301040
10311041 // May be just the singleton 'from' or
@@ -1034,39 +1044,54 @@ class sva_cycle_delay_exprt : public ternary_exprt
10341044 const constant_exprt &to () const
10351045 {
10361046 PRECONDITION (is_range () && !is_unbounded ());
1037- return static_cast <const constant_exprt &>(op1 () );
1047+ return static_cast <const constant_exprt &>(operands ()[ 2 ] );
10381048 }
10391049
10401050 constant_exprt &to ()
10411051 {
10421052 PRECONDITION (is_range () && !is_unbounded ());
1043- return static_cast <constant_exprt &>(op1 () );
1053+ return static_cast <constant_exprt &>(operands ()[ 2 ] );
10441054 }
10451055
10461056 bool is_range () const
10471057 {
1048- return op1 () .is_not_nil ();
1058+ return operands ()[ 2 ] .is_not_nil ();
10491059 }
10501060
10511061 bool is_unbounded () const
10521062 {
1053- return op1 () .id () == ID_infinity;
1063+ return operands ()[ 2 ] .id () == ID_infinity;
10541064 }
10551065
10561066 const exprt &op () const
10571067 {
1058- return op2 () ;
1068+ return operands ()[ 3 ] ;
10591069 }
10601070
10611071 exprt &op ()
10621072 {
1063- return op2 () ;
1073+ return operands ()[ 3 ] ;
10641074 }
10651075
1066- protected:
1067- using ternary_exprt::op0;
1068- using ternary_exprt::op1;
1069- using ternary_exprt::op2;
1076+ const exprt &rhs () const
1077+ {
1078+ return operands ()[3 ];
1079+ }
1080+
1081+ exprt &rhs ()
1082+ {
1083+ return operands ()[3 ];
1084+ }
1085+
1086+ static void check (
1087+ const exprt &expr,
1088+ const validation_modet vm = validation_modet::INVARIANT)
1089+ {
1090+ DATA_CHECK (
1091+ vm,
1092+ expr.operands ().size () == 4 ,
1093+ " sva_cycle_delay expression must have four operands" );
1094+ }
10701095};
10711096
10721097static inline const sva_cycle_delay_exprt &
@@ -1084,13 +1109,14 @@ static inline sva_cycle_delay_exprt &to_sva_cycle_delay_expr(exprt &expr)
10841109 return static_cast <sva_cycle_delay_exprt &>(expr);
10851110}
10861111
1087- class sva_cycle_delay_plus_exprt : public unary_exprt
1112+ class sva_cycle_delay_plus_exprt : public binary_exprt
10881113{
10891114public:
1090- explicit sva_cycle_delay_plus_exprt (exprt op)
1091- : unary_exprt(
1115+ explicit sva_cycle_delay_plus_exprt (exprt __lhs, exprt __rhs)
1116+ : binary_exprt(
1117+ std::move (__lhs),
10921118 ID_sva_cycle_delay_plus,
1093- std::move (op ),
1119+ std::move(__rhs ),
10941120 verilog_sva_sequence_typet{})
10951121 {
10961122 }
@@ -1115,13 +1141,14 @@ to_sva_cycle_delay_plus_expr(exprt &expr)
11151141 return static_cast <sva_cycle_delay_plus_exprt &>(expr);
11161142}
11171143
1118- class sva_cycle_delay_star_exprt : public unary_exprt
1144+ class sva_cycle_delay_star_exprt : public binary_exprt
11191145{
11201146public:
1121- explicit sva_cycle_delay_star_exprt (exprt op)
1122- : unary_exprt(
1147+ explicit sva_cycle_delay_star_exprt (exprt __lhs, exprt __rhs)
1148+ : binary_exprt(
1149+ std::move (__lhs),
11231150 ID_sva_cycle_delay_star,
1124- std::move (op ),
1151+ std::move(__rhs ),
11251152 verilog_sva_sequence_typet{})
11261153 {
11271154 }
0 commit comments