Home Forums Nazca Warning: Duplicated cell name Reply To: Warning: Duplicated cell name

#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 # 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_$9d42

Ronald