"Value", "Const", "C", "Operator", "Mux", "Part", "Slice", "Cat", "Repl",
"Array", "ArrayProxy",
"Signal", "ClockSignal", "ResetSignal",
- "Statement", "Assign", "Switch", "Delay", "Tick", "Passive",
- "ValueKey", "ValueDict", "ValueSet", "SignalKey", "SignalDict", "SignalSet",
+ "Statement", "Assign", "Assert", "Assume", "Switch", "Delay", "Tick",
+ "Passive", "ValueKey", "ValueDict", "ValueSet", "SignalKey", "SignalDict",
+ "SignalSet",
]
return "(eq {!r} {!r})".format(self.lhs, self.rhs)
+class Assert(Statement):
+ def __init__(self, test, _check=None, _en=None):
+ self.test = Value.wrap(test)
+
+ self._check = _check
+ if self._check is None:
+ self._check = Signal(reset_less=True, name="$assert$check")
+ self._check.src_loc = self.test.src_loc
+
+ self._en = _en
+ if _en is None:
+ self._en = Signal(reset_less=True, name="$assert$en")
+ self._en.src_loc = self.test.src_loc
+
+ def _lhs_signals(self):
+ return ValueSet((self._en, self._check))
+
+ def _rhs_signals(self):
+ return self.test._rhs_signals()
+
+ def __repr__(self):
+ return "(assert {!r})".format(self.test)
+
+
+class Assume(Statement):
+ def __init__(self, test, _check=None, _en=None):
+ self.test = Value.wrap(test)
+
+ self._check = _check
+ if self._check is None:
+ self._check = Signal(reset_less=True, name="$assume$check")
+ self._check.src_loc = self.test.src_loc
+
+ self._en = _en
+ if self._en is None:
+ self._en = Signal(reset_less=True, name="$assume$en")
+ self._en.src_loc = self.test.src_loc
+
+ def _lhs_signals(self):
+ return ValueSet((self._en, self._check))
+
+ def _rhs_signals(self):
+ return self.test._rhs_signals()
+
+ def __repr__(self):
+ return "(assume {!r})".format(self.test)
+
+
class Switch(Statement):
def __init__(self, test, cases):
self.test = Value.wrap(test)