aboutsummaryrefslogtreecommitdiff
path: root/parse.py
diff options
context:
space:
mode:
authorAfonso Oliveira <Afonso.Oliveira@synopsys.com>2024-08-31 22:07:44 +0100
committerAfonso Oliveira <Afonso.Oliveira@synopsys.com>2024-08-31 22:07:44 +0100
commit5132029669a84d987219fc8a62ea6bf4e3c90e99 (patch)
treeb2ef10198b459749e3b27a75c1bd3f3a188d9aef /parse.py
parent37f82a0cce112d3646c8fb7eab9cbd382b2ad8da (diff)
downloadriscv-opcodes-5132029669a84d987219fc8a62ea6bf4e3c90e99.zip
riscv-opcodes-5132029669a84d987219fc8a62ea6bf4e3c90e99.tar.gz
riscv-opcodes-5132029669a84d987219fc8a62ea6bf4e3c90e99.tar.bz2
Added Distinction between Instructions and Pseudo-instructions with the same name. (JAL and JALR case)
Signed-off-by: Afonso Oliveira <Afonso.Oliveira@synopsys.com>
Diffstat (limited to 'parse.py')
-rwxr-xr-xparse.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/parse.py b/parse.py
index 5c2c533..fb0c2e7 100755
--- a/parse.py
+++ b/parse.py
@@ -116,9 +116,7 @@ def process_enc_line(line, ext):
if len(parts := a.split('=')) == 2:
existing_arg, new_arg = parts
if existing_arg in arg_lut:
- print ("old",arg_lut)
arg_lut[a] = arg_lut[existing_arg]
- print ("new\n", arg_lut)
else:
logging.error(f' Found field {existing_arg} in variable {a} in instruction {name} whose mapping in arg_lut does not exist')
@@ -380,11 +378,16 @@ def create_inst_dict(file_filter, include_pseudo=False, include_pseudo_ops=[]):
instr_dict[name] = single_dict
logging.debug(f' including pseudo_ops:{name}')
else:
+ if(single_dict['match'] != instr_dict[name]['match']):
+ instr_dict[name + '_pseudo'] = single_dict
+
# if a pseudo instruction has already been added to the filtered
# instruction dictionary but the extension is not in the current
# list, add it
- ext_name = single_dict['extension']
- if ext_name not in instr_dict[name]['extension']:
+ else:
+ ext_name = single_dict['extension']
+
+ if (ext_name not in instr_dict[name]['extension']) & (name + '_pseudo' not in instr_dict):
instr_dict[name]['extension'].extend(ext_name)
else:
logging.debug(f' Skipping pseudo_op {pseudo_inst} since original instruction {orig_inst} already selected in list')