In our workflow, we have supplementary files that are stored alongside but not within the OA library database, belonging to cells of a library. An example of such a file would be an electromagnetic simulation or a resulting s-parameter file of a layout view of a cell. We are storing this data in a separate directory directly below the library path. However, when we are running ADE/spectre, we would like to add this supplementary directory to the include paths automatically so that for example, the nport component can load the s-parameter file using a relative path.
It would be possible to enter the full absolute path under ADE L -> Setup -> Simulation Files, however when switching systems, the absolute path breaks and needs to be adjusted by hand in every testbench. Currently, as a workaround we define an environment variable before running virtuoso, however this seems clumsy and error prone.
I wonder if there is a better way to achieve this, so that I can, for example, add the following path as an include path in ADE
where $CURRENT_LIBRARY_DIR is automatically populated with the library of the opened cell view.
I'm not sure how robust this would be, but you could use:
procedure(CCFinitLibDir(sess) let((libName libPath) libName=asiGetDesignLibName(sess) when(libName libPath=ddGetObjReadPath(ddGetObj(libName)) ) when(libPath setShellEnvVar("CURRENT_LIBRARY_DIR" libPath) ) ))
envSetVal("asimenv.startup" "sessInitTrigFunc" 'string "CCFinitLibDir")
This automatically sets the $CURRENT_LIBRARY_DIR env var to the path to the library containing the design whenever ADE is opened.
Thanks for your reply. I will try this on next occasion.
I am certainly no expert with the scripting functionality in virtuoso, but isn't it possible to add some kind of script to the Library itself, that gets executed once the Library gets "opened" or loaded into memory? Then the Library registers it's path in an environment variable such as LIB_<LIBNAME>_DIR.
Best Regards and much appreciated
You could put this in your .cdsinit - that would have this effect:
setShellEnvVar(strcat("LIB_" libId~>name "_DIR") libPath)
ddRegTrigger("FirstAccessLib" 'CCFsetLibDirVar 1)