From 46c346c523cf0a94f3f1b3060f139058a9539fd4 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 21 Feb 2019 10:55:44 +0000 Subject: [PATCH] isolate inputs and outputs in FPGetA class --- src/add/nmigen_add_experiment.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/add/nmigen_add_experiment.py b/src/add/nmigen_add_experiment.py index f1bcabf7..2073ef69 100644 --- a/src/add/nmigen_add_experiment.py +++ b/src/add/nmigen_add_experiment.py @@ -27,6 +27,11 @@ class FPGetOpA(FPState): """ gets operand a """ + def __init__(self, in_a, width): + FPState.__init__(self, "get_a") + self.in_a = in_a + self.a = FPNumIn(in_a, width) + def action(self, m): self.get_op(m, self.in_a, self.a, "get_b") @@ -282,11 +287,9 @@ class FPADD: m = Module() # Latches - a = FPNumIn(self.in_a, self.width) b = FPNumIn(self.in_b, self.width) z = FPNumOut(self.width, False) - m.submodules.fpnum_a = a m.submodules.fpnum_b = b m.submodules.fpnum_z = z @@ -296,10 +299,12 @@ class FPADD: of = Overflow() m.submodules.overflow = of - geta = self.add_state(FPGetOpA("get_a")) - geta.set_inputs({"in_a": self.in_a}) - geta.set_outputs({"a": a}) + geta = self.add_state(FPGetOpA(self.in_a, self.width)) + #geta.set_inputs({"in_a": self.in_a}) + #geta.set_outputs({"a": a}) + a = geta.a m.d.comb += a.v.eq(self.in_a.v) # links in_a to a + m.submodules.fpnum_a = a getb = self.add_state(FPGetOpB("get_b")) getb.set_inputs({"in_b": self.in_b}) -- 2.30.2