summaryrefslogtreecommitdiffstatshomepage
path: root/nl_examples
diff options
context:
space:
mode:
author Couriersud <couriersud@users.noreply.github.com>2014-02-09 22:43:58 +0000
committer Couriersud <couriersud@users.noreply.github.com>2014-02-09 22:43:58 +0000
commit534348f6a96f09d4642d1eabb53ab7607b5674d5 (patch)
tree16509726366e2ab25bb5ddfe6f734a7fc02299e8 /nl_examples
parentee7c90c3a462ea9556f259ee17d08e4b2a324eb2 (diff)
Commit current state of netlist examples. Later, these are intended as a basis for regression tests.
Diffstat (limited to 'nl_examples')
-rw-r--r--nl_examples/7400_astable.c14
-rw-r--r--nl_examples/opamp.c18
-rw-r--r--nl_examples/sn74ls629_osc.c33
-rw-r--r--nl_examples/todo.c17
-rw-r--r--nl_examples/vccs.c28
-rw-r--r--nl_examples/vccs1.c33
6 files changed, 111 insertions, 32 deletions
diff --git a/nl_examples/7400_astable.c b/nl_examples/7400_astable.c
index 4e92127c2f5..b9f4c93eee0 100644
--- a/nl_examples/7400_astable.c
+++ b/nl_examples/7400_astable.c
@@ -16,19 +16,19 @@ NETLIST_START(7400_astable)
SOLVER(Solver)
PARAM(Solver.FREQ, 48000)
- PARAM(Solver.ACCURACY, 1e-7)
+ PARAM(Solver.ACCURACY, 1e-4)
- // astable NAND Multivibrator
- RES(R1, 1000)
- CAP(C1, 1e-6)
+ // astable NAND Multivibrator ==> f ~ 1.0 / (3 * R * C)
+ RES(R1, 4700)
+ CAP(C1, 0.22e-6)
TTL_7400_NAND(n1,R1.1,R1.1)
TTL_7400_NAND(n2,R1.2,R1.2)
NET_C(n1.Q, R1.2)
NET_C(n2.Q, C1.1)
NET_C(C1.2, R1.1)
- LOG(log2, C1.2)
- //LOG(log2, n1.Q)
- LOG(log3, n2.Q)
+ LOG(logC12, C1.2)
+ LOG(logn1Q, n1.Q)
+ LOG(logn2Q, n2.Q)
NETLIST_END()
diff --git a/nl_examples/opamp.c b/nl_examples/opamp.c
index 2d960888f2e..57daf960e9c 100644
--- a/nl_examples/opamp.c
+++ b/nl_examples/opamp.c
@@ -19,10 +19,8 @@ NETLIST_START(opamp)
/* Standard stuff */
- CLOCK(clk)
- PARAM(clk.FREQ, 1000) // 1000 Hz
- SOLVER(Solver)
- PARAM(Solver.FREQ, 48000)
+ CLOCK(clk, 1000) // 1000 Hz
+ SOLVER(Solver, 48000)
PARAM(Solver.ACCURACY, 1e-6)
/* Wiring up the opamp */
@@ -40,9 +38,9 @@ NETLIST_START(opamp)
PARAM(EBUF.RO, 50)
PARAM(EBUF.G, 1)
- NET_ALIAS(PLUS, G1.IP) // Positive input
- NET_ALIAS(MINUS, G1.IN) // Negative input
- NET_ALIAS(OUT, EBUF.OP) // Opamp output ...
+ ALIAS(PLUS, G1.IP) // Positive input
+ ALIAS(MINUS, G1.IN) // Negative input
+ ALIAS(OUT, EBUF.OP) // Opamp output ...
NET_C(EBUF.ON, GND)
@@ -55,6 +53,10 @@ NETLIST_START(opamp)
NET_C(CP1.1, RP1.1)
NET_C(EBUF.IP, RP1.1)
+ RES(RL, 1000)
+ NET_C(RL.2, GND)
+ NET_C(RL.1, OUT)
+
//LOG(logX, OUT)
- //LOG(logY, 4V)
+ //LOG(logY, clk)
NETLIST_END()
diff --git a/nl_examples/sn74ls629_osc.c b/nl_examples/sn74ls629_osc.c
new file mode 100644
index 00000000000..e390361a74b
--- /dev/null
+++ b/nl_examples/sn74ls629_osc.c
@@ -0,0 +1,33 @@
+/*
+ * ne555_astable.c
+ *
+ */
+
+#include "netlist/devices/net_lib.h"
+
+NETLIST_START(ne555_astable)
+
+ /*
+ * Astable ne555
+ *
+ */
+
+ /* Standard stuff */
+
+ SOLVER(Solver)
+ PARAM(Solver.FREQ, 48000)
+
+ ANALOG_INPUT(V5, 5) // 5V
+ ANALOG_INPUT(VF, 2.5) // 5V
+ ANALOG_INPUT(VR, 5) // 5V
+
+ SN74LS629(OSC, 0.022e-6)
+
+ NET_C(GND, OSC.GND)
+ NET_C(VR, OSC.RNG)
+ NET_C(VF, OSC.FC)
+ NET_C(GND, OSC.ENQ)
+
+ //LOG(log2, OSC.Y)
+
+NETLIST_END()
diff --git a/nl_examples/todo.c b/nl_examples/todo.c
index 641a94fa803..9da1a2c66f6 100644
--- a/nl_examples/todo.c
+++ b/nl_examples/todo.c
@@ -49,23 +49,6 @@
#endif
#if 0
- NETDEV_VCCS(VV)
- PARAM(VV.G, 100000) // typical OP-AMP amplification
- RES(R1, 1000)
- RES(R2, 1)
- RES(R3, 10000)
-
- NET_C(4V, R1.1)
- NET_C(R1.2, VV.IN)
- NET_C(R2.1, VV.OP)
- NET_C(R3.1, VV.IN)
- NET_C(R3.2, VV.OP)
- NET_C(R2.2, GND)
- NET_C(VV.ON, GND)
- NET_C(VV.IP, GND)
- //LOG(logX, VV.OP)
- //LOG(logY, 4V)
-
#endif
#if 0
diff --git a/nl_examples/vccs.c b/nl_examples/vccs.c
new file mode 100644
index 00000000000..73cefd15fb1
--- /dev/null
+++ b/nl_examples/vccs.c
@@ -0,0 +1,28 @@
+/*
+ * vccs.c
+ *
+ */
+
+
+#include "netlist/devices/net_lib.h"
+
+NETLIST_START(vccs)
+
+ CLOCK(clk, 1000) // 1000 Hz
+ SOLVER(Solver, 48000)
+ PARAM(Solver.ACCURACY, 1e-12)
+ PARAM(Solver.RESCHED_LOOPS, 10000)
+
+ NETDEV_VCCS(VV)
+ PARAM(VV.G, 100) // typical OP-AMP amplification
+ RES(R2, 1)
+
+ NET_C(clk, VV.IN)
+ NET_C(R2.1, VV.OP)
+ NET_C(R2.2, GND)
+ NET_C(VV.ON, GND)
+ NET_C(VV.IP, GND)
+ LOG(logX, VV.OP)
+ LOG(logY, clk)
+
+NETLIST_END()
diff --git a/nl_examples/vccs1.c b/nl_examples/vccs1.c
new file mode 100644
index 00000000000..c1a5725f93c
--- /dev/null
+++ b/nl_examples/vccs1.c
@@ -0,0 +1,33 @@
+/*
+ * vccs.c
+ *
+ */
+
+
+#include "netlist/devices/net_lib.h"
+
+NETLIST_START(vccs)
+
+ CLOCK(clk, 1000) // 1000 Hz
+ SOLVER(Solver, 48000)
+ PARAM(Solver.ACCURACY, 1e-6)
+
+
+ NETDEV_VCCS(VV)
+ PARAM(VV.G, 100000) // typical OP-AMP amplification
+ RES(R1, 10000)
+ RES(R2, 1)
+ RES(R3, 1000)
+
+ NET_C(clk, R1.1)
+ NET_C(R1.2, VV.IN)
+ NET_C(R2.1, VV.OP)
+ NET_C(R3.1, VV.IN)
+ NET_C(R3.2, VV.OP)
+ NET_C(R2.2, GND)
+ NET_C(VV.ON, GND)
+ NET_C(VV.IP, GND)
+ LOG(logX, VV.OP)
+ LOG(logY, clk)
+
+NETLIST_END()