Fix != implementation in partsig.py
authorMichael Nolan <mtnolan2640@gmail.com>
Fri, 7 Feb 2020 14:38:47 +0000 (09:38 -0500)
committerMichael Nolan <mtnolan2640@gmail.com>
Fri, 7 Feb 2020 14:39:52 +0000 (09:39 -0500)
src/ieee754/part/partsig.py
src/ieee754/part/test/test_partsig.py

index d7a8f6144658d9f38be6229bcdcf3a4947cc8aae..b7e6eabbb9249241327241bcde386e3b142cac0f 100644 (file)
@@ -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]
index cca06b20fc2b0be3cdd47febc1a4cd795c6bb764..eb12b8a601cad98a12badbf151a0b45d68247a95 100644 (file)
@@ -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)