Hello, I need bit of help with the test_glayout co...
# ieee-sscs-dc-24
s
Hello, I need bit of help with the test_glayout code . I have decoded the dependecies.sh and installed everything as per the instructions. However, on running the python test code, I get the following error on the LVS checking
Copy code
...Creating nmos component...
2024-06-11 13:35:27.864 | INFO     | gdsfactory.pdk:activate:337 - 'sky130' PDK is now active

...Showing nmos component...
------miniforge3/envs/fasoc/lib/python3.10/site-packages/gdsfactory/show.py:40: UserWarning: Unnamed cells, 1 in 'Unnamed_03b80ae3'
  gdspath = component.write_gds(
2024-06-11 13:35:30.677 | WARNING  | gdsfactory.klive:show:48 - Could not connect to klive server. Is klayout open and klive plugin installed?
Created nmos component!

...Running LVS...
using user specified pdk_root, will search for required files in the specified directory
2024-06-11 13:35:30.679 | INFO     | gdsfactory.component:_write_library:1851 - Wrote to '/tmp/tmpl2r2gt9g/nmos_test.gds'

Magic 8.3 revision 464 - Compiled on Sat Mar  9 23:18:29 UTC 2024.
Starting magic under Tcl interpreter
Using the terminal as the console.
Using NULL graphics device.
Processing system .magicrc file
Using technology "minimum", version 0.0
Creating new cell

Netgen 1.5.272 compiled on Tue Mar  5 23:16:53 UTC 2024
Warning: netgen command 'format' use fully-qualified name '::netgen::format'
Warning: netgen command 'global' use fully-qualified name '::netgen::global'
Reading netlist file /tmp/tmpl2r2gt9g/nmos_test_lvsmag.spice
-1
    while executing
"netgen::readnet $file1"
    (procedure "lvs" line 58)
    invoked from within
"lvs {/tmp/tmpl2r2gt9g/nmos_test_lvsmag.spice nmos_test} {/tmp/tmpl2r2gt9g/nmos_test.spice nmos_test} /usr/bin/miniconda3/share/pdk/sky130A/libs.tech/n..."
    ("eval" body line 1)
    invoked from within
"eval $argv"

Traceback (most recent call last):
  File "-----/OpenFASOC/openfasoc/generators/glayout/test_glayout.py", line 176, in <module>
    place_nfet_run_lvs()
  File "---/OpenFASOC/openfasoc/generators/glayout/test_glayout.py", line 160, in place_nfet_run_lvs
    sky130.lvs_netgen(nmos_component, 'nmos_test')
  File "--/miniforge3/envs/fasoc/lib/python3.10/site-packages/pydantic/deprecated/decorator.py", line 55, in wrapper_function
    return vd.call(*args, **kwargs)
  File "--/miniforge3/envs/fasoc/lib/python3.10/site-packages/pydantic/deprecated/decorator.py", line 150, in call
    return self.execute(m)
  File "--/miniforge3/envs/fasoc/lib/python3.10/site-packages/pydantic/deprecated/decorator.py", line 222, in execute
    return self.raw_function(**d, **var_kwargs)
  File "--/OpenFASOC/openfasoc/generators/glayout/glayout/flow/pdk/mappedpdk.py", line 753, in lvs_netgen
    raise ValueError("LVS report not found!")
ValueError: LVS report not found!
Now it says
using user specified pdk_root, will search for required files in the specified directory
and I have defined PDK_ROOT in my bashrc, accordingly but not sure why its checking in this path
"lvs {/tmp/tmpl2r2gt9g/nmos_test_lvsmag.spice nmos_test} {/tmp/tmpl2r2gt9g/nmos_test.spice nmos_test} /usr/bin/miniconda3/share/pdk/sky130A/libs.tech/n..."
c
did you modify the
test_glayout.py
script?
also your conda installation is in /usr/bin/ yes?
s
1. Yes! I have added my PDK_root as the code had hard codded paths,
Copy code
paths_to_check = [
        Path("/usr/bin/miniconda3/share/pdk/"), 
        Path(f"/home/{os.getenv('LOGNAME')}/miniconda3/share/pdk/"),
        Path(os.getenv('PDK_ROOT'))
    ]
the third line is added. 2. no! My conda (or mamba rather) is installed locally.
pdk_root.resolve().parents[1]
shows
PosixPath('/home/sapta/miniforge3/envs/fasoc')
with sapta being my username I got the problem. Didn't found the solution yet. The problem is with the
place_nfet_run_lvs()
function which calls
sky130.lvs_netgen(nmos_component, 'nmos_test')
now upon checking the
lvs_netgen
it defaults to
None
which in turn triggers
Copy code
if pdk_root is None:
                print("using default pdk_root: /usr/bin/miniconda3/share/pdk/")
            else: 
                print('using provided pdk_root')
                self.pdk_files['pdk_root'] = pdk_root
Which is creating the problem. Strangely modifying the command to following doesn't solve the problem
sky130.lvs_netgen(nmos_component, 'nmos_test',pdk_root=os.getenv('PDK_ROOT'))
[update] Klive 0.3.2 needs Klayout 0.28.17 or newer. Dependencies.sh install Klayout 0.28.12. I manually installed the Klayout 0.28.17 as well as the Klive plug-in and started the klayout before executing the code. Now the Klayout is running fine!
I solved it. The issue was with
--/openfasoc/generators/glayout/glayout/flow/pdk/sky130_mapped/sky130_mapped.py
which had hard coded pdk_root path
pdk_root = Path('/usr/bin/miniconda3/share/pdk/')
replacing that with
import os; pdk_root=Path(f"{os.getenv('PDK_ROOT')}/")
solved the problem. Is it possible to open an issue in the github repo and submit the solution? I have never done the same. Basically in all libraries, the PDK_ROOT environment should give the path
c
This is intended behaviour, the code accepts a string or pathlib path which it then exports as an environment variable called
PDK_ROOT
please do not change internal functions, we won't be able to push your code to the repo