summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author couriersud <couriersud@gmx.org>2020-08-10 18:24:27 +0200
committer couriersud <couriersud@gmx.org>2020-08-10 18:31:34 +0200
commit9809a7b9910b282ef2a83413ea34c8567d494eb6 (patch)
treeed30eb8099ca27ce140dfa936f6ca74a127b0209
parent66439cc0b43c1b9ed60923c751fc5d5025cc658d (diff)
netlist: align naming of files within the macro folder.
* Use a consistent naming scheme. This is a preparational step towards improved parsing performance.
-rw-r--r--scripts/src/netlist.lua24
-rw-r--r--src/lib/netlist/build/makefile12
-rw-r--r--src/lib/netlist/devices/net_lib.h21
-rw-r--r--src/lib/netlist/macro/nlm_base_lib.cpp (renamed from src/lib/netlist/macro/nlm_base.cpp)19
-rw-r--r--src/lib/netlist/macro/nlm_base_lib.h (renamed from src/lib/netlist/macro/nlm_base.h)2
-rw-r--r--src/lib/netlist/macro/nlm_cd4xxx_lib.cpp (renamed from src/lib/netlist/macro/nlm_cd4xxx.cpp)2
-rw-r--r--src/lib/netlist/macro/nlm_cd4xxx_lib.h (renamed from src/lib/netlist/macro/nlm_cd4xxx.h)0
-rw-r--r--src/lib/netlist/macro/nlm_mc3340.h34
-rw-r--r--src/lib/netlist/macro/nlm_opamp_lib.cpp (renamed from src/lib/netlist/macro/nlm_opamp.cpp)2
-rw-r--r--src/lib/netlist/macro/nlm_opamp_lib.h (renamed from src/lib/netlist/macro/nlm_opamp.h)3
-rw-r--r--src/lib/netlist/macro/nlm_otheric_lib.cpp (renamed from src/lib/netlist/macro/nlm_other.cpp)0
-rw-r--r--src/lib/netlist/macro/nlm_otheric_lib.h (renamed from src/lib/netlist/macro/nlm_other.h)0
-rw-r--r--src/lib/netlist/macro/nlm_roms_lib.cpp (renamed from src/lib/netlist/macro/nlm_roms.cpp)2
-rw-r--r--src/lib/netlist/macro/nlm_roms_lib.h (renamed from src/lib/netlist/macro/nlm_roms.h)0
-rw-r--r--src/lib/netlist/macro/nlm_ttl74xx_lib.cpp (renamed from src/lib/netlist/macro/nlm_ttl74xx.cpp)2
-rw-r--r--src/lib/netlist/macro/nlm_ttl74xx_lib.h (renamed from src/lib/netlist/macro/nlm_ttl74xx.h)0
-rw-r--r--src/lib/netlist/nl_base.cpp6
-rw-r--r--src/lib/netlist/nl_parser.cpp24
-rw-r--r--src/lib/netlist/nl_parser.h5
-rw-r--r--src/lib/netlist/plib/ptokenizer.h5
20 files changed, 83 insertions, 80 deletions
diff --git a/scripts/src/netlist.lua b/scripts/src/netlist.lua
index b46dfec4d3a..20c83daf992 100644
--- a/scripts/src/netlist.lua
+++ b/scripts/src/netlist.lua
@@ -251,18 +251,18 @@ project "netlist"
MAME_DIR .. "src/lib/netlist/devices/nlid_system.h",
MAME_DIR .. "src/lib/netlist/devices/nlid_proxy.cpp",
MAME_DIR .. "src/lib/netlist/devices/nlid_proxy.h",
- MAME_DIR .. "src/lib/netlist/macro/nlm_base.cpp",
- MAME_DIR .. "src/lib/netlist/macro/nlm_base.h",
- MAME_DIR .. "src/lib/netlist/macro/nlm_ttl74xx.cpp",
- MAME_DIR .. "src/lib/netlist/macro/nlm_ttl74xx.h",
- MAME_DIR .. "src/lib/netlist/macro/nlm_cd4xxx.cpp",
- MAME_DIR .. "src/lib/netlist/macro/nlm_cd4xxx.h",
- MAME_DIR .. "src/lib/netlist/macro/nlm_opamp.cpp",
- MAME_DIR .. "src/lib/netlist/macro/nlm_opamp.h",
- MAME_DIR .. "src/lib/netlist/macro/nlm_other.cpp",
- MAME_DIR .. "src/lib/netlist/macro/nlm_other.h",
- MAME_DIR .. "src/lib/netlist/macro/nlm_roms.cpp",
- MAME_DIR .. "src/lib/netlist/macro/nlm_roms.h",
+ MAME_DIR .. "src/lib/netlist/macro/nlm_base_lib.cpp",
+ MAME_DIR .. "src/lib/netlist/macro/nlm_base_lib.h",
+ MAME_DIR .. "src/lib/netlist/macro/nlm_ttl74xx_lib.cpp",
+ MAME_DIR .. "src/lib/netlist/macro/nlm_ttl74xx_lib.h",
+ MAME_DIR .. "src/lib/netlist/macro/nlm_cd4xxx_lib.cpp",
+ MAME_DIR .. "src/lib/netlist/macro/nlm_cd4xxx_lib.h",
+ MAME_DIR .. "src/lib/netlist/macro/nlm_opamp_lib.cpp",
+ MAME_DIR .. "src/lib/netlist/macro/nlm_opamp_lib.h",
+ MAME_DIR .. "src/lib/netlist/macro/nlm_otheric_lib.cpp",
+ MAME_DIR .. "src/lib/netlist/macro/nlm_otheric_lib.h",
+ MAME_DIR .. "src/lib/netlist/macro/nlm_roms_lib.cpp",
+ MAME_DIR .. "src/lib/netlist/macro/nlm_roms_lib.h",
MAME_DIR .. "src/lib/netlist/generated/static_solvers.cpp",
}
diff --git a/src/lib/netlist/build/makefile b/src/lib/netlist/build/makefile
index e142f7c0d7e..07c1e8d89f9 100644
--- a/src/lib/netlist/build/makefile
+++ b/src/lib/netlist/build/makefile
@@ -209,12 +209,12 @@ NLOBJS := \
$(NLOBJ)/devices/nlid_proxy.o \
$(NLOBJ)/devices/nld_system.o \
$(NLOBJ)/devices/nlid_truthtable.o \
- $(NLOBJ)/macro/nlm_base.o \
- $(NLOBJ)/macro/nlm_cd4xxx.o \
- $(NLOBJ)/macro/nlm_opamp.o \
- $(NLOBJ)/macro/nlm_other.o \
- $(NLOBJ)/macro/nlm_roms.o \
- $(NLOBJ)/macro/nlm_ttl74xx.o \
+ $(NLOBJ)/macro/nlm_base_lib.o \
+ $(NLOBJ)/macro/nlm_cd4xxx_lib.o \
+ $(NLOBJ)/macro/nlm_opamp_lib.o \
+ $(NLOBJ)/macro/nlm_otheric_lib.o \
+ $(NLOBJ)/macro/nlm_roms_lib.o \
+ $(NLOBJ)/macro/nlm_ttl74xx_lib.o \
TESTOBJS := \
$(TESTOBJ)/test_pfunction.o \
diff --git a/src/lib/netlist/devices/net_lib.h b/src/lib/netlist/devices/net_lib.h
index f677e140eaa..a5779cf162e 100644
--- a/src/lib/netlist/devices/net_lib.h
+++ b/src/lib/netlist/devices/net_lib.h
@@ -28,12 +28,12 @@
#define IND_P(ind) ((ind) * 1e-12)
#endif
-NETLIST_EXTERNAL(base)
-NETLIST_EXTERNAL(CD4XXX_lib)
-NETLIST_EXTERNAL(OPAMP_lib)
+NETLIST_EXTERNAL(base_lib)
+NETLIST_EXTERNAL(cd4xxx_lib)
+NETLIST_EXTERNAL(opamp_lib)
NETLIST_EXTERNAL(otheric_lib)
-NETLIST_EXTERNAL(TTL74XX_lib)
-NETLIST_EXTERNAL(ROMS_lib)
+NETLIST_EXTERNAL(ttl74xx_lib)
+NETLIST_EXTERNAL(roms_lib)
#if NL_AUTO_DEVICES
#include "nld_devinc.h"
@@ -104,12 +104,11 @@ NETLIST_EXTERNAL(ROMS_lib)
#include "nld_log.h"
-#include "netlist/macro/nlm_cd4xxx.h"
-#include "netlist/macro/nlm_mc3340.h"
-#include "netlist/macro/nlm_opamp.h"
-#include "netlist/macro/nlm_other.h"
-#include "netlist/macro/nlm_roms.h"
-#include "netlist/macro/nlm_ttl74xx.h"
+#include "../macro/nlm_cd4xxx_lib.h"
+#include "../macro/nlm_opamp_lib.h"
+#include "../macro/nlm_otheric_lib.h"
+#include "../macro/nlm_roms_lib.h"
+#include "../macro/nlm_ttl74xx_lib.h"
#include "netlist/analog/nld_bjt.h"
#include "netlist/analog/nld_fourterm.h"
diff --git a/src/lib/netlist/macro/nlm_base.cpp b/src/lib/netlist/macro/nlm_base_lib.cpp
index 920eb2a7f2d..04676fc5338 100644
--- a/src/lib/netlist/macro/nlm_base.cpp
+++ b/src/lib/netlist/macro/nlm_base_lib.cpp
@@ -98,7 +98,7 @@ NETLIST_END()
* Always included
* ---------------------------------------------------------------------------*/
-NETLIST_START(base)
+NETLIST_START(base_lib)
NET_REGISTER_DEV(GNDA, GND)
NET_REGISTER_DEV(PARAMETER, NETLIST)
@@ -107,21 +107,22 @@ NETLIST_START(base)
LOCAL_SOURCE(mosfet_models)
LOCAL_SOURCE(family_models)
- LOCAL_SOURCE(TTL74XX_lib)
- LOCAL_SOURCE(CD4XXX_lib)
- LOCAL_SOURCE(OPAMP_lib)
+ LOCAL_SOURCE(ttl74xx_lib)
+ LOCAL_SOURCE(cd4xxx_lib)
+ LOCAL_SOURCE(opamp_lib)
LOCAL_SOURCE(otheric_lib)
- LOCAL_SOURCE(ROMS_lib)
+ LOCAL_SOURCE(roms_lib)
INCLUDE(diode_models)
INCLUDE(bjt_models)
INCLUDE(mosfet_models)
INCLUDE(family_models)
- INCLUDE(TTL74XX_lib)
- INCLUDE(CD4XXX_lib)
- INCLUDE(OPAMP_lib)
+
+ INCLUDE(ttl74xx_lib)
+ INCLUDE(cd4xxx_lib)
+ INCLUDE(opamp_lib)
INCLUDE(otheric_lib)
- INCLUDE(ROMS_lib)
+ INCLUDE(roms_lib)
NETLIST_END()
diff --git a/src/lib/netlist/macro/nlm_base.h b/src/lib/netlist/macro/nlm_base_lib.h
index 2b5596b5410..1da4bb8d172 100644
--- a/src/lib/netlist/macro/nlm_base.h
+++ b/src/lib/netlist/macro/nlm_base_lib.h
@@ -27,7 +27,7 @@
* External declarations
* ---------------------------------------------------------------------------*/
-NETLIST_EXTERNAL(base)
+NETLIST_EXTERNAL(base_lib)
#endif
diff --git a/src/lib/netlist/macro/nlm_cd4xxx.cpp b/src/lib/netlist/macro/nlm_cd4xxx_lib.cpp
index 56150a2d31e..492736d75ca 100644
--- a/src/lib/netlist/macro/nlm_cd4xxx.cpp
+++ b/src/lib/netlist/macro/nlm_cd4xxx_lib.cpp
@@ -552,7 +552,7 @@ static NETLIST_START(CD4538_DIP)
NETLIST_END()
-NETLIST_START(CD4XXX_lib)
+NETLIST_START(cd4xxx_lib)
TRUTHTABLE_START(CD4001_GATE, 2, 1, "")
TT_HEAD("A , B | Q ")
diff --git a/src/lib/netlist/macro/nlm_cd4xxx.h b/src/lib/netlist/macro/nlm_cd4xxx_lib.h
index d6ecade6658..d6ecade6658 100644
--- a/src/lib/netlist/macro/nlm_cd4xxx.h
+++ b/src/lib/netlist/macro/nlm_cd4xxx_lib.h
diff --git a/src/lib/netlist/macro/nlm_mc3340.h b/src/lib/netlist/macro/nlm_mc3340.h
deleted file mode 100644
index ccd3047f4a5..00000000000
--- a/src/lib/netlist/macro/nlm_mc3340.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// license:GPL-2.0+
-// copyright-holders:Ryan Holtz
-
-#ifndef NLM_MC3340_H_
-#define NLM_MC3340_H_
-
-///
-/// \file nlm_mc3340.h
-///
-
-#include "netlist/nl_setup.h"
-
-#ifndef __PLIB_PREPROCESSOR__
-
-/* ----------------------------------------------------------------------------
- * Netlist Macros
- * ---------------------------------------------------------------------------*/
-
-#if !NL_AUTO_DEVICES
-
-#define MC3340_DIP(name) \
- NET_REGISTER_DEV(MC3340_DIP, name)
-
-#endif // NL_AUTO_DEVICES
-
-/* ----------------------------------------------------------------------------
- * External declarations
- * ---------------------------------------------------------------------------*/
-
-// moved to net_lib.h
-
-#endif // __PLIB_PREPROCESSOR__
-
-#endif
diff --git a/src/lib/netlist/macro/nlm_opamp.cpp b/src/lib/netlist/macro/nlm_opamp_lib.cpp
index 2d0c83807d6..a8fae82e8c8 100644
--- a/src/lib/netlist/macro/nlm_opamp.cpp
+++ b/src/lib/netlist/macro/nlm_opamp_lib.cpp
@@ -564,7 +564,7 @@ static NETLIST_START(LM3900)
NETLIST_END()
#endif
-NETLIST_START(OPAMP_lib)
+NETLIST_START(opamp_lib)
LOCAL_LIB_ENTRY(opamp_layout_4_4_11)
LOCAL_LIB_ENTRY(opamp_layout_2_8_4)
LOCAL_LIB_ENTRY(opamp_layout_2_13_9_4)
diff --git a/src/lib/netlist/macro/nlm_opamp.h b/src/lib/netlist/macro/nlm_opamp_lib.h
index 70beffd3885..7c9b31a29bd 100644
--- a/src/lib/netlist/macro/nlm_opamp.h
+++ b/src/lib/netlist/macro/nlm_opamp_lib.h
@@ -57,6 +57,9 @@
#define LM747A_DIP(name) \
NET_REGISTER_DEV(LM747A_DIP, name)
+#define MC3340_DIP(name) \
+ NET_REGISTER_DEV(MC3340_DIP, name)
+
#endif // NL_AUTO_DEVICES
/* ----------------------------------------------------------------------------
diff --git a/src/lib/netlist/macro/nlm_other.cpp b/src/lib/netlist/macro/nlm_otheric_lib.cpp
index 327b57faa62..327b57faa62 100644
--- a/src/lib/netlist/macro/nlm_other.cpp
+++ b/src/lib/netlist/macro/nlm_otheric_lib.cpp
diff --git a/src/lib/netlist/macro/nlm_other.h b/src/lib/netlist/macro/nlm_otheric_lib.h
index c69b4d61224..c69b4d61224 100644
--- a/src/lib/netlist/macro/nlm_other.h
+++ b/src/lib/netlist/macro/nlm_otheric_lib.h
diff --git a/src/lib/netlist/macro/nlm_roms.cpp b/src/lib/netlist/macro/nlm_roms_lib.cpp
index 30bd4b98e06..13edd472e93 100644
--- a/src/lib/netlist/macro/nlm_roms.cpp
+++ b/src/lib/netlist/macro/nlm_roms_lib.cpp
@@ -386,7 +386,7 @@ NETLIST_END()
NETLIST_END()
-NETLIST_START(ROMS_lib)
+NETLIST_START(roms_lib)
LOCAL_LIB_ENTRY(PROM_82S123_DIP)
LOCAL_LIB_ENTRY(PROM_82S126_DIP)
diff --git a/src/lib/netlist/macro/nlm_roms.h b/src/lib/netlist/macro/nlm_roms_lib.h
index ab754f34c86..ab754f34c86 100644
--- a/src/lib/netlist/macro/nlm_roms.h
+++ b/src/lib/netlist/macro/nlm_roms_lib.h
diff --git a/src/lib/netlist/macro/nlm_ttl74xx.cpp b/src/lib/netlist/macro/nlm_ttl74xx_lib.cpp
index 5c3529e22b5..dc1a65c29b5 100644
--- a/src/lib/netlist/macro/nlm_ttl74xx.cpp
+++ b/src/lib/netlist/macro/nlm_ttl74xx_lib.cpp
@@ -2896,7 +2896,7 @@ static NETLIST_START(TTL_9602_DIP)
NETLIST_END()
-NETLIST_START(TTL74XX_lib)
+NETLIST_START(ttl74xx_lib)
NET_MODEL("DM7414 SCHMITT_TRIGGER(VTP=1.7 VTM=0.9 VI=4.35 RI=6.15k VOH=3.5 ROH=120 VOL=0.1 ROL=37.5 TPLH=15 TPHL=15)")
NET_MODEL("TTL_7414_GATE SCHMITT_TRIGGER(VTP=1.7 VTM=0.9 VI=4.35 RI=6.15k VOH=3.5 ROH=120 VOL=0.1 ROL=37.5 TPLH=15 TPHL=15)")
NET_MODEL("DM74LS14 SCHMITT_TRIGGER(VTP=1.6 VTM=0.8 VI=4.4 RI=19.3k VOH=3.45 ROH=130 VOL=0.1 ROL=31.2 TPLH=15 TPHL=15)")
diff --git a/src/lib/netlist/macro/nlm_ttl74xx.h b/src/lib/netlist/macro/nlm_ttl74xx_lib.h
index b797bfd6cc9..b797bfd6cc9 100644
--- a/src/lib/netlist/macro/nlm_ttl74xx.h
+++ b/src/lib/netlist/macro/nlm_ttl74xx_lib.h
diff --git a/src/lib/netlist/nl_base.cpp b/src/lib/netlist/nl_base.cpp
index 1ea7817dc72..532a3f98f47 100644
--- a/src/lib/netlist/nl_base.cpp
+++ b/src/lib/netlist/nl_base.cpp
@@ -1,6 +1,7 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
+#include "macro/nlm_base_lib.h"
#include "solver/nld_matrix_solver.h"
#include "solver/nld_solver.h"
@@ -13,7 +14,6 @@
#include "core/setup.h"
#include "devices/nlid_proxy.h"
#include "devices/nlid_system.h" // netlist_params
-#include "macro/nlm_base.h"
#include "nl_base.h"
#include "nl_errstr.h"
@@ -141,7 +141,7 @@ namespace netlist
"#define IND_P(ind) ((ind) * 1e-12) \n";
m_setup->parser().add_include<plib::psource_str_t>("netlist/devices/net_lib.h", content);
#if 1
- NETLIST_NAME(base)(m_setup->parser());
+ NETLIST_NAME(base_lib)(m_setup->parser());
#else
// FIXME: This is very slow - need optimized parsing scanning
#if 0
@@ -155,7 +155,7 @@ namespace netlist
m_setup->parser().register_source<source_file_t>(dir + "nlm_cd4xxx.cpp");
m_setup->parser().register_source<source_file_t>(dir + "nlm_other.cpp");
m_setup->parser().register_source<source_file_t>(dir + "nlm_ttl74xx.cpp");
- m_setup->parser().include("base");
+ m_setup->parser().include("base_lib");
#endif
#endif
}
diff --git a/src/lib/netlist/nl_parser.cpp b/src/lib/netlist/nl_parser.cpp
index 791ac073dd1..8edecb84a3a 100644
--- a/src/lib/netlist/nl_parser.cpp
+++ b/src/lib/netlist/nl_parser.cpp
@@ -21,6 +21,7 @@ void parser_t::verror(const pstring &msg)
parser_t::parser_t(nlparse_t &setup)
: m_setup(setup)
+ , m_cur_local(nullptr)
{
m_tokenizer.identifier_chars("abcdefghijklmnopqrstuvwvxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_.-$@")
.number_chars(".0123456789", "0123456789eE-.") //FIXME: processing of numbers
@@ -82,6 +83,8 @@ bool parser_t::parse(token_store &tokstor, const pstring &nlname)
while (true)
{
+ // FIXME: line numbers in cached local netlists are wrong
+ // need to process raw tokens here.
token_t token = get_token();
if (token.is_type(token_type::ENDOFFILE))
{
@@ -98,6 +101,11 @@ bool parser_t::parse(token_store &tokstor, const pstring &nlname)
in_nl = false;
}
require_token(m_tok_paren_right);
+
+ m_cur_local->push_back(token);
+ m_cur_local->push_back(token_t(m_tok_paren_left));
+ m_cur_local->push_back(token_t(m_tok_paren_right));
+
}
else if (token.is(m_tok_NETLIST_START))
{
@@ -112,6 +120,18 @@ bool parser_t::parse(token_store &tokstor, const pstring &nlname)
return true;
}
+ // create a new cached local store
+ m_local.emplace(name.str(), token_store());
+ m_cur_local = &m_local[name.str()];
+ m_cur_local->push_back(token_t(token_type::LINEMARKER));
+ auto sl = sourceloc();
+ auto num = plib::pfmt("{1}")(sl.line());
+ m_cur_local->push_back(token_t(token_type::NUMBER, num));
+ m_cur_local->push_back(token_t(token_type::STRING, sl.file_name()));
+ m_cur_local->push_back(token_t(m_tok_NETLIST_START));
+ m_cur_local->push_back(token_t(m_tok_paren_left));
+ m_cur_local->push_back(name);
+ m_cur_local->push_back(token_t(m_tok_paren_right));
in_nl = true;
}
else if (!in_nl)
@@ -119,6 +139,10 @@ bool parser_t::parse(token_store &tokstor, const pstring &nlname)
if (!token.is(m_tok_static))
error(MF_EXPECTED_NETLIST_START_1(token.str()));
}
+ else
+ {
+ m_cur_local->push_back(token);
+ }
}
}
diff --git a/src/lib/netlist/nl_parser.h b/src/lib/netlist/nl_parser.h
index e4308786e3a..c552663af6a 100644
--- a/src/lib/netlist/nl_parser.h
+++ b/src/lib/netlist/nl_parser.h
@@ -11,6 +11,8 @@
#include "nltypes.h" // for setup_t
#include "plib/ptokenizer.h"
+#include <unordered_map>
+
namespace netlist
{
class parser_t : public plib::ptoken_reader
@@ -75,6 +77,9 @@ namespace netlist
plib::ptokenizer m_tokenizer;
nlparse_t &m_setup;
+
+ std::unordered_map<pstring, token_store> m_local;
+ token_store *m_cur_local;
};
} // namespace netlist
diff --git a/src/lib/netlist/plib/ptokenizer.h b/src/lib/netlist/plib/ptokenizer.h
index 23dcd2da923..9d67c297296 100644
--- a/src/lib/netlist/plib/ptokenizer.h
+++ b/src/lib/netlist/plib/ptokenizer.h
@@ -75,6 +75,10 @@ namespace plib {
: m_type(type), m_id(token_id_t::npos), m_token(str)
{
}
+ token_t(const token_id_t &id)
+ : m_type(token_type::TOKEN), m_id(id.id()), m_token(id.name())
+ {
+ }
token_t(const token_id_t &id, const pstring &str)
: m_type(token_type::TOKEN), m_id(id.id()), m_token(str)
{
@@ -220,6 +224,7 @@ namespace plib {
void error(const perrmsg &errs);
+ plib::source_location sourceloc() { return m_source_location.back(); }
protected:
virtual void verror(const pstring &msg) = 0;