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, create_edges, max_atoms_per_core, neuron_impl, pynn_model, translator=None, spikes_per_second=None, label=None, ring_buffer_sigma=None, incoming_spike_buffer_size=None, drop_late_spikes=None, splitter=None, seed=None, n_colour_bits=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:
  • devices (list(AbstractMulticastControllableDevice)) – The AbstractMulticastControllableDevice instances to be controlled by the population

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

  • max_atoms_per_core (int) –

  • neuron_impl (AbstractNeuronImpl) –

  • pynn_model (AbstractPyNNNeuronModel) –

  • translator (AbstractEthernetTranslator or None) – Translator to be used when used for Ethernet communication. Must be provided if the dev is to be controlled over Ethernet.

  • spikes_per_second (float) –

  • label (str) –

  • ring_buffer_sigma (float) –

  • incoming_spike_buffer_size (int) –

  • splitter (None or AbstractSplitterCommon) – splitter from application vertices to machine vertices

  • n_colour_bits (int) – The number of colour bits to use

dependent_vertices()[source]

Return the vertices which this vertex depends upon.

Return type:

iterable(ApplicationVertex)

edge_partition_identifiers_for_dependent_vertex(vertex)[source]

Return the dependent edge identifiers for a particular dependent vertex.

Parameters:

vertex (ApplicationVertex) –

Return type:

iterable(str)

get_atom_key_map(pre_vertex, partition_id, routing_info)[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()[source]

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

Return type:

iterable(AbstractMulticastControllableDevice)

get_fixed_key_and_mask(partition_id)[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()[source]

Get the translator of messages.

Return type:

AbstractEthernetTranslator

get_outgoing_partition_ids()[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 16 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

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

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

The base key which identifies packets to send out to the peripheral

P_MASK = 3

The mask which identifies packets to send out to the peripheral

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

cmd(payload=None)[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

Return type:

MultiCastCommand

delayed_command(get_payload)[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) – A function to call to get the payload later

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

Module contents

class spynnaker.pyNN.external_devices_models.AbstractEthernetController[source]

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()[source]

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

Return type:

iterable(AbstractMulticastControllableDevice)

abstract get_message_translator()[source]

Get the translator of messages.

Return type:

AbstractEthernetTranslator

abstract get_outgoing_partition_ids()[source]

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

Return type:

list(str)

class spynnaker.pyNN.external_devices_models.AbstractEthernetSensor[source]

Bases: object

abstract get_database_connection()[source]

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

Return type:

SpynnakerLiveSpikesConnection

abstract get_injector_label()[source]

Get the label to give to the Spike Injector.

Return type:

str

abstract get_injector_parameters()[source]

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

Return type:

dict(str,Any)

abstract get_n_neurons()[source]

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

Return type:

int

abstract get_translator()[source]

Get a translator of multicast commands to Ethernet commands.

Return type:

AbstractEthernetTranslator

class spynnaker.pyNN.external_devices_models.AbstractEthernetTranslator[source]

Bases: object

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

abstract translate_control_packet(multicast_packet)[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[source]

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

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

Return type:

int

abstract property device_control_key

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

Return type:

int

abstract property device_control_max_value

The maximum value to send to the device.

Return type:

float

abstract property device_control_min_value

The minimum value to send to the device.

Return type:

float

abstract property device_control_partition_id

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

Return type:

str

property device_control_scaling_factor

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

Return type:

int

abstract property device_control_send_type

The type of data to be sent.

Return type:

SendType

abstract property device_control_timesteps_between_sending

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

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, fpga_link_id, fpga_id, board_address=None, chip_coords=None, label=None)[source]

Bases: ApplicationFPGAVertex, PopulationApplicationVertex

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, spinnaker_link, label=None, board_address=None)[source]

Bases: ApplicationSpiNNakerLinkVertex, PopulationApplicationVertex

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)[source]

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:
create_vertex(n_neurons, label, spikes_per_second, ring_buffer_sigma, incoming_spike_buffer_size, n_steps_per_timestep, drop_late_spikes, splitter, seed, n_colour_bits)[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 (AbstractSplitterCommon) –

  • seed (float) –

  • 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, retina_key, spinnaker_link_id, polarity, label=None, board_address=None)[source]

Bases: ApplicationSpiNNakerLinkVertex, PopulationApplicationVertex, AbstractSendMeMulticastCommandsVertex

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)[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, polarity)[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

The commands needed when pausing or stopping simulation.

Return type:

iterable(MultiCastCommand)

property start_resume_commands

The commands needed when starting or resuming simulation.

Return type:

iterable(MultiCastCommand)

property timed_commands

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

Return type:

iterable(MultiCastCommand)

class spynnaker.pyNN.external_devices_models.ICUBRetinaDevice(base_key=0, width=304, height=240, sub_width=16, sub_height=16, spinnaker_link_id=0, board_address=None)[source]

Bases: Application2DSpiNNakerLinkVertex, HasShapeKeyFields

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)[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)[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, partition_id)[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

get_shape_key_fields(vertex_slice)[source]

Get the fields to be used for each dimension in the shape of the given source vertex slice, as a list of start, size, mask, shift values in the order of the fields.

Parameters:

vertex_slice (Slice) – The slice of the source vertex

Return type:

list(tuple(int, int, int, int))

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)[source]

Bases: MachineVertex, AbstractGeneratesDataSpecification, AbstractHasAssociatedBinary, ProvidesProvenanceDataFromMachineImpl

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

Parameters:
  • speed (int) –

  • sample_time (int) –

  • update_time (int) –

  • delay_time (int) –

  • delta_threshold (int) –

  • continue_if_not_different (bool) –

  • label (str) –

  • app_vertex (ApplicationVertex) –

INPUT_BUFFER_FULL_NAME = 'Times_the_input_buffer_lost_packets'

The name of the provenance item saying that packets were lost.

MOTOR_PARTITION_ID = 'MOTOR'
generate_data_specification(spec, placement)[source]

Generate a data specification.

Parameters:
get_binary_file_name()[source]

Get the binary name to be run for this vertex.

Return type:

str

get_binary_start_type()[source]

Get the start type of the binary to be run.

Return type:

ExecutableType

get_n_keys_for_partition(partition_id)[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, x, y, p, provenance_data)[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

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)[source]

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()[source]

Return the vertices which this vertex depends upon.

Return type:

iterable(ApplicationVertex)

edge_partition_identifiers_for_dependent_vertex(vertex)[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)[source]

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'

Select the left retina

MERGED_POLARITY = 'MERGED'
RIGHT_RETINA = 'RIGHT'

Select the right retina

UP_POLARITY = 'UP'
default_parameters = {'board_address': None, 'label': 'MunichRetinaDevice', 'polarity': None}
get_fixed_key_and_mask(partition_id)[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

The commands needed when pausing or stopping simulation.

Return type:

iterable(MultiCastCommand)

property start_resume_commands

The commands needed when starting or resuming simulation.

Return type:

iterable(MultiCastCommand)

property timed_commands

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

Return type:

iterable(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)[source]

Bases: ApplicationFPGAVertex, PopulationApplicationVertex, AbstractSendMeMulticastCommandsVertex

Output (only) to a SPIF device.

Parameters:
  • n_atoms (int) – The number of atoms in the vertex

  • incoming_fpga_connections (list(FPGAConnection) or None) – The connections from one or more FPGAs that that packets are expected to be received from for this device, or None if no incoming traffic is expected from the device

  • outgoing_fpga_connection (FPGAConnection or None) – The connection to an FPGA that packets to be sent to this device should be sent down, or None if no outgoing traffic is expected to be sent to the device.

  • label (str) – The optional name of the vertex.

  • n_machine_vertices_per_link (int) – The optional number of machine vertices to create for each FPGA link (1 by default)

add_incoming_edge(edge, partition)[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:
property pause_stop_commands

The commands needed when pausing or stopping simulation.

Return type:

iterable(MultiCastCommand)

property start_resume_commands

The commands needed when starting or resuming simulation.

Return type:

iterable(MultiCastCommand)

property timed_commands

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

Return type:

iterable(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)[source]

Bases: Application2DFPGAVertex, PopulationApplicationVertex, AbstractSendMeMulticastCommandsVertex, HasShapeKeyFields

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

See Y_MASK for description

X_PER_ROW = 4

The number of X values per row

Y_MASK = 1

SPIF outputs to 8 FPGA output links, so we split into (2 x 4), meaning a mask of (1 x 3)

get_atom_key_map(pre_vertex, partition_id, routing_info)[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)[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, partition_id)[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

get_shape_key_fields(vertex_slice)[source]

Get the fields to be used for each dimension in the shape of the given source vertex slice, as a list of start, size, mask, shift values in the order of the fields.

Parameters:

vertex_slice (Slice) – The slice of the source vertex

Return type:

list(tuple(int, int, int, int))

property pause_stop_commands

The commands needed when pausing or stopping simulation.

Return type:

iterable(MultiCastCommand)

property start_resume_commands

The commands needed when starting or resuming simulation.

Return type:

iterable(MultiCastCommand)

property timed_commands

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

Return type:

iterable(MultiCastCommand)

class spynnaker.pyNN.external_devices_models.SendType(value)[source]

Bases: Enum

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

SEND_TYPE_ACCUM = 2

Signed accum (s15.16)

SEND_TYPE_FRACT = 4

Signed fract (s0.31)

SEND_TYPE_INT = 0

Signed integer

SEND_TYPE_UACCUM = 3

Unsigned accum (u16.16)

SEND_TYPE_UFRACT = 5

Unsigned fract (u0.32)

SEND_TYPE_UINT = 1

Unsigned integer

class spynnaker.pyNN.external_devices_models.ThresholdTypeMulticastDeviceControl(devices)[source]

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)[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)[source]

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

Parameters:

state_variables (RangeDictionary) – A holder of the state variables