Add length helper for getting length of a selectable int
authorMichael Nolan <mtnolan2640@gmail.com>
Wed, 6 May 2020 18:21:40 +0000 (14:21 -0400)
committerMichael Nolan <mtnolan2640@gmail.com>
Wed, 6 May 2020 18:21:40 +0000 (14:21 -0400)
src/soc/decoder/helpers.py
src/soc/decoder/isa/sprset.patch [deleted file]
src/soc/decoder/pseudo/pywriter.py

index ba3ca0a19236f46c06b2f7e9316278816750a697..c75fa1e9f7960bb9dd7f02e418c53aa2cd734071 100644 (file)
@@ -71,6 +71,10 @@ def lt(a, b):
 
 def le(a, b):
     return SelectableInt((a <= b), bits=1)
+
+def length(a):
+    return len(a)
+
 # 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
diff --git a/src/soc/decoder/isa/sprset.patch b/src/soc/decoder/isa/sprset.patch
deleted file mode 100644 (file)
index adae5b1..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
---- sprset.py.orig     2020-05-06 14:15:08.236887767 -0400
-+++ sprset.py  2020-05-06 14:15:51.757083567 -0400
-@@ -15,11 +15,11 @@
-         if n in [13]:
-             see(Book_III_p974)
-         elif n in [808, 809, 810, 811]:
--            if eq(length(SPR(n)), 64):
-+            if eq(len(SPR(n)), 64):
-                 SPR[n] = RS
-             else:
-                 SPR[n] = RS[32:64]
--        elif eq(length(SPR(n)), 64):
-+        elif eq(len(SPR(n)), 64):
-             SPR[n] = RS
-         else:
-             SPR[n] = RS[32:64]
index e7f2b344ec981256c2e031aabda19bf12fedc890..a55b3ffc875f5423057d4fc6233feb869694110d 100644 (file)
@@ -20,7 +20,7 @@ header = """\
 
 from soc.decoder.isa.caller import inject, instruction_info
 from soc.decoder.helpers import (EXTS, EXTS64, EXTZ64, ROTL64, ROTL32, MASK,
-                                 ne, eq, gt, ge, lt, le)
+                                 ne, eq, gt, ge, lt, le, length)
 from soc.decoder.selectable_int import SelectableInt
 from soc.decoder.selectable_int import selectconcat as concat
 from soc.decoder.orderedset import OrderedSet