From 2f0836f278bf982f5c7c29ed13357e37f7888fef Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Wed, 20 Oct 2021 14:39:18 +0100 Subject: [PATCH] realised that the new dsl.Module AST Type class should be a (static) function not a class in which there is expected to be a function named "cast" --- nmigen/hdl/dsl.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nmigen/hdl/dsl.py b/nmigen/hdl/dsl.py index 982b3a5..09fa92a 100644 --- a/nmigen/hdl/dsl.py +++ b/nmigen/hdl/dsl.py @@ -163,7 +163,7 @@ class Module(_ModuleBuilderRoot, Elaboratable): raise SyntaxError("Instead of inheriting from `Module`, inherit from `Elaboratable` " "and return a `Module` from the `elaborate(self, platform)` method") - def __init__(self, _astType=None): + def __init__(self, _astTypeFn=None): _ModuleBuilderRoot.__init__(self, self, depth=0) self.submodules = _ModuleBuilderSubmodules(self) self.domains = _ModuleBuilderDomainSet(self) @@ -181,7 +181,7 @@ class Module(_ModuleBuilderRoot, Elaboratable): # to complete the Type 1 (ast.*) nmigen language construct abstraction # from Type 2 (Module - this class) Module must be told what AST type # it may cast m.If/Elif conditions and m.Switch - self._astType = _astType or Value + self._astTypeCast = _astTypeFn or Value.cast def _check_context(self, construct, context): if self._ctrl_context != context: @@ -214,7 +214,7 @@ class Module(_ModuleBuilderRoot, Elaboratable): return data def _check_signed_cond(self, cond): - cond = self._astType.cast(cond) + cond = self._astTypeCast(cond) width, signed = cond.shape() if signed: warnings.warn("Signed values in If/Elif conditions usually result from inverting " @@ -295,7 +295,7 @@ class Module(_ModuleBuilderRoot, Elaboratable): def Switch(self, test): self._check_context("Switch", context=None) switch_data = self._set_ctrl("Switch", { - "test": self._astType.cast(test), + "test": self._astTypeCast(test), "cases": OrderedDict(), "src_loc": tracer.get_src_loc(src_loc_at=1), "case_src_locs": {}, -- 2.30.2