summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/examples/cmos_inverter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/netlist/examples/cmos_inverter.cpp')
-rw-r--r--src/lib/netlist/examples/cmos_inverter.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/lib/netlist/examples/cmos_inverter.cpp b/src/lib/netlist/examples/cmos_inverter.cpp
new file mode 100644
index 00000000000..3db470744b7
--- /dev/null
+++ b/src/lib/netlist/examples/cmos_inverter.cpp
@@ -0,0 +1,50 @@
+// license:CC0-1.0
+// copyright-holders:Couriersud
+/*
+ * bjt.c
+ *
+ */
+
+
+#include "netlist/devices/net_lib.h"
+
+NETLIST_START(cmos_inverter)
+{
+ /* Standard stuff */
+
+ //EXTERNAL_SOURCE(modules_lib)
+
+ //INCLUDE(modules_lib)
+
+ SOLVER(Solver, 48000)
+ PARAM(Solver.ACCURACY, 1e-7)
+ PARAM(Solver.NR_LOOPS, 50)
+ PARAM(Solver.METHOD, "MAT_CR")
+ ANALOG_INPUT(V5, 5)
+
+ RTEST(X)
+ NET_C(X.1, V5)
+ NET_C(X.2, GND)
+
+ 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)
+
+}