[Libre-soc-dev] SimdSignal scalar/vector switching and SimdShape.width

lkcl luke.leighton at gmail.com
Thu Oct 28 11:45:57 BST 2021


(not committed) - does this look right?  something that's
signed creates a result that's signed, regardless of whether
the sign comes from LHS or RHS, is that reasonable?

diff --git a/src/ieee754/part/partsig.py b/src/ieee754/part/partsig.py
index d3548f2..9b4de6a 100644
--- a/src/ieee754/part/partsig.py
+++ b/src/ieee754/part/partsig.py
@@ -202,11 +202,12 @@ class SimdShape(Shape):
         Shape.__init__(self, fixed_width, signed)

     def __mul__(self, other):
+        signed = self.signed or other.signed # XXX is this right?
         if isinstance(other, int):
             lane_shapes = {k: v * other for k, v in self.lane_shapes}
             # XXX not correct, we need a width-hint, not an overwrite
             # lane_shapes argument...
-            return SimdShape(self.scope, lane_shapes, signed=self.signed,
+            return SimdShape(self.scope, lane_shapes, signed=signed,
                              fixed_width=self.width * other)



More information about the Libre-soc-dev mailing list