migen/genlib/record: add leave_out parameter to connect
Modules doing dataflow adaptation often need to connect most of the signals between endpoints except the one concerned by the adaptation. This new parameter ease that by avoid manual connection of all signals.
This commit is contained in:
parent
5390540d3c
commit
9cabcf14e9
|
@ -128,10 +128,13 @@ class Record:
|
|||
def raw_bits(self):
|
||||
return Cat(*self.flatten())
|
||||
|
||||
def connect(self, *slaves):
|
||||
def connect(self, *slaves, leave_out=set()):
|
||||
if isinstance(leave_out, str):
|
||||
leave_out = {leave_out}
|
||||
r = []
|
||||
for f in self.layout:
|
||||
field = f[0]
|
||||
if field not in leave_out:
|
||||
self_e = getattr(self, field)
|
||||
if isinstance(self_e, Signal):
|
||||
direction = f[2]
|
||||
|
@ -143,7 +146,7 @@ class Record:
|
|||
raise TypeError
|
||||
else:
|
||||
for slave in slaves:
|
||||
r += self_e.connect(getattr(slave, field))
|
||||
r += self_e.connect(getattr(slave, field), leave_out=leave_out)
|
||||
return r
|
||||
|
||||
def connect_flat(self, *slaves):
|
||||
|
|
Loading…
Reference in New Issue