From: Luke Kenneth Casson Leighton Date: Wed, 29 Sep 2021 15:48:55 +0000 (+0100) Subject: whitespace cleanup and provide warning not to use Type (2) dsl.Module nmigen X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2d1c0158f5797638c48e6060f602c7a5be631dda;p=nmigen.git whitespace cleanup and provide warning not to use Type (2) dsl.Module nmigen language constructs in overrides of Type (1) AST language constructs --- diff --git a/nmigen/hdl/ast.py b/nmigen/hdl/ast.py index 0a4d75b..9d0cbc2 100644 --- a/nmigen/hdl/ast.py +++ b/nmigen/hdl/ast.py @@ -151,20 +151,22 @@ class Value(metaclass=ABCMeta): super().__init__() self.src_loc = tracer.get_src_loc(1 + src_loc_at) + # These are redirection of "Type (1) - AST " nmigen language constructs + # If over-ridden to provide advanced behaviour, the implementation + # *MUST NOT* use "Type (2) - dsl.Module" nmigen language constructs + # (m.If, m.Else, m.Switch, m.FSM): it creates complications in dsl.Module. + def __Repl__(self, count, *, src_loc_at=0): return _InternalRepl(self, count, src_loc_at=src_loc_at) - def __Cat__(self, *args, src_loc_at=0): return _InternalCat(self, *args, src_loc_at=src_loc_at) - def __Mux__(self, val1, val0): return _InternalMux(self, val1, val0) - - def __Switch__(self, cases, *, src_loc=None, src_loc_at=0, case_src_locs={}): + def __Switch__(self, cases, *, src_loc=None, src_loc_at=0, + case_src_locs={}): return _InternalSwitch(self, cases, src_loc=src_loc, 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)