From 837eb8705ae953db5f5aa0ab3ad22967e14704c6 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Tue, 8 Sep 2020 13:16:21 +0100 Subject: [PATCH] pass in CoreState to PowerDecoder rather than eq a copy of it --- src/soc/decoder/power_decoder2.py | 16 +++++++++++----- src/soc/simple/core.py | 4 ++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/soc/decoder/power_decoder2.py b/src/soc/decoder/power_decoder2.py index b1167f85..caf57810 100644 --- a/src/soc/decoder/power_decoder2.py +++ b/src/soc/decoder/power_decoder2.py @@ -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 diff --git a/src/soc/simple/core.py b/src/soc/simple/core.py index ce207d43..8ec18ce9 100644 --- a/src/soc/simple/core.py +++ b/src/soc/simple/core.py @@ -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 -- 2.30.2