From: Luke Kenneth Casson Leighton Date: Sat, 16 Feb 2019 09:14:26 +0000 (+0000) Subject: create put_z function X-Git-Tag: ls180-24jan2020~1960 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4f73a467f1f3a9bd23a393ab783ca95b5b30ef3e;p=ieee754fpu.git create put_z function --- 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