How to create a hierarchical design

By 12 November 2017Nazca Layout

Creating a hierarchical design

How to create a hierarchical design using cells

Nazca uses the Python with statement to help define a Nazca Cell, which becomes a gds cell upon gds export. The name keyword of Cell becomes the gds cell name. The indentation under with determines which lines belong to the Cell context.

import nazca as nd

with nd.Cell(name='Cell_A') as cella:
    nd.taper(length=10, width1=1, width2=5).put(0)

with nd.Cell(name='Cell_B') as cellb:
    nd.bend(angle=90).put(0)
    cella.put()

with nd.Cell(name='Cell_C') as cellc:
    nd.strt(10).put(0)
    cellb.put()
    cella.put(0, 10)

nd.export_gds(cellc)

The example creates a GDS layout with the following hierarchy:
Cell_C
–Cell_A
–Cell_B
—-Cell_A

Each Cell is assigned to a reference variable. In the first Cell declaration we effectively have cella = nd.Cell(name=’Cell_A’), where reference cella is a Cell object. cella remains available after its definition.

Note 1: creating a cell and putting a cell in the layout are two different things by design. Just remember the Nazca mantra:

Make a cell, put a cell

Note 2: the functions nd.taper, nd.bend, and nd.strt in the above example are parametrized cells, i.e. they each are a function returning a Cell object which is subsequently put in the layout, just like cella, cellb, and cellc are put in the layout.

Note 3: cella is ‘put’ twice, therefore, in the gds the cell with name ‘Cell_A’ is ‘instantiated’ twice.

Related Tutorials

Nazca LayoutNazca Foundry
11 November 2019

Log your layout

In this example we show how to log your layout.
Nazca LayoutNazca Foundry
3 November 2019

Make and put a Cell

In this example we show how to create xsections and layers
Nazca LayoutNazca Foundry
2 November 2019

xsections and layers

In this example we show how to create xsections and layers
Nazca LayoutNazca FoundryPhotonic BBs
28 October 2019

Reuse parametric building blocks

Avoid "duplicate cellname" warnings using introspection via the @hasme decorator.