<@U01819B63HP> I am still not sure if I completely...
# xschem
h
@Stefan Schippers I am still not sure if I completely understand how the path to instantiated cells (the symbols) is formed in
xschem
. I know about the working of
XSCHEM_LIBRARY_PATH
, but: if I instantiate a cell from a subdirectory where the current cell (where I instantiate into) is located, is then always a relative path to the symbol formed? Or only, when the current cell’s location is contained in
XSCHEM_LIBRARY_PATH
?
s
@Harald Pretl A relative path is formed for the symbol reference if one of the
XSCHEM_LIBRARY_PATH
paths (starting from the first one) contains the first part of the symbol absolute location. In this case the relative path is obtained by stripping off the leading matching part. As a consequence it is advisable to put deeper directories first in XSCHEM_LIBRARY_PATH, like /`a/b/c/a/b/a` instead of
/a:/a/b:/a/b/c
, so you will have the shortest relative paths. Important note: if
XSCHEM_LIBRARY_PATH
contains
.
as one of the paths this is interpreted as the path of the parent schematic (the one instantiating the symbol). This is different than the usual meaning of
.
which is the current working directory (the dir where you started xschem). I strongly recommend to avoid using '`.`' in
XSCHEM_LIBRARY_PATH
definitions in
xschemrc
files, if you need to add the current directory use
[pwd]
.
h
OK, this means if I want a relative path for hierarchies, I put the [PWD] first into XSCHEM_LIBRARY_PATH?
s
You can set only the top level directory, (if it is the current working directory you can use
[pwd]
instead of writing the actual path):
set XSCHEM_LIBRARY_PATH $XSCHEM_SHAREDIR/xschem_library:[pwd]
so an inverter
inv.sym
in
[pwd]
will have relative path
inv.sym
, an opamp that is located in
[pwd]/analoglib/opamp.sym
will have relative path
analoglib/opamp.sym
. However if you set this in `XSCHEM_LIBRARY_PATH`:
set XSCHEM_LIBRARY_PATH $XSCHEM_SHAREDIR/xschem_library:[pwd]/analoglib:[pwd]
then both the
inv.sym
and the
opamp.sym
will have relative paths of
inv.sym
and
opamp.sym
respectively.
h
I am thinking of doing this by default in our container (as most people are not aware of
XSCHEM_LIBRARY_PATH
and its implications; they just get frustrated when they move blocks around that the symbols are not found):
set XSCHEM_LIBRARY_PATH $XSCHEM_SHAREDIR/xschem_library:[pwd]
You think setting this by default is a good idea? Or any undesirable side effects?
s
@Harald Pretl I often use this setup. If I need to create a design with more than one schematic (some hierarchy) I create a directory, place a xschemrc file in it and add this:
set XSCHEM_LIBRARY_PATH $XSCHEM_SHAREDIR/xschem_library:[pwd]
If every used schematic is located under [pwd] you will not have any absolute path (only subdirectories of [pwd]) and design is portable. One exception is adding a directory for the pdk, like:
set XSCHEM_LIBRARY_PATH $XSCHEM_SHAREDIR/xschem_library:${PDK_ROOT}/${PDK}/libs.tech/xschem:[pwd]
In this case used components in the design should either be xschem primitives (pins, vsources, labels and so on) or pdk elements (nfet_01v8.sym and so on) or stuff located hierarchically under [pwd].