"profiler/vscode:/vscode.git/clone" did not exist on "63cdd92398c4f92829d95ec4ae3473a4456016b8"
Commit 9078f477 authored by Jonas Kaufmann's avatar Jonas Kaufmann
Browse files

orchestration/instantiation/get_socket(): rename to update_get_socket() since...

orchestration/instantiation/get_socket(): rename to update_get_socket() since function has side-effects
parent 423b30f1
...@@ -186,19 +186,19 @@ class Instantiation(): ...@@ -186,19 +186,19 @@ class Instantiation():
new_socket = inst_socket.Socket(path=new_path, ty=new_ty) new_socket = inst_socket.Socket(path=new_path, ty=new_ty)
return new_socket return new_socket
def get_socket(self, interface: sys_base.Interface) -> inst_socket.Socket | None: def update_get_socket(self, interface: sys_base.Interface) -> inst_socket.Socket | None:
socket = self._get_socket_by_interface(interface=interface) socket = self._get_socket_by_interface(interface=interface)
if socket: if socket:
return socket return socket
return None return None
def _get_socket( def _update_get_socket(
self, interface: sys_base.Interface, socket_type: inst_socket.SockType self, interface: sys_base.Interface, socket_type: inst_socket.SockType
) -> inst_socket.Socket: ) -> inst_socket.Socket:
if self._opposing_interface_within_same_sim(interface=interface): if self._opposing_interface_within_same_sim(interface=interface):
raise Exception( raise Exception(
"we do not create a socket for interfacces taht both beloing to the same simulator" "we do not create a socket for channels where both interfaces belong to the same simulator"
) )
# check if already a socket is associated with this interface # check if already a socket is associated with this interface
......
...@@ -232,7 +232,7 @@ class Simulator(utils_base.IdObj, abc.ABC): ...@@ -232,7 +232,7 @@ class Simulator(utils_base.IdObj, abc.ABC):
raise Exception("comp must be a simulators component") raise Exception("comp must be a simulators component")
sockets = [] sockets = []
for interface in comp.interfaces(): for interface in comp.interfaces():
socket = inst.get_socket(interface=interface) socket = inst.update_get_socket(interface=interface)
if socket: if socket:
sockets.append(socket) sockets.append(socket)
return sockets return sockets
......
...@@ -180,7 +180,7 @@ class Gem5Sim(HostSim): ...@@ -180,7 +180,7 @@ class Gem5Sim(HostSim):
interfaces=fsh_interfaces, ty=sys_pcie.PCIeHostInterface interfaces=fsh_interfaces, ty=sys_pcie.PCIeHostInterface
) )
for inf in pci_interfaces: for inf in pci_interfaces:
socket = inst.get_socket(interface=inf) socket = inst.update_get_socket(interface=inf)
if socket is None: if socket is None:
continue continue
assert socket._type == inst_socket.SockType.CONNECT assert socket._type == inst_socket.SockType.CONNECT
...@@ -197,7 +197,7 @@ class Gem5Sim(HostSim): ...@@ -197,7 +197,7 @@ class Gem5Sim(HostSim):
interfaces=fsh_interfaces, ty=sys_mem.MemHostInterface interfaces=fsh_interfaces, ty=sys_mem.MemHostInterface
) )
for inf in mem_interfaces: for inf in mem_interfaces:
socket = inst.get_socket(interface=inf) socket = inst.update_get_socket(interface=inf)
if socket is None: if socket is None:
continue continue
assert socket._type == inst_socket.SockType.CONNECT assert socket._type == inst_socket.SockType.CONNECT
...@@ -335,7 +335,7 @@ class QemuSim(HostSim): ...@@ -335,7 +335,7 @@ class QemuSim(HostSim):
interfaces=fsh_interfaces, ty=sys_pcie.PCIeHostInterface interfaces=fsh_interfaces, ty=sys_pcie.PCIeHostInterface
) )
for inf in pci_interfaces: for inf in pci_interfaces:
socket = inst.get_socket(interface=inf) socket = inst.update_get_socket(interface=inf)
if socket is None: if socket is None:
continue continue
assert socket._type is inst_socket.SockType.CONNECT assert socket._type is inst_socket.SockType.CONNECT
......
...@@ -75,11 +75,11 @@ class NICSim(PCIDevSim): ...@@ -75,11 +75,11 @@ class NICSim(PCIDevSim):
assert len(nic_devices) == 1 assert len(nic_devices) == 1
nic_device = nic_devices[0] nic_device = nic_devices[0]
socket = inst.get_socket(interface=nic_device._pci_if) socket = inst.update_get_socket(interface=nic_device._pci_if)
assert socket is not None and socket._type == inst_socket.SockType.LISTEN assert socket is not None and socket._type == inst_socket.SockType.LISTEN
cmd += f"{socket._path} " cmd += f"{socket._path} "
socket = inst.get_socket(interface=nic_device._eth_if) socket = inst.update_get_socket(interface=nic_device._eth_if)
assert socket is not None and socket._type == inst_socket.SockType.LISTEN assert socket is not None and socket._type == inst_socket.SockType.LISTEN
cmd += f"{socket._path} " cmd += f"{socket._path} "
......
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