laylight tour
0/25
3/4

Cells and instances · 3 of 4

Attributes

Attributes are values that a cell computes from its parameters and makes available to others:

cell Mmi {
    param {
        wg_len  size = 10um
        mmi_len size = 30um
    }
    attribute {
        total_length wg_len * 2 + mmi_len
        description  "a simplified MMI"
    }
    ...
}

An attribute is read-only. Inside the cell it is used by its name, like a parameter. From outside it is read through a named instance, after a dot — and so are the instance's parameters:

place Mmi at (0, 0) as a
place Mmi at (a.total_length, 0) as b    # b starts where a ends

Attributes can use parameters, global constants and other attributes. They are also written to the GDSII output, together with the parameter values, so that tools can read them back.

Exercise

Give Mmi an attribute total_length, the length of both waveguides and the body together. Then use it in Chain to put the three splitters end to end, the first one at the origin.

loading compiler…

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

Compiling…