I appreciate QSpice’s addition of the .libpath directive.
Without the .libpath directive, QSpice assumes that all needed simulation information (I call components) such as C-Blocks, Verilog-Blocks, symbols, subcircuits and models are in the same directory as the schematic.
.libpath defines a the C compiler equivalent to adding a “include” directory path. This allows you to place pieces of the simulation design in a logical folder format. This allows common components used across multiple simulation designs to not need copying into each simulation design folder.
There are two ways to use this directive.
The Direct Method
To use this command directly in the schematic just add the text “.libpath =folderpath=” to the schematic.
=folderpath= can be a relative path or an absolute path.
QSpice will first look in the folder where the simulation design schematic exists. If the components added to the schematic is not found in this directory, it will use the .libpath to find it.
The Indirect Method (“Symbols & IP Browser”)
QSpice added the .libpath directive into the NetList based on the added “symbol directories” to the “Symbols & IP Browser”.
Here is a snapshot of this browser with the default symbol directories.
These directories are the “default” included libpath directories.
If you place your project sharable components in separate directories you can add the directories to the “Symbols & IP Browser”. Just Right-click on “Symbols & IP” and select “Add a symbol directory”
Find the desired directory in the File Explorer and Select Folder".
You can see in my snapshot I added 4 Symbol and IP directories.
If you open the NetList you will find the added directories as .libpath absolute paths in the other you added them to the “Symbols & IP Browser”.
Executing the simulation will add those libpaths.
I’d like to point out 3 things about using this indirect method.
-
When you add directories to the “Symbol & IP Browser” these adds persist across multiple QSpice instances. This can be convenient when creating different simulations that use common components.
-
Adding directories “Symbol & IP Browser” will display symbols in the treeview structure. If your added directory has no symbols, the treeveiw under that directory may look empty. However, the special component files will still be referenced using the .libpath directive. So don’t panic.
-
The libpaths in the NetList will be executed in the order that it shows up in “Symbol & IP Browser”, This means if you have a component with the same name across different directories in the Browser, the first component found will be included. If you need to change the Netlist order, delete the directory with the old version of the component. If the directory is still needed, add it to the end of the “Symbol & IP Browser” treeview list.
Len