diff options
author | Pavel I. Kryukov <pavel.igorevich.kryukov@gmail.com> | 2022-05-18 10:10:24 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-18 00:10:24 -0700 |
commit | 2415a34131979da9a33594212655bfbe72f74a6f (patch) | |
tree | 14e73b9f68d3d94b991202fd0b9ab4554ac64e5a /parse.py | |
parent | f9272e8d496a8259f29b952797f595eb9e81078d (diff) | |
download | riscv-opcodes-2415a34131979da9a33594212655bfbe72f74a6f.zip riscv-opcodes-2415a34131979da9a33594212655bfbe72f74a6f.tar.gz riscv-opcodes-2415a34131979da9a33594212655bfbe72f74a6f.tar.bz2 |
Check for overlapping fields (#120)
* Check for overlapping fields
* Enable unit test
Diffstat (limited to 'parse.py')
-rwxr-xr-x | parse.py | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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 |