From 58b7d171b46d7cda43eb3078865b96a7499ee2fc Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Tue, 1 Aug 2023 12:43:14 +0100 Subject: [PATCH] 1 bmp_selector --- spinnman/extended/extended_transceiver.py | 20 ++----------- spinnman/transceiver.py | 36 ++++++----------------- 2 files changed, 11 insertions(+), 45 deletions(-) diff --git a/spinnman/extended/extended_transceiver.py b/spinnman/extended/extended_transceiver.py index f2120267f..ba922ac9e 100644 --- a/spinnman/extended/extended_transceiver.py +++ b/spinnman/extended/extended_transceiver.py @@ -450,8 +450,7 @@ def set_led(self, led, action, board, cabinet, frame): """ warn_once(logger, "The set_led method is deprecated and " "untested due to no known use.") - process = SendSingleCommandProcess( - self._bmp_connection(cabinet, frame)) + process = SendSingleCommandProcess(self._bmp_selector) process.execute(BMPSetLed(led, action, board)) def read_adc_data(self, board, cabinet, frame): @@ -471,8 +470,7 @@ def read_adc_data(self, board, cabinet, frame): """ warn_once(logger, "The read_adc_data method is deprecated and " "untested due to no known use.") - process = SendSingleCommandProcess( - self._bmp_connection(cabinet, frame)) + process = SendSingleCommandProcess(self._bmp_selector) response = process.execute(ReadADC(board)) return response.adc_info # pylint: disable=no-member @@ -798,20 +796,6 @@ def number_of_boards_located(self): # if no BMPs are available, then there's still at least one board return max(1, boards) - @property - def bmp_connection(self): - """ - The BMP connections. - - .. warning:: - This property is currently deprecated and likely to be removed. - - :rtype: dict(tuple(int,int),MostDirectConnectionSelector) - """ - warn_once(logger, "The bmp_connection property is deprecated and " - "likely to be removed.") - return self._bmp_connection_selectors - def get_heap(self, x, y, heap=SystemVariableDefinition.sdram_heap_address): """ Get the contents of the given heap on a given chip. diff --git a/spinnman/transceiver.py b/spinnman/transceiver.py index a3e3daa91..3af4a0494 100644 --- a/spinnman/transceiver.py +++ b/spinnman/transceiver.py @@ -174,7 +174,7 @@ class Transceiver(AbstractContextManager): """ __slots__ = [ "_all_connections", - "_bmp_connection_selectors", + "_bmp_selector", "_bmp_connections", "_boot_send_connection", "_chip_execute_lock_condition", @@ -237,7 +237,7 @@ def __init__( self._bmp_connections = list() # build connection selectors for the processes. - self._bmp_connection_selectors = dict() + self._bmp_selector = None self._scamp_connection_selector = \ self.__identify_connections(connections) @@ -289,8 +289,8 @@ def __identify_connections(self, connections): if isinstance(conn, BMPConnection): # If it is a BMP conn, add it here self._bmp_connections.append(conn) - self._bmp_connection_selectors[0, 0] =\ - FixedConnectionSelector(conn) + assert (self._bmp_selector is None) + self._bmp_selector = FixedConnectionSelector(conn) # Otherwise, check if it can send and receive SCP (talk to SCAMP) elif isinstance(conn, SCAMPConnection): self._scamp_connections.append(conn) @@ -311,8 +311,7 @@ def __check_bmp_connections(self): # try to send a BMP sver to check if it responds as expected try: version_info = self._get_scamp_version( - conn.chip_x, conn.chip_y, - self._bmp_connection_selectors[0, 0]) + conn.chip_x, conn.chip_y, self._bmp_selector) fail_version_name = version_info.name != _BMP_NAME fail_version_num = \ version_info.version_number[0] not in _BMP_MAJOR_VERSIONS @@ -1099,20 +1098,6 @@ def power_off(self, boards=0, cabinet=0, frame=0): """ self._power(PowerCommand.POWER_OFF, boards, cabinet, frame) - def _bmp_connection(self, cabinet, frame): - """ - :param int cabinet: - :param int frame: - :rtype: FixedConnectionSelector - """ - assert (cabinet==frame==0) - key = (0, 0) - if key not in self._bmp_connection_selectors: - raise SpinnmanInvalidParameterException( - "cabinet and frame", f"{0} and {0}", - "Unknown combination") - return self._bmp_connection_selectors[key] - def _power(self, power_command, boards=0, cabinet=0, frame=0): """ Send a power request to the machine. @@ -1124,7 +1109,7 @@ def _power(self, power_command, boards=0, cabinet=0, frame=0): :param int frame: the ID of the frame in the cabinet containing the board(s), or 0 if the board is not in a frame """ - connection_selector = self._bmp_connection(cabinet, frame) + connection_selector = self._bmp_selector timeout = ( BMP_POWER_ON_TIMEOUT if power_command == PowerCommand.POWER_ON @@ -1154,8 +1139,7 @@ def read_fpga_register( :return: the register data :rtype: int """ - process = SendSingleCommandProcess( - self._bmp_connection(cabinet, frame), timeout=1.0) + process = SendSingleCommandProcess(self._bmp_selector, timeout=1.0) response = process.execute( ReadFPGARegister(fpga_num, register, board)) return response.fpga_register # pylint: disable=no-member @@ -1175,8 +1159,7 @@ def write_fpga_register(self, fpga_num, register, value, :param int frame: the frame this is targeting :param int board: which board to write the FPGA register to """ - process = SendSingleCommandProcess( - self._bmp_connection(cabinet, frame)) + process = SendSingleCommandProcess(self._bmp_selector) process.execute( WriteFPGARegister(fpga_num, register, value, board)) @@ -1189,8 +1172,7 @@ def read_bmp_version(self, board, cabinet=0, frame=0): :param int board: which board to request the data from :return: the sver from the BMP """ - process = SendSingleCommandProcess( - self._bmp_connection(cabinet, frame)) + process = SendSingleCommandProcess(self._bmp_selector) response = process.execute(BMPGetVersion(board)) return response.version_info # pylint: disable=no-member