Hi, I am trying to follow <this> tutorial for sett...
# klayout
a
Hi, I am trying to follow this tutorial for setting up klayout in Sky130 (klayout 0.29 on a Mac M1). The workarounds took care of a couple of issues but now I am stuck as the PCell generation is not working. Any idea of what is going on?
l
Hi! It seems to me the Python script is unable write to an output file 🤔️ Have you installed the tools natively or are you using a VM/docker? Currently the PCells are drawn using gdsfactory, then written as a gds file and then read again using KLayout. This is not optimal, but that's how it is done at the moment.
Copy code
# creating layout and cell in klayout 
c.write_gds(f"nfet_temp.gds")
layout.read(f"nfet_temp.gds")
Maybe the error happens when writing the temporary file? It should be created in the
layout/
folder of this tutorial.
a
natively. I gave 777 permissions to the layout directory but the errors persist. Apart from the error message in the snapshot above for the
nfet
and
pfet
, different messages show up for other components: • For
cap_vpp
npn_bjt
photodiode
pnp_bjt
rf_bjt
: “TypeError: No overload with matching arguments” • For
res_diff
res_metal
: “TypeError: Cell() argument 1 must be str, not None” • For
vias_gen
: macro crashes with Error message: “UnboundLocalError: cannot access local variable ‘level1’ where is not associated with a value
l
Just to be sure, do you have gdsfactory version 6.33.0 installed in your system-wide installation? I am currently using an older version of KLayout (0.28.15). I am going to update it to see if I get the same errors as you.
a
I am using the HW KLayout deliverable that comes with Python and Qt bundled. Within that deliverable I installed gdsfactory. I also installed gdsfactory system wide but KLayout only sees the bundled environment. I will try with the ST flavour and see if I that fixes the issue
l
Do you get a similar output in your terminal when KLayout is started?
Copy code
2024-04-29 11:36:39.258 | INFO     | gdsfactory.config:<module>:51 - Load '/home/leo/.local/lib/python3.11/site-packages/gdsfactory' 6.33.0
2024-04-29 11:36:39.314 | INFO     | gdsfactory.technology.layer_views:__init__:779 - Importing LayerViews from KLayout layer properties file: /home/leo/.local/lib/python3.11/site-packages/gdsfactory/generic_tech/klayout/tech/layers.lyp.
This means that gdsfactory has been imported successfully.
KLayout version 0.29.0 seems to work here:
By the way, I can reproduce the errors you are getting for the other PCells, so that is something that needs to be investigated. Still, nfet and pfet work here.
a
Sorry it took me a while to debug this. Indeed the issue was that the files were being written to an permission restricted directory. The solution for me was to edit the gdsfactory write_gds line to point to my temporal directory
/tmp
l
Thanks for the reply, that's good to know!