# identify if the lane_shapes is a mapping (dict, etc.)
# if not, then assume that it is an integer (width) that
- # needs to be requested across all partitions
+ # needs to be requested across all partitions.
+ # Note: back in SimdScope.Shape(), this is how code that was
+ # formerly scalar can be "converted" to "look like" it is
+ # still scalar, by not altering the width at any of the elwids.
if not isinstance(lane_shapes, Mapping):
lane_shapes = {i: lane_shapes for i in vec_el_counts}
# simd mode.
# XXX TODO
- def Shape(self): pass
- #if self.scalar:
+ def Shape(self, width=1, signed=False):
+ if self.scalar:
# scalar mode, just return nmigen Shape. THIS IS IMPORTANT.
- # else
- # simd mode.
+ return Shape(width, signed)
+ else:
+ # SIMD mode. NOTE: for compatibility with Shape, the width
+ # is assumed to be the widths_at_elwid parameter NOT the
+ # fixed width. this ensures that code that is converted
+ # straight from scalar to SIMD will have the exact same
+ # width at all elwidths, because layout() detects the integer
+ # case and converts it, preserving the width at all elwidths
+ return SimdShape(self, width=None, signed=signed,
+ widths_at_elwid=width)