Voltage: Vname N+ N- value/pwl(t v t v ...)
Current: Iname N+ N- value/pwl(t v t v ...)
Resistor: Rname N+ N- value
Capacitor: Cname N+ N- value
Inductor: Lname N+ N- value
VCVS: Ename N+ N- NC+ NC- Value
VCCS: Gname N+ N- NC+ NC- Value
CCVS: Hname N+ N- NC+ NC- Value
CCCS: Fname N+ N- NC+ NC- Value
.tran tstep tstop
: Specifies simulation time step and total simulation time.
.debug 1
: Enable debug output to print MNA matrix and RHS vector, as well as solution to each time step.
.option method=euler
: Specifies the method used to perform numerical integration. Valid methods are euler
(backward Euler), gear2
(Gear2 or BDF2) and trap
(tapezoidal method).
.plot tran [width=xx height=xx] [canvas.]V(NodeName) [canvas.]I(DeviceName)
: Generate a simple ASCII plot in terminal for easier debugging. If width
and height
directives are not given, the tool will use current terminal size for plot width and height. Multiple simulation results can be plotted in a single chart by specifying a same canvas name. Currently at most 4 plots can be drawn in one canvas.
.measure tran variable_name trig V(node)/I(device)=trigger_value TD=xx targ V(node)/I(device)=target_value
: Measure the event time between trigger value happend and target value happend.
git clone --recurse-submodules
and make
should be sufficient. The executable is generated under current code directory and named "trans".
To run, just give the executable the spice deck you want to simulate.
./trans circuit/rc.cir
gives the exponential curve of a capacitor being charged, as well as an example for .measure
commands.
./trans circuit/lc.cir
produces a oscillation curve of an LC circuit.
./trans circuit/xtalk.cir
gives an example of the voltage curve of a capacitor with an aggressor toggling beside it, as well as the canvas-ed .plot
command.
./trans circuit/network.cir
gives an example of simulation of a larger RC network.
The output tr0 format still cannot be recognized by waveform viewer tools, not sure where the problem is.