spinnman.model package

Subpackages

Module contents

class spinnman.model.ADCInfo(adc_data: bytes, offset: int)

Bases: object

Container for the ADC data that’s been retrieved from an FPGA.

Parameters:

adc_data – bytes from an SCP packet containing ADC information

Raises:

SpinnmanInvalidParameterException – If the message does not contain valid ADC information

property fan_0: float | None

Fan 0.

property fan_1: float | None

Fan 1.

property temp_btm: float

Temperature bottom.

property temp_ext_0: float | None

Temperature external 0.

property temp_ext_1: float | None

Temperature external 1.

property temp_top: float

Temperature top.

property voltage_1_2a: float

Actual voltage of the 1.2V a supply rail.

property voltage_1_2b: float

Actual voltage of the 1.2V b supply rail.

property voltage_1_2c: float

Actual voltage of the 1.2V c supply rail.

property voltage_1_8: float

Actual voltage of the 1.8V supply rail.

property voltage_3_3: float

Actual voltage of the 3.3V supply rail.

property voltage_supply: float

Actual voltage of the main power supply (nominally 12V).

class spinnman.model.BMPConnectionData(ip_address: str, boards: Sequence[int], port_num: int | None)

Bases: object

Contains the details of a BMP connection.

property boards: Sequence[int]

The boards to be addressed.

property ip_address: str

The IP address of the BMP.

property port_num: int | None

The port number associated with this BMP connection.

class spinnman.model.CPUInfo(x: int, y: int, p: int, cpu_data: Tuple[bytes, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, bytes, int, int, int, int, int, int])

Bases: object

Represents information about the state of a CPU.

This is the content of the vcpu_t for the processor, maintained by SARK.

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

  • y – The y-coordinate of a chip

  • p – The ID of a core on the chip

  • cpu_data – A byte-string received from SDRAM on the board

property application_id: int

The ID of the application running on the core.

Returns:

The ID of the application

property application_mailbox_command: MailboxCommand

The command currently in the mailbox being sent from the monitor processor to the application.

Returns:

The command

property application_mailbox_data_address: int

The address of the data in SDRAM for the application mailbox.

Returns:

The address of the data

property application_name: str

The name of the application running on the core.

Returns:

The name of the application

get_status_string() str[source]

Get a string indicating the status of the given core.

property iobuf_address: int

The address of the IOBUF buffer in SDRAM.

Returns:

The address

The current link register value.

Returns:

The link register value

static mock_info(x: int, y: int, p: int, physical_cpu_id: int, state: CPUState) CPUInfo[source]

Makes a CPU_info object for Testing purposes

property monitor_mailbox_command: MailboxCommand

The command currently in the mailbox being sent from the application to the monitor processor.

Returns:

The command

property monitor_mailbox_data_address: int

The address of the data in SDRAM of the monitor mailbox.

Returns:

The address of the data

property p: int

The ID of the core on the chip.

Returns:

The ID of the core

property physical_cpu_id: int

The physical ID of this processor.

Returns:

The physical ID of the processor

property processor_state_register: int

The value in the processor state register.

Returns:

The processor state register value

property registers: Sequence[int]

The current register values (r0 - r7).

Returns:

An array of 8 values, one for each register

property run_time_error: RunTimeError

The reason for a run time error.

Returns:

The run time error

property software_error_count: int

The number of software errors counted. Saturating.

Returns:

The number of software errors

property software_source_filename_address: int

The address of the filename of the software source.

Returns:

The filename address

property software_source_line_number: int

The line number of the software source.

Returns:

The line number

property software_version: int

The software version.

Returns:

The software version

property stack_pointer: int

The current stack pointer value.

Returns:

The stack pointer value

property state: CPUState

The current state of the core.

Returns:

The state of the core

property time: int

The time at which the application started.

Returns:

The time in seconds since 00:00:00 on the 1st January 1970

property user: Sequence[int]

The current user values (user0 - user3).

Returns:

An array of 4 values, one for each user value

property x: int

The X-coordinate of the chip containing the core.

Returns:

The x-coordinate of the chip

property y: int

The y-coordinate of the chip containing the core.

Returns:

The y-coordinate of the chip

class spinnman.model.CPUInfos

Bases: object

A set of CPU information objects.

add_info(cpu_info: CPUInfo) None[source]

Add a info on using its core coordinates.

Parameters:

cpu_info

add_infos(other: Self, states: Iterable[CPUState]) None[source]

Adds all the infos in the other CPUInfos if the have one of the required states

mainly a support method for Transceiver.add_cpu_information_from_core

Parameters:
  • other – Another Infos object to merge in

  • states – Only add if the Info has this state

get_cpu_info(x: int, y: int, p: int) CPUInfo[source]

Get the information for the given core on the given core

get_status_string() str[source]

Get a string indicating the status of the given cores.

infos_for_state(state: CPUState) CPUInfos[source]

Creates a new CpuInfos object with Just the Infos that match the state.

Parameters:

state

Returns:

New Infos object with the filtered infos if any

infos_not_in_states(states: Iterable[CPUState]) CPUInfos[source]

Creates a new CpuInfos object with Just the Infos that match the state.

Parameters:

states

Returns:

New Infos object with the filtered infos if any

is_core(x: int, y: int, p: int) bool[source]

Determine if there is a CPU Info for x, y, p.

class spinnman.model.ChipInfo(system_data: bytes, offset: int)

Bases: object

Represents the system variables for a chip, received from the chip SDRAM.

Parameters:
  • system_data – A byte-string retrieved from SDRAM on the board

  • offset – The offset into the byte-string where the actual data starts

Raises:

SpinnmanInvalidParameterException – If the data doesn’t contain valid system data information

property cpu_clock_mhz: int

The speed of the CPU clock in MHz.

property cpu_information_base_address: int

The base address of the CPU information structure.

property first_free_router_entry: int

The ID of the first free routing entry on the chip.

property iobuf_size: int

The size of the IOBUF buffers in bytes.

property ip_address: str | None

The IP address of the chip, or None if no Ethernet.

property is_ethernet_available: bool

Whether the Ethernet is running on this chip.

The links that are available on the chip.

property nearest_ethernet_x: int

The X-coordinate of the nearest chip with Ethernet.

property nearest_ethernet_y: int

The Y-coordinate of the nearest chip with Ethernet.

property physical_to_virtual_core_map: bytes

The physical core ID to virtual core ID map; entries with a value of 0xFF are non-operational cores.

router_table_copy_address() int[source]

The address of the copy of the router table.

property sdram_base_address: int

The base address of the user region of SDRAM on the chip.

Return type:

int

property sdram_heap_address: int

The address of the base of the heap in SDRAM.

property system_ram_heap_address: int

The address of the base of the heap in system RAM.

property system_sdram_base_address: int

The base address of the System SDRAM region on the chip.

property virtual_core_ids: Iterable[int]

A list of available cores by virtual core ID (including the monitor).

property virtual_to_physical_core_map: bytes

The virtual core ID to physical core ID map; entries with a value of 0xFF are non-operational cores.

property x: int

The X-coordinate of the chip.

property x_size: int

The number of chips in the X-dimension.

property y: int

The Y-coordinate of the chip.

property y_size: int

The number of chips in the Y-dimension.

class spinnman.model.ChipSummaryInfo(chip_summary_data: bytes, offset: int, x: int, y: int)

Bases: object

Represents the chip summary information read via an SCP command.

Parameters:
  • chip_summary_data – The data from the SCP response

  • offset – The offset into the data where the data starts

  • x – The x-coordinate of the chip that this data is from

  • y – The y-coordinate of the chip that this data is from

clear_ethernet_ip_address() None[source]

Forces the Ethernet IP address to None, in case of an errant chip.

property core_states: List[CPUState]

The state of the cores on the chip (list of one per core).

property ethernet_ip_address: str | None

The IP address of the Ethernet if up, or None if not.

property is_ethernet_available: bool

Whether the Ethernet connection is available on this chip.

property largest_free_sdram_block: int

The size of the largest block of free SDRAM in bytes.

property largest_free_sram_block: int

The size of the largest block of free SRAM in bytes.

property n_cores: int

The number of cores working on the chip (including monitors).

property n_free_multicast_routing_entries: int

The number of multicast routing entries free on this chip.

property nearest_ethernet_x: int

The X-coordinate of the nearest Ethernet chip.

property nearest_ethernet_y: int

The Y-coordinate of the nearest Ethernet chip.

The link to the parent of the chip in the tree of chips from root.

The IDs of the working links outgoing from this chip.

property x: int

The X-coordinate of the chip that this data is from.

property y: int

The Y-coordinate of the chip that this data is from.

class spinnman.model.DiagnosticFilter(enable_interrupt_on_counter_event: bool, match_emergency_routing_status_to_incoming_packet: bool, destinations: List[DiagnosticFilterDestination], sources: List[DiagnosticFilterSource], payload_statuses: List[DiagnosticFilterPayloadStatus], default_routing_statuses: List[DiagnosticFilterDefaultRoutingStatus], emergency_routing_statuses: List[DiagnosticFilterEmergencyRoutingStatus], packet_types: List[DiagnosticFilterPacketType])

Bases: object

A router diagnostic counter filter, which counts packets passing through the router with certain properties. The counter will be incremented so long as the packet matches one of the values in each field i.e. one of each of the destinations, sources, payload_statuses, default_routing_statuses, emergency_routing_statuses and packet_types.

Parameters:
  • enable_interrupt_on_counter_event – Indicates whether an interrupt should be raised when this rule matches

  • match_emergency_routing_status_to_incoming_packet – Indicates whether the emergency routing statuses should be matched against packets arriving at this router (if True), or if they should be matched against packets leaving this router (if False)

  • destinations – Increment the counter if one or more of the given destinations match

  • sources – Increment the counter if one or more of the given sources match (or None or empty list to match all)

  • payload_statuses – Increment the counter if one or more of the given payload statuses match (or None or empty list to match all)

  • default_routing_statuses – Increment the counter if one or more of the given default routing statuses match (or None or empty list to match all)

  • emergency_routing_statuses – Increment the counter if one or more of the given emergency routing statuses match (or None or empty list to match all)

  • packet_types – Increment the counter if one or more of the given packet types match (or None or empty list to match all)

property default_routing_statuses: List[DiagnosticFilterDefaultRoutingStatus]

Returns the default routing statuses passed into the init unchanged

Currently unused

property destinations: List[DiagnosticFilterDestination]

Returns the destinations passed into the init unchanged

Currently unused

property emergency_routing_statuses: List[DiagnosticFilterEmergencyRoutingStatus]

Returns the emergency routing statuses passed into the init unchanged

Currently unused

property enable_interrupt_on_counter_event: bool

Returns the enable interrupt on counter event passed into the init unchanged

Currently unused

property filter_word: int

A word of data that can be written to the router to set up the filter.

property match_emergency_routing_status_to_incoming_packet: bool

Returns the match emergency routing status to incoming packet passed into the init unchanged

Currently unused

property packet_types: List[DiagnosticFilterPacketType]

Returns the packet types passed into the init unchanged

Currently unused

property payload_statuses: List[DiagnosticFilterPayloadStatus]

Returns the payload statuses passed into the init unchanged

Currently unused

static read_from_int(int_value: int) DiagnosticFilter[source]

Claims to returns a filter that reads an int

Currently only called by unused Transceiver methods

Parameters:

int_value

property sources: List[DiagnosticFilterSource]

Returns the sources passed into the init unchanged

Currently unused

class spinnman.model.ExecutableTargets

Bases: object

Encapsulate the binaries and cores on which to execute them.

add_processor(binary: str, chip_x: int, chip_y: int, chip_p: int, executable_type: ExecutableType | None = None) None[source]

Add a processor to the executable targets

Parameters:
  • binary – the binary path for executable

  • chip_x – the coordinate on the machine in terms of x for the chip

  • chip_y – the coordinate on the machine in terms of y for the chip

  • chip_p – the processor ID to place this executable on

  • executable_type – the executable type for locating n cores of

add_subsets(binary: str, subsets: CoreSubsets, executable_type: ExecutableType | None = None) None[source]

Add core subsets to a binary.

Parameters:
  • binary – the path to the binary needed to be executed

  • subsets – the subset of cores that the binary needs to be loaded on

  • executable_type – The type of this executable. None means don’t record it.

property all_core_subsets: CoreSubsets

All the core subsets for all the binaries.

property binaries: Collection[str]

The binaries of the executables.

executable_types_in_binary_set() Iterable[ExecutableType][source]

Get the executable types in the set of binaries.

Returns:

iterable of the executable types in this binary set.

get_binaries_of_executable_type(executable_type: ExecutableType) Iterable[str][source]

Get the binaries of a given a executable type.

Parameters:

executable_type – the executable type enum value

Returns:

iterable of binaries with that executable type

get_cores_for_binary(binary: str) CoreSubsets[source]

Get the cores that a binary is to run on.

Parameters:

binary – The binary to find the cores for

get_n_cores_for_executable_type(executable_type: ExecutableType) int[source]

Get the number of cores that the executable type is using.

Parameters:

executable_type

Returns:

the number of cores using this executable type

known(binary: str, chip_x: int, chip_y: int, chip_p: int) bool[source]
Parameters:
  • binary

  • chip_x

  • chip_y

  • chip_p

property total_processors: int

The total number of cores to be loaded.

class spinnman.model.HeapElement(block_address: int, next_address: int, free: int)

Bases: object

An element of one of the heaps on SpiNNaker.

Parameters:
  • block_address – The address of this element on the heap

  • next_address – The address of the next element on the heap

  • free – The “free” element of the block as read from the heap

property app_id: int | None

The application ID of the block if allocated, or None if not.

property block_address: int

The address of the block.

property is_free: bool

Whether this block is a free block.

property next_address: int

The address of the next block, or 0 if none.

property size: int

The usable size of this block (not including the header).

property tag: int | None

The tag of the block if allocated, or None if not.

class spinnman.model.IOBuffer(x: int, y: int, p: int, iobuf: str)

Bases: object

The contents of IOBUF for a core.

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

  • y – The y-coordinate of a chip

  • p – The p-coordinate of a chip

  • iobuf – The contents of the buffer for the chip

property iobuf: str

The contents of the buffer.

property p: int

The ID of the core on the chip.

property x: int

The X-coordinate of the chip containing the core.

property y: int

The Y-coordinate of the chip containing the core.

class spinnman.model.MachineDimensions(width: int, height: int)

Bases: object

Represents the size of a machine in chips.

Parameters:
  • width – The width of the machine in chips

  • height – The height of the machine in chips

property height: int

The height of the machine in chips.

property width: int

The width of the machine in chips.

class spinnman.model.P2PTable(width: int, height: int, column_data: List[Tuple[bytes, int]])

Bases: object

Represents a P2P routing table read from the machine.

Parameters:
  • width

  • height

  • column_data

static get_column_offset(column: int) int[source]

Get the offset of the next column in the table from the P2P base address.

Parameters:

column – The column to be read

static get_n_column_bytes(height: int) int[source]

Get the number of bytes to be read for each column of the table.

Parameters:

height – The height of the machine

get_route(x: int, y: int) P2PTableRoute[source]

Get the route to follow from this chip to the given chip.

Parameters:
  • x – The x-coordinate of the chip to find the route to

  • y – The y-coordinate of the chip to find the route to

property height: int

The height of the machine that this table represents.

is_route(x: int, y: int) bool[source]

Determines if there is a route in the P2P table to the given chip.

Parameters:
  • x – The x-coordinate of the chip to look up

  • y – The y-coordinate of the chip to look up

iterchips() Iterable[Tuple[int, int]][source]

Get an iterator of tuples of (x, y) coordinates in the table.

property n_routes: int

The number of routes in the table

property width: int

The width of the machine that this table represents.

class spinnman.model.RouterDiagnostics(control_register: int, error_status: int, register_values: Sequence[int])

Bases: object

Represents a set of diagnostic information available from a chip router.

Parameters:
  • control_register – The value of the control register

  • error_status – The value of the error_status

  • register_values – The values of the 16 router registers

Raises:

SpinnmanInvalidParameterException – If the number of register values is not 16

property error_count: int

The count of errors.

property error_status: int

The error status.

property errors_set: Sequence[RouterError]

A list of errors that have been detected.

property mon: int

The Monitor part of the control register.

property n_dropped_fixed_route_packets: int

The number of fixed-route packets received that were dropped.

property n_dropped_multicast_packets: int

The number of multicast packets received that were dropped.

property n_dropped_nearest_neighbour_packets: int

The number of nearest-neighbour packets received that were dropped.

property n_dropped_peer_to_peer_packets: int

The number of peer-to-peer packets received that were dropped.

property n_external_fixed_route_packets: int

The number of fixed-route packets received from external links.

property n_external_multicast_packets: int

The number of multicast packets received from external links.

property n_external_nearest_neighbour_packets: int

The number of nearest-neighbour packets received from external links.

property n_external_peer_to_peer_packets: int

The number of peer-to-peer packets received from external links.

property n_local_fixed_route_packets: int

The number of fixed-route packets received from local cores.

property n_local_multicast_packets: int

The number of multicast packets received from local cores.

property n_local_nearest_neighbour_packets: int

The number of nearest-neighbour packets received from local cores.

property n_local_peer_to_peer_packets: int

The number of peer-to-peer packets received from local cores.

property registers: Sequence[int]

The values in all of the registers. Can be used to directly access the registers if they have been programmed to give different values.

Returns:

An array of 16 values

property user_0: int

The number of packets counted by the user 0 router diagnostic filter.

property user_1: int

The number of packets counted by the user 1 router diagnostic filter.

property user_2: int

The number of packets counted by the user 2 router diagnostic filter.

property user_3: int

The number of packets counted by the user 3 router diagnostic filter.

property user_registers: Sequence[int]

The values in the user control registers.

Returns:

An array of 4 values

property wait_1: int

The “wait_1” part of the control register.

property wait_2: int

The “wait_2” part of the control register.

class spinnman.model.VersionInfo(version_data: bytes, offset: int = 0)

Bases: object

Decodes SC&MP/SARK version information as returned by the SVER command.

Parameters:
  • version_data – bytes from an SCP packet containing version information

  • offset – the offset in the bytes from an SCP packet containing version information

Raises:

SpinnmanInvalidParameterException – If the message does not contain valid version information

property build_date: int

The build date of the software, in seconds since 1st January 1970.

property hardware: str

The hardware being run on.

property name: str

The name of the software.

property p: int

The processor ID of the processor where the information was obtained.

property version_number: Tuple[int, int, int]

The version number of the software.

property version_string: str

The version information as text.

property x: int

The X-coordinate of the chip where the information was obtained.

property y: int

The Y-coordinate of the chip where the information was obtained.