genlib/record: add eq

This commit is contained in:
Sebastien Bourdeauducq 2013-03-24 00:50:33 +01:00
parent 9d7c679b8c
commit 1897b74f97
1 changed files with 4 additions and 0 deletions

View File

@ -27,6 +27,10 @@ class Record:
setattr(self, f, Signal(1, prefix + f)) setattr(self, f, Signal(1, prefix + f))
self.field_order.append((f, 1)) 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): def layout(self):
l = [] l = []
for key, alignment in self.field_order: for key, alignment in self.field_order: