Home Forums Nazca Warning: Duplicated cell name

This topic contains 5 replies, has 3 voices, and was last updated by  Douglas 5 months, 3 weeks ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #5316


    Hi Nazca team,

    We are trying to settle down several layout splits with sweep parameters. (ex: width, length, etc…)

    I built a Pcell by def function to do this as following, but it’s will have a warning of duplicate cell name always.

    Could I have your suggestion to avoid the warning ?


    def DC(w=0.5, g=0.1):
        with nd.Cell(name='DC') as bentDC:
        demo.shallow.width = w
        A0 = demo.shallow.strt(length=dL).put(0, 0)
    return bentDC


    Thanks, Eric

    • This topic was modified 7 months ago by  Ronald. Reason: reformatted code


    Dear Eric,

    Cell names in GDS are their ID and they have to be unique. If you have multiple cells with the same name (it is technically possible) different GDS tools will treat them differently. Nazca will detect if you reuse a cell name, and changes the name into a unique name by adding a number to it. Your GDS design is then correct and Nazca issues the duplicate cellname warning to notify you each time this occurs.

    It is very good practice to always solve these warnings. This is very simple to do: Make the cell name in a function dependent on the function parameters, e.g. in your case

    def DC(w=0.5, g=0.1):
    name = "DC_{}_{}".format(w, g)
    with nd.Cell(name=name) as bentDC:

    Alternatively, there is a more advanced @hashme decorator to take care of unique cell naming. It takes the manual work out of the name creation. It also takes care of cases when calling the function more than once using the same parameters. In such cases it doesn’t recreate the cell, but returns the existing one.

    • This reply was modified 7 months ago by  Ronald.


    Hi Ronald,

    Nice suggestion, that’s exactly what we need.







    could you provide an example of the use of the @hashme decorator ?

    I am having this exact problem since I am using parameterized building blocks inside other parameterized building blocks…





    Dear Douglas,

    Below an example of @hashme. Its first parameter is the cell’s basename. The optional parameters following the basename are variable names whose value you like to have included in the cell name as a “visual aid”. To ensure a unique cellname in all cases, a hash based on all parameters of the decorated function (var1, var2, var3, var4 in the example) is generated and added as a suffix to the cellname.

    import nazca as nd
    #from nazca.pdk_template_core import hashme # before nazca-0.5
    from nazca.bb_util import hashme # from nazca-0.5
    @hashme('cellname', 'var1', 'var3')
    def func(var1=10, var2=3, var3=20, var4=5):
    with nd.Cell(hashme=True) as C:
    nd.strt(length=var1, width=var2).put(0)
    nd.strt(length=var3, width=var4).put(0, 20)
    return C
    func(var3=15, var4=1).put(0, 50)

    Resulting cellnames:


    • This reply was modified 2 months, 3 weeks ago by  Ronald. Reason: name change of module


    Thanks Ronald!

    It is working perfectly. Simple and efficient!


Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.