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:

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


The example creates a GDS layout with the following hierarchy:

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
28 March 2019

Parametric curve

In this example we show how to create parametric curves between two points.
Nazca LayoutNazca Foundry
16 November 2018

Add text to your layout

In this example we show how to add text to your layout.
Nazca LayoutNazca FoundryPhotonic BBs
19 January 2018

Create a building block using Polygons

In this example we show how to create a building block from Polygons.