From: Luke Kenneth Casson Leighton Date: Sat, 30 Oct 2021 10:35:07 +0000 (+0100) Subject: add SimdScope.__call__ function needed to copy and adapt scope X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=985e52b0cd2764734f5b3781a1236af45086d61d;p=ieee754fpu.git add SimdScope.__call__ function needed to copy and adapt scope --- diff --git a/src/ieee754/part/simd_scope.py b/src/ieee754/part/simd_scope.py index 680fea32..2f7e264d 100644 --- a/src/ieee754/part/simd_scope.py +++ b/src/ieee754/part/simd_scope.py @@ -66,6 +66,19 @@ class SimdScope: if module is not None: module._setAstTypeCastFn(SimdSignal.cast) + def __call__(self, module=None, elwid=None): + """use as: newscope = scope(newmodule) or with scope(m) as newscope + allows for scope to be established and carry parameters then + later copied and used inside an Elaboratable. a new elwid + can be specified so that pipelines can carry properly sync'd + elwid signals + """ + if elwid is None: + elwid = self.elwid + if module is None: + module = self.module + return SimdScope(module, elwid, self.vec_el_counts, self.scalar) + def __repr__(self): return (f"SimdScope(\n" f" elwid={self.elwid},\n"