From: Luke Kenneth Casson Leighton Date: Fri, 22 Mar 2019 10:39:13 +0000 (+0000) Subject: create StageChain from Align/Add0/Add1 X-Git-Tag: ls180-24jan2020~1530 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5f3aa904601537386de5c0b7c991a9c99c516faf;p=ieee754fpu.git create StageChain from Align/Add0/Add1 --- diff --git a/src/add/nmigen_add_experiment.py b/src/add/nmigen_add_experiment.py index dd7b43d4..349b2784 100644 --- a/src/add/nmigen_add_experiment.py +++ b/src/add/nmigen_add_experiment.py @@ -607,6 +607,9 @@ class FPAddAlignSingleMod: def ospec(self): return FPNumIn2Ops(self.width, self.id_wid) + def process(self, i): + return self.o + def setup(self, m, i): """ links module to inputs and outputs """ @@ -719,20 +722,16 @@ class FPAddAlignSingleAdd(FPState): def setup(self, m, i): """ links module to inputs and outputs """ - mod = FPAddAlignSingleMod(self.width, self.id_wid) - mod.setup(m, i) - o = mod.ospec() - m.d.comb += o.eq(mod.o) + # chain AddAlignSingle, AddStage0 and AddStage1 + mod = FPAddAlignSingleMod(self.width, self.id_wid) a0mod = FPAddStage0Mod(self.width, self.id_wid) - a0mod.setup(m, o) - a0o = a0mod.ospec() - m.d.comb += a0o.eq(a0mod.o) - a1mod = FPAddStage1Mod(self.width, self.id_wid) - a1mod.setup(m, a0o) self.a1modo = a1mod.o + chain = StageChain([mod, a0mod, a1mod]) + chain.setup(m, i) + m.d.sync += self.a1o.eq(self.a1modo) def action(self, m): @@ -764,6 +763,9 @@ class FPAddStage0Mod: def ospec(self): return FPAddStage0Data(self.width, self.id_wid) + def process(self, i): + return self.o + def setup(self, m, i): """ links module to inputs and outputs """ @@ -862,6 +864,9 @@ class FPAddStage1Mod(FPState): def ospec(self): return FPAddStage1Data(self.width, self.id_wid) + def process(self, i): + return self.o + def setup(self, m, i): """ links module to inputs and outputs """