UP

# TUTORIAL: Manage XSCHEM design / symbol libraries

There are 2 ways to describe symbols in xschem,

- first approach: define a `XSCHEM_LIBRARY_PATH` that is a list of paths to last level directories containing .sym /.sch files
- second approach: define a `XSCHEM_LIBRARY_PATH` that is a list of paths one or more levels above the directories containing .sym/.sch files

In the first approach a '`npn.sym`' symbol placed in a schematic will be saved as '`npn.sym`' in the .sch file, when loading back the parent schematic xschem will go through the elements of `XSCHEM_LIBRARY_PATH` and look for a directory containing `npn.sym`.

In the second approach the '`npn.sym`' will be saved as '`devices/npn.sym`' (assuming `devices/` is the directory containing this symbol) . This is because the `XSCHEM_LIBRARY_PATH` is pointing to something like `/some/path/xschem_library/` and `xschem_library/` contains `devices/` (names are just given as examples, any dir name is allowed for `xschem_library/` and `devices/`)

The first approach is preferred by pcb hobbysts, people working on small designs. the second approach is preferred for big designs where a one or more directory level indirection is desired for symbols, so any symbol in xschem is given as '`libname/symname.sym`' (one level directory specification in symbol references) or '`libgroup/libname/symname.sym`' (2 level directory specification in symbol references) instead of just '`symname.sym`'

In any case the real path of the symbol reference is obtained by prepending the XSCHEM_LIBRARY_PATH paths to the symbol reference until the resulting file is found in the machine filesystem.

For VLSI / big designs I strongly suggest using the second approach, just as an example i have the following dirs:

      ~/share/xschem/xschem_library/
        containing:
        devices/
        TECHLIB/

      ~/xschem_library/
        containing:
        stdcell_stef/

      ~/share/doc/xschem/
        containing:
        library_t9/
        dram/

then in my xschemrc i have the following:

`set XSCHEM_LIBRARY_PATH \
$env(HOME)/share/xschem/xschem_library:$env(HOME)/share/doc/xschem/:$env(HOME)/xschem_library`

### You may choose either method, but please be consistent throughout your design.