laylight tour
0/25
3/3

Libraries and projects · 3 of 3

Project: splitter tree

The last project uses nearly everything in the tour: a splitter tree that divides one input into 2level outputs, built from 1×2 MMI splitters joined by S-bends.

MMI1x2 is given; its two outputs sit out_offset above and below its axis. The tree grows one level at a time. At each level it places a splitter on every port that still needs feeding and fans the two outputs of that splitter apart with S-bends:

  • the first level has one splitter, at the input, and spreads its outputs to spread / 2 above and below its axis;
  • each following level has twice as many splitters and half the spread;
  • after level levels, neighbouring outputs are pitch apart, so the first spread is pitch × 2^(level − 1).

The key is a list of ports. It starts as [self.origin]; at every level, a loop over it places the splitters and collects the outputs of their S-bends in a new list, which replaces the old one for the next level.

The S-bend that goes up shifts by spread / 2 − mmi.out_offset, since the output it starts from is already out_offset above the axis; the one that goes down shifts by the negative of that.

Exercise

Write the body of MMITree so that it builds the tree for any level and pitch, starting with a splitter at the origin.

That is the end of the tour. The language reference and the playground are good places to go on from here.

loading compiler…

Edit the code, watch the layout, then press Submit to check your solution against the exercise.

Compiling…