self.is_overflowed = Signal(reset_less=True)
self.is_denormalised = Signal(reset_less=True)
self.exp_128 = Signal(reset_less=True)
+ self.exp_sub_n126 = Signal((e_width, True), reset_less=True)
self.exp_lt_n126 = Signal(reset_less=True)
self.exp_gt_n126 = Signal(reset_less=True)
self.exp_gt127 = Signal(reset_less=True)
m.d.comb += self.is_overflowed.eq(self._is_overflowed())
m.d.comb += self.is_denormalised.eq(self._is_denormalised())
m.d.comb += self.exp_128.eq(self.e == self.P128)
- m.d.comb += self.exp_gt_n126.eq(self.e > self.N126)
- m.d.comb += self.exp_lt_n126.eq(self.e < self.N126)
+ m.d.comb += self.exp_sub_n126.eq(self.e - self.N126)
+ m.d.comb += self.exp_gt_n126.eq(self.exp_sub_n126 > 0)
+ m.d.comb += self.exp_lt_n126.eq(self.exp_sub_n126 < 0)
m.d.comb += self.exp_gt127.eq(self.e > self.P127)
m.d.comb += self.exp_n127.eq(self.e == self.N127)
m.d.comb += self.exp_n126.eq(self.e == self.N126)
clz = Signal((len(in_z.e), True), reset_less=True)
# make sure that the amount to decrease by does NOT
# go below the minimum non-INF/NaN exponent
- limclz = Mux(in_z.e - pe.o - in_z.N126 > 0, pe.o,
- in_z.e - in_z.N126)
+ limclz = Mux(in_z.exp_sub_n126 > pe.o, pe.o,
+ in_z.exp_sub_n126)
m.d.comb += [
# cat round and guard bits back into the mantissa
temp_m.eq(Cat(in_of.round_bit,