If a record contains records, calling ports on it will give a result
that cannot be passed to the nmigen simulation backend. This flattens
it, so that ports() will just return signals
yield x
def ports(self): # would be better being called "keys"
- return list(self)
+ results = []
+ # If the record itself contains records, flatten them
+ for item in list(self):
+ ports_fun = getattr(item, "ports", None)
+ if callable(ports_fun):
+ results.extend(ports_fun())
+ else:
+ results.append(item)
+ return results
class PrevControl(Elaboratable):