From: Luke Kenneth Casson Leighton Date: Mon, 25 Oct 2021 13:28:55 +0000 (+0100) Subject: had to add fixed_width parameter temporarily to confirm that the X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fff6d9ab2de5700103e0f9c1bb9fab64233f1783;p=ieee754fpu.git had to add fixed_width parameter temporarily to confirm that the minitest, test_partsig_scope.py, worked (which it did). now can work out how to remove it --- diff --git a/src/ieee754/part/partsig.py b/src/ieee754/part/partsig.py index 26e526ac..61b64e66 100644 --- a/src/ieee754/part/partsig.py +++ b/src/ieee754/part/partsig.py @@ -144,7 +144,8 @@ class SimdSignal(UserValue): # XXX ################################################### XXX # XXX Keep these functions in the same order as ast.Value XXX # XXX ################################################### XXX - def __init__(self, mask, shape=None, *args, src_loc_at=0, **kwargs): + def __init__(self, mask, shape=None, *args, + src_loc_at=0, fixed_width=None, **kwargs): super().__init__(src_loc_at=src_loc_at) print ("SimdSignal shape", shape) # create partition points @@ -153,7 +154,7 @@ class SimdSignal(UserValue): self.ptype = ElwidPartType(self) # adapt shape to a SimdShape if not isinstance(shape, SimdShape): - shape = SimdShape(self.scope, shape) + shape = SimdShape(self.scope, shape, fixed_width=fixed_width) self._shape = shape self.sig = Signal(shape, *args, **kwargs) # get partpoints from SimdShape diff --git a/src/ieee754/part/simd_scope.py b/src/ieee754/part/simd_scope.py index 057901b3..6c21d476 100644 --- a/src/ieee754/part/simd_scope.py +++ b/src/ieee754/part/simd_scope.py @@ -101,7 +101,10 @@ class SimdScope: ################## def Signal(self, shape=None, *, name=None, reset=0, reset_less=False, - attrs=None, decoder=None, src_loc_at=0): + attrs=None, decoder=None, src_loc_at=0, + fixed_width=None): # TODO: *REMOVE* THIS. work out how. + # BE CAREFUL when using this param + # it is NOT available in scalar mode if self.scalar: # scalar mode, just return a nmigen Signal. THIS IS IMPORTANT. # when passing in SimdShape it should go "oh, this is @@ -127,7 +130,8 @@ class SimdScope: # 3) lane_shapes 4) fixed_width name=name, reset=reset, reset_less=reset_less, attrs=attrs, - decoder=decoder, src_loc_at=src_loc_at) + decoder=decoder, src_loc_at=src_loc_at, + fixed_width=fixed_width) # set the module context so that the SimdSignal can create # its own submodules during AST creation s.set_module(self.module) diff --git a/src/ieee754/part/test/test_partsig_scope.py b/src/ieee754/part/test/test_partsig_scope.py index 09aab823..ba72e28b 100644 --- a/src/ieee754/part/test/test_partsig_scope.py +++ b/src/ieee754/part/test/test_partsig_scope.py @@ -31,9 +31,11 @@ class TestCatMod(Elaboratable): def __init__(self, width, elwid, vec_el_counts): self.m = Module() with SimdScope(self.m, elwid, vec_el_counts) as s: - self.a = s.Signal(width) - self.b = s.Signal(width*2) - self.o = s.Signal(width*3) + # BE CAREFUL with the fixed_width parameter. + # it is NOT available in SimdScope.scalar mode + self.a = s.Signal(fixed_width=width) + self.b = s.Signal(fixed_width=width*2) + self.o = s.Signal(fixed_width=width*3) self.cat_out = self.o.sig def elaborate(self, platform):