From e93d491f1aea8c0adea47f4cc51c162dfc0a7f77 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sat, 2 Mar 2019 11:18:56 +0000 Subject: [PATCH] reorg FPRound move setup function --- src/add/nmigen_add_experiment.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/add/nmigen_add_experiment.py b/src/add/nmigen_add_experiment.py index b69c7025..9dfd1585 100644 --- a/src/add/nmigen_add_experiment.py +++ b/src/add/nmigen_add_experiment.py @@ -656,13 +656,6 @@ class FPRoundMod: self.in_z = FPNumBase(width, False) self.out_z = FPNumBase(width, False) - def setup(self, m, in_z, out_z, in_of): - """ links module to inputs and outputs - """ - m.d.comb += self.in_z.copy(in_z) - m.d.comb += out_z.copy(self.out_z) - m.d.comb += self.in_roundz.eq(in_of.roundz) - def elaborate(self, platform): m = Module() m.d.comb += self.out_z.copy(self.in_z) @@ -680,6 +673,15 @@ class FPRound(FPState): self.mod = FPRoundMod(width) self.out_z = FPNumBase(width) + def setup(self, m, in_z, in_of): + """ links module to inputs and outputs + """ + m.submodules.roundz = self.mod + + m.d.comb += self.mod.in_z.copy(in_z) + m.d.comb += self.out_z.copy(self.mod.out_z) + m.d.comb += self.mod.in_roundz.eq(in_of.roundz) + def action(self, m): m.d.sync += self.z.copy(self.out_z) m.next = "corrections" @@ -846,8 +848,7 @@ class FPADD: rn = self.add_state(FPRound(self.width)) rn.set_inputs({"of": n1.out_of}) rn.set_outputs({"z": rnz}) - rn.mod.setup(m, n1.out_z, rn.out_z, add1.out_of) - m.submodules.roundz = rn.mod + rn.setup(m, n1.out_z, add1.out_of) cor = self.add_state(FPCorrections(self.width)) cor.set_inputs({"z": rnz}) # XXX Z as output -- 2.30.2