From: Michael Nolan Date: Fri, 7 Feb 2020 14:38:47 +0000 (-0500) Subject: Fix != implementation in partsig.py X-Git-Tag: ls180-24jan2020~242 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1a5339fbd5363cd443250a021b4ba55481198d5f;p=ieee754fpu.git Fix != implementation in partsig.py --- diff --git a/src/ieee754/part/partsig.py b/src/ieee754/part/partsig.py index d7a8f614..b7e6eabb 100644 --- a/src/ieee754/part/partsig.py +++ b/src/ieee754/part/partsig.py @@ -159,8 +159,10 @@ class PartitionedSignal: def __ne__(self, other): width = self.sig.shape()[0] - invert = ~self.sig # invert the input before compare EQ. TODO: NE op - return self._compare(width, invert, other, "eq", PartitionedEqGtGe.EQ) + eq = self._compare(width, self, other, "eq", PartitionedEqGtGe.EQ) + ne = Signal(eq.width) + self.m.d.comb += ne.eq(~eq) + return ne def __gt__(self, other): width = self.sig.shape()[0] diff --git a/src/ieee754/part/test/test_partsig.py b/src/ieee754/part/test/test_partsig.py index cca06b20..eb12b8a6 100644 --- a/src/ieee754/part/test/test_partsig.py +++ b/src/ieee754/part/test/test_partsig.py @@ -151,7 +151,7 @@ class TestPartitionPoints(unittest.TestCase): (test_ge_fn, "ge"), (test_lt_fn, "lt"), (test_le_fn, "le"), - #(test_ne_fn, "ne"), # NE not actually working at the moment + (test_ne_fn, "ne"), ): yield part_mask.eq(0) yield from test_binop("16-bit", test_fn, mod_attr, 0b1111)