Skip to content

Commit

Permalink
seal5.transform.converter: add --prefix option
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippvK committed Mar 14, 2024
1 parent c8a5efe commit 45125b4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
12 changes: 7 additions & 5 deletions examples/cfg/xcorev/XCoreVMac.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
---
extensions:
XCoreVMac:
feature: XCVmac
arch: xcvmac
# feature: XCVmac
# arch: xcvmac
version: "1.0"
experimental: false
vendor: true
# patches: []
passes:
per_model:
XCoreVMac:
skip: [riscv_features, riscv_isa_info, riscv_instr_formats, riscv_instr_info, behav_to_pat]
# skip: [riscv_features, riscv_isa_info, riscv_instr_formats, riscv_instr_info, behav_to_pat]
override:
behav_to_pat:
patterns: false
# behav_to_pat:
# patterns: false
convert_models:
prefix: "SEAL5"
8 changes: 4 additions & 4 deletions seal5/transform/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def main():
parser = argparse.ArgumentParser()
parser.add_argument("top_level", help="A .m2isarmodel file containing the models to generate.")
parser.add_argument("--log", default="info", choices=["critical", "error", "warning", "info", "debug"])
parser.add_argument("--prefix", default="", type=str)
parser.add_argument("--output", "-o", type=str, default=None)
args = parser.parse_args()

Expand Down Expand Up @@ -65,10 +66,9 @@ def main():
for set_name, set_def in sets.items():
logger.info("replacing set %s", set_name)
for enc, instr_def in set_def.instructions.items():
PREFIX = True
if PREFIX:
instr_def.name = f"SEAL5_{instr_def.name}"
instr_def.mnemonic = f"seal5.{instr_def.mnemonic}"
if args.prefix:
instr_def.name = f"{args.prefix.upper()}_{instr_def.name}"
instr_def.mnemonic = f"{args.prefix.lower()}.{instr_def.mnemonic}"
set_def.instructions[enc] = seal5_model.Seal5Instruction(
instr_def.name,
instr_def.attributes,
Expand Down

0 comments on commit 45125b4

Please sign in to comment.