mame/nl_examples/7400_astable.c
Couriersud a8a62c3212 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.
2013-12-31 15:35:08 +00:00

34 lines
583 B
C

/*
* 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()