summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib
diff options
context:
space:
mode:
authorGravatarGravatar couriersud <couriersud@gmx.org>2019-11-25 22:28:41 +0100
committerGravatarGravatar couriersud <couriersud@gmx.org>2019-11-25 22:28:41 +0100
commitc50bf9a698c8dc3e99ab6f703fc8bb9d1da41ad6 (patch)
tree96f0910ad76c2ef23d87f5626f3c30768ec04c3e /src/lib
parentceae2fdc3ebbd1c54e21190aa16957af8724b4b5 (diff)
netlist: move nl_examples to src/lib/netlist/examples. (nw)
One folder less in the top-level.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/netlist/examples/2N6027.cpp101
-rw-r--r--src/lib/netlist/examples/7400_astable.c35
-rw-r--r--src/lib/netlist/examples/74123_mstable.c47
-rw-r--r--src/lib/netlist/examples/7414.cpp33
-rw-r--r--src/lib/netlist/examples/9602_mstable.c53
-rw-r--r--src/lib/netlist/examples/LM3900_test.cpp103
-rw-r--r--src/lib/netlist/examples/bjt.c46
-rw-r--r--src/lib/netlist/examples/bjt_eb.c44
-rw-r--r--src/lib/netlist/examples/bjt_eb_pnp.c35
-rw-r--r--src/lib/netlist/examples/breakout.c1462
-rw-r--r--src/lib/netlist/examples/cccs.c39
-rw-r--r--src/lib/netlist/examples/cd4066.c46
-rw-r--r--src/lib/netlist/examples/cdelay.c53
-rw-r--r--src/lib/netlist/examples/cmos_inverter.cpp42
-rw-r--r--src/lib/netlist/examples/cmos_inverter_clk.cpp64
-rw-r--r--src/lib/netlist/examples/congo_bongo.c419
-rw-r--r--src/lib/netlist/examples/congo_bongo.csv13
-rw-r--r--src/lib/netlist/examples/cs.cpp27
-rw-r--r--src/lib/netlist/examples/diode.c31
-rw-r--r--src/lib/netlist/examples/kidniki.c466
-rw-r--r--src/lib/netlist/examples/mm5837_noise.c38
-rw-r--r--src/lib/netlist/examples/msx_mixer_stage.c65
-rw-r--r--src/lib/netlist/examples/ne555_astable.c53
-rw-r--r--src/lib/netlist/examples/nmos_fet.cpp54
-rw-r--r--src/lib/netlist/examples/norton_opamp.c126
-rw-r--r--src/lib/netlist/examples/opamp.c187
-rw-r--r--src/lib/netlist/examples/opamp_amplification_curve.cpp94
-rw-r--r--src/lib/netlist/examples/rc.c31
-rw-r--r--src/lib/netlist/examples/rl.c32
-rw-r--r--src/lib/netlist/examples/sn74ls629_osc.c34
-rw-r--r--src/lib/netlist/examples/test.c87
-rw-r--r--src/lib/netlist/examples/todo.c140
-rw-r--r--src/lib/netlist/examples/vccs.c30
-rw-r--r--src/lib/netlist/examples/vccs1.c35
-rw-r--r--src/lib/netlist/examples/vs.c32
-rw-r--r--src/lib/netlist/examples/vs_cs.c52
36 files changed, 4249 insertions, 0 deletions
diff --git a/src/lib/netlist/examples/2N6027.cpp b/src/lib/netlist/examples/2N6027.cpp
new file mode 100644
index 00000000000..8b414317087
--- /dev/null
+++ b/src/lib/netlist/examples/2N6027.cpp
@@ -0,0 +1,101 @@
+// license:GPL-2.0+
+// copyright-holders:Couriersud
+
+#include "netlist/devices/net_lib.h"
+
+/*
+ * Run with
+ * ./nltool -t 1 -f nl_examples/2N6027.cpp -l PUT.A -l PUT.K -l PUT.G -v
+ */
+
+/* ----------------------------------------------------------------------------
+ * Library section header START
+ * ---------------------------------------------------------------------------*/
+
+#ifndef __PLIB_PREPROCESSOR__
+
+#define PUT_2N6027(_name) \
+ NET_REGISTER_DEV(G501534_DIP, _name)
+
+//NETLIST_EXTERNAL(ex2N6027)
+NETLIST_EXTERNAL(loc_lib)
+
+#endif
+
+/* ----------------------------------------------------------------------------
+ * Library section header END
+ * ---------------------------------------------------------------------------*/
+
+NETLIST_START(ex2N6027)
+
+ /* This is a circuit pushing the solvers to the limits
+ * 50,000 maximum NR loops.
+ */
+ SOLVER(Solver, 48000)
+ PARAM(Solver.ACCURACY, 1e-5)
+ PARAM(Solver.DYNAMIC_TS, 1)
+ PARAM(Solver.DYNAMIC_MIN_TIMESTEP, 1e-9)
+ PARAM(Solver.NR_LOOPS, 50000)
+ PARAM(Solver.METHOD, "MAT_CR")
+
+ LOCAL_SOURCE(loc_lib)
+ INCLUDE(loc_lib)
+
+ ANALOG_INPUT(VB, 10)
+
+ PUT_2N6027(PUT)
+
+ // Figure 3 from datasheet
+ RES(R1, RES_K(510))
+ RES(R2, RES_K(16))
+ RES(R3, RES_K(27))
+ RES(R4, 20)
+ CAP(C, CAP_U(0.1))
+
+ NET_C(VB, R1.1, R2.1)
+ NET_C(R1.2, C.1, PUT.A)
+ NET_C(PUT.K, R4.1)
+ NET_C(PUT.G, R2.2, R3.1)
+
+ NET_C(GND, C.2, R4.2, R3.2)
+
+NETLIST_END()
+
+
+NETLIST_START(PUT_2N6027)
+
+ NET_MODEL("2N6027_NPN NPN(IS=5E-15 VAF=100 IKF=0.3 ISE=1.85E-12 NE=1.45 RE=0.15 RC=0.15 CJE=7E-10 TF=0.6E-8 CJC=2.2E-10 TR=4.76E-8 XTB=3)")
+ NET_MODEL("2N6027_PNP PNP(IS=2E-15 VAF=100 IKF=0.3 ISE=1.90E-12 NE=1.5 RE=0.15 RC=0.15 CJE=7E-10 TF=1.6E-8 CJC=2.2E-10 TR=5.1E-8 XTB=3)")
+
+ QBJT_EB(Q1, "2N6027_NPN")
+ QBJT_EB(Q2, "2N6027_PNP")
+
+ /* The netlist transistor model currently doesn't support
+ * BE and BC capacitances.
+ * Adding those here significantly reduces NR loops.
+ * FIXME: Needs to be removed when added to the
+ * transistor EB model.
+ */
+#if 0
+ CAP(CJE1, CAP_N(1))
+ CAP(CJE2, CAP_N(1))
+
+ NET_C(CJE1.1, Q1.B)
+ NET_C(CJE1.2, Q1.E)
+ NET_C(CJE2.1, Q2.B)
+ NET_C(CJE2.2, Q2.E)
+#endif
+ NET_C(Q1.C, Q2.B)
+ NET_C(Q1.B, Q2.C)
+
+ ALIAS(G, Q2.B)
+ ALIAS(A, Q2.E)
+ ALIAS(K, Q1.E)
+
+NETLIST_END()
+
+NETLIST_START(loc_lib)
+
+ LOCAL_LIB_ENTRY(PUT_2N6027)
+
+NETLIST_END()
diff --git a/src/lib/netlist/examples/7400_astable.c b/src/lib/netlist/examples/7400_astable.c
new file mode 100644
index 00000000000..07748a0816a
--- /dev/null
+++ b/src/lib/netlist/examples/7400_astable.c
@@ -0,0 +1,35 @@
+// license:GPL-2.0+
+// copyright-holders:Couriersud
+/*
+ * 7400_astable.c
+ *
+ */
+
+#include "netlist/devices/net_lib.h"
+
+NETLIST_START(7400_astable)
+
+ /*
+ * Astable multivibrator using two 7400 gates (or inverters)
+ *
+ */
+
+ /* Standard stuff */
+
+ SOLVER(Solver, 48000)
+ PARAM(Solver.ACCURACY, 1e-5)
+
+ // 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(logC12, C1.2)
+ LOG(logn1Q, n1.Q)
+ LOG(logn2Q, n2.Q)
+
+NETLIST_END()
diff --git a/src/lib/netlist/examples/74123_mstable.c b/src/lib/netlist/examples/74123_mstable.c
new file mode 100644
index 00000000000..aa21f4fe215
--- /dev/null
+++ b/src/lib/netlist/examples/74123_mstable.c
@@ -0,0 +1,47 @@
+// license:GPL-2.0+
+// copyright-holders:Couriersud
+/*
+ * 74123_mstable.c
+ *
+ */
+
+#include "netlist/devices/net_lib.h"
+
+NETLIST_START(74123_mstable)
+
+ /*
+ * Monoflog
+ *
+ */
+
+ /* Standard stuff */
+
+ SOLVER(Solver, 48000)
+
+ ANALOG_INPUT(V5, 5) // 5V
+
+ /* Wiring up the 74123 */
+
+ CLOCK(clk, 50)
+ TTL_74123(mf)
+
+ RES(R, 10000)
+ CAP(C, 1e-6)
+
+ NET_C(GND, mf.GND)
+ NET_C(V5, mf.VCC)
+
+ NET_C(C.1, mf.C)
+ NET_C(mf.C, GND)
+ NET_C(C.2, mf.RC, R.2)
+ NET_C(R.1, V5)
+
+ NET_C(mf.CLRQ, V5)
+ NET_C(mf.B, V5)
+ NET_C(mf.A, clk.Q)
+
+ LOG(log_C, C.2)
+ LOG(log_Q, mf.Q)
+ LOG(log_X, clk.Q)
+
+NETLIST_END()
diff --git a/src/lib/netlist/examples/7414.cpp b/src/lib/netlist/examples/7414.cpp
new file mode 100644
index 00000000000..0fcfde9a7f4
--- /dev/null
+++ b/src/lib/netlist/examples/7414.cpp
@@ -0,0 +1,33 @@
+// license:GPL-2.0+
+// copyright-holders:Couriersud
+/*
+ * 7414.c
+ *
+ */
+
+#include "netlist/devices/net_lib.h"
+
+NETLIST_START(7414_astable)
+
+ /*
+ * Simple oscillator with 74LS14
+ *
+ * ./nltool -f nl_examples/7414.cpp -l C37.1 -l U4A1.Q
+ *
+ */
+
+ /* Standard stuff */
+
+ SOLVER(Solver, 48000)
+ PARAM(Solver.ACCURACY, 1e-8)
+
+ TTL_74LS14_GATE(U4A1)
+ //TTL_7404_GATE(U4A1)
+ RES(R39, 2200)
+ CAP(C37, CAP_U(1))
+ NET_C(U4A1.A, R39.2, C37.1)
+ NET_C(GND, C37.2)
+ NET_C(GND, U4A1.GND)
+ NET_C(R39.1, U4A1.Q)
+
+NETLIST_END()
diff --git a/src/lib/netlist/examples/9602_mstable.c b/src/lib/netlist/examples/9602_mstable.c
new file mode 100644
index 00000000000..8e482c8dfb3
--- /dev/null
+++ b/src/lib/netlist/examples/9602_mstable.c
@@ -0,0 +1,53 @@
+// license:GPL-2.0+
+// copyright-holders:Couriersud
+/*
+ * 9602_mstable.c
+ *
+ */
+
+#include "netlist/devices/net_lib.h"
+
+NETLIST_START(74123_mstable)
+
+ /*
+ * Monoflog
+ *
+ */
+
+ /* Standard stuff */
+
+ SOLVER(Solver, 48000)
+
+ ANALOG_INPUT(V5, 5) // 5V
+
+ /* Wiring up the 74123 */
+
+ CLOCK(clk, 50)
+ TTL_9602_DIP(mf)
+
+ RES(R, 10000)
+ CAP(C, 1e-6)
+
+ NET_C(GND, mf.8) //
+ NET_C(V5, mf.16) //
+
+ NET_C(C.1, mf.1)
+ NET_C(mf.1, GND) // Test - can be removed
+ NET_C(C.2, mf.2, R.2)
+ NET_C(R.1, V5)
+
+ NET_C(mf.3, V5) // CLR
+ NET_C(mf.4, GND) // B
+ NET_C(mf.5, clk.Q) // A
+
+ LOG(logC, C.2)
+ LOG(logQ, mf.6) //Q
+ LOG(logX, clk.Q)
+
+ // avoid non connected inputs
+
+ NET_C(mf.11, V5)
+ NET_C(mf.12, V5)
+ NET_C(mf.13, V5)
+
+NETLIST_END()
diff --git a/src/lib/netlist/examples/LM3900_test.cpp b/src/lib/netlist/examples/LM3900_test.cpp
new file mode 100644
index 00000000000..0498b4d2f0b
--- /dev/null
+++ b/src/lib/netlist/examples/LM3900_test.cpp
@@ -0,0 +1,103 @@
+// license:GPL-2.0+
+// copyright-holders:Couriersud
+/*
+ * Script to analyze opamp amplification as a function of frequency.
+ *
+ * ./nltool -t 0.5 -f nl_examples/LM9000_test.cpp
+ *
+ * t=0.0: 10 Hz
+ * t=0.1: 100 Hz
+ * t=0.2: 1000 Hz
+ * t=0.3: 10000 Hz
+ * t=0.4: 100000 Hz
+ * ....
+ *
+ * ./plot_nl.sh --db Y Z
+ */
+
+
+#include "netlist/devices/net_lib.h"
+
+NETLIST_START(main)
+
+ /* Standard stuff */
+
+ //VARCLOCK(clk, "0.5 / pow(10, 1 + T * 4)")
+ //CLOCK(clk, 1000)
+ SOLVER(Solver, 48000)
+ PARAM(Solver.ACCURACY, 1e-10)
+ PARAM(Solver.NR_LOOPS, 300)
+ PARAM(Solver.DYNAMIC_TS, 1)
+ PARAM(Solver.DYNAMIC_MIN_TIMESTEP, 1e-7)
+
+ VS(vs, 0)
+ /*
+ * Having f(t)=sin(g(t)*t) the derivative becomes
+ *
+ * f'(t) = d/dt(g(t)*t) * cos(g(t)*t)
+ *
+ * w(t) = d/dt(g(t)*t) = 2*pi*freq(t) is the angular frequency at time t
+ *
+ * choosing freq(t) = pow(10, a+b*t) and integrating we get
+ *
+ * g(t)*t = 2 * pi /(b*ln(10)) * (pow(10, a+b*t)-pow(10,a))
+ */
+
+ PARAM(vs.FUNC, "0.001 * sin(0.2728752708 * (pow(10, 1 + 10*T) - 10))")
+
+ /*
+ * Stepwise ... same as above
+ */
+ //PARAM(vs.FUNC, "0.001 * sin(6.28 * pow(10, trunc((1 + T * 10)*10)/10) * T)")
+
+ /*
+ * Fixed Frequency:
+ * PARAM(vs.FUNC, "1.001 * sin(6.28 * 100 * T)")
+ */
+ PARAM(vs.R, 0.1)
+ ALIAS(clk, vs.1)
+ NET_C(vs.2, GND)
+ ANALOG_INPUT(V9, 9)
+ ANALOG_INPUT(V12, 12)
+ ANALOG_INPUT(VM12, -12)
+
+ //OPAMP(op, OPAMP_TEST)
+ LM3900(op)
+
+ NET_C(op.GND, VM12)
+ NET_C(op.VCC, V12)
+
+ /* Opamp B wired as inverting amplifier connected to output of first opamp */
+
+ RES(R1, 50)
+ RES(RP, 500000) // Set to R2 * 2 if VPlus == VCC (see datasheet)
+ RES(R2, 500000)
+
+ NET_C(op.PLUS, RP.1)
+
+ //NET_C(RP.2, V9)
+ NET_C(RP.2, GND)
+ //NET_C(RP.2, V12)
+
+ NET_C(op.MINUS, R2.2)
+ NET_C(op.MINUS, R1.2)
+
+ CAP(C, 10e-6)
+
+ NET_C(clk, C.1)
+ NET_C(C.2, R1.1)
+ NET_C(op.OUT, R2.1)
+
+ CAP(CL, 10.0e-6)
+ RES(RL, 2000)
+ NET_C(RL.2, GND)
+ NET_C(RL.1, CL.2)
+ NET_C(CL.1, op.OUT)
+
+ AFUNC(f, 1, "A0 * 1000")
+ NET_C(f.A0, RL.1)
+#if 1
+ LOG(log_Y, R1.1)
+ LOG(log_Z, f)
+#endif
+NETLIST_END()
diff --git a/src/lib/netlist/examples/bjt.c b/src/lib/netlist/examples/bjt.c
new file mode 100644
index 00000000000..7222ced4445
--- /dev/null
+++ b/src/lib/netlist/examples/bjt.c
@@ -0,0 +1,46 @@
+// license:GPL-2.0+
+// copyright-holders:Couriersud
+/*
+ * bjt.c
+ *
+ */
+
+
+#include "netlist/devices/net_lib.h"
+
+NETLIST_START(bjt)
+ /* Standard stuff */
+
+ CLOCK(clk, 1000) // 1000 Hz
+ SOLVER(Solver, 48000)
+ ANALOG_INPUT(V5, 5)
+ ANALOG_INPUT(V3, 3.5)
+
+ /* NPN - example */
+
+ QBJT_SW(Q, "BC237B")
+ RES(RB, 1000)
+ RES(RC, 1000)
+
+ NET_C(RC.1, V5)
+ NET_C(RC.2, Q.C)
+ NET_C(RB.1, clk)
+ NET_C(RB.2, Q.B)
+ NET_C(Q.E, GND)
+
+ /* PNP - example */
+
+ QBJT_SW(Q1, "BC556B")
+ RES(RB1, 1000)
+ RES(RC1, 1000)
+
+ NET_C(RC1.1, GND)
+ NET_C(RC1.2, Q1.C)
+ NET_C(RB1.1, clk)
+ NET_C(RB1.2, Q1.B)
+ NET_C(Q1.E, V3)
+
+ LOG(logB, Q.B)
+ LOG(logC, Q.C)
+
+NETLIST_END()
diff --git a/src/lib/netlist/examples/bjt_eb.c b/src/lib/netlist/examples/bjt_eb.c
new file mode 100644
index 00000000000..f21735c36ec
--- /dev/null
+++ b/src/lib/netlist/examples/bjt_eb.c
@@ -0,0 +1,44 @@
+// license:GPL-2.0+
+// copyright-holders:Couriersud
+/*
+ * bjt.c
+ *
+ */
+
+
+#include "netlist/devices/net_lib.h"
+#include "netlist/analog/nld_twoterm.h"
+
+NETLIST_START(bjt)
+ /* Standard stuff */
+
+ CLOCK(clk, 10000) // 10000 Hz
+ SOLVER(Solver, 48000)
+ PARAM(Solver.ACCURACY, 1e-6)
+ PARAM(Solver.RESCHED_LOOPS, 30)
+ ANALOG_INPUT(V5, 5)
+ ANALOG_INPUT(V3, 3.5)
+
+ /* NPN - example */
+
+ QBJT_EB(Q, "BC237B")
+ RES(RB, 1000)
+ RES(RC, 1000)
+
+ NET_C(RC.1, V5)
+ NET_C(RC.2, Q.C)
+ NET_C(RB.1, clk)
+ //NET_C(RB.1, V3)
+ NET_C(RB.2, Q.B)
+ NET_C(Q.E, GND)
+
+ // put some load on Q.C
+
+ RES(RCE, 150000)
+ NET_C(RCE.1, Q.C)
+ NET_C(RCE.2, GND)
+
+ //LOG(logB, Q.B)
+ //LOG(logC, Q.C)
+
+NETLIST_END()
diff --git a/src/lib/netlist/examples/bjt_eb_pnp.c b/src/lib/netlist/examples/bjt_eb_pnp.c
new file mode 100644
index 00000000000..10169b6bd3f
--- /dev/null
+++ b/src/lib/netlist/examples/bjt_eb_pnp.c
@@ -0,0 +1,35 @@
+// license:GPL-2.0+
+// copyright-holders:Couriersud
+/*
+ * bjt.c
+ *
+ */
+
+
+#include "netlist/devices/net_lib.h"
+
+NETLIST_START(bjt)
+ /* Standard stuff */
+
+ CLOCK(clk, 1000) // 1000 Hz
+ SOLVER(Solver, 48000)
+ ANALOG_INPUT(V5, 5)
+ ANALOG_INPUT(V3, 3.5)
+
+ /* PNP - example */
+
+ QBJT_EB(Q1, "BC556B")
+ RES(RB1, 1000)
+ RES(RC1, 1000)
+
+ NET_C(RC1.1, GND)
+ NET_C(RC1.2, Q1.C)
+ NET_C(RB1.1, clk)
+ NET_C(RB1.2, Q1.B)
+ NET_C(Q1.E, V3)
+
+ LOG(logA, clk)
+ LOG(logB, Q1.B)
+ LOG(logC, Q1.C)
+
+NETLIST_END()
diff --git a/src/lib/netlist/examples/breakout.c b/src/lib/netlist/examples/breakout.c
new file mode 100644
index 00000000000..591ffaf3414
--- /dev/null
+++ b/src/lib/netlist/examples/breakout.c
@@ -0,0 +1,1462 @@
+// license:GPL-2.0+
+// copyright-holders:Couriersud
+#define NETLIST_DEVELOPMENT 1
+
+#include "netlist/nl_dice_compat.h"
+#include "netlist/devices/net_lib.h"
+#include "netlist/analog/nld_twoterm.h"
+
+//2 555 timers
+static Astable555Desc b2_555_desc(OHM(560.0), M_OHM(1.8), U_FARAD(0.1));
+
+static Mono555Desc c9_555_desc(OHM(47.0), U_FARAD(1.0)); // R33, C21
+
+//check these values
+//static Paddle1HorizontalDesc pad1_desc(15047.0, 47.0, &c9_555_desc);
+
+static CapacitorDesc c32_desc(U_FARAD(0.1));
+static CapacitorDesc c36_desc(N_FARAD(1.0)); //0.001uF = 1nF
+static CapacitorDesc c37_desc(P_FARAD(330.0));
+static BufferDesc pad_en_buf_desc(DELAY_NS(15.0), DELAY_NS(15.0)); // Prevents 12ns glitch on PAD_EN_n signal from resetting C9. TODO: is this accurate?
+
+#if 0
+static VIDEO_DESC( breakout )
+ VIDEO_RESISTANCE(1, K_OHM(0.0))
+ VIDEO_RESISTANCE(2, K_OHM(3.9))
+ VIDEO_RESISTANCE(3, K_OHM(3.9))
+ VIDEO_RESISTANCE(4, K_OHM(3.9))
+ VIDEO_RESISTANCE(5, K_OHM(3.9))
+ VIDEO_RESISTANCE(6, K_OHM(3.9))
+ //VIDEO_RESISTANCE(Video::HBLANK_PIN, K_OHM(0.0))
+ VIDEO_ORIENTATION(ROTATE_90)
+ VIDEO_CONTRAST(4.0)
+
+ // Values guessed based on screenshots. TODO: Make more accurate
+ // X, Y, W, H, R, G, B
+ VIDEO_OVERLAY( 15.570e-6, 0.0, 1.911e-6, -1.0, 0.80, 0.15, 0.05 ) // Red Bricks
+ VIDEO_OVERLAY( 17.481e-6, 0.0, 1.956e-6, -1.0, 0.95, 0.65, 0.05 ) // Amber Bricks
+ VIDEO_OVERLAY( 19.437e-6, 0.0, 1.956e-6, -1.0, 0.05, 0.65, 0.25 ) // Green Bricks
+ VIDEO_OVERLAY( 21.393e-6, 0.0, 1.955e-6, -1.0, 0.95, 0.95, 0.20 ) // Yellow Bricks
+ VIDEO_OVERLAY( 51.345e-6, 0.0, 1.956e-6, -1.0, 0.05, 0.65, 0.95 ) // Blue Paddle
+
+ // TODO: Different overlays for cocktail cabinet
+VIDEO_DESC_END
+
+static AUDIO_DESC( breakout )
+ AUDIO_RESISTANCE(1, K_OHM(47.0))
+ AUDIO_RESISTANCE(2, K_OHM(47.0))
+ AUDIO_RESISTANCE(3, K_OHM(47.0))
+ AUDIO_RESISTANCE(4, K_OHM(47.0))
+ AUDIO_GAIN(3.0)
+VIDEO_DESC_END
+#endif
+
+static Mono9602Desc n8_desc(K_OHM(33.0), U_FARAD(100.0), K_OHM(5.6), P_FARAD(0.01)); // No capacitor on 2nd 9602, assume very low internal capacitance
+static Mono9602Desc f3_desc(K_OHM(47.0), U_FARAD(1.0), K_OHM(47.0), U_FARAD(1.0));
+
+static Mono9602Desc a7_desc(K_OHM(68.0), U_FARAD(1.0), K_OHM(22.0), U_FARAD(10.0));
+static Mono9602Desc a8_desc(K_OHM(27.0), U_FARAD(1.0), K_OHM(27.0), U_FARAD(1.0));
+
+static Dipswitch53137Desc dipswitch1_desc("bonus_credit", "Bonus Credit", 3, "None", "100", "200", "300", "400", "500", "600", "700", "800");
+//static DipswitchDesc dipswitch2_desc("cabinet_type", "Cabinet Type", 0, "Normal", "Cocktail");
+//static DipswitchDesc dipswitch3_desc("coinage", "Coinage", 0, "1 Coin / 1 Credit", "1 Coin / 2 Credits");
+//static DipswitchDesc dipswitch4_desc("ball_count", "Ball Count", 0, "3", "5");
+
+CIRCUIT_LAYOUT( breakout )
+ CHIP("S1", 53137, &dipswitch1_desc)
+ CHIP("S2", DIPSWITCH, &dipswitch2_desc)
+ CHIP("S3", DIPSWITCH, &dipswitch3_desc)
+ CHIP("S4", DIPSWITCH, &dipswitch4_desc)
+
+ SOLVER(Solver, 48000)
+ PARAM(Solver.ACCURACY, 1e-7) // works and is sufficient
+ //CHIP("CLOCK", CLOCK_14_318_MHZ)
+ MAINCLOCK(Y1, 14318000.0)
+
+ ANALOG_INPUT(V5, 5)
+#define VCC "V5", Q
+#define GND "GND", Q
+
+ //CHIP("Y1", CLOCK_14_318_MHZ) //Y1
+
+ CHIP_CAPACITOR(C32, &c32_desc)
+ CHIP_CAPACITOR(C36, &c36_desc)
+ CHIP_CAPACITOR(C37, &c37_desc)
+ CHIP("PAD_EN_BUF", BUFFER, &pad_en_buf_desc)
+
+ CHIP("A3", 7474)
+ CHIP("A4", 7408)
+ CHIP("A5", 7400)
+ CHIP("A6", 7474)
+ CHIP_9602_Mono(A7, &a7_desc)
+ CHIP_9602_Mono(A8, &a8_desc)
+
+ CHIP_555_Astable(B2, &b2_555_desc)
+ CHIP("B3", 7402)
+ CHIP("B4", 9316)
+ CHIP("B5", 74193)
+ CHIP("B6", 7400)
+ CHIP("B7", 9316)
+ CHIP("B8", 9316)
+ CHIP("B9", 7408)
+
+ CHIP("C2", 7400)
+ CHIP("C3", 7400)
+ CHIP("C4", 7486)
+ CHIP("C5", 7404)
+ CHIP("C6", 7486)
+ CHIP("C7", 9316)
+ CHIP("C8", 9316)
+ CHIP_555_Mono(C9, &c9_555_desc)
+
+ CHIP("D2", 7432)
+ CHIP("D3", 7474)
+ CHIP("D4", 9316)
+ CHIP("D5", 7474)
+ CHIP("D6", 7408)
+ CHIP("D7", 7411)
+ CHIP("D8", 7400)
+// CHIP("D9", 4016) //quad bilateral switch
+
+ CHIP("E1", 7404)
+ CHIP("E2", 7486)
+ CHIP("E3", 7402)
+ CHIP("E4", 7432)
+ CHIP("E5", 7408)
+ CHIP("E6", 7474)
+ CHIP("E7", 7402)
+ CHIP("E8", 7474)
+ CHIP("E9", 7404)
+
+ CHIP("F1", 9316)
+ CHIP("F2", 7411)
+ CHIP_9602_Mono(F3, &f3_desc)
+ CHIP("F4", 7474)
+ CHIP("F5", 7474)
+ CHIP("F6", 74193)
+ CHIP("F7", 74279)
+ CHIP("F8", 7474)
+ CHIP("F9", 7404)
+
+ CHIP("H1", 7437)
+ CHIP("H2", 7408)
+ CHIP("H3", 7427)
+ CHIP("H4", 7400)
+ CHIP("H5", 9312)
+ CHIP("H6", 9310)
+ CHIP("H7", 7408) //sometimes looks like N7 on schematic
+ CHIP("H8", 7474)
+ CHIP("H9", 7474)
+
+ CHIP("J1", 74175)
+ CHIP("J2", 7404)
+ CHIP("J3", 7402)
+ CHIP("J4", 9312)
+ CHIP("J5", 7448)
+ CHIP("J6", 9310)
+ CHIP("J7", 7420)
+ CHIP("J8", 74279)
+ CHIP("J9", 7410)
+
+ CHIP("K1", 9316)
+ CHIP("K2", 7486)
+ CHIP("K3", 7430)
+ CHIP("K4", 7408)
+ CHIP("K5", 9312)
+ CHIP("K6", 9310)
+ CHIP("K7", 7486)
+ CHIP("K8", 7474) //TODO: one more than bom?
+ CHIP("K9", 74107)
+
+ CHIP("L1", 9316)
+ CHIP("L2", 7486)
+ CHIP("L3", 82S16) //RAM
+ CHIP("L4", 7411)
+ CHIP("L5", 9312)
+ CHIP("L6", 9310)
+ CHIP("L7", 7486)
+ CHIP("L8", 74193)
+ CHIP("L9", 7400) //TODO: 1 more chip than on bom?
+
+ CHIP("M1", 9316)
+ CHIP("M2", 7483)
+ CHIP("M3", 7486)
+ CHIP("M4", 7410)
+ CHIP("M5", 9312)
+ CHIP("M6", 9310)
+ CHIP("M8", 7427)
+ CHIP("M9", 7404)
+
+ CHIP("N1", 9316)
+ CHIP("N2", 7483)
+ CHIP("N3", 7486)
+ CHIP("N4", 7411)
+ CHIP("N5", 9312)
+ CHIP("N6", 9310)
+ CHIP("N7", 7408) //sometimes looks like H7 on schematic
+ CHIP_9602_Mono(N8, &n8_desc)
+ CHIP("N9", 74192)
+
+ //LM380 //speaker amplifier
+ //LM323 //regulator
+
+// CHIP("CREDIT_LIGHT1", LAMP)
+// CHIP("CREDIT_LIGHT2", LAMP)
+// CHIP("SERVE_LIGHT", LAMP)
+
+ CHIP("PAD1", PADDLE1_HORIZONTAL_INPUT, &pad1_desc)
+ PADDLE_CONNECTION("PAD1", "C9")
+
+ CHIP_LATCH(LATCH)
+ CHIP("COIN1", COIN_INPUT)
+
+ //CHIP("COIN2", COIN_INPUT)
+
+ CHIP("START", START_INPUT)
+
+ CHIP("SERVE", BUTTONS1_INPUT)
+
+ //TODO: coin2 and start 2
+
+ VIDEO(breakout)
+ AUDIO(breakout)
+
+#ifdef DEBUG
+ CHIP("LOG1", VCD_LOG, &vcd_log_desc)
+#endif
+
+ //HSYNC and VSYNC
+ #define H1_d "L1", 14
+ #define H2_d "L1", 13
+ #define H4_d "L1", 12
+ #define H8_d "L1", 11
+ #define H8_n "J2", 2
+ #define H16_d "K1", 14
+ #define H16_n "J2", 6
+ #define H32_d "K1", 13
+ #define H32_n "J2", 4
+ #define H64_d "K1", 12
+ #define H128_d "K1", 11
+
+ #define V1_d "M1", 14
+ #define V2_d "M1", 13
+ #define V4_d "M1", 12
+ #define V8_d "M1", 11
+ #define V16_d "N1", 14
+ #define V16_n "J2", 10
+ #define V32_d "N1", 13
+ #define V64_d "N1", 12
+ #define V64I "H7", 11
+ #define V64_n "M9", 10
+ #define V128_d "N1", 11
+
+ #define H1 "L2", 8
+ #define H2 "L2", 11
+ #define H4 "L2", 3
+ #define H8 "L2", 6
+ #define H16 "K2", 8
+ #define H32 "K2", 11
+ #define H64 "K2", 3
+ #define H128 "K2", 6
+
+ //#define V1
+ #define V2 "M3", 3
+ #define V4 "M3", 6
+ #define V8 "M3", 11
+ #define V16 "N3", 8
+ #define V32 "N3", 3
+ #define V64 "N3", 6
+ #define V128 "N3", 11
+
+ #define HSYNC "J1", 2
+ #define HSYNC_n "J1", 3
+ #define VSYNC "J1", 7
+ #define VSYNC_n "J1", 6
+ #define PSYNC "J1", 11
+ #define PSYNC_n "J1", 10
+ #define BSYNC "J1", 15
+ #define BSYNC_n "J1", 14
+
+ #define BALL "D7", 6
+ #define BALL_DISPLAY "A4", 6
+ #define PLAYFIELD "H4", 3
+ #define SCORE "D3", 5
+ #define VERT_TRIG_n "H1", 8
+
+ #define CLOCK "H1", 11
+ #define SCLOCK "K1", 15
+ #define CKBH "F1", 13
+
+ #define PAD_n "K3", 8
+ #define PAD_EN_n "C2", 8
+
+ //#define P VCC
+ #define P "V5", Q
+
+ #define COIN "L9", 6
+ #define COIN1_n "F8", 5
+ #define COIN2_n "H9", 5
+ #define CREDIT_1_OR_2 "L9", 3
+ #define CREDIT_1_OR_2_n "F9", 8
+ #define CREDIT2 "F9", 6
+ #define CREDIT2_n "M8", 8
+ #define CR_START1 "E8", 5
+ #define CR_START1_n "E8", 6 //Schematic shows E8.6 as positive CR_START1, but this can't be right?
+ #define CR_START2 "E8", 9
+ #define CR_START2_n "E8", 8
+ #define CSW1 "F9", 12
+ #define CSW2 "F9", 2
+
+ #define P2_CONDITIONAL "H1", 3
+ #define P2_CONDITIONAL_dash "H7", 8
+ #define PLAYER_2 "B4", 14
+ #define PLAYER_2_n "M9", 8
+
+ #define START_GAME "D8", 6
+ #define START_GAME1_n "M9", 4
+ #define START_GAME_n "M9", 6
+
+ #define BG1_n "K8", 9
+ #define BG1 "K8", 8
+ #define BG2_n "K8", 5
+ #define BG2 "K8", 6
+
+ #define FREE_GAME_TONE "N7", 3
+ #define BONUS_COIN "L9", 11
+
+ //#define Q "E9", 6
+ #define LAT_Q "E9", 6
+ #define Q_n "LATCH", 3
+ #define SBD_n "D2", 11
+
+ #define PLAY_CP "D2", 8
+ #define PLGM2_n "F7", 7
+ #define VB_HIT_n "A5", 6
+
+ #define SERVE_n "SERVE", 1
+ #define SERVE_WAIT "A3", 9
+ #define SERVE_WAIT_n "A3", 8
+
+ #define BRICK_DISPLAY "E3", 1
+ #define BRICK_HIT "E6", 5
+ #define BRICK_HIT_n "E6", 6
+
+ //#define EGL "A4", 3
+ #define EGL "C37" , 2
+ #define EGL_n "C5", 2
+
+ #define RAM_PLAYER1 "E7", 4
+ #define A1 "H6", 14
+ #define B1 "H6", 13
+ #define C1 "H6", 12
+ #define D1 "H6", 11
+ #define E1 "J6", 14
+ #define F1 "J6", 13
+ #define G1 "J6", 12
+ #define H01 "J6", 11
+ #define I1 "K6", 14
+ #define J1 "K6", 13
+ #define K1 "K6", 12
+ #define L1 "K6", 11
+ #define A2 "N6", 14
+ #define B2 "N6", 13
+ #define C2 "N6", 12
+ #define D2 "N6", 11
+ #define E2 "M6", 14
+ #define F2 "M6", 13
+ #define G2 "M6", 12
+ #define H02 "M6", 11 //TODO: better name for these signals
+ #define I2 "L6", 14
+ #define J2 "L6", 13
+ #define K2 "L6", 12
+ #define L2 "L6", 11
+
+ #define CX0 "C6", 11
+ #define CX1 "C6", 6
+ #define X0 "C5", 10
+ #define X1 "B6", 3
+ #define X2 "C6", 3
+ #define Y0 "B6", 11
+ #define Y1 "B6", 6
+ #define Y2 "A6", 6
+ #define DN "C4", 3
+ #define PC "D4", 12
+ #define PD "D4", 11
+ #define SU_n "D5", 8
+ #define V_SLOW "C5", 8
+
+ #define PLNR "E3", 4
+ #define SCI_n "H4", 6
+ #define SFL_n "E9", 12 //score flash
+ #define TOP_n "E9", 2
+
+ #define BP_HIT_n "A5", 8
+ #define BTB_HIT_n "C3", 3
+
+ #define SET_BRICKS "D3", 9
+ #define SET_BRICKS_n "D3", 8
+
+ #define BALL_A "B4", 13
+ #define BALL_B "B4", 12
+ #define BALL_C "B4", 11
+
+ #define FPD1 "F3", 10
+ #define FPD1_n "F3", 9
+ #define FPD2 "F3", 6
+ #define FPD2_n "F3", 7
+
+ #define COUNT "N7", 11
+ #define COUNT_1 "N7", 8
+ #define COUNT_2 "N7", 6
+
+ #define ATTRACT "E6", 8
+ #define ATTRACT_n "E6", 9
+
+ #define BRICK_SOUND "B8", 14
+ #define P_HIT_SOUND "B7", 12
+ #define VB_HIT_SOUND "B7", 11
+
+ #define LH_SIDE "J3", 13
+ #define RH_SIDE "H2", 3
+ #define TOP_BOUND "K4", 6
+
+// CONNECTION(CREDIT_1_OR_2, "CREDIT_LIGHT1", 1)
+// CONNECTION(CREDIT2, "CREDIT_LIGHT2", 1)
+// CONNECTION(SERVE_WAIT_n, "SERVE_LIGHT", 1)
+
+ //Audio
+ CONNECTION("M9", 2, "F6", 5)
+ CONNECTION("M9", 2, "F7", 15)
+ CONNECTION("F6", 13, "F7", 14)
+ CONNECTION(START_GAME_n, "F6", 11)
+ CONNECTION(P, "F6", 15)
+ CONNECTION(P, "F6", 1)
+ CONNECTION(P, "F6", 10)
+ CONNECTION(P, "F6", 9)
+ CONNECTION(GND, "F6", 14)
+ CONNECTION("F7", 13, "J9", 2)
+ CONNECTION(VSYNC, "J9", 1)
+ CONNECTION("A7", 9, "J9", 13)
+ CONNECTION("J9", 12, "F6", 4)
+ CONNECTION("J9", 12, "A7", 11)
+ CONNECTION(GND, "A7", 12)
+ CONNECTION(ATTRACT_n, "A7", 13)
+ CONNECTION("J9", 12, "A8", 11)
+ CONNECTION(GND, "A8", 12)
+ CONNECTION(ATTRACT_n, "A8", 13)
+ CONNECTION(VB_HIT_n, "A7", 5)
+ CONNECTION(GND, "A7", 4)
+ CONNECTION(ATTRACT_n, "A7", 3)
+ CONNECTION(BP_HIT_n, "A8", 5)
+ CONNECTION(GND, "A8", 4)
+ CONNECTION(ATTRACT_n, "A8", 3)
+ CONNECTION("A8", 6, "B9", 13)
+ CONNECTION(P_HIT_SOUND, "B9", 12)
+ CONNECTION("A8", 10, "B9", 10)
+ CONNECTION(BRICK_SOUND, "B9", 9)
+ CONNECTION("A7", 6, "B9", 4)
+ CONNECTION(VB_HIT_SOUND, "B9", 5)
+
+ CONNECTION(GND, "S1", 1)
+ CONNECTION(P, "S1", 2)
+ CONNECTION(GND, "S1", 4)
+ CONNECTION(P, "S1", 3)
+ CONNECTION(GND, "S1", 12)
+ CONNECTION(P, "S1", 11)
+ CONNECTION(GND, "S1", 9)
+ CONNECTION(P, "S1", 10)
+
+ //Free Game Selector
+ CONNECTION(I1, "K7", 2)
+ CONNECTION("S1", 15, "K7", 1)
+ CONNECTION(J1, "K7", 12)
+ CONNECTION("S1", 14, "K7", 13)
+ CONNECTION(K1, "K7", 5)
+ CONNECTION("S1", 6, "K7", 4)
+ CONNECTION(L1, "K7", 9)
+ CONNECTION("S1", 7, "K7", 10)
+
+ CONNECTION(I2, "L7", 2)
+ CONNECTION("S1", 15, "L7", 1)
+ CONNECTION(J2, "L7", 12)
+ CONNECTION("S1", 14, "L7", 13)
+ CONNECTION(K2, "L7", 5)
+ CONNECTION("S1", 6, "L7", 4)
+ CONNECTION(L2, "L7", 9)
+ CONNECTION("S1", 7, "L7", 10)
+
+
+ CONNECTION("K7", 3, "J7", 13)
+ CONNECTION("K7", 11, "J7", 12)
+ CONNECTION("K7", 6, "J7", 10)
+ CONNECTION("K7", 8, "J7", 9)
+
+ CONNECTION("L7", 3, "J7", 1)
+ CONNECTION("L7", 11, "J7", 2)
+ CONNECTION("L7", 6, "J7", 4)
+ CONNECTION("L7", 8, "J7", 5)
+
+ CONNECTION(START_GAME1_n, "J8", 12)
+ CONNECTION(BG1_n, "J8", 11)
+ CONNECTION("J7", 8, "J8", 10)
+
+ CONNECTION(START_GAME1_n, "J8", 2)
+ CONNECTION(BG2_n, "J8", 3)
+ CONNECTION("J7", 6, "J8", 1)
+
+ CONNECTION("J8", 9, "K8", 12)
+ CONNECTION(EGL, "K8", 11)
+ CONNECTION(P, "K8", 13)
+ CONNECTION(LAT_Q, "K8", 10)
+
+ CONNECTION("J8", 4, "K8", 2)
+ CONNECTION(EGL, "K8", 3)
+ CONNECTION(P, "K8", 1)
+ CONNECTION(LAT_Q, "K8", 4)
+
+ CONNECTION(P, "K9", 8)
+ CONNECTION("J8", 9, "K9", 9)
+ CONNECTION(GND, "K9", 11)
+ CONNECTION(HSYNC_n, "K9", 10)
+
+ CONNECTION(P, "K9", 1)
+ CONNECTION("J8", 4, "K9", 12)
+ CONNECTION(GND, "K9", 4)
+ CONNECTION(HSYNC_n, "K9", 13)
+
+ CONNECTION("K9", 6, "L9", 12)
+ CONNECTION("K9", 2, "L9", 13)
+
+ CONNECTION(P, "N8", 5)
+ CONNECTION(BONUS_COIN, "N8", 4)
+ CONNECTION(ATTRACT_n, "N8", 3)
+
+ CONNECTION(V4_d, "N7", 2)
+ CONNECTION("N8", 6, "N7", 1)
+ //
+ CONNECTION(GND, "M2", 13)
+ CONNECTION(V1_d, "M2", 10)
+ CONNECTION(V2_d, "M2", 8)
+ CONNECTION(V4_d, "M2", 3)
+ CONNECTION(V8_d, "M2", 1)
+ CONNECTION(GND, "M2", 11)
+ CONNECTION(P2_CONDITIONAL, "M2", 7)
+ CONNECTION(GND, "M2", 4)
+ CONNECTION(GND, "M2", 16)
+
+ CONNECTION("M2", 14, "N2", 13)
+ CONNECTION(V16_d, "N2", 10)
+ CONNECTION(V32_d, "N2", 8)
+ CONNECTION(V64_d, "N2", 3)
+ CONNECTION(V128_d, "N2", 1)
+ CONNECTION(GND, "N2", 11)
+ CONNECTION(P2_CONDITIONAL, "N2", 7)
+ CONNECTION(GND, "N2", 4)
+ CONNECTION(GND, "N2", 16)
+
+ CONNECTION("M2", 6, "M3", 2)
+ CONNECTION(P2_CONDITIONAL, "M3", 1)
+ CONNECTION("M2", 2, "M3", 5)
+ CONNECTION(P2_CONDITIONAL, "M3", 4)
+ CONNECTION("M2", 15, "M3", 12)
+ CONNECTION(P2_CONDITIONAL, "M3", 13)
+
+ CONNECTION(P2_CONDITIONAL, "N3", 10)
+ CONNECTION("N2", 9, "N3", 9)
+ CONNECTION(P2_CONDITIONAL, "N3", 1)
+ CONNECTION("N2", 6, "N3", 2)
+ CONNECTION(P2_CONDITIONAL, "N3", 4)
+ CONNECTION("N2", 2, "N3", 5)
+ CONNECTION(P2_CONDITIONAL, "N3", 13)
+ CONNECTION("N2", 15, "N3", 12)
+
+ CONNECTION(H1_d, "L2", 9)
+ CONNECTION(P2_CONDITIONAL, "L2", 10)
+ CONNECTION(H2_d, "L2", 12)
+ CONNECTION(P2_CONDITIONAL, "L2", 13)
+ CONNECTION(H4_d, "L2", 2)
+ CONNECTION(P2_CONDITIONAL, "L2", 1)
+ CONNECTION(H8_d, "L2", 5)
+ CONNECTION(P2_CONDITIONAL, "L2", 4)
+
+ CONNECTION(P2_CONDITIONAL, "K2", 10)
+ CONNECTION(H16_d, "K2", 9)
+ CONNECTION(P2_CONDITIONAL, "K2", 13)
+ CONNECTION(H32_d, "K2", 12)
+ CONNECTION(P2_CONDITIONAL, "K2", 1)
+ CONNECTION(H64_d, "K2", 2)
+ CONNECTION(P2_CONDITIONAL, "K2", 4)
+ CONNECTION(H128_d, "K2", 5)
+
+
+ CONNECTION(V64, "M9", 11)
+ CONNECTION(H16, "J2", 5)
+ CONNECTION(H32, "J2", 3)
+ CONNECTION(V16, "J2", 11)
+ CONNECTION(H8, "J2", 1)
+
+ CONNECTION(CLOCK, "J1", 9)
+ CONNECTION(SCLOCK, "J1", 4)
+ CONNECTION("N4", 6, "J1", 5)
+ CONNECTION(PAD_n, "J1", 12)
+ CONNECTION(BALL_DISPLAY, "J1", 13)
+ CONNECTION(P, "J1", 1)
+
+ CONNECTION(P, "K1", 1)
+ CONNECTION(P, "K1", 3)
+ CONNECTION(P, "K1", 4)
+ CONNECTION(P, "K1", 5)
+ CONNECTION(P, "K1", 6)
+ CONNECTION(P, "K1", 9)
+ CONNECTION(P, "K1", 10)
+ CONNECTION(CLOCK, "K1", 2)
+ CONNECTION("L1", 15, "K1", 7)
+
+ CONNECTION(P, "L1", 1)
+ CONNECTION(P, "L1", 3)
+ CONNECTION(GND, "L1", 4)
+ CONNECTION(P, "L1", 5)
+ CONNECTION(GND, "L1", 6)
+ CONNECTION(VERT_TRIG_n, "L1", 9)
+ CONNECTION(P, "L1", 10)
+ CONNECTION(CLOCK, "L1", 2)
+ CONNECTION(P, "L1", 7)
+
+ CONNECTION(P, "N1", 1)
+ CONNECTION(P, "N1", 10)
+ CONNECTION(P, "N1", 3)
+ CONNECTION(P, "N1", 4)
+ CONNECTION(P, "N1", 5)
+ CONNECTION(P, "N1", 6)
+ CONNECTION(P, "N1", 9)
+ CONNECTION(CLOCK, "N1", 2)
+ CONNECTION("H2", 6, "N1", 7)
+
+ CONNECTION("M1", 15, "H2", 5)
+ CONNECTION("L1", 15, "H2", 4)
+
+ CONNECTION(V128_d, "N4", 5)
+ CONNECTION(V64_d, "N4", 3)
+ CONNECTION(V32_d, "N4", 4)
+ CONNECTION("N4", 6, "H1", 10)
+ CONNECTION(VSYNC_n, "H1", 9)
+
+ CONNECTION(P, "M1", 1)
+ CONNECTION(GND, "M1", 3)
+ CONNECTION(GND, "M1", 4)
+ CONNECTION(P, "M1", 5)
+ CONNECTION(GND, "M1", 6)
+ CONNECTION(VERT_TRIG_n, "M1", 9)
+ CONNECTION(CLOCK, "M1", 2)
+ CONNECTION("L1", 15, "M1", 7)
+ CONNECTION("K1", 15, "M1", 10)
+
+
+ //9312 circuit
+ CONNECTION(PLAYER_2, "M9", 9)
+ CONNECTION(BALL_A, "C5", 5)
+ CONNECTION(BALL_A, "C4", 13)
+ CONNECTION(BALL_B, "C4", 12)
+ CONNECTION(BALL_A, "A4", 13)
+ CONNECTION(BALL_B, "A4", 12)
+ CONNECTION(BALL_C, "C4", 10)
+ CONNECTION("A4", 11, "C4", 9)
+
+ CONNECTION(A2, "N5", 1)
+ CONNECTION(E2, "N5", 2)
+ CONNECTION(I2, "N5", 3)
+ CONNECTION("C5", 6, "N5", 4)
+ CONNECTION(A1, "N5", 5)
+ CONNECTION(E1, "N5", 6)
+ CONNECTION(I1, "N5", 7)
+ CONNECTION(PLAYER_2_n, "N5", 9)
+ CONNECTION(H32_n, "N5", 10)
+ CONNECTION(V16, "N5", 11)
+ CONNECTION(V64, "N5", 12)
+ CONNECTION(V128, "N5", 13)
+
+ CONNECTION(B2, "M5", 1)
+ CONNECTION(F2, "M5", 2)
+ CONNECTION(J2, "M5", 3)
+ CONNECTION("C4", 11, "M5", 4)
+ CONNECTION(B1, "M5", 5)
+ CONNECTION(F1, "M5", 6)
+ CONNECTION(J1, "M5", 7)
+ CONNECTION(PLAYER_2, "M5", 9)
+ CONNECTION(H32_n, "M5", 10)
+ CONNECTION(V16, "M5", 11)
+ CONNECTION(V64, "M5", 12)
+ CONNECTION(V128, "M5", 13)
+
+ CONNECTION(C2, "L5", 1)
+ CONNECTION(G2, "L5", 2)
+ CONNECTION(K2, "L5", 3)
+ CONNECTION("C4", 8, "L5", 4)
+ CONNECTION(C1, "L5", 5)
+ CONNECTION(G1, "L5", 6)
+ CONNECTION(K1, "L5", 7)
+ CONNECTION(GND, "L5", 9)
+ CONNECTION(H32_n, "L5", 10)
+ CONNECTION(V16, "L5", 11)
+ CONNECTION(V64, "L5", 12)
+ CONNECTION(V128, "L5", 13)
+
+ CONNECTION(D2, "K5", 1)
+ CONNECTION(H02, "K5", 2)
+ CONNECTION(L2, "K5", 3)
+ CONNECTION(GND, "K5", 4)
+ CONNECTION(D1, "K5", 5)
+ CONNECTION(H01, "K5", 6)
+ CONNECTION(L1, "K5", 7)
+ CONNECTION(GND, "K5", 9)
+ CONNECTION(H32_n, "K5", 10)
+ CONNECTION(V16, "K5", 11)
+ CONNECTION(V64, "K5", 12)
+ CONNECTION(V128, "K5", 13)
+
+ CONNECTION(P, "J5", 4)
+ CONNECTION(P, "J5", 3)
+ CONNECTION("N5", 15, "J5", 7)
+ CONNECTION("M5", 15, "J5", 1)
+ CONNECTION("L5", 15, "J5", 2)
+ CONNECTION("K5", 15, "J5", 6)
+ CONNECTION(H32, "J5", 5)
+
+ CONNECTION("J5", 13, "H5", 1)
+ CONNECTION(GND, "H5", 2)
+ CONNECTION(GND, "H5", 3)
+ CONNECTION("J5", 14, "H5", 4)
+ CONNECTION(GND, "H5", 5)
+ CONNECTION(GND, "H5", 6)
+ CONNECTION("J5", 10, "H5", 7)
+ CONNECTION(GND, "H5", 9)
+
+ CONNECTION(V4, "K4", 12)
+ CONNECTION(V8, "K4", 13)
+
+ CONNECTION("K4", 11, "H5", 10)
+ CONNECTION(H2, "H5", 11)
+ CONNECTION(H4, "H5", 12)
+ CONNECTION(H8, "H5", 13)
+
+ CONNECTION(H2, "L4", 3)
+ CONNECTION(H4, "L4", 5)
+ CONNECTION(H8, "L4", 4)
+
+ CONNECTION("J5", 12 , "J4", 1)
+ CONNECTION("J5", 11, "J4", 2)
+ CONNECTION(GND, "J4", 3)
+ CONNECTION(GND, "J4", 4)
+ CONNECTION("J5", 15, "J4", 5)
+ CONNECTION("J5", 9, "J4", 6)
+ CONNECTION(GND, "J4", 7)
+ CONNECTION(GND, "J4", 9)
+ CONNECTION("L4", 6, "J4", 10)
+ CONNECTION(H8, "J4", 11)
+ CONNECTION(V4, "J4", 12)
+ CONNECTION(V8, "J4", 13)
+
+ CONNECTION("H5", 14, "H4", 13)
+ CONNECTION("J4", 14, "H4", 12)
+
+ //PADDLES
+ CONNECTION(ATTRACT_n, "B2", 4)
+
+ CONNECTION("B2", 3, "E9", 13)
+ CONNECTION(PLAYER_2_n, "M3", 9)
+ CONNECTION(V128, "M3", 10)
+ CONNECTION(H64, "J3", 8)
+ CONNECTION(H128, "J3", 9)
+ CONNECTION(V32, "E3", 5)
+ CONNECTION(V16_n, "E3", 6)
+
+ CONNECTION(SFL_n, "M8", 1)
+ CONNECTION("M3", 8, "M8", 2)
+ CONNECTION(PLNR, "M8", 13)
+ CONNECTION("J3", 10, "E9", 1)
+ CONNECTION(V64, "E2", 5)
+ CONNECTION(V32, "E2", 4)
+ CONNECTION(PLNR, "E2", 10)
+ CONNECTION(H16, "E2", 9)
+
+ CONNECTION("M8", 12, "M8", 3)
+ CONNECTION(TOP_n, "M8", 4)
+ CONNECTION(TOP_n, "M8", 5)
+ CONNECTION("H4", 11, "F2", 11)
+ CONNECTION("E2", 6, "F2", 10)
+ CONNECTION("E2", 8, "F2", 9)
+
+ CONNECTION("M8", 6, "H4", 5)
+ CONNECTION("F2", 8, "H4", 4)
+
+ CONNECTION(PAD_EN_n, "PAD_EN_BUF", 1)
+
+ CONNECTION("PAD_EN_BUF", 2, "C9", 4)
+ CONNECTION("PAD_EN_BUF", 2, "C9", 2)
+ CONNECTION(BTB_HIT_n, "C5", 3)
+ CONNECTION(P, "F5", 10)
+ CONNECTION(P, "F5", 12)
+ CONNECTION("C5", 4, "F5", 11)
+ CONNECTION(SERVE_WAIT_n, "F5", 13)
+ CONNECTION(H64, "E5", 13)
+ CONNECTION("F5", 9, "E5", 12)
+ CONNECTION(H128, "E5", 10)
+ CONNECTION("F5", 8, "E5", 9)
+ CONNECTION("E5", 11, "E4", 12)
+ CONNECTION("E5", 8, "E4", 13)
+ CONNECTION("E4", 11, "D4", 2)
+ CONNECTION(P, "D4", 3)
+ CONNECTION(P, "D4", 4)
+ CONNECTION(P, "D4", 5)
+ CONNECTION(P, "D4", 6)
+ CONNECTION(P, "D4", 9)
+ CONNECTION(P, "D4", 10)
+ CONNECTION("C3", 11, "D4", 7)
+ CONNECTION(VSYNC_n, "D4", 1)
+
+ CONNECTION("D4", 15, "E4", 10)
+ CONNECTION("H7", 6, "E4", 9)
+ CONNECTION("C9", 3, "H7", 5)
+ CONNECTION(PAD_EN_n, "H7", 4)
+ CONNECTION("E4", 8, "C3", 12)
+ CONNECTION(ATTRACT_n, "C3", 13)
+ CONNECTION(H8, "J3", 2)
+ CONNECTION(H32, "J3", 3)
+
+ CONNECTION("C3", 11, "K3", 12)
+ CONNECTION(H128, "K3", 5)
+ CONNECTION(H64, "K3", 6)
+ CONNECTION(H16, "K3", 11)
+ CONNECTION(H4, "K3", 4)
+ CONNECTION("J3", 1, "K3", 1)
+ CONNECTION(P, "K3", 3)
+ CONNECTION(P, "K3", 2)
+
+ CONNECTION(V16_d, "D7", 1)
+ CONNECTION(V64_d, "D7", 13)
+ CONNECTION(V128_d, "D7", 2)
+ CONNECTION("D7", 12, "H1", 4)
+ CONNECTION(V8_d, "H1", 5)
+ CONNECTION("H1", 6, "C2", 4)
+ CONNECTION("H1", 6, "C2", 5)
+ CONNECTION(V32_d, "J2", 9)
+ CONNECTION("J2", 8, "C2", 10)
+ CONNECTION("C2", 6, "C2", 9)
+
+
+ //SCORE
+ CONNECTION(SCI_n, "D3", 4)
+ CONNECTION(GND, "D3", 2)
+ CONNECTION(GND, "D3", 3)
+ CONNECTION(GND, "D3", 1)
+
+ //PLAYER2_CONDITIONAL
+ CONNECTION(PLAYER_2, "H7", 10)
+ CONNECTION(GND, "S2", 1)
+ CONNECTION(P, "S2", 2)
+ CONNECTION("S2", 3, "H7", 9)
+
+ //A-L 1 and 2
+ CONNECTION(SET_BRICKS_n, "B3", 2)
+ CONNECTION(H2, "B3", 3)
+ CONNECTION("B3", 1, "E7", 6)
+ CONNECTION(PLAYER_2, "E7", 5)
+ CONNECTION(P, "N6", 9)
+ CONNECTION(P, "M6", 9)
+ CONNECTION(P, "L6", 9)
+ CONNECTION(P, "H6", 9)
+ CONNECTION(P, "J6", 9)
+ CONNECTION(P, "K6", 9)
+
+ CONNECTION(P, "N6", 10)
+ CONNECTION(PLAYER_2, "N6", 7)
+ CONNECTION(COUNT_2, "N6", 2)
+ CONNECTION(START_GAME_n, "N6", 1)
+
+ CONNECTION("N6", 15, "M6", 10)
+ CONNECTION(PLAYER_2, "M6", 7)
+ CONNECTION(COUNT_2, "M6", 2)
+ CONNECTION(START_GAME_n, "M6", 1)
+
+ CONNECTION("M6", 15, "L6", 10)
+ CONNECTION(PLAYER_2, "L6", 7)
+ CONNECTION(COUNT_2, "L6", 2)
+ CONNECTION(START_GAME_n, "L6", 1)
+
+ CONNECTION(P, "H6", 10)
+ CONNECTION(RAM_PLAYER1, "H6", 7)
+ CONNECTION(COUNT_1, "H6", 2)
+ CONNECTION(START_GAME_n, "H6", 1)
+
+ CONNECTION("H6", 15, "J6", 10)
+ CONNECTION(RAM_PLAYER1, "J6", 7)
+ CONNECTION(COUNT_1, "J6", 2)
+ CONNECTION(START_GAME_n, "J6", 1)
+
+ CONNECTION("J6", 15, "K6", 10)
+ CONNECTION(RAM_PLAYER1, "K6", 7)
+ CONNECTION(COUNT_1, "K6", 2)
+ CONNECTION(START_GAME_n, "K6", 1)
+
+
+ //CX0 and CX1
+ CONNECTION(BRICK_HIT, "H2", 9)
+ CONNECTION(H16_n, "H2", 10)
+ CONNECTION(P, "D5", 10)
+ CONNECTION(P, "D5", 12)
+ CONNECTION("H2", 8, "D5", 11)
+ CONNECTION(SERVE_WAIT_n, "D5", 13)
+ CONNECTION(X0, "C6", 13)
+ CONNECTION("D5", 9, "C6", 12)
+ CONNECTION("D5", 9, "D6", 12)
+ CONNECTION(DN, "D6", 13)
+ CONNECTION("D6", 11, "C6", 4)
+ CONNECTION(X1, "C6", 5)
+
+ //COUNT1 and COUNT2
+ CONNECTION(P, "N8", 11)
+ CONNECTION(BRICK_HIT, "N8", 12)
+ CONNECTION(ATTRACT_n, "N8", 13)
+ CONNECTION("N8", 9, "N9", 11)
+ CONNECTION(P, "N9", 15)
+ CONNECTION(P, "N9", 5)
+
+ CONNECTION(COUNT, "N9", 4)
+ CONNECTION(START_GAME, "N9", 14)
+ CONNECTION(H8_n, "N9", 1)
+ CONNECTION(H16_n, "N9", 10)
+ CONNECTION(GND, "N9", 9)
+
+ CONNECTION("N9", 13, "N7", 13)
+ CONNECTION(SCLOCK, "N7", 12)
+
+ CONNECTION(PLAYER_2, "N7", 5)
+ CONNECTION(COUNT, "N7", 4)
+
+ CONNECTION(COUNT, "M9", 1)
+ CONNECTION(COUNT, "N7", 10)
+ CONNECTION(RAM_PLAYER1, "N7", 9)
+
+
+ //Ball Logic
+ CONNECTION(P, "C7", 1)
+ CONNECTION(P, "C7", 10)
+ CONNECTION(P, "C7", 7)
+ CONNECTION(CX0, "C7", 3)
+ CONNECTION(CX1, "C7", 4)
+ CONNECTION(X2, "C7", 5)
+ CONNECTION(GND, "C7", 6)
+ CONNECTION("D8", 8, "C7", 9)
+ CONNECTION("C7", 15, "C8", 7)
+ CONNECTION("C7", 11, "C8", 10)
+ CONNECTION("C7", 12, "D7", 10)
+ CONNECTION("C7", 13, "D7", 11)
+ CONNECTION(CLOCK, "C7", 2)
+
+ CONNECTION(P, "C8", 1)
+ CONNECTION(P, "C8", 3)
+ CONNECTION(P, "C8", 4)
+ CONNECTION(P, "C8", 5)
+ CONNECTION(P, "C8", 6)
+ CONNECTION(P, "C8", 9)
+ CONNECTION(CLOCK, "C8", 2)
+ CONNECTION("C8", 15, "B7", 7)
+ CONNECTION("C7", 15, "B7", 10)
+
+ CONNECTION(P, "B7", 1)
+ CONNECTION(Y0, "B7", 3)
+ CONNECTION(Y1, "B7", 4)
+ CONNECTION(Y2, "B7", 5)
+ CONNECTION(GND, "B7", 6)
+ CONNECTION("D8", 8, "B7", 9)
+ CONNECTION(CLOCK, "B7", 2)
+ CONNECTION("B7", 15, "B8", 7)
+
+ CONNECTION(VB_HIT_SOUND, "D7", 9)
+
+ CONNECTION(P, "B8", 1)
+ CONNECTION(P, "B8", 3)
+ CONNECTION(P, "B8", 4)
+ CONNECTION(P, "B8", 5)
+ CONNECTION(P, "B8", 6)
+ CONNECTION(P, "B8", 9)
+ CONNECTION("C8", 15, "B8", 10)
+ CONNECTION(CLOCK, "B8", 2)
+
+ CONNECTION("B8", 15, "D8", 10)
+ CONNECTION("B7", 15, "D8", 9)
+
+ CONNECTION("D7", 8, "D7", 5)
+ CONNECTION(P_HIT_SOUND, "D7", 4)
+ CONNECTION("B8", 15, "D7", 3)
+
+ //Clock Generator
+ CONNECTION(CKBH, "H1", 12)
+ CONNECTION("F1", 14, "H1", 13)
+ CONNECTION("F1", 15, "E1", 5)
+
+ CONNECTION(P, "F1", 1)
+ CONNECTION(P, "F1", 7)
+ CONNECTION(P, "F1", 10)
+ CONNECTION(GND, "F1", 3)
+ CONNECTION(P, "F1", 4)
+ CONNECTION(GND, "F1", 5)
+ CONNECTION(GND, "F1", 6)
+ CONNECTION("E1", 6, "F1", 9)
+ CONNECTION("Y1", 1, "F1", 2)
+
+ // RH and LH Sides
+ CONNECTION(V128, "N4", 1)
+ CONNECTION(V64, "N4", 2)
+ CONNECTION(V16, "N4", 13)
+ CONNECTION("N4", 12, "N4", 11)
+ CONNECTION(V8, "N4", 10)
+ CONNECTION(V4, "N4", 9)
+ CONNECTION("N4", 8, "H2", 2)
+ CONNECTION(V32, "H2", 1)
+ CONNECTION("N4", 8, "J2", 13)
+ CONNECTION("J2", 12, "J3", 11)
+ CONNECTION(V32, "J3", 12)
+
+ // Top Bound
+ CONNECTION(H128, "H3", 4)
+ CONNECTION(H64, "H3", 5)
+ CONNECTION(H32, "H3", 3)
+ CONNECTION("H3", 6, "L4", 9)
+ CONNECTION(H16, "L4", 10)
+ CONNECTION(H8, "L4", 11)
+ CONNECTION("L4", 8, "K4", 5)
+ CONNECTION(VSYNC_n, "K4", 4)
+
+ //Cabinet type
+
+ // Coin Circuit
+ CONNECTION("COIN1", 1, "F9", 13)
+
+ CONNECTION(CSW1, "F9", 11)
+ //CONNECTION("F9", 10, "F9", 13) //TODO: causes lots of bouncing, commented out since this trace is not implemented in gotcha
+
+ CONNECTION(V64, "H7", 12)
+ CONNECTION(V64, "H7", 13)
+
+ CONNECTION(CSW1, "F8", 10)
+ CONNECTION("F9", 10, "F8", 12)
+ CONNECTION(V64I, "F8", 11)
+ CONNECTION(P, "F8", 13)
+ CONNECTION(P, "F8", 1)
+ CONNECTION(V64I, "F8", 3)
+ CONNECTION("F8", 9, "F8", 2)
+ CONNECTION(CSW1, "F8", 4)
+
+ CONNECTION("F8", 6, "H8", 12)
+ CONNECTION(P, "H8", 10)
+ CONNECTION(V16_d, "H8", 11)
+ CONNECTION(P, "H8", 13)
+ CONNECTION("H8", 9, "J8", 15)
+ CONNECTION("H8", 9, "J9", 9)
+ CONNECTION(V16_d, "J8", 14)
+ CONNECTION("J8", 13, "J9", 10)
+ CONNECTION(P, "S3", 1)
+ CONNECTION(V4_d, "S3", 2)
+ CONNECTION("S3", 3, "J9", 11)
+
+ CONNECTION("J9", 8, "L9", 5)
+ CONNECTION("J9", 6, "L9", 4)
+
+ //COIN2 circuit
+ //CONNECTION("COIN2", 1, "F9", 1)
+ CONNECTION(GND, "F9", 1) //TODO: coin2 not implemented
+
+ CONNECTION(CSW2, "F9", 3)
+ CONNECTION(CSW2, "H9", 10)
+ CONNECTION("F9", 4, "H9", 12)
+ CONNECTION(V64_n, "H9", 11)
+ CONNECTION(V64_n, "H9", 3)
+ CONNECTION(P, "H9", 13)
+ CONNECTION("H9", 9, "H9", 2)
+ CONNECTION(CSW2, "H9", 4)
+ CONNECTION(P, "H9", 1)
+
+ CONNECTION(P, "H8", 4)
+ CONNECTION("H9", 6, "H8", 2)
+ CONNECTION(V16_d, "H8", 3)
+ CONNECTION(P, "H8", 1)
+ CONNECTION("H8", 5, "J8", 6)
+ CONNECTION(V16_d, "J8", 5)
+ CONNECTION(P, "J9", 3)
+ CONNECTION("H8", 5, "J9", 5)
+ CONNECTION("J8", 7, "J9", 4)
+
+ CONNECTION(P2_CONDITIONAL_dash, "E9", 9)
+ CONNECTION("E9", 8, "H1", 1)
+ CONNECTION("E9", 8, "H1", 2)
+
+ //Start2 Input
+ CONNECTION("START", 2, "E9", 11)
+ CONNECTION("E9", 10, "E8", 12)
+ CONNECTION(P, "E8", 10)
+ CONNECTION(V64I, "E8", 11)
+
+ CONNECTION(V128_d, "F7", 2)
+ CONNECTION(V128_d, "F7", 3)
+ CONNECTION(CREDIT2_n, "F7", 1)
+ CONNECTION(ATTRACT_n, "E7", 12)
+ CONNECTION("F7", 4, "E7", 11)
+ CONNECTION("E7", 13, "E8", 13)
+
+ //Start1 Input
+ CONNECTION("START", 1, "E9", 3)
+ CONNECTION("E9", 4, "E8", 2)
+ CONNECTION(P, "E8", 4)
+ CONNECTION(V64_d, "E8", 3)
+
+
+ CONNECTION(CREDIT_1_OR_2_n, "E7", 2)
+ CONNECTION(ATTRACT_n, "E7", 3)
+ CONNECTION("E7", 1, "E8", 1)
+
+ CONNECTION(CR_START1_n, "D8", 4) // Schematic shows CR_START1 ?
+ CONNECTION(CR_START2_n, "D8", 5)
+
+
+ CONNECTION(START_GAME, "M9", 3)
+ CONNECTION(START_GAME, "M9", 5)
+
+ CONNECTION(V32, "D6", 4)
+ CONNECTION(ATTRACT, "D6", 5)
+ CONNECTION(P, "E6", 10)
+ CONNECTION(START_GAME, "E6", 12)
+ CONNECTION("D6", 6, "E6", 11)
+ CONNECTION("D6", 3, "E6", 13)
+
+ //TODO: hows this whole latch stuff work? what about Q_n going to COIN1_n and COIN2_n
+ CONNECTION(CREDIT_1_OR_2_n, "D8", 13)
+ CONNECTION(EGL, "D8", 12)
+ CONNECTION("LATCH", 1, "D8", 11) //set
+ CONNECTION("LATCH", 2, COIN1_n) //reset
+ //CONNECTION("LATCH", 3, COIN2_n) //set //TODO: coin2 here
+ CONNECTION( "LATCH", 3, "E9", 5) //output
+
+
+ CONNECTION(LAT_Q, "D6", 1)
+ CONNECTION(EGL_n, "D6", 2)
+
+ //Serve
+ CONNECTION(H64, "J3", 6)
+ CONNECTION(H32, "J3", 5)
+ CONNECTION("J3", 4, "L4", 13)
+ CONNECTION(H128, "L4", 2)
+ CONNECTION(H16, "L4", 1)
+
+ CONNECTION(BALL_DISPLAY, "H2", 13)
+ CONNECTION(H128, "H2", 12)
+ CONNECTION("H2", 11, "C3", 9)
+ CONNECTION(HSYNC, "C3", 10)
+ CONNECTION("C3", 8, "B3", 5)
+ CONNECTION(H8_d, "B3", 6)
+ CONNECTION("B3", 4, "C3", 4)
+ CONNECTION(H4, "C3", 5)
+ CONNECTION("C3", 6, "A4", 9)
+ CONNECTION(START_GAME1_n, "A4", 10)
+
+ CONNECTION(SERVE_WAIT_n, "D2", 13)
+
+ CONNECTION(SERVE_n, "D2", 12)
+ CONNECTION(SERVE_n, "A3", 4)
+ CONNECTION(P, "A3", 2)
+ CONNECTION(ATTRACT, "A3", 3)
+ CONNECTION(SERVE_WAIT, "A3", 1)
+
+ CONNECTION(BALL, "E1", 13)
+ CONNECTION("E1", 12, "B3", 8)
+ CONNECTION("A3", 6, "B3", 9)
+ CONNECTION("B3", 10, "B3", 11)
+ CONNECTION(SERVE_WAIT_n, "B3", 12)
+ CONNECTION("B3", 13, "A3", 12)
+ CONNECTION("A4", 8, "A3", 10)
+ CONNECTION("L4", 12, "A3", 11)
+ CONNECTION(P, "A3", 13)
+
+ //Set Bricks
+ CONNECTION(P, "D3", 10)
+ CONNECTION(P, "D3", 12)
+ CONNECTION(START_GAME, "D3", 11)
+ CONNECTION(SERVE_n, "D3", 13)
+
+ //Playfield
+ CONNECTION(LH_SIDE, "H3", 1)
+ CONNECTION(TOP_BOUND, "H3", 13)
+ CONNECTION(RH_SIDE, "H3", 2)
+ CONNECTION("H3", 12, "H4", 2)
+ CONNECTION("E1", 2, "C36", 1)
+ CONNECTION("C36", 2, "H4", 1)
+
+ CONNECTION(BALL_DISPLAY, "A5", 10)
+ CONNECTION(PSYNC, "A5", 9)
+ CONNECTION(BSYNC, "C3", 2)
+ CONNECTION(TOP_BOUND, "C3", 1)
+
+ CONNECTION(PC, "C4", 4)
+ CONNECTION(PD, "C4", 5)
+ CONNECTION(BP_HIT_n, "C5", 13)
+ CONNECTION(PD, "A5", 1)
+ CONNECTION("C5", 12, "A5", 2)
+ CONNECTION(BSYNC, "A5", 5)
+ CONNECTION(VSYNC, "A5", 4)
+
+ CONNECTION("C5", 12, "A5", 13)
+ CONNECTION("A5", 3, "A5", 12)
+
+ CONNECTION(BRICK_HIT, "D5", 3)
+ CONNECTION("E5", 3, "D5", 1)
+ CONNECTION("D5", 6, "D5", 2)
+ CONNECTION(BP_HIT_n, "D5", 4)
+
+ CONNECTION(P, "A6", 10)
+ CONNECTION("C4", 6, "A6", 12)
+ CONNECTION(BP_HIT_n, "A6", 11)
+ CONNECTION(P, "A6", 13)
+
+ CONNECTION("A5", 3, "A6", 4)
+ CONNECTION(V16_d, "A6", 2)
+ CONNECTION(VB_HIT_n, "A6", 3)
+ CONNECTION("A5", 11, "A6", 1)
+
+ CONNECTION(P2_CONDITIONAL, "C6", 1)
+ CONNECTION("D5", 5, "C6", 2)
+ CONNECTION("D5", 6, "C4", 2)
+ CONNECTION(P2_CONDITIONAL, "C4", 1)
+
+ CONNECTION(V_SLOW, "B6", 12)
+ CONNECTION("A6", 8, "B6", 13)
+ CONNECTION(V_SLOW, "C6", 10)
+ CONNECTION("A6", 5, "C6", 9)
+
+ CONNECTION(Y0, "B6", 4)
+ CONNECTION("C6", 8, "B6", 5)
+
+ CONNECTION(X2, "D6", 10)
+ CONNECTION("B6", 8, "D6", 9)
+ CONNECTION("B5", 7, "B6", 9)
+ CONNECTION("B5", 6, "B6", 10)
+ CONNECTION(X0, "B6", 1)
+ CONNECTION(X2, "B6", 2)
+
+ CONNECTION("B5", 6, "C5", 11)
+ CONNECTION("B5", 7, "C5", 9)
+
+ CONNECTION(SU_n, "B5", 11)
+ CONNECTION(P, "B5", 15)
+ CONNECTION(P, "B5", 1)
+ CONNECTION(P, "B5", 10)
+ CONNECTION(P, "B5", 9)
+ CONNECTION(P, "B5", 4)
+ CONNECTION("D6", 8, "B5", 5)
+ CONNECTION(SERVE_WAIT, "B5", 14)
+
+ CONNECTION(BTB_HIT_n, "E5", 1)
+ CONNECTION(SBD_n, "E5", 2)
+
+ CONNECTION(BP_HIT_n, "E5", 4)
+ CONNECTION(BTB_HIT_n, "E5", 5)
+ CONNECTION("E5", 6, "F7", 11)
+ CONNECTION("E5", 6, "F7", 12)
+ CONNECTION(BRICK_HIT_n, "F7", 10)
+ CONNECTION("F7", 9, "C2", 2)
+ CONNECTION(BALL_DISPLAY, "C2", 1)
+ CONNECTION("L3", 6, "E3", 11)
+ CONNECTION("C2", 3, "E3", 12)
+
+ CONNECTION(SET_BRICKS_n, "E6", 4)
+ CONNECTION("E3", 13, "E6", 2)
+ CONNECTION(CKBH, "E6", 3)
+ CONNECTION("E3", 13, "D2", 2)
+ CONNECTION(SET_BRICKS, "D2", 1)
+ CONNECTION("D2", 3, "E6", 1)
+
+ CONNECTION(BRICK_DISPLAY, "E1", 1)
+ CONNECTION(H1, "K4", 9)
+ CONNECTION(H2, "K4", 10)
+ CONNECTION("K4", 8, "E3", 2)
+ CONNECTION("L3", 6, "E3", 3)
+
+ CONNECTION(ATTRACT_n, "C2", 13)
+ CONNECTION(SET_BRICKS_n, "C2", 12)
+ CONNECTION("C2", 11, "H3", 10)
+ CONNECTION(FPD1, "H3", 9)
+ CONNECTION(FPD2, "H3", 11)
+ CONNECTION("H3", 8, "E1", 3)
+ CONNECTION("E1", 4, "C32", 1)
+ CONNECTION("C32", 2, "L3", 13)
+ CONNECTION(H4, "L3", 2)
+ CONNECTION(H8, "L3", 1)
+ CONNECTION(H16, "L3", 15)
+ CONNECTION(V32, "L3", 14)
+ CONNECTION(V64, "L3", 7)
+ CONNECTION(V128, "L3", 9)
+ CONNECTION(V16, "L3", 10)
+ CONNECTION(RAM_PLAYER1, "L3", 11)
+ CONNECTION(H32, "L3", 3)
+ CONNECTION(H128, "L3", 4)
+ CONNECTION("H4", 8, "L3", 5)
+
+ CONNECTION(V2, "M4", 5)
+ CONNECTION(V4, "M4", 4)
+ CONNECTION(V8, "M4", 3)
+ CONNECTION("M4", 6, "H4", 9)
+ CONNECTION(VSYNC_n, "K4", 2)
+ CONNECTION(H64, "K4", 1)
+ CONNECTION("K4", 3, "H4", 10)
+ CONNECTION(FPD1_n, "F2", 13)
+ CONNECTION(BRICK_HIT_n, "F2", 2)
+ CONNECTION(FPD2_n, "F2", 1)
+
+ CONNECTION("F2", 12, "L3", 12)
+
+ //FPD circuits
+ CONNECTION(K2, "M4", 2)
+ CONNECTION(G2, "M4", 13)
+ CONNECTION(D2, "M4", 1)
+ CONNECTION(K1, "M4", 9)
+ CONNECTION(G1, "M4", 10)
+ CONNECTION(D1, "M4", 11)
+ CONNECTION(BP_HIT_n, "E4", 2)
+ CONNECTION("M4", 12, "E4", 1)
+ CONNECTION(BP_HIT_n, "E4", 4)
+ CONNECTION("M4", 8, "E4", 5)
+
+ CONNECTION(P, "F4", 4)
+ CONNECTION(P, "F4", 2)
+ CONNECTION("E4", 3, "F4", 3)
+ CONNECTION(START_GAME1_n, "F4", 1)
+
+ CONNECTION(P, "F4", 10)
+ CONNECTION(P, "F4", 12)
+ CONNECTION("E4", 6, "F4", 11)
+ CONNECTION(START_GAME1_n, "F4", 13)
+
+ CONNECTION("F4", 6, "F3", 5)
+ CONNECTION(GND, "F3", 4)
+ CONNECTION("F4", 8, "F3", 11)
+ CONNECTION(GND, "F3", 12)
+
+ CONNECTION(P, "F3", 3)
+ CONNECTION(P, "F3", 13)
+
+
+ //CREDIT_COUNTER
+ CONNECTION(BONUS_COIN, "E7", 8)
+ CONNECTION(COIN, "E7", 9)
+ CONNECTION(CR_START1_n, "H7", 2)
+ CONNECTION(V8, "D8", 1)
+ CONNECTION(CR_START2, "D8", 2)
+ CONNECTION("D8", 3, "H7", 1)
+
+ CONNECTION("L8", 12, "L8", 11) // not on schematic, on rollover load 16, keeps you from losing all credits
+ CONNECTION(P, "L8", 15)
+ CONNECTION(P, "L8", 1)
+ CONNECTION(P, "L8", 10)
+ CONNECTION(P, "L8", 9)
+ CONNECTION("E7", 10, "L8", 5)
+ CONNECTION("H7", 3, "L8", 4)
+
+ CONNECTION(LAT_Q, "L9", 10)
+ CONNECTION("L8", 13, "L9", 9)
+ CONNECTION("L9", 8, "L8", 14)
+ CONNECTION("L8", 7, "M8", 9)
+ CONNECTION("L8", 6, "M8", 10)
+ CONNECTION("L8", 2, "M8", 11)
+ CONNECTION("L8", 3, "M9", 13)
+
+ CONNECTION(CREDIT2_n, "F9", 5)
+ CONNECTION(CREDIT2_n, "L9", 2)
+ CONNECTION("M9", 12, "L9", 1)
+ CONNECTION(CREDIT_1_OR_2, "F9", 9)
+
+ //PLGM2_n
+ CONNECTION(CR_START1_n, "F7", 6)
+ CONNECTION(CR_START2_n, "F7", 5)
+
+ //PLAY_CP
+ CONNECTION(PLGM2_n, "F2", 5)
+ CONNECTION(PLAYER_2, "F2", 4)
+ CONNECTION(H1, "F2", 3)
+
+ CONNECTION(P, "F5", 4)
+ CONNECTION(P, "F5", 2)
+ CONNECTION(SERVE_WAIT, "F5", 3)
+ CONNECTION(H128, "F5", 1)
+ CONNECTION("F2", 6, "D2", 9)
+ CONNECTION("F5", 5, "D2", 10)
+
+ //EGL
+ CONNECTION(P, "B4", 10)
+ CONNECTION(P, "B4", 7)
+ CONNECTION(P, "B4", 9)
+ CONNECTION(PLAY_CP, "B4", 2)
+
+ CONNECTION(EGL, "C5", 1)
+
+
+
+ CONNECTION(START_GAME1_n, "B4", 1)
+ CONNECTION(BALL_A, "A4", 2)
+ CONNECTION(BALL_B, "S4", 1)
+ CONNECTION(BALL_C, "S4", 2)
+ CONNECTION("S4", 3, "A4", 1)
+ CONNECTION("A4", 3, "C37", 1)
+
+ CONNECTION(SERVE_WAIT_n, "A4", 5)
+ CONNECTION(BALL, "A4", 4)
+
+ // Ball Circuit
+
+
+ // Video Summing
+ CONNECTION(V16_d, "D2", 4)
+ CONNECTION(V8_d, "D2", 5)
+ CONNECTION("D2", 6, "E3", 8)
+ CONNECTION(VSYNC_n, "E3", 9)
+ CONNECTION(HSYNC_n, "E2", 12)
+ CONNECTION("E3", 10, "E2", 13)
+ CONNECTION(PSYNC, "B9", 1)
+ CONNECTION(VSYNC_n, "B9", 2)
+
+ //CONNECTION("VIDEO", 1, "E2", 11)
+ CONNECTION("VIDEO", 2, PLAYFIELD)
+ CONNECTION("VIDEO", 3, BSYNC)
+ CONNECTION("VIDEO", 4, SCORE)
+ CONNECTION("VIDEO", 5, "B9", 3)
+ //CONNECTION("VIDEO", 6, P)
+
+ CONNECTION("VIDEO", Video::HBLANK_PIN, HSYNC)
+ CONNECTION("VIDEO", Video::VBLANK_PIN, "E3", 10)
+
+
+ // Audio Summing
+ CONNECTION("AUDIO", 1, "B9", 11)
+ CONNECTION("AUDIO", 2, "B9", 8)
+ CONNECTION("AUDIO", 3, FREE_GAME_TONE)
+ CONNECTION("AUDIO", 4, "B9", 6)
+
+
+#ifdef DEBUG
+ // RAM access
+ /*CONNECTION("LOG1", 3, H4) //A
+ CONNECTION("LOG1", 4, H8) //B
+ CONNECTION("LOG1", 5, H16) //C
+ CONNECTION("LOG1", 6, V32) //D
+ CONNECTION("LOG1", 7, V64) //E
+ CONNECTION("LOG1", 8, V128) //F
+ CONNECTION("LOG1", 9, V16) //G
+ CONNECTION("LOG1", 10, RAM_PLAYER1) //H
+ CONNECTION("LOG1", 11, H32) //I
+ CONNECTION("LOG1", 12, H128) //J
+ CONNECTION("LOG1", 13, "H4", 8) //K
+ CONNECTION("LOG1", 14, "E1", 4) //L
+ CONNECTION("LOG1", 15, "F2", 12) //M
+ CONNECTION("LOG1", 16, "L3", 6)*/ //N
+#endif
+
+CIRCUIT_LAYOUT_END
+
diff --git a/src/lib/netlist/examples/cccs.c b/src/lib/netlist/examples/cccs.c
new file mode 100644
index 00000000000..a1244677d20
--- /dev/null
+++ b/src/lib/netlist/examples/cccs.c
@@ -0,0 +1,39 @@
+// license:GPL-2.0+
+// copyright-holders:Couriersud
+/*
+ * cccs.c
+ *
+ */
+
+
+#include "netlist/devices/net_lib.h"
+
+NETLIST_START(cccs)
+
+ CLOCK(clk, 1000) // 1000 Hz
+ SOLVER(Solver, 48000)
+ PARAM(Solver.ACCURACY, 1e-12)
+ PARAM(Solver.METHOD, "MAT_CR")
+
+ CCCS(VV)
+ PARAM(VV.G, 1)
+ PARAM(VV.RI, 1e-3)
+
+ RES(R2, 1000)
+ RES(R1, 1000)
+ NET_C(clk, VV.IP)
+ NET_C(VV.IN, R1.1)
+ NET_C(R1.2, GND)
+
+ NET_C(R2.1, VV.OP)
+ NET_C(R2.2, GND)
+ NET_C(VV.ON, GND)
+
+ /* Simple current source */
+
+ CS(CS1, 1)
+ RES(R3, 1)
+ NET_C(R3.1, CS1.P)
+ NET_C(GND, CS1.N, R3.2)
+
+NETLIST_END()
diff --git a/src/lib/netlist/examples/cd4066.c b/src/lib/netlist/examples/cd4066.c
new file mode 100644
index 00000000000..c77e6438c0f
--- /dev/null
+++ b/src/lib/netlist/examples/cd4066.c
@@ -0,0 +1,46 @@
+// license:GPL-2.0+
+// copyright-holders:Couriersud
+/*
+ * bjt.c
+ *
+ */
+
+
+#include "netlist/devices/net_lib.h"
+
+NETLIST_START(cd4066)
+ /* Standard stuff */
+
+ CLOCK(clk, 1000) // 1000 Hz
+ SOLVER(Solver, 48000)
+
+ ANALOG_INPUT(V5, 5)
+
+ CD_4066_DIP(SW)
+ RES(R1, 1000)
+
+ NET_C(SW.7, GND)
+ NET_C(SW.14, V5)
+
+ NET_C(SW.13, clk)
+ NET_C(SW.1, V5)
+
+ NET_C(SW.2, R1.1)
+ NET_C(R1.2, GND)
+
+ // ground anything else
+
+ NET_C(SW.3, GND)
+ NET_C(SW.4, GND)
+ NET_C(SW.5, GND)
+ NET_C(SW.6, GND)
+ NET_C(SW.8, GND)
+ NET_C(SW.9, GND)
+ NET_C(SW.10, GND)
+ NET_C(SW.11, GND)
+ NET_C(SW.12, GND)
+
+ LOG(logB, clk)
+ LOG(logC, R1.1)
+
+NETLIST_END()
diff --git a/src/lib/netlist/examples/cdelay.c b/src/lib/netlist/examples/cdelay.c
new file mode 100644
index 00000000000..5f4f8d04440
--- /dev/null
+++ b/src/lib/netlist/examples/cdelay.c
@@ -0,0 +1,53 @@
+// license:GPL-2.0+
+// copyright-holders:Couriersud
+/*
+ * cdelay.c
+ *
+ */
+
+#include "netlist/devices/net_lib.h"
+
+NETLIST_START(perf)
+
+ SOLVER(Solver, 48000)
+ PARAM(Solver.ACCURACY, 1e-20)
+ MAINCLOCK(clk, 50000000)
+
+ TTL_7400_NAND(n1,clk,clk)
+
+NETLIST_END()
+
+#ifndef P_FREQ
+#define P_FREQ 4800
+#endif
+
+#ifndef P_DTS
+#define P_DTS 1
+#endif
+
+NETLIST_START(cap_delay)
+
+ /*
+ * delay circuit
+ *
+ */
+
+ /* Standard stuff */
+
+ SOLVER(Solver, P_FREQ)
+ PARAM(Solver.ACCURACY, 1e-20)
+ PARAM(Solver.DYNAMIC_TS, P_DTS)
+ PARAM(Solver.DYNAMIC_MIN_TIMESTEP, 1e-6)
+ CLOCK(clk, 5000)
+
+ TTL_7400_NAND(n1,clk,clk)
+ CAP(C, 1e-6)
+ NET_C(n1.Q, C.2)
+ NET_C(GND, C.1)
+ TTL_7400_NAND(n2,n1.Q, n1.Q)
+
+ LOG(logclk, clk)
+ LOG(logn1Q, C.2)
+ LOG(logn2Q, n1.Q)
+
+NETLIST_END()
diff --git a/src/lib/netlist/examples/cmos_inverter.cpp b/src/lib/netlist/examples/cmos_inverter.cpp
new file mode 100644
index 00000000000..e0936bfd3bc
--- /dev/null
+++ b/src/lib/netlist/examples/cmos_inverter.cpp
@@ -0,0 +1,42 @@
+// license:GPL-2.0+
+// copyright-holders:Couriersud
+/*
+ * bjt.c
+ *
+ */
+
+
+#include "netlist/devices/net_lib.h"
+#include "netlist/analog/nld_twoterm.h"
+
+NETLIST_START(cmos_inverter)
+ /* Standard stuff */
+
+ SOLVER(Solver, 48000)
+ PARAM(Solver.ACCURACY, 1e-7)
+ PARAM(Solver.NR_LOOPS, 5000)
+ PARAM(Solver.METHOD, "MAT_CR")
+ ANALOG_INPUT(V5, 5)
+
+ VS(IN, 5)
+ PARAM(IN.FUNC, "T 5 *")
+
+ MOSFET(P, "PMOS(VTO=-1.0 KP=2e-3 LAMBDA=2E-2)")
+ MOSFET(M, "NMOS(VTO=1.0 KP=2e-3 LAMBDA=2E-2)")
+
+ NET_C(P.S, V5)
+ NET_C(P.D, M.D)
+ NET_C(GND, M.S, IN.N)
+
+ NET_C(IN.P, M.G, P.G)
+
+ // capacitance over D - S
+#if 0
+ CAP(C, CAP_N(1))
+ NET_C(M.D, C.1)
+ NET_C(M.S, C.2)
+#endif
+ LOG(log_G, M.G)
+ LOG(log_D, M.D)
+
+NETLIST_END()
diff --git a/src/lib/netlist/examples/cmos_inverter_clk.cpp b/src/lib/netlist/examples/cmos_inverter_clk.cpp
new file mode 100644
index 00000000000..8b70c46e715
--- /dev/null
+++ b/src/lib/netlist/examples/cmos_inverter_clk.cpp
@@ -0,0 +1,64 @@
+// license:GPL-2.0+
+// copyright-holders:Couriersud
+/*
+ * cmos_inverter_clk
+ *
+ */
+
+
+#include "netlist/devices/net_lib.h"
+#include "netlist/analog/nld_twoterm.h"
+
+#define USE_CLOCK (1)
+
+NETLIST_START(cmos_inverter_clk)
+ /* Standard stuff */
+
+ //SOLVER(Solver, 480000)
+ SOLVER(Solver, 1e5)
+ //SOLVER(Solver, 100000000000)
+ PARAM(Solver.ACCURACY, 1e-6 )
+ PARAM(Solver.NR_LOOPS, 500000)
+ PARAM(Solver.DYNAMIC_TS, 1)
+ PARAM(Solver.DYNAMIC_LTE, 1e-5)
+ PARAM(Solver.DYNAMIC_MIN_TIMESTEP, 2e-9)
+ ANALOG_INPUT(V5, 5)
+
+// CLOCK(clk, 0.5e6)
+
+#if (USE_CLOCK)
+ CLOCK(V, 5000)
+ PARAM(NETLIST.DEFAULT_MOS_CAPMODEL, 2) // Disable capacitance modeling
+ //CLOCK(V, 500000)
+#else
+ VS(V, 5)
+ PARAM(V.FUNC, "T * 5e6")
+#endif
+
+ MOSFET(P, "PMOS(VTO=-0.5 GAMMA=0.5 TOX=20n)")
+ MOSFET(M, "NMOS(VTO=0.5 GAMMA=0.5 TOX=20n)")
+ RES(RG, 1)
+
+ NET_C(P.S, V5)
+ NET_C(P.D, M.D)
+#if (USE_CLOCK)
+ NET_C(GND, M.S)
+ NET_C(V.Q, RG.1)
+#else
+ NET_C(GND, M.S, V.N)
+ NET_C(V.P, RG.1)
+#endif
+ NET_C(RG.2, M.G, P.G)
+
+ // capacitance over D - S
+#if 0
+ CAP(C, CAP_N(1))
+ NET_C(M.D, C.1)
+ NET_C(M.S, C.2)
+#endif
+#if 1
+ LOG(log_G, M.G)
+ LOG(log_D, M.D)
+ LOGD(log_X, RG.1, RG.2)
+#endif
+NETLIST_END()
diff --git a/src/lib/netlist/examples/congo_bongo.c b/src/lib/netlist/examples/congo_bongo.c
new file mode 100644
index 00000000000..3ad52e7dced
--- /dev/null
+++ b/src/lib/netlist/examples/congo_bongo.c
@@ -0,0 +1,419 @@
+// license:GPL-2.0+
+// copyright-holders:Couriersud
+/* € */ // ABC
+
+#include "netlist/devices/net_lib.h"
+
+/* ----------------------------------------------------------------------------
+ * Define
+ * ---------------------------------------------------------------------------*/
+
+/* set to 1 to use optimizations increasing performance significantly */
+
+#define USE_OPTMIZATIONS 1
+#define USE_FRONTIERS 1
+
+/* ----------------------------------------------------------------------------
+ * Library section header START
+ * ---------------------------------------------------------------------------*/
+
+#ifndef __PLIB_PREPROCESSOR__
+
+#define LM358_DIP(_name) \
+ NET_REGISTER_DEV_X(LM358_DIP, _name)
+
+#define G501534_DIP(_name) \
+ NET_REGISTER_DEV_X(G501534_DIP, _name)
+
+
+NETLIST_EXTERNAL(congob_lib)
+
+#endif
+
+/* ----------------------------------------------------------------------------
+ * Library section header END
+ * ---------------------------------------------------------------------------*/
+
+
+NETLIST_START(dummy)
+// EESCHEMA NETLIST VERSION 1.1 (SPICE FORMAT) CREATION DATE: WED 01 JUL 2015 11:09:25 PM CEST
+// TO EXCLUDE A COMPONENT FROM THE SPICE NETLIST ADD [SPICE_NETLIST_ENABLED] USER FIELD SET TO: N
+// TO REORDER THE COMPONENT SPICE NODE SEQUENCE ADD [SPICE_NODE_SEQUENCE] USER FIELD AND DEFINE SEQUENCE: 2,1,0
+// SHEET NAME:/
+// IGNORED O_AUDIO0: O_AUDIO0 64 0
+// .END
+
+ PARAM(Solver.ACCURACY, 1e-7)
+ PARAM(Solver.NR_LOOPS, 90000)
+ PARAM(Solver.SOR_FACTOR, 1.0)
+ PARAM(Solver.GS_LOOPS, 99)
+ //PARAM(Solver.METHOD, "GMRES")
+ PARAM(Solver.METHOD, "MAT_CR")
+ //PARAM(Solver.METHOD, "SOR")
+
+#if USE_OPTMIZATIONS
+#if USE_FRONTIERS
+ SOLVER(Solver, 48000)
+#else
+ SOLVER(Solver, 48000)
+#endif
+ PARAM(Solver.DYNAMIC_TS, 0)
+ PARAM(Solver.PARALLEL, 1)
+ PARAM(Solver.DYNAMIC_MIN_TIMESTEP, 2e-6)
+#else
+ SOLVER(Solver, 48000)
+ PARAM(Solver.DYNAMIC_TS, 1)
+ PARAM(Solver.DYNAMIC_LTE, 1e-4)
+ PARAM(Solver.DYNAMIC_MIN_TIMESTEP, 1e-7)
+ PARAM(Solver.PARALLEL, 0)
+ PARAM(Solver.PIVOT, 0)
+#endif
+
+ LOCAL_SOURCE(congob_lib)
+ INCLUDE(congob_lib)
+
+ TTL_INPUT(I_BASS_DRUM0, 0)
+ TTL_INPUT(I_CONGA_H0, 0)
+ TTL_INPUT(I_CONGA_L0, 0)
+ TTL_INPUT(I_GORILLA0, 0)
+ TTL_INPUT(I_RIM0, 0)
+
+ ALIAS(I_V0.Q, GND.Q)
+
+ ANALOG_INPUT(I_V12, 12)
+ ANALOG_INPUT(I_V5, 5)
+ ANALOG_INPUT(I_V6, 6)
+
+ /* temporary output stage */
+ RES(RO, RES_K(50))
+ CAP(CO, CAP_U(10))
+
+ NET_C(R94.1, CO.1)
+ NET_C(CO.2, RO.1)
+ NET_C(RO.2, GND)
+
+ // Found here: https://hamesspam.sakura.ne.jp/hes2016/160521.html
+ NET_MODEL("1S2075 D(IS=1.387E-9 N=1.702 RS=1.53 CJO=1.92pf VJ=0.4996 M=0.0605 TT=5ns BV=75 IBV=100E-15)")
+
+ NET_MODEL("2SC1941 NPN(IS=46.416f BF=210 NF=1.0022 VAF=600 IKF=500m ISE=60f NE=1.5 BR=2.0122 NR=1.0022 VAR=10G IKR=10G ISC=300p NC=2 RB=13.22 IRB=10G RBM=13.22 RE=100m RC=790m CJE=26.52p VJE=900m MJE=518m TF=1.25n XTF=10 VTF=10 ITF=500m PTF=0 CJC=4.89p VJC=750m MJC=237m XCJC=500m TR=100n CJS=0 VJS=750m MJS=500m XTB=1.5 EG=1.11 XTI=3 KF=0 AF=1 FC=500m)")
+
+ INCLUDE(CongoBongo_schematics)
+
+#if USE_OPTMIZATIONS
+ /* provide resistance feedback loop. This helps convergence for
+ * Newton-Raphson a lot. This puts a resistor of 1e100 Ohms in parallel
+ * to the feedback loop consisting of D9 and Q2.
+ */
+
+#if 0
+ RES(RX1, 1e100)
+ NET_C(RX1.1, Q2.C)
+ NET_C(RX1.2, XU16.7)
+#endif
+
+ /* The opamp actually has an FPF of about 1000k. This doesn't work here and causes oscillations.
+ * FPF here therefore about half the Solver clock.
+ */
+ PARAM(XU16.B.MODEL, "MB3614(TYPE=3)")
+ PARAM(XU17.C.MODEL, "MB3614(TYPE=3 UGF=44k)")
+#if 0
+ PARAM(XU17.A.MODEL, "MB3614(TYPE=1)")
+ PARAM(XU17.B.MODEL, "MB3614(TYPE=1)")
+ PARAM(XU17.D.MODEL, "MB3614(TYPE=1)")
+
+ //PARAM(XU16.A.MODEL, "MB3614(TYPE=1)")
+ PARAM(XU16.C.MODEL, "MB3614(TYPE=1)")
+ PARAM(XU16.D.MODEL, "MB3614(TYPE=1)")
+#endif
+#if 0
+ PARAM(XU13.A.MODEL, "MB3614(TYPE=1)")
+ PARAM(XU13.B.MODEL, "MB3614(TYPE=1)")
+ PARAM(XU13.C.MODEL, "MB3614(TYPE=1)")
+ PARAM(XU13.D.MODEL, "MB3614(TYPE=1)")
+#endif
+
+#if USE_FRONTIERS
+ OPTIMIZE_FRONTIER(C51.1, RES_K(20), 50)
+ OPTIMIZE_FRONTIER(R77.2, RES_K(20), 50)
+
+ OPTIMIZE_FRONTIER(C25.2, RES_K(240), 50)
+ OPTIMIZE_FRONTIER(C29.2, RES_K(390), 50)
+ OPTIMIZE_FRONTIER(C37.2, RES_K(390), 50)
+ OPTIMIZE_FRONTIER(C44.2, RES_K(200), 50)
+
+ OPTIMIZE_FRONTIER(R90.2, RES_K(100), 50)
+ OPTIMIZE_FRONTIER(R92.2, RES_K(15), 50)
+#endif
+#endif
+NETLIST_END()
+
+NETLIST_START(CongoBongo_schematics)
+ CAP(C20, CAP_N(68))
+ CAP(C21, CAP_U(1))
+ CAP(C22, CAP_U(47))
+ CAP(C23, CAP_N(100))
+ CAP(C24, CAP_N(100))
+ CAP(C25, CAP_U(1))
+ CAP(C26, CAP_N(68))
+ CAP(C27, CAP_N(33))
+ CAP(C28, CAP_U(47))
+ CAP(C29, CAP_U(1))
+ CAP(C30, CAP_N(33))
+ CAP(C31, CAP_N(33))
+ CAP(C32, CAP_N(68))
+ CAP(C33, CAP_N(33))
+ CAP(C34, CAP_U(47))
+ CAP(C35, CAP_N(33))
+ CAP(C36, CAP_N(33))
+ CAP(C37, CAP_U(1))
+ CAP(C38, CAP_N(10))
+ CAP(C39, CAP_N(3.3))
+ CAP(C40, CAP_U(2.2))
+ CAP(C41, CAP_N(6.8))
+ CAP(C42, CAP_N(6.8))
+ CAP(C43, CAP_N(47))
+ CAP(C44, CAP_U(1))
+ CAP(C45, CAP_U(33))
+ CAP(C46, CAP_N(100))
+ CAP(C47, CAP_P(470))
+ CAP(C48, CAP_N(1.5))
+ CAP(C49, CAP_P(220))
+ CAP(C50, CAP_N(3.9))
+ CAP(C51, CAP_U(1))
+ CAP(C52, CAP_U(1))
+ CAP(C53, CAP_U(1))
+ CAP(C54, CAP_U(1))
+ CAP(C55, CAP_U(1))
+ CAP(C56, CAP_U(10))
+ CAP(C57, CAP_N(47))
+ CAP(C58, CAP_N(22))
+ CAP(C59, CAP_U(10))
+ CAP(C60, CAP_N(22))
+ CAP(C62, CAP_N(22))
+ CAP(C61, CAP_U(1))
+ DIODE(D1, "1S2075")
+ DIODE(D2, "1S2075")
+ DIODE(D3, "1S2075")
+ DIODE(D4, "1S2075")
+ DIODE(D5, "1S2075")
+ DIODE(D6, "1S2075")
+ DIODE(D7, "1S2075")
+ DIODE(D8, "1S2075")
+ QBJT_EB(Q2, "2SC1941")
+ RES(R21, RES_K(10))
+ RES(R22, RES_K(47))
+ RES(R23, RES_K(47))
+ RES(R24, RES_K(10))
+ RES(R25, RES_K(47))
+ RES(R26, RES_K(22))
+ RES(R27, RES_K(10))
+ RES(R28, RES_K(470))
+ RES(R29, RES_K(1))
+ RES(R30, RES_K(240))
+ RES(R31, RES_K(10))
+ RES(R32, RES_K(47))
+ RES(R33, RES_K(47))
+ RES(R34, RES_K(47))
+ RES(R35, RES_K(47))
+ RES(R36, RES_K(22))
+ RES(R37, RES_K(10))
+ RES(R38, RES_M(1))
+ RES(R39, 330)
+ RES(R40, RES_K(390))
+ RES(R41, RES_K(10))
+ RES(R42, RES_K(47))
+ RES(R43, RES_K(47))
+ RES(R44, RES_K(47))
+ RES(R45, RES_K(47))
+ RES(R46, RES_K(22))
+ RES(R47, RES_K(10))
+ RES(R48, RES_M(1))
+ RES(R49, 220)
+ RES(R50, RES_K(390))
+ RES(R51, RES_K(10))
+ RES(R52, RES_K(22))
+ RES(R53, RES_K(22))
+ RES(R54, RES_K(22))
+ RES(R55, RES_K(22))
+ RES(R56, RES_K(10))
+ RES(R57, RES_K(4.7))
+ RES(R58, RES_M(1))
+ RES(R59, 470)
+ RES(R60, RES_M(2.2))
+ RES(R61, RES_M(2.2))
+ RES(R62, RES_K(200))
+ RES(R63, RES_K(22))
+ RES(R64, RES_K(22))
+ RES(R65, RES_K(20))
+ RES(R66, RES_K(20))
+ RES(R67, RES_K(20))
+ RES(R68, RES_K(20))
+ RES(R69, RES_K(20))
+ RES(R70, RES_K(100))
+ RES(R71, RES_K(150))
+ RES(R72, RES_K(330))
+ RES(R73, RES_K(1))
+ RES(R74, RES_K(1))
+ RES(R75, RES_K(470))
+ RES(R76, RES_K(10))
+ RES(R77, RES_K(20))
+ RES(R78, RES_K(47))
+ RES(R79, RES_K(22))
+ RES(R80, RES_K(20))
+ RES(R81, RES_K(10))
+ RES(R82, RES_K(100))
+ RES(R83, RES_K(51))
+ RES(R84, RES_K(51))
+ RES(R85, RES_K(51))
+ RES(R86, RES_K(51))
+ RES(R87, RES_K(100))
+ RES(R88, RES_K(2.2))
+ RES(R89, RES_K(10))
+ RES(R90, RES_K(100))
+ RES(R91, RES_K(10))
+ RES(R92, RES_K(15))
+ RES(R93, RES_K(15))
+ RES(R94, RES_K(51))
+ MB3614_DIP(XU13)
+ G501534_DIP(XU15)
+ MB3614_DIP(XU16)
+ MB3614_DIP(XU17)
+ CD4001_DIP(XU18)
+ CD4538_DIP(XU19)
+ MM5837_DIP(XU20)
+ TTL_7416_DIP(XU6)
+
+ NET_C(D1.A, C21.2, R23.1)
+ NET_C(D1.K, C20.1, R22.1)
+ NET_C(XU13.1, C37.2, C36.1, R48.1)
+ NET_C(XU13.2, C35.2, R48.2)
+ NET_C(XU13.3, R44.1, R46.2, R45.1)
+ NET_C(XU13.4, R27.1, R21.1, R37.1, R31.1, R47.1, R41.1, R57.1, R51.1, C46.2, C45.2, XU17.4, R80.2, XU16.4, XU20.4, XU15.12, I_V12.Q)
+ NET_C(XU13.5, R54.1, R56.2, R55.1)
+ NET_C(XU13.6, C41.2, R58.2, R60.2)
+ NET_C(XU13.7, C44.2, C42.1, R58.1, R61.1)
+ NET_C(XU13.8, C29.2, C31.1, R38.1)
+ NET_C(XU13.9, C30.2, R38.2)
+ NET_C(XU13.10, R34.1, R36.2, R35.1)
+ NET_C(XU13.11, C22.2, R29.2, R25.2, R23.2, R22.2, XU6.1, XU6.3, XU6.7, C28.2, R39.2, R35.2, R33.2, R32.2, C34.2, R49.2, R45.2, R43.2, R42.2, C40.2, R59.2, R55.2, R53.2, R52.2, C43.2, R69.1, R64.1, C49.2, C48.2, C47.2, C46.1, C45.1, XU17.11, XU19.1, XU19.4, XU19.8, XU19.12, XU19.15, R81.1, C56.2, C55.2, C53.2, C52.2, XU18.1, XU18.2, XU18.7, XU18.12, XU18.13, C54.2, XU16.11, R84.1, R88.1, Q2.E, C58.2, C60.2, XU20.1, XU20.2, XU15.4, I_V0.Q)
+ NET_C(XU13.12, R24.1, R26.2, R25.1)
+ NET_C(XU13.13, C23.2, R28.2)
+ NET_C(XU13.14, C25.2, C24.1, R28.1)
+ NET_C(C25.1, R30.2)
+ NET_C(C24.2, C23.1, R29.1)
+ NET_C(C21.1, R24.2)
+ NET_C(C20.2, R21.2, XU6.8)
+ NET_C(C22.1, R27.2, R26.1)
+ NET_C(R30.1, R40.1, R50.1, R62.1, R94.1)
+ //NET_C(XU6.2, XU6.4, XU19.7, XU18.3, XU18.11, XU15.5, XU15.6, XU15.7, XU15.8, XU15.9, XU15.10, XU15.11, XU15.14)
+ NET_C(XU6.5, I_CONGA_L0.Q)
+ NET_C(XU6.6, C26.2, R31.2)
+ NET_C(XU6.9, I_BASS_DRUM0.Q)
+ NET_C(XU6.10, C38.2, R51.2)
+ NET_C(XU6.11, I_RIM0.Q)
+ NET_C(XU6.12, C32.2, R41.2)
+ NET_C(XU6.13, I_CONGA_H0.Q)
+ NET_C(XU6.14, D5.K, XU19.16, R70.2, R76.2, R71.2, XU18.14, I_V5.Q)
+ NET_C(D2.A, C27.2, R33.1)
+ NET_C(D2.K, C26.1, R32.1)
+ NET_C(C29.1, R40.2)
+ NET_C(C31.2, C30.1, R39.1)
+ NET_C(C27.1, R34.2)
+ NET_C(C28.1, R37.2, R36.1)
+ NET_C(D3.A, C33.2, R43.1)
+ NET_C(D3.K, C32.1, R42.1)
+ NET_C(C37.1, R50.2)
+ NET_C(C36.2, C35.1, R49.1)
+ NET_C(C33.1, R44.2)
+ NET_C(C34.1, R47.2, R46.1)
+ NET_C(D4.A, C39.2, R53.1)
+ NET_C(D4.K, C38.1, R52.1)
+ NET_C(C44.1, R62.2)
+ NET_C(C42.2, C41.1, R59.1)
+ NET_C(C39.1, R54.2)
+ NET_C(C40.1, R57.2, R56.1)
+ NET_C(R60.1, R61.2, C43.1)
+ NET_C(R63.1, R64.2, C47.1, D5.A, XU18.5, XU18.6)
+ NET_C(R63.2, XU20.3)
+ NET_C(R65.1, R66.2, C48.1)
+ NET_C(R65.2, XU18.4)
+ NET_C(R66.1, R67.2, C50.2)
+ NET_C(R67.1, C49.1, XU17.10)
+ NET_C(R68.1, R69.2, XU17.9)
+ NET_C(R68.2, C50.1, XU17.8, C51.1)
+ NET_C(XU17.1, XU16.6, C62.1)
+ NET_C(XU17.2, R82.1, C62.2, R85.2)
+ NET_C(XU17.3, R83.1, R84.2)
+ NET_C(XU17.5, C55.1, R72.1, R73.1)
+ NET_C(XU17.6, XU17.7, R77.2)
+ NET_C(XU17.12, R80.1, R81.2, C56.1)
+ NET_C(XU17.13, R78.1, R79.2, R77.1)
+ NET_C(XU17.14, R79.1, R82.2, R83.2)
+ NET_C(C51.2, R78.2)
+ NET_C(XU19.2, R70.1, C52.1)
+ NET_C(XU19.3, XU19.13, R76.1)
+ NET_C(XU19.5, XU19.11, I_GORILLA0.Q)
+ NET_C(XU19.6, XU18.9)
+ NET_C(XU19.9, XU18.8)
+ NET_C(XU19.10, D7.A, R75.2)
+ NET_C(XU19.14, R71.1, C53.1)
+ NET_C(R72.2, D6.A, XU18.10)
+ NET_C(R73.2, D6.K)
+ NET_C(D7.K, R74.2)
+ NET_C(R74.1, R75.1, C54.1, XU16.10)
+ NET_C(XU16.1, R91.1, R92.2)
+ NET_C(XU16.2, R90.1, R91.2)
+ NET_C(XU16.3, R86.2, I_V6.Q)
+ NET_C(XU16.5, R86.1, R87.2)
+ NET_C(XU16.7, R87.1, D8.A, R90.2)
+ NET_C(XU16.8, XU16.9, XU15.13)
+ NET_C(XU16.12, R93.1, C58.1)
+ NET_C(XU16.13, XU16.14, C57.1, C59.2)
+ NET_C(R85.1, Q2.C)
+ NET_C(R89.1, D8.K)
+ NET_C(R89.2, R88.2, Q2.B)
+ NET_C(R92.1, C57.2, R93.2)
+ NET_C(C59.1, XU15.1)
+ NET_C(C60.1, XU15.2)
+ NET_C(XU15.3, C61.2)
+ NET_C(C61.1, R94.2)
+NETLIST_END()
+
+
+
+NETLIST_START(G501534_DIP)
+ //AFUNC(f, 2, "A0 A1 A1 A1 * * 0.01 * *")
+ //AFUNC(f, 2, "A0")
+ //AFUNC(f, 2, "A0 6 - A1 3 pow * 0.02 * 6 +")
+ AFUNC(f, 2, "A0 * pow(A1,3.0) * 0.02")
+
+ /*
+ * 12: VCC
+ * 4: GND
+ * 1: IN
+ * 3: OUT
+ * 13: CV
+ * 2: RDL - connected via Capacitor to ground
+ */
+
+ DUMMY_INPUT(DU1)
+ DUMMY_INPUT(DU2)
+ DUMMY_INPUT(DU3)
+
+ RES(RO, 1000)
+
+ ALIAS(12, DU1.I)
+ ALIAS(4, DU2.I)
+ ALIAS(2, DU3.I)
+ ALIAS(1, f.A0)
+ ALIAS(13, f.A1)
+ NET_C(f.Q, RO.1)
+ ALIAS(3, RO.2)
+
+NETLIST_END()
+
+NETLIST_START(congob_lib)
+
+ LOCAL_LIB_ENTRY(G501534_DIP)
+
+NETLIST_END()
diff --git a/src/lib/netlist/examples/congo_bongo.csv b/src/lib/netlist/examples/congo_bongo.csv
new file mode 100644
index 00000000000..55ec61fe0de
--- /dev/null
+++ b/src/lib/netlist/examples/congo_bongo.csv
@@ -0,0 +1,13 @@
+0.000,I_GORILLA0.IN,0
+0.100,I_GORILLA0.IN,1
+0.200,I_GORILLA0.IN,0
+1.000,I_BASS_DRUM0.IN,1
+1.100,I_BASS_DRUM0.IN,0
+2.000,I_CONGA_H0.IN,1
+2.100,I_CONGA_H0.IN,0
+3.000,I_CONGA_L0.IN,1
+3.100,I_CONGA_L0.IN,0
+4.000,I_RIM0.IN,1
+4.100,I_RIM0.IN,0
+5.000,I_GORILLA0.IN,1
+5.100,I_GORILLA0.IN,0
diff --git a/src/lib/netlist/examples/cs.cpp b/src/lib/netlist/examples/cs.cpp
new file mode 100644
index 00000000000..8229c5bc032
--- /dev/null
+++ b/src/lib/netlist/examples/cs.cpp
@@ -0,0 +1,27 @@
+// license:GPL-2.0+
+// copyright-holders:Couriersud
+/*
+ * cs.c
+ *
+ */
+
+
+#include "netlist/devices/net_lib.h"
+
+NETLIST_START(cs)
+
+ SOLVER(Solver, 48000)
+ PARAM(Solver.ACCURACY, 1e-12)
+ PARAM(Solver.METHOD, "MAT_CR")
+
+ /* Positive current flows into pin 1 of the current source
+ * Thus we observe a negative voltage on R1.1 !
+ */
+ CS(CS1, 1e-3)
+ RES(R1, 1000)
+
+ NET_C(CS1.1, R1.1)
+ NET_C(GND, CS1.2, R1.2)
+
+ LOG(log_P, R1.1)
+NETLIST_END()
diff --git a/src/lib/netlist/examples/diode.c b/src/lib/netlist/examples/diode.c
new file mode 100644
index 00000000000..9a2196c6f24
--- /dev/null
+++ b/src/lib/netlist/examples/diode.c
@@ -0,0 +1,31 @@
+/*
+ * diode.c
+ *
+ */
+
+
+#include "netlist/devices/net_lib.h"
+
+NETLIST_START(diode)
+ /* Standard stuff */
+
+ CLOCK(clk, 1000) // 1000 Hz
+ SOLVER(Solver, 48)
+ ANALOG_INPUT(V5, 5)
+
+ //DIODE(D, "1N914")
+ DIODE(D, "D(IS=1e-15)")
+
+ RES(R, RES_K(10))
+ RES(R1, RES_K(10))
+
+ NET_C(clk, D.K)
+ NET_C(D.A, R.1)
+ NET_C(R.2, V5)
+ NET_C(R1.2, GND)
+ NET_C(R.1, R1.1)
+
+ LOG(logB, clk)
+ LOG(logC, D.A)
+
+NETLIST_END()
diff --git a/src/lib/netlist/examples/kidniki.c b/src/lib/netlist/examples/kidniki.c
new file mode 100644
index 00000000000..edbcf5ce203
--- /dev/null
+++ b/src/lib/netlist/examples/kidniki.c
@@ -0,0 +1,466 @@
+// license:GPL-2.0+
+// copyright-holders:Couriersud
+#include "netlist/devices/net_lib.h"
+#include "netlist/devices/nld_system.h"
+#include "netlist/analog/nld_bjt.h"
+
+#define USE_FRONTIERS 0
+#define USE_FIXED_STV 1
+
+NETLIST_START(dummy)
+#if (1 || USE_FRONTIERS)
+ SOLVER(Solver, 18000)
+ PARAM(Solver.ACCURACY, 1e-8)
+ PARAM(Solver.NR_LOOPS, 300)
+ PARAM(Solver.GS_LOOPS, 1)
+ //PARAM(Solver.METHOD, "W")
+ PARAM(Solver.METHOD, "MAT_CR")
+ //PARAM(Solver.METHOD, "MAT")
+ //PARAM(Solver.METHOD, "GMRES")
+ //PARAM(Solver.METHOD, "SOR")
+ PARAM(Solver.DYNAMIC_TS, 0)
+ PARAM(Solver.DYNAMIC_LTE, 5e-3)
+ PARAM(Solver.DYNAMIC_MIN_TIMESTEP, 10e-6)
+ PARAM(Solver.PARALLEL, 0)
+ PARAM(Solver.SOR_FACTOR, 1.00)
+ PARAM(Solver.PIVOT, 0)
+#else
+ SOLVER(Solver, 12000)
+ PARAM(Solver.ACCURACY, 1e-8)
+ PARAM(Solver.NR_LOOPS, 300)
+ PARAM(Solver.GS_LOOPS, 20)
+ PARAM(Solver.METHOD, "GMRES")
+ PARAM(Solver.PARALLEL, 0)
+#endif
+ //FIXME proper models!
+ //NET_MODEL("2SC945 NPN(Is=2.04f Xti=3 Eg=1.11 Vaf=6 Bf=400 Ikf=20m Xtb=1.5 Br=3.377 Rc=1 Cjc=1p Mjc=.3333 Vjc=.75 Fc=.5 Cje=25p Mje=.3333 Vje=.75 Tr=450n Tf=20n Itf=0 Vtf=0 Xtf=0 VCEO=45V ICrating=150M MFG=Toshiba)")
+ //NET_MODEL("1S1588 D(Is=2.52n Rs=.568 N=1.752 Cjo=4p M=.4 tt=20n Iave=200m Vpk=75 mfg=OnSemi type=silicon)")
+
+ //NET_C(R44.1, XU1.7)
+
+ /*
+ * Workaround: The simplified opamp model does not correctly
+ * model the internals of the inputs.
+ */
+
+ ANALOG_INPUT(VWORKAROUND, 2.061)
+ RES(RWORKAROUND, RES_K(27))
+ NET_C(VWORKAROUND.Q, RWORKAROUND.1)
+ NET_C(XU1.6, RWORKAROUND.2)
+
+ ANALOG_INPUT(I_V5, 5)
+ //ANALOG_INPUT(I_V0, 0)
+ ALIAS(I_V0.Q, GND)
+ #if 0
+ TTL_INPUT(I_SD0, 0)
+ TTL_INPUT(I_BD0, 0)
+ TTL_INPUT(I_CH0, 0)
+ TTL_INPUT(I_OH0, 0)
+ TTL_INPUT(I_SOUNDIC0, 0)
+ ANALOG_INPUT(I_MSM2K0, 0)
+ ANALOG_INPUT(I_MSM3K0, 0)
+ TTL_INPUT(I_SOUND0, 0)
+ TTL_INPUT(I_SINH0, 0)
+ #else
+ TTL_INPUT(I_SD0, 1)
+ //CLOCK(I_SD0, 5)
+ TTL_INPUT(I_BD0, 1)
+ //CLOCK(I_BD0, 5)
+ TTL_INPUT(I_CH0, 1)
+ //CLOCK(I_CH0, 5 )
+ //TTL_INPUT(I_OH0, 1)
+ CLOCK(I_OH0, 5)
+ TTL_INPUT(I_SOUNDIC0, 1)
+ ANALOG_INPUT(I_MSM2K0, 0)
+ ANALOG_INPUT(I_MSM3K0, 0)
+ TTL_INPUT(I_SOUND0, 1)
+ TTL_INPUT(I_SINH0, 1)
+ #endif
+
+ INCLUDE(kidniki_schematics)
+
+ #if (USE_FRONTIERS)
+ OPTIMIZE_FRONTIER(C63.2, RES_K(27), RES_K(1))
+ OPTIMIZE_FRONTIER(R31.2, RES_K(5.1), 50)
+ OPTIMIZE_FRONTIER(R29.2, RES_K(2.7), 50)
+ OPTIMIZE_FRONTIER(R87.2, RES_K(68), 50)
+
+ OPTIMIZE_FRONTIER(R50.1, RES_K(2.2), 50)
+ OPTIMIZE_FRONTIER(R55.1, RES_K(510), 50)
+ OPTIMIZE_FRONTIER(R84.2, RES_K(50), RES_K(5))
+ #endif
+
+NETLIST_END()
+
+NETLIST_START(kidniki_schematics)
+ // EESCHEMA NETLIST VERSION 1.1 (SPICE FORMAT) CREATION DATE: SAT 06 JUN 2015 01:06:26 PM CEST
+ // TO EXCLUDE A COMPONENT FROM THE SPICE NETLIST ADD [SPICE_NETLIST_ENABLED] USER FIELD SET TO: N
+ // TO REORDER THE COMPONENT SPICE NODE SEQUENCE ADD [SPICE_NODE_SEQUENCE] USER FIELD AND DEFINE SEQUENCE: 2,1,0
+ // SHEET NAME:/
+ // IGNORED O_AUDIO0: O_AUDIO0 49 0
+ // .END
+
+ CAP(C200, CAP_N(100))
+ CAP(C28, CAP_U(1))
+ CAP(C31, CAP_N(470))
+ CAP(C32, CAP_N(3.3))
+ CAP(C33, CAP_U(1))
+ CAP(C34, CAP_N(1))
+ CAP(C35, CAP_N(1))
+ CAP(C36, CAP_N(6.5))
+ CAP(C37, CAP_N(22))
+ CAP(C38, CAP_N(1))
+ CAP(C39, CAP_N(1))
+ CAP(C40, CAP_P(12))
+ CAP(C41, CAP_U(1))
+ CAP(C42, CAP_N(1.2))
+ CAP(C43, CAP_N(1.2))
+ CAP(C44, CAP_U(1))
+ CAP(C45, CAP_N(22))
+ CAP(C47, CAP_U(1))
+ CAP(C48, CAP_N(470))
+ CAP(C49, CAP_N(3.3))
+ CAP(C50, CAP_N(22))
+ CAP(C51, CAP_N(22))
+ CAP(C52, CAP_N(27))
+ CAP(C53, CAP_N(27))
+ CAP(C56, CAP_N(6.8))
+ CAP(C57, CAP_N(6.8))
+ CAP(C59, CAP_N(6.8))
+ CAP(C60, CAP_N(22))
+ CAP(C61, CAP_N(22))
+ CAP(C62, CAP_N(6.8))
+ CAP(C63, CAP_N(1))
+ CAP(C64, CAP_N(68))
+ CAP(C65, CAP_N(68))
+ CAP(C66, CAP_N(68))
+ CAP(C67, CAP_N(15))
+ CAP(C68, CAP_N(15))
+ CAP(C69, CAP_N(10))
+ CAP(C70, CAP_N(22))
+ CAP(C72, CAP_N(12))
+ CAP(C73, CAP_N(10))
+ CAP(C76, CAP_N(68))
+ CAP(C77, CAP_N(12))
+
+ DIODE(D3, "1S1588")
+ DIODE(D4, "1S1588")
+ DIODE(D5, "1S1588")
+
+ POT(RV1, RES_K(50))
+
+ QBJT_EB(Q10, "2SC945")
+ QBJT_EB(Q3, "2SC945")
+ QBJT_EB(Q4, "2SC945")
+ QBJT_EB(Q5, "2SC945")
+ QBJT_EB(Q6, "2SC945")
+ QBJT_EB(Q7, "2SC945")
+ QBJT_EB(Q9, "2SC945")
+
+ SUBMODEL(LM324_DIP,XU1)
+ SUBMODEL(LM358_DIP,XU2)
+
+ TTL_7404_DIP(XU3)
+
+ RES(R100, RES_K(560))
+ RES(R101, RES_K(150))
+ RES(R102, RES_K(150))
+ RES(R103, RES_K(470))
+ RES(R104, RES_K(22))
+ RES(R105, RES_K(470))
+ RES(R106, RES_K(150))
+ RES(R107, RES_K(150))
+ RES(R108, RES_K(560))
+ RES(R119, RES_K(22))
+ RES(R200, RES_K(100))
+ RES(R201, RES_K(100))
+ RES(R27, RES_K(6.8))
+ RES(R28, RES_K(150))
+ RES(R29, RES_K(2.7))
+ RES(R30, RES_K(10))
+ RES(R31, RES_K(5.1))
+ RES(R32, RES_K(4.7))
+ RES(R34, RES_K(100))
+ RES(R35, RES_K(100))
+ RES(R36, RES_K(100))
+ RES(R37, RES_K(47))
+ RES(R38, 820)
+ RES(R39, RES_K(22))
+ RES(R40, RES_K(10))
+ RES(R41, RES_K(10))
+ RES(R42, RES_K(150))
+ RES(R43, 470)
+ RES(R44, RES_K(100))
+ RES(R45, RES_K(1))
+ RES(R46, RES_K(12))
+ RES(R48, 470)
+ RES(R48_2, RES_K(100))
+ RES(R49, RES_K(10))
+ RES(R50, RES_K(22))
+ RES(R51, RES_K(150))
+ RES(R52, RES_K(100))
+ RES(R53, RES_K(100))
+ RES(R54, RES_K(680))
+ RES(R55, RES_K(510))
+ RES(R57, 560)
+ RES(R58, RES_K(39))
+ RES(R59, 560)
+ RES(R60, RES_K(39))
+ RES(R61, RES_K(100))
+ RES(R62, RES_K(100))
+ RES(R63, RES_K(1))
+ RES(R65, RES_K(1))
+ RES(R65_1, RES_K(27))
+ RES(R66, RES_M(1))
+ RES(R67, RES_K(100))
+ RES(R68, RES_K(100))
+ RES(R69, RES_K(1))
+ RES(R70, RES_K(10))
+ RES(R71, RES_K(100))
+ RES(R72, RES_K(100))
+ RES(R73, RES_K(10))
+ RES(R74, RES_K(10))
+ RES(R75, RES_K(10))
+ RES(R76, RES_K(10))
+ RES(R81, 220)
+ RES(R82, RES_M(2.2))
+ RES(R83, RES_K(12))
+ RES(R84, RES_K(1))
+ RES(R85, RES_M(2.2))
+ RES(R86, RES_K(10))
+ RES(R87, RES_K(68))
+ RES(R89, RES_K(22))
+ RES(R90, RES_K(390))
+ RES(R91, RES_K(100))
+ RES(R92, RES_K(22))
+ RES(R93, RES_K(1))
+ RES(R94, RES_K(22))
+ RES(R95, RES_K(330))
+ RES(R96, RES_K(150))
+ RES(R97, RES_K(150))
+ RES(R98, RES_K(650))
+
+ #if USE_FIXED_STV
+ ANALOG_INPUT(STV, 2)
+ #else
+ RES(R78, RES_K(3.3))
+ RES(R77, RES_K(2.2))
+ CAP(C58, CAP_U(47))
+ #endif
+
+ NET_C(R95.1, XU3.2, R96.2)
+ NET_C(R95.2, XU3.1, C69.1)
+ NET_C(XU3.3, R103.2, C73.1)
+ NET_C(XU3.4, R103.1, R102.2)
+ NET_C(XU3.5, R105.2, C72.1)
+ NET_C(XU3.6, R105.1, R106.2)
+ #if USE_FIXED_STV
+ //FIXME: We should have a NET_C_REMOVE
+ NET_C(/*XU3.7,*/ C69.2, C73.2, C72.2, C77.2, C67.2, C68.2, R65.2, R38.2, XU1.11, R54.2, Q4.E, R63.2, C47.2, R72.2, R67.2, R71.2, R68.2, C48.2, R46.2, C28.1, C32.1, R43.2, XU2.4, C56.1, C52.1,/* R77.2, C58.1, */ R48.2, R93.2, R94.2, R119.2, R104.2, R53.2, R34.2, R81.2, R92.2, R89.2, C33.1, R37.2, R36.1, R91.1, I_V0.Q, RV1.3)
+ #else
+ NET_C(/*XU3.7,*/ C69.2, C73.2, C72.2, C77.2, C67.2, C68.2, R65.2, R38.2, XU1.11, R54.2, Q4.E, R63.2, C47.2, R72.2, R67.2, R71.2, R68.2, C48.2, R46.2, C28.1, C32.1, R43.2, XU2.4, C56.1, C52.1, R77.2, C58.1, R48.2, R93.2, R94.2, R119.2, R104.2, R53.2, R34.2, R81.2, R92.2, R89.2, C33.1, R37.2, R36.1, R91.1, I_V0.Q, RV1.3)
+ #endif
+ NET_C(XU3.8, R108.1, R107.2)
+ NET_C(XU3.9, R108.2, C77.1)
+ NET_C(XU3.10, R100.1, R101.2)
+ NET_C(XU3.11, R100.2, C67.1)
+ NET_C(XU3.12, R98.1, R97.2)
+ NET_C(XU3.13, R98.2, C68.1)
+ #if USE_FIXED_STV
+ NET_C(/*XU3.14,*/ XU1.4, R66.1, R70.1, Q6.C, Q5.C, XU2.8, /* R78.1, */ R86.1, R83.1, Q3.C, I_V5.Q)
+ #else
+ NET_C(/*XU3.14,*/ XU1.4, R66.1, R70.1, Q6.C, Q5.C, XU2.8, R78.1, R86.1, R83.1, Q3.C, I_V5.Q)
+ #endif
+ NET_C(R96.1, R102.1, R106.1, R107.1, R101.1, R97.1, R65.1, C63.2)
+ NET_C(C63.1, R65_1.2)
+ NET_C(R65_1.1, R44.2, C38.2, C40.2, XU1.6)
+ #if USE_FIXED_STV
+ NET_C(R30.1, R41.1, R40.1, STV, R76.2, /* R78.2, R77.1, C58.2*/ STV)
+ #else
+ NET_C(R30.1, R41.1, R40.1, R76.2, R78.2, R77.1, C58.2)
+ #endif
+ NET_C(R30.2, XU1.5)
+ NET_C(R44.1, C39.1, C40.1, R48_2.2)
+ NET_C(C38.1, C39.2, R38.1)
+ NET_C(XU1.1, XU1.2, R39.1, R32.2)
+ NET_C(XU1.3, C34.1, R41.2)
+ NET_C(XU1.7, R45.2)
+ NET_C(XU1.8, XU1.9, R31.2, C36.2)
+ NET_C(XU1.10, R42.1, C32.2)
+ NET_C(XU1.12, C49.1, C31.1, R40.2, C61.1, C60.1)
+ NET_C(XU1.13, R27.1, R28.2)
+ NET_C(XU1.14, R28.1, R29.2, I_SINH0.Q)
+ NET_C(R48_2.1, C45.2, R54.1)
+ NET_C(C45.1, R55.1, Q7.B)
+ NET_C(R55.2, R90.2, C33.2, R37.1, Q3.E)
+ NET_C(R45.1, C44.2)
+ NET_C(C44.1, R66.2, Q4.B)
+ NET_C(Q4.C, C42.1, C43.1, R46.1, C35.2, D4.K, D5.K)
+ NET_C(R70.2, R69.2, Q7.C)
+ NET_C(R63.1, Q7.E)
+ NET_C(R69.1, C49.2)
+ NET_C(C42.2, R58.1, D5.A)
+ NET_C(R58.2, R57.1, C47.1)
+ NET_C(R57.2, Q6.E)
+ NET_C(Q6.B, R61.1)
+ NET_C(C50.1, R67.1, R61.2)
+ NET_C(C50.2, R72.1, I_OH0.Q)
+ NET_C(C51.1, R68.1, R62.2)
+ NET_C(C51.2, R71.1, I_CH0.Q)
+ NET_C(R62.1, Q5.B)
+ NET_C(Q5.E, R59.2)
+ NET_C(R60.1, C43.2, D4.A)
+ NET_C(R60.2, R59.1, C48.1)
+ NET_C(C35.1, C34.2, R39.2)
+ NET_C(R32.1, C31.2)
+ NET_C(R27.2, C28.2)
+ NET_C(R29.1, R31.1, R50.2, R49.1, RV1.1)
+ NET_C(R42.2, R51.1, C36.1)
+ NET_C(R51.2, C41.1)
+ NET_C(C41.2, R43.1, I_SOUNDIC0.Q)
+ NET_C(XU2.1, XU2.2, R73.1)
+ NET_C(XU2.3, R76.1, C200.2)
+ NET_C(XU2.5, C56.2, R75.1)
+ NET_C(XU2.6, XU2.7, R50.1, C53.2)
+ NET_C(R75.2, R74.1, C53.1)
+ NET_C(R74.2, C52.2, R73.2)
+ NET_C(R49.2, R48.1, I_SOUND0.Q)
+ NET_C(Q9.E, R81.1)
+ NET_C(Q9.C, R84.2, R83.2, R82.1, C59.1)
+ NET_C(Q9.B, R82.2, C62.1)
+ NET_C(Q10.E, R93.1)
+ NET_C(Q10.C, R87.2, R86.2, R85.1, C76.1)
+ NET_C(Q10.B, R85.2, C64.1)
+ NET_C(R84.1, C61.2)
+ NET_C(C60.2, R87.1)
+ NET_C(C64.2, C65.1, R94.1, D3.K)
+ NET_C(C65.2, C66.1, R119.1)
+ NET_C(C66.2, C76.2, R104.1)
+ NET_C(R53.1, R52.2, C37.1)
+ NET_C(R34.1, C37.2, I_BD0.Q)
+ NET_C(R52.1, D3.A)
+ NET_C(R92.1, C62.2, C57.1)
+ NET_C(R89.1, C57.2, C59.2, R90.1)
+ NET_C(Q3.B, R35.1)
+ NET_C(R35.2, R36.2, C70.1)
+ NET_C(R91.2, C70.2, I_SD0.Q)
+ NET_C(I_MSM3K0.Q, R200.2)
+ NET_C(I_MSM2K0.Q, R201.2)
+ NET_C(R200.1, R201.1, C200.1)
+NETLIST_END()
+
+NETLIST_START(opamp)
+
+ /* Opamp model from
+ *
+ * http://www.ecircuitcenter.com/Circuits/opmodel1/opmodel1.htm
+ *
+ * Bandwidth 1Mhz
+ *
+ */
+
+ /* Terminal definitions for calling netlists */
+
+ ALIAS(PLUS, G1.IP) // Positive input
+ ALIAS(MINUS, G1.IN) // Negative input
+ ALIAS(OUT, EBUF.OP) // Opamp output ...
+
+ ALIAS(GND, EBUF.ON) // GND terminal
+ ALIAS(VCC, DUMMY.I) // VCC terminal
+ DUMMY_INPUT(DUMMY)
+
+ /* The opamp model */
+
+ VCCS(G1)
+ PARAM(G1.RI, RES_K(1000))
+#if 1
+ PARAM(G1.G, 100) // typical OP-AMP amplification 100 * 1000 = 100000
+ RES(RP1, 1000)
+ CAP(CP1, 1.59e-5) // <== change to 1.59e-3 for 10Khz bandwidth
+#else
+ PARAM(G1.G, 1) // typical OP-AMP amplification 100 * 1000 = 100000
+ RES(RP1, 100000)
+ CAP(CP1, 1.59e-7) // <== change to 1.59e-3 for 10Khz bandwidth
+#endif
+ VCVS(EBUF)
+ PARAM(EBUF.RO, 50)
+ PARAM(EBUF.G, 1)
+
+// PARAM(EBUF.RI, 1e20)
+// NET_C(EBUF.ON, GND)
+
+ NET_C(G1.ON, GND)
+ NET_C(RP1.2, GND)
+ NET_C(CP1.2, GND)
+ NET_C(EBUF.IN, GND)
+
+ NET_C(RP1.1, G1.OP)
+ NET_C(CP1.1, RP1.1)
+
+ DIODE(DP,"1N914")
+ DIODE(DN,"1N914")
+
+ NET_C(DP.K, VCC)
+#if 1
+ NET_C(DP.A, DN.K, RP1.1)
+#else
+ RES(RDP, 1000)
+ RES(RDN, 1000)
+ NET_C(RDP.1, DP.A)
+ NET_C(RDN.1, DN.K)
+ NET_C(RDP.2, RDN.2, RP1.1)
+#endif
+ NET_C(DN.A, GND)
+
+ NET_C(EBUF.IP, RP1.1)
+
+NETLIST_END()
+
+NETLIST_START(LM324_DIP)
+ SUBMODEL(opamp, op1)
+ SUBMODEL(opamp, op2)
+ SUBMODEL(opamp, op3)
+ SUBMODEL(opamp, op4)
+
+ ALIAS( 1, op1.OUT)
+ ALIAS( 2, op1.MINUS)
+ ALIAS( 3, op1.PLUS)
+
+ ALIAS( 7, op2.OUT)
+ ALIAS( 6, op2.MINUS)
+ ALIAS( 5, op2.PLUS)
+
+ ALIAS( 8, op3.OUT)
+ ALIAS( 9, op3.MINUS)
+ ALIAS(10, op3.PLUS)
+
+ ALIAS(14, op4.OUT)
+ ALIAS(13, op4.MINUS)
+ ALIAS(12, op4.PLUS)
+
+ NET_C(op1.GND, op2.GND, op3.GND, op4.GND)
+ NET_C(op1.VCC, op2.VCC, op3.VCC, op4.VCC)
+
+ ALIAS(11, op1.GND)
+ ALIAS( 4, op1.VCC)
+NETLIST_END()
+
+NETLIST_START(LM358_DIP)
+ SUBMODEL(opamp, op1)
+ SUBMODEL(opamp, op2)
+
+ ALIAS( 1, op1.OUT)
+ ALIAS( 2, op1.MINUS)
+ ALIAS( 3, op1.PLUS)
+
+ ALIAS( 7, op2.OUT)
+ ALIAS( 6, op2.MINUS)
+ ALIAS( 5, op2.PLUS)
+
+
+ NET_C(op1.GND, op2.GND)
+ NET_C(op1.VCC, op2.VCC)
+
+ ALIAS( 4, op1.GND)
+ ALIAS( 8, op1.VCC)
+NETLIST_END()
diff --git a/src/lib/netlist/examples/mm5837_noise.c b/src/lib/netlist/examples/mm5837_noise.c
new file mode 100644
index 00000000000..dff1966e1eb
--- /dev/null
+++ b/src/lib/netlist/examples/mm5837_noise.c
@@ -0,0 +1,38 @@
+// license:GPL-2.0+
+// copyright-holders:Couriersud
+/*
+ * mm5837_noise.c
+ *
+ */
+
+#include "netlist/devices/net_lib.h"
+
+NETLIST_START(ne555_astable)
+
+ /*
+ * Astable ne555
+ *
+ */
+
+ /* Standard stuff */
+
+ SOLVER(Solver, 48000)
+
+ ANALOG_INPUT(V12, 12) // 5V
+
+ /* Wiring up the ne555 */
+
+ // astable NE555, 1.13 ms period
+
+ MM5837_DIP(NOISE)
+
+ RES(R, 10000)
+
+ NET_C(NOISE.1, NOISE.2, R.2, GND)
+ NET_C(NOISE.4, V12)
+
+ NET_C(NOISE.3, R.1)
+
+ LOG(log3, NOISE.3)
+
+NETLIST_END()
diff --git a/src/lib/netlist/examples/msx_mixer_stage.c b/src/lib/netlist/examples/msx_mixer_stage.c
new file mode 100644
index 00000000000..445777eb9cf
--- /dev/null
+++ b/src/lib/netlist/examples/msx_mixer_stage.c
@@ -0,0 +1,65 @@
+// license:GPL-2.0+
+// copyright-holders:Couriersud
+/*
+ * bjt.c
+ *
+ */
+
+
+#include "netlist/devices/net_lib.h"
+
+NETLIST_START(msx)
+ /* The BJT is used as an amplifier. RESCHED_LOOPS must be relatively high to
+ * allow Newton-Raphson to finish. */
+
+ CLOCK(clk, 1000) // 1000 Hz
+ SOLVER(Solver, 48000)
+ PARAM(Solver.ACCURACY, 1e-5)
+ //PARAM(Solver.CONVERG, 0.3)
+ PARAM(Solver.GS_LOOPS, 50)
+
+ RES(RAY8910, 2345) // Max Voltage
+
+ ANALOG_INPUT(V5, 5)
+ ANALOG_INPUT(V12, 12)
+
+ ANALOG_INPUT(SOUND, 5)
+ ANALOG_INPUT(SND, 5)
+
+ NET_MODEL("ss9014 NPN(is=2.87599e-14 bf=377.5 vaf=123 ikf=1.1841 ise=4.7863e-15 ne=1.5 br=4.79 var=11.29 ikr=0.275423 isc=1.44544e-14 nc=1.5 rb=200 irb=1e-5 rbm=10 re=0.56 rc=5 cje=1.7205e-11 vje=0.6905907 mje=0.3193434 tf=5.89463e-10 cjc=6.2956p vjc=0.4164212 mjc=0.2559546 xcjc=0.451391 xtb=1.8881 eg=1.2415 xti=3 fc=0.5 Vceo=45 Icrating=0.1 mfg=Fairchild)")
+
+ RES(R24, RES_K(51))
+ RES(R23, RES_K(5))
+ RES(R21, RES_K(51))
+ RES(R20, RES_K(1))
+ RES(R9, RES_K(10))
+ RES(R8, 330)
+
+ CAP(C55, CAP_U(5)) // Guessed
+
+ //NET_C(RAY8910.1, SND)
+ NET_C(RAY8910.1, clk)
+
+ //NET_C(C55.1, SOUND)
+ NET_C(C55.1, V5)
+ NET_C(C55.2, R24.1)
+ NET_C(R24.2, R23.2)
+ NET_C(R23.1, RAY8910.2)
+ NET_C(R23.1, R20.1)
+ NET_C(R20.2, GND)
+
+ NET_C(R21.1, V5)
+ NET_C(R21.2, R23.2)
+
+ QBJT_EB(T2, "ss9014")
+
+ NET_C(R9.1, V12)
+ NET_C(R9.2, T2.C)
+ NET_C(R21.2, T2.B)
+ NET_C(R8.1, T2.E)
+ NET_C(R8.2, GND)
+
+ //LOG(logB, T2.B)
+ LOG(logC, T2.C)
+
+NETLIST_END()
diff --git a/src/lib/netlist/examples/ne555_astable.c b/src/lib/netlist/examples/ne555_astable.c
new file mode 100644
index 00000000000..0348d3ae4d3
--- /dev/null
+++ b/src/lib/netlist/examples/ne555_astable.c
@@ -0,0 +1,53 @@
+// license:GPL-2.0+
+// copyright-holders:Couriersud
+
+/*
+ * ne555_astable.c
+ *
+ */
+
+//! [ne555_example]
+#include "netlist/devices/net_lib.h"
+
+NETLIST_START(ne555_astable)
+
+ /*
+ * Astable ne555
+ *
+ */
+
+ /* Standard stuff */
+
+ SOLVER(Solver, 48000)
+
+ ANALOG_INPUT(V5, 5) // 5V
+
+ /* Wiring up the ne555 */
+
+ // astable NE555, 1.13 ms period
+
+ RES(RA, 5000)
+ RES(RB, 3000)
+ CAP(C, 0.15e-6)
+ NE555(555)
+
+ NET_C(GND, 555.GND)
+ NET_C(V5, 555.VCC)
+ NET_C(V5, 555.RESET)
+
+ NET_C(RA.1, 555.VCC)
+ NET_C(RA.2, 555.DISCH)
+
+ NET_C(RB.1, 555.DISCH)
+ NET_C(RB.2, 555.TRIG)
+
+ NET_C(RB.2, 555.THRESH)
+
+ NET_C(555.TRIG, C.1)
+ NET_C(C.2, GND)
+
+ LOG(log2, C.1)
+ LOG(log3, 555.OUT)
+
+NETLIST_END()
+//! [ne555_example]
diff --git a/src/lib/netlist/examples/nmos_fet.cpp b/src/lib/netlist/examples/nmos_fet.cpp
new file mode 100644
index 00000000000..53c6b4a6fc9
--- /dev/null
+++ b/src/lib/netlist/examples/nmos_fet.cpp
@@ -0,0 +1,54 @@
+// license:GPL-2.0+
+// copyright-holders:Couriersud
+/*
+ * nmos_fet.cpp
+ *
+ */
+
+
+#include "netlist/devices/net_lib.h"
+#include "netlist/analog/nld_twoterm.h"
+
+NETLIST_START(nmos)
+ /* Standard stuff */
+
+ CLOCK(clk, 100) // 100 Hz
+ SOLVER(Solver, 48000)
+ PARAM(Solver.ACCURACY, 1e-9)
+ PARAM(Solver.NR_LOOPS, 50000)
+ PARAM(Solver.DYNAMIC_TS, 1)
+ PARAM(Solver.DYNAMIC_MIN_TIMESTEP, 1e-9)
+ ANALOG_INPUT(V5, 5)
+ ANALOG_INPUT(V3, 3.5)
+
+ /* NMOS - example */
+
+ NET_MODEL("MM NMOS(VTO=1.0 KP=2e-3 LAMBDA=2E-2)")
+ MOSFET(M, "MM")
+
+ RES(RB, 1000)
+ RES(RC, 10000)
+
+ NET_C(RC.1, V5)
+ NET_C(RC.2, M.D)
+ NET_C(RB.1, clk)
+ //NET_C(RB.1, V3)
+ NET_C(RB.2, M.G)
+ NET_C(M.S, GND)
+
+ // put some load on M.D
+
+ RES(RCE, 150000)
+ NET_C(RCE.1, M.D)
+ NET_C(RCE.2, GND)
+
+ // capacitance over G - S
+
+ CAP(C, CAP_N(1))
+ NET_C(M.D, C.1)
+ NET_C(M.S, C.2)
+
+ LOG(log_G, M.G)
+ LOG(log_D, M.D)
+
+NETLIST_END()
diff --git a/src/lib/netlist/examples/norton_opamp.c b/src/lib/netlist/examples/norton_opamp.c
new file mode 100644
index 00000000000..8e077a91df2
--- /dev/null
+++ b/src/lib/netlist/examples/norton_opamp.c
@@ -0,0 +1,126 @@
+/*
+ * opamp.c
+ *
+ */
+
+
+#include "netlist/devices/net_lib.h"
+
+NETLIST_START(main)
+
+ /* Standard stuff */
+
+ CLOCK(clk, 10000) // 1000 Hz
+ SOLVER(Solver, 48000)
+ ANALOG_INPUT(V5, 5)
+ PARAM(Solver.ACCURACY, 1e-6)
+ PARAM(Solver.DYNAMIC_TS, 0)
+ PARAM(Solver.SOR_FACTOR, 1.0)
+ //PARAM(Solver.CONVERG, 1.0)
+ PARAM(Solver.GS_LOOPS, 5)
+
+ SUBMODEL(op1, opamp_fast)
+ /* Wired as non - inverting amplifier like in LM3900 datasheet */
+
+ RES(R1, 25000)
+ RES(R2, 100000)
+ RES(R3, 200000)
+ CAP(C1, CAP_U(0.05))
+
+ NET_C(clk, C1.1)
+ NET_C(C1.2, R1.1)
+
+ NET_C(op1.VM, GND)
+ NET_C(op1.VP, V5 )
+ NET_C(op1.PLUS, R1.2, R3.1)
+ NET_C(R3.2, V5)
+ //NET_C(R3.2, GND)
+ NET_C(op1.MINUS, R2.2)
+ NET_C(op1.OUT, R2.1)
+
+ RES(RL, 10000)
+ NET_C(RL.2, GND)
+ NET_C(RL.1, op1.OUT)
+
+ LOG(logX, op1.OUT)
+ LOG(logY, clk)
+NETLIST_END()
+
+NETLIST_START(opamp)
+
+ /* Opamp model from
+ *
+ * http://www.ecircuitcenter.com/Circuits/opmodel1/opmodel1.htm
+ *
+ * Bandwidth 10Mhz
+ *
+ */
+
+ /* Terminal definitions for calling netlists */
+
+ ALIAS(PLUS, G1.IP) // Positive input
+ ALIAS(MINUS, G2.IN) // Negative input
+ ALIAS(OUT, EBUF.OP) // Opamp output ...
+ ALIAS(VM, EBUF.ON) // V- terminal
+ ALIAS(VP, DUMMY.I) // V+ terminal
+
+ DUMMY_INPUT(DUMMY)
+
+ /* The opamp model */
+
+ CCCS(G1)
+ CCCS(G2)
+ //PARAM(G1.G, 100) // typical OP-AMP amplification 100 * 1000 = 100000
+ PARAM(G1.G, 1000000) // typical OP-AMP amplification 100 * 1000 = 100000
+ PARAM(G2.G, 1000000) // typical OP-AMP amplification 100 * 1000 = 100000
+ RES(RP1, 1000)
+ CAP(CP1, 1.59e-6) // <== change to 1.59e-3 for 10Khz bandwidth
+ VCVS(EBUF)
+ PARAM(EBUF.RO, 50)
+ PARAM(EBUF.G, 1)
+
+// NET_C(EBUF.ON, GND)
+
+ NET_C(G1.ON, GND)
+ NET_C(G2.ON, GND)
+ NET_C(RP1.2, GND)
+ NET_C(CP1.2, GND)
+ NET_C(EBUF.IN, GND)
+
+ NET_C(G1.IN, G2.IP, GND)
+
+ NET_C(RP1.1, G1.OP)
+ NET_C(RP1.1, G2.OP)
+ NET_C(CP1.1, RP1.1)
+ NET_C(EBUF.IP, RP1.1)
+
+NETLIST_END()
+
+NETLIST_START(opamp_fast)
+
+ /*
+ * Fast norton opamp model without bandwidth
+ */
+
+ /* Terminal definitions for calling netlists */
+
+ ALIAS(PLUS, R1.1) // Positive input
+ ALIAS(MINUS, R2.1) // Negative input
+ ALIAS(OUT, G1.OP) // Opamp output ...
+ ALIAS(VM, G1.ON) // V- terminal
+ ALIAS(VP, DUMMY.I) // V+ terminal
+
+ DUMMY_INPUT(DUMMY)
+
+ /* The opamp model */
+
+ RES(R1, 1)
+ RES(R2, 1)
+ NET_C(R1.1, G1.IP)
+ NET_C(R2.1, G1.IN)
+ NET_C(R1.2, R2.2, G1.ON)
+ VCVS(G1)
+ PARAM(G1.G, 1000000)
+ PARAM(G1.RO, RES_K(8))
+
+NETLIST_END()
diff --git a/src/lib/netlist/examples/opamp.c b/src/lib/netlist/examples/opamp.c
new file mode 100644
index 00000000000..b13d92dab67
--- /dev/null
+++ b/src/lib/netlist/examples/opamp.c
@@ -0,0 +1,187 @@
+// license:GPL-2.0+
+// copyright-holders:Couriersud
+/*
+ * opamp.c
+ *
+ */
+
+
+#include "netlist/devices/net_lib.h"
+
+NETLIST_START(main)
+
+ /* Standard stuff */
+
+ CLOCK(clk, 1000) // 1000 Hz
+ SOLVER(Solver, 480000)
+ PARAM(Solver.ACCURACY, 1e-10)
+ PARAM(Solver.NR_LOOPS, 30000 )
+ //PARAM(Solver.CONVERG, 1.0)
+ PARAM(Solver.GS_LOOPS, 30)
+
+ // Tie up +5 to opamps thought it's not currently needed
+ // Stay compatible
+ ANALOG_INPUT(V5, 5)
+ NET_C(op.VCC, V5)
+ NET_C(op1.VCC, V5)
+
+ /* Opamp wired as impedance changer */
+ SUBMODEL(opamp, op)
+
+ NET_C(op.GND, GND)
+ NET_C(op.PLUS, clk)
+ NET_C(op.MINUS, op.OUT)
+
+ SUBMODEL(opamp, op1)
+ /* Wired as inverting amplifier connected to output of first opamp */
+
+ RES(R1, 100000)
+ RES(R2, 200000)
+
+ NET_C(op1.GND, GND)
+ NET_C(op1.PLUS, GND)
+ NET_C(op1.MINUS, R2.2)
+ NET_C(op1.MINUS, R1.2)
+
+ NET_C(op.OUT, R1.1)
+ NET_C(op1.OUT, R2.1)
+
+ RES(RL, 1000)
+ NET_C(RL.2, GND)
+ NET_C(RL.1, op1.OUT)
+
+ LOG(log_X, op1.OUT)
+ LOG(log_Y, clk)
+NETLIST_END()
+
+NETLIST_START(opamp)
+
+ /* Opamp model from
+ *
+ * http://www.ecircuitcenter.com/Circuits/opmodel1/opmodel1.htm
+ *
+ * Bandwidth 10Mhz
+ *
+ */
+
+ /* Terminal definitions for calling netlists */
+
+ ALIAS(PLUS, G1.IP) // Positive input
+ ALIAS(MINUS, G1.IN) // Negative input
+ ALIAS(OUT, EBUF.OP) // Opamp output ...
+
+ ALIAS(GND, EBUF.ON) // GND terminal
+ ALIAS(VCC, DUMMY.I) // VCC terminal
+ DUMMY_INPUT(DUMMY)
+
+ /* The opamp model */
+
+ LVCCS(G1)
+ PARAM(G1.G, 0.0021)
+ PARAM(G1.CURLIM, 0.002)
+ RES(RP1, 1e7)
+ CAP(CP1, 0.00333e-6)
+ VCVS(EBUF)
+ PARAM(EBUF.RO, 50)
+ PARAM(EBUF.G, 1)
+
+// NET_C(EBUF.ON, GND)
+
+ NET_C(G1.ON, GND)
+ NET_C(RP1.2, GND)
+ NET_C(CP1.2, GND)
+ NET_C(EBUF.IN, GND)
+
+ NET_C(RP1.1, G1.OP)
+ NET_C(CP1.1, RP1.1)
+ NET_C(EBUF.IP, RP1.1)
+
+NETLIST_END()
+
+NETLIST_START(opamp_mod)
+
+ /* Opamp model from
+ *
+ * http://www.ecircuitcenter.com/Circuits/opmodel1/opmodel1.htm
+ *
+ * MB3614 Unit Gain frequency is about 500 kHz and the first pole frequency
+ * about 5 Hz. We have to keep the Unity Gain Frequency below our sampling
+ * frequency of 24 Khz.
+ *
+ * Simple Opamp Model Calculation
+ *
+ * First Pole Frequency 5 Hz
+ * Unity Gain Frequency 11,000 Hz
+ * RP 100,000 Ohm
+ * DC Gain / Aol 2200
+ * CP 0.318 uF
+ * KG 0.022
+ *
+ */
+
+ /* Terminal definitions for calling netlists */
+
+ ALIAS(PLUS, G1.IP) // Positive input
+ ALIAS(MINUS, G1.IN) // Negative input
+ ALIAS(OUT, EBUF.OP) // Opamp output ...
+
+ AFUNC(fUH, 1, "A0 1.2 -")
+ AFUNC(fUL, 1, "A0 1.2 +")
+
+ ALIAS(VCC, fUH.A0) // VCC terminal
+ ALIAS(GND, fUL.A0) // VGND terminal
+
+ AFUNC(fVREF, 2, "A0 A1 + 0.5 *")
+ NET_C(fUH.A0, fVREF.A0)
+ NET_C(fUL.A0, fVREF.A1)
+
+ NET_C(EBUF.ON, fVREF)
+ /* The opamp model */
+
+ LVCCS(G1)
+ PARAM(G1.RI, RES_K(1000))
+#if 0
+ PARAM(G1.G, 0.0022)
+ RES(RP1, 1e6)
+ CAP(CP1, 0.0318e-6)
+#else
+ PARAM(G1.G, 0.002)
+ PARAM(G1.CURLIM, 0.002)
+ RES(RP1, 9.5e6)
+ CAP(CP1, 0.0033e-6)
+#endif
+ VCVS(EBUF)
+ PARAM(EBUF.RO, 50)
+ PARAM(EBUF.G, 1)
+
+ NET_C(G1.ON, fVREF)
+ NET_C(RP1.2, fVREF)
+ NET_C(CP1.2, fVREF)
+ NET_C(EBUF.IN, fVREF)
+
+ NET_C(RP1.1, G1.OP)
+ NET_C(CP1.1, RP1.1)
+
+ DIODE(DP,"D(IS=1e-15 N=1)")
+ DIODE(DN,"D(IS=1e-15 N=1)")
+#if 1
+ NET_C(DP.K, fUH.Q)
+ NET_C(fUL.Q, DN.A)
+ NET_C(DP.A, DN.K, RP1.1)
+#else
+ /*
+ * This doesn't add any performance by decreasing iteration loops.
+ * To the contrary, it significantly decreases iterations
+ */
+ RES(RH1, 0.1)
+ RES(RL1, 0.1)
+ NET_C(DP.K, RH1.1)
+ NET_C(RH1.2, fUH.Q)
+ NET_C(fUL.Q, RL1.1)
+ NET_C(RL1.2, DN.A)
+ NET_C(DP.A, DN.K, RP1.1)
+
+#endif
+ NET_C(EBUF.IP, RP1.1)
+
+NETLIST_END()
diff --git a/src/lib/netlist/examples/opamp_amplification_curve.cpp b/src/lib/netlist/examples/opamp_amplification_curve.cpp
new file mode 100644
index 00000000000..e1665244b0e
--- /dev/null
+++ b/src/lib/netlist/examples/opamp_amplification_curve.cpp
@@ -0,0 +1,94 @@
+// license:GPL-2.0+
+// copyright-holders:Couriersud
+/*
+ * Script to analyze opamp amplification as a function of frequency.
+ *
+ * ./nltool -t 0.5 -f nl_examples/opamp_amplification_curve.cpp
+ *
+ * t=0.0: 10 Hz
+ * t=0.1: 100 Hz
+ * t=0.2: 1000 Hz
+ * t=0.3: 10000 Hz
+ * t=0.4: 100000 Hz
+ * ....
+ *
+ * ./plot_nl.sh --log Y Z
+ */
+
+
+#include "netlist/devices/net_lib.h"
+
+#define OPAMP_TEST "MB3614(DAB=0.0015)"
+
+NETLIST_START(main)
+
+ /* Standard stuff */
+
+ //VARCLOCK(clk, "0.5 / pow(10, 1 + T * 4)")
+ //CLOCK(clk, 1000)
+ SOLVER(Solver, 48000)
+ PARAM(Solver.ACCURACY, 1e-7)
+ PARAM(Solver.NR_LOOPS, 300)
+ PARAM(Solver.DYNAMIC_TS, 1)
+ PARAM(Solver.DYNAMIC_MIN_TIMESTEP, 1e-7)
+
+ VS(vs, 0)
+ /*
+ * Having f(t)=sin(g(t)*t) the derivative becomes
+ *
+ * f'(t) = d/dt(g(t)*t) * cos(g(t)*t)
+ *
+ * w(t) = d/dt(g(t)*t) = 2*pi*freq(t) is the angular frequency at time t
+ *
+ * choosing freq(t) = pow(10, a+b*t) and integrating we get
+ *
+ * g(t)*t = 2 * pi /(b*ln(10)) * (pow(10, a+b*t)-pow(10,a))
+ */
+
+ PARAM(vs.FUNC, "0.001 * sin(0.2728752708 * (pow(10, 1 + 10*T) - 10))")
+
+ /*
+ * Stepwise ... same as above
+ */
+ //PARAM(vs.FUNC, "0.001 * sin(6.28 * pow(10, trunc((1 + T * 10)*10)/10) * T)")
+
+ /*
+ * Fixed Frequency:
+ * PARAM(vs.FUNC, "1.001 * sin(6.28 * 100 * T)")
+ */
+ PARAM(vs.R, 0.001)
+ ALIAS(clk, vs.1)
+ NET_C(vs.2, GND)
+ ANALOG_INPUT(V12, 12)
+ ANALOG_INPUT(VM12, -12)
+
+ OPAMP(op, OPAMP_TEST)
+
+ NET_C(op.GND, VM12)
+ NET_C(op.VCC, V12)
+
+ /* Opamp B wired as inverting amplifier connected to output of first opamp */
+
+ RES(R1, 100)
+ RES(RP, 100)
+ RES(R2, 10000000)
+
+ NET_C(op.PLUS, RP.1)
+ NET_C(RP.2, GND)
+ NET_C(op.MINUS, R2.2)
+ NET_C(op.MINUS, R1.2)
+
+ NET_C(clk, R1.1)
+ NET_C(op.OUT, R2.1)
+
+ RES(RL, 2000)
+ NET_C(RL.2, GND)
+ NET_C(RL.1, op.OUT)
+
+ AFUNC(f, 1, "A0 * 1000")
+ NET_C(f.A0, op.OUT)
+#if 1
+ LOG(log_Y, R1.1)
+ LOG(log_Z, f)
+#endif
+NETLIST_END()
diff --git a/src/lib/netlist/examples/rc.c b/src/lib/netlist/examples/rc.c
new file mode 100644
index 00000000000..1850da313da
--- /dev/null
+++ b/src/lib/netlist/examples/rc.c
@@ -0,0 +1,31 @@
+/*
+ * cdelay.c
+ *
+ */
+
+#include "netlist/devices/net_lib.h"
+
+NETLIST_START(rc)
+
+ /*
+ * delay circuit
+ *
+ */
+
+ /* Standard stuff */
+
+ SOLVER(Solver, 48000)
+ PARAM(Solver.ACCURACY, 1e-6)
+ CLOCK(clk, 20000)
+
+ CAP(C1, 0.022e-6)
+ RES(R1, 10000)
+ RES(R2, 20000)
+
+ NET_C(clk, R2.1)
+ NET_C(R2.2, R1.1, C1.1)
+ NET_C(C1.2, R1.2, GND)
+
+ LOG(tt, C1.1)
+
+NETLIST_END()
diff --git a/src/lib/netlist/examples/rl.c b/src/lib/netlist/examples/rl.c
new file mode 100644
index 00000000000..2848348c440
--- /dev/null
+++ b/src/lib/netlist/examples/rl.c
@@ -0,0 +1,32 @@
+/*
+ * lr.c
+ *
+ */
+
+#include "netlist/devices/net_lib.h"
+
+NETLIST_START(lr)
+
+ /*
+ * delay circuit
+ *
+ */
+
+ /* Standard stuff */
+
+ SOLVER(Solver, 48000)
+ PARAM(Solver.ACCURACY, 1e-6)
+ CLOCK(clk, 50)
+ PARAM(Solver.METHOD, "MAT_CR")
+
+ IND(L1, 10)
+ RES(R1, 10000)
+
+ NET_C(clk, L1.1)
+ NET_C(L1.2, R1.1)
+ NET_C(R1.2, GND)
+
+ //LOG(log_1, R1.1)
+ //LOG(log_2, clk)
+
+NETLIST_END()
diff --git a/src/lib/netlist/examples/sn74ls629_osc.c b/src/lib/netlist/examples/sn74ls629_osc.c
new file mode 100644
index 00000000000..f40c464f55c
--- /dev/null
+++ b/src/lib/netlist/examples/sn74ls629_osc.c
@@ -0,0 +1,34 @@
+// license:GPL-2.0+
+// copyright-holders:Couriersud
+/*
+ * ne555_astable.c
+ *
+ */
+
+#include "netlist/devices/net_lib.h"
+
+NETLIST_START(ls629)
+
+ /*
+ * Astable ne555
+ *
+ */
+
+ /* Standard stuff */
+
+ SOLVER(Solver, 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/src/lib/netlist/examples/test.c b/src/lib/netlist/examples/test.c
new file mode 100644
index 00000000000..9a75dd3ad91
--- /dev/null
+++ b/src/lib/netlist/examples/test.c
@@ -0,0 +1,87 @@
+// license:GPL-2.0+
+// copyright-holders:Couriersud
+/*
+ * bjt.c
+ *
+ */
+
+// CURRENTLY BROKEN
+
+#include "netlist/devices/net_lib.h"
+
+NETLIST_START(bjt)
+ /* Standard stuff */
+
+ CLOCK(clk, 1000) // 1000 Hz
+ SOLVER(Solver, 48000)
+
+ ANALOG_INPUT(V3, 3)
+ ANALOG_INPUT(STOPG, 0)
+ ALIAS(SRSTQ, RYf.2)
+ ALIAS(SRST, RYc.2)
+ NET_C(antenna, GND)
+ ALIAS(runQ, Q1.C)
+
+ TTL_7404_INVERT(e4d, STOPG)
+
+ RES(RYf, 50) // output impedance
+ RES(RYc, 50) // output impedance
+
+ TTL_7404_INVERT(c9f, RYc.2)
+ TTL_7404_INVERT(c9c, RYf.2)
+ NET_C(c9f.Q, RYf.1)
+ NET_C(c9c.Q, RYc.1)
+
+ SWITCH2(coinsw, RYc.2, RYf.2)
+
+ NET_C(coinsw.Q, GND)
+
+ /* Antenna circuit */
+ /* Also has a diode to clamp negative voltages - omitted here */
+ NETDEV_QNPN(Q3, BC237B)
+ ALIAS(antenna, Q3.B)
+ NET_C(GND, Q3.E)
+ RES(RX5, 100)
+ CAP(CX1, 100)
+ NET_C(RX5.1, CX1.1)
+ NET_C(RX5.1, Q3.C)
+ NET_C(RX5.2, GND)
+ NET_C(CX1.2, GND)
+ NETDEV_QNPN(Q1, BC237B)
+ NET_C(Q1.B, RX5.1)
+ NET_C(Q1.E, GND)
+
+ DIODE(D3, 1N914)
+ NET_C(D3.A, Q1.C)
+ NET_C(D3.K, SRSTQ)
+
+ DIODE(D2, 1N914)
+ RES(RX4, 220)
+ NET_C(D2.K, e4d.Q)
+ NET_C(D2.A, RX4.1)
+ NET_C(RX4.2, Q3.C)
+
+ RES(RX1, 100)
+ RES(RX2, 100)
+ RES(RX3, 330)
+ CAP(CX2, CAP_U(0.1))
+
+ NET_C(RX3.2, D3.A)
+ NET_C(RX3.1, RX1.2)
+ NET_C(RX1.1, V3)
+
+ NET_C(RX1.1, CX2.1)
+ NET_C(RX1.2, CX2.2)
+
+ NETDEV_QPNP(Q2, BC556B)
+ NET_C(Q2.E, V3)
+ NET_C(Q2.B, RX1.2)
+ NET_C(Q2.C, RX2.2)
+
+ NET_C(RX2.1, D2.A)
+
+
+ //LOG(logB, Q1.B)
+ //LOG(logC, Q1.C)
+
+NETLIST_END()
diff --git a/src/lib/netlist/examples/todo.c b/src/lib/netlist/examples/todo.c
new file mode 100644
index 00000000000..62c713e86fd
--- /dev/null
+++ b/src/lib/netlist/examples/todo.c
@@ -0,0 +1,140 @@
+// license:GPL-2.0+
+// copyright-holders:Couriersud
+/*
+ * todo.c
+ *
+ */
+
+#include "netlist/devices/net_lib.h"
+
+NETLIST_START(7400_TTL)
+ NET_REGISTER_DEV(7400, s1)
+ NET_REGISTER_DEV(7400, s2)
+ NET_REGISTER_DEV(7400, s3)
+ NET_REGISTER_DEV(7400, s4)
+
+ ALIAS(1, s1.A);
+ ALIAS(2, s1.B);
+ ALIAS(3, s1.Q);
+
+ ALIAS(4, s2.A);
+ ALIAS(5, s2.B);
+ ALIAS(6, s2.Q);
+
+ ALIAS(9, s3.A);
+ ALIAS(10, s3.B)
+ ALIAS(8, s3.Q);
+
+ ALIAS(12, s4.A);
+ ALIAS(13, s4.B);
+ ALIAS(11, s4.Q);
+
+NETLIST_END()
+
+NETLIST_START(lib)
+ TRUTHTABLE_START(7400A, 2, 1, 0, "+A,B")
+ TT_HEAD(" A , B | Q ")
+ TT_LINE(" 0 , X | 1 |22")
+ TT_LINE(" X , 0 | 1 |22")
+ TT_LINE(" 1 , 1 | 0 |15")
+ TRUTHTABLE_END()
+NETLIST_END()
+
+
+
+#if 0
+ RES(R1, 10)
+ RES(R2, 10)
+ RES(R3, 10)
+ NET_C(V5,R1.1)
+ NET_C(R1.2, R2.1)
+ NET_C(R2.2, R3.1)
+ NET_C(R3.2, GND)
+#endif
+#if 0
+ RES(R4, 1000)
+ CAP(C1, 1e-6)
+ NET_C(V5,R4.1)
+ NET_C(R4.2, C1.1)
+ NET_C(C1.2, GND)
+ //LOG(log1, C1.1)
+#endif
+
+#if 0
+ RES(R5, 1000)
+ NETDEV_1N914(D1)
+ NET_C(V5, R5.1)
+ NET_C(R5.2, D1.A)
+ NET_C(D1.K, GND)
+ //LOG(log1, D1.A)
+#endif
+
+#if 0
+#endif
+
+#if 0
+ NETDEV_VCVS(VV)
+ RES(R1, 1000)
+ RES(R2, 10000)
+
+ NET_C(V5, R1.1)
+ NET_C(R1.2, VV.IN)
+ NET_C(R2.1, VV.OP)
+ NET_C(R2.2, VV.IN)
+ NET_C(VV.ON, GND)
+ NET_C(VV.IP, GND)
+ LOG(logX, VV.OP)
+
+#endif
+
+#if 0
+#endif
+
+#if 0
+ NETDEV_VCVS(VV)
+ PARAM(VV.G, 100000) // typical OP-AMP amplification
+ PARAM(VV.RO, 50) // typical OP-AMP amplification
+ RES(R1, 1000)
+ RES(R3, 10000) // ==> 10x amplification (inverting)
+
+ NET_C(4V, R1.1)
+ NET_C(R1.2, VV.IN)
+ NET_C(R3.1, VV.IN)
+ NET_C(R3.2, VV.OP)
+ NET_C(VV.ON, GND)
+ NET_C(VV.IP, GND)
+ LOG(logX, VV.OP)
+ LOG(logY, 4V)
+
+#endif
+
+#if 0
+ // Impedance converter with resistor
+ NETDEV_VCVS(VV)
+ PARAM(VV.G, 100000) // typical OP-AMP amplification
+ PARAM(VV.RO, 50) // typical OP-AMP amplification
+ RES(R3, 10000)
+
+ NET_C(4V, VV.IP)
+ NET_C(R3.1, VV.IN)
+ NET_C(R3.2, VV.OP)
+ NET_C(VV.ON, GND)
+ LOG(logX, VV.OP)
+ LOG(logY, 4V)
+
+#endif
+
+#if 0
+ // Impedance converter without resistor
+ NETDEV_VCVS(VV)
+ PARAM(VV.G, 100000) // typical OP-AMP amplification
+ PARAM(VV.RO, 50) // typical OP-AMP amplification
+
+ NET_C(4V, VV.IP)
+ NET_C(VV.IN, VV.OP)
+ NET_C(VV.ON, GND)
+ LOG(logX, VV.OP)
+ LOG(logY, 4V)
+
+#endif
+
diff --git a/src/lib/netlist/examples/vccs.c b/src/lib/netlist/examples/vccs.c
new file mode 100644
index 00000000000..27ebf5a64e0
--- /dev/null
+++ b/src/lib/netlist/examples/vccs.c
@@ -0,0 +1,30 @@
+// license:GPL-2.0+
+// copyright-holders:Couriersud
+/*
+ * 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.GS_LOOPS, 10000)
+
+ 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/src/lib/netlist/examples/vccs1.c b/src/lib/netlist/examples/vccs1.c
new file mode 100644
index 00000000000..7e6dd1ea48c
--- /dev/null
+++ b/src/lib/netlist/examples/vccs1.c
@@ -0,0 +1,35 @@
+// license:GPL-2.0+
+// copyright-holders:Couriersud
+/*
+ * vccs.c
+ *
+ */
+
+
+#include "netlist/devices/net_lib.h"
+
+NETLIST_START(vccs)
+
+ CLOCK(clk, 1000) // 1000 Hz
+ SOLVER(Solver, 48000)
+ PARAM(Solver.ACCURACY, 1e-6)
+
+
+ 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()
diff --git a/src/lib/netlist/examples/vs.c b/src/lib/netlist/examples/vs.c
new file mode 100644
index 00000000000..7d72398e297
--- /dev/null
+++ b/src/lib/netlist/examples/vs.c
@@ -0,0 +1,32 @@
+// license:GPL-2.0+
+// copyright-holders:Couriersud
+/*
+ * vs_cs.c
+ *
+ * Voltage and current source test
+ *
+ */
+
+#include "netlist/devices/net_lib.h"
+
+NETLIST_START(vs)
+
+ /* Standard stuff */
+
+ SOLVER(Solver, 480)
+ PARAM(Solver.ACCURACY, 1e-6)
+ PARAM(Solver.METHOD, "MAT_CR")
+ PARAM(Solver.DYNAMIC_TS, 1)
+
+ RES(R1, 1000)
+ VS(VS1, 1)
+ PARAM(VS1.R, 1)
+ PARAM(VS1.FUNC, "T 10000.0 * sin 1.0 +")
+ NET_C(R1.1, VS1.P)
+ NET_C(R1.2, VS1.N)
+ NET_C(GND, VS1.N)
+
+ //LOG(tt, VS1.P)
+ //LOG(tt1, R1.1)
+
+NETLIST_END()
diff --git a/src/lib/netlist/examples/vs_cs.c b/src/lib/netlist/examples/vs_cs.c
new file mode 100644
index 00000000000..9b39106a540
--- /dev/null
+++ b/src/lib/netlist/examples/vs_cs.c
@@ -0,0 +1,52 @@
+// license:GPL-2.0+
+// copyright-holders:Couriersud
+/*
+ * vs_cs.c
+ *
+ * Voltage and current source test
+ *
+ */
+
+#include "netlist/devices/net_lib.h"
+
+NETLIST_START(rc)
+
+ /*
+ * delay circuit
+ *
+ */
+
+ /* Standard stuff */
+
+ SOLVER(Solver, 48000)
+ PARAM(Solver.ACCURACY, 1e-6)
+ CLOCK(clk, 20000)
+
+ /* Voltage source. Inner resistance will make clock visible */
+
+ RES(R1, 1000)
+ VS(VS1, 1)
+ NET_C(R1.1, clk)
+ NET_C(R1.2, VS1.P)
+ NET_C(GND, VS1.N)
+
+ /* Current source. Current flows from "+" to "-", thus for a source we
+ * need negative current
+ */
+
+ RES(R2, 1000)
+ RES(R3, 1000)
+ CS(CS1, -0.001)
+ NET_C(CS1.P, R2.1)
+ NET_C(R2.2, R3.1)
+ NET_C(GND, CS1.N, R3.2)
+
+ CAP(C1, CAP_U(1))
+ NET_C(C1.1, R3.1)
+ NET_C(C1.2, R3.2)
+
+
+ LOG(tt, VS1.P)
+ LOG(tx, R2.2)
+
+NETLIST_END()