Markers and ports · 3 of 4
Several locations
A marker can hold several locations. List them in a block after at; they are numbered from 0 in the order written:
marker {
output {
at {
out1.right_center
out2.right_center
}
with {
type = "waveguide"
direction = "output"
}
}
}with has a block form too, one attribute per line; its attributes apply to all the locations. From outside, the two locations above are s.marker.output[0] and s.marker.output[1].
A cell built from instances usually exports some of their ports as its own: its markers sit on ports of its instances. at accepts any point, including a port of an instance:
marker {
input { at s.marker.input[0] with type = "waveguide", direction = "input" }
}at also takes a list of points, which makes the number of locations depend on the parameters. Markers see the variables defined directly in the cell, with the value they have once the body has run, so a loop can collect ports in a list for a marker to export:
marker { output { at ends } }
define ends: [point] = []
for i in 0..n {
place Waveguide at (0, i * pitch) as w
ends.append(w.marker.output[0])
}Exercise
In Fanout, attach a Waveguide to each output of the splitter s. Then export the ports: input at the input of the splitter, and one marker output with two locations, the far ends of the upper and the lower waveguide (in that order). Give them the attributes of the splitter's ports.