ctn-waterloo/nengo_spinnaker — pull request #15 by mundya (2014-03-10 16:05:15+00:00)
Title: Ensemble with multiple input filters

Not ready to merge yet.

Input to an Ensemble is encapsulated within an ```ensemble_input_t``` which exposes the post-filtering input vector as an array.

On receipt of a multicast packet its key is used to determine which filter is appropriate and, as in the current code, the payload of the packet is added to the accumulator for the filter. When ```input_filter_step``` is called by ```ensemble_update``` (on the timer tick) it performs filtering on each of the input filters, and accumulates the outputs of each of these filters in the ```input``` array of the global ```ensemble_input_t```. ```ensemble_update``` then continues as usual to encode the value of ```input``` for each neuron.

The extra parameters and data required for this are:
* The number of input filters (```region_system_t::n_filters```)
* The number of routing entries required for the Ensemble (```region_system_t::n_filter_keys```)

Extra regions are:
* (6) Pairs of the filter decays (```exp( -dt/filter )```) and filter "complements" (```1 - exp(...)```) -- these are interpreted as ```value_t``` types in the C (S1615) and given 1 word each.
* (7) Triples of routing keys, routing masks and filters.

Of specific note the filter for a given packet is determined by:
```c
static inline filtered_input_buffer_t* input_filter( uint key ) {
// Compare against each key, value pair held in the input
for( uint i = 0; i < g_input.n_routes; i++ ) {
if( ( key & g_input.routes[i].mask ) == g_input.routes[i].key ) {
// Match the given key and mask
return g_input.filters[ g_input.routes[i].filter ];
}
}
// No match
return NULL;
};
```
There is no reason that every key, mask, filter triple should be provided to the ensemble code. If it is possible to alias multiple entries together then this should be done.

- [ ] Finalise code for extracting key, mask and filter entries from the Nengo/PACMAN model
- [ ] Test