laylight tour
0/25
2/6

Shapes and placement · 2 of 6

Placing shapes on shapes

The target of a placement does not have to be a fixed point. It can be an anchor of another shape:

place wg.left_center   at self.origin
place body.left_center at wg.right_center

self.origin is the origin of the cell being defined. The second line attaches body to the right end of wg, wherever wg ends up. offset shifts a placement by a vector:

place out.left_center at body.right_center offset (0, 1um)

Placement is declarative. The order of the statements does not matter — a placement may refer to a shape defined or placed further down — and laylight works out the positions when they are needed. Two rules keep this well defined:

  • every shape is placed exactly once, and a shape that is never placed is an error;
  • placements cannot go round in a circle, like a placed on b placed on a.

Because a shape is placed only once, drawing the same shape twice takes a copy. clone wg as wg2 creates a new shape with the same geometry, on the same layer, waiting to be placed.

Exercise

Complete the splitter. Attach body to the right end of input; then make two outputs by cloning input and attach them to the right side of body, shifted 1 µm up and 1 µm down.

loading compiler…

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

Compiling…