genlib/record: add eq
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Sat, 23 Mar 2013 23:50:33 +0000 (00:50 +0100)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Sat, 23 Mar 2013 23:50:33 +0000 (00:50 +0100)
migen/genlib/record.py

index 74bd8303513c59361f8a1ac2d1403f65b10bba0c..9ead8daa4dfc8ccb11f135aaa6f727ca71a0810d 100644 (file)
@@ -27,6 +27,10 @@ class Record:
                                setattr(self, f, Signal(1, prefix + f))
                                self.field_order.append((f, 1))
 
+       def eq(self, other):
+               return [getattr(self, key).eq(getattr(other, key))
+                 for key, a in self.field_order]
+
        def layout(self):
                l = []
                for key, alignment in self.field_order: