allow wsim to take .elf in testsuite argument; print error if ELF not found

This commit is contained in:
David Harris 2024-07-13 21:59:26 -07:00
parent 26d4fbcc19
commit 904a081218

View File

@ -21,8 +21,8 @@ import os
# Parse arguments
parser = argparse.ArgumentParser()
parser.add_argument("config", help="Configuration file")
parser.add_argument("testsuite", help="Test suite or ELF file")
parser.add_argument("--elf", "-e", help="ELF File name", default="")
parser.add_argument("testsuite", help="Test suite or path to .elf file")
parser.add_argument("--elf", "-e", help="ELF File name; use if name does not end in .elf", default="")
parser.add_argument("--sim", "-s", help="Simulator", choices=["questa", "verilator", "vcs"], default="questa")
parser.add_argument("--tb", "-t", help="Testbench", choices=["testbench", "testbench_fp"], default="testbench")
parser.add_argument("--gui", "-g", help="Simulate with GUI", action="store_true")
@ -36,11 +36,16 @@ parser.add_argument("--covlog", "-d", help="Log coverage after n instructions.",
args = parser.parse_args()
print("Config=" + args.config + " tests=" + args.testsuite + " sim=" + args.sim + " gui=" + str(args.gui) + " args='" + args.args + "'")
ElfFile=""
DirectorMode = 0
WALLY = os.environ.get('WALLY')
if(os.path.isfile(args.elf)):
ElfFile = "+ElfFile=" + os.path.abspath(args.elf)
elif(args.testsuite.endswith('.elf') and os.path.isfile(args.testsuite)):
ElfFile = "+ElfFile=" + os.path.abspath(args.testsuite)
args.testsuite=args.testsuite.rsplit('/', 1)[1]
else:
print("ELF file not found: " + args.elf)
exit(1)
# Validate arguments
if (args.gui or args.coverage or args.fcov or args.lockstep):