From 6b47e9506c733db653b7f0d874b809383863933b Mon Sep 17 00:00:00 2001 From: Luca Colagrande Date: Mon, 16 Sep 2024 13:49:05 +0200 Subject: [PATCH] util: Improve simulation classes --- util/sim/Simulation.py | 3 ++- util/sim/Simulator.py | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/util/sim/Simulation.py b/util/sim/Simulation.py index 5dd98ee35..def9124ac 100644 --- a/util/sim/Simulation.py +++ b/util/sim/Simulation.py @@ -36,7 +36,8 @@ def __init__(self, elf=None, dry_run=False, retcode=0, run_dir=None, name=None): self.dry_run = dry_run self.run_dir = run_dir if run_dir is not None else Path.cwd() if name is None: - self.testname = Path(self.elf).stem + if self.elf is not None: + self.testname = Path(self.elf).stem else: self.testname = name self.cmd = [] diff --git a/util/sim/Simulator.py b/util/sim/Simulator.py index a5d7e1909..4d5cd2883 100644 --- a/util/sim/Simulator.py +++ b/util/sim/Simulator.py @@ -4,7 +4,7 @@ # # Luca Colagrande -from Simulation import QuestaSimulation, VCSSimulation, VerilatorSimulation, BansheeSimulation +from snitch.util.sim import Simulation class Simulator(object): @@ -111,7 +111,7 @@ def __init__(self, binary): Arguments: binary: The VCS simulation binary. """ - super().__init__(binary, name='vcs', simulation_cls=VCSSimulation) + super().__init__(binary, name='vcs', simulation_cls=Simulation.VCSSimulation) class QuestaSimulator(RTLSimulator): @@ -128,7 +128,7 @@ def __init__(self, binary): Arguments: binary: The QuestaSim simulation binary. """ - super().__init__(binary, name='vsim', simulation_cls=QuestaSimulation) + super().__init__(binary, name='vsim', simulation_cls=Simulation.QuestaSimulation) class VerilatorSimulator(RTLSimulator): @@ -145,7 +145,7 @@ def __init__(self, binary): Arguments: binary: The Verilator simulation binary. """ - super().__init__(binary, name='verilator', simulation_cls=VerilatorSimulation) + super().__init__(binary, name='verilator', simulation_cls=Simulation.VerilatorSimulation) class BansheeSimulator(Simulator): @@ -161,7 +161,7 @@ def __init__(self, cfg): Arguments: cfg: A Banshee config file. """ - super().__init__(name='banshee', simulation_cls=BansheeSimulation) + super().__init__(name='banshee', simulation_cls=Simulation.BansheeSimulation) self.cfg = cfg def supports(self, test):