amaranth icon indicating copy to clipboard operation
amaranth copied to clipboard

`stream.Signature` should allow setting the init value for the payload

Open whitequark opened this issue 1 year ago • 4 comments

This for example does not work:

class BitSerializer(wiring.Component):
    def __init__(self, *, width, length):
        self._length = length

        super().__init__({
            "shift": In(1),
            "stream": In(stream.Signature(data.StructLayout({
                "o":  data.ArrayLayout(width, length),
                "oe": 1
            })), init={"payload": {"oe": 1}}),
            "buffer": Out(io.FFBuffer.Signature("o", width)),
        })

but could be valuable for the same reason io.Buffer.Signature's oe member has init=1.

whitequark avatar Jun 17 '24 13:06 whitequark

doing it with the proposed syntax is not possible with current lib.wiring (a member of signature type with init will be rejected)

what do you think about stream.Signature(..., payload_init={"oe": 1}) instead?

wanda-phi avatar Jun 18 '24 17:06 wanda-phi

doing it with the proposed syntax is not possible with current lib.wiring (a member of signature type with init will be rejected)

what do you think about stream.Signature(..., payload_init={"oe": 1}) instead?

Yeah, I was thinking of just init= since it would not make any sense to have ready/valid have init IMO.

whitequark avatar Jun 19 '24 00:06 whitequark

Let's bikeshed payload_init= vs init= on the next meeting.

whitequark avatar Jun 29 '24 12:06 whitequark

We have discussed this issue on the 2024-07-01 weekly meeting. We have decided to go with payload_init=.

whitequark avatar Jul 01 '24 18:07 whitequark