pass in CoreState to PowerDecoder rather than eq a copy of it
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 8 Sep 2020 12:16:21 +0000 (13:16 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 8 Sep 2020 12:16:21 +0000 (13:16 +0100)
src/soc/decoder/power_decoder2.py
src/soc/simple/core.py

index b1167f85b4b2fe3961eaeb15f336698a146fac81..caf578107a6c013f5353b6be15701dc8bc8ec973 100644 (file)
@@ -599,7 +599,7 @@ class PowerDecodeSubset(Elaboratable):
     """
 
     def __init__(self, dec, opkls=None, fn_name=None, col_subset=None,
-                            final=False):
+                            final=False, state=None):
 
         self.final = final
         if dec is None:
@@ -613,8 +613,11 @@ class PowerDecodeSubset(Elaboratable):
             self.fn_name = None
         self.e = Decode2ToExecute1Type(name=self.fn_name, opkls=self.opkls)
 
-        # state information needed by the Decoder (TODO: this as a Record)
-        self.state = CoreState("dec2")
+        # state information needed by the Decoder
+        if state is not None:
+            self.state = state
+        else:
+            self.state = CoreState("dec2")
 
     def rowsubsetfn(self, opcode, row):
         return row['unit'] == self.fn_name
@@ -653,8 +656,11 @@ class PowerDecodeSubset(Elaboratable):
         if self.final:
             e = self.e
         else:
-            self.e_tmp = e = Decode2ToExecute1Type(name=self.fn_name,
-                                                   opkls=self.opkls)
+            if self.fn_name is None:
+                name = "tmp"
+            else:
+                name = self.fn_name + "tmp"
+            self.e_tmp = e = Decode2ToExecute1Type(name=name, opkls=self.opkls)
         do = e.do
 
         # set up submodule decoders
index ce207d4383199dc38197af5e9ba8e40a307bd76c..8ec18ce968b792fa9645bda671b35e69e0ec40f8 100644 (file)
@@ -107,7 +107,8 @@ class NonProductionCore(Elaboratable):
                 self.trapunit = funame
                 continue
             self.decoders[funame] = PowerDecodeSubset(None, opkls, f_name,
-                                                      final=True)
+                                                      final=True,
+                                                      state=self.state)
             self.ees[funame] = self.decoders[funame].e
 
     def elaborate(self, platform):
@@ -125,7 +126,6 @@ class NonProductionCore(Elaboratable):
             setattr(m.submodules, "dec_%s" % v.fn_name, v)
             comb += v.dec.raw_opcode_in.eq(self.raw_insn_i)
             comb += v.dec.bigendian.eq(self.bigendian_i)
-            comb += v.state.eq(self.state)
 
         # ssh, cheat: trap uses the main decoder because of the rewriting
         self.ees[self.trapunit] = self.e