summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--readme.org78
1 files changed, 59 insertions, 19 deletions
diff --git a/readme.org b/readme.org
index b193b88..d43c310 100644
--- a/readme.org
+++ b/readme.org
@@ -1,3 +1,4 @@
+#+TITLE: Readme
* Overview
Extends org-babel capabilities to support spice simulations using
@@ -12,7 +13,7 @@ Spice source blocks are interpreted as circuit descriptions until an
*line all of the src block is interpreted as a control block!*
* Use cases
-*** Just load some circuit for later simulation:
+** Just load some circuit for later simulation:
#+BEGIN_SRC spice :results output
,* RC
r1 1 0 10k
@@ -24,7 +25,7 @@ c1 1 0 1p
#+RESULTS:
: Circuit: * rc
-*** Execute some stuff
+** Execute some stuff
#+BEGIN_SRC spice
echo "Hello world"
#+END_SRC
@@ -37,7 +38,7 @@ echo "0,1,2,3"
#+RESULTS:
| 0 | 1 | 2 | 3 |
-*** Plot some voltages and return png
+** Plot some voltages and return png
#+BEGIN_SRC spice :var file="/tmp/xzy" :results file
,*RC circuit
r1 1 0 10k
@@ -57,7 +58,7 @@ gnuplot $file v(1)
#+RESULTS:
[[file:/tmp/xzy.png]]
-*** Do measurements and return results
+** Do measurements and return results
#+BEGIN_SRC spice :session spicetest :results value
,*Time Constant Measurement
r1 1 0 10k
@@ -79,7 +80,7 @@ echo $&value_at_tau ,$&value_at_five_tau
#+RESULTS:
| 0.36798 | 0.00671732 |
-*** write simulation data to file and return file name
+** Write simulation data to file and return file name
#+BEGIN_SRC spice :var file="/tmp/xyz" :post plot_stuff(data=*this*) :results file
,*RC circuit
r1 1 0 10k
@@ -100,20 +101,59 @@ wrdata $file v(1)
#+BEGIN_SRC gnuplot :var data="x" :file "/tmp/xyz_plot.png" :results silent
plot data u 1:2 w l ls 1
#+END_SRC
+** Use calculation results of other src blocks as parameters
+#+NAME: dim1_params
+#+BEGIN_SRC ruby :exports none
+[7.3260073260073255e-06,1.3215597400496679e-05,5.411787135503391e-06,2.344322344322345e-05,2.4e-06, 100.0]
+#+END_SRC
+#+RESULTS: dim1_params
+| 7.3260073260073255e-06 | 1.3215597400496679e-05 | 5.411787135503391e-06 | 2.344322344322345e-05 | 2.4e-06 | 100.0 |
+
+#+NAME: dim1_plot
+#+BEGIN_SRC gnuplot :var data="x" :file /tmp/ignored.png :results silent :exports none
+ set terminal pngcairo size 640,300 enhanced
+ set format y "%.0s%cV"
+ set format x "%.0s%cs"
+ set xrange [190e-9:260e-9]
+ set ytics 5e-3
+ set xlabel "t"
+ plot data using 1:2 w l ls 2 t "V_{out}"
+#+END_SRC
+
+#+BEGIN_SRC spice :session test :var dim=dim1_params :results output
+,* DAC.asc
+.model NMOS NMOS
+.model PMOS PMOS
+.lib /home/fred/spice/library/ngspice/CM5/CM5-N.phy CM5
+M1 0 VDD N005 N005 MP7 l=$dim[5] w=$dim[4]
+M2 VOUT VCTRL N005 N005 MP7 l=$dim[5] w=$dim[4]
+M4 N003 N002 VDD VDD MP7 l=$dim[3] w=$dim[2]
+M3 N002 N002 VDD VDD MP7 l=$dim[3] w=$dim[2]
+M5 N005 N004 N003 N003 MP7 l=$dim[3] w=$dim[2]
+M6 N004 N004 N002 N002 MP7 l=$dim[3] w=$dim[2]
+RL VOUT 0 $dim[6]
+CL VOUT 0 10p
+VDD VDD 0 5
+IREF N004 0 7.3u
+V1 VBIAS 0 2.5
+V2 VCTRL 0 PULSE(0 5 0 1n 1n 200n 420n)
+VM VDD N001 0
+.tran 1n 300n 190n
+.end
+#+END_SRC
+
+#+RESULTS:
+: Circuit: * dac.asc
+
+#+NAME: dim1
+#+BEGIN_SRC spice :session test :var file="/tmp/dim1" dim=dim1_params :post dim1_plot[:file /tmp/dim1.png](data=*this*) :results file
+save all
+run
+wrdata $file v(vout)
+#+END_SRC
-* Flags
-** :netlist / :circuit
-Name of a src block to include for netlist/circuit descriptions.
+#+RESULTS: dim1
+[[file:/tmp/dim1.png]]
+* Current supported Flags
** :dir
Working directory to run the src block in. Default is the value of `default-directory'.
-** :file?
-
-** :gnuplot
-Name of gnuplot block or .plt file: handle plotting instead of gnuplot
-lines
-** :results
-Available result options are `value' which returns the output of the
- last expression, `output' which returns all output and `smart' which
- tries to only display echos and plot filenames.
-** :batch / :no-interactive
-use batch mode