From b1188f7894d7a37be82cf7e450d85de1353a841d Mon Sep 17 00:00:00 2001 From: Michael Nolan Date: Wed, 6 May 2020 14:21:40 -0400 Subject: [PATCH] Add length helper for getting length of a selectable int --- src/soc/decoder/helpers.py | 4 ++++ src/soc/decoder/isa/sprset.patch | 16 ---------------- src/soc/decoder/pseudo/pywriter.py | 2 +- 3 files changed, 5 insertions(+), 17 deletions(-) delete mode 100644 src/soc/decoder/isa/sprset.patch diff --git a/src/soc/decoder/helpers.py b/src/soc/decoder/helpers.py index ba3ca0a1..c75fa1e9 100644 --- a/src/soc/decoder/helpers.py +++ b/src/soc/decoder/helpers.py @@ -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 index adae5b1b..00000000 --- a/src/soc/decoder/isa/sprset.patch +++ /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] diff --git a/src/soc/decoder/pseudo/pywriter.py b/src/soc/decoder/pseudo/pywriter.py index e7f2b344..a55b3ffc 100644 --- a/src/soc/decoder/pseudo/pywriter.py +++ b/src/soc/decoder/pseudo/pywriter.py @@ -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 -- 2.30.2