From: Luke Kenneth Casson Leighton Date: Sat, 2 Mar 2019 11:18:56 +0000 (+0000) Subject: reorg FPRound move setup function X-Git-Tag: ls180-24jan2020~1771 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e93d491f1aea8c0adea47f4cc51c162dfc0a7f77;p=ieee754fpu.git reorg FPRound move setup function --- 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