From 80faa8e2714b5417b40db99294bec8710bb8ec17 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Tue, 5 Mar 2019 02:28:48 +0000 Subject: [PATCH] add id to FPRound --- src/add/nmigen_add_experiment.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/add/nmigen_add_experiment.py b/src/add/nmigen_add_experiment.py index e63eecf2..a0707a27 100644 --- a/src/add/nmigen_add_experiment.py +++ b/src/add/nmigen_add_experiment.py @@ -841,22 +841,26 @@ class FPRoundMod: return m -class FPRound(FPState): +class FPRound(FPState, FPID): - def __init__(self, width): + def __init__(self, width, id_wid): FPState.__init__(self, "round") + FPID.__init__(self, id_wid) self.mod = FPRoundMod(width) self.out_z = FPNumBase(width) - def setup(self, m, in_z, roundz): + def setup(self, m, in_z, roundz, in_mid): """ 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.mod.in_roundz.eq(roundz) + if self.in_mid: + m.d.comb += self.in_mid.eq(in_mid) def action(self, m): + self.idsync(m) m.d.sync += self.out_z.copy(self.mod.out_z) m.next = "corrections" @@ -1010,8 +1014,8 @@ class FPADD(FPID): n1 = self.add_state(FPNorm1(self.width, self.id_wid)) n1.setup(m, add1.out_z, add1.out_of, add1.norm_stb, add0.in_mid) - rn = self.add_state(FPRound(self.width)) - rn.setup(m, n1.out_z, n1.out_roundz) + rn = self.add_state(FPRound(self.width, self.id_wid)) + rn.setup(m, n1.out_z, n1.out_roundz, n1.in_mid) cor = self.add_state(FPCorrections(self.width)) cor.setup(m, rn.out_z) -- 2.30.2