genlib/record: use getattr instead of __dict__
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Sat, 23 Mar 2013 23:51:01 +0000 (00:51 +0100)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Sat, 23 Mar 2013 23:51:01 +0000 (00:51 +0100)
migen/genlib/record.py

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