From 4f73a467f1f3a9bd23a393ab783ca95b5b30ef3e Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sat, 16 Feb 2019 09:14:26 +0000 Subject: [PATCH] create put_z function --- src/add/nmigen_add_experiment.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/add/nmigen_add_experiment.py b/src/add/nmigen_add_experiment.py index 435fc252..a6180950 100644 --- a/src/add/nmigen_add_experiment.py +++ b/src/add/nmigen_add_experiment.py @@ -177,6 +177,15 @@ class FPADD: with m.Else(): m.d.sync += z.create(z.s, z.e, z.m) + def put_z(self, m, z, out_z, next_state): + m.d.sync += [ + out_z.stb.eq(1), + out_z.v.eq(z.v) + ] + with m.If(out_z.stb & out_z.ack): + m.d.sync += out_z.stb.eq(0) + m.next = next_state + def get_fragment(self, platform=None): m = Module() @@ -371,13 +380,7 @@ class FPADD: # put_z stage with m.State("put_z"): - m.d.sync += [ - self.out_z.stb.eq(1), - self.out_z.v.eq(z.v) - ] - with m.If(self.out_z.stb & self.out_z.ack): - m.d.sync += self.out_z.stb.eq(0) - m.next = "get_a" + self.put_z(m, z, self.out_z, "get_a") return m -- 2.30.2