Make vcd generation optional in runtests

This commit is contained in:
Luke Wren 2022-05-24 22:56:13 +01:00
parent 64d9f4a111
commit 456810b09e
2 changed files with 14 additions and 4 deletions

View File

@ -4,9 +4,15 @@ import os
import subprocess import subprocess
import sys import sys
args = sys.argv[1:]
if len(sys.argv) > 1: generate_vcd = False
testlist = sys.argv[1:] if "--vcd" in args:
generate_vcd = True
del args[args.index("--vcd")]
if len(args) > 0:
testlist = args
else: else:
testlist = [] testlist = []
for path in os.listdir(): for path in os.listdir():
@ -36,8 +42,12 @@ for test in testlist:
all_passed = False all_passed = False
continue 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( test_run_ret = subprocess.run(
["../tb_cxxrtl/tb", "--bin", f"tmp/{test}.bin", "--cycles", "1000000", "--vcd", f"tmp/{test}.vcd"], cmdline,
stdout = subprocess.PIPE, stdout = subprocess.PIPE,
stderr = subprocess.PIPE, stderr = subprocess.PIPE,
timeout=10 timeout=10

View File

@ -29,7 +29,7 @@ void __attribute__((naked)) do_ecall() {
// /!\ Unconventional control flow ahead // /!\ Unconventional control flow ahead
// Call function in U mode, from M mode. Catch exception, or break back to M // 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)) { static inline void umode_call_and_catch(void (*f)(void)) {
clear_csr(mstatus, 0x1800u); clear_csr(mstatus, 0x1800u);
write_csr(mepc, f); write_csr(mepc, f);