diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/netlist/analog/nld_bjt.h | 3 | ||||
-rw-r--r-- | src/lib/netlist/analog/nld_fourterm.h | 3 | ||||
-rw-r--r-- | src/lib/netlist/analog/nld_opamps.cpp | 3 | ||||
-rw-r--r-- | src/lib/netlist/analog/nld_opamps.h | 3 | ||||
-rw-r--r-- | src/lib/netlist/analog/nld_switches.h | 3 | ||||
-rw-r--r-- | src/lib/netlist/analog/nld_twoterm.h | 4 | ||||
-rw-r--r-- | src/lib/netlist/devices/net_lib.cpp | 5 | ||||
-rw-r--r-- | src/lib/netlist/devices/net_lib.h | 22 | ||||
-rw-r--r-- | src/lib/netlist/devices/nld_7448.h | 4 | ||||
-rw-r--r-- | src/lib/netlist/devices/nld_system.h | 4 | ||||
-rw-r--r-- | src/lib/netlist/macro/nlm_cd4xxx.h | 3 | ||||
-rw-r--r-- | src/lib/netlist/macro/nlm_opamp.h | 4 | ||||
-rw-r--r-- | src/lib/netlist/macro/nlm_other.h | 3 | ||||
-rw-r--r-- | src/lib/netlist/macro/nlm_ttl74xx.h | 4 | ||||
-rw-r--r-- | src/lib/netlist/nl_base.cpp | 3 | ||||
-rw-r--r-- | src/lib/netlist/nl_setup.cpp | 2 | ||||
-rw-r--r-- | src/lib/netlist/nl_setup.h | 3 | ||||
-rw-r--r-- | src/lib/netlist/prg/nltool.cpp | 70 | ||||
-rw-r--r-- | src/lib/netlist/solver/nld_solver.h | 3 | ||||
-rw-r--r-- | src/mame/machine/nl_pongd.cpp | 1 |
20 files changed, 139 insertions, 11 deletions
diff --git a/src/lib/netlist/analog/nld_bjt.h b/src/lib/netlist/analog/nld_bjt.h index a4e163b13bc..eb2b4071ae4 100644 --- a/src/lib/netlist/analog/nld_bjt.h +++ b/src/lib/netlist/analog/nld_bjt.h @@ -15,6 +15,8 @@ // Macros // ----------------------------------------------------------------------------- +#ifndef NL_AUTO_DEVICES + #define QBJT_SW(name, model) \ NET_REGISTER_DEV(QBJT_SW, name) \ NETDEV_PARAMI(name, MODEL, model) @@ -23,6 +25,7 @@ NET_REGISTER_DEV(QBJT_EB, name) \ NETDEV_PARAMI(name, MODEL, model) +#endif namespace netlist { diff --git a/src/lib/netlist/analog/nld_fourterm.h b/src/lib/netlist/analog/nld_fourterm.h index 0e4bcc03429..3861d57f6ad 100644 --- a/src/lib/netlist/analog/nld_fourterm.h +++ b/src/lib/netlist/analog/nld_fourterm.h @@ -15,6 +15,7 @@ // ---------------------------------------------------------------------------------------- // Macros // ---------------------------------------------------------------------------------------- +#ifndef NL_AUTO_DEVICES #define VCCS(name) \ NET_REGISTER_DEV(VCCS, name) @@ -28,6 +29,8 @@ #define LVCCS(name) \ NET_REGISTER_DEV(LVCCS, name) +#endif + namespace netlist { namespace analog diff --git a/src/lib/netlist/analog/nld_opamps.cpp b/src/lib/netlist/analog/nld_opamps.cpp index e777ffb791c..ff64516186b 100644 --- a/src/lib/netlist/analog/nld_opamps.cpp +++ b/src/lib/netlist/analog/nld_opamps.cpp @@ -5,9 +5,10 @@ * */ -#include "nld_opamps.h" #include "devices/net_lib.h" +#include "nld_opamps.h" + namespace netlist { diff --git a/src/lib/netlist/analog/nld_opamps.h b/src/lib/netlist/analog/nld_opamps.h index b407bb2215e..32903b7fa3e 100644 --- a/src/lib/netlist/analog/nld_opamps.h +++ b/src/lib/netlist/analog/nld_opamps.h @@ -19,10 +19,13 @@ // Macros // ---------------------------------------------------------------------------------------- +#ifndef NL_AUTO_DEVICES + #define OPAMP(name, model) \ NET_REGISTER_DEV(OPAMP, name) \ NETDEV_PARAMI(name, MODEL, model) +#endif // ---------------------------------------------------------------------------------------- // Devices ... // ---------------------------------------------------------------------------------------- diff --git a/src/lib/netlist/analog/nld_switches.h b/src/lib/netlist/analog/nld_switches.h index d91cf775377..e557b67c0fe 100644 --- a/src/lib/netlist/analog/nld_switches.h +++ b/src/lib/netlist/analog/nld_switches.h @@ -17,11 +17,14 @@ // Macros // ---------------------------------------------------------------------------------------- +#ifndef NL_AUTO_DEVICES + #define SWITCH(name) \ NET_REGISTER_DEV(SWITCH, name) #define SWITCH2(name) \ NET_REGISTER_DEV(SWITCH2, name) +#endif #endif /* NLD_SWITCHES_H_ */ diff --git a/src/lib/netlist/analog/nld_twoterm.h b/src/lib/netlist/analog/nld_twoterm.h index 06325679dff..5edceb63ece 100644 --- a/src/lib/netlist/analog/nld_twoterm.h +++ b/src/lib/netlist/analog/nld_twoterm.h @@ -39,6 +39,8 @@ // Macros // ----------------------------------------------------------------------------- +#ifndef NL_AUTO_DEVICES + #define RES(name, p_R) \ NET_REGISTER_DEV(RES, name) \ NETDEV_PARAMI(name, R, p_R) @@ -74,6 +76,8 @@ NET_REGISTER_DEV(CS, name) \ NETDEV_PARAMI(name, I, pI) +#endif + // ----------------------------------------------------------------------------- // Generic macros // ----------------------------------------------------------------------------- diff --git a/src/lib/netlist/devices/net_lib.cpp b/src/lib/netlist/devices/net_lib.cpp index 502f044ec76..661f4e63b4e 100644 --- a/src/lib/netlist/devices/net_lib.cpp +++ b/src/lib/netlist/devices/net_lib.cpp @@ -9,7 +9,6 @@ ****************************************************************************/ #include "net_lib.h" -#include "nld_system.h" #include "nl_factory.h" #include "solver/nld_solver.h" @@ -54,7 +53,7 @@ static void initialize_factory(factory::list_t &factory) ENTRYX(log, LOG, "+I") ENTRYX(logD, LOGD, "+I,+I2") ENTRYX(clock, CLOCK, "FREQ") - ENTRYX(extclock, EXTCLOCK, "FREQ") + ENTRYX(extclock, EXTCLOCK, "FREQ,PATTERN") ENTRYX(mainclock, MAINCLOCK, "FREQ") ENTRYX(gnd, GND, "") ENTRYX(netlistparams, PARAMETER, "") @@ -62,7 +61,7 @@ static void initialize_factory(factory::list_t &factory) ENTRYX(res_sw, RES_SWITCH, "+IN,+P1,+P2") ENTRYX(switch1, SWITCH, "") ENTRYX(switch2, SWITCH2, "") - ENTRYX(nicRSFF, NETDEV_RSFF, "+S,+R") + ENTRYX(nicRSFF, NETDEV_RSFF, "") ENTRYX(nicDelay, NETDEV_DELAY, "") ENTRYX(2716, EPROM_2716, "+GQ,+EPQ,+A0,+A1,+A2,+A3,+A4,+A5,+A6,+A7,+A8,+A9,+A10") ENTRYX(2102A, RAM_2102A, "+CEQ,+A0,+A1,+A2,+A3,+A4,+A5,+A6,+A7,+A8,+A9,+RWQ,+DI") diff --git a/src/lib/netlist/devices/net_lib.h b/src/lib/netlist/devices/net_lib.h index 9bbd9db744a..d12d7fcceb2 100644 --- a/src/lib/netlist/devices/net_lib.h +++ b/src/lib/netlist/devices/net_lib.h @@ -12,6 +12,27 @@ #define NET_LIB_H #include "nl_base.h" + +//#define NL_AUTO_DEVICES 1 + +#ifdef NL_AUTO_DEVICES +#include "nld_devinc.h" + +#include "analog/nld_bjt.h" +#include "analog/nld_fourterm.h" +#include "analog/nld_switches.h" +#include "analog/nld_twoterm.h" +#include "analog/nld_opamps.h" +#include "solver/nld_solver.h" + +#include "macro/nlm_cd4xxx.h" +#include "macro/nlm_ttl74xx.h" +#include "macro/nlm_opamp.h" +#include "macro/nlm_other.h" + +#include "nld_7448.h" + +#else #include "nld_system.h" #include "nld_2102A.h" @@ -75,6 +96,7 @@ #include "solver/nld_solver.h" #include "nld_legacy.h" +#endif namespace netlist { void initialize_factory(factory::list_t &factory); diff --git a/src/lib/netlist/devices/nld_7448.h b/src/lib/netlist/devices/nld_7448.h index 199b46343a8..c45a3cbe56a 100644 --- a/src/lib/netlist/devices/nld_7448.h +++ b/src/lib/netlist/devices/nld_7448.h @@ -34,6 +34,8 @@ #define USE_TRUTHTABLE_7448 (0) +#ifndef NL_AUTO_DEVICES + #define TTL_7448(name, cA0, cA1, cA2, cA3, cLTQ, cBIQ, cRBIQ) \ NET_REGISTER_DEV(TTL_7448, name) \ NET_CONNECT(name, A, cA0) \ @@ -47,4 +49,6 @@ #define TTL_7448_DIP(name) \ NET_REGISTER_DEV(TTL_7448_DIP, name) +#endif + #endif /* NLD_7448_H_ */ diff --git a/src/lib/netlist/devices/nld_system.h b/src/lib/netlist/devices/nld_system.h index 738ceb2a171..46781fe2884 100644 --- a/src/lib/netlist/devices/nld_system.h +++ b/src/lib/netlist/devices/nld_system.h @@ -54,9 +54,6 @@ NET_C(cG, name.G) \ NET_C(cOUT, name.Q) -#define OPTIMIZE_FRONTIER(attach, r_in, r_out) \ - setup.register_frontier(# attach, r_in, r_out); - #define RES_SWITCH(name, cIN, cP1, cP2) \ NET_REGISTER_DEV(RES_SWITCH, name) \ NET_C(cIN, name.I) \ @@ -72,4 +69,5 @@ PARAM(name.N, p_N) \ PARAM(name.FUNC, p_F) + #endif /* NLD_SYSTEM_H_ */ diff --git a/src/lib/netlist/macro/nlm_cd4xxx.h b/src/lib/netlist/macro/nlm_cd4xxx.h index de10ff7a64d..446c2d6e435 100644 --- a/src/lib/netlist/macro/nlm_cd4xxx.h +++ b/src/lib/netlist/macro/nlm_cd4xxx.h @@ -22,6 +22,8 @@ * Netlist Macros * ---------------------------------------------------------------------------*/ +#ifndef NL_AUTO_DEVICES + #define CD4001_NOR(name) \ NET_REGISTER_DEV(CD4001_NOR, name) @@ -44,6 +46,7 @@ #define CD4316_DIP(name) \ NET_REGISTER_DEV(CD4016_DIP, name) +#endif /* ---------------------------------------------------------------------------- * External declarations * ---------------------------------------------------------------------------*/ diff --git a/src/lib/netlist/macro/nlm_opamp.h b/src/lib/netlist/macro/nlm_opamp.h index 6e3c1f615e7..ec717fdb2dc 100644 --- a/src/lib/netlist/macro/nlm_opamp.h +++ b/src/lib/netlist/macro/nlm_opamp.h @@ -11,6 +11,8 @@ * Netlist Macros * ---------------------------------------------------------------------------*/ +#ifndef NL_AUTO_DEVICES + #define MB3614_DIP(name) \ NET_REGISTER_DEV(MB3614_DIP, name) @@ -23,6 +25,8 @@ #define LM3900(name) \ NET_REGISTER_DEV(LM3900, name) +#endif + /* ---------------------------------------------------------------------------- * External declarations * ---------------------------------------------------------------------------*/ diff --git a/src/lib/netlist/macro/nlm_other.h b/src/lib/netlist/macro/nlm_other.h index bb73d0105d2..f0e8ca05af0 100644 --- a/src/lib/netlist/macro/nlm_other.h +++ b/src/lib/netlist/macro/nlm_other.h @@ -11,12 +11,15 @@ * Netlist Macros * ---------------------------------------------------------------------------*/ +#ifndef NL_AUTO_DEVICES + #define MC14584B_GATE(name) \ NET_REGISTER_DEV(MC14584B_GATE, name) #define MC14584B_DIP(name) \ NET_REGISTER_DEV(MC14584B_DIP, name) +#endif /* ---------------------------------------------------------------------------- * External declarations diff --git a/src/lib/netlist/macro/nlm_ttl74xx.h b/src/lib/netlist/macro/nlm_ttl74xx.h index 44b3db63bd3..526fbf395da 100644 --- a/src/lib/netlist/macro/nlm_ttl74xx.h +++ b/src/lib/netlist/macro/nlm_ttl74xx.h @@ -11,6 +11,8 @@ * Netlist Macros * ---------------------------------------------------------------------------*/ +#ifndef NL_AUTO_DEVICES + #define TTL_7400_GATE(name) \ NET_REGISTER_DEV(TTL_7400_GATE, name) @@ -200,6 +202,8 @@ #define TTL_74260_DIP(name) \ NET_REGISTER_DEV(TTL_74260_DIP, name) +#endif + /* ---------------------------------------------------------------------------- * External declarations * ---------------------------------------------------------------------------*/ diff --git a/src/lib/netlist/nl_base.cpp b/src/lib/netlist/nl_base.cpp index 80acf9847a3..3e000cb5a08 100644 --- a/src/lib/netlist/nl_base.cpp +++ b/src/lib/netlist/nl_base.cpp @@ -433,7 +433,8 @@ void netlist_t::stop() log().debug("Printing statistics ...\n"); print_stats(); log().debug("Stopping solver device ...\n"); - m_solver->stop(); + if (m_solver != nullptr) + m_solver->stop(); } detail::net_t *netlist_t::find_net(const pstring &name) diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp index 84aa7c8d384..57a125d1843 100644 --- a/src/lib/netlist/nl_setup.cpp +++ b/src/lib/netlist/nl_setup.cpp @@ -7,8 +7,6 @@ #include <cstdio> -#include "solver/nld_solver.h" - #include "plib/palloc.h" #include "plib/putil.h" #include "nl_base.h" diff --git a/src/lib/netlist/nl_setup.h b/src/lib/netlist/nl_setup.h index 798ba8f4140..41c1ecc67ee 100644 --- a/src/lib/netlist/nl_setup.h +++ b/src/lib/netlist/nl_setup.h @@ -81,6 +81,9 @@ void NETLIST_NAME(name)(netlist::setup_t &setup) \ NETLIST_NAME(model)(setup); \ setup.namespace_pop(); +#define OPTIMIZE_FRONTIER(attach, r_in, r_out) \ + setup.register_frontier(# attach, r_in, r_out); + // ----------------------------------------------------------------------------- // truthtable defines // ----------------------------------------------------------------------------- diff --git a/src/lib/netlist/prg/nltool.cpp b/src/lib/netlist/prg/nltool.cpp index 91f9fc7c1ae..3850dd935e4 100644 --- a/src/lib/netlist/prg/nltool.cpp +++ b/src/lib/netlist/prg/nltool.cpp @@ -30,7 +30,7 @@ public: tool_options_t() : plib::options(), opt_grp1(*this, "General options", "The following options apply to all commands."), - opt_cmd (*this, "c", "cmd", "run", "run:convert:listdevices:static", "run|convert|listdevices|static"), + opt_cmd (*this, "c", "cmd", "run", "run:convert:listdevices:static:header", "run|convert|listdevices|static|header"), opt_file(*this, "f", "file", "-", "file to process (default is stdin)"), opt_defines(*this, "D", "define", "predefine value as macro, e.g. -Dname=value. If '=value' is omitted predefine it as 1. This option may be specified repeatedly."), opt_rfolders(*this, "r", "rom", "where to look for files"), @@ -325,6 +325,72 @@ static void static_compile(tool_options_t &opts) } +static void mac_out(const pstring s, const bool cont = true) +{ + static const unsigned RIGHT = 72; + if (cont) + { + unsigned adj = 0; + for (auto x : s) + adj += (x == '\t' ? 3 : 0); + pout("{1}\\\n", s.rpad(" ", RIGHT-1-adj)); + } + else + pout("{1}\n", s); +} + +static void create_header(tool_options_t &opts) +{ + netlist_tool_t nt("netlist"); + + nt.init(); + + nt.log().verbose.set_enabled(false); + nt.log().warning.set_enabled(false); + + nt.setup().register_source(plib::make_unique_base<netlist::source_t, + netlist::source_proc_t>(nt.setup(), "dummy", &netlist_dummy)); + nt.setup().include("dummy"); + + pout("// license:GPL-2.0+\n"); + pout("// copyright-holders:Couriersud\n"); + pout("#ifndef NLD_DEVINC_H\n"); + pout("#define NLD_DEVINC_H\n"); + pout("\n"); + pout("#include \"nl_setup.h\"\n"); + pout("#ifndef __PLIB_PREPROCESSOR__\n"); + pout("\n"); + pout("/* ----------------------------------------------------------------------------\n"); + pout(" * Netlist Macros\n"); + pout(" * ---------------------------------------------------------------------------*/\n"); + pout("\n"); + + for (auto &e : nt.setup().factory()) + { + auto v = plib::pstring_vector_t(e->param_desc(), ","); + pstring vs; + for (auto s : v) + vs += ", p" + s.replace("+","").replace(".","_"); + mac_out("#define " + e->name() + "(name" + vs + ")"); + mac_out("\tNET_REGISTER_DEV(" + e->name() +", name)"); \ + + for (auto s : v) + { + pstring r(s.replace("+","").replace(".","_")); + if (s.startsWith("+")) + mac_out("\tNET_CONNECT(name, " + r + ", p" + r + ")"); + else + mac_out("\tNETDEV_PARAMI(name, " + r + ", p" + r + ")"); + } + mac_out("", false); + } + pout("#endif // __PLIB_PREPROCESSOR__\n"); + pout("#endif\n"); + nt.stop(); + +} + + /*------------------------------------------------- listdevices - list all known devices -------------------------------------------------*/ @@ -472,6 +538,8 @@ int main(int argc, char *argv[]) run(opts); else if (cmd == "static") static_compile(opts); + else if (cmd == "header") + create_header(opts); else if (cmd == "convert") { pstring contents; diff --git a/src/lib/netlist/solver/nld_solver.h b/src/lib/netlist/solver/nld_solver.h index e3ba6419f8b..637e7d56b89 100644 --- a/src/lib/netlist/solver/nld_solver.h +++ b/src/lib/netlist/solver/nld_solver.h @@ -20,10 +20,13 @@ // Macros // ---------------------------------------------------------------------------------------- +#ifndef NL_AUTO_DEVICES + #define SOLVER(name, freq) \ NET_REGISTER_DEV(SOLVER, name) \ PARAM(name.FREQ, freq) +#endif // ---------------------------------------------------------------------------------------- // solver // ---------------------------------------------------------------------------------------- diff --git a/src/mame/machine/nl_pongd.cpp b/src/mame/machine/nl_pongd.cpp index 545b7a1c5f5..e04fb89e304 100644 --- a/src/mame/machine/nl_pongd.cpp +++ b/src/mame/machine/nl_pongd.cpp @@ -87,6 +87,7 @@ CIRCUIT_LAYOUT( pongdoubles ) ANALOG_INPUT(V5, 5) #define VCC "V5", Q +#undef GND #define GND "GND", Q CHIP("F9", 7493) |