A gRPC service for executing SPICE circuit simulations via various simulators as subprocesses.
SpiceServer accepts gRPC requests containing SPICE netlists and executes them using the specified simulator (e.g., ngspice, Xyce, LTspice). Results are streamed back to the client in real-time.
Xyce
- CMake 3.15 or higher
- C++17 compatible compiler
- gRPC and Protocol Buffers
- A SPICE simulator (ngspice, Xyce, etc.)
On Ubuntu/Debian:
sudo apt-get update
sudo apt-get install -y cmake build-essential
sudo apt-get install -y libgrpc++-dev libprotobuf-dev protobuf-compiler-grpc(UNTESTED) On macOS with Homebrew:
brew install cmake grpc protobufmkdir build
cd build
cmake ..
make -j $(nproc)Start the server (with port set to 50051):
./spice_server --port=50051 --nofind_simulators --static_installs=../static_installs.pb.txtYou can provide override paths to the Python modules for vlsirtools and the
Python VLSIR bindings with the --python_vlsir and --python_vlsirtools flags
(see src/netlister.cc or --help).
The testdata/cmos_inverter_hdl21 directory contains an example Hdl21
description of a basic CMOS inverter for the Sky130 PDK and a simple
testbench to demonstrate it. Hdl21 can output a vlsir::spice::SimInput
protobuf containing the testbench and design under test, which the example
client can submit to the spice server:
cd example_client
PYTHONPATH=${HOME}/src/Hdl21::${HOME}/src/Hdl21/pdks/Sky130 ./client.pyThe testdata directory contains example netlists to run through simulators. For example, you can run Xyce on cmost_inverter by running:
cd testdata/cmost_inverter
/path/to/Xyce main.sp
Or you could have the spice_server run it for you by sending the test data to the server with the example python3 client.py. First generat the required protobufs:
cd example_client
./generate_protobufs.sh
Then:
- changing the values in
static_installs.pb.txtto suit your system; - running the server with the above comand; and
- running the client on the testdata dir:
example_client/client.py testdata/cmos_inverter testdata/cmos_inverter/main.sp
~/go/bin/grpcurl -plaintext localhost:50051 listspice_server uses scripts in VLSIR's VlsirTools to convert VLSIR netlist protobufs to different netlist formats.
It does this by invoking the python scripts directly from within the C++ program. For now, the python scripts are pulled in directly from the vlsir_repo submodule in this repo. An alternative would to make them available as system-wide (or user-wide, or venv-wide) packages instead.