From: Luke Kenneth Casson Leighton Date: Fri, 19 Jun 2020 14:27:25 +0000 (+0100) Subject: add abs SelectableInt unit test (very quick) X-Git-Tag: div_pipeline~311 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=237fc003dd9b0b1d149a98198890bdd28f017314;p=soc.git add abs SelectableInt unit test (very quick) --- diff --git a/src/soc/decoder/selectable_int.py b/src/soc/decoder/selectable_int.py index eebada68..8e0564f6 100644 --- a/src/soc/decoder/selectable_int.py +++ b/src/soc/decoder/selectable_int.py @@ -412,6 +412,8 @@ class SelectableIntTestCase(unittest.TestCase): d = a - b e = a * b f = -a + g = abs(f) + h = abs(a) self.assertEqual(c.value, a.value + b.value) self.assertEqual(d.value, (a.value - b.value) & 0xFF) self.assertEqual(e.value, (a.value * b.value) & 0xFF) @@ -419,6 +421,8 @@ class SelectableIntTestCase(unittest.TestCase): self.assertEqual(c.bits, a.bits) self.assertEqual(d.bits, a.bits) self.assertEqual(e.bits, a.bits) + self.assertEqual(a.bits, f.bits) + self.assertEqual(a.bits, h.bits) def test_logic(self): a = SelectableInt(0x0F, 8)