decodetree: Properly diagnose fields overflowing an insn
Previously this would result in an exception for shifting
the field mask by a negative number.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
diff --git a/scripts/decodetree.py b/scripts/decodetree.py
index ac158b4..aa790b5 100755
--- a/scripts/decodetree.py
+++ b/scripts/decodetree.py
@@ -622,6 +622,8 @@
sign = True
flen = flen[1:]
shift = int(flen, 10)
+ if shift + width > insnwidth:
+ error(lineno, 'field {0} exceeds insnwidth'.format(fname))
f = Field(sign, insnwidth - width - shift, shift)
flds = add_field(lineno, flds, fname, f)
fixedbits <<= shift