+ # TODO: compensate for answer being in range 0.49999 to 1.99998
+ p = Signal(len(self.i.quotient_root), reset_less=True)
+ with m.If(self.i.quotient_root[-1]):
+ m.d.comb += p.eq(self.i.quotient_root)
+ with m.Else():
+ # get 1 bit of extra accuracy if the mantissa top bit is zero
+ m.d.comb += p.eq(self.i.quotient_root<<1)
+ m.d.comb += self.o.z.e.eq(self.i.z.e-1)
+
+ # TODO: use p here instead of quotient_root, direct.
+ # XXX what to do about remainder? shift that as well?
+ # hmm, how about concatenate remainder and quotient...