Fundamentals of analog VLSI design
EE-424
Installing the ngspice simulator
Page content
We are progressively moving the simulations to the open source simulator called ngspice. You can down load ngspice from the official ngspice site. It is a good idea to also download the user manual from the same site.
Install the ngspice folder named Spice64 where you want. I created a NGSpice folder in the C:\Program Files\ folder and copied the Spice64 folder in it. So for my installation, the path to the ngspice binary is C:\Program Files\NGSpice\Spice64\bin\. Nos you can choose any other installation location.
Once you have installed (copied) ngspice, you need to copy the EKV2.6 osdi file that contains the EKV2.6 MOSFET model that is used for the simulation. Add it to the folder <your ngspice installation path>\Spice64\lib\ngspice\. There are already other default osdi for other models in the same directory.
You then need to modify the spinit file of ngspice that is in the follwoing folder <your ngspice installation path>\Spice64\share\ngspice\scripts\. You can replace it by the following spinit file. This file is run each time ngspice is started. It will load the ekv26.osdi file for running simulations with the EKV2.6 compact model. Note that the other osdi models have been disabled by adding the star at the beginning of the line. If you want to use of these models you just remove the start on the corresponding line.
Finally, we need to add a few variables to the Windows Environment variables. In order to do this in Windows 10 (probably similar in Windows 11), open Settings>Sytem>About. On the right panel click Advanced system settings.


In order to tell ngspice where to find the osdi model library, you then need to create a new System variable:
Variable name: NGSPICE_OSDI_DIR
Variable value:<Your ngspice installation path>\Spice64\lib\ngspice\
as shown below:

In order to tell ngspice where to find the spinit file, you need to create the following System variable:
Variable name: SPICE_SCRIPTS
Variable value: <Your ngspice installation path>\Spice64\share\ngspice\scripts\
as shown below:

You are now all set for running the ngspice simulations contained in the Jupyter Note books.