mindw0rk has quit [Read error: Connection reset by peer]
mindw0rk has joined #amaranth-lang
skipwich has quit [Remote host closed the connection]
skipwich has joined #amaranth-lang
xlg has joined #amaranth-lang
<xlg>
hi I am new to amaranth. How to create a signal with the shape of an interface? I found Record as a promising solution but it was removed in the latest versions.
<xlg>
by interface i mean wiring.Signature
xlg has quit [Quit: Client closed]
xlg has joined #amaranth-lang
Aiden has quit [Remote host closed the connection]
xlg has quit [Quit: Client closed]
xlg has joined #amaranth-lang
zyp[m] has joined #amaranth-lang
<zyp[m]>
an interface is not a single signal, but a collection of signals
<zyp[m]>
you can call signature.create() to create an interface, but in practice you just mostly let the Component constructor do it for you
<xlg>
how do I do then if I need to copy the data in the interface to registers? For now, I recreate the same layout of the interface as StructLayout then create a signal with that and copy the members one by one from the interface. This is tedious, error prone, difficult to refactor, etc
<zyp[m]>
you might want a struct, not an interface
<xlg>
oh, if a group of fields are the same direction in the interface, I can create a struct for them, that seems to work. I think my fault was to not use struct because I was mixing in/out signals when grouping signals into struct, and I got confused and decided to do all the interface with signature.
<xlg>
thank you
<zyp[m]>
the reason Record was deprecated was that it tried doing two different things, so it was replaced with two different mechanisms for respectively dividing a signal into subfields and making a collection of signals with directions