Home Forums Nazca Warning: Duplicated cell name

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

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

    EricYang
    Participant

    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 4 months ago by  Ronald. Reason: reformatted code
    #5318

    Ronald
    Keymaster

    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 take 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 4 months ago by  Ronald.
    #5319

    EricYang
    Participant

    Hi Ronald,

    Nice suggestion, that’s exactly what we need.

     

    Thanks!

    Eric

    #5349

    Douglas
    Participant

    Ronald,

    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…

    Thanks,

    Douglas

    #5350

    Ronald
    Keymaster

    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
    
    @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(var1=20).put(0)
    func(var3=15, var4=1).put(0, 50)
    
    nd.export_gds()

    Resulting cellnames:
    cellname_10_15_$d269
    cellname_20_20_$9d42

    Ronald

    #5379

    Douglas
    Participant

    Thanks Ronald!

    It is working perfectly. Simple and efficient!

    Douglas

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

You must be logged in to reply to this topic.