From b50d83f14e83aae30f52aedd030e385889a50867 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sun, 7 Nov 2021 22:39:24 +0000 Subject: [PATCH] make FSMDivCoreStage properly conform to Stage API added ispec and ospec functions, no need to explicitly set self.p_i_data and self.n.o_data because that is the job of the Stage API --- src/soc/fu/div/fsm.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/soc/fu/div/fsm.py b/src/soc/fu/div/fsm.py index 1b22ca6f..cac9fd3c 100644 --- a/src/soc/fu/div/fsm.py +++ b/src/soc/fu/div/fsm.py @@ -132,17 +132,29 @@ class DivState: class FSMDivCoreStage(ControlBase): def __init__(self, pspec): - super().__init__() - self.pspec = pspec - self.p.i_data = CoreInputData(pspec) - self.n.o_data = CoreOutputData(pspec) - self.saved_input_data = CoreInputData(pspec) + self.pspec = pspec # store now: used in ispec and ospec + super().__init__(stage=self) + self.saved_input_data = self.ispec() self.empty = Signal(reset=1) self.saved_state = DivState(64, name="saved_state") self.div_state_next = DivStateNext(64) self.div_state_init = DivStateInit(64) self.divisor = Signal(unsigned(64)) + def ispec(self): + return CoreInputData(self.pspec) + + def ospec(self): + return CoreOutputData(self.pspec) + + # an extremely rare (and catastrophic) coredump in the binary executable + # known as "python 3.7" requires the addition of this function. + # no, that's not a "crash which most n00bs call an exception", being + # thrown: that's an *actual* coredump created by /usr/bin/python3.7 which + # actually segfaults if this function is not added. no idea why. + def setup(self, m, i): + pass + def elaborate(self, platform): m = super().elaborate(platform) m.submodules.div_state_next = self.div_state_next -- 2.30.2