Unverified Commit af34751b authored by Jakob Görgen's avatar Jakob Görgen
Browse files

experiments/simbricks/orchestration/simulation : added new simulation class as...

experiments/simbricks/orchestration/simulation : added new simulation class as type to network simulators
parent 77a9f1a8
......@@ -28,16 +28,24 @@ from simbricks.orchestration.experiment import experiment_environment_new as exp
from simbricks.orchestration.instantiation import base as inst_base
if tp.TYPE_CHECKING:
from simbricks.orchestration.simulation import Channel, HostSim, PCIDevSim, NetSim
from simbricks.orchestration.simulation import (
Channel,
HostSim,
PCIDevSim,
NetSim,
base as sim_base,
)
class Simulator(abc.ABC):
"""Base class for all simulators."""
def __init__(self, e: Simulation, relative_executable_path: str = "") -> None:
def __init__(
self, simulation: sim_base.Simulation, relative_executable_path: str = ""
) -> None:
self.extra_deps: list[Simulator] = []
self.name = ""
self.experiment = e
self.name: str = ""
self.experiment: sim_base.Simulation = simulation
self._components: set[sys_conf.Component] = []
self._relative_executable_path: str = relative_executable_path
......
......@@ -22,7 +22,6 @@
import abc
import sys
from simbricks.orchestration import experiments
from simbricks.orchestration.simulation import base
from simbricks.orchestration.system import eth
from simbricks.orchestration.instantiation import base as inst_base
......@@ -31,8 +30,10 @@ from simbricks.orchestration.instantiation import base as inst_base
class NetSim(base.Simulator):
"""Base class for network simulators."""
def __init__(self, e: exp.Experiment, relative_executable_path: str = "") -> None:
super().__init__(e, relative_executable_path=relative_executable_path)
def __init__(
self, simulation: base.Simulation, relative_executable_path: str = ""
) -> None:
super().__init__(simulation, relative_executable_path=relative_executable_path)
# TODO: do we want them here?
self._switch_specs = []
self._host_specs = []
......@@ -70,8 +71,10 @@ class NetSim(base.Simulator):
class WireNet(NetSim):
def __init__(self, e: exp.Experiment) -> None:
super().__init__(e, relative_executable_path="/sims/net/wire/net_wire")
def __init__(self, simulation: base.Simulation) -> None:
super().__init__(
simulation=simulation, relative_executable_path="/sims/net/wire/net_wire"
)
# TODO: probably we want to store these in a common base class...
self._wire_comp: eth.EthWire | None = None
......@@ -111,9 +114,13 @@ class WireNet(NetSim):
class SwitchNet(NetSim):
def __init__(
self, e: exp.Experiment, relative_executable_path="/sims/net/switch/net_switch"
self,
simulation: base.Simulation,
relative_executable_path="/sims/net/switch/net_switch",
) -> None:
super().__init__(e, relative_executable_path=relative_executable_path)
super().__init__(
simulation=simulation, relative_executable_path=relative_executable_path
)
# TODO: probably we want to store these in a common base class...
self._switch_spec: eth.EthSwitch | None = None
......@@ -175,9 +182,11 @@ class SwitchNet(NetSim):
class MemSwitchNet(SwitchNet):
def __init__(self, e: exp.Experiment) -> None:
super().__init__(e, relative_executable_path="/sims/mem/memswitch/memswitch")
self.sync = True
def __init__(self, simulation: base.Simulation) -> None:
super().__init__(
simulation=simulation,
relative_executable_path="/sims/mem/memswitch/memswitch",
)
"""AS_ID,VADDR_START,VADDR_END,MEMNODE_MAC,PHYS_START."""
self.mem_map = []
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment