spynnaker.pyNN.external_devices_models package

Subpackages

Submodules

spynnaker.pyNN.external_devices_models.external_device_lif_control_vertex module

class spynnaker.pyNN.external_devices_models.external_device_lif_control_vertex.ExternalDeviceLifControlVertex(*, devices: Sequence[AbstractMulticastControllableDevice], create_edges: bool, max_atoms_per_core: int | Tuple[int, ...], n_synapse_cores: int | None, allow_delay_extensions: bool, neuron_impl: AbstractNeuronImpl, pynn_model: AbstractPyNNNeuronModel, translator: AbstractEthernetTranslator | None = None, spikes_per_second: float | None = None, label: str | None = None, ring_buffer_sigma: float | None = None, max_expected_summed_weight: List[float] | None = None, incoming_spike_buffer_size: int | None = None, drop_late_spikes: bool | None = None, splitter: SplitterPopulationVertex | None = None, seed: int | None = None, n_colour_bits: int | None = None)[source]

Bases: PopulationVertex, AbstractEthernetController, AbstractVertexWithEdgeToDependentVertices, HasCustomAtomKeyMap

Abstract control module for the pushbot, based on the LIF neuron, but without spikes, and using the voltage as the output to the various devices.

Parameters:
  • devices – The AbstractMulticastControllableDevice instances to be controlled by the population

  • create_edges – True if edges to the devices should be added by this device (set to False if using the device over Ethernet using a translator)

  • max_atoms_per_core

  • neuron_impl

  • pynn_model

  • translator – Translator to be used when used for Ethernet communication. Must be provided if the device is to be controlled over Ethernet.

  • spikes_per_second

  • label

  • ring_buffer_sigma

  • incoming_spike_buffer_size

  • splitter – splitter from application vertices to machine vertices

  • n_colour_bits – The number of colour bits to use

dependent_vertices() Iterable[ApplicationVertex][source]
Returns:

The vertices which this vertex depends upon.

edge_partition_identifiers_for_dependent_vertex(vertex: ApplicationVertex) Iterable[str][source]
Parameters:

vertex

Returns:

The dependent edge identifiers for a particular dependent vertex.

get_atom_key_map(pre_vertex: MachineVertex, partition_id: str, routing_info: RoutingInfo) Iterable[Tuple[int, int]][source]

Get the mapping between atoms and keys for the given partition id, and for the given machine pre-vertex.

Parameters:
  • pre_vertex – The machine vertex to get the map for

  • partition_id – The partition to get the map for

  • routing_info – Routing information

Returns:

A list of (atom_id, key)

get_external_devices() Iterable[AbstractMulticastControllableDevice][source]
Returns:

The external devices that are to be controlled by the controller.

get_fixed_key_and_mask(partition_id: str) BaseKeyAndMask | None[source]

Get a fixed key and mask for the application vertex or None if not fixed (the default). See get_machine_fixed_key_and_mask() for the conditions.

Parameters:

partition_id – The identifier of the partition to get the key for

Returns:

None or key and mask if fixed

get_message_translator() AbstractEthernetTranslator[source]
Returns:

The translator of messages.

get_outgoing_partition_ids() List[str][source]
Returns:

The partition IDs of messages coming out of the controller.

spynnaker.pyNN.external_devices_models.spif_devices module

Devices connected to the SpiNNaker peripheral interface (SPIF).

spynnaker.pyNN.external_devices_models.spif_devices.N_FIELDS = 4

The number of fields supported for each pipe

spynnaker.pyNN.external_devices_models.spif_devices.N_FILTERS = 8

The number of filters supported for each pipe

spynnaker.pyNN.external_devices_models.spif_devices.N_INPUTS = 8

The number of FPGA inputs per pipe

Note

The inputs are not actually separated in the hardware, but a logical separation per pipe is useful.

spynnaker.pyNN.external_devices_models.spif_devices.N_PIPES = 2

The number of pipes

class spynnaker.pyNN.external_devices_models.spif_devices.SPIFRegister(value)[source]

Bases: IntEnum

The register offsets on a SPIF device.

CONFIG_PKT_CNT = 65

The configuration packet count register

DIST_KEY_BASE = 208
DIST_MASK_BASE = 224
DIST_SHIFT_BASE = 240
DROPPED_PKT_CNT = 66

The dropped packet count register

FL_MASK_BASE = 176

The filter mask base register (8 filters per pipe)

FL_VALUE_BASE = 144

The filter value base register (8 filters per pipe)

IN_PERIPH_PKT_CNT = 67

The input peripheral packet count register

IR_KEY_BASE = 16

The input key register base (8 inputs per pipe)

IR_MASK_BASE = 32

The input mask register base (8 inputs per pipe)

IR_ROUTE_BASE = 48

The input route register base (8 inputs per pipe)

MP_FLD_LIMIT_BASE = 128

The output mapper field limit base register (4 fields per pipe)

MP_FLD_MASK_BASE = 96

The output mapper field mask base register (4 fields per pipe)

MP_FLD_SHIFT_BASE = 112

The output mapper field shift base register (4 fields per pipe)

MP_KEY_BASE = 80

The output mapper key base register (2 pipes)

OUT_PERIPH_PKT_CNT = 64

The output peripheral packet count register

REPLY_KEY = 2

The key to send messages back when requested

cmd(payload: int | None = None, index: int = 0) MultiCastCommand[source]

Make a command to send to a SPIF device to set a register value.

Parameters:
  • payload – The payload to use in the command, or None for no payload

  • index – The index of the register to send to when there are multiple registers starting from a base

Returns:

Command created but not yet run

delayed_command(get_payload: Callable[[int], int], index: int = 0) _DelayedMultiCastCommand[source]
Make a command to send to a SPIF device to set a register value,

where the value itself is currently unknown

Parameters:
  • get_payload – A function to call to get the payload later

  • index – The index of the register to use when using a multi-indexed register (default is 0 which works for all registers)

Returns:

Command created but not yet run

spynnaker.pyNN.external_devices_models.spif_devices.SPIF_FPGA_ID = 0

SPIF is always connected to FPGA 0

SPIF always gets input from odd links on FPGA 0 (1, 3, 5, 7, 9, 11, 13, 15)

SPIF always outputs to FPGA link 15 on FPGA 0

class spynnaker.pyNN.external_devices_models.spif_devices.SpiNNFPGARegister(value)[source]

Bases: IntEnum

The register offsets on the SpiNNaker FPGAs for devices.

LC_KEY = 12

The base key which identifies packets to write to the FPGA registers

LC_MASK = 13

The mask which identifies packets to write to the FPGA registers

P_KEY = 2
P_MASK = 3
RC_KEY = 14

The base key which identifies packets to write to the peripheral registers

RC_MASK = 15

The mask which identifies packets to write to the peripheral registers

START = 17

The register to write to to start the sending of data from the peripheral to SpiNNaker

STOP = 16

The register to write to to stop the sending of data from the peripheral to SpiNNaker

XP_KEY_BASE = 32

The base of the keys that can be sent out of SpiNNaker (up to 6)

XP_MASK_BASE = 48

The base of the masks that can be sent out of SpiNNake (up to 6)

cmd(payload: int | None = None, index: int = 0) MultiCastCommand[source]

Make a command to send to the FPGA to set a register value.

Parameters:
  • payload – The payload to use in the command, or None for no payload

  • index – The index of the register to send to when there are multiple registers starting from a base

Returns:

Command created but not yet run

delayed_command(get_payload: Callable[[int], int], index: int = 0) _DelayedMultiCastCommand[source]

Make a command to send to the FPGA to set a register value, where the value itself is currently unknown.

Parameters:
  • get_payload – A function to call to get the payload later, passing in the index

  • index – The index of the register to send to when there are multiple registers starting from a base

Returns:

Command created but not yet run

spynnaker.pyNN.external_devices_models.spif_devices.set_distiller_key(index: int, key: int) MultiCastCommand[source]
Get a command to set the key of the distiller of the output via SPIF.

This tells SPIF which bits to put at the top of the 32-bit output for each spike received on the given distiller channel, defined by the peripheral routes in the SpiNNaker FPGA.

Parameters:
  • index – The index of the channel to set (0-5)

  • key – The key to set

Returns:

Command created but not yet run

spynnaker.pyNN.external_devices_models.spif_devices.set_distiller_mask(index: int, mask: int) MultiCastCommand[source]
Get a command to set the mask of the distiller of the output via SPIF.

This tells SPIF which bits to use from the key in the 32-bit output for each spike received on the given distiller channel, defined by the peripheral routes in the SpiNNaker FPGA.

Parameters:
  • index – The index of the channel to set (0-5)

  • mask – The mask to set

Returns:

Command created but not yet run

spynnaker.pyNN.external_devices_models.spif_devices.set_distiller_mask_delayed(index: int, mask_func: Callable[[int], int]) MultiCastCommand[source]
Get a command to set the mask of the distiller of the output via SPIF.

This tells SPIF which bits to use from the key in the 32-bit output for each spike received on the given distiller channel, defined by the peripheral routes in the SpiNNaker FPGA.

Parameters:
  • index – The index of the channel to set (0-5)

  • mask_func – The function to call to set the mask - takes index as argument

Returns:

Command created but not yet run

spynnaker.pyNN.external_devices_models.spif_devices.set_distiller_shift(index: int, shift: int) MultiCastCommand[source]
Get a command to set the shift of the distiller of the output via SPIF.

This tells SPIF how much to shift the key after masking but before applying the distiller key.

Parameters:
  • index – The index of the channel to set (0-5)

  • shift – The shift to set

Returns:

Command created but not yet run

spynnaker.pyNN.external_devices_models.spif_devices.set_field_limit(pipe: int, index: int, limit: int) MultiCastCommand[source]

Get a command to set the limit of a mapper field on SPIF. This sets a limit on the value of the field after shifting and masking.

Parameters:
  • pipe – The SPIF pipe to set the limit of (0-1)

  • index – The index of the field to set (0-3)

  • limit – The maximum value of the field

Returns:

Command created but not yet run

spynnaker.pyNN.external_devices_models.spif_devices.set_field_mask(pipe: int, index: int, mask: int) MultiCastCommand[source]

Get a command to set the mask of a mapper field on SPIF. This masks off the bits of the field from the incoming UDP or USB packet values (which are 32-bits each).

Parameters:
  • pipe – The SPIF pipe to set the mask of (0-1)

  • index – The index of the field to set (0-3)

  • mask – The mask to set

Returns:

Command created but not yet run

spynnaker.pyNN.external_devices_models.spif_devices.set_field_shift(pipe: int, index: int, shift: int) MultiCastCommand[source]

Get a command to set the shift of a mapper field on SPIF. This shifts the masked bits of the field from the incoming UDP or USB packet values (which are 32-bits each).

Parameters:
  • pipe – The SPIF pipe to set the shift of (0-1)

  • index – The index of the field to set (0-3)

  • shift – The shift value to set (0-31); positive = right, negative = left

Returns:

Command created but not yet run

spynnaker.pyNN.external_devices_models.spif_devices.set_filter_mask(pipe: int, index: int, mask: int) MultiCastCommand[source]

Get a command to set the mask of a filter of SPIF. This will drop input events from the UDP or USB packets where filter value == filter mask & event value.

Parameters:
  • pipe – The SPIF pipe to set the filter of (0-1)

  • index – The index of the filter to set (0-7)

  • mask – The filter mask to set

Returns:

Command created but not yet run

spynnaker.pyNN.external_devices_models.spif_devices.set_filter_value(pipe: int, index: int, value: int) MultiCastCommand[source]

Get a command to set the value of a filter of SPIF. This will drop input events from the UDP or USB packets where filter value == filter mask & event value.

Parameters:
  • pipe – The SPIF pipe to set the filter of (0-1)

  • index – The index of the filter to set (0-7)

  • value – The filter value to set

Returns:

Command created but not yet run

spynnaker.pyNN.external_devices_models.spif_devices.set_input_key(pipe: int, index: int, key: int) MultiCastCommand[source]

Get a command to set the key of the FPGA input of SPIF. This tells SPIF how to route the incoming packets after they have been assembled by the mapper; when incoming key & input mask == input_key, the packet will be routed to input_route.

Parameters:
  • pipe – The SPIF pipe to set the input of (0-1)

  • index – The index of the input to set (0-7)

  • key – The key to set

Returns:

Command created but not yet run

spynnaker.pyNN.external_devices_models.spif_devices.set_input_mask(pipe: int, index: int, mask: int) MultiCastCommand[source]

Get a command to set the mask of the FPGA input of SPIF. This tells SPIF how to route the incoming packets after they have been assembled by the mapper; when incoming key & input mask == input_key, the packet will be routed to input_route.

Parameters:
  • pipe – The SPIF pipe to set the input of (0-1)

  • index – The index of the input to set (0-7)

  • mask – The mask to set

Returns:

Command created but not yet run

spynnaker.pyNN.external_devices_models.spif_devices.set_input_route(pipe: int, index: int, route: int) MultiCastCommand[source]

Get a command to set the route of the FPGA input of SPIF. This tells SPIF how to route the incoming packets after they have been assembled by the mapper; when incoming key & input mask == input_key, the packet will be routed to input_route.

Note

route 0 refers to FPGA link 15, 1 to 13 and so on in twos.

Parameters:
  • pipe – The SPIF pipe to set the input of (0-1)

  • index – The index of the input to set (0-7)

  • route – The route to set

Returns:

Command created but not yet run

spynnaker.pyNN.external_devices_models.spif_devices.set_mapper_key(pipe: int, key: int) MultiCastCommand[source]

Get a command to set the output base key for packets from SPIF. This will be added to the keys determined by the mapper output.

Parameters:
  • pipe – The SPIF pipe to set the key of (0-1)

  • key – The output key to set

Returns:

Command created but not yet run

spynnaker.pyNN.external_devices_models.spif_devices.set_xp_key(index: int, key: int) MultiCastCommand[source]
Get a command to set the key of the output via the FPGA.

This tells the FPGA to route this key to the external device.

Parameters:
  • index – The index of the channel to set (0-5)

  • key – The key to set

Returns:

Command created but not yet run

spynnaker.pyNN.external_devices_models.spif_devices.set_xp_key_delayed(index: int, key_func: Callable[[int], int]) _DelayedMultiCastCommand[source]
Get a command to set the key of the output via the FPGA later.

This tells the FPGA to route this key to the external device.

Parameters:
  • index – The index of the channel to set (0-5)

  • key_func – The function to call to get the key

Returns:

Command created but not yet run

spynnaker.pyNN.external_devices_models.spif_devices.set_xp_mask(index: int, mask: int) MultiCastCommand[source]
Get a command to set the mask the output via the FPGA.

This tells the FPGA to route keys after using this mask to the external device.

Parameters:
  • index – The index of the channel to set (0-5)

  • mask – The mask to set

Returns:

Command created but not yet run

spynnaker.pyNN.external_devices_models.spif_devices.set_xp_mask_delayed(index: int, mask_func: Callable[[int], int]) _DelayedMultiCastCommand[source]
Get a command to set the mask of the output via the FPGA later.

This tells the FPGA to route keys after using this mask to the external device.

Parameters:
  • index – The index of the channel to set (0-5)

  • mask_func – The function to call to get the mask

Returns:

Command created but not yet run

Module contents

class spynnaker.pyNN.external_devices_models.AbstractEthernetController

Bases: object

A controller that can send multicast packets which can be received over Ethernet and translated to control an external device.

abstractmethod get_external_devices() Iterable[AbstractMulticastControllableDevice][source]
Returns:

The external devices that are to be controlled by the controller.

abstractmethod get_message_translator() AbstractEthernetTranslator[source]
Returns:

The translator of messages.

abstractmethod get_outgoing_partition_ids() List[str][source]
Returns:

The partition IDs of messages coming out of the controller.

class spynnaker.pyNN.external_devices_models.AbstractEthernetSensor

Bases: object

An Ethernet-connected device that can send events (spikes) to SpiNNaker via a Spike Injector.

abstractmethod get_database_connection() SpynnakerLiveSpikesConnection[source]
Returns:

A Database Connection instance that this device uses to inject packets.

abstractmethod get_injector_label() str[source]
Returns:

the label to give to the Spike Injector.

abstractmethod get_injector_parameters() Dict[str, Any][source]
Returns:

The parameters of the Spike Injector to use with this device.

abstractmethod get_n_neurons() int[source]
Returns:

The number of neurons that will be sent out by the device.

abstractmethod get_translator() AbstractEthernetTranslator[source]
Returns:

A translator of multicast commands to Ethernet commands.

class spynnaker.pyNN.external_devices_models.AbstractEthernetTranslator

Bases: object

A module that can translate packets received over Ethernet into control of an external device.

abstractmethod translate_control_packet(multicast_packet: MultiCastCommand) None[source]

Translate a multicast packet received over Ethernet and send appropriate messages to the external device.

Parameters:

multicast_packet – A received multicast packet

class spynnaker.pyNN.external_devices_models.AbstractMulticastControllableDevice

Bases: object

A device that can be controlled by sending multicast packets to it, either directly, or via Ethernet using an AbstractEthernetTranslator.

property device_control_first_send_timestep: int | None

The first timestep that the device should send in (0 by default).

abstract property device_control_key: int

The key that must be sent to the device to control it.

abstract property device_control_max_value: Decimal

The maximum value to send to the device.

abstract property device_control_min_value: float

The minimum value to send to the device.

abstract property device_control_partition_id: str

A partition ID to give to an outgoing edge partition that will control this device.

property device_control_scaling_factor: int

The scaling factor used to send the payload to this device.

abstract property device_control_send_type: SendType

The type of data to be sent.

abstract property device_control_timesteps_between_sending: int | None

The number of timesteps between sending commands to the device. This defines the “sampling interval” for the device.

abstract property device_control_uses_payload: bool

Whether the control of the device accepts an arbitrary valued payload, the value of which will change the devices behaviour.

class spynnaker.pyNN.external_devices_models.ArbitraryFPGADevice(n_neurons: int, fpga_link_id: int, fpga_id: int, board_address: str | None = None, chip_coords: Tuple[int, int] | None = None, label: str | None = None)

Bases: ApplicationFPGAVertex, PopulationApplicationVertex

A device connected to SpiNNaker via one of the on-board FPGAs.

Parameters:
  • n_neurons – Number of neurons

  • fpga_link_id – The ID of the link of the FPGA (0-15)

  • fpga_id – The ID of the FPGA on the board (0, 1 or 2)

  • board_address – The IP address of the board with the FPGA, or None for the default board or if using chip_coords

  • chip_coords – The coordinates of the chip connected to the FPGA, or None for the default board or if using board_address

  • label – The optional name of the vertex.

class spynnaker.pyNN.external_devices_models.ExternalDeviceLifControl(**kwargs: Any)

Bases: AbstractPyNNNeuronModelStandard

Abstract control module for the PushBot, based on the LIF neuron, but without spikes, and using the voltage as the output to the various devices.

Parameters:
  • model_name – Name of the model.

  • binary – Name of the implementation executable.

  • neuron_model – The model of the neuron body

  • input_type – The model of synaptic input types

  • synapse_type – The model of the synapses’ dynamics

  • threshold_type – The model of the firing threshold

  • additional_input_type – The model (if any) of additional environmental inputs

create_vertex(n_neurons: int, label: str, *, spikes_per_second: float | None = None, ring_buffer_sigma: float | None = None, max_expected_summed_weight: List[float] | None = None, incoming_spike_buffer_size: int | None = None, drop_late_spikes: bool | None = None, splitter: SplitterPopulationVertex | None = None, seed: int | None = None, n_colour_bits: int | None = None, n_steps_per_timestep: int = 1, neurons_per_core: int | Tuple[int, ...] | None = None, n_synapse_cores: int | None = None, allow_delay_extensions: bool | None = None) PopulationVertex[source]

Create a vertex for a population of the model.

Parameters:
  • n_neurons – The number of neurons in the population

  • label – The label to give to the vertex

  • spikes_per_second

  • ring_buffer_sigma

  • incoming_spike_buffer_size

  • drop_late_spikes

  • splitter

  • seed

  • n_colour_bits

  • n_steps_per_timestep

Returns:

An application vertex for the population

class spynnaker.pyNN.external_devices_models.ExternalFPGARetinaDevice(mode: str, retina_key: int, spinnaker_link_id: int, polarity: str, label: str | None = None, board_address: str | None = None)

Bases: ApplicationSpiNNakerLinkVertex, PopulationApplicationVertex, AbstractSendMeMulticastCommandsVertex

A retina connected by FPGA

Parameters:
  • mode – The retina “mode”

  • retina_key – The value of the top 16-bits of the key

  • spinnaker_link_id – The SpiNNaker link to which the retina is connected

  • polarity – The “polarity” of the retina data

  • label – The optional name of the vertex.

  • board_address

DOWN_POLARITY = 'DOWN'
MERGED_POLARITY = 'MERGED'
MODE_128 = '128'
MODE_16 = '16'
MODE_32 = '32'
MODE_64 = '64'
UP_POLARITY = 'UP'
get_fixed_key_and_mask(partition_id: str) BaseKeyAndMask[source]

Get a fixed key and mask for the application vertex or None if not fixed (the default). See get_machine_fixed_key_and_mask() for the conditions.

Parameters:

partition_id – The identifier of the partition to get the key for

Returns:

None or key and mask if fixed

static get_n_neurons(mode: str, polarity: str) int[source]

Calculate the number of neurons based on mode and polarity

Parameters:
  • mode128 or 64 or 32 or 16

  • polarityUP or DOWN

Returns:

The number of neurons in the retina

property pause_stop_commands: Iterable[MultiCastCommand]

The commands needed when pausing or stopping simulation.

property start_resume_commands: Iterable[MultiCastCommand]

The commands needed when starting or resuming simulation.

property timed_commands: List[MultiCastCommand]

The commands to be sent at given times in the simulation.

class spynnaker.pyNN.external_devices_models.ICUBRetinaDevice(base_key: int = 0, width: int = 304, height: int = 240, sub_width: int = 16, sub_height: int = 16, spinnaker_link_id: int = 0, board_address: str | None = None)

Bases: Application2DSpiNNakerLinkVertex

An ICUB retina device connected to SpiNNaker using a SpiNNakerLink.

Parameters:
  • base_key – The key that is common over the whole vertex

  • width – The width of the retina in pixels

  • height – The height of the retina in pixels

  • sub_width – The width of rectangles to split the retina into for efficiency of sending

  • sub_height – The height of rectangles to split the retina into for efficiency of sending

  • spinnaker_link_id – The ID of the SpiNNaker link that the device is connected to

  • board_address – The board to which the device is connected, or None for the first board

get_fixed_key_and_mask(partition_id: str) BaseKeyAndMask[source]

Get a fixed key and mask for the application vertex or None if not fixed (the default). See get_machine_fixed_key_and_mask() for the conditions.

Parameters:

partition_id – The identifier of the partition to get the key for

Returns:

None or key and mask if fixed

get_incoming_slice(index: int) Slice[source]
Parameters:

index – The index of the connection, for when n_machine_vertices > 1

Returns:

The slice to be given to the connection.

get_machine_fixed_key_and_mask(machine_vertex: MachineVertex, partition_id: str) BaseKeyAndMask[source]

Get a fixed key and mask for the given machine vertex and partition identifier, or None if not fixed (the default).

If this doesn’t return None, get_fixed_key_and_mask() must also not return None, and the keys returned here must align with those such that for each key:mask returned here, key & app_mask == app_key. It is OK for this to return None and get_fixed_key_and_mask() to return non-None if and only if there is only one machine vertex.

Parameters:
  • machine_vertex – The identifier of the partition to get the key for

  • partition_id – The identifier of the partition to get the key for

Returns:

None or key and mask if fixed

class spynnaker.pyNN.external_devices_models.MachineMunichMotorDevice(speed: int, sample_time: int, update_time: int, delay_time: int, delta_threshold: int, continue_if_not_different: bool, label: str | None = None, app_vertex: ApplicationVertex | None = None)

Bases: MachineVertex, AbstractGeneratesDataSpecification, AbstractHasAssociatedBinary, ProvidesProvenanceDataFromMachineImpl

An Omnibot motor control device. This has a real vertex and an external device vertex.

Parameters:
  • speed

  • sample_time

  • update_time

  • delay_time

  • delta_threshold

  • continue_if_not_different

  • label

  • app_vertex

INPUT_BUFFER_FULL_NAME = 'Times_the_input_buffer_lost_packets'
MOTOR_PARTITION_ID = 'MOTOR'
generate_data_specification(spec: DataSpecificationGenerator, placement: Placement) None[source]

Generate a data specification.

Parameters:
  • spec – The data specification to write to

  • placement – The placement the vertex is located at

get_binary_file_name() str[source]
Returns:

The binary name to be run for this vertex.

get_binary_start_type() ExecutableType[source]
Returns:

The start type of the binary to be run.

get_n_keys_for_partition(partition_id: str) int[source]

Get the number of keys required by the given partition of edges.

Parameters:

partition_id – The identifier of the partition; the partition_id param is only used by some MachineVertex subclasses

Returns:

The number of keys required

parse_extra_provenance_items(label: str, x: int, y: int, p: int, provenance_data: Sequence[int]) None[source]

Convert the remaining provenance words (those not in the standard set) into provenance items.

Called by get_provenance_data_from_machine()

Parameters:
  • label – A descriptive label for the vertex (derived from label and placed position) to be used for provenance error reporting to the user.

  • x – x coordinate of the chip where this core

  • y – y coordinate of the core where this core

  • p – virtual id of the core

  • provenance_data – The list of words of raw provenance data.

reserve_memory_regions(spec: DataSpecificationGenerator) None[source]

Reserve SDRAM space for memory areas:

  1. Area for information on what data to record

  2. area for start commands

  3. area for end commands

Parameters:

spec – The data specification to write to

property sdram_required: ConstantSDRAM

The SDRAM space required by the vertex.

class spynnaker.pyNN.external_devices_models.MunichMotorDevice(spinnaker_link_id: int, board_address: str | None = None, speed: int = 30, sample_time: int = 4096, update_time: int = 512, delay_time: int = 5, delta_threshold: int = 23, continue_if_not_different: bool = True, label: str | None = None)

Bases: AbstractOneAppOneMachineVertex, AbstractVertexWithEdgeToDependentVertices, PopulationApplicationVertex, AbstractProvidesDefaults

An Omnibot motor control device. This has a real vertex and an external device vertex.

Parameters:
  • spinnaker_link_id – The SpiNNaker link to which the motor is connected

  • board_address

  • speed

  • sample_time

  • update_time

  • delay_time

  • delta_threshold

  • continue_if_not_different

  • label – The optional name of the vertex.

dependent_vertices() Iterable[ApplicationVertex][source]
Returns:

The vertices which this vertex depends upon.

edge_partition_identifiers_for_dependent_vertex(vertex: ApplicationVertex) Iterable[str][source]
Parameters:

vertex

Returns:

The dependent edge identifiers for a particular dependent vertex.

class spynnaker.pyNN.external_devices_models.MunichRetinaDevice(retina_key: int, spinnaker_link_id: int, position: Literal['LEFT', 'RIGHT'], label: str = 'MunichRetinaDevice', polarity: Literal['UP'] | Literal['DOWN'] | Literal['MERGED'] | None = None, board_address: str | None = None)

Bases: ApplicationSpiNNakerLinkVertex, PopulationApplicationVertex, AbstractSendMeMulticastCommandsVertex

An Omnibot silicon retina device.

Parameters:
  • retina_key

  • spinnaker_link_id – The SpiNNaker link to which the retina is connected

  • positionLEFT or RIGHT

  • label – The optional name of the vertex.

  • polarityUP, DOWN or MERGED

  • board_address

DOWN_POLARITY = 'DOWN'
LEFT_RETINA = 'LEFT'
MERGED_POLARITY: Literal['MERGED'] = 'MERGED'
RIGHT_RETINA = 'RIGHT'
UP_POLARITY = 'UP'
get_fixed_key_and_mask(partition_id: str) BaseKeyAndMask[source]

Get a fixed key and mask for the application vertex or None if not fixed (the default). See get_machine_fixed_key_and_mask() for the conditions.

Parameters:

partition_id – The identifier of the partition to get the key for

Returns:

None or key and mask if fixed

property pause_stop_commands: Iterable[MultiCastCommand]

The commands needed when pausing or stopping simulation.

property start_resume_commands: Iterable[MultiCastCommand]

The commands needed when starting or resuming simulation.

property timed_commands: List[MultiCastCommand]

The commands to be sent at given times in the simulation.

class spynnaker.pyNN.external_devices_models.SPIFInputDevice(pipe: int, n_neurons: int, n_neurons_per_partition: int, base_key: int | None = None, board_address: str | None = None, chip_coords: Tuple[int, int] | None = None)

Bases: ApplicationFPGAVertex, PopulationApplicationVertex, AbstractSendMeMulticastCommandsVertex

A 1D input device connected to SpiNNaker using a SPIF board.

Parameters:
  • pipe – Which pipe on SPIF the retina is connected to

  • n_neurons – The number of neurons in the device

  • n_neurons_per_partition – The number of neurons per partition

  • base_key – The key that is common over the whole vertex, or None to use the pipe number as the key

  • board_address – The IP address of the board to which the FPGA is connected, or None to use the default board or chip_coords. Note chip_coords will be used first if both are specified, with board_address then being used if the coordinates don’t connect to an FPGA.

  • chip_coords – The coordinates of the chip to which the FPGA is connected, or None to use the default board or board_address. Note chip_coords will be used first if board_address is also specified, with board_address then being used if the coordinates don’t connect to an FPGA.

INPUT_MASK = 7
get_atom_key_map(pre_vertex: MachineVertex, partition_id: str, routing_info: RoutingInfo) Iterable[Tuple[int, int]][source]

Get the mapping between atoms and keys for the given partition id, and for the given machine pre-vertex.

Parameters:
  • pre_vertex – The machine vertex to get the map for

  • partition_id – The partition to get the map for

  • routing_info – Routing information

Returns:

A list of (atom_id, key)

get_fixed_key_and_mask(partition_id: str) BaseKeyAndMask[source]

Get a fixed key and mask for the application vertex or None if not fixed (the default). See get_machine_fixed_key_and_mask() for the conditions.

Parameters:

partition_id – The identifier of the partition to get the key for

Returns:

None or key and mask if fixed

Parameters:
  • link – The FPGA connection to get the slice for

  • index – The index of the connection on the FGPA link, for when n_machine_vertices_per_link > 1

Returns:

The slice to be given to the connection from the given link.

get_machine_fixed_key_and_mask(machine_vertex: MachineVertex, partition_id: str) BaseKeyAndMask[source]

Get a fixed key and mask for the given machine vertex and partition identifier, or None if not fixed (the default).

If this doesn’t return None, get_fixed_key_and_mask() must also not return None, and the keys returned here must align with those such that for each key:mask returned here, key & app_mask == app_key. It is OK for this to return None and get_fixed_key_and_mask() to return non-None if and only if there is only one machine vertex.

Parameters:
  • machine_vertex – The identifier of the partition to get the key for

  • partition_id – The identifier of the partition to get the key for

Returns:

None or key and mask if fixed

property pause_stop_commands: Iterable[MultiCastCommand]

The commands needed when pausing or stopping simulation.

property start_resume_commands: Iterable[MultiCastCommand]

The commands needed when starting or resuming simulation.

property timed_commands: List[MultiCastCommand]

The commands to be sent at given times in the simulation.

class spynnaker.pyNN.external_devices_models.SPIFOutputDevice(board_address: str | None = None, chip_coords: Tuple[int, int] | None = None, label: str | None = None, create_database: bool = True, database_notify_host: str | None = None, database_notify_port_num: int | None = None, database_ack_port_num: int | None = None, output_key_shift: int = 24)

Bases: ApplicationFPGAVertex, PopulationApplicationVertex, AbstractSendMeMulticastCommandsVertex, LiveOutputDevice

Output (only) to a SPIF device. Each SPIF device can accept up to 6 incoming projections. Keys sent from Populations to SPIF will be mapped by removing the SpiNNaker key and adding an index so that the source Population can be identified. Source Populations must be split into power-of-two sized cores to ensure that keys are contiguous. The keys output by SPIF will be of the form:

(projection_index << output_key_shift) | neuron_id

By default, the projection index will be in the top 8 bits of the packet, but this can be controlled with the output_key_shift parameter.

Parameters:
  • board_address – The board IP address of the SPIF device

  • chip_coords – The chip coordinates of the SPIF device

  • label – The label to give the SPIF device

  • create_database – Whether the database will be used to decode keys or not

  • database_notify_host – The host that will read the database

  • database_notify_port_num – The port of the host that will read the database

  • database_ack_port_num – The port to listen on for responses from the host reading the database

  • output_key_shift – The shift to apply to the population indices when added to the key

add_incoming_edge(edge: ApplicationEdge, partition: ApplicationEdgePartition) None[source]

Add an edge incoming to this vertex. This is ignored by default, but could be used to track incoming edges, and/or report faults.

Parameters:
  • edge – The edge to add.

  • partition – The partition to add the edge to.

get_device_output_keys() Dict[MachineVertex, List[Tuple[int, int]]][source]

Get the atom key mapping to be output for each machine vertex received by the device to be output. Note that the device may change the keys as they pass through it, and this needs to be recognised here.

Returns:

Mapping of machine vertex to list of (atom_id, key)

property pause_stop_commands: Iterable[MultiCastCommand]

The commands needed when pausing or stopping simulation.

set_output_key_and_mask(population: Population, key: int, mask: int) None[source]
Set the output key to be written into packets when received by

SPIF, and the mask to apply before adding the key. The key should be the exact value that will be “or’ed” with the packet after masking. The mask should be the mask to apply to the incoming SpiNNaker key to extract the neuron id bits. The key and mask will not be checked; please make sure you are using values that make sense!

Parameters:
  • population – The PyNN source Population

  • key – The key to “or” with the incoming key after masking

  • mask – The mask to “and” with the incoming SpiNNaker key

property start_resume_commands: Iterable[MultiCastCommand]

The commands needed when starting or resuming simulation.

property timed_commands: List[MultiCastCommand]

The commands to be sent at given times in the simulation.

class spynnaker.pyNN.external_devices_models.SPIFRetinaDevice(pipe: int, width: int, height: int, sub_width: int, sub_height: int, base_key: int | None = None, input_x_shift: int = 16, input_y_shift: int = 0, board_address: str | None = None, chip_coords: Tuple[int, int] | None = None)

Bases: Application2DFPGAVertex, PopulationApplicationVertex, AbstractSendMeMulticastCommandsVertex

A retina device connected to SpiNNaker using a SPIF board.

Parameters:
  • pipe – Which pipe on SPIF the retina is connected to

  • width – The width of the retina in pixels

  • height – The height of the retina in pixels

  • sub_width – The width of rectangles to split the retina into for efficiency of sending

  • sub_height – The height of rectangles to split the retina into for efficiency of sending

  • base_key – The key that is common over the whole vertex, or None to use the pipe number as the key

  • input_x_shift – The shift to get the x coordinate from the input keys sent to SPIF

  • input_y_shift – The shift to get the y coordinate from the input keys sent to SPIF

  • board_address

    The IP address of the board to which the FPGA is connected, or None to use the default board or chip_coords.

    Note

    chip_coords will be used first if both are specified, with board_address then being used if the coordinates don’t connect to an FPGA.

  • chip_coords

    The coordinates of the chip to which the FPGA is connected, or None to use the default board or board_address.

    Note

    chip_coords will be used first if board_address is also specified, with board_address then being used if the coordinates don’t connect to an FPGA.

X_MASK = 3
X_PER_ROW = 4
Y_MASK = 1
get_atom_key_map(pre_vertex: MachineVertex, partition_id: str, routing_info: RoutingInfo) Iterable[Tuple[int, int]][source]

Get the mapping between atoms and keys for the given partition id, and for the given machine pre-vertex.

Parameters:
  • pre_vertex – The machine vertex to get the map for

  • partition_id – The partition to get the map for

  • routing_info – Routing information

Returns:

A list of (atom_id, key)

get_fixed_key_and_mask(partition_id: str) BaseKeyAndMask[source]

Get a fixed key and mask for the application vertex or None if not fixed (the default). See get_machine_fixed_key_and_mask() for the conditions.

Parameters:

partition_id – The identifier of the partition to get the key for

Returns:

None or key and mask if fixed

Parameters:
  • link – The FPGA connection to get the slice for

  • index – The index of the connection on the FGPA link, for when n_machine_vertices_per_link > 1

Returns:

The slice to be given to the connection from the given link.

get_machine_fixed_key_and_mask(machine_vertex: MachineVertex, partition_id: str) BaseKeyAndMask[source]

Get a fixed key and mask for the given machine vertex and partition identifier, or None if not fixed (the default).

If this doesn’t return None, get_fixed_key_and_mask() must also not return None, and the keys returned here must align with those such that for each key:mask returned here, key & app_mask == app_key. It is OK for this to return None and get_fixed_key_and_mask() to return non-None if and only if there is only one machine vertex.

Parameters:
  • machine_vertex – The identifier of the partition to get the key for

  • partition_id – The identifier of the partition to get the key for

Returns:

None or key and mask if fixed

property pause_stop_commands: Iterable[MultiCastCommand]

The commands needed when pausing or stopping simulation.

property start_resume_commands: Iterable[MultiCastCommand]

The commands needed when starting or resuming simulation.

property timed_commands: List[MultiCastCommand]

The commands to be sent at given times in the simulation.

class spynnaker.pyNN.external_devices_models.SendType(value)

Bases: Enum

The data type to be sent in the payload of the multicast packet.

SEND_TYPE_ACCUM = 2
SEND_TYPE_FRACT = 4
SEND_TYPE_INT = 0
SEND_TYPE_UACCUM = 3
SEND_TYPE_UFRACT = 5
SEND_TYPE_UINT = 1
class spynnaker.pyNN.external_devices_models.ThresholdTypeMulticastDeviceControl(devices: Sequence[AbstractMulticastControllableDevice])

Bases: AbstractThresholdType

A threshold type that can send multicast keys with the value of membrane voltage as the payload.

Parameters:

devices

add_parameters(parameters: RangeDictionary[float]) None[source]

Add the initial values of the parameters to the parameter holder.

Parameters:

parameters – A holder of the parameters

add_state_variables(state_variables: RangeDictionary[float]) None[source]

Add the initial values of the state variables to the state variables holder.

Parameters:

state_variables – A holder of the state variables