ctn-waterloo/nengo_spinnaker — pull request #94 by mundya (2014-07-03 16:49:40+00:00)
Title: Refactor builder and vertices

I'm not completely done with this but would really appreciate some extra pairs of eyes.

Known issues:
- Any form of custom connection from pass nodes (including probing them) breaks because non-Nengo objects can't be the used with Nengo connections. I think the solution is to replace `replace_pass_through_nodes` with some equivalent functionality.
- UART doesn't work because some routing entries don't make it on to the chip, currently trying to track this down.
- Unit tests are out of date :unamused:

Things to neaten:
- The intermediate representations and vertices need moving to some better locations to keep the builder and assembler neater.

----

When a Simulator is presented with a model it first builds it.
Building entails:
0. Flattening the network.
1. Applying a series of transforms which modify the connectivity of the network.
2. Removing pass nodes.
3. Replacing all Nengo `Connections` with equivalents that have the full transform and a keyspace attribute.
4. Applying a second set of transforms which replace objects like Ensembles, and build their decoders.
4. Assigning an ID to all objects
5. Building the keyspace (determining the number of bits required to represent whether the packet is routed to UART (`x`, 1 bit), the object ID (`o`), the connection ID (`i`) and the dimension (`d`))
6. Applying that keyspace to all Connections

The builder returns a list of objects, a list of connections and the final keyspace.

When `run` is called some final assembly takes place:
0. Function of time Nodes are checked to see whether there's sufficient memory for them, if there is then they are converted into PACMAN vertices, otherwise they're left to be picked up by the IO building.
1. The IO building is used to construct IO, the `prepare_network` function performs this task.
2. The assembler is used to convert any remaining non-PACMAN objects into Vertices.
3. Everything runs as before...