It contains all the documentation for Ngspice and GHDL related work.
Windows port (this branch): the simulator source tarball is rebased onto ngspice-45.2 (mixed Verilog co-simulation via
d_cosim/ivlngneeds ngspice ≥ 42) and the sources compile cleanly under MinGW/MSYS2. Seewindows/README.mdfor what changed, how the tarball is regenerated reproducibly, and how the eSim Windows installer ships the whole toolchain prebuilt.
Ngspice supports mixed-signal simulation. It can simulate both digital and analog components.
Ngspice has something called code-model which defines the behavior of your component and can be used in the netlist. For example you can create a full-adder's code-model in Ngspice and use it in any circuit netlist of Ngspice.
Now the question is if we already have digital model creation in Ngspice, then why this interfacing?
Well, in Ngspice, it is difficult to write your own digital code-models. Though, many people are familiar with GHDL and can easily write the VHDL code. So the idea of interfacing is just to write VHDL code for a model and use it as a dummy model in Ngspice. Thus, whenever Ngspice looks for that model, it will actually call GHDL to get the results. GHDL's foreign language interface is used for this inter-process communication.
-
Ubuntu 18.04 and 20.04 LTS versions.
-
Microsoft Windows 7, 8 and 10.
Note for other distributions: You can refer
installersbranch for documentation on packaging (for above mentioned distributions) to build installers for your operating system in a similar way. For providing your build, please check theContributionsection mentioned below.
- Support for nearly 500 VHDL digital models.
- Support for VHDL digital models upto 64 output ports/pins.
- Support for Verilog digital models.
- GHDL — llvm or gcc backend, never mcode:
nghdl links its VHDL socket server with
ghdl -e -Wl,..., which mcode rejects. Seeinstall-nghdl-scripts/GHDL-BACKEND-26.04.md. - Verilator v5+ (for Verilog models)
- Icarus Verilog built with
--enable-libvvp(only ford_cosim; apt's build ships no libvvp) - Ngspice — not needed separately: the
nghdl-simulatorbuild in this repo is ngspice 45.2 with the nghdl delta
install-nghdl.sh installs all of these.
This module is made available with eSim (Electronic Circuit Simulation). Refer https://esim.fossee.in/ for more information.
On Ubuntu (24.04 / 25.x / 26.04) it also installs on its own, without eSim:
bash install-nghdl.sh --install # nghdl-simulator + GHDL, Verilator, Icarus
bash install-nghdl.sh --uninstallOne script covers every supported release (it detects the version itself), and
it applies everything under patches/ngspice/ to
the simulator source before building — currently the d_cosim operating-point
fix, without which a co-simulated block reads all-zero at t=0.
- Launch eSim --> Click on "NGHDL" icon from the left toolbar --> Click on "Browse" button --> Go to
nghdl/Example/ - Locate the example you wish to simulate, find the VHDL file within that example and click on "Open" button at the bottom of "Open File" window.
- Click on "Upload" button in the NGHDL window. File will be processed in the backend for few seconds. Now exit the NGHDL window.
- Open the desired example under
eSim/Examples/Mixed_Signal/using the "Open Project" button, double click on the project when the project is loaded in the "Projects" window. - Click on the "Simulation" button on eSim Main window.
A Microwatt OpenPOWER NGHDL co-simulation example is available under:
nghdl/Example/Microwatt
This example demonstrates the integration of the OpenPOWER Microwatt core with the NGHDL/XSPICE co-simulation flow in eSim. The example includes:
microwatt_cosim.vhdl- NGHDL-compatible Microwatt wrappercompile_for_nghdl.sh- GHDL compilation script for NGHDLREADME.md- Usage and integration instructions
Please refer here for further details.