Tagged: hashme, duplicate cellname warning
- This topic has 5 replies, 3 voices, and was last updated 5 years, 8 months ago by Douglas.
-
AuthorPosts
-
21 November 2018 at 04:51 #5316EricYangParticipant
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
21 November 2018 at 10:44 #5318RonaldKeymasterDear 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.
21 November 2018 at 10:58 #5319EricYangParticipantHi Ronald,
Nice suggestion, that’s exactly what we need.
Thanks!
Eric
11 December 2018 at 02:45 #5349DouglasParticipantRonald,
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
11 December 2018 at 11:49 #5350RonaldKeymasterDear 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(var1=20).put(0) func(var3=15, var4=1).put(0, 50) nd.export_gds()
Resulting cellnames:
cellname_10_15_$d269
cellname_20_20_$9d42Ronald
4 January 2019 at 23:13 #5379DouglasParticipantThanks Ronald!
It is working perfectly. Simple and efficient!
Douglas
-
AuthorPosts
- You must be logged in to reply to this topic.