From 5f3aa904601537386de5c0b7c991a9c99c516faf Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 22 Mar 2019 10:39:13 +0000 Subject: [PATCH] create StageChain from Align/Add0/Add1 --- src/add/nmigen_add_experiment.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) 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 """ -- 2.30.2