From 1a5339fbd5363cd443250a021b4ba55481198d5f Mon Sep 17 00:00:00 2001 From: Michael Nolan Date: Fri, 7 Feb 2020 09:38:47 -0500 Subject: [PATCH] Fix != implementation in partsig.py --- src/ieee754/part/partsig.py | 6 ++++-- src/ieee754/part/test/test_partsig.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) 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) -- 2.30.2