Commit 3c1dada9 authored by Sebastien Bourdeauducq's avatar Sebastien Bourdeauducq
Browse files

record: compatibility check

parent 588f1a25
......@@ -19,7 +19,7 @@ class Record:
def template(self):
l = []
for key in self.__dict__:
for key in sorted(self.__dict__):
e = self.__dict__[key]
if isinstance(e, Signal):
l.append((key, e.bv))
......@@ -59,6 +59,11 @@ class Record:
return l
return Record(dict_to_list(fields), "subrecord")
def compatible(self, other):
tpl1 = self.template()
tpl2 = other.template()
return tpl1 == tpl2
def flatten(self):
l = []
for key in sorted(self.__dict__):
......
......@@ -22,6 +22,9 @@ class BV:
r += "s"
r += "d"
return r
def __eq__(self, other):
return self.width == other.width and self.signed == other.signed
class Value:
def __invert__(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment