Skip to content

Commit

Permalink
1 bmp_selector
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed Aug 1, 2023
1 parent 647cc6d commit 58b7d17
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 45 deletions.
20 changes: 2 additions & 18 deletions spinnman/extended/extended_transceiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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

Expand Down Expand Up @@ -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.
Expand Down
36 changes: 9 additions & 27 deletions spinnman/transceiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class Transceiver(AbstractContextManager):
"""
__slots__ = [
"_all_connections",
"_bmp_connection_selectors",
"_bmp_selector",
"_bmp_connections",
"_boot_send_connection",
"_chip_execute_lock_condition",
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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))

Expand All @@ -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

Expand Down

0 comments on commit 58b7d17

Please sign in to comment.