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
Consider slice as signal in Record initialization #402
Comments
That patch wouldn't work; even disregarding any language design concerns, a More to your point, can you describe in detail what are you trying to do? It is not clear to me that your solution is a good one for the problem you're experiencing. |
I'm trying to resize an AXI bus: def resize_axi(axi, data_w=None, addr_w=None, id_w=None):
layout = []
fields = {}
for field in axi.fields:
width = len(axi[field])
if data_w is not None and 'DATA' in field:
width = data_w
if addr_w is not None and 'ADDR' in field:
width = addr_w
if id_w is not None and 'ID' in field and 'VALID' not in field:
width = id_w
layout.append((field, width))
fields[field] = axi[field][:width]
return Record(layout, fields=fields, name=axi.name + '_resized') Is there any other way to do that without comb assignments? I haven't the module object in the scope. |
Ah right so this is actually indicative of a fairly serious problem in nMigen, which is that our unit of abstraction is an For now I suggest you pass the module object around; I'm aware that what you're trying to do is currently pretty painful, I don't have a good solution yet, but it's something I consider important to fix in a nice way. |
Thank you for your answer. Let me know if i can help. For solving this i'm going to create an AxiResizer elaboratable. I think that it is better than passing module object. |
Not yet, there are much more pressing design issues. We'll get to it eventually.
Also an excellent solution if you are OK with the overhead of an elaboratable. That's what nmigen-soc currently does. |
Hi,
I'm trying to generate a Record from sliced signals (i'm trying to resize a bus) and record fields must be records or signals.
Example code:
Error:
Maybe changing ithe following line is enough to support this feature
Thank you.
The text was updated successfully, but these errors were encountered: