From: Luke Kenneth Casson Leighton Date: Fri, 22 Oct 2021 14:01:16 +0000 (+0100) Subject: in SimdScope only update module AST Typecast function in SIMD mode X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1411a10fcf1bc0986fe57bb23144904b67941a4f;p=ieee754fpu.git in SimdScope only update module AST Typecast function in SIMD mode do not whatever you do change the mode over to Simd casting in Scalar mode --- diff --git a/src/ieee754/part/simd_scope.py b/src/ieee754/part/simd_scope.py index da17af18..ca134918 100644 --- a/src/ieee754/part/simd_scope.py +++ b/src/ieee754/part/simd_scope.py @@ -79,12 +79,13 @@ class SimdScope: def __init__(self, *, module, elwid=None, vec_el_counts=None, elwid_type=IntElWid, scalar=False): - # must establish module as part of context and inform + # in SIMD mode, must establish module as part of context and inform # the module to operate under "SIMD" Type 1 (AST) casting rules, # not the # default "Value.cast" rules. - self.module = module - from ieee754.part.partsig import SimdSignal - module._setAstTypeCastFn(SimdSignal.cast) + if not scalar: + self.module = module + from ieee754.part.partsig import SimdSignal + module._setAstTypeCastFn(SimdSignal.cast) if isinstance(elwid, (IntElWid, FpElWid)): elwid_type = type(elwid)