Closed josepfargas closed 2 months ago
You need to use the factories for this. Tje cells
are registered to the default KCLayout
, i.e. kf.kcl
. The factories allow you to register default functions to arbitrary KCLayouts/PDK. Also important, you need to make sure you only register it once, if you do it twice, you will have a cache miss and it will create a duplicate cell.
So, do:
The problem in your case is that you pass the pdk where kfactory expects the first argument of the cell function. But it gets shadowed because KCLayout is not hashable. I think I can kind of fix that by makung it hashable through the name. But I need to think first whether that is a good idea or not.
Sorry, just got to this, It seems that creating the factory first
bend_euler_virtual = kf.factories.virtual.bend_euler_factory(MYPDK)
creates the same error as before
TypeError: unhashable type: 'MY_PDK'
s_bend = c.create_vinst(kf.cells.euler.bend_euler_factory(MYPDK)(width=1, radius=10, angle=15, layer=pdk.infos.MYLAYER,))
This worked tho.
When trying to import an euler bend in a PDK repo, if I use the virtual version I get an error
This is fine bend = kf.cells.euler.bend_euler_factory(pdk)(width=1, radius=10, angle=15, layer=pdk.infos.MYLAYER)
This gives an error: e_bend = kf.cells.virtual.euler.virtual_bend_euler(pdk)(width=1, radius=10, angle=15, layer=pdk.infos.MYLAYER)
TypeError: unhashable type: 'MY_PDK'
Is this a bug, or am I doing something wrong?
Thanks