add eq_from_execute1 subset function
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 10 Apr 2020 12:34:51 +0000 (13:34 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 10 Apr 2020 12:34:51 +0000 (13:34 +0100)
src/soc/experiment/alu_hier.py

index 6d95290dd8a7ecae487a76c9f1d5125b15f3c43a..0172625817333fa225df0311b8eb0aa794ba5c43 100644 (file)
@@ -24,7 +24,8 @@ class CompALUOpSubset(Record):
     """CompALUOpSubset
 
     a copy of the relevant subset information from Decode2Execute1Type
-    needed for ALU operations.
+    needed for ALU operations.  use with eq_from_execute1 (below) to
+    grab subsets.
     """
     def __init__(self):
         layout = (('insn_type', InternalOp),
@@ -65,6 +66,15 @@ class CompALUOpSubset(Record):
         self.byte_reverse.reset_less = True
         self.sign_extend.reset_less = True
 
+    def eq_from_execute1(self, other):
+        """ use this to copy in from Decode2Execute1Type
+        """
+        res = []
+        for fname, sig in self.fields.items():
+            eqfrom = other.fields[fname]
+            res.append(sig.eq(eqfrom)
+        return res
+
     def ports(self):
         return [self.insn_type,
                 self.nia,