-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Registering product types #1215
Comments
We should add an error for this, but m.Register expects an undirected type, so here's a version that slightly changes it by having SetParams be undirected and qualifying it both ways in the IO.
the second problem is you were using |
How would you recommend handling registering in compound product types. For example, consider an axi stream interface with two outputs and an input. Having them defined as directed makes it conveneint to group and provide flipped versions (or at least, that's the way I was using it). Sometimes, it may be necessary to register inputs, outputs, or both. Is there a way to do this? class axisMaster(m.Product):
tdata = m.Out(m.UInt[32])
tvalid = m.Out(m.Bit)
tready = m.In(m.Bit)
class ThreshStim(m.Circuit):
io = m.IO(
out=axisMaster,
in=m.Flip(axisMaster)
)
# Register all inputs, outputs, or both I could think of breaking up the interface to input and output product types, and it seems that it would work. Though, I was wondering if there is a more concise way of doing this? class Data(m.Product):
tdata = m.UInt[32]
tvalid = m.Bit
class Ready(m.Product):
tready = m.In(m.Bit)
class AxisM(m.Product):
out = m.Out(Data)
in = m.In(Ready)
class ThreshStim(m.Circuit):
io = m.IO(
out=axisM,
in=m.Flip(axisM)
)
# Registers for 'data', 'ready', or both product types |
Breaking it up would work but is quite tedious. I'll have to think of a good way to do this. One option would be have a helper that returns an anonymous handle to the register values (basically walks the type, for each input, register and return reg.I, for each output, register and return reg.O). @rsetaluri any ideas on this pattern? |
Hi @leonardt, following up on this discussion. Is it possible to register just the inputs, outputs, or both of product types with directions? |
How can one 'register' all members of a product type in a single expression? Here, I am showing a product type with uniformly sized fields, but the same question could apply for non-uniform fields.
Also tried this with Array (will not be applicable for a general product type)
but the output of compile was this:
A use case I had in mind was for registering all inputs and / or outputs of a circuit.
The text was updated successfully, but these errors were encountered: