From 456810b09e60eb57089e02fd3603754056c97d23 Mon Sep 17 00:00:00 2001 From: Luke Wren Date: Tue, 24 May 2022 22:56:13 +0100 Subject: [PATCH] Make vcd generation optional in runtests --- test/sim/sw_testcases/runtests | 16 +++++++++++++--- test/sim/sw_testcases/umode_wfi.c | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/test/sim/sw_testcases/runtests b/test/sim/sw_testcases/runtests index 723303a..1f2b852 100755 --- a/test/sim/sw_testcases/runtests +++ b/test/sim/sw_testcases/runtests @@ -4,9 +4,15 @@ import os import subprocess import sys +args = sys.argv[1:] -if len(sys.argv) > 1: - testlist = sys.argv[1:] +generate_vcd = False +if "--vcd" in args: + generate_vcd = True + del args[args.index("--vcd")] + +if len(args) > 0: + testlist = args else: testlist = [] for path in os.listdir(): @@ -36,8 +42,12 @@ for test in testlist: all_passed = False continue + cmdline = ["../tb_cxxrtl/tb", "--bin", f"tmp/{test}.bin", "--cycles", "1000000"] + if generate_vcd: + cmdline += ["--vcd", f"tmp/{test}.vcd"] + test_run_ret = subprocess.run( - ["../tb_cxxrtl/tb", "--bin", f"tmp/{test}.bin", "--cycles", "1000000", "--vcd", f"tmp/{test}.vcd"], + cmdline, stdout = subprocess.PIPE, stderr = subprocess.PIPE, timeout=10 diff --git a/test/sim/sw_testcases/umode_wfi.c b/test/sim/sw_testcases/umode_wfi.c index 683696b..8f7c4d3 100644 --- a/test/sim/sw_testcases/umode_wfi.c +++ b/test/sim/sw_testcases/umode_wfi.c @@ -29,7 +29,7 @@ void __attribute__((naked)) do_ecall() { // /!\ Unconventional control flow ahead // Call function in U mode, from M mode. Catch exception, or break back to M -// mode if the function returned normally, and then return. +// mode if the function returned normally (via dummy ecall), and then return. static inline void umode_call_and_catch(void (*f)(void)) { clear_csr(mstatus, 0x1800u); write_csr(mepc, f);