mirror of https://github.com/llvm/circt.git
[RTL sim] Add option to run verilator with valgrind
This commit is contained in:
parent
91e8b3dd9a
commit
223d4ccc30
|
@ -181,7 +181,7 @@ class Verilator:
|
|||
self.verilator = "@VERILATOR_PATH@"
|
||||
elif "VERILATOR_PATH" in os.environ:
|
||||
self.verilator = os.environ["VERILATOR_PATH"]
|
||||
|
||||
self.valgrind = args.valgrind
|
||||
self.top = args.top
|
||||
|
||||
def compile(self, sources, args):
|
||||
|
@ -203,7 +203,10 @@ class Verilator:
|
|||
|
||||
def run(self, cycles, args):
|
||||
exe = os.path.join("obj_dir", "V" + self.top)
|
||||
cmd = [exe]
|
||||
if self.valgrind:
|
||||
cmd = ["valgrind", exe]
|
||||
else:
|
||||
cmd = [exe]
|
||||
if cycles >= 0:
|
||||
cmd.append("--cycles")
|
||||
cmd.append(str(cycles))
|
||||
|
@ -272,6 +275,11 @@ def __main__(args):
|
|||
default=-1,
|
||||
help="Number of cycles to run the simulator. " +
|
||||
" -1 means don't stop.")
|
||||
argparser.add_argument(
|
||||
"--valgrind",
|
||||
dest="valgrind",
|
||||
action='store_true',
|
||||
help="Run the simulator under valgrind (Verilator only).")
|
||||
|
||||
argparser.add_argument("sources",
|
||||
nargs="+",
|
||||
|
|
|
@ -178,7 +178,7 @@ class CosimTestRunner:
|
|||
checkCount = 0
|
||||
while (not os.path.exists(portFileName)) and \
|
||||
simProc.poll() is None:
|
||||
time.sleep(0.05)
|
||||
time.sleep(0.1)
|
||||
checkCount += 1
|
||||
if checkCount > 200:
|
||||
raise Exception(f"Cosim never wrote cfg file: {portFileName}")
|
||||
|
|
Loading…
Reference in New Issue