had to add fixed_width parameter temporarily to confirm that the
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 25 Oct 2021 13:28:55 +0000 (14:28 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 25 Oct 2021 13:28:55 +0000 (14:28 +0100)
minitest, test_partsig_scope.py, worked (which it did).
now can work out how to remove it

src/ieee754/part/partsig.py
src/ieee754/part/simd_scope.py
src/ieee754/part/test/test_partsig_scope.py

index 26e526aca2a6a695f91256d860f9ed18f178e7e9..61b64e661e4ff1a3e3b2d8e3896c18be923947eb 100644 (file)
@@ -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
index 057901b3c93679fcf18b1e74630ec471f5604e40..6c21d476f0f050e565e8f86cb753088899f60cf6 100644 (file)
@@ -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)
index 09aab823537d969045170461b2c7b426ba06dfd3..ba72e28bf6adbfc4538ec03b3e2f3faebe92f898 100644 (file)
@@ -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):