spinnman.extended package

Submodules

spinnman.extended.extended_transceiver module

class spinnman.extended.extended_transceiver.ExtendedTransceiver[source]

Bases: object

Allows a Transceiver to support extra method not currently needed.

All methods here are in danger of being removed if they become too hard to support and many are untested so use at your own risk. It is undetermined if these will work with Spin2 boards.

If any method here is considered important to keep please move it to Transceiver and its implementations

execute(x, y, processors, executable, app_id, n_bytes=None, wait=False)[source]

Start an executable running on a single chip.

Warning

This method is currently deprecated and likely to be removed.

Parameters:
  • x (int) – The x-coordinate of the chip on which to run the executable

  • y (int) – The y-coordinate of the chip on which to run the executable

  • processors (list(int)) – The cores on the chip on which to run the application

  • executable (RawIOBase or bytes or bytearray or str) –

    The data that is to be executed. Should be one of the following:

    • An instance of RawIOBase

    • A bytearray/bytes

    • A filename of a file containing the executable (in which case is_filename must be set to True)

  • app_id (int) – The ID of the application with which to associate the executable

  • n_bytes (int) –

    The size of the executable data in bytes. If not specified:

    • If executable is an RawIOBase, an error is raised

    • If executable is a bytearray, the length of the bytearray will be used

    • If executable is an int, 4 will be used

    • If executable is a str, the length of the file will be used

  • wait (bool) – True if the binary should enter a “wait” state on loading

Raises:
execute_application(executable_targets, app_id)[source]

Execute a set of binaries that make up a complete application on specified cores, wait for them to be ready and then start all of the binaries.

Note

This will get the binaries into c_main but will not signal the barrier.

Parameters:
  • executable_targets (ExecutableTargets) – The binaries to be executed and the cores to execute them on

  • app_id (int) – The app_id to give this application

free_sdram(x, y, base_address)[source]

Free allocated SDRAM.

Warning

This method is currently deprecated and likely to be removed.

Parameters:
  • x (int) – The x-coordinate of the chip onto which to ask for memory

  • y (int) – The y-coordinate of the chip onto which to ask for memory

  • base_address (int) – The base address of the allocated memory

free_sdram_by_app_id(x, y, app_id)[source]

Free all SDRAM allocated to a given app ID.

Warning

This method is currently deprecated and untested as there is no known use. Same functionality provided by ybug and bmpc. Retained in case needed for hardware debugging.

Parameters:
  • x (int) – The x-coordinate of the chip onto which to ask for memory

  • y (int) – The y-coordinate of the chip onto which to ask for memory

  • app_id (int) – The app ID of the allocated memory

Returns:

The number of blocks freed

Return type:

int

get_heap(x, y, heap=SystemVariableDefinition.sdram_heap_address)[source]

Get the contents of the given heap on a given chip.

Parameters:
  • x (int) – The x-coordinate of the chip

  • y (int) – The y-coordinate of the chip

  • heap (SystemVariableDefinition) – The SystemVariableDefinition which is the heap to read

Return type:

list(HeapElement)

get_iobuf_from_core(x, y, p)[source]

Get the contents of IOBUF for a given core.

Warning

This method is currently deprecated and likely to be removed.

Parameters:
  • x (int) – The x-coordinate of the chip containing the processor

  • y (int) – The y-coordinate of the chip containing the processor

  • p (int) – The ID of the processor to get the IOBUF for

Returns:

An IOBUF buffer

Return type:

IOBuffer

Raises:
get_router_diagnostic_filter(x: int, y: int, position: int) DiagnosticFilter[source]

Gets a router diagnostic filter from a router.

Parameters:
  • x (int) – the X address of the router from which this filter is being retrieved

  • y (int) – the Y address of the router from which this filter is being retrieved

  • position (int) – the position in the list of filters to read the information from

Returns:

The diagnostic filter read

Return type:

DiagnosticFilter

Raises:
is_connected(connection=None)[source]

Determines if the board can be contacted via SCAMP

Parameters:

connection (Connection) – The connection which is to be tested. If None, all Scamp connections will be tested, and the board will be considered to be connected if any one connection works.

Returns:

True if the board can be contacted, False otherwise

Return type:

bool

property number_of_boards_located

The number of boards currently configured.

Warning

This property is currently deprecated and likely to be removed.

Return type:

int

read_adc_data(board)[source]

Read the BMP ADC data.

Warning

This method is currently deprecated and untested as there is no known use. Same functionality provided by ybug and bmpc. Retained in case needed for hardware debugging.

Parameters:

board (int) – which board to request the ADC data from

Returns:

the FPGA’s ADC data object

Return type:

ADCInfo

read_neighbour_memory(x, y, link, base_address, length, cpu=0)[source]

Read some areas of memory on a neighbouring chip using a LINK_READ SCP command. If sent to a BMP, this command can be used to communicate with the FPGAs’ debug registers.

Warning

This method is currently deprecated and untested as there is no known use. Same functionality provided by ybug and bmpc. Retained in case needed for hardware debugging.

Parameters:
  • x (int) – The x-coordinate of the chip whose neighbour is to be read from

  • y (int) – The y-coordinate of the chip whose neighbour is to be read from

  • cpu (int) – The CPU to use, typically 0 (or if a BMP, the slot number)

  • link (int) – The link index to send the request to (or if BMP, the FPGA number)

  • base_address (int) – The address in SDRAM where the region of memory to be read starts

  • length (int) – The length of the data to be read in bytes

Returns:

An iterable of chunks of data read in order

Return type:

bytes

Raises:
abstract property scamp_connection_selector: ConnectionSelector

Returns the scamp selector

Return type:

AbstractMultiConnectionProcessConnectionSelector

Returns the scamp selector

Return type:

AbstractMultiConnectionProcessConnectionSelector

set_led(led, action, board)[source]

Set the LED state of a board in the machine.

Warning

This method is currently deprecated and untested as there is no known use. Same functionality provided by ybug and bmpc. Retained in case needed for hardware debugging.

Parameters:
  • led (int or iterable(int)) – Number of the LED or an iterable of LEDs to set the state of (0-7)

  • action (LEDAction) – State to set the LED to, either on, off or toggle

  • board (int or iterable(int)) – Specifies the board to control the LEDs of. This may also be an iterable of multiple boards. The command will actually be sent to the first board in the iterable.

set_leds(x, y, cpu, led_states)[source]

Set LED states.

Warning

The set_leds is deprecated and untested due to no known use.

Parameters:
  • x (int) – The x-coordinate of the chip on which to set the LEDs

  • y (int) – The x-coordinate of the chip on which to set the LEDs

  • cpu (int) – The CPU of the chip on which to set the LEDs

  • led_states (dict(int,int)) – A dictionary mapping SetLED index to state with 0 being off, 1 on and 2 inverted.

Raises:
set_watch_dog(watch_dog)[source]

Enable, disable or set the value of the watch dog timer.

Warning

This method is currently deprecated and untested as there is no known use. Same functionality provided by ybug and bmpc. Retained in case needed for hardware debugging.

Parameters:

watch_dog (bool or int) – Either a Boolean indicating whether to enable (True) or disable (False) the watch dog timer, or an int value to set the timer count to.

write_memory_flood(base_address, data, n_bytes=None, offset=0, is_filename=False)[source]

Write to the SDRAM of all chips.

Parameters:
  • base_address (int) – The address in SDRAM where the region of memory is to be written

  • data (RawIOBase or bytes or bytearray or int or str) –

    The data that is to be written. Should be one of the following:

    • An instance of RawIOBase

    • A byte-string

    • A single integer

    • A file name of a file to read (in which case is_filename should be set to True)

  • n_bytes (int) –

    The amount of data to be written in bytes. If not specified:

    • If data is an RawIOBase, an error is raised

    • If data is a bytearray or bytes, the length of the bytearray will be used

    • If data is an int, 4 will be used

    • If data is a str, the size of the file will be used

  • offset (int) – The offset where the valid data starts; if data is an int, then the offset will be ignored and 0 is used.

  • is_filename (bool) – True if data should be interpreted as a file name

Raises:
write_neighbour_memory(x, y, link, base_address, data, n_bytes=None, offset=0, cpu=0)[source]

Write to the memory of a neighbouring chip using a LINK_READ SCP command. If sent to a BMP, this command can be used to communicate with the FPGAs’ debug registers.

Warning

This method is deprecated and untested due to no known use.

Parameters:
  • x (int) – The x-coordinate of the chip whose neighbour is to be written to

  • y (int) – The y-coordinate of the chip whose neighbour is to be written to

  • link (int) – The link index to send the request to (or if BMP, the FPGA number)

  • base_address (int) – The address in SDRAM where the region of memory is to be written

  • data (RawIOBase or bytes or bytearray or int) –

    The data to write. Should be one of the following:

    • An instance of RawIOBase

    • A bytearray/bytes

    • A single integer; will be written in little-endian byte order

  • n_bytes (int) –

    The amount of data to be written in bytes. If not specified:

    • If data is an RawIOBase, an error is raised

    • If data is a bytearray, the length of the bytearray will be used

    • If data is an int, 4 will be used

  • offset (int) – The offset where the valid data starts (if data is an int then offset will be ignored and used 0)

  • cpu (int) – The CPU to use, typically 0 (or if a BMP, the slot number)

Raises:

spinnman.extended.version3transceiver module

class spinnman.extended.version3transceiver.ExtendedVersion3Transceiver(connections: List[Connection] | None = None, power_cycle: bool = False)[source]

Bases: Version3Transceiver, ExtendedTransceiver

A Transceiver specific for a 4 chip (spin 1) with the extended methods.

Parameters:
  • connections (list(Connection)) – An iterable of connections to the board. If not specified, no communication will be possible until connections are found.

  • power_cycle (bool) – If True will power cycle the machine:

Raises:

spinnman.extended.version5transceiver module

class spinnman.extended.version5transceiver.ExtendedVersion5Transceiver(connections: List[Connection] | None = None, power_cycle: bool = False)[source]

Bases: Version5Transceiver, ExtendedTransceiver

A Transceiver specific for a 48 chip (spin 1) with the extended methods.

Parameters:
  • connections (list(Connection)) – An iterable of connections to the board. If not specified, no communication will be possible until connections are found.

  • power_cycle (bool) – If True will power cycle the machine:

Raises:

Module contents

class spinnman.extended.BMPSetLed(led: int | Iterable[int], action: LEDAction, boards: int | Iterable[int])

Bases: BMPRequest

Set the LED(s) of a board to either on, off or toggling.

This class is currently deprecated and untested as there is no known use except for Transceiver.set_led which is itself deprecated.

Parameters:
  • led (int or list(int)) – Number of the LED or an iterable of LEDs to set the state of (0-7)

  • action (LEDAction) – State to set the LED to, either on, off or toggle

  • boards (int or list(int)) – Specifies the board to control the LEDs of. This may also be an iterable of multiple boards (in the same frame).

get_scp_response() CheckOKResponse[source]

Get an SCP response message to be used to process any response received.

Returns:

An SCP response, or None if no response is required

Return type:

AbstractSCPResponse

class spinnman.extended.DeAllocSDRAMProcess(connection_selector: ConnectionSelector)

Bases: AbstractMultiConnectionProcess

Warning

This class is currently deprecated and untested as there is no known use except for Transceiver.free_sdram and free_sdram_by_app_id which are both themselves deprecated.

Parameters:

connection_selector (ConnectionSelector)

de_alloc_all_app_sdram(x: int, y: int, app_id: int)[source]
Parameters:
de_alloc_sdram(x: int, y: int, base_address: int)[source]
Parameters:
property no_blocks_freed: int | None
Return type:

int

class spinnman.extended.ReadADC(board: int)

Bases: BMPRequest[_SCPReadADCResponse]

SCP Request for the data from the BMP including voltages and temperature.

This class is currently deprecated and untested as there is no known use except for Transceiver.read_adc_data which is itself deprecated.

Note

The equivalent code in Java is not deprecated.

Parameters:

board (int) – which board to request the ADC data from

get_scp_response() _SCPReadADCResponse[source]

Get an SCP response message to be used to process any response received.

Returns:

An SCP response, or None if no response is required

Return type:

AbstractSCPResponse

class spinnman.extended.SetLED(x: int, y: int, cpu: int, led_states: Mapping[int, int])

Bases: AbstractSCPRequest[CheckOKResponse]

A request to change the state of a chip’s LED.

This class is currently deprecated and untested as there is no known use except for Transceiver.set_led which is itself deprecated.

Parameters:
  • x (int) – The x-coordinate of the chip, between 0 and 255

  • y (int) – The y-coordinate of the chip, between 0 and 255

  • cpu (int) – The CPU-number to use to set the LED. Normally should be 0

  • led_states (dict(int,int)) – A dictionary mapping LED index to state with 0 being off, 1 on and 2 inverted.

get_scp_response() CheckOKResponse[source]

Get an SCP response message to be used to process any response received.

Returns:

An SCP response, or None if no response is required

Return type:

AbstractSCPResponse

class spinnman.extended.WriteMemoryFloodProcess(next_connection_selector: ConnectionSelector)

Bases: AbstractMultiConnectionProcess

A process for writing memory on multiple SpiNNaker chips at once.

Parameters:
  • next_connection_selector (ConnectionSelector) – How to choose the connection.

  • n_retries (int) – The number of retries of a message to use. Passed to SCPRequestPipeLine

  • timeout (float) – The timeout, in seconds. Passed to SCPRequestPipeLine

  • n_channels (int) – The maximum number of channels to use when talking to a particular SCAMP instance. Passed to SCPRequestPipeLine

  • intermediate_channel_waits (int) – The maximum number of outstanding message/reply pairs to have on a particular connection. Passed to SCPRequestPipeLine

  • non_fail_retry_codes (Optional[Set[SCPResult]]) – Optional set of responses that result in retry but after retrying don’t then result in failure even if returned on the last call.

write_memory_from_bytearray(nearest_neighbour_id: int, base_address: int, data: bytes, offset: int, n_bytes: int | None = None)[source]
Parameters:
write_memory_from_reader(nearest_neighbour_id: int, base_address: int, reader: BinaryIO, n_bytes: int)[source]
Parameters: