Revert "genlib/record/connect: add match_by_position"

This reverts commit df1ed32765.
This commit is contained in:
Sebastien Bourdeauducq 2013-05-10 17:41:51 +02:00
parent c82b53f1cd
commit 955a9733c8
1 changed files with 5 additions and 11 deletions

View File

@ -96,11 +96,7 @@ class Record:
def raw_bits(self): def raw_bits(self):
return Cat(*self.flatten()) return Cat(*self.flatten())
def connect(self, *slaves, match_by_position=False): def connect(self, *slaves):
if match_by_position:
iters = [iter(slave.layout) for slave in slaves]
else:
iters = [iter(self.layout) for slave in slaves]
r = [] r = []
for f in self.layout: for f in self.layout:
field = f[0] field = f[0]
@ -108,16 +104,14 @@ class Record:
if isinstance(self_e, Signal): if isinstance(self_e, Signal):
direction = f[2] direction = f[2]
if direction == DIR_M_TO_S: if direction == DIR_M_TO_S:
r += [getattr(slave, next(it)[0]).eq(self_e) for slave, it in zip(slaves, iters)] r += [getattr(slave, field).eq(self_e) for slave in slaves]
elif direction == DIR_S_TO_M: elif direction == DIR_S_TO_M:
r.append(self_e.eq(optree("|", [getattr(slave, next(it)[0]) r.append(self_e.eq(optree("|", [getattr(slave, field) for slave in slaves])))
for slave, it in zip(slaves, iters)])))
else: else:
raise TypeError raise TypeError
else: else:
for slave, it in zip(slaves, iters): for slave in slaves:
r += self_e.connect(getattr(slave, next(it)[0]), r += self_e.connect(getattr(slave, field))
match_by_position=match_by_position)
return r return r
def __len__(self): def __len__(self):