aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2024-07-15 18:30:35 -0700
committerGitHub <noreply@github.com>2024-07-15 18:30:35 -0700
commit1742345a329e6d885a0b5fd0654592c0e5af172d (patch)
tree3a29a0b2a390eec34f86dcd845a619a343c36ce4
parentef2d43d474b720555bf12174f9801c40321d810d (diff)
parent0d337c165bd089fc2751383e22916637282095e7 (diff)
downloadriscv-opcodes-1742345a329e6d885a0b5fd0654592c0e5af172d.zip
riscv-opcodes-1742345a329e6d885a0b5fd0654592c0e5af172d.tar.gz
riscv-opcodes-1742345a329e6d885a0b5fd0654592c0e5af172d.tar.bz2
Merge pull request #258 from moscickimilosz/parse_windows_fix
Fix python script on windows
-rwxr-xr-xparse.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/parse.py b/parse.py
index cbad629..675aa6b 100755
--- a/parse.py
+++ b/parse.py
@@ -127,7 +127,7 @@ def process_enc_line(line, ext):
# the name of the instruction
single_dict['encoding'] = "".join(encoding)
single_dict['variable_fields'] = args
- single_dict['extension'] = [ext.split('/')[-1]]
+ single_dict['extension'] = [os.path.basename(ext)]
single_dict['match']=hex(int(match,2))
single_dict['mask']=hex(int(mask,2))
@@ -235,7 +235,7 @@ def create_inst_dict(file_filter, include_pseudo=False, include_pseudo_ops=[]):
# call process_enc_line to get the data about the current
# instruction
(name, single_dict) = process_enc_line(line, f)
- ext_name = f.split("/")[-1]
+ ext_name = os.path.basename(f)
# if an instruction has already been added to the filtered
# instruction dictionary throw an error saying the given
@@ -403,7 +403,7 @@ def create_inst_dict(file_filter, include_pseudo=False, include_pseudo_ops=[]):
var = instr_dict[name]["extension"]
if instr_dict[name]['encoding'] != single_dict['encoding']:
err_msg = f'imported instruction : {name} in '
- err_msg += f'{f.split("/")[-1]} is already '
+ err_msg += f'{os.path.basename(f)} is already '
err_msg += f'added from {var} but each have different encodings for the same instruction'
logging.error(err_msg)
raise SystemExit(1)