Skip to content

Adding Shapes gives counterintuitive results #421

@awygle

Description

@awygle

Shapes implement __add__, but adding them is currently not useful:

>>> from nmigen import *
>>> x = Signal(16)
>>> y = Signal(32)
>>> s = x.shape() + y.shape()
>>> s
(16, False, 32, False)

The expected result here (I argue) would be (48, False), but (probably because Shape is a named tuple under the hood) we get the not-very-useful result shown above.

Obviously in this case you can do (x+y).shape() but that's not always easy or possible (I hit a particular case involving an Enum)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions