From 243ee0ba3850621d9cbb5d9f70ff1dfee04cad87 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 21 Feb 2019 09:10:07 +0000 Subject: [PATCH] create separate denormalisation class --- src/add/nmigen_add_experiment.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/add/nmigen_add_experiment.py b/src/add/nmigen_add_experiment.py index 4505269b..8c08652f 100644 --- a/src/add/nmigen_add_experiment.py +++ b/src/add/nmigen_add_experiment.py @@ -111,6 +111,15 @@ class FPAddSpecialCases(FPState): m.next = "denormalise" +class FPAddDeNorm(FPState): + + def action(self, m): + # Denormalised Number checks + m.next = "align" + self.denormalise(m, self.a) + self.denormalise(m, self.b) + + class FPADD(FPBase): def __init__(self, width, single_cycle=False): @@ -156,6 +165,10 @@ class FPADD(FPBase): sc.set_inputs({"a": a, "b": b}) sc.set_outputs({"z": z}) + dn = FPAddDeNorm("denormalise") + dn.set_inputs({"a": a, "b": b}) + dn.set_outputs({"a": a, "b": b}) # XXX outputs same as inputs + with m.FSM() as fsm: # ****** @@ -183,10 +196,7 @@ class FPADD(FPBase): # denormalise. with m.State("denormalise"): - # Denormalised Number checks - m.next = "align" - self.denormalise(m, a) - self.denormalise(m, b) + dn.action(m) # ****** # align. -- 2.30.2