aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xparse.py9
-rw-r--r--test.py1
2 files changed, 9 insertions, 1 deletions
diff --git a/parse.py b/parse.py
index 243a8bb..65d2875 100755
--- a/parse.py
+++ b/parse.py
@@ -126,10 +126,19 @@ def process_enc_line(line, ext):
# check if all args of the instruction are present in arg_lut present in
# constants.py
args = single_fixed.sub(' ', args).split()
+ encoding_args = ['-'] * 32
for a in args:
if a not in arg_lut:
logging.error(f' Found variable {a} in instruction {name} whose mapping in arg_lut does not exist')
raise SystemExit(1)
+ else:
+ (msb, lsb) = arg_lut[a]
+ for ind in range(lsb, msb):
+ # overlapping bits
+ if encoding_args[ind] != '-':
+ logging.error(f' Found variable {a} in instruction {name} overlapping {encoding_args[ind]} variable')
+ raise SystemExit(1)
+ encoding_args[ind] = a
# update the fields of the instruction as a dict and return back along with
# the name of the instruction
diff --git a/test.py b/test.py
index 89c014d..8f6f34e 100644
--- a/test.py
+++ b/test.py
@@ -36,7 +36,6 @@ class EncodingLineTest(unittest.TestCase):
self.assertError('jol rd jimm20 2..0=10')
self.assertError('jol rd jimm20 2..0=0xB')
- @unittest.skip('not implemented')
def test_overlapping_field(self):
self.assertError('jol rd rs1 jimm20 6..2=0x1b 1..0=3')