Module devices.xylo.xylo_devkit_utils

Utilities for working with the Xylo HDK.

Ideally you should not need to use these utility functions. You should try using XyloSamna and XyloSim for high-level interfaces to Xylo.

Functions overview

advance_time_step(write_buffer)

Take a single manual time-step on a Xylo HDK

apply_configuration(hdk, config, ...)

Apply a configuration to the Xylo HDK

blocking_read(read_buffer[, ...])

Perform a blocking read on a buffer, optionally waiting for a certain count, a target timestamp, or imposing a timeout

configure_accel_time_mode(config, ...[, ...])

Switch on accelerated-time mode on a Xylo hdk, and configure network monitoring

configure_single_step_time_mode(config)

Switch on single-step model on a Xylo hdk

decode_accel_mode_data(events[, Nhidden, Nout])

Decode events from accelerated-time operation of the Xylo HDK

decode_memory_read_events(events, start_address)

Decode a list of events containing memory reads from a Xylo HDK

export_allram_state(path, config, inp_spks, ...)

Export the all RAM state of a Xylo network over time, for debugging purposes

export_config(path, config, dt)

Export a network configuration to a set of text files, for debugging purposes

export_frozen_state(path, config, state)

Export a single time-step frozen state of a Xylo network

export_last_state(path, config, inp_spks, state)

Export the final state of a Xylo network, evolved over an input

export_registers(read_buffer, write_buffer, file)

Print register contents for debugging purposes

export_temporal_state(path, config, ...)

Export the state of a Xylo network over time, for debugging purposes

find_xylo_boards()

Search for and return a list of Xylo HDK

generate_read_memory_events(start_address[, ...])

Build a list of events that cause Xylo memory to be read

get_current_timestamp(read_buffer, write_buffer)

Retrieve the current timestamp on a Xylo HDK

initialise_xylo_hdk(write_buffer)

Initialise the Xylo HDK

is_xylo_ready(read_buffer, write_buffer)

Query a Xylo HDK to see if it is ready for a time-step

new_xylo_read_buffer(hdk)

Create and connect a new buffer to read from a Xylo HDK

new_xylo_state_monitor_buffer(hdk)

Create a new buffer for monitoring neuron and synapse state and connect it

new_xylo_write_buffer(hdk)

Create a new buffer for writing events to a Xylo HDK

num_buffer_neurons(Nhidden)

Number of buffer neurons required for this network on Xylo 1

print_debug_ram(read_buffer, write_buffer[, ...])

Print memory contents for debugging purposes

print_debug_registers(read_buffer, write_buffer)

Print register contents of a Xylo HDK for debugging purposes

read_accel_mode_data(monitor_buffer, Nin, ...)

Read accelerated simulation mode data from a Xylo HDK

read_allram_state(read_buffer, write_buffer)

Read and return the all ram in each step as a state

read_memory(read_buffer, write_buffer, ...)

Read a block of memory from a Xylo HDK

read_neuron_synapse_state(read_buffer, ...)

Read and return the current neuron and synaptic state of neurons

read_output_events(read_buffer, write_buffer)

Read the spike flags from the output neurons on a Xylo HDK

read_register(read_buffer, write_buffer, address)

Read the contents of a register

reset_input_spikes(write_buffer)

Reset the input spike registers on a Xylo HDK

reset_neuron_synapse_state(hdk, read_buffer, ...)

Reset the neuron and synapse state on a Xylo HDK

send_immediate_input_spikes(write_buffer, ...)

Send input events with no timestamp to a Xylo HDK

to_hex(n, digits)

Output a consistent-length hex string encoding a number

verify_xylo_version(read_buffer, write_buffer)

Verify that the provided daughterbaord returns the correct version ID for Xylo

write_memory(write_buffer, start_address[, ...])

Write data to Xylo memory

write_register(write_buffer, register[, data])

Write data to a register on a Xylo HDK

zero_memory(write_buffer)

Clear all Xylo memory

Classes overview

XyloAllRam(Nin, Nhidden, Nout, V_mem_hid, ...)

NamedTuple that encapsulates a recorded Xylo HDK state

XyloState(Nin, Nhidden, Nout, V_mem_hid, ...)

NamedTuple that encapsulates a recorded Xylo HDK state

Functions

devices.xylo.xylo_devkit_utils.advance_time_step(write_buffer: samna.BasicSourceNode_xylo_event_input_event) None[source]

Take a single manual time-step on a Xylo HDK

Parameters

write_buffer (XyloWriteBuffer) – A write buffer connected to the Xylo HDK

devices.xylo.xylo_devkit_utils.apply_configuration(hdk: Any, config: samna.xylo.configuration.XyloConfiguration, read_buffer: samna.BasicSinkNode_xylo_event_output_event, write_buffer: samna.BasicSourceNode_xylo_event_input_event) None[source]

Apply a configuration to the Xylo HDK

Parameters
  • hdk (XyloHDK) – The Xylo HDK to write the configuration to

  • config (XyloConfiguration) – A configuration for Xylo

  • read_buffer (XyloReadBuffer) – A connected read buffer for the Xylo HDK

  • write_buffer (XyloWriteBuffer) – A connected write buffer for the Xylo HDK

devices.xylo.xylo_devkit_utils.blocking_read(read_buffer: samna.BasicSinkNode_xylo_event_output_event, target_timestamp: typing.Optional[int] = None, count: typing.Optional[int] = None, timeout: typing.Optional[float] = None) -> (typing.List, <class 'bool'>)[source]

Perform a blocking read on a buffer, optionally waiting for a certain count, a target timestamp, or imposing a timeout

You should not provide count and target_timestamp together.

Parameters
  • read_buffer (XyloReadBuffer) – A buffer to read from

  • target_timestamp (Optional[int]) – The desired final timestamp. Read until this timestamp is returned in an event. Default: None, don’t wait until a particular timestamp is read.

  • count (Optional[int]) – The count of required events. Default: None, just wait for any data.

  • timeout (Optional[float]) – The time in seconds to wait for a result. Default: None, no timeout: block until a read is made.

Returns

event_list, is_timeout event_list is a list of events read from the HDK. is_timeout is a boolean flag indicating that the read resulted in a timeout

Return type

(List, bool)

devices.xylo.xylo_devkit_utils.configure_accel_time_mode(config: samna.xylo.configuration.XyloConfiguration, state_monitor_buffer: samna.xylo.NeuronStateSinkNode, monitor_Nhidden: typing.Optional[int] = 0, monitor_Noutput: typing.Optional[int] = 0, readout='Spike', record=False) -> (<class 'samna.xylo.configuration.XyloConfiguration'>, <class 'samna.xylo.NeuronStateSinkNode'>)[source]

Switch on accelerated-time mode on a Xylo hdk, and configure network monitoring

Notes

Use new_xylo_state_monitor_buffer() to generate a buffer to monitor neuron and synapse state.

Parameters
  • config (XyloConfiguration) – The desired Xylo configuration to use

  • state_monitor_buffer (XyloNeuronStateBuffer) – A connected neuron state monitor buffer

  • monitor_Nhidden (Optional[int]) – The number of hidden neurons for which to monitor state during evolution. Default: 0, don’t monitor any hidden neurons.

  • monitor_Noutput (Optional[int]) – The number of output neurons for which to monitor state during evolution. Default: 0, don’t monitor any output neurons.

  • readout – The readout out mode for which to output neuron states. Default: ``Spike’’.

  • record (bool) – Iff True, record state during evolution. Default: False, do not record state.

Returns

config and monitor_buffer

Return type

(XyloConfiguration, XyloNeuronStateBuffer)

devices.xylo.xylo_devkit_utils.configure_single_step_time_mode(config: samna.xylo.configuration.XyloConfiguration) samna.xylo.configuration.XyloConfiguration[source]

Switch on single-step model on a Xylo hdk

Parameters
  • hdk (XyloBaughterBoard) – The Xylo HDK to configure

  • config (XyloConfiguration) – The desired Xylo configuration to use

devices.xylo.xylo_devkit_utils.decode_accel_mode_data(events: List[Any], Nhidden: int = 1000, Nout: int = 8) Tuple[devices.xylo.xylo_devkit_utils.XyloState, numpy.ndarray][source]

Decode events from accelerated-time operation of the Xylo HDK

Warning

Nhidden and Nout must be defined correctly for the network deployed to the Xylo HDK, for this function to operate as expected.

This function must be called with the full list of events from a simulation. Otherwise the data returned will be incomplete. This function will not operate as expected if provided with incomplete data.

You can use the target_timstamp argument to blocking_read to ensure that you have read events up to the desired final timestep.

Parameters
  • events (List[Any]) – A list of events produced during an accelerated-mode simulation on a Xylo HDK

  • Nhidden (int) – The number of defined hidden-layer neurons. Default: 1000, expect to read the state of every neuron.

  • Nout (int) – The number of defined output-layer neurons. Default: 8, expect to read the state of every neuron.

Returns

A NamedTuple containing the decoded state resulting from the simulation, and an array of timestamps for each state entry over time

Return type

(XyloState, np.ndarray)

devices.xylo.xylo_devkit_utils.decode_memory_read_events(events: List[Any], start_address: int, count: int = 1) List[source]

Decode a list of events containing memory reads from a Xylo HDK

This is a low-level function designed to be used in conjuction with generate_read_memory_events().

See also

Use the read_memory() function for a more convenient high-level API.

Parameters
  • events (List) – A list of events read from a Xylo HDK

  • start_address (int) – The starting address for the memory read

  • count (int) – The number of contiguous memory elements that were read

Returns

A list of memory entries extracted from the list of events, in address order

Return type

List

devices.xylo.xylo_devkit_utils.export_allram_state(path: Union[pathlib.Path, str], config: samna.xylo.configuration.XyloConfiguration, inp_spks: numpy.ndarray, state: devices.xylo.xylo_devkit_utils.XyloState) None[source]

Export the all RAM state of a Xylo network over time, for debugging purposes

This function will produce a series of RAM files, per time-step, containing the recorded state evolution of a Xylo network. The files will be written to a directory path, which will be created if necessary.

Parameters
  • path (Path) – The directory to export the state to

  • config (XyloConfiguration) – The configuration of the Xylo network

  • inp_spks (np.ndarray) – The input spikes for this simulation

  • state (XyloState) – A temporal state of a Xylo network to export

devices.xylo.xylo_devkit_utils.export_config(path: Union[str, pathlib.Path], config: samna.xylo.configuration.XyloConfiguration, dt: float) None[source]

Export a network configuration to a set of text files, for debugging purposes

This function produces a large number of text files under the directory path, which will be created if necessary. These files contain detailed memory contents and configuration options specified by an HDK configuration object config.

Parameters
  • path (Union[str, path]) – Directory to write data

  • config (XyloConfiguration) – A Xylo configuraiton to export

  • dt (float) – The time step of the simulation

devices.xylo.xylo_devkit_utils.export_frozen_state(path: Union[str, pathlib.Path], config: samna.xylo.configuration.XyloConfiguration, state: devices.xylo.xylo_devkit_utils.XyloState) None[source]

Export a single time-step frozen state of a Xylo network

This function will produce a series of RAM initialisation files containing a Xylo state, written to the directory path, which will be created if necessary.

Parameters
  • path (Path) – The directory to export the state to

  • config (XyloConfiguration) – The configuration of the Xylo network

  • state (XyloState) – A single time-step state of a Xylo network to export

devices.xylo.xylo_devkit_utils.export_last_state(path: Union[pathlib.Path, str], config: samna.xylo.configuration.XyloConfiguration, inp_spks: numpy.ndarray, state: devices.xylo.xylo_devkit_utils.XyloState) None[source]

Export the final state of a Xylo network, evolved over an input

This function will produce a series of RAM files, per time-step, containing the recorded state evolution of a Xylo network. The files will be written to the directory path, which will be created if necessary.

Parameters
  • path (Path) – The directory to export the state to

  • config (XyloConfiguration) – The configuration of the Xylo network

  • inp_spks (np.ndarray) – The input spikes for this simulation

  • state (XyloState) – A temporal state of a Xylo network to export

devices.xylo.xylo_devkit_utils.export_registers(read_buffer: samna.BasicSinkNode_xylo_event_output_event, write_buffer: samna.BasicSourceNode_xylo_event_input_event, file) None[source]

Print register contents for debugging purposes

Parameters
  • read_buffer (XyloReadBuffer) – A connected Xylo read buffer to use in reading registers

  • write_buffer (XyloWriteBuffer) – A write buffer connected to a Xylo HDK

  • file – a file to save the registers

devices.xylo.xylo_devkit_utils.export_temporal_state(path: Union[pathlib.Path, str], config: samna.xylo.configuration.XyloConfiguration, inp_spks: numpy.ndarray, state: devices.xylo.xylo_devkit_utils.XyloState) None[source]

Export the state of a Xylo network over time, for debugging purposes

This function will produce a series of RAM files, per time-step, containing the recorded state evolution of a Xylo network. The files will be save to the directory path, which will be created if necessary.

Parameters
  • path (Path) – The directory to export the state to

  • config (XyloConfiguration) – The configuration of the Xylo network

  • inp_spks (np.ndarray) – The input spikes for this simulation

  • state (XyloState) – A temporal state of a Xylo network to export

devices.xylo.xylo_devkit_utils.find_xylo_boards() List[Any][source]

Search for and return a list of Xylo HDK

Iterate over devices and search for Xylo HDKs. Return a list of available Xylo HDKs, or an empty list if none are found.

Returns

A (possibly empty) list of Xylo HDK hdks.

Return type

List[XyloHDK]

devices.xylo.xylo_devkit_utils.generate_read_memory_events(start_address: int, count: int = 1) List[Any][source]

Build a list of events that cause Xylo memory to be read

This function is designed to be used with decode_memory_read_events.

See also

Use the read_memory function for a more convenient high-level API.

Parameters
  • start_address (int) – The starting address of the memory read

  • count (int) – The number of memory elements to read. Default: 1, read a single memory address.

Returns

A list of events to send to a Xylo HDK

Return type

List

devices.xylo.xylo_devkit_utils.get_current_timestamp(read_buffer: samna.BasicSinkNode_xylo_event_output_event, write_buffer: samna.BasicSourceNode_xylo_event_input_event, timeout: float = 3.0) int[source]

Retrieve the current timestamp on a Xylo HDK

Parameters
  • read_buffer (XyloReadBuffer) – A connected read buffer for the xylo HDK

  • write_buffer (XyloWriteBuffer) – A connected write buffer for the Xylo HDK

  • timeout (float) – A timeout for reading

Returns

The current timestamp on the Xylo HDK

Return type

int

devices.xylo.xylo_devkit_utils.initialise_xylo_hdk(write_buffer: samna.BasicSourceNode_xylo_event_input_event) None[source]

Initialise the Xylo HDK

Parameters

write_buffer (XyloWriteBuffer) – A write buffer connected to a Xylo HDK to initialise

devices.xylo.xylo_devkit_utils.is_xylo_ready(read_buffer: samna.BasicSinkNode_xylo_event_output_event, write_buffer: samna.BasicSourceNode_xylo_event_input_event) None[source]

Query a Xylo HDK to see if it is ready for a time-step

Parameters
  • read_buffer (XyloReadBuffer) – A buffer to use while reading

  • write_buffer (XyloWriteBuffer) – A buffer to use while writing

Returns: True iff the Xylo HDK has finished all processing

devices.xylo.xylo_devkit_utils.new_xylo_read_buffer(hdk: Any) samna.BasicSinkNode_xylo_event_output_event[source]

Create and connect a new buffer to read from a Xylo HDK

Parameters

hdk (XyloDaughterBoard) –

Returns

Output buffer receiving events from Xylo HDK

Return type

samna.BasicSinkNode_xylo_event_output_event

devices.xylo.xylo_devkit_utils.new_xylo_state_monitor_buffer(hdk: Any) samna.xylo.NeuronStateSinkNode[source]

Create a new buffer for monitoring neuron and synapse state and connect it

Parameters

hdk (XyloDaughterBoard) – A Xylo HDK to configure

Returns

A connected neuron / synapse state monitor buffer

Return type

XyloNeuronStateBuffer

devices.xylo.xylo_devkit_utils.new_xylo_write_buffer(hdk: Any) samna.BasicSourceNode_xylo_event_input_event[source]

Create a new buffer for writing events to a Xylo HDK

Parameters

hdk (XyloDaughterBoard) – A Xylo HDK to create a new buffer for

Returns

A connected event write buffer

Return type

XyloWriteBuffer

devices.xylo.xylo_devkit_utils.num_buffer_neurons(Nhidden: int) int[source]

Number of buffer neurons required for this network on Xylo 1

Parameters

Nhidden (int) – Number of hidden layer neurons

Returns

The number of buffer neurons

Return type

int

devices.xylo.xylo_devkit_utils.print_debug_ram(read_buffer: samna.BasicSinkNode_xylo_event_output_event, write_buffer: samna.BasicSourceNode_xylo_event_input_event, Nin: int = 10, Nhidden: int = 10, Nout: int = 2) None[source]

Print memory contents for debugging purposes

Parameters
  • read_buffer (XyloReadBuffer) – A connected Xylo read buffer to use when reading memory

  • write_buffer (XyloWriteBuffer) – A connected Xylo write buffer to use

  • Nin (int) – Number of input neurons to display. Default: 10.

  • Nhidden (int) – Number of hidden neurons to display. Default: 10.

devices.xylo.xylo_devkit_utils.print_debug_registers(read_buffer: samna.BasicSinkNode_xylo_event_output_event, write_buffer: samna.BasicSourceNode_xylo_event_input_event) None[source]

Print register contents of a Xylo HDK for debugging purposes

Parameters
  • write_buffer (XyloWriteBuffer) – A connected write buffer to a Xylo HDK

  • read_buffer (XyloReadBuffer) – A connected Xylo read buffer to use when reading registers

devices.xylo.xylo_devkit_utils.read_accel_mode_data(monitor_buffer: samna.xylo.NeuronStateSinkNode, Nin: int, Nhidden: int, Nout: int) devices.xylo.xylo_devkit_utils.XyloState[source]

Read accelerated simulation mode data from a Xylo HDK

Parameters
  • monitor_buffer (XyloNeuronStateBuffer) – A connected XyloNeuronStateBuffer to read from

  • Nhidden (int) – The number of hidden neurons to monitor

  • Nout (int) – The number of output neurons to monitor

Returns

The encapsulated state read from the Xylo device

Return type

XyloState

devices.xylo.xylo_devkit_utils.read_allram_state(read_buffer: samna.BasicSinkNode_xylo_event_output_event, write_buffer: samna.BasicSourceNode_xylo_event_input_event, Nin: int = 16, Nhidden: int = 1000, Nout: int = 8) devices.xylo.xylo_devkit_utils.XyloAllRam[source]

Read and return the all ram in each step as a state

Parameters
  • read_buffer (XyloReadBuffer) – A read buffer connected to the Xylo HDK

  • write_buffer (XyloWriteBuffer) – A write buffer connected to the Xylo HDK

Returns

The recorded state as a NamedTuple. Contains keys V_mem_hid, V_mem_out, I_syn_hid, I_syn_out, I_syn2_hid, Nhidden, Nout. This state has no time axis; the first axis is the neuron ID.

Return type

XyloState

devices.xylo.xylo_devkit_utils.read_memory(read_buffer: samna.BasicSinkNode_xylo_event_output_event, write_buffer: samna.BasicSourceNode_xylo_event_input_event, start_address: int, count: int = 1, read_timeout: float = 2.0) List[int][source]

Read a block of memory from a Xylo HDK

Parameters
  • read_buffer (XyloReadBuffer) – A connected read buffer to the desired Xylo HDK

  • write_buffer (XyloWriteBuffer) – A connected write buffer to the desired Xylo HDK

  • start_address (int) – The base address to start reading from

  • count (int) – The number of elements to read

Returns

A list of values read from memory

Return type

List[int]

devices.xylo.xylo_devkit_utils.read_neuron_synapse_state(read_buffer: samna.BasicSinkNode_xylo_event_output_event, write_buffer: samna.BasicSourceNode_xylo_event_input_event, Nhidden: int = 1000, Nout: int = 8) devices.xylo.xylo_devkit_utils.XyloState[source]

Read and return the current neuron and synaptic state of neurons

Parameters
  • read_buffer (XyloReadBuffer) – A read buffer connected to the Xylo HDK

  • write_buffer (XyloWriteBuffer) – A write buffer connected to the Xylo HDK

  • Nhidden (int) – Number of hidden neurons to read. Default: 1000 (all neurons).

  • Nout (int) – Number of output neurons to read. Default: 8 (all neurons).

Returns

The recorded state as a NamedTuple. Contains keys V_mem_hid, V_mem_out, I_syn_hid, I_syn_out, I_syn2_hid, Nhidden, Nout. This state has no time axis; the first axis is the neuron ID.

Return type

XyloState

devices.xylo.xylo_devkit_utils.read_output_events(read_buffer: samna.BasicSinkNode_xylo_event_output_event, write_buffer: samna.BasicSourceNode_xylo_event_input_event) numpy.ndarray[source]

Read the spike flags from the output neurons on a Xylo HDK

Parameters
  • read_buffer (XyloReadBuffer) – A read buffer to use

  • write_buffer (XyloWriteBuffer) – A write buffer to use

Returns

A boolean array of output event flags

Return type

np.ndarray

devices.xylo.xylo_devkit_utils.read_register(read_buffer: samna.BasicSinkNode_xylo_event_output_event, write_buffer: samna.BasicSourceNode_xylo_event_input_event, address: int, timeout: float = 2.0) List[int][source]

Read the contents of a register

Parameters
  • read_buffer (XyloReadBuffer) – A connected read buffer to the XYlo HDK

  • write_buffer (XyloWriteBuffer) – A connected write buffer to the Xylo HDK

  • address (int) – The register address to read

  • timeout (float) – A timeout in seconds

Returns

A list of events returned from the read

Return type

List[int]

devices.xylo.xylo_devkit_utils.reset_input_spikes(write_buffer: samna.BasicSourceNode_xylo_event_input_event) None[source]

Reset the input spike registers on a Xylo HDK

Parameters

write_buffer (XyloWriteBuffer) – A write buffer connected to the Xylo HDK to access

devices.xylo.xylo_devkit_utils.reset_neuron_synapse_state(hdk: Any, read_buffer: samna.BasicSinkNode_xylo_event_output_event, write_buffer: samna.BasicSourceNode_xylo_event_input_event) None[source]

Reset the neuron and synapse state on a Xylo HDK

Parameters
  • hdk (XyloHDK) – The Xylo HDK hdk to reset

  • read_buffer (XyloReadBuffer) – A read buffer connected to the Xylo HDK to reset

  • write_buffer (XyloWriteBuffer) – A write buffer connected to the Xylo HDK to reset

devices.xylo.xylo_devkit_utils.send_immediate_input_spikes(write_buffer: samna.BasicSourceNode_xylo_event_input_event, spike_counts: Iterable[int]) None[source]

Send input events with no timestamp to a Xylo HDK

Parameters
  • write_buffer (XyloWriteBuffer) – A write buffer connected to a Xylo HDK

  • spike_counts (Iterable[int]) – An Iterable containing one slot per input channel. Each entry indicates how many events should be sent to the corresponding input channel.

devices.xylo.xylo_devkit_utils.to_hex(n: int, digits: int) str[source]

Output a consistent-length hex string encoding a number

Parameters
  • n (int) – Number to export

  • digits (int) – Number of digits to produce

Returns

Hex-encoded string, with digits digits

Return type

str

devices.xylo.xylo_devkit_utils.verify_xylo_version(read_buffer: samna.BasicSinkNode_xylo_event_output_event, write_buffer: samna.BasicSourceNode_xylo_event_input_event, timeout: float = 1.0) bool[source]

Verify that the provided daughterbaord returns the correct version ID for Xylo

Parameters
  • read_buffer (XyloReadBuffer) – A read buffer connected to the Xylo HDK

  • write_buffer (XyloWriteBuffer) – A write buffer connected to the Xylo HDK

  • timeout (float) – Timeout for checking in seconds

Returns

True iff the version ID is correct for Xylo

Return type

bool

devices.xylo.xylo_devkit_utils.write_memory(write_buffer: samna.BasicSourceNode_xylo_event_input_event, start_address: int, count: Optional[int] = None, data: Optional[Iterable] = None, chunk_size: int = 65535) None[source]

Write data to Xylo memory

Parameters
  • write_buffer (XyloWriteBuffer) – A write buffer connected to the desired Xylo HDK

  • start_address (int) – The base address to start writing from

  • count (int) – The number of entries to write. Default: len(data)

  • data (Iterable) – A list of data to write to memory. Default: Write zeros.

  • chunk_size (int) – Chunk size to write. Default: 2000. Only needed on OS X, it seems?

devices.xylo.xylo_devkit_utils.write_register(write_buffer: samna.BasicSourceNode_xylo_event_input_event, register: int, data: int = 0) None[source]

Write data to a register on a Xylo HDK

Parameters
  • write_buffer (XyloWriteBuffer) – A connected write buffer to the desintation Xylo HDK

  • register (int) – The address of the register to write to

  • data (int) – The data to write. Default: 0x0

devices.xylo.xylo_devkit_utils.zero_memory(write_buffer: samna.BasicSourceNode_xylo_event_input_event) None[source]

Clear all Xylo memory

This function writes zeros to all memory banks on a Xylo HDK.

Parameters

write_buffer (XyloWriteBuffer) – A write buffer connected to the desired Xylo HDK

Classes

class devices.xylo.xylo_devkit_utils.XyloAllRam(Nin: int, Nhidden: int, Nout: int, V_mem_hid: numpy.ndarray, I_syn_hid: numpy.ndarray, V_mem_out: numpy.ndarray, I_syn_out: numpy.ndarray, I_syn2_hid: numpy.ndarray, Spikes_hid: numpy.ndarray, Spikes_out: numpy.ndarray, IWTRAM_state: numpy.ndarray, IWT2RAM_state: numpy.ndarray, NDSRAM_state: numpy.ndarray, RDS2RAM_state: numpy.ndarray, NDMRAM_state: numpy.ndarray, NTHRAM_state: numpy.ndarray, RCRAM_state: numpy.ndarray, RARAM_state: numpy.ndarray, REFOCRAM_state: numpy.ndarray, RFORAM_state: numpy.ndarray, RWTRAM_state: numpy.ndarray, RWT2RAM_state: numpy.ndarray, OWTRAM_state: numpy.ndarray)[source]

NamedTuple that encapsulates a recorded Xylo HDK state

IWT2RAM_state: numpy.ndarray

Contents of IWT2RAM

Type

np.ndarray

IWTRAM_state: numpy.ndarray

Contents of IWTRAM

Type

np.ndarray

I_syn2_hid: numpy.ndarray

Synaptic current 2 of hidden neurons (Nhidden,)

Type

np.ndarray

I_syn_hid: numpy.ndarray

Synaptic current 1 of hidden neurons (Nhidden,)

Type

np.ndarray

I_syn_out: numpy.ndarray

Synaptic current of output neurons (Nout,)

Type

np.ndarray

NDMRAM_state: numpy.ndarray

Contents of NMDRAM

Type

np.ndarray

NDSRAM_state: numpy.ndarray

Contents of NDSRAM

Type

np.ndarray

NTHRAM_state: numpy.ndarray

Contents of NTHRAM

Type

np.ndarray

Nhidden: int

The number of hidden-layer neurons

Type

int

Nin: int

The number of input-layer neurons

Type

int

Nout: int

The number of output layer neurons

Type

int

OWTRAM_state: numpy.ndarray

Contents of OWTRAM

Type

np.ndarray

RARAM_state: numpy.ndarray

Contents of RARAM

Type

np.ndarray

RCRAM_state: numpy.ndarray

Contents of RCRAM

Type

np.ndarray

RDS2RAM_state: numpy.ndarray

Contents of RDS2RAM

Type

np.ndarray

REFOCRAM_state: numpy.ndarray

Contents of REFOCRAM

Type

np.ndarray

RFORAM_state: numpy.ndarray

Contents of RFORAM

Type

np.ndarray

RWT2RAM_state: numpy.ndarray

Contents of RWT2RAM

Type

np.ndarray

RWTRAM_state: numpy.ndarray

Contents of RWTRAM

Type

np.ndarray

Spikes_hid: numpy.ndarray

Spikes from hidden layer neurons (Nhidden,)

Type

np.ndarray

Spikes_out: numpy.ndarray

Spikes from output layer neurons (Nout,)

Type

np.ndarray

V_mem_hid: numpy.ndarray

Membrane potential of hidden neurons (Nhidden,)

Type

np.ndarray

V_mem_out: numpy.ndarray

Membrane potential of output neurons (Nhidden,)

Type

np.ndarray

_asdict()

Return a new dict which maps field names to their values.

classmethod _make(iterable)

Make a new XyloAllRam object from a sequence or iterable

_replace(**kwds)

Return a new XyloAllRam object replacing specified fields with new values

class devices.xylo.xylo_devkit_utils.XyloState(Nin: int, Nhidden: int, Nout: int, V_mem_hid: numpy.ndarray, I_syn_hid: numpy.ndarray, V_mem_out: numpy.ndarray, I_syn_out: numpy.ndarray, I_syn2_hid: numpy.ndarray, Spikes_hid: numpy.ndarray, Spikes_out: numpy.ndarray)[source]

NamedTuple that encapsulates a recorded Xylo HDK state

I_syn2_hid: numpy.ndarray

Synaptic current 2 of hidden neurons (Nhidden,)

Type

np.ndarray

I_syn_hid: numpy.ndarray

Synaptic current 1 of hidden neurons (Nhidden,)

Type

np.ndarray

I_syn_out: numpy.ndarray

Synaptic current of output neurons (Nout,)

Type

np.ndarray

Nhidden: int

The number of hidden-layer neurons

Type

int

Nin: int

The number of input-layer neurons

Type

int

Nout: int

The number of output layer neurons

Type

int

Spikes_hid: numpy.ndarray

Spikes from hidden layer neurons (Nhidden,)

Type

np.ndarray

Spikes_out: numpy.ndarray

Spikes from output layer neurons (Nout,)

Type

np.ndarray

V_mem_hid: numpy.ndarray

Membrane potential of hidden neurons (Nhidden,)

Type

np.ndarray

V_mem_out: numpy.ndarray

Membrane potential of output neurons (Nhidden,)

Type

np.ndarray

_asdict()

Return a new dict which maps field names to their values.

classmethod _make(iterable)

Make a new XyloState object from a sequence or iterable

_replace(**kwds)

Return a new XyloState object replacing specified fields with new values