aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMeng Zhuo <mengzhuo@iscas.ac.cn>2026-03-14 05:39:13 +0800
committerGitHub <noreply@github.com>2026-03-13 14:39:13 -0700
commit6086c5aa807d3903a275f4406161f1f0f9588d63 (patch)
tree4c05062859442b8ae06ff70081f7299b344681c2 /src
parent8730672c739ccd32675bfa90cb6a07f614cfb19f (diff)
downloadriscv-opcodes-6086c5aa807d3903a275f4406161f1f0f9588d63.tar.gz
riscv-opcodes-6086c5aa807d3903a275f4406161f1f0f9588d63.tar.bz2
riscv-opcodes-6086c5aa807d3903a275f4406161f1f0f9588d63.zip
fix absolute path for inst.go codegen (#411)
sys.args will print out absolute path like "/x/y/z/src/riscv_opcodes/__main__.py -go ..." the path will changed if generated on another path. This PR replace the absolute path with "make inst.go " for stable code generation.
Diffstat (limited to 'src')
-rw-r--r--src/riscv_opcodes/go_utils.py6
-rw-r--r--src/riscv_opcodes/parse.py2
2 files changed, 4 insertions, 4 deletions
diff --git a/src/riscv_opcodes/go_utils.py b/src/riscv_opcodes/go_utils.py
index 1a6fc33..4c5748a 100644
--- a/src/riscv_opcodes/go_utils.py
+++ b/src/riscv_opcodes/go_utils.py
@@ -1,6 +1,6 @@
import logging
import pprint
-import sys
+from typing import Sequence
from .constants import csrs
from .shared_utils import InstrDict, signed
@@ -9,9 +9,9 @@ pp = pprint.PrettyPrinter(indent=2)
logging.basicConfig(level=logging.INFO, format="%(levelname)s:: %(message)s")
-def make_go(instr_dict: InstrDict):
+def make_go(instr_dict: InstrDict, extensions: Sequence[str]):
- args = " ".join(sys.argv)
+ args = 'make inst.go EXTENSIONS="' + " ".join(extensions) + '"'
prelude = f"""// Code generated by {args}; DO NOT EDIT."""
prelude += """
diff --git a/src/riscv_opcodes/parse.py b/src/riscv_opcodes/parse.py
index d78f232..0d3da61 100644
--- a/src/riscv_opcodes/parse.py
+++ b/src/riscv_opcodes/parse.py
@@ -64,7 +64,7 @@ def generate_extensions(
logging.info("inst.rs generated successfully")
if go:
- make_go(instr_dict_with_segment)
+ make_go(instr_dict_with_segment, extensions)
logging.info("inst.go generated successfully")
if latex: