Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed Oct 18, 2023
2 parents 4d98273 + 986e235 commit 45b8573
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 29 deletions.
26 changes: 6 additions & 20 deletions spinnman/transceiver/base_transceiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,23 +232,15 @@ def scamp_connection_selector(self) -> MostDirectConnectionSelector:
def bmp_connection(self) -> BMPConnection:
return self._bmp_connection

def _where_is_xy(self, x: int, y: int):
"""
Attempts to get where_is_x_y info from the machine
If no machine will do its best.
:param int x:
:param int y:
:rtype: str
"""
try:
@overrides(ExtendableTransceiver.bmp_connection)
def where_is_xy(self, x:int, y:int):
try:
if SpiNNManDataView.has_machine():
return SpiNNManDataView.get_machine().where_is_xy(x, y)
return (f"No Machine. "
f"Root IP:{self._scamp_connections[0].remote_ip_address}"
f"x:{x} y:{y}")
except Exception as ex: # pylint: disable=broad-except
except Exception as ex: # pylint: disable=broad-except
return str(ex)

def __identify_connections(
Expand Down Expand Up @@ -1371,14 +1363,8 @@ def update_provenance_and_exit(self, x: int, y: int, p: int):
data=_ONE_WORD.pack(SDP_RUNNING_MESSAGE_CODES
.SDP_UPDATE_PROVENCE_REGION_AND_EXIT.value)))

def send_chip_update_provenance_and_exit(self, x, y, p):
"""
Sends a singnal to update the provenance and exit
:param int x:
:param int y:
:param int p:
"""
@overrides(Transceiver.send_chip_update_provenance_and_exit)
def send_chip_update_provenance_and_exit(self, x: int, y: int, p: int):
cmd = SDP_RUNNING_MESSAGE_CODES.SDP_UPDATE_PROVENCE_REGION_AND_EXIT
port = SDP_PORTS.RUNNING_COMMAND_SDP_PORT

Expand Down
14 changes: 8 additions & 6 deletions spinnman/transceiver/mockable_transceiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,6 @@ def write_fpga_register(

@overrides(Transceiver.read_bmp_version)
def read_bmp_version(self, board: int) -> VersionInfo:
"""
Read the BMP version.
:param int board: which board to request the data from
:return: the sver from the BMP
"""
raise NotImplementedError("Needs to be mocked")

@overrides(Transceiver.write_memory)
Expand Down Expand Up @@ -253,6 +247,14 @@ def control_sync(self, do_sync: bool):
def update_provenance_and_exit(self, x: int, y: int, p: int):
pass

@overrides(Transceiver.send_chip_update_provenance_and_exit)
def send_chip_update_provenance_and_exit(self, x: int, y: int, p: int):
pass

@overrides(Transceiver.where_is_xy)
def where_is_xy(self, x:int, y:int):
return f"Mocked {x=} {y=}"

@property
@overrides(ExtendableTransceiver.bmp_connection)
def bmp_connection(self) -> BMPConnection:
Expand Down
30 changes: 27 additions & 3 deletions spinnman/transceiver/transceiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def get_region_base_address(self, x: int, y: int, p: int):
:param int x: The x-coordinate of the chip containing the processor
:param int y: The y-coordinate of the chip containing the processor
:param int p: The ID of the processor to get the address
:return: The adddress of the Region table for the selected core
:return: The address of the Region table for the selected core
:rtype: int
:raise SpinnmanIOException:
If there is an error communicating with the board
Expand Down Expand Up @@ -412,7 +412,7 @@ def read_bmp_version(self, board: int) -> VersionInfo:
Read the BMP version.
:param int board: which board to request the data from
:return: the sver from the BMP
:return: the version_info from the BMP
"""
raise NotImplementedError("abstractmethod")

Expand Down Expand Up @@ -956,7 +956,7 @@ def control_sync(self, do_sync: bool):
@abstractmethod
def update_provenance_and_exit(self, x: int, y: int, p: int):
"""
Sends a command to update prevenance and exit
Sends a command to update provenance and exit
:param int x:
The x-coordinate of the core
Expand All @@ -966,3 +966,27 @@ def update_provenance_and_exit(self, x: int, y: int, p: int):
The processor on the core
"""
raise NotImplementedError("abstractmethod")

@abstractmethod
def send_chip_update_provenance_and_exit(self, x: int, y: int, p: int):
"""
Sends a signal to update the provenance and exit
:param int x:
:param int y:
:param int p:
"""
raise NotImplementedError("abstractmethod")

@abstractmethod
def where_is_xy(self, x:int, y:int):
"""
Attempts to get where_is_x_y info from the machine
If no machine will do its best.
:param int x:
:param int y:
:rtype: str
"""
raise NotImplementedError("abstractmethod")

0 comments on commit 45b8573

Please sign in to comment.