A simple spice in C/C++
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
include
sample
src
.gitignore
Makefile
README
README.markdown

README.markdown

CSPICE

A simple SPICE in C/C++

(C) 2010 Andrew Liu (C) 2010 Stimim Chen

Compile

Tools like lex and yacc are used in parsing, please install flex' and bison'. Simply just `make', tested on 32/64bit GNU/Linux.

Usage

  cspice [NETLIST] [PLOT]

The output format is a gnuplot setting file, using `gnuplot [PLOT]' to plot the output of simulation. For more information of gnuplot, please check the website (http://sourceforge.net/projects/gnuplot/files/gnuplot/4.4.2/).

Support elements and simulations

Support elements

Resistor, Inductor, Capacitor, Voltage Control Current Source, Voltage source input, Current source input

Support simulations

Transient response, Frequency response

Netlist format

  # Elements
  V[ID] [NODE1] [NODE2] [VALUE] # Voltage source
  I[ID] [NODE1] [NODE2] [VALUE] # Current source
  R[ID] [NODE1] [NODE2] [VALUE] # Resistor
  L[ID] [NODE1] [NODE2] [VALUE] # Inductor
  C[ID] [NODE1] [NODE2] [VALUE] # Capacitor
  G[ID] [NODE1] [NODE2] [NODE3] [NODE4] [VALUE]
  # VCCS: (V3-V4) = (VALUE) * (V1 - V2)

  # Simulations
  FREQ  [START] [END] [STEP] [SRC] [OUTPUT] # Frequency response
  TIME  [START] [END] [STEP] [OUTPUT]       # Transient response