Skip to content

Commit

Permalink
Merge pull request #372 from SpiNNakerManchester/transceiver_fixes
Browse files Browse the repository at this point in the history
send_chip_update_provenance_and_exit to abstract
  • Loading branch information
rowleya authored Oct 18, 2023
2 parents 55a5c7c + 5bd2a33 commit 986e235
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 49 deletions.
45 changes: 5 additions & 40 deletions spinnman/transceiver/base_transceiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -1241,22 +1241,8 @@ def __set_router_diagnostic_filter(
process.execute(WriteMemory(
x, y, memory_position, _ONE_WORD.pack(data_to_send)))

@overrides(Transceiver.clear_router_diagnostic_counters)
def clear_router_diagnostic_counters(self, x, y):
"""
Clear router diagnostic information on a chip.
:param int x: The x-coordinate of the chip
:param int y: The y-coordinate of the chip
:raise SpinnmanIOException:
If there is an error communicating with the board
:raise SpinnmanInvalidPacketException:
If a packet is received that is not in the valid format
:raise SpinnmanInvalidParameterException:
If a packet is received that has invalid parameters or a counter
ID is out of range
:raise SpinnmanUnexpectedResponseCodeException:
If a response indicates an error during the exchange
"""
try:
process = SendSingleCommandProcess(self._scamp_connection_selector)
# Clear all
Expand All @@ -1266,37 +1252,22 @@ def clear_router_diagnostic_counters(self, x, y):
logger.info(self.where_is_xy(x, y))
raise

@overrides(Transceiver.close)
def close(self):
"""
Close the transceiver and any threads that are running.
"""
if self._bmp_connection is not None:
if get_config_bool("Machine", "turn_off_machine"):
self._power_off_machine()

for connection in self._all_connections:
connection.close()

@overrides(Transceiver.control_sync)
def control_sync(self, do_sync):
"""
Control the synchronisation of the chips.
:param bool do_sync: Whether to synchronise or not
"""
process = SendSingleCommandProcess(self._scamp_connection_selector)
process.execute(DoSync(do_sync))

@overrides(Transceiver.update_provenance_and_exit)
def update_provenance_and_exit(self, x, y, p):
"""
Sends a command to update prevenance and exit
:param int x:
The x-coordinate of the core
:param int y:
The y-coordinate of the core
:param int p:
The processor on the core
"""
# Send these signals to make sure the application isn't stuck
self.send_sdp_message(SDPMessage(
sdp_header=SDPHeader(
Expand All @@ -1306,14 +1277,8 @@ def update_provenance_and_exit(self, x, y, p):
data=_ONE_WORD.pack(SDP_RUNNING_MESSAGE_CODES
.SDP_UPDATE_PROVENCE_REGION_AND_EXIT.value)))

@overrides(Transceiver.send_chip_update_provenance_and_exit)
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:
"""
cmd = SDP_RUNNING_MESSAGE_CODES.SDP_UPDATE_PROVENCE_REGION_AND_EXIT
port = SDP_PORTS.RUNNING_COMMAND_SDP_PORT

Expand Down
10 changes: 4 additions & 6 deletions spinnman/transceiver/mockable_transceiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,6 @@ def write_fpga_register(self, fpga_num, register, value, board=0):

@overrides(Transceiver.read_bmp_version)
def read_bmp_version(self, board):
"""
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 @@ -205,6 +199,10 @@ def control_sync(self, do_sync):
def update_provenance_and_exit(self, x, y, p):
pass

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

@overrides(Transceiver.where_is_xy)
def where_is_xy(self, x, y):
return f"Mocked {x=} {y=}"
Expand Down
16 changes: 13 additions & 3 deletions spinnman/transceiver/transceiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def get_region_base_address(self, x, y, p):
: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 @@ -380,7 +380,7 @@ def read_bmp_version(self, board):
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
"""

@abstractmethod
Expand Down Expand Up @@ -883,7 +883,7 @@ def control_sync(self, do_sync):
@abstractmethod
def update_provenance_and_exit(self, x, y, p):
"""
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 @@ -893,6 +893,16 @@ def update_provenance_and_exit(self, x, y, p):
The processor on the core
"""

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

@abstractmethod
def where_is_xy(self, x, y):
"""
Expand Down

0 comments on commit 986e235

Please sign in to comment.