genlib/record: use getattr instead of __dict__

This commit is contained in:
Sebastien Bourdeauducq 2013-03-24 00:51:01 +01:00
parent 1897b74f97
commit 3da98ea04d

View file

@ -34,7 +34,7 @@ class Record:
def layout(self): def layout(self):
l = [] l = []
for key, alignment in self.field_order: for key, alignment in self.field_order:
e = self.__dict__[key] e = getattr(self, key)
if isinstance(e, Signal): if isinstance(e, Signal):
l.append((key, (e.nbits, e.signed), alignment)) l.append((key, (e.nbits, e.signed), alignment))
elif isinstance(e, Record): elif isinstance(e, Record):
@ -84,7 +84,7 @@ class Record:
l.append(Replicate(0, pad_size)) l.append(Replicate(0, pad_size))
offset += pad_size offset += pad_size
e = self.__dict__[key] e = getattr(self, key)
if isinstance(e, Signal): if isinstance(e, Signal):
added = [e] added = [e]
elif isinstance(e, Record): elif isinstance(e, Record):