From: Luke Kenneth Casson Leighton Date: Thu, 21 Feb 2019 10:08:37 +0000 (+0000) Subject: move rounding to separate class X-Git-Tag: ls180-24jan2020~1846 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c9601b52ffa461d1eb6636d6d55e595733eef38d;p=ieee754fpu.git move rounding to separate class --- diff --git a/src/add/nmigen_add_experiment.py b/src/add/nmigen_add_experiment.py index 5c6086b0..0fa305ed 100644 --- a/src/add/nmigen_add_experiment.py +++ b/src/add/nmigen_add_experiment.py @@ -233,6 +233,12 @@ class FPNorm2(FPState): self.normalise_2(m, self.z, self.of, "round") +class FPRound(FPState): + + def action(self, m): + self.roundz(m, self.z, self.of, "corrections") + + class FPADD(FPBase): def __init__(self, width, single_cycle=False): @@ -305,6 +311,10 @@ class FPADD(FPBase): n2.set_inputs({"z": z, "of": of}) # XXX Z as output n2.set_outputs({"z": z}) # XXX Z as output + rn = FPRound("corrections") + rn.set_inputs({"z": z, "of": of}) # XXX Z as output + rn.set_outputs({"z": z}) # XXX Z as output + with m.FSM() as fsm: # ****** @@ -371,7 +381,7 @@ class FPADD(FPBase): # rounding stage with m.State("round"): - self.roundz(m, z, of, "corrections") + rn.action(m) # ****** # correction stage