Rewrote nl_dice_compat.h so that it can be used to support

DICE to netlist syntax conversions. Example script included in the
header. (nw)
This commit is contained in:
couriersud 2015-05-17 01:01:02 +02:00
parent 535b12d4bf
commit 3d1f7e4a52

View File

@ -2,6 +2,22 @@
// copyright-holders:Couriersud
/*
* nl_dice_compat.h
*
* The follwoing script will convert a circuit using dice syntax into netlist
* syntax. It's not fail proof, but eases the manual work involved significantly.
sed -e 's/#define \(.*\)"\(.*\)"[ \t]*,[ \t]*\(.*\)/NET_ALIAS(\1,\2.\3)/' src/mame/drivers/nl_breakout.c \
| sed -e 's/^[ \t]*$/NL_EMPTY /' \
| cpp -I src/emu -I src/osd/ -DNL_CONVERT_CPP -P -CC - \
| sed -e 's/\(TTL_.*\)("\(.*\)")/\1(\2)/' \
| sed -e 's/CONNECTION(\(.*\),[ \t]*"\(.*\)", \(.*\))/NET_C(\1, \2.\3)/' \
| sed -e 's/CONNECTION("\(.*\)",[ \t]*\(.*\), \(.*\))/NET_C(\1.\2, \3)/' \
| sed -e 's/NET_C("\(.*\)", \(.*\), \(.*\))/NET_C(\1.\2, \3)/' \
| sed -e 's/) RES(/)\n RES(/g' \
| sed -e 's/) CAP(/)\n CAP(/g' \
| sed -e 's/) NET_C(/)\n NET_C(/g' \
| sed -e 's/NL_EMPTY//' \
*
*/
@ -12,6 +28,7 @@
#include "netlist/devices/net_lib.h"
#include "netlist/analog/nld_twoterm.h"
#endif
/* --------------------------------------------------------------------
* Compatibility macros for DICE netlists ...
* -------------------------------------------------------------------- */
@ -34,14 +51,6 @@
#define CONNECTIONX(_a, _b, _c, _d) setup.register_link(_a "." # _b, _c "." # _d);
#define NET_CSTR(_a, _b) setup.register_link( _a, _b);
#else
#define CHIP(_n, _t) TTL_ ## _t ## _DIP(_n)
#endif
#define CIRCUIT_LAYOUT(x) NETLIST_START(x)
#define CIRCUIT_LAYOUT_END NETLIST_END()
#define OHM(x) (x)
#define K_OHM(x) ((x) * 1000.0)
#define M_OHM(x) ((x) * 1.0e6)
@ -88,6 +97,22 @@ public:
CapacitorDesc(nl_double cap) : SeriesRCDesc(0.0, cap) { }
};
#else
#define CHIP(_n, _t) TTL_ ## _t ## _DIP(_n)
#define OHM(x) x
#define K_OHM(x) RES_K(X)
#define M_OHM(x) RES_M(X)
#define U_FARAD(x) CAP_U(x)
#define N_FARAD(x) CAP_N(x)
#define P_FARAD(x) CAP_P(x)
#endif
#define CIRCUIT_LAYOUT(x) NETLIST_START(x)
#define CIRCUIT_LAYOUT_END NETLIST_END()
#define CHIP_555_Mono(_name, _pdesc) \
CHIP(# _name, NE555) \
NET_C(_name.6, _name.7) \