From 985e52b0cd2764734f5b3781a1236af45086d61d Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sat, 30 Oct 2021 11:35:07 +0100 Subject: [PATCH] add SimdScope.__call__ function needed to copy and adapt scope --- src/ieee754/part/simd_scope.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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" -- 2.30.2