summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib
diff options
context:
space:
mode:
authorGravatarGravatar couriersud <couriersud@gmx.org>2019-10-13 16:45:03 +0200
committerGravatarGravatar couriersud <couriersud@gmx.org>2019-10-13 16:45:30 +0200
commita89b7d194d77cacfe73dd1936c3db68c52ba0b36 (patch)
treed6463bf9ef1417f470227660bb9a4c3a98482524 /src/lib
parent3812869c54c98505f08d88c54c430eb93991b8bf (diff)
netlist: mame netlist reorganization. [Couriersud]
- moved netlists out of driver code into audio/ or machine/ as nl_xxx.cpp files. - identified and documented extended validation - updated arcade, mess and nl targets
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/netlist/devices/nld_7497.cpp2
-rw-r--r--src/lib/netlist/devices/nlid_proxy.cpp2
-rw-r--r--src/lib/netlist/devices/nlid_system.h2
-rw-r--r--src/lib/netlist/macro/nlm_ttl74xx.cpp4
-rw-r--r--src/lib/netlist/macro/nlm_ttl74xx.h2
-rw-r--r--src/lib/netlist/nl_parser.cpp4
-rw-r--r--src/lib/netlist/nl_setup.h11
-rw-r--r--src/lib/netlist/plib/pparser.h1
-rw-r--r--src/lib/netlist/prg/nltool.cpp28
-rw-r--r--src/lib/netlist/solver/nld_matrix_solver.cpp6
-rw-r--r--src/lib/netlist/solver/nld_ms_gcr.h5
11 files changed, 43 insertions, 24 deletions
diff --git a/src/lib/netlist/devices/nld_7497.cpp b/src/lib/netlist/devices/nld_7497.cpp
index 2c54d63bf09..cfbab15157e 100644
--- a/src/lib/netlist/devices/nld_7497.cpp
+++ b/src/lib/netlist/devices/nld_7497.cpp
@@ -172,7 +172,7 @@ namespace netlist
};
- NETLIB_DEVICE_IMPL(7497, "TTL_7497", "+CLK,+STRBQ,+ENQ,+UNITYQ,+CLR,+B0,+B1,+B2,+B3,+B4,+B5, @VCC, @GND")
+ NETLIB_DEVICE_IMPL(7497, "TTL_7497", "+CLK,+STRBQ,+ENQ,+UNITYQ,+CLR,+B0,+B1,+B2,+B3,+B4,+B5,@VCC,@GND")
NETLIB_DEVICE_IMPL(7497_dip, "TTL_7497_DIP", "")
} //namespace devices
diff --git a/src/lib/netlist/devices/nlid_proxy.cpp b/src/lib/netlist/devices/nlid_proxy.cpp
index 2a9fccd1dc6..fe42f5e8582 100644
--- a/src/lib/netlist/devices/nlid_proxy.cpp
+++ b/src/lib/netlist/devices/nlid_proxy.cpp
@@ -126,7 +126,7 @@ namespace netlist
else
{
log().verbose("D/A Proxy: Found power terminals on device {1}", out_proxied->device().name());
- if (setup().is_validation())
+ if (setup().is_extended_validation())
{
// During validation, don't connect to terminals found
// This will cause terminals not connected to a rail net to
diff --git a/src/lib/netlist/devices/nlid_system.h b/src/lib/netlist/devices/nlid_system.h
index 8d9c4f86039..bed4c2bb8d2 100644
--- a/src/lib/netlist/devices/nlid_system.h
+++ b/src/lib/netlist/devices/nlid_system.h
@@ -438,7 +438,7 @@ namespace devices
nld_power_pins(device_t &owner, const pstring &sVCC = "VCC",
const pstring &sGND = "GND", bool force_analog_input = false)
{
- if (owner.setup().is_validation() || force_analog_input)
+ if (owner.setup().is_extended_validation() || force_analog_input)
{
m_GND = plib::make_unique<analog_input_t>(owner, sGND, NETLIB_DELEGATE(power_pins, noop));
m_VCC = plib::make_unique<analog_input_t>(owner, sVCC, NETLIB_DELEGATE(power_pins, noop));
diff --git a/src/lib/netlist/macro/nlm_ttl74xx.cpp b/src/lib/netlist/macro/nlm_ttl74xx.cpp
index fb175ae0c18..37c010607c9 100644
--- a/src/lib/netlist/macro/nlm_ttl74xx.cpp
+++ b/src/lib/netlist/macro/nlm_ttl74xx.cpp
@@ -827,7 +827,7 @@ NETLIST_END()
#ifndef __PLIB_PREPROCESSOR__
#define DM9312_TT(name) \
- NET_REGISTER_DEV(DM9312_TT, name)
+ NET_REGISTER_DEV(DM9312, name)
#endif
static NETLIST_START(DM9312_DIP)
@@ -1340,7 +1340,7 @@ NETLIST_START(TTL74XX_lib)
TT_FAMILY("74XX")
TRUTHTABLE_END()
- TRUTHTABLE_START(DM9312_TT, 12, 2, "+A,+B,+C,+G,+D0,+D1,+D2,+D3,+D4,+D5,+D6,+D7,@VCC,@GND")
+ TRUTHTABLE_START(DM9312, 12, 2, "+A,+B,+C,+G,+D0,+D1,+D2,+D3,+D4,+D5,+D6,+D7,@VCC,@GND")
TT_HEAD(" C, B, A, G,D0,D1,D2,D3,D4,D5,D6,D7| Y,YQ")
TT_LINE(" X, X, X, 1, X, X, X, X, X, X, X, X| 0, 1|33,19")
TT_LINE(" 0, 0, 0, 0, 0, X, X, X, X, X, X, X| 0, 1|33,28")
diff --git a/src/lib/netlist/macro/nlm_ttl74xx.h b/src/lib/netlist/macro/nlm_ttl74xx.h
index 8afc465490d..4c9e8c4d553 100644
--- a/src/lib/netlist/macro/nlm_ttl74xx.h
+++ b/src/lib/netlist/macro/nlm_ttl74xx.h
@@ -281,7 +281,7 @@
NET_REGISTER_DEV(TTL_74279_DIP, name)
#define DM9312(name, cA, cB, cC, cSTROBE, cD0, cD1, cD2, cD3, cD4, cD5, cD6, cD7) \
- NET_REGISTER_DEV(DM9312_TT, name) \
+ NET_REGISTER_DEV(DM9312, name) \
NET_CONNECT(name, VCC, VCC) \
NET_CONNECT(name, GND, GND) \
NET_CONNECT(name, A, cA) \
diff --git a/src/lib/netlist/nl_parser.cpp b/src/lib/netlist/nl_parser.cpp
index 8816cba95aa..c0cf595119c 100644
--- a/src/lib/netlist/nl_parser.cpp
+++ b/src/lib/netlist/nl_parser.cpp
@@ -413,8 +413,8 @@ void parser_t::device(const pstring &dev_type)
nl_double parser_t::eval_param(const token_t &tok)
{
- static std::array<pstring, 6> macs = {"", "RES_K", "RES_M", "CAP_U", "CAP_N", "CAP_P"};
- static std::array<nl_double, 6> facs = {1, 1e3, 1e6, 1e-6, 1e-9, 1e-12};
+ static std::array<pstring, 7> macs = {"", "RES_R", "RES_K", "RES_M", "CAP_U", "CAP_N", "CAP_P"};
+ static std::array<nl_double, 7> facs = {1, 1, 1e3, 1e6, 1e-6, 1e-9, 1e-12};
std::size_t f=0;
nl_double ret(0);
diff --git a/src/lib/netlist/nl_setup.h b/src/lib/netlist/nl_setup.h
index 318720c7a06..977732623b9 100644
--- a/src/lib/netlist/nl_setup.h
+++ b/src/lib/netlist/nl_setup.h
@@ -393,8 +393,15 @@ namespace netlist
/* validation */
- void enable_validation() { m_validation = true; }
- bool is_validation() const { return m_validation; }
+ /* The extended validation mode is not intended for running.
+ * The intention is to identify power pins which are not properly
+ * connected. The downside is that this mode creates a netlist which
+ * is different (and not able to run).
+ *
+ * Extended validation is supported by nltool validate option.
+ */
+ void set_extended_validation(bool val) { m_validation = val; }
+ bool is_extended_validation() const { return m_validation; }
private:
void merge_nets(detail::net_t &thisnet, detail::net_t &othernet);
diff --git a/src/lib/netlist/plib/pparser.h b/src/lib/netlist/plib/pparser.h
index 0f0e57fca12..3d4f18b3eb1 100644
--- a/src/lib/netlist/plib/pparser.h
+++ b/src/lib/netlist/plib/pparser.h
@@ -175,6 +175,7 @@ public:
using defines_map_type = std::unordered_map<pstring, define_t>;
explicit ppreprocessor(defines_map_type *defines = nullptr);
+
~ppreprocessor() override
{
delete rdbuf();
diff --git a/src/lib/netlist/prg/nltool.cpp b/src/lib/netlist/prg/nltool.cpp
index d4c220da6b2..f7ff843801c 100644
--- a/src/lib/netlist/prg/nltool.cpp
+++ b/src/lib/netlist/prg/nltool.cpp
@@ -41,7 +41,10 @@ public:
opt_grp2(*this, "Options for run and static commands", "These options apply to run and static commands."),
opt_name(*this, "n", "name", "", "the netlist in file specified by ""-f"" option to run; default is first one"),
- opt_grp3(*this, "Options for run command", "These options are only used by the run command."),
+ opt_grp3(*this, "Options for static command", "These options apply to static command."),
+ opt_dir(*this, "d", "dir", "", "output directory for the generated files"),
+
+ opt_grp4(*this, "Options for run command", "These options are only used by the run command."),
opt_ttr (*this, "t", "time_to_run", 1.0, "time to run the emulation (seconds)\n\n abc def\n\n xyz"),
opt_stats(*this, "s", "statistics", "gather runtime statistics"),
opt_logs(*this, "l", "log" , "define terminal to log. This option may be specified repeatedly."),
@@ -49,10 +52,13 @@ public:
opt_loadstate(*this,"", "loadstate", "", "load state from file and continue from there"),
opt_savestate(*this,"", "savestate", "", "save state to file at end of run"),
- opt_grp4(*this, "Options for convert command", "These options are only used by the convert command."),
+ opt_grp5(*this, "Options for convert command", "These options are only used by the convert command."),
opt_type(*this, "y", "type", 0, std::vector<pstring>({"spice","eagle","rinf"}), "type of file to be converted: spice,eagle,rinf"),
- opt_grp5(*this, "Options for header command", "These options are only used by the header command."),
+ opt_grp6(*this, "Options for validate command", "These options are only used by the validate command."),
+ opt_extended_validation(*this, "", "extended", "Identify issues with power terminals."),
+
+ opt_grp7(*this, "Options for header command", "These options are only used by the header command."),
opt_tabwidth(*this, "", "tab-width", 4, "Tab width for output."),
opt_linewidth(*this,"", "line-width", 72, "Line width for output."),
@@ -79,15 +85,19 @@ public:
plib::option_group opt_grp2;
plib::option_str opt_name;
plib::option_group opt_grp3;
+ plib::option_str opt_dir;
+ plib::option_group opt_grp4;
plib::option_num<double> opt_ttr;
plib::option_bool opt_stats;
plib::option_vec opt_logs;
plib::option_str opt_inp;
plib::option_str opt_loadstate;
plib::option_str opt_savestate;
- plib::option_group opt_grp4;
- plib::option_str_limit<unsigned> opt_type;
plib::option_group opt_grp5;
+ plib::option_str_limit<unsigned> opt_type;
+ plib::option_group opt_grp6;
+ plib::option_bool opt_extended_validation;
+ plib::option_group opt_grp7;
plib::option_num<unsigned> opt_tabwidth;
plib::option_num<unsigned> opt_linewidth;
plib::option_example opt_ex1;
@@ -455,7 +465,7 @@ void tool_app_t::validate()
m_errors = 0;
m_warnings = 0;
- nt.setup().enable_validation();
+ nt.setup().set_extended_validation(opt_extended_validation());
try
{
@@ -484,6 +494,9 @@ void tool_app_t::validate()
void tool_app_t::static_compile()
{
+ if (!opt_dir.was_specified())
+ throw netlist::nl_exception("--dir option needs to be specified");
+
netlist_tool_t nt(*this, "netlist");
nt.init();
@@ -506,7 +519,8 @@ void tool_app_t::static_compile()
for (auto &e : mp)
{
- pout.write(e.second);
+ auto sout(std::ofstream(opt_dir() + "/" + e.first + ".c" ));
+ sout << e.second;
}
nt.stop();
diff --git a/src/lib/netlist/solver/nld_matrix_solver.cpp b/src/lib/netlist/solver/nld_matrix_solver.cpp
index 88823811858..2ad6cae7903 100644
--- a/src/lib/netlist/solver/nld_matrix_solver.cpp
+++ b/src/lib/netlist/solver/nld_matrix_solver.cpp
@@ -559,14 +559,8 @@ namespace devices
if (m_params.m_dynamic_ts)
{
-#if 0
- for (std::size_t k = 0, iN=m_terms.size(); k < iN; k++)
- {
- terms_for_net_t *t = m_terms[k].get();
-#else
for (auto &t : m_terms)
{
-#endif
//const nl_double DD_n = (n->Q_Analog() - t->m_last_V);
// avoid floating point exceptions
const nl_double DD_n = std::max(-1e100, std::min(1e100,(t->getV() - t->m_last_V)));
diff --git a/src/lib/netlist/solver/nld_ms_gcr.h b/src/lib/netlist/solver/nld_ms_gcr.h
index bf8ee2acb60..cda9336c1c9 100644
--- a/src/lib/netlist/solver/nld_ms_gcr.h
+++ b/src/lib/netlist/solver/nld_ms_gcr.h
@@ -136,9 +136,13 @@ namespace devices
pstring symname = static_compile_name();
m_proc.load(this->state().lib(), symname);
if (m_proc.resolved())
+ {
this->log().info("External static solver {1} found ...", symname);
+ }
else
+ {
this->log().warning("External static solver {1} not found ...", symname);
+ }
}
}
@@ -213,7 +217,6 @@ namespace devices
plib::putf8_fmt_writer w(&t);
generate_code(w);
std::hash<typename std::remove_const<std::remove_reference<decltype(t.str())>::type>::type> h;
-
return plib::pfmt("nl_gcr_{1:x}_{2}")(h( t.str() ))(mat.nz_num);
}