m.d.sync += z.nan(1)
# if a is Inf and b is Inf return NaN
- with m.Elif(a.is_inf() | b.is_inf()):
+ with m.Elif(a.is_inf() & b.is_inf()):
m.next = "put_z"
m.d.sync += z.nan(1)
# if a is inf return inf (or NaN if b is zero)
with m.Elif(a.is_inf()):
m.next = "put_z"
- # if b is zero return NaN
- with m.If(b.is_zero()):
- m.d.sync += z.nan(1)
- with m.Else():
- m.d.sync += z.inf(a.s ^ b.s)
+ m.d.sync += z.inf(a.s ^ b.s)
# if b is inf return zero
with m.Elif(b.is_inf()):
m.next = "put_z"
m.d.sync += z.zero(a.s ^ b.s)
- # if a is inf return zero (or NaN if b is zero)
- with m.Elif(a.is_inf()):
+ # if a is zero return zero (or NaN if b is zero)
+ with m.Elif(a.is_zero()):
m.next = "put_z"
# if b is zero return NaN
with m.If(b.is_zero()):
m.d.sync += z.nan(1)
with m.Else():
- m.d.sync += z.inf(a.s ^ b.s)
+ m.d.sync += z.zero(a.s ^ b.s)
# if b is zero return Inf
with m.Elif(b.is_zero()):
m.next = "put_z"
- m.d.sync += z.zero(a.s ^ b.s)
+ m.d.sync += z.inf(a.s ^ b.s)
# Denormalised Number checks
with m.Else():
def testbench(dut):
- yield from check_case(dut, 0x2b017, 0xff3807ab, 0x80000000)
+ yield from check_case(dut, 0x80000000, 0x00000000, 0xffc00000)
+ yield from check_case(dut, 0x00000000, 0x80000000, 0xffc00000)
+ yield from check_case(dut, 0x0002b017, 0xff3807ab, 0x80000000)
yield from check_case(dut, 0x40000000, 0x3F800000, 0x40000000)
yield from check_case(dut, 0x3F800000, 0x40000000, 0x3F000000)
yield from check_case(dut, 0x3F800000, 0x40400000, 0x3EAAAAAB)