spinnman.data package

Submodules

spinnman.data.spinnman_data_writer module

class spinnman.data.spinnman_data_writer.SpiNNManDataWriter(state: DataStatus)[source]

Bases: MachineDataWriter, SpiNNManDataView

See UtilsDataWriter

This class is designed to only be used directly within the SpiNNMan repository unit tests as all methods are available to subclasses

Parameters:

state (DataStatus) – State writer should be in

set_transceiver(transceiver: Transceiver)[source]

Sets the transceiver object.

Parameters:

transceiver (Transceiver)

Raises:

TypeError – If the transceiver is not a Transceiver subclass

Module contents

class spinnman.data.SpiNNManDataView

Bases: MachineDataView

Adds the extra Methods to the View for SpiNNMan level.

See UtilsDataView for a more detailed description.

This class is designed to only be used directly within the SpiNNMan repository as all methods are available to subclasses

classmethod free_id(app_id: int)[source]

Frees up an app_id.

previously get_transceiver().app_id_tracker().free_id(app_id)

Parameters:

app_id (int)

classmethod get_app_id() int[source]

Gets the main app_id used by the transceiver.

This method will create a new app_id if one has not yet been created.

Return type:

int

classmethod get_new_id() int[source]

Gets a new id from the current app_id_tracker

previously get_transceiver().app_id_tracker().get_new_id()

Return type:

AppIdTracker

classmethod get_scamp_connection_selector() MostDirectConnectionSelector[source]

Gets the SCAMP connection selector from the transceiver.

Syntactic sugar for get_transceiver().get_scamp_connection_selector()

Return type:

MostDirectConnectionSelector

Raises:

SpiNNUtilsException – If the transceiver is currently unavailable

classmethod get_transceiver() Transceiver[source]

The transceiver description.

Return type:

Transceiver

Raises:

SpiNNUtilsException – If the transceiver is currently unavailable

classmethod has_transceiver() bool[source]

Reports if a transceiver is currently set.

Return type:

bool

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

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

Syntactic sugar for get_transceiver().read_memory().

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:
classmethod write_memory(x: int, y: int, base_address: int, data: BinaryIO | bytes | bytearray | int | str, *, n_bytes: int | None = None, offset: int = 0, cpu: int = 0) Tuple[int, int][source]

Write to the SDRAM on the board.

Syntactic sugar for get_transceiver().write_memory().

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 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 byte string (bytearray or bytes), the length of the byte string 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

Raises: