aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordramforever <dramforever@live.com>2023-04-07 12:08:47 +0800
committerdramforever <dramforever@live.com>2023-04-07 12:11:06 +0800
commit89ac807055d4c4086b623325e0cc8a9e6f92cd21 (patch)
tree89179bebfc52d5dab170f2f38132272a0917d394
parent5adef50bd3f8aaff379f7f99e5b6817e2dedf0ed (diff)
downloadriscv-opcodes-89ac807055d4c4086b623325e0cc8a9e6f92cd21.zip
riscv-opcodes-89ac807055d4c4086b623325e0cc8a9e6f92cd21.tar.gz
riscv-opcodes-89ac807055d4c4086b623325e0cc8a9e6f92cd21.tar.bz2
Fix merging of instructions with the same name
Fixes generation of 'extension' field for instr_dict.yaml
-rwxr-xr-xparse.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/parse.py b/parse.py
index 9714e99..47846b7 100755
--- a/parse.py
+++ b/parse.py
@@ -247,8 +247,10 @@ def create_inst_dict(file_filter, include_pseudo=False, include_pseudo_ops=[]):
err_msg += f'added from {item["extension"]} in same base extensions'
logging.error(err_msg)
raise SystemExit(1)
- # update the final dict with the instruction
- instr_dict[name] = single_dict
+
+ if name not in instr_dict:
+ # update the final dict with the instruction
+ instr_dict[name] = single_dict
# second pass if for pseudo instructions
logging.debug('Collecting pseudo instructions now')
@@ -382,10 +384,10 @@ def create_inst_dict(file_filter, include_pseudo=False, include_pseudo_ops=[]):
err_msg += f'added from {var} but each have different encodings for the same instruction'
logging.error(err_msg)
raise SystemExit(1)
- instr_dict[name]['extension'].append(single_dict['extension'])
-
- # update the final dict with the instruction
- instr_dict[name] = single_dict
+ instr_dict[name]['extension'].extend(single_dict['extension'])
+ else:
+ # update the final dict with the instruction
+ instr_dict[name] = single_dict
return instr_dict
def make_priv_latex_table():