From: Michael Nolan Date: Mon, 30 Mar 2020 23:57:14 +0000 (-0400) Subject: Add more comments to helpers.py X-Git-Tag: div_pipeline~1586 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4dcce6d901255043bd660c94dc82ba5406ae73c0;p=soc.git Add more comments to helpers.py --- diff --git a/src/soc/decoder/helpers.py b/src/soc/decoder/helpers.py index 95aa2852..79660d45 100644 --- a/src/soc/decoder/helpers.py +++ b/src/soc/decoder/helpers.py @@ -34,6 +34,12 @@ def MASK(x, y): return mask_a ^ mask_b +# For these tests I tried to find power instructions that would let me +# isolate each of these helper operations. So for instance, when I was +# testing the MASK() function, I chose rlwinm and rldicl because if I +# set the shift equal to 0 and passed in a value of all ones, the +# result I got would be exactly the same as the output of MASK() + class HelperTests(unittest.TestCase): def test_MASK(self): # Verified using rlwinm, rldicl, rldicr in qemu @@ -79,8 +85,11 @@ class HelperTests(unittest.TestCase): value_b = 0x73123456 # r2 value_c = 0x80000000 # r3 + # extswsli reg, 1, 0 self.assertHex(EXTS64(value_a), 0xffffffffdeadbeef) + # extswsli reg, 2, 0 self.assertHex(EXTS64(value_b), value_b) + # extswsli reg, 3, 0 self.assertHex(EXTS64(value_c), 0xffffffff80000000)