aboutsummaryrefslogtreecommitdiff
path: root/parse.py
diff options
context:
space:
mode:
authorFlorian Zaruba <florian@zaruba.email>2022-08-28 22:28:16 +0200
committerGitHub <noreply@github.com>2022-08-28 13:28:16 -0700
commit86edbf4ff2d3bcf88a189f8729eb1d751e2ccfb2 (patch)
treef6ecc1279f11151dcea0a60cbb1df673cbfb0d60 /parse.py
parentdcdf8d35dc906b6232b1e3d01d1392128e049294 (diff)
downloadriscv-opcodes-86edbf4ff2d3bcf88a189f8729eb1d751e2ccfb2.zip
riscv-opcodes-86edbf4ff2d3bcf88a189f8729eb1d751e2ccfb2.tar.gz
riscv-opcodes-86edbf4ff2d3bcf88a189f8729eb1d751e2ccfb2.tar.bz2
Make path to encoding.h relative to script (#141)
That allows for running the script out-of-tree. Signed-off-by: Florian Zaruba <florian@zaruba.email> Signed-off-by: Florian Zaruba <florian@zaruba.email>
Diffstat (limited to 'parse.py')
-rwxr-xr-xparse.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/parse.py b/parse.py
index 90f1b41..940d814 100755
--- a/parse.py
+++ b/parse.py
@@ -846,7 +846,7 @@ def make_c(instr_dict):
mask = ((1 << (end - begin + 1)) - 1) << begin
arg_str += f"#define INSN_FIELD_{name.upper().replace(' ', '_')} {hex(mask)}\n"
- with open('encoding.h', 'r') as file:
+ with open(f'{os.path.dirname(__file__)}/encoding.h', 'r') as file:
enc_header = file.read()
commit = os.popen('git log -1 --format="format:%h"').read()