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

Typing is best effort as without use there is no way to check

execute(x: int, y: int, processors: List[int], executable: BinaryIO | bytes | int | str, app_id: int, n_bytes: int | None = None, wait: bool = False) None[source]

Start an executable running on a single chip.

Warning

This method is currently deprecated and likely to be removed.

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

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

  • processors – The cores on the chip on which to run the application

  • executable

    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 – The the application with which to associate the executable

  • n_bytes

    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 – True if the binary should enter a “wait” state on loading

Raises:
execute_application(executable_targets: ExecutableTargets, app_id: int) None[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 – The binaries to be executed and the cores to execute them on

  • app_id – The app_id to give this application

free_sdram(x: int, y: int, base_address: int) None[source]

Free allocated SDRAM.

Warning

This method is currently deprecated and likely to be removed.

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

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

  • base_address – The base address of the allocated memory

free_sdram_by_app_id(x: int, y: int, app_id: int) int | None[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 – The x-coordinate of the chip onto which to ask for memory

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

  • app_id – The app ID of the allocated memory

Returns:

The number of blocks freed

get_heap(x: int, y: int, heap: SystemVariableDefinition = SystemVariableDefinition.sdram_heap_address) Sequence[HeapElement][source]

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

Parameters:
  • x – The x-coordinate of the chip

  • y – The y-coordinate of the chip

  • heap – The SystemVariableDefinition which is the heap to read

Returns:

List of HeapElements

get_iobuf_from_core(x: int, y: int, p: int) IOBuffer[source]

Get the contents of IOBUF for a given core.

Warning

This method is currently deprecated and likely to be removed.

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

  • y – The y-coordinate of the chip containing the processor

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

Returns:

An IOBUF buffer

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

Gets a router diagnostic filter from a router.

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

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

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

Returns:

The diagnostic filter read

Raises:
is_connected(connection: Connection | None = None) bool[source]

Determines if the board can be contacted via SCAMP

Parameters:

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

property number_of_boards_located: int

The number of boards currently configured.

Warning

This property is currently deprecated and likely to be removed.

read_adc_data(board: int) ADCInfo[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 – which board to request the ADC data from

Returns:

the FPGA’s ADC data object

read_neighbour_memory(x: int, y: int, link: int, base_address: int, length: int, cpu: int = 0) bytearray[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 – The x-coordinate of the chip whose neighbour is to be read from

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

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

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

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

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

Returns:

An iterable of chunks of data read in order

Raises:
set_led(led: int | Iterable[int], action: LEDAction, board: int | Iterable[int]) None[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 – Number of the LED or an iterable of LEDs to set the state of (0-7)

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

  • board – 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: int, y: int, cpu: int, led_states: Mapping[int, int]) None[source]

Set LED states.

Warning

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

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

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

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

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

Raises:
set_watch_dog(watch_dog: int | bool) None[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 – 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: int, data: BinaryIO | str | int | bytes, n_bytes: int | None = None, offset: int = 0, is_filename: bool = False) None[source]

Write to the SDRAM of all chips.

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

  • data

    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

    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 – The offset where the valid data starts; if data is an int, then the offset will be ignored and 0 is used.

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

Raises:
write_neighbour_memory(x: int, y: int, link: int, base_address: int, data: BinaryIO | str | int | bytes, n_bytes: int | None = None, offset: int = 0, cpu: int = 0) None[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 – The x-coordinate of the chip whose neighbour is to be written to

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

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

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

  • data

    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

    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 – The offset where the valid data starts (if data is an int then offset will be ignored and used 0)

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

Raises:

spinnman.extended.version3transceiver module

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

Bases: Version3Transceiver, ExtendedTransceiver

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

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

  • power_cycle – If True will power cycle the machine:

  • ensure_board_is_ready – Flag to say if ensure_board_is_ready should be run

  • connections – An iterable of connections to the board. If not specified, no communication will be possible until connections are found.

  • power_cycle – If True will power cycle the machine:

  • ensure_board_is_ready – Flag to say if ensure_board_is_ready should be run

Raises:

spinnman.extended.version5transceiver module

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

Bases: Version5Transceiver, ExtendedTransceiver

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

param connections:

An iterable of connections to the board. If not specified, no communication will be possible until connections are found.

param power_cycle:

If True will power cycle the machine:

param ensure_board_is_ready:

Flag to say if ensure_board_is_ready should be run

raise SpinnmanIOException:

If there is an error communicating with the board, or if no connections to the board can be found (if connections is None)

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

raise SpinnmanUnexpectedResponseCodeException:

If a response indicates an error during the exchange

Parameters:

connections

An iterable of connections to the board. If not specified, no communication will be possible until connections are found.

param power_cycle:

If True will power cycle the machine:

param ensure_board_is_ready:

Flag to say if ensure_board_is_ready should be run

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 – Number of the LED or an iterable of LEDs to set the state of (0-7)

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

  • boards – 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

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

de_alloc_all_app_sdram(x: int, y: int, app_id: int) None[source]

Currently not used!

Parameters:
  • x

  • y

  • app_id

de_alloc_sdram(x: int, y: int, base_address: int) None[source]

Currently not used!

Parameters:
  • x

  • y

  • base_address

property no_blocks_freed: int | None

number of blocks freed

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 – 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

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 – The x-coordinate of the chip, between 0 and 255

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

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

  • led_states – 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

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 – How to choose the connection.

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

Currently not used!

Parameters:
  • nearest_neighbour_id

  • base_address

  • data

  • offset

  • n_bytes

write_memory_from_reader(nearest_neighbour_id: int, base_address: int, reader: BinaryIO, n_bytes: int) None[source]

Currently not used!

Parameters:
  • nearest_neighbour_id

  • base_address

  • reader

  • n_bytes