spinnman.transceiver package

Submodules

spinnman.transceiver.base_transceiver module

class spinnman.transceiver.base_transceiver.BaseTransceiver(connections: List[Connection] | None = None, power_cycle: bool = False)[source]

Bases: ExtendableTransceiver

A base for all the code shared by all Version of the Transceiver.

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:
add_cpu_information_from_core(cpu_infos: CPUInfos, x: int, y: int, p: int, states: Iterable[CPUState])[source]

Adds information about a specific processor on the board to the info

Parameters:
  • cpu_infos (CPUInfos) – Info to add data for this core to

  • 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 information about

  • states (list(CPUState)) – If provided will only add the info if in one of the states

Returns:

The CPU information for the selected core

Raises:
add_scamp_connections(connections: Dict[Tuple[int, int], str])[source]

Check connections to the board and store these for future use.

Note

An exception will be thrown if no initial connections can be found to the board.

Parameters:

connections (dict((int,int),str)) – Dict of (x,`y`) to IP address

Raises:
property bmp_selector: FixedConnectionSelector[BMPConnection] | None

Returns the BMP selector

Return type:

AbstractMultiConnectionProcessConnectionSelector

abstract property boot_led_0_value: int

The Values to be set in SpinnakerBootMessages for led_0

Rtype int:

clear_ip_tag(tag: int, board_address: str | None = None)[source]

Clear the setting of an IP tag.

Parameters:
  • tag (int) – The tag ID

  • board_address (str) – Board address where the tag should be cleared. If not specified, all AbstractSCPConnection connections will send the message to clear the tag

Raises:
clear_multicast_routes(x: int, y: int)[source]

Remove all the multicast routes on a chip.

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

  • y (int) – The y-coordinate of the chip on which to clear the routes

Raises:
clear_router_diagnostic_counters(x: int, y: int)[source]

Clear router diagnostic information on a chip.

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

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

Raises:
close() None[source]

Close the transceiver and any threads that are running.

control_sync(do_sync: bool)[source]

Control the synchronisation of the chips.

Parameters:

do_sync (bool) – Whether to synchronise or not

discover_scamp_connections() None[source]

Find connections to the board and store these for future use.

Note

An exception will be thrown if no initial connections can be found to the board.

Raises:
execute_flood(core_subsets: CoreSubsets, executable: BinaryIO | bytes | str, app_id: int, *, n_bytes: int | None = None, wait: bool = False)[source]

Start an executable running on multiple places on the board. This will be optimised based on the selected cores, but it may still require a number of communications with the board to execute.

Parameters:
  • core_subsets (CoreSubsets) – Which cores on which chips to start the executable

  • 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 * A filename of an executable

  • 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 a str, the length of the file will be used

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

Raises:
  • SpinnmanIOException

    • If there is an error communicating with the board

    • If there is an error reading the executable

  • SpinnmanInvalidPacketException – If a packet is received that is not in the valid format

  • SpinnmanInvalidParameterException

    • If one of the specified cores is not valid

    • If app_id is an invalid application ID

    • If a packet is received that has invalid parameters

    • If executable is an RawIOBase but n_bytes is not specified

    • If executable is an int and n_bytes is more than 4

    • If n_bytes is less than 0

  • SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange

get_clock_drift(x: int, y: int) float[source]

Get the clock drift.

Parameters:
  • x (int) – The x-coordinate of the chip to get drift for

  • y (int) – The y-coordinate of the chip to get drift for

get_connections() Set[Connection][source]

Get the currently known connections to the board, made up of those passed in to the transceiver and those that are discovered during calls to discover_connections. No further discovery is done here.

Returns:

An iterable of connections known to the transceiver

Return type:

set(Connection)

get_core_state_count(app_id: int, state: CPUState, xys: Iterable[Tuple[int, int]] | None = None) int[source]

Get a count of the number of cores which have a given state.

Parameters:
  • app_id (int) – The ID of the application from which to get the count.

  • state (CPUState) – The state count to get

  • xys (list(int,int)) – The chips to query, or None for all

Returns:

A count of the cores with the given status

Return type:

int

Raises:
get_cpu_infos(core_subsets: CoreSubsets | None = None, states: CPUState | Iterable[CPUState] | None = None, include: bool = True) CPUInfos[source]

Get information about the processors on the board.

Parameters:
  • core_subsets (CoreSubsets) – A set of chips and cores from which to get the information. If not specified, the information from all of the cores on all of the chips on the board are obtained.

  • states (None, CPUState or iterable(CPUState)) – The state or states to filter on (if any)

  • include (bool) – If True includes only infos in the requested state(s). If False includes only infos not in the requested state(s). Ignored if states is None.

Returns:

The CPU information for the selected cores and States, or all cores/states if core_subsets/states is not specified

Return type:

CPUInfos

Raises:
get_iobuf(core_subsets: CoreSubsets | None = None) Iterable[IOBuffer][source]

Get the contents of the IOBUF buffer for a number of processors.

Parameters:

core_subsets (CoreSubsets) – A set of chips and cores from which to get the buffers. If not specified, the buffers from all of the cores on all of the chips on the board are obtained.

Returns:

An iterable of the buffers, which may not be in the order of core_subsets

Return type:

iterable(IOBuffer)

Raises:
get_machine_details() Machine[source]

Get the details of the machine made up of chips on a board and how they are connected to each other.

Returns:

A machine description

Return type:

Machine

Raises:
get_multicast_routes(x: int, y: int, app_id: int | None = None) List[MulticastRoutingEntry][source]

Get the current multicast routes set up on a chip.

Parameters:
  • x (int) – The x-coordinate of the chip from which to get the routes

  • y (int) – The y-coordinate of the chip from which to get the routes

  • app_id (int) – The ID of the application to filter the routes for. If not specified, will return all routes

Returns:

An iterable of multicast routes

Return type:

list(MulticastRoutingEntry)

Raises:
get_region_base_address(x: int, y: int, p: int)[source]

Gets the base address of the Region Table

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 address

Returns:

The address of the Region table for the selected core

Return type:

int

Raises:
get_router_diagnostics(x: int, y: int) RouterDiagnostics[source]

Get router diagnostic information from a chip.

Parameters:
  • x (int) – The x-coordinate of the chip from which to get the information

  • y (int) – The y-coordinate of the chip from which to get the information

Returns:

The router diagnostic information

Return type:

RouterDiagnostics

Raises:
get_scamp_connection_selector() MostDirectConnectionSelector[source]

Returns the most direct scamp connections

Return type:

MostDirectConnectionSelecto

get_tags(connection: SCAMPConnection | None = None) Iterable[AbstractTag][source]

Get the current set of tags that have been set on the board.

Parameters:

connection (AbstractSCPConnection) – Connection from which the tags should be received. If not specified, all AbstractSCPConnection connections will be queried and the response will be combined.

Returns:

An iterable of tags

Return type:

iterable(AbstractTag)

Raises:
load_fixed_route(x: int, y: int, fixed_route: RoutingEntry, app_id: int)[source]

Loads a fixed route routing table entry onto a chip’s router.

Parameters:
  • x (int) – The x-coordinate of the chip onto which to load the routes

  • y (int) – The y-coordinate of the chip onto which to load the routes

  • fixed_route (RoutingEntry) – the route for the fixed route entry on this chip

  • app_id (int) – The ID of the application with which to associate the routes. If not specified, defaults to 0.

Raises:
load_multicast_routes(x: int, y: int, routes: Collection[MulticastRoutingEntry], app_id: int)[source]

Load a set of multicast routes on to a chip.

Parameters:
  • x (int) – The x-coordinate of the chip onto which to load the routes

  • y (int) – The y-coordinate of the chip onto which to load the routes

  • routes (iterable(MulticastRoutingEntry)) – An iterable of multicast routes to load

  • app_id (int) – The ID of the application with which to associate the routes. If not specified, defaults to 0.

Raises:
malloc_sdram(x: int, y: int, size: int, app_id: int, tag: int = 0) int[source]

Allocates a chunk of SDRAM on a chip on the machine.

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

  • size (int) – the amount of memory to allocate in bytes

  • app_id (int) – The ID of the application with which to associate the routes. If not specified, defaults to 0.

  • tag (int) – the tag for the SDRAM, a 8-bit (chip-wide) tag that can be looked up by a SpiNNaker application to discover the address of the allocated block. If 0 then no tag is applied.

Returns:

the base address of the allocated memory

Return type:

int

read_bmp_version(board: int) VersionInfo[source]

Read the BMP version.

Parameters:

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

Returns:

the version_info from the BMP

read_fixed_route(x: int, y: int, app_id: int) RoutingEntry[source]

Reads a fixed route routing table entry from a chip’s router.

Parameters:
  • x (int) – The x-coordinate of the chip onto which to load the routes

  • y (int) – The y-coordinate of the chip onto which to load the routes

  • app_id (int) – The ID of the application with which to associate the routes. If not specified, defaults to 0.

Returns:

the route as a fixed route entry

read_fpga_register(fpga_num: int, register: int, board: int = 0) int[source]

Read a register on a FPGA of a board. The meaning of the register’s contents will depend on the FPGA’s configuration.

Parameters:
  • fpga_num (int) – FPGA number (0, 1 or 2) to communicate with.

  • register (int) – Register address to read to (will be rounded down to the nearest 32-bit word boundary).

  • board (int) – which board to request the FPGA register from

Returns:

the register data

Return type:

int

read_memory(x: int, y: int, base_address: int, length: int, cpu: int = 0) bytearray[source]

Read some areas of memory (usually SDRAM) from the board.

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

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

  • 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

  • cpu (int) – the core ID used to read the memory of; should usually be 0 when reading from SDRAM, but may be other values when reading from DTCM.

Returns:

A bytearray of data read

Return type:

bytes

Raises:
read_user(x: int, y: int, p: int, user: UserRegister)[source]

Get the contents of the this user register for the given processor.

Note

Conventionally, user_0 usually holds the address of the table of memory regions.

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

  • y (int) – Y coordinate of the chip

  • p (int) – Virtual processor identifier on the chip

  • user (int) – The user number to read data for

Return type:

int

Raises:
read_word(x: int, y: int, base_address: int, cpu: int = 0) int[source]

Read a word (usually of SDRAM) from the board.

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

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

  • base_address (int) – The address (usually in SDRAM) where the word to be read starts

  • cpu (int) – the core ID used to read the word; should usually be 0 when reading from SDRAM, but may be other values when reading from DTCM.

Returns:

The unsigned integer value at base_address

Return type:

int

Raises:
property scamp_connection_selector: MostDirectConnectionSelector

Returns the scamp selector

Return type:

AbstractMultiConnectionProcessConnectionSelector

send_chip_update_provenance_and_exit(x: int, y: int, p: int)[source]

Sends a signal to update the provenance and exit

Parameters:
send_sdp_message(message: SDPMessage, connection: SDPConnection | None = None)[source]

Sends an SDP message using one of the connections.

Parameters:
send_signal(app_id: int, signal: Signal)[source]

Send a signal to an application.

Parameters:
  • app_id (int) – The ID of the application to send to

  • signal (Signal) – The signal to send

Raises:
set_ip_tag(ip_tag: IPTag, use_sender: bool = False)[source]

Set up an IP tag.

Parameters:
  • ip_tag (IPTag) –

    The tag to set up.

    Note

    board_address can be None, in which case, the tag will be assigned to all boards.

  • use_sender (bool) – Optionally use the sender host and port instead of the given host and port in the tag

Raises:
set_reverse_ip_tag(reverse_ip_tag: ReverseIPTag)[source]

Set up a reverse IP tag.

Parameters:

reverse_ip_tag (ReverseIPTag) –

The reverse tag to set up.

Note

The board_address field can be None, in which case, the tag will be assigned to all boards.

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

Sets a router diagnostic filter in a router.

Parameters:
  • x (int) – The X address of the router in which this filter is being set.

  • y (int) – The Y address of the router in which this filter is being set.

  • position (int) – The position in the list of filters where this filter is to be added.

  • diagnostic_filter (DiagnosticFilter) –

    The diagnostic filter being set in the placed, between 0 and 15.

    Note

    Positions 0 to 11 are used by the default filters, and setting these positions will result in a warning.

Raises:
stop_application(app_id: int)[source]

Sends a stop request for an app_id.

Parameters:

app_id (int) – The ID of the application to send to

Raises:
update_provenance_and_exit(x: int, y: int, p: int)[source]

Sends a command to update provenance and exit

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

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

  • p (int) – The processor on the core

wait_for_cores_to_be_in_state(all_core_subsets: CoreSubsets, app_id: int, cpu_states: CPUState | Iterable[CPUState], *, timeout: float | None = None, time_between_polls: float = 0.1, error_states: FrozenSet[CPUState] = frozenset({CPUState.RUN_TIME_EXCEPTION, CPUState.WATCHDOG}), counts_between_full_check: int = 100, progress_bar: ProgressBar | None = None)[source]

Waits for the specified cores running the given application to be in some target state or states. Handles failures.

Parameters:
  • all_core_subsets (CoreSubsets) – the cores to check are in a given sync state

  • app_id (int) – the application ID that being used by the simulation

  • cpu_states (CPUState or iterable(CPUState)) – The expected states once the applications are ready; success is when each application is in one of these states

  • timeout (float) – The amount of time to wait in seconds for the cores to reach one of the states

  • time_between_polls (float) – Time between checking the state

  • error_states (set(CPUState)) – Set of states that the application can be in that indicate an error, and so should raise an exception

  • counts_between_full_check (int) – The number of times to use the count signal before instead using the full CPU state check

  • progress_bar (ProgressBar or None) – Possible progress bar to update.

Raises:

SpinnmanTimeoutException – If a timeout is specified and exceeded.

write_fpga_register(fpga_num: int, register: int, value: int, board: int = 0)[source]

Write a register on a FPGA of a board. The meaning of setting the register’s contents will depend on the FPGA’s configuration.

Parameters:
  • fpga_num (int) – FPGA number (0, 1 or 2) to communicate with.

  • register (int) – Register address to read to (will be rounded down to the nearest 32-bit word boundary).

  • value (int) – the value to write into the FPGA register

  • board (int) – which board to write the FPGA register to

write_memory(x: int, y: int, base_address: int, data: BinaryIO | bytes | int | str, *, n_bytes: int | None = None, offset: int = 0, cpu: int = 0, get_sum: bool = False) Tuple[int, int][source]

Write to the SDRAM on the board.

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

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

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

    • A string - the filename of a data file

  • 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

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

  • offset (int) – The offset from which the valid data begins

  • cpu (int) – The optional CPU to write to

  • get_sum (bool) – whether to return a checksum or 0

Returns:

The number of bytes written, the checksum (0 if get_sum=False)

Return type:

int, int

Raises:
write_user(x: int, y: int, p: int, user: UserRegister, value: int)[source]

Write to the user N “register” for the given processor.

Note

Conventionally, user_0 usually holds the address of the table of memory regions.

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

  • y (int) – Y coordinate of the chip

  • p (int) – Virtual processor identifier on the chip

  • user (int) – The user “register” number of write data for

  • value (int) – The value to write

Raises:

spinnman.transceiver.extendable_transceiver module

class spinnman.transceiver.extendable_transceiver.ExtendableTransceiver[source]

Bases: Transceiver

Support Functions to allow a Transceiver to also be an ExtendedTransceiver

If supporting these is too difficult the methods that require these may be removed.

abstract property bmp_selector: FixedConnectionSelector[BMPConnection] | None

Returns the BMP selector

Return type:

AbstractMultiConnectionProcessConnectionSelector

abstract property scamp_connection_selector: ConnectionSelector

Returns the scamp selector

Return type:

AbstractMultiConnectionProcessConnectionSelector

spinnman.transceiver.version3transceiver module

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

Bases: BaseTransceiver

Implementation of the Transceiver classes for Version 3 boards

This class should ONLY be created via by transceiver_factory.py

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:
property boot_led_0_value: int

The Values to be set in SpinnakerBootMessages for led_0

Rtype int:

spinnman.transceiver.version5transceiver module

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

Bases: BaseTransceiver

Implementation of the Transceiver classes for Version 5 boards

This class should ONLY be created via by transceiver_factory.py

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:
property boot_led_0_value: int

The Values to be set in SpinnakerBootMessages for led_0

Rtype int:

spinnman.transceiver.virtual5transceiver module

class spinnman.transceiver.virtual5transceiver.Virtual5Transceiver(connections: List[Connection] | None = None, power_cycle: bool = False)[source]

Bases: Version5Transceiver

Overwrites the standard Version 5 Transceiver to intercept the sending of messages.

This is just enough different to pass know tests. Extend for new tests!

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:
get_cpu_infos(core_subsets: CoreSubsets | None = None, states: CPUState | Iterable[CPUState] | None = None, include: bool = True) CPUInfos[source]

Get information about the processors on the board.

Parameters:
  • core_subsets (CoreSubsets) – A set of chips and cores from which to get the information. If not specified, the information from all of the cores on all of the chips on the board are obtained.

  • states (None, CPUState or iterable(CPUState)) – The state or states to filter on (if any)

  • include (bool) – If True includes only infos in the requested state(s). If False includes only infos not in the requested state(s). Ignored if states is None.

Returns:

The CPU information for the selected cores and States, or all cores/states if core_subsets/states is not specified

Return type:

CPUInfos

Raises:
get_machine_details() Machine[source]

Get the details of the machine made up of chips on a board and how they are connected to each other.

Returns:

A machine description

Return type:

Machine

Raises:
read_memory(x: int, y: int, base_address: int, length: int, cpu: int = 0) bytearray[source]

Read some areas of memory (usually SDRAM) from the board.

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

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

  • 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

  • cpu (int) – the core ID used to read the memory of; should usually be 0 when reading from SDRAM, but may be other values when reading from DTCM.

Returns:

A bytearray of data read

Return type:

bytes

Raises:

Module contents

class spinnman.transceiver.MockableTransceiver

Bases: ExtendableTransceiver

A based for Mock Transceivers

add_cpu_information_from_core(cpu_infos: CPUInfos, x: int, y: int, p: int, states: Iterable[CPUState])[source]

Adds information about a specific processor on the board to the info

Parameters:
  • cpu_infos (CPUInfos) – Info to add data for this core to

  • 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 information about

  • states (list(CPUState)) – If provided will only add the info if in one of the states

Returns:

The CPU information for the selected core

Raises:
add_scamp_connections(connections: Dict[Tuple[int, int], str])[source]

Check connections to the board and store these for future use.

Note

An exception will be thrown if no initial connections can be found to the board.

Parameters:

connections (dict((int,int),str)) – Dict of (x,`y`) to IP address

Raises:
property bmp_selector: FixedConnectionSelector[BMPConnection] | None

Returns the BMP selector

Return type:

AbstractMultiConnectionProcessConnectionSelector

clear_ip_tag(tag: int, board_address: str | None = None)[source]

Clear the setting of an IP tag.

Parameters:
  • tag (int) – The tag ID

  • board_address (str) – Board address where the tag should be cleared. If not specified, all AbstractSCPConnection connections will send the message to clear the tag

Raises:
clear_multicast_routes(x: int, y: int)[source]

Remove all the multicast routes on a chip.

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

  • y (int) – The y-coordinate of the chip on which to clear the routes

Raises:
clear_router_diagnostic_counters(x: int, y: int)[source]

Clear router diagnostic information on a chip.

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

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

Raises:
close() None[source]

Close the transceiver and any threads that are running.

control_sync(do_sync: bool)[source]

Control the synchronisation of the chips.

Parameters:

do_sync (bool) – Whether to synchronise or not

discover_scamp_connections() None[source]

Find connections to the board and store these for future use.

Note

An exception will be thrown if no initial connections can be found to the board.

Raises:
execute_flood(core_subsets: CoreSubsets, executable: BinaryIO | bytes | str, app_id: int, *, n_bytes: int | None = None, wait: bool = False)[source]

Start an executable running on multiple places on the board. This will be optimised based on the selected cores, but it may still require a number of communications with the board to execute.

Parameters:
  • core_subsets (CoreSubsets) – Which cores on which chips to start the executable

  • 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 * A filename of an executable

  • 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 a str, the length of the file will be used

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

Raises:
  • SpinnmanIOException

    • If there is an error communicating with the board

    • If there is an error reading the executable

  • SpinnmanInvalidPacketException – If a packet is received that is not in the valid format

  • SpinnmanInvalidParameterException

    • If one of the specified cores is not valid

    • If app_id is an invalid application ID

    • If a packet is received that has invalid parameters

    • If executable is an RawIOBase but n_bytes is not specified

    • If executable is an int and n_bytes is more than 4

    • If n_bytes is less than 0

  • SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange

get_clock_drift(x: int, y: int) float[source]

Get the clock drift.

Parameters:
  • x (int) – The x-coordinate of the chip to get drift for

  • y (int) – The y-coordinate of the chip to get drift for

get_connections() Set[Connection][source]

Get the currently known connections to the board, made up of those passed in to the transceiver and those that are discovered during calls to discover_connections. No further discovery is done here.

Returns:

An iterable of connections known to the transceiver

Return type:

set(Connection)

get_core_state_count(app_id: int, state: CPUState, xys: Iterable[Tuple[int, int]] | None = None) int[source]

Get a count of the number of cores which have a given state.

Parameters:
  • app_id (int) – The ID of the application from which to get the count.

  • state (CPUState) – The state count to get

  • xys (list(int,int)) – The chips to query, or None for all

Returns:

A count of the cores with the given status

Return type:

int

Raises:
get_cpu_infos(core_subsets: CoreSubsets | None = None, states: CPUState | Iterable[CPUState] | None = None, include: bool = True) CPUInfos[source]

Get information about the processors on the board.

Parameters:
  • core_subsets (CoreSubsets) – A set of chips and cores from which to get the information. If not specified, the information from all of the cores on all of the chips on the board are obtained.

  • states (None, CPUState or iterable(CPUState)) – The state or states to filter on (if any)

  • include (bool) – If True includes only infos in the requested state(s). If False includes only infos not in the requested state(s). Ignored if states is None.

Returns:

The CPU information for the selected cores and States, or all cores/states if core_subsets/states is not specified

Return type:

CPUInfos

Raises:
get_iobuf(core_subsets: CoreSubsets | None = None) Iterable[IOBuffer][source]

Get the contents of the IOBUF buffer for a number of processors.

Parameters:

core_subsets (CoreSubsets) – A set of chips and cores from which to get the buffers. If not specified, the buffers from all of the cores on all of the chips on the board are obtained.

Returns:

An iterable of the buffers, which may not be in the order of core_subsets

Return type:

iterable(IOBuffer)

Raises:
get_machine_details() Machine[source]

Get the details of the machine made up of chips on a board and how they are connected to each other.

Returns:

A machine description

Return type:

Machine

Raises:
get_multicast_routes(x: int, y: int, app_id: int | None = None) List[MulticastRoutingEntry][source]

Get the current multicast routes set up on a chip.

Parameters:
  • x (int) – The x-coordinate of the chip from which to get the routes

  • y (int) – The y-coordinate of the chip from which to get the routes

  • app_id (int) – The ID of the application to filter the routes for. If not specified, will return all routes

Returns:

An iterable of multicast routes

Return type:

list(MulticastRoutingEntry)

Raises:
get_region_base_address(x: int, y: int, p: int)[source]

Gets the base address of the Region Table

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 address

Returns:

The address of the Region table for the selected core

Return type:

int

Raises:
get_router_diagnostics(x: int, y: int) RouterDiagnostics[source]

Get router diagnostic information from a chip.

Parameters:
  • x (int) – The x-coordinate of the chip from which to get the information

  • y (int) – The y-coordinate of the chip from which to get the information

Returns:

The router diagnostic information

Return type:

RouterDiagnostics

Raises:
get_scamp_connection_selector() MostDirectConnectionSelector[source]

Returns the most direct scamp connections

Return type:

MostDirectConnectionSelecto

get_tags(connection: SCAMPConnection | None = None) Iterable[AbstractTag][source]

Get the current set of tags that have been set on the board.

Parameters:

connection (AbstractSCPConnection) – Connection from which the tags should be received. If not specified, all AbstractSCPConnection connections will be queried and the response will be combined.

Returns:

An iterable of tags

Return type:

iterable(AbstractTag)

Raises:
load_fixed_route(x: int, y: int, fixed_route: RoutingEntry, app_id: int)[source]

Loads a fixed route routing table entry onto a chip’s router.

Parameters:
  • x (int) – The x-coordinate of the chip onto which to load the routes

  • y (int) – The y-coordinate of the chip onto which to load the routes

  • fixed_route (RoutingEntry) – the route for the fixed route entry on this chip

  • app_id (int) – The ID of the application with which to associate the routes. If not specified, defaults to 0.

Raises:
load_multicast_routes(x: int, y: int, routes: Collection[MulticastRoutingEntry], app_id: int)[source]

Load a set of multicast routes on to a chip.

Parameters:
  • x (int) – The x-coordinate of the chip onto which to load the routes

  • y (int) – The y-coordinate of the chip onto which to load the routes

  • routes (iterable(MulticastRoutingEntry)) – An iterable of multicast routes to load

  • app_id (int) – The ID of the application with which to associate the routes. If not specified, defaults to 0.

Raises:
malloc_sdram(x: int, y: int, size: int, app_id: int, tag: int = 0) int[source]

Allocates a chunk of SDRAM on a chip on the machine.

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

  • size (int) – the amount of memory to allocate in bytes

  • app_id (int) – The ID of the application with which to associate the routes. If not specified, defaults to 0.

  • tag (int) – the tag for the SDRAM, a 8-bit (chip-wide) tag that can be looked up by a SpiNNaker application to discover the address of the allocated block. If 0 then no tag is applied.

Returns:

the base address of the allocated memory

Return type:

int

read_bmp_version(board: int) VersionInfo[source]

Read the BMP version.

Parameters:

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

Returns:

the version_info from the BMP

read_fixed_route(x: int, y: int, app_id: int) RoutingEntry[source]

Reads a fixed route routing table entry from a chip’s router.

Parameters:
  • x (int) – The x-coordinate of the chip onto which to load the routes

  • y (int) – The y-coordinate of the chip onto which to load the routes

  • app_id (int) – The ID of the application with which to associate the routes. If not specified, defaults to 0.

Returns:

the route as a fixed route entry

read_fpga_register(fpga_num: int, register: int, board: int = 0) int[source]

Read a register on a FPGA of a board. The meaning of the register’s contents will depend on the FPGA’s configuration.

Parameters:
  • fpga_num (int) – FPGA number (0, 1 or 2) to communicate with.

  • register (int) – Register address to read to (will be rounded down to the nearest 32-bit word boundary).

  • board (int) – which board to request the FPGA register from

Returns:

the register data

Return type:

int

read_memory(x: int, y: int, base_address: int, length: int, cpu: int = 0) bytearray[source]

Read some areas of memory (usually SDRAM) from the board.

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

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

  • 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

  • cpu (int) – the core ID used to read the memory of; should usually be 0 when reading from SDRAM, but may be other values when reading from DTCM.

Returns:

A bytearray of data read

Return type:

bytes

Raises:
read_user(x: int, y: int, p: int, user: UserRegister)[source]

Get the contents of the this user register for the given processor.

Note

Conventionally, user_0 usually holds the address of the table of memory regions.

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

  • y (int) – Y coordinate of the chip

  • p (int) – Virtual processor identifier on the chip

  • user (int) – The user number to read data for

Return type:

int

Raises:
read_word(x: int, y: int, base_address: int, cpu: int = 0) int[source]

Read a word (usually of SDRAM) from the board.

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

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

  • base_address (int) – The address (usually in SDRAM) where the word to be read starts

  • cpu (int) – the core ID used to read the word; should usually be 0 when reading from SDRAM, but may be other values when reading from DTCM.

Returns:

The unsigned integer value at base_address

Return type:

int

Raises:
property scamp_connection_selector: ConnectionSelector

Returns the scamp selector

Return type:

AbstractMultiConnectionProcessConnectionSelector

send_chip_update_provenance_and_exit(x: int, y: int, p: int)[source]

Sends a signal to update the provenance and exit

Parameters:
send_sdp_message(message: SDPMessage, connection: SDPConnection | None = None)[source]

Sends an SDP message using one of the connections.

Parameters:
send_signal(app_id: int, signal: Signal)[source]

Send a signal to an application.

Parameters:
  • app_id (int) – The ID of the application to send to

  • signal (Signal) – The signal to send

Raises:
set_ip_tag(ip_tag: IPTag, use_sender: bool = False)[source]

Set up an IP tag.

Parameters:
  • ip_tag (IPTag) –

    The tag to set up.

    Note

    board_address can be None, in which case, the tag will be assigned to all boards.

  • use_sender (bool) – Optionally use the sender host and port instead of the given host and port in the tag

Raises:
set_reverse_ip_tag(reverse_ip_tag: ReverseIPTag)[source]

Set up a reverse IP tag.

Parameters:

reverse_ip_tag (ReverseIPTag) –

The reverse tag to set up.

Note

The board_address field can be None, in which case, the tag will be assigned to all boards.

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

Sets a router diagnostic filter in a router.

Parameters:
  • x (int) – The X address of the router in which this filter is being set.

  • y (int) – The Y address of the router in which this filter is being set.

  • position (int) – The position in the list of filters where this filter is to be added.

  • diagnostic_filter (DiagnosticFilter) –

    The diagnostic filter being set in the placed, between 0 and 15.

    Note

    Positions 0 to 11 are used by the default filters, and setting these positions will result in a warning.

Raises:
stop_application(app_id: int)[source]

Sends a stop request for an app_id.

Parameters:

app_id (int) – The ID of the application to send to

Raises:
update_provenance_and_exit(x: int, y: int, p: int)[source]

Sends a command to update provenance and exit

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

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

  • p (int) – The processor on the core

wait_for_cores_to_be_in_state(all_core_subsets: CoreSubsets, app_id: int, cpu_states: CPUState | Iterable[CPUState], *, timeout: float | None = None, time_between_polls: float = 0.1, error_states: FrozenSet[CPUState] = frozenset({CPUState.RUN_TIME_EXCEPTION, CPUState.WATCHDOG}), counts_between_full_check: int = 100, progress_bar: ProgressBar | None = None)[source]

Waits for the specified cores running the given application to be in some target state or states. Handles failures.

Parameters:
  • all_core_subsets (CoreSubsets) – the cores to check are in a given sync state

  • app_id (int) – the application ID that being used by the simulation

  • cpu_states (CPUState or iterable(CPUState)) – The expected states once the applications are ready; success is when each application is in one of these states

  • timeout (float) – The amount of time to wait in seconds for the cores to reach one of the states

  • time_between_polls (float) – Time between checking the state

  • error_states (set(CPUState)) – Set of states that the application can be in that indicate an error, and so should raise an exception

  • counts_between_full_check (int) – The number of times to use the count signal before instead using the full CPU state check

  • progress_bar (ProgressBar or None) – Possible progress bar to update.

Raises:

SpinnmanTimeoutException – If a timeout is specified and exceeded.

write_fpga_register(fpga_num: int, register: int, value: int, board: int = 0)[source]

Write a register on a FPGA of a board. The meaning of setting the register’s contents will depend on the FPGA’s configuration.

Parameters:
  • fpga_num (int) – FPGA number (0, 1 or 2) to communicate with.

  • register (int) – Register address to read to (will be rounded down to the nearest 32-bit word boundary).

  • value (int) – the value to write into the FPGA register

  • board (int) – which board to write the FPGA register to

write_memory(x: int, y: int, base_address: int, data: BinaryIO | bytes | int | str, *, n_bytes: int | None = None, offset: int = 0, cpu: int = 0, get_sum: bool = False) Tuple[int, int][source]

Write to the SDRAM on the board.

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

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

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

    • A string - the filename of a data file

  • 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

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

  • offset (int) – The offset from which the valid data begins

  • cpu (int) – The optional CPU to write to

  • get_sum (bool) – whether to return a checksum or 0

Returns:

The number of bytes written, the checksum (0 if get_sum=False)

Return type:

int, int

Raises:
write_user(x: int, y: int, p: int, user: UserRegister, value: int)[source]

Write to the user N “register” for the given processor.

Note

Conventionally, user_0 usually holds the address of the table of memory regions.

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

  • y (int) – Y coordinate of the chip

  • p (int) – Virtual processor identifier on the chip

  • user (int) – The user “register” number of write data for

  • value (int) – The value to write

Raises:
written_memory
class spinnman.transceiver.Transceiver

Bases: object

An encapsulation of various communications with the SpiNNaker board.

The methods of this class are designed to be thread-safe (provided they do not access a BMP, as access to those is never thread-safe); thus you can make multiple calls to the same (or different) methods from multiple threads and expect each call to work as if it had been called sequentially, although the order of returns is not guaranteed.

Note

With multiple connections to the board, using multiple threads in this way may result in an increase in the overall speed of operation, since the multiple calls may be made separately over the set of given connections.

abstract add_cpu_information_from_core(cpu_infos: CPUInfos, x: int, y: int, p: int, states: Iterable[CPUState])[source]

Adds information about a specific processor on the board to the info

Parameters:
  • cpu_infos (CPUInfos) – Info to add data for this core to

  • 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 information about

  • states (list(CPUState)) – If provided will only add the info if in one of the states

Returns:

The CPU information for the selected core

Raises:
abstract add_scamp_connections(connections: Dict[Tuple[int, int], str])[source]

Check connections to the board and store these for future use.

Note

An exception will be thrown if no initial connections can be found to the board.

Parameters:

connections (dict((int,int),str)) – Dict of (x,`y`) to IP address

Raises:
abstract clear_ip_tag(tag: int, board_address: str | None = None)[source]

Clear the setting of an IP tag.

Parameters:
  • tag (int) – The tag ID

  • board_address (str) – Board address where the tag should be cleared. If not specified, all AbstractSCPConnection connections will send the message to clear the tag

Raises:
abstract clear_multicast_routes(x: int, y: int)[source]

Remove all the multicast routes on a chip.

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

  • y (int) – The y-coordinate of the chip on which to clear the routes

Raises:
abstract clear_router_diagnostic_counters(x: int, y: int)[source]

Clear router diagnostic information on a chip.

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

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

Raises:
abstract close() None[source]

Close the transceiver and any threads that are running.

abstract control_sync(do_sync: bool)[source]

Control the synchronisation of the chips.

Parameters:

do_sync (bool) – Whether to synchronise or not

abstract discover_scamp_connections() None[source]

Find connections to the board and store these for future use.

Note

An exception will be thrown if no initial connections can be found to the board.

Raises:
abstract execute_flood(core_subsets: CoreSubsets, executable: BinaryIO | bytes | str, app_id: int, *, n_bytes: int | None = None, wait: bool = False)[source]

Start an executable running on multiple places on the board. This will be optimised based on the selected cores, but it may still require a number of communications with the board to execute.

Parameters:
  • core_subsets (CoreSubsets) – Which cores on which chips to start the executable

  • 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 * A filename of an executable

  • 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 a str, the length of the file will be used

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

Raises:
  • SpinnmanIOException

    • If there is an error communicating with the board

    • If there is an error reading the executable

  • SpinnmanInvalidPacketException – If a packet is received that is not in the valid format

  • SpinnmanInvalidParameterException

    • If one of the specified cores is not valid

    • If app_id is an invalid application ID

    • If a packet is received that has invalid parameters

    • If executable is an RawIOBase but n_bytes is not specified

    • If executable is an int and n_bytes is more than 4

    • If n_bytes is less than 0

  • SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange

abstract get_clock_drift(x: int, y: int) float[source]

Get the clock drift.

Parameters:
  • x (int) – The x-coordinate of the chip to get drift for

  • y (int) – The y-coordinate of the chip to get drift for

abstract get_connections() Set[Connection][source]

Get the currently known connections to the board, made up of those passed in to the transceiver and those that are discovered during calls to discover_connections. No further discovery is done here.

Returns:

An iterable of connections known to the transceiver

Return type:

set(Connection)

abstract get_core_state_count(app_id: int, state: CPUState, xys: Iterable[Tuple[int, int]] | None = None) int[source]

Get a count of the number of cores which have a given state.

Parameters:
  • app_id (int) – The ID of the application from which to get the count.

  • state (CPUState) – The state count to get

  • xys (list(int,int)) – The chips to query, or None for all

Returns:

A count of the cores with the given status

Return type:

int

Raises:
abstract get_cpu_infos(core_subsets: CoreSubsets | None = None, states: CPUState | Iterable[CPUState] | None = None, include: bool = True) CPUInfos[source]

Get information about the processors on the board.

Parameters:
  • core_subsets (CoreSubsets) – A set of chips and cores from which to get the information. If not specified, the information from all of the cores on all of the chips on the board are obtained.

  • states (None, CPUState or iterable(CPUState)) – The state or states to filter on (if any)

  • include (bool) – If True includes only infos in the requested state(s). If False includes only infos not in the requested state(s). Ignored if states is None.

Returns:

The CPU information for the selected cores and States, or all cores/states if core_subsets/states is not specified

Return type:

CPUInfos

Raises:
abstract get_iobuf(core_subsets: CoreSubsets | None = None) Iterable[IOBuffer][source]

Get the contents of the IOBUF buffer for a number of processors.

Parameters:

core_subsets (CoreSubsets) – A set of chips and cores from which to get the buffers. If not specified, the buffers from all of the cores on all of the chips on the board are obtained.

Returns:

An iterable of the buffers, which may not be in the order of core_subsets

Return type:

iterable(IOBuffer)

Raises:
abstract get_machine_details() Machine[source]

Get the details of the machine made up of chips on a board and how they are connected to each other.

Returns:

A machine description

Return type:

Machine

Raises:
abstract get_multicast_routes(x: int, y: int, app_id: int | None = None) List[MulticastRoutingEntry][source]

Get the current multicast routes set up on a chip.

Parameters:
  • x (int) – The x-coordinate of the chip from which to get the routes

  • y (int) – The y-coordinate of the chip from which to get the routes

  • app_id (int) – The ID of the application to filter the routes for. If not specified, will return all routes

Returns:

An iterable of multicast routes

Return type:

list(MulticastRoutingEntry)

Raises:
abstract get_region_base_address(x: int, y: int, p: int)[source]

Gets the base address of the Region Table

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 address

Returns:

The address of the Region table for the selected core

Return type:

int

Raises:
abstract get_router_diagnostics(x: int, y: int) RouterDiagnostics[source]

Get router diagnostic information from a chip.

Parameters:
  • x (int) – The x-coordinate of the chip from which to get the information

  • y (int) – The y-coordinate of the chip from which to get the information

Returns:

The router diagnostic information

Return type:

RouterDiagnostics

Raises:
abstract get_scamp_connection_selector() MostDirectConnectionSelector[source]

Returns the most direct scamp connections

Return type:

MostDirectConnectionSelecto

abstract get_tags(connection: SCAMPConnection | None = None) Iterable[AbstractTag][source]

Get the current set of tags that have been set on the board.

Parameters:

connection (AbstractSCPConnection) – Connection from which the tags should be received. If not specified, all AbstractSCPConnection connections will be queried and the response will be combined.

Returns:

An iterable of tags

Return type:

iterable(AbstractTag)

Raises:
abstract load_fixed_route(x: int, y: int, fixed_route: RoutingEntry, app_id: int)[source]

Loads a fixed route routing table entry onto a chip’s router.

Parameters:
  • x (int) – The x-coordinate of the chip onto which to load the routes

  • y (int) – The y-coordinate of the chip onto which to load the routes

  • fixed_route (RoutingEntry) – the route for the fixed route entry on this chip

  • app_id (int) – The ID of the application with which to associate the routes. If not specified, defaults to 0.

Raises:
abstract load_multicast_routes(x: int, y: int, routes: Collection[MulticastRoutingEntry], app_id: int)[source]

Load a set of multicast routes on to a chip.

Parameters:
  • x (int) – The x-coordinate of the chip onto which to load the routes

  • y (int) – The y-coordinate of the chip onto which to load the routes

  • routes (iterable(MulticastRoutingEntry)) – An iterable of multicast routes to load

  • app_id (int) – The ID of the application with which to associate the routes. If not specified, defaults to 0.

Raises:
abstract malloc_sdram(x: int, y: int, size: int, app_id: int, tag: int = 0) int[source]

Allocates a chunk of SDRAM on a chip on the machine.

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

  • size (int) – the amount of memory to allocate in bytes

  • app_id (int) – The ID of the application with which to associate the routes. If not specified, defaults to 0.

  • tag (int) – the tag for the SDRAM, a 8-bit (chip-wide) tag that can be looked up by a SpiNNaker application to discover the address of the allocated block. If 0 then no tag is applied.

Returns:

the base address of the allocated memory

Return type:

int

abstract read_bmp_version(board: int) VersionInfo[source]

Read the BMP version.

Parameters:

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

Returns:

the version_info from the BMP

abstract read_fixed_route(x: int, y: int, app_id: int) RoutingEntry[source]

Reads a fixed route routing table entry from a chip’s router.

Parameters:
  • x (int) – The x-coordinate of the chip onto which to load the routes

  • y (int) – The y-coordinate of the chip onto which to load the routes

  • app_id (int) – The ID of the application with which to associate the routes. If not specified, defaults to 0.

Returns:

the route as a fixed route entry

abstract read_fpga_register(fpga_num: int, register: int, board: int = 0) int[source]

Read a register on a FPGA of a board. The meaning of the register’s contents will depend on the FPGA’s configuration.

Parameters:
  • fpga_num (int) – FPGA number (0, 1 or 2) to communicate with.

  • register (int) – Register address to read to (will be rounded down to the nearest 32-bit word boundary).

  • board (int) – which board to request the FPGA register from

Returns:

the register data

Return type:

int

abstract read_memory(x: int, y: int, base_address: int, length: int, cpu: int = 0) bytearray[source]

Read some areas of memory (usually SDRAM) from the board.

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

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

  • 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

  • cpu (int) – the core ID used to read the memory of; should usually be 0 when reading from SDRAM, but may be other values when reading from DTCM.

Returns:

A bytearray of data read

Return type:

bytes

Raises:
abstract read_user(x: int, y: int, p: int, user: UserRegister)[source]

Get the contents of the this user register for the given processor.

Note

Conventionally, user_0 usually holds the address of the table of memory regions.

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

  • y (int) – Y coordinate of the chip

  • p (int) – Virtual processor identifier on the chip

  • user (int) – The user number to read data for

Return type:

int

Raises:
abstract read_word(x: int, y: int, base_address: int, cpu: int = 0) int[source]

Read a word (usually of SDRAM) from the board.

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

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

  • base_address (int) – The address (usually in SDRAM) where the word to be read starts

  • cpu (int) – the core ID used to read the word; should usually be 0 when reading from SDRAM, but may be other values when reading from DTCM.

Returns:

The unsigned integer value at base_address

Return type:

int

Raises:
abstract send_chip_update_provenance_and_exit(x: int, y: int, p: int)[source]

Sends a signal to update the provenance and exit

Parameters:
abstract send_sdp_message(message: SDPMessage, connection: SDPConnection | None = None)[source]

Sends an SDP message using one of the connections.

Parameters:
abstract send_signal(app_id: int, signal: Signal)[source]

Send a signal to an application.

Parameters:
  • app_id (int) – The ID of the application to send to

  • signal (Signal) – The signal to send

Raises:
abstract set_ip_tag(ip_tag: IPTag, use_sender: bool = False)[source]

Set up an IP tag.

Parameters:
  • ip_tag (IPTag) –

    The tag to set up.

    Note

    board_address can be None, in which case, the tag will be assigned to all boards.

  • use_sender (bool) – Optionally use the sender host and port instead of the given host and port in the tag

Raises:
abstract set_reverse_ip_tag(reverse_ip_tag: ReverseIPTag)[source]

Set up a reverse IP tag.

Parameters:

reverse_ip_tag (ReverseIPTag) –

The reverse tag to set up.

Note

The board_address field can be None, in which case, the tag will be assigned to all boards.

Raises:
abstract set_router_diagnostic_filter(x: int, y: int, position: int, diagnostic_filter: DiagnosticFilter)[source]

Sets a router diagnostic filter in a router.

Parameters:
  • x (int) – The X address of the router in which this filter is being set.

  • y (int) – The Y address of the router in which this filter is being set.

  • position (int) – The position in the list of filters where this filter is to be added.

  • diagnostic_filter (DiagnosticFilter) –

    The diagnostic filter being set in the placed, between 0 and 15.

    Note

    Positions 0 to 11 are used by the default filters, and setting these positions will result in a warning.

Raises:
abstract stop_application(app_id: int)[source]

Sends a stop request for an app_id.

Parameters:

app_id (int) – The ID of the application to send to

Raises:
abstract update_provenance_and_exit(x: int, y: int, p: int)[source]

Sends a command to update provenance and exit

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

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

  • p (int) – The processor on the core

abstract wait_for_cores_to_be_in_state(all_core_subsets: CoreSubsets, app_id: int, cpu_states: CPUState | Iterable[CPUState], *, timeout: float | None = None, time_between_polls: float = 0.1, error_states: FrozenSet[CPUState] = frozenset({CPUState.RUN_TIME_EXCEPTION, CPUState.WATCHDOG}), counts_between_full_check: int = 100, progress_bar: ProgressBar | None = None)[source]

Waits for the specified cores running the given application to be in some target state or states. Handles failures.

Parameters:
  • all_core_subsets (CoreSubsets) – the cores to check are in a given sync state

  • app_id (int) – the application ID that being used by the simulation

  • cpu_states (CPUState or iterable(CPUState)) – The expected states once the applications are ready; success is when each application is in one of these states

  • timeout (float) – The amount of time to wait in seconds for the cores to reach one of the states

  • time_between_polls (float) – Time between checking the state

  • error_states (set(CPUState)) – Set of states that the application can be in that indicate an error, and so should raise an exception

  • counts_between_full_check (int) – The number of times to use the count signal before instead using the full CPU state check

  • progress_bar (ProgressBar or None) – Possible progress bar to update.

Raises:

SpinnmanTimeoutException – If a timeout is specified and exceeded.

abstract write_fpga_register(fpga_num: int, register: int, value: int, board: int = 0)[source]

Write a register on a FPGA of a board. The meaning of setting the register’s contents will depend on the FPGA’s configuration.

Parameters:
  • fpga_num (int) – FPGA number (0, 1 or 2) to communicate with.

  • register (int) – Register address to read to (will be rounded down to the nearest 32-bit word boundary).

  • value (int) – the value to write into the FPGA register

  • board (int) – which board to write the FPGA register to

abstract write_memory(x: int, y: int, base_address: int, data: BinaryIO | bytes | int | str, *, n_bytes: int | None = None, offset: int = 0, cpu: int = 0, get_sum: bool = False) Tuple[int, int][source]

Write to the SDRAM on the board.

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

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

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

    • A string - the filename of a data file

  • 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

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

  • offset (int) – The offset from which the valid data begins

  • cpu (int) – The optional CPU to write to

  • get_sum (bool) – whether to return a checksum or 0

Returns:

The number of bytes written, the checksum (0 if get_sum=False)

Return type:

int, int

Raises:
abstract write_user(x: int, y: int, p: int, user: UserRegister, value: int)[source]

Write to the user N “register” for the given processor.

Note

Conventionally, user_0 usually holds the address of the table of memory regions.

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

  • y (int) – Y coordinate of the chip

  • p (int) – Virtual processor identifier on the chip

  • user (int) – The user “register” number of write data for

  • value (int) – The value to write

Raises:
spinnman.transceiver.create_transceiver_from_connections(connections: List[Connection], virtual: bool = False, power_cycle: bool = False, extended: bool = False) Transceiver

Create a Transceiver with these connections

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

  • virtual (bool) – If True will return a virtual Transceiver

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

  • extended (bool)

Returns:

The created transceiver

Return type:

spinnman.transceiver.Transceiver

Raises:
spinnman.transceiver.create_transceiver_from_hostname(hostname: str | None, *, bmp_connection_data: BMPConnectionData | None = None, auto_detect_bmp: bool = False, power_cycle: bool = False, extended: bool = False) Transceiver

Create a Transceiver by creating a UDPConnection to the given hostname on port 17893 (the default SCAMP port), and a BootConnection on port 54321 (the default boot port), optionally discovering any additional links using the UDPConnection, and then returning the transceiver created with the conjunction of the created UDPConnection and the discovered connections.

Parameters:
  • hostname (str or None) – The hostname or IP address of the board or None if only the BMP connections are of interest

  • bmp_connection_data (BMPConnectionData) – the details of the BMP connections used to boot multi-board systems

  • auto_detect_bmp (bool) – True if the BMP of version 4 or 5 boards should be automatically determined from the board IP address

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

  • scamp_connections – the list of connections used for SCAMP communications

  • extended (bool) – If True will return an Extended version of the Transceiver

Returns:

The created transceiver

Return type:

spinnman.transceiver.Transceiver

Raises: