"Shape", "signed", "unsigned",
"Value", "Const", "C", "AnyConst", "AnySeq", "Operator", "Mux", "Part", "Slice", "Cat", "Repl",
"Array", "ArrayProxy",
- "_InternalSwitch",
+ "_InternalSwitch", "_InternalAssign",
"Signal", "ClockSignal", "ResetSignal",
"UserValue", "ValueCastable",
"Sample", "Past", "Stable", "Rose", "Fell", "Initial",
src_loc_at=src_loc_at,
case_src_locs=case_src_locs)
+ def __Assign__(self, rhs, *, src_loc_at=0):
+ return _InternalAssign(self, rhs, src_loc_at=src_loc_at)
+
def __bool__(self):
raise TypeError("Attempted to convert nMigen value to Python boolean")
@final
-class Assign(Statement):
+def Assign(lhs, rhs, *, src_loc_at=0):
+ return lhs.__Assign__(rhs, src_loc_at=src_loc_at)
+
+
+class _InternalAssign(Statement):
def __init__(self, lhs, rhs, *, src_loc_at=0):
super().__init__(src_loc_at=src_loc_at)
self.lhs = Value.cast(lhs)
self._pop_ctrl()
for stmt in Statement.cast(assigns):
- if not compat_mode and not isinstance(stmt, (Assign, Assert, Assume, Cover)):
+ if not compat_mode and not isinstance(stmt, (_InternalAssign, Assert, Assume, Cover)):
raise SyntaxError(
"Only assignments and property checks may be appended to d.{}"
.format(domain_name(domain)))
return True
def on_statement(self, stmt):
- if type(stmt) is Assign:
+ if type(stmt) is _InternalAssign:
new_stmt = self.on_Assign(stmt)
elif type(stmt) is Assert:
new_stmt = self.on_Assert(stmt)