spinnman.data package¶
Submodules¶
spinnman.data.spinnman_data_writer module¶
- class spinnman.data.spinnman_data_writer.SpiNNManDataWriter(state: DataStatus)[source]¶
Bases:
MachineDataWriter,SpiNNManDataViewSee
UtilsDataWriterThis class is designed to only be used directly within the SpiNNMan repository unit tests as all methods are available to subclasses
- Parameters:
state – State writer should be in
- set_transceiver(transceiver: Transceiver) None[source]¶
Sets the transceiver object.
- Raises:
TypeError – If the transceiver is not a Transceiver subclass
Module contents¶
- class spinnman.data.SpiNNManDataView¶
Bases:
MachineDataViewAdds the extra Methods to the View for SpiNNMan level.
See
UtilsDataViewfor 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) None[source]¶
Frees up an app_id.
previously get_transceiver().app_id_tracker().free_id(app_id)
- Parameters:
app_id
- 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.
Note
Only returns IDs obtained via this method not by direct calls to get_new_id
- Returns:
The last ID provided (or a new ID if no previous id)
- 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()
Note
Ids obtained this way are not cached so not returned by get_app_id
- Returns:
A new unallocated ID
- classmethod get_scamp_connection_selector() MostDirectConnectionSelector[source]¶
Gets the SCAMP connection selector from the transceiver.
Syntactic sugar for get_transceiver().get_scamp_connection_selector()
- Returns:
the most direct scamp connections
- Raises:
SpiNNUtilsException – If the transceiver is currently unavailable
- classmethod get_transceiver() Transceiver[source]¶
The transceiver description.
- Returns:
A previously created transceiver.
- Raises:
SpiNNUtilsException – If the transceiver is currently unavailable
- classmethod has_transceiver() bool[source]¶
Reports if a transceiver is currently set.
- Returns:
True if a transceiver is available.
- 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 – The x-coordinate of the chip where the memory is to be read from
y – The y-coordinate of the chip where the memory is to be read from
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
cpu – 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
- Raises:
SpiNNUtilsException – If the transceiver is currently unavailable
SpinnmanIOException – If there is an error communicating with the board
SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
SpinnmanInvalidParameterException –
If one of x, y, cpu, base_address or length is invalid
If a packet is received that has invalid parameters
SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
- 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 – The x-coordinate of the chip where the memory is to be written to
y – The y-coordinate of the chip where the memory is to be written to
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
A filename of a data file
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 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 – The offset from which the valid data begins
cpu – The optional CPU to write to
- Returns:
The number of bytes written, the checksum (0 if get_sum=False)
- Raises:
SpiNNUtilsException – If the transceiver is currently unavailable
If there is an error communicating with the board
If there is an error reading the data
SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
SpinnmanInvalidParameterException –
If x, y does not lead to a valid chip
If a packet is received that has invalid parameters
If base_address is not a positive integer
If data is an RawIOBase but n_bytes is not specified
If data 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