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: Tuple[int, ...], 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: SplitterAbstractPopulationVertex | None = None, seed: int | None = None, n_colour_bits: int | None = None)[source]

Bases: AbstractPopulationVertex, 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:
dependent_vertices() Iterable[ApplicationVertex][source]

Return the vertices which this vertex depends upon.

Return type:

iterable(ApplicationVertex)

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

Return the dependent edge identifiers for a particular dependent vertex.

Parameters:

vertex (ApplicationVertex)

Return type:

iterable(str)

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 (MachineVertex) – The machine vertex to get the map for

  • partition_id (str) – The partition to get the map for

  • routing_info (RoutingInfo) – Routing information

Returns:

A list of (atom_id, key)

Return type:

list(tuple(int,int))

get_external_devices() Iterable[AbstractMulticastControllableDevice][source]

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

Return type:

iterable(AbstractMulticastControllableDevice)

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_gixed_key_and_mask() for the conditions.

Parameters:

partition_id (str) – The identifier of the partition to get the key for

Return type:

BaseKeyAndMask or None

get_message_translator() AbstractEthernetTranslator[source]

Get the translator of messages.

Return type:

AbstractEthernetTranslator

get_outgoing_partition_ids() List[str][source]

Get the partition IDs of messages coming out of the controller.

Return type:

list(str)

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, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[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=None, index=0)[source]

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

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

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

Return type:

MultiCastCommand

delayed_command(get_payload, index=0)[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 (callable()->int) – A function to call to get the payload later

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

Return type:

MultiCastCommand

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, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[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=None, index=0)[source]

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

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

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

Return type:

MultiCastCommand

delayed_command(get_payload, index=0)[source]

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

Parameters:
  • get_payload (callable(int)->int) – A function to call to get the payload later, passing in the index

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

Return type:

MultiCastCommand

spynnaker.pyNN.external_devices_models.spif_devices.set_distiller_key(index, key)[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 (int) – The index of the channel to set (0-5)

  • key (int) – The key to set

Return type:

MulticastCommand

spynnaker.pyNN.external_devices_models.spif_devices.set_distiller_mask(index, mask)[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 (int) – The index of the channel to set (0-5)

  • mask (int) – The mask to set

Return type:

MulticastCommand

spynnaker.pyNN.external_devices_models.spif_devices.set_distiller_mask_delayed(index, mask_func)[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 (int) – The index of the channel to set (0-5)

  • mask_func (callable(int)->int) – The function to call to set the mask - takes index as argument

Return type:

MulticastCommand

spynnaker.pyNN.external_devices_models.spif_devices.set_distiller_shift(index, shift)[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 (int) – The index of the channel to set (0-5)

  • shift (int) – The shift to set

Return type:

MulticastCommand

spynnaker.pyNN.external_devices_models.spif_devices.set_field_limit(pipe, index, limit)[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 (int) – The SPIF pipe to set the limit of (0-1)

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

  • limit (int) – The maximum value of the field

Return type:

MultiCastCommand

spynnaker.pyNN.external_devices_models.spif_devices.set_field_mask(pipe, index, mask)[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 (int) – The SPIF pipe to set the mask of (0-1)

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

  • mask (int) – The mask to set

Return type:

MultiCastCommand

spynnaker.pyNN.external_devices_models.spif_devices.set_field_shift(pipe, index, shift)[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 (int) – The SPIF pipe to set the shift of (0-1)

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

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

Return type:

MultiCastCommand

spynnaker.pyNN.external_devices_models.spif_devices.set_filter_mask(pipe, index, mask)[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 (int) – The SPIF pipe to set the filter of (0-1)

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

  • mask (int) – The filter mask to set

Return type:

MultiCastCommand

spynnaker.pyNN.external_devices_models.spif_devices.set_filter_value(pipe, index, value)[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 (int) – The SPIF pipe to set the filter of (0-1)

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

  • value (int) – The filter value to set

Return type:

MultiCastCommand

spynnaker.pyNN.external_devices_models.spif_devices.set_input_key(pipe, index, key)[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 (int) – The SPIF pipe to set the input of (0-1)

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

  • key (int) – The key to set

Return type:

MultiCastCommand

spynnaker.pyNN.external_devices_models.spif_devices.set_input_mask(pipe, index, mask)[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 (int) – The SPIF pipe to set the input of (0-1)

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

  • mask (int) – The mask to set

Return type:

MultiCastCommand

spynnaker.pyNN.external_devices_models.spif_devices.set_input_route(pipe, index, route)[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 (int) – The SPIF pipe to set the input of (0-1)

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

  • route (int) – The route to set

Return type:

MultiCastCommand

spynnaker.pyNN.external_devices_models.spif_devices.set_mapper_key(pipe, key)[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 (int) – The SPIF pipe to set the key of (0-1)

  • key (int) – The output key to set

Return type:

MultiCastCommand

spynnaker.pyNN.external_devices_models.spif_devices.set_xp_key(index, key)[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 (int) – The index of the channel to set (0-5)

  • key (int) – The key to set

Return type:

MulticastCommand

spynnaker.pyNN.external_devices_models.spif_devices.set_xp_key_delayed(index, key_func)[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 (int) – The index of the channel to set (0-5)

  • key_func (callable(int)->int) – The function to call to get the key

Return type:

MulticastCommand

spynnaker.pyNN.external_devices_models.spif_devices.set_xp_mask(index, mask)[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 (int) – The index of the channel to set (0-5)

  • mask (int) – The mask to set

Return type:

MulticastCommand

spynnaker.pyNN.external_devices_models.spif_devices.set_xp_mask_delayed(index, mask_func)[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 (int) – The index of the channel to set (0-5)

  • mask_func (callable(int)->int) – The function to call to get the mask

Return type:

MulticastCommand

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.

abstract get_external_devices() Iterable[AbstractMulticastControllableDevice][source]

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

Return type:

iterable(AbstractMulticastControllableDevice)

abstract get_message_translator() AbstractEthernetTranslator[source]

Get the translator of messages.

Return type:

AbstractEthernetTranslator

abstract get_outgoing_partition_ids() List[str][source]

Get the partition IDs of messages coming out of the controller.

Return type:

list(str)

class spynnaker.pyNN.external_devices_models.AbstractEthernetSensor

Bases: object

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

abstract get_database_connection() SpynnakerLiveSpikesConnection[source]

Get a Database Connection instance that this device uses to inject packets.

Return type:

SpynnakerLiveSpikesConnection

abstract get_injector_label() str[source]

Get the label to give to the Spike Injector.

Return type:

str

abstract get_injector_parameters() Dict[str, Any][source]

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

Return type:

dict(str,Any)

abstract get_n_neurons() int[source]

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

Return type:

int

abstract get_translator() AbstractEthernetTranslator[source]

Get a translator of multicast commands to Ethernet commands.

Return type:

AbstractEthernetTranslator

class spynnaker.pyNN.external_devices_models.AbstractEthernetTranslator

Bases: object

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

abstract translate_control_packet(multicast_packet: MultiCastCommand)[source]

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

Parameters:

multicast_packet (AbstractDataElement) – 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

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

Return type:

int

abstract property device_control_key: int

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

Return type:

int

abstract property device_control_max_value: float

The maximum value to send to the device.

Return type:

float

abstract property device_control_min_value: float

The minimum value to send to the device.

Return type:

float

abstract property device_control_partition_id: str

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

Return type:

str

property device_control_scaling_factor: int

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

Return type:

int

abstract property device_control_send_type: SendType

The type of data to be sent.

Return type:

SendType

abstract property device_control_timesteps_between_sending: int

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

Return type:

int

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.

Return type:

bool

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 (int) – Number of neurons

  • fpga_link_id (int)

  • fpga_id (int)

  • board_address (str or None)

  • chip_coords (tuple(int, int) or None)

  • label (str or None)

class spynnaker.pyNN.external_devices_models.ExternalCochleaDevice(n_neurons: int, spinnaker_link: int, label: str | None = None, board_address: str | None = None)

Bases: ApplicationSpiNNakerLinkVertex, PopulationApplicationVertex

An ear vertex.

Parameters:
  • n_neurons (int) – Number of neurons

  • spinnaker_link (int) – The SpiNNaker link to which the cochlea is connected

  • label (str)

  • board_address (str)

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

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 (str) – Name of the model.

  • binary (str) – Name of the implementation executable.

  • neuron_model (NeuronModel) – The model of the neuron body

  • input_type (AbstractInputType) – The model of synaptic input types

  • synapse_type (AbstractSynapseType) – The model of the synapses’ dynamics

  • threshold_type (AbstractThresholdType) – The model of the firing threshold

  • additional_input_type (AbstractAdditionalInput or None) – 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: SplitterAbstractPopulationVertex | None = None, seed: int | None = None, n_colour_bits: int | None = None, n_steps_per_timestep: int = 1) AbstractPopulationVertex[source]

Create a vertex for a population of the model.

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

  • label (str) – The label to give to the vertex

  • spikes_per_second (float)

  • ring_buffer_sigma (float)

  • incoming_spike_buffer_size (int)

  • drop_late_spikes (bool)

  • splitter (SplitterAbstractPopulationVertex or None)

  • seed (int)

  • n_colour_bits (int)

  • n_steps_per_timestep (int)

Returns:

An application vertex for the population

Return type:

PopulationApplicationVertex

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 (str) – The retina “mode”

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

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

  • polarity (str) – The “polarity” of the retina data

  • label (str)

  • board_address (str)

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_gixed_key_and_mask() for the conditions.

Parameters:

partition_id (str) – The identifier of the partition to get the key for

Return type:

BaseKeyAndMask or None

static get_n_neurons(mode: str, polarity: str) int[source]
Parameters:
  • mode (str) – 128 or 64 or 32 or 16

  • parity (str) – UP or DOWN or MERGED

Return type:

int

property pause_stop_commands: Iterable[MultiCastCommand]

The commands needed when pausing or stopping simulation.

Return type:

iterable(MultiCastCommand)

property start_resume_commands: Iterable[MultiCastCommand]

The commands needed when starting or resuming simulation.

Return type:

iterable(MultiCastCommand)

property timed_commands: List[MultiCastCommand]

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

Return type:

list(MultiCastCommand)

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 (int) – The key that is common over the whole vertex

  • width (int) – The width of the retina in pixels

  • height (int) – The height of the retina in pixels

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

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

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

  • board_address (str or None) – 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_gixed_key_and_mask() for the conditions.

Parameters:

partition_id (str) – The identifier of the partition to get the key for

Return type:

BaseKeyAndMask or None

get_incoming_slice(index: int) Slice[source]

Get the slice to be given to the connection.

Parameters:

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

Return type:

Slice

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 (MachineVertex) – A source machine vertex of this application vertex

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

Return type:

BaseKeyAndMask or None

class spynnaker.pyNN.external_devices_models.MachineMunichMotorDevice(speed, sample_time, update_time, delay_time, delta_threshold, continue_if_not_different, label=None, app_vertex=None)

Bases: MachineVertex, AbstractGeneratesDataSpecification, AbstractHasAssociatedBinary, ProvidesProvenanceDataFromMachineImpl

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

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

Generate a data specification.

Parameters:
  • spec (DataSpecificationGenerator) – The data specification to write to

  • placement (Placement) – The placement the vertex is located at

get_binary_file_name() str[source]

Get the binary name to be run for this vertex.

Return type:

str

get_binary_start_type() ExecutableType[source]

Get the start type of the binary to be run.

Return type:

ExecutableType

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 (str) – The identifier of the partition; the partition_id param is only used by some MachineVertex subclasses

Returns:

The number of keys required

Return type:

int

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

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

Called by get_provenance_data_from_machine()

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

  • x (int) – x coordinate of the chip where this core

  • y (int) – y coordinate of the core where this core

  • p (int) – virtual id of the core

  • provenance_data (list(int)) – The list of words of raw provenance data.

reserve_memory_regions(spec)[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 (DataSpecificationGenerator) – The data specification to write to

property sdram_required: ConstantSDRAM

The SDRAM space required by the vertex.

Return type:

AbstractSDRAM

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

Bases: AbstractOneAppOneMachineVertex, AbstractVertexWithEdgeToDependentVertices, PopulationApplicationVertex

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

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

  • board_address (str or None)

  • speed (int)

  • sample_time (int)

  • update_time (int)

  • delay_time (int)

  • delta_threshold (int)

  • continue_if_not_different (bool)

  • label (str or None)

default_initial_values = {}
default_parameters = {'board_address': None, 'continue_if_not_different': True, 'delay_time': 5, 'delta_threshold': 23, 'label': None, 'sample_time': 4096, 'speed': 30, 'update_time': 512}
dependent_vertices() Iterable[ApplicationVertex][source]

Return the vertices which this vertex depends upon.

Return type:

iterable(ApplicationVertex)

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

Return the dependent edge identifiers for a particular dependent vertex.

Parameters:

vertex (ApplicationVertex)

Return type:

iterable(str)

class spynnaker.pyNN.external_devices_models.MunichRetinaDevice(retina_key, spinnaker_link_id, position, label='MunichRetinaDevice', polarity=None, board_address=None)

Bases: ApplicationSpiNNakerLinkVertex, PopulationApplicationVertex, AbstractSendMeMulticastCommandsVertex

An Omnibot silicon retina device.

Parameters:
  • retina_key (int)

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

  • position (str) – LEFT or RIGHT

  • label (str)

  • polarity (str) – UP, DOWN or MERGED

  • board_address (str or None)

DOWN_POLARITY = 'DOWN'
LEFT_RETINA = 'LEFT'
MERGED_POLARITY = 'MERGED'
RIGHT_RETINA = 'RIGHT'
UP_POLARITY = 'UP'
default_parameters = {'board_address': None, 'label': 'MunichRetinaDevice', 'polarity': None}
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_gixed_key_and_mask() for the conditions.

Parameters:

partition_id (str) – The identifier of the partition to get the key for

Return type:

BaseKeyAndMask or None

property pause_stop_commands: Iterable[MultiCastCommand]

The commands needed when pausing or stopping simulation.

Return type:

iterable(MultiCastCommand)

property start_resume_commands: Iterable[MultiCastCommand]

The commands needed when starting or resuming simulation.

Return type:

iterable(MultiCastCommand)

property timed_commands: List[MultiCastCommand]

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

Return type:

list(MultiCastCommand)

class spynnaker.pyNN.external_devices_models.SPIFInputDevice(pipe, n_neurons, n_neurons_per_partition, base_key=None, board_address=None, chip_coords=None)

Bases: ApplicationFPGAVertex, PopulationApplicationVertex, AbstractSendMeMulticastCommandsVertex

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

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

  • n_neurons (int) – The number of neurons in the device

  • height (int) – The height of the retina in pixels

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

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

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

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

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

  • board_address (str or None) – 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 (tuple(int, int) or None) – 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 (MachineVertex) – The machine vertex to get the map for

  • partition_id (str) – The partition to get the map for

  • routing_info (RoutingInfo) – Routing information

Returns:

A list of (atom_id, key)

Return type:

list(tuple(int,int))

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_gixed_key_and_mask() for the conditions.

Parameters:

partition_id (str) – The identifier of the partition to get the key for

Return type:

BaseKeyAndMask or None

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

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

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

Return type:

Slice

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 (MachineVertex) – A source machine vertex of this application vertex

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

Return type:

BaseKeyAndMask or None

property pause_stop_commands: Iterable[MultiCastCommand]

The commands needed when pausing or stopping simulation.

Return type:

iterable(MultiCastCommand)

property start_resume_commands: Iterable[MultiCastCommand]

The commands needed when starting or resuming simulation.

Return type:

iterable(MultiCastCommand)

property timed_commands: List[MultiCastCommand]

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

Return type:

list(MultiCastCommand)

class spynnaker.pyNN.external_devices_models.SPIFOutputDevice(board_address=None, chip_coords=None, label=None, create_database=True, database_notify_host=None, database_notify_port_num=None, database_ack_port_num=None, output_key_shift=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 (int or None) – The board IP address of the SPIF device

  • chip_coords (tuple(int, int) or None) – The chip coordinates of the SPIF device

  • label (int or None) – The label to give the SPIF device

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

  • database_notify_host (str or None) – The host that will read the database

  • database_notify_port_num (int or None) – The port of the host that will read the database

  • database_ack_port_num (int or None) – The port to listen on for responses from the host reading the database

  • proj_index_shift (int) – The shift to apply to the population indices when added to the key

add_incoming_edge(edge: ApplicationEdge, partition: ApplicationEdgePartition)[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:
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.

Return type:

Dict[MachineVertex, List[Tuple[int, int]]]

property pause_stop_commands: Iterable[MultiCastCommand]

The commands needed when pausing or stopping simulation.

Return type:

iterable(MultiCastCommand)

set_output_key_and_mask(population, key, mask)[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 (Population) – The PyNN source Population

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

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

property start_resume_commands: Iterable[MultiCastCommand]

The commands needed when starting or resuming simulation.

Return type:

iterable(MultiCastCommand)

property timed_commands: List[MultiCastCommand]

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

Return type:

list(MultiCastCommand)

class spynnaker.pyNN.external_devices_models.SPIFRetinaDevice(pipe, width, height, sub_width, sub_height, base_key=None, input_x_shift=16, input_y_shift=0, board_address=None, chip_coords=None)

Bases: Application2DFPGAVertex, PopulationApplicationVertex, AbstractSendMeMulticastCommandsVertex

A retina device connected to SpiNNaker using a SPIF board.

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

  • width (int) – The width of the retina in pixels

  • height (int) – The height of the retina in pixels

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

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

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

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

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

  • board_address (str or None) –

    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 (tuple(int, int) or None) –

    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 (MachineVertex) – The machine vertex to get the map for

  • partition_id (str) – The partition to get the map for

  • routing_info (RoutingInfo) – Routing information

Returns:

A list of (atom_id, key)

Return type:

list(tuple(int,int))

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_gixed_key_and_mask() for the conditions.

Parameters:

partition_id (str) – The identifier of the partition to get the key for

Return type:

BaseKeyAndMask or None

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

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

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

Return type:

Slice

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 (MachineVertex) – A source machine vertex of this application vertex

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

Return type:

BaseKeyAndMask or None

property pause_stop_commands: Iterable[MultiCastCommand]

The commands needed when pausing or stopping simulation.

Return type:

iterable(MultiCastCommand)

property start_resume_commands: Iterable[MultiCastCommand]

The commands needed when starting or resuming simulation.

Return type:

iterable(MultiCastCommand)

property timed_commands: List[MultiCastCommand]

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

Return type:

list(MultiCastCommand)

class spynnaker.pyNN.external_devices_models.SendType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

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:

device (list(AbstractMulticastControllableDevice))

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

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

Parameters:

parameters (RangeDictionary) – A holder of the parameters

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

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

Parameters:

state_variables (RangeDictionary) – A holder of the state variables