samna.speck3.configuration

Contents

samna.speck3.configuration#

Submodules#

Module content#

class samna.speck3.configuration.CnnLayerConfig#

Bases: pybind11_object

Configuration options for CNN layers.

property biases#

Contains bias values for features in a layer.

Formatted as [feature].

Type:

tensor array

property destinations#

List of 2 CnnLayerDestination which describe target destination layers for events produced in this layer.

Type:

Array of 2 fixed length

property dimensions#

Specifies padding, stride, kernel size and I/O shape of the layer.

Type:

Instance of CnnLayerDimensions

from_json(self: samna.speck3.configuration.CnnLayerConfig, arg0: str) None#
property input_congestion_balancer_enable#

Enable input congestion balancer.

Type:

bool

property leak_enable#

Enable leak/bias processing for this layer. A slow clk must be provided to SLOW_CLK pin.

CAUTION: May impact performance significantly.

Type:

bool

property leak_internal_slow_clk_enable#

forward internally generated slow clock to convolutional layers’ leak generator to replace the need of external slow clk. The leakEnable must be set to True first

Type:

bool

property monitor_enable#

Enable monitoring of this layer. When True all events produced by this layer will also be output on the monitoring bus. When False, events will only go to layers selected in the destinations list.

Monitoring should only be enabled on development kits that support fast readout of events.

Type:

bool

property neurons_initial_value#

Contains initial neuron membrane potential values for neurons in a layer.

Formatted as [feature][x][y].

Type:

tensor array

property output_decimator_enable#

Enable output decimator.

Type:

bool

property output_decimator_interval#

Output decimator block interval.

Type:

int

property return_to_zero#

If True neurons in this layer will return to 0 when firing. Otherwise their threshold will be subtracted from the value their membrane potential reached before firing.

Type:

bool

property sram_k_pd#

Kernel SRAM Power Down (low leakage mode) enable bit. When set, the corresponding SRAM is disabled but kept in retention mode (low power consumption). Can be used to disable all the SRAMs of unused layers, as well as the Leak SRAMs when not used.

property sram_l_pd#

Leak SRAM Power Down (low leakage mode) enable bit. When set, the corresponding SRAM is disabled but kept in retention mode (low power consumption). Can be used to disable all the SRAMs of unused layers, as well as the Leak SRAMs when not used.

property sram_n_pd#

Neuron SRAM Power Down (low leakage mode) enable bit. When set, the corresponding SRAM is disabled but kept in retention mode (low power consumption). Can be used to disable all the SRAMs of unused layers, as well as the Leak SRAMs when not used.

property threshold_high#

Set the high threshold. When the neuron membrane potential becomes equal to or great than this value the neuron will fire.

Type:

int

property threshold_low#

The minimum value of the neuron membrane potential which cannot be surpassed by leak.

Type:

int

to_json(self: samna.speck3.configuration.CnnLayerConfig) str#
property weights#

4 dimensional list of lists representing kernel parameters.

Formatted as [feature][channel][x][y].

Type:

tensor array

class samna.speck3.configuration.CnnLayerDestination#

Bases: pybind11_object

Configuration options for CNN layer destinations.

property enable#

Enable this destination. If False no events will be forwarded, if True all events will be forwarded to this destination.

Type:

bool

property feature_shift#

Shift feature IDs. The feature ID observed in the target layer will be the ID in this layer + feature_shift.

Type:

int

from_json(self: samna.speck3.configuration.CnnLayerDestination, arg0: str) None#
property layer#

Target layer ID. Allowed values [0, 4] and 6, where [0,4] is the CNN layers and layer 6 is the readout layer. If you want to send Spike events to the readout block from outside, you need to set the target layer of the Spike event to 5.

Type:

int

property pooling#

{1, 2, 4, 8}

Type:

int

Type:

Pooling will be applied to events before reaching the selected destination layer. Allowed values

to_json(self: samna.speck3.configuration.CnnLayerDestination) str#
class samna.speck3.configuration.CnnLayerDimensions#

Bases: pybind11_object

Describes the dimensions of a Cnn layer as the configurable parameters.

from_json(self: samna.speck3.configuration.CnnLayerDimensions, arg0: str) None#
get_biases_array_dimensions(self: samna.speck3.configuration.CnnLayerDimensions) List[int[1]]#

Function to get the dimension of the bias array.

Returns:

A list of the dimension in the format of [feature].

get_neuron_states_array_dimensions(self: samna.speck3.configuration.CnnLayerDimensions) List[int[3]]#

Function to get the dimension of the neuron states array.

Returns:

A list of the dimension in the format of [feature, x, y].

get_weights_array_dimensions(self: samna.speck3.configuration.CnnLayerDimensions) List[int[4]]#

Function to get the dimension of the weights array.

Returns:

A list of the dimension in the format of [feature, channel, x, y].

property input_shape#

Shape of features on the input of this layer.

Type:

Instance of IOShape

property kernel_size#

Kernel size for all features in this layer. All kernels are square. Allowable values [1, 16]

Type:

int

property output_shape#

Shape of features on the output of this layer.

Type:

Instance of IOShape

property padding#

Padding of all features in this layer. Allowable values [0, 7].

Type:

Instance of Vec2

property stride#

Stride for all features in this layer. Allowable values {1, 2, 4, 8}.

Type:

Instance of Vec2

to_json(self: samna.speck3.configuration.CnnLayerDimensions) str#
class samna.speck3.configuration.DvsFilterConfig#

Bases: pybind11_object

The DVS Filter Block is included in the DVS pre-processing layer of Speck 3 in order to filter events depending on neighboring pixel activity. In general, an event at position (x,y) is forwarded by the filter when at least one pixel in the vicinity of (x,y) has spiked in a defined time window before the (x,y) event.

property enable#

Enable the filter. A slow clk must be provided to SLOW_CLK pin.

Type:

bool

property filter_size#

Filter window size in the X/Y dimension.

Type:

Instance of Vec2

from_json(self: samna.speck3.configuration.DvsFilterConfig, arg0: str) None#
property hot_pixel_filter_enable#

Enable hot pixel filtering, default is enabled. The enable has to be set True first.

Type:

bool

property internal_slow_clk#

Forward internally generated slow clock to DVS filter to replace the need of external slow clk. The enable must be set to True first.

Type:

bool

property lpf_enable#

In this mode, the filter works as a low-pass filter. This mode can be used to filter out 50/60 Hz light flickering noise produced by some lights such as fluorescent or LED lights that output a square wave with the frequency of the mains power supply.

property sram_power_down#

Filter SRAM Power Down (low leakage mode) enable bit. When set, the corresponding SRAM is disabled but kept in retention mode (low power consumption). Can be used to disable the filter SRAM when the filter is not used.

property threshold#

Defines the threshold of the filter. This value is used to compare the current counter value with the value of the pixels neighboring the current spiking pixel. If any of the neighboring pixels has a value difference withing the delta value, the filter emits the current spike. Otherwise, the current spike is blocked.

Type:

int

to_json(self: samna.speck3.configuration.DvsFilterConfig) str#
class samna.speck3.configuration.DvsLayerConfig#

Bases: pybind11_object

Configuration options for event pre-process layer. The event pre-processing layer receives as input the events coming from the internal DVS, or from an external source through the Input Serial Interface

property cut#

Select the cut range, the roi cut happens concurrently, the range needs to be defined from the sensors (original) origin).

Actually it cuts an area using the given size based on (0, 0), then adjust this area according to origin.

Type:

Instance of Vec2

property destinations#

Destinations

Type:

list of 2 DvsLayerDestination

property dvs_balancer_en#

Spike input rate balancer enable bit. When enabled, any spike received by the layer while the layer input pipeline is busy is discarded.

As soon as the layer input is able to accept another input spike, the coming spike is forwarded.

property dvs_decimator_en#

Spike output decimator enable bit. When enabled, only a fraction of the spikes generated in the layer is forwarded to the layer output.

The fraction of forwarded spikes can be configured via the register bits DDINT.

property dvs_decimator_interval#

Configures the fraction of forwarded spikes at the output of the layer when the DDEN bit is enabled.

from_json(self: samna.speck3.configuration.DvsLayerConfig, arg0: str) None#
property merge#

Whether merge the two polarity from dvs (On/Off).

If True, Merge all events marking them with Polarity = ‘1’. If False, Pass all events and maintain the polarity information.

Type:

bool

property mirror#

Enable mirroring (1) or not (0) of the X or Y dimension. mirroring is reversing image on X or Y dimension.

Type:

object(x bool, y bool)

property mirror_diagonal#

Enables mirroring of the input events along the diagonal. when set to ‘1’, it swaps X with Y.

Type:

bool

property monitor_enable#

Enables the DVS Pre-Processing Spike Monitor Bus. When enabled, output messages of the dvs pre-processing block are forwarded on the monitor bus to the output serial interface data1 input.

This is typically openned when you want speck2b to output dvs events.

Type:

bool

property off_channel#

Whether pass events with OFF polarity, only make sense when merge equal to True.

If True, pass events with OFF polarity. If False, block events with OFF polarity

Type:

bool

property on_channel#

Whether pass events with ON polarity, only make sense when merge equal to True.

If True, pass events with ON polarity. If False, block events with ON polarity

Type:

bool

property origin#

Select the origin offset the roi cut happens concurrently, the offset needs to be defined from the sensors (original) origin).

Actually this origin will redefined the area after cut.

Type:

Instance of Vec2

property pass_sensor_events#

Pass/Drop Internal DVS Events. If disabled, the internal sensor events are dropped, i.e., not forwarded to the DVS pre-processing block.

This is typically used when sensor data is provided by an external source (Ext DVS Mode).

Type:

bool

property pooling#

Pooling is restricting dvs events in an area, available values are {1, 2, 4}, you can set pooling value on X/Y dimension seperately.

For example, if you set config.dvs_layer.pooling.x = 2 and config.dvs_layer.pooling.y = 2, you will see a 1/4 area on top left of visualizer which show pixels and other areas will be blank

Type:

Instance of Vec2

property raw_monitor_enable#

Enables the DVS Monitor Bus. When enabled, input messages to the dvs pre-processing block are forwarded on the monitor bus to the output serial interface data1 input.

These messages are the raw messages coming from the internal DVS or an external sensor (Ext DVS Mode) before pre-processing.

Type:

bool

to_json(self: samna.speck3.configuration.DvsLayerConfig) str#
class samna.speck3.configuration.DvsLayerDestination#

Bases: pybind11_object

Configuration options for dvs layer destination. It can have 2 destinations.

property enable#

if this destination is enabled.

Type:

bool

from_json(self: samna.speck3.configuration.DvsLayerDestination, arg0: str) None#
property layer#

destination layer that is going to receive output data.

Type:

int

to_json(self: samna.speck3.configuration.DvsLayerDestination) str#
class samna.speck3.configuration.IOShape#

Bases: pybind11_object

Describes the input or output shape of a CNN layer.

property feature_count#

Number of features in the input or output”

Type:

int

from_json(self: samna.speck3.configuration.IOShape, arg0: str) None#
property size#

Size of each feature.

Type:

Instance of Vec2

to_json(self: samna.speck3.configuration.IOShape) str#
class samna.speck3.configuration.ReadoutConfig#

Bases: pybind11_object

The main use of the post-processing block is to calculate the moving average over a time window for a maximum of 15 neurons, provide the maximum average of the 15 neurons and compare the value of the calculated moving averages against a specified threshold.

property enable#

enable the readout block, a slow clk (frequency depends on the algorithm model) must be provided to SLOW_CLK pin.

Type:

bool

from_json(self: samna.speck3.configuration.ReadoutConfig, arg0: str) None#
property internal_slow_clk#

forward internally generated slow clk to the readout block to replace the need of external slow clk. The enable must be set to True first.

Type:

bool

property low_pass_filter32_not16#

Selects readout moving average length (16 or 32 clock periods).

Value

Configuration

False

time window = 16* MOVING_AVERAGE_CLK period

True

time window = 32* MOVING_AVERAGE_CLK period

Type:

bool

property low_pass_filter_disable#

Disables readout low pass filtering.

Value

Configuration

False

time window = selected by low_pass_filter32_not16

True

time window = 1 MOVING_AVERAGE_CLK period

This overrides low_pass_filter32_not16 when set to True.

Type:

bool

property monitor_enable#

Allow monitoring of readout events, you will receive ReadoutValue from the model.

Please note that if you turn this on, you can’t get any events from CNN layers or the DVS sensor anymore.

Type:

bool

property output_mod_sel#

There are 4 different modes where the output data are multiplexed. In the following table the different data output modes are described:

output_mode_sel

data_out[20]

data_out[19:16]

data_out[15:0]

0b00

data valid

neuron index of max average

power down (clock gating)

0b01

data valid

neuron index of max average

threshold compare output

0b10

data valid

neuron index of max average

average output of the selected neuron

0b11

max spiking neuron above threshold

neuron index of max average

average output of max spiking neuron

If output_mode_sel equals to ‘0b00’ then the clk_gated signal and the data_out[15:0] are equal to 0.

If output_mode_sel equals to ‘0b01’ then the data_out[15:0] consists of the data of the threshold comparison, the index of the maximum moving average neuron and the data valid signal. The threshold comparison data is the 16 bit value of the comparison of each neurons’ moving average with the threshold.

If output_mode_sel equals to ‘0b10’ then the data_out[15:0] consists of the moving average of the selected neuron, the index of the maximum moving average neuron and the data valid signal. The data valid signal is asserted after all the computations have finished in order to ensure correct sampling of the data.

If output_mode_sel equals to ‘0b11’ then the data_out[15:0] consists of the maximum average of the 15 neurons, the index of the maximum moving average neuron and the comparison output between the maximum moving average and the threshold.

Type:

int

property output_neuron_num#

The internal signal output_mode_sel enable the selection of one of the 15 output neurons. The neuron selection is used when signals output_mode_sel == ‘0b10’.

Selected neuron number = average_sel.

Type:

int

property override_threshold_max#

Override Output Layer Threshold compare. Sends interrupt at each slow clock cycle.

Type:

bool

property readout_configuration_sel#

Addressing modes of the incoming spikes.

There are 4 different addressing modes that could be selected. The valid configurations are the following:

Value

Configuration

0b00

2x*2y*4f

0b10

4x*4y*1f

0b01

2x*4y*2f

0b11

1x*1y*16f

Where x, y and f represent, respectively, the X, Y and Feature dimensions of the events arriving at the Readout Layer.

Type:

int

property readout_pin_monitor_enable#

enable/disable the monitor of the readout pins. If enabled, the ReadoutPinValue will be outputted. Default is False.

Type:

bool

property threshold#

Readout neurons threshold value.

The moving average of the output neurons is compared to the threshold value to produce an output if the received number of spikes is greater than the threshold.

Type:

int

to_json(self: samna.speck3.configuration.ReadoutConfig) str#
class samna.speck3.configuration.SpeckConfiguration#

Bases: pybind11_object

Contains configuration options and network parameters for a Speck 3 device. Applied to a device via apply_configuration() on the device model.

The configuration is divided into settings for the 9 CNN layers, the DVS event pre-processing layer and the readout layer. The factory configuration and debug configuration sub structs are pre-populated with default values and are only used for debug scenarios.

property cnn_layers#

List of 5 CnnLayerConfig.

property debug_config#

Instace of DebugConfig

property dvs_filter#

Instance of DvsFilterConfig

property dvs_layer#

Instance of DvsLayerConfig

property factory_config#

Instance of FactoryConfig.

from_json(self: samna.speck3.configuration.SpeckConfiguration, arg0: str) None#
property readout#

Instance of ReadoutConfig.

to_json(self: samna.speck3.configuration.SpeckConfiguration) str#