From b3829ddc6d2a352d02d068351a361b39e1410c8b Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sun, 25 Aug 2019 11:46:25 +0100 Subject: [PATCH] remove use of out_do_z in add align --- src/ieee754/fpadd/align.py | 63 +++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/src/ieee754/fpadd/align.py b/src/ieee754/fpadd/align.py index 0e2ad119..16f6da39 100644 --- a/src/ieee754/fpadd/align.py +++ b/src/ieee754/fpadd/align.py @@ -85,38 +85,37 @@ class FPAddAlignSingleMod(PipeModBase): elz = Signal(reset_less=True) egz = Signal(reset_less=True) - with m.If(~self.i.out_do_z): - # connect multi-shifter to t_inp/out mantissa (and tdiff) - # (only one: input/output is muxed) - comb += msr.inp.eq(t_inp.m) - comb += msr.diff.eq(tdiff) - comb += t_out.m.eq(msr.m) - comb += t_out.e.eq(t_inp.e + tdiff) - comb += t_out.s.eq(t_inp.s) - - comb += ediff.eq(self.i.a.e - self.i.b.e) # a - b - comb += ediffr.eq(-ediff) # b - a - comb += elz.eq(self.i.a.e < self.i.b.e) # ae < be - comb += egz.eq(self.i.a.e > self.i.b.e) # ae > be - - # default: A-exp == B-exp, A and B untouched (fall through) - comb += self.o.a.eq(self.i.a) - comb += self.o.b.eq(self.i.b) - - # exponent of a greater than b: shift b down - with m.If(egz): - comb += [t_inp.eq(self.i.b), - tdiff.eq(ediff), - self.o.b.eq(t_out), - self.o.b.s.eq(self.i.b.s), # whoops forgot sign - ] - # exponent of b greater than a: shift a down - with m.Elif(elz): - comb += [t_inp.eq(self.i.a), - tdiff.eq(ediffr), - self.o.a.eq(t_out), - self.o.a.s.eq(self.i.a.s), # whoops forgot sign - ] + # connect multi-shifter to t_inp/out mantissa (and tdiff) + # (only one: input/output is muxed) + comb += msr.inp.eq(t_inp.m) + comb += msr.diff.eq(tdiff) + comb += t_out.m.eq(msr.m) + comb += t_out.e.eq(t_inp.e + tdiff) + comb += t_out.s.eq(t_inp.s) + + comb += ediff.eq(self.i.a.e - self.i.b.e) # a - b + comb += ediffr.eq(-ediff) # b - a + comb += elz.eq(self.i.a.e < self.i.b.e) # ae < be + comb += egz.eq(self.i.a.e > self.i.b.e) # ae > be + + # default: A-exp == B-exp, A and B untouched (fall through) + comb += self.o.a.eq(self.i.a) + comb += self.o.b.eq(self.i.b) + + # exponent of a greater than b: shift b down + with m.If(egz): + comb += [t_inp.eq(self.i.b), + tdiff.eq(ediff), + self.o.b.eq(t_out), + self.o.b.s.eq(self.i.b.s), # whoops forgot sign + ] + # exponent of b greater than a: shift a down + with m.Elif(elz): + comb += [t_inp.eq(self.i.a), + tdiff.eq(ediffr), + self.o.a.eq(t_out), + self.o.a.s.eq(self.i.a.s), # whoops forgot sign + ] comb += self.o.ctx.eq(self.i.ctx) comb += self.o.z.eq(self.i.z) -- 2.30.2