summaryrefslogtreecommitdiffstatshomepage
path: root/nl_examples/7400_astable.c
diff options
context:
space:
mode:
author Couriersud <couriersud@users.noreply.github.com>2013-12-31 15:35:08 +0000
committer Couriersud <couriersud@users.noreply.github.com>2013-12-31 15:35:08 +0000
commita8a62c3212fe7b0793d580d3fcbacd190485aa30 (patch)
treeb5a43fa5d88898b81d22a1a751396558add6fa77 /nl_examples/7400_astable.c
parentce8e8234f0b1316c06d9871bc35e55751351f466 (diff)
Enhanced the netlist parser and cleaned pong.c. Also added a folder nl_examples which contains standalone netlist examples. [couriersud]
The examples have a ".c" suffix. In eclipse, I get automatic syntax parsing and error notifications. The parser treats "#" preprocessor defines/includes just as comments. All of these examples can be run through nltool: ./nltool -f nl_examples/opamp.c -t 1 -l OUT runs the opamp example for 1 second of emulation time and logs the terminal named "OUT" to "netlist_log_OUT.log". I'll post a simple script to the list to visualize those logs using gnuplot.
Diffstat (limited to 'nl_examples/7400_astable.c')
-rw-r--r--nl_examples/7400_astable.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/nl_examples/7400_astable.c b/nl_examples/7400_astable.c
new file mode 100644
index 00000000000..d16e43392fd
--- /dev/null
+++ b/nl_examples/7400_astable.c
@@ -0,0 +1,33 @@
+/*
+ * 7400_astable.c
+ *
+ */
+
+#include "netlist/devices/net_lib.h"
+
+NETLIST_START(7400_astable)
+
+ /*
+ * Astable multivibrator using two 7400 gates (or inverters)
+ *
+ */
+
+ /* Standard stuff */
+
+ NETDEV_SOLVER(Solver)
+ NETDEV_PARAM(Solver.FREQ, 48000)
+
+ // astable NAND Multivibrator
+ NETDEV_R(R1, 1000)
+ NETDEV_C(C1, 1e-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)
+
+ NETDEV_LOG(log2, C1.2)
+ //NETDEV_LOG(log2, n1.Q)
+ NETDEV_LOG(log3, n2.Q)
+
+NETLIST_END()