diff options
author | 2020-07-28 20:42:27 +0200 | |
---|---|---|
committer | 2020-07-28 20:42:30 +0200 | |
commit | 09e987486a38e9e9f94e468b77f4cd7f4aa5259c (patch) | |
tree | f6d507252ab4c41e3610a050d0ea09b41781d421 /src/lib/netlist | |
parent | c00cbad238a86afd03dcc458b679737530d067c3 (diff) |
netlist: necessary changes towards runtime processing of macro directory
Diffstat (limited to 'src/lib/netlist')
-rw-r--r-- | src/lib/netlist/devices/net_lib.h | 15 | ||||
-rw-r--r-- | src/lib/netlist/macro/nlm_base.cpp | 1 | ||||
-rw-r--r-- | src/lib/netlist/macro/nlm_cd4xxx.h | 7 | ||||
-rw-r--r-- | src/lib/netlist/macro/nlm_opamp.h | 2 | ||||
-rw-r--r-- | src/lib/netlist/macro/nlm_other.h | 2 | ||||
-rw-r--r-- | src/lib/netlist/macro/nlm_roms.h | 2 | ||||
-rw-r--r-- | src/lib/netlist/macro/nlm_ttl74xx.cpp | 24 | ||||
-rw-r--r-- | src/lib/netlist/macro/nlm_ttl74xx.h | 20 | ||||
-rw-r--r-- | src/lib/netlist/nl_base.cpp | 12 | ||||
-rw-r--r-- | src/lib/netlist/nl_setup.cpp | 6 | ||||
-rw-r--r-- | src/lib/netlist/plib/ppreprocessor.h | 11 |
11 files changed, 57 insertions, 45 deletions
diff --git a/src/lib/netlist/devices/net_lib.h b/src/lib/netlist/devices/net_lib.h index b4f65bf2322..fc65a4cf5ef 100644 --- a/src/lib/netlist/devices/net_lib.h +++ b/src/lib/netlist/devices/net_lib.h @@ -28,17 +28,16 @@ #define IND_P(ind) ((ind) * 1e-12) #endif +NETLIST_EXTERNAL(base) +NETLIST_EXTERNAL(CD4XXX_lib) +NETLIST_EXTERNAL(OPAMP_lib) +NETLIST_EXTERNAL(otheric_lib) +NETLIST_EXTERNAL(TTL74XX_lib) +NETLIST_EXTERNAL(ROMS_lib) + #if NL_AUTO_DEVICES #include "nld_devinc.h" -#include "netlist/macro/nlm_cd4xxx.h" -#include "netlist/macro/nlm_opamp.h" -#include "netlist/macro/nlm_other.h" -#include "netlist/macro/nlm_ttl74xx.h" -#include "netlist/macro/nlm_roms.h" - -#include "nld_7448.h" - #else #define SOLVER(name, freq) \ diff --git a/src/lib/netlist/macro/nlm_base.cpp b/src/lib/netlist/macro/nlm_base.cpp index 1185f482e73..f18ae337afb 100644 --- a/src/lib/netlist/macro/nlm_base.cpp +++ b/src/lib/netlist/macro/nlm_base.cpp @@ -1,7 +1,6 @@ // license:GPL-2.0+ // copyright-holders:Couriersud #include "netlist/devices/net_lib.h" -#include "nlm_base.h" /* ---------------------------------------------------------------------------- * Diode Models diff --git a/src/lib/netlist/macro/nlm_cd4xxx.h b/src/lib/netlist/macro/nlm_cd4xxx.h index ba90ad0fe64..a18f917d5df 100644 --- a/src/lib/netlist/macro/nlm_cd4xxx.h +++ b/src/lib/netlist/macro/nlm_cd4xxx.h @@ -64,13 +64,14 @@ #define CD4538_DIP(name) \ NET_REGISTER_DEV(CD4538_DIP, name) -#endif +#endif // !NL_AUTO_DEVICES + /* ---------------------------------------------------------------------------- * External declarations * ---------------------------------------------------------------------------*/ -NETLIST_EXTERNAL(CD4XXX_lib) +// moved to net_lib.h #endif -#endif +#endif // NLD_CD4XXX_H_ diff --git a/src/lib/netlist/macro/nlm_opamp.h b/src/lib/netlist/macro/nlm_opamp.h index 06c31acc71b..eefb95b478d 100644 --- a/src/lib/netlist/macro/nlm_opamp.h +++ b/src/lib/netlist/macro/nlm_opamp.h @@ -60,7 +60,7 @@ * External declarations * ---------------------------------------------------------------------------*/ -NETLIST_EXTERNAL(OPAMP_lib) +// moved to net_lib.h #endif // __PLIB_PREPROCESSOR__ diff --git a/src/lib/netlist/macro/nlm_other.h b/src/lib/netlist/macro/nlm_other.h index b028d829e4b..c69b4d61224 100644 --- a/src/lib/netlist/macro/nlm_other.h +++ b/src/lib/netlist/macro/nlm_other.h @@ -33,7 +33,7 @@ * External declarations * ---------------------------------------------------------------------------*/ -NETLIST_EXTERNAL(otheric_lib) +// moved to net_lib.h #endif diff --git a/src/lib/netlist/macro/nlm_roms.h b/src/lib/netlist/macro/nlm_roms.h index 1900e693e04..d838d7a13b1 100644 --- a/src/lib/netlist/macro/nlm_roms.h +++ b/src/lib/netlist/macro/nlm_roms.h @@ -37,7 +37,7 @@ * External declarations * ---------------------------------------------------------------------------*/ -NETLIST_EXTERNAL(ROMS_lib) +// moved to net_lib.h #endif // __PLIB_PREPROCESSOR__ diff --git a/src/lib/netlist/macro/nlm_ttl74xx.cpp b/src/lib/netlist/macro/nlm_ttl74xx.cpp index 4c51e01055b..802e5537203 100644 --- a/src/lib/netlist/macro/nlm_ttl74xx.cpp +++ b/src/lib/netlist/macro/nlm_ttl74xx.cpp @@ -3,6 +3,20 @@ #include "netlist/devices/net_lib.h" +#ifndef NL_USE_TRUTHTABLE_74107 +#define NL_USE_TRUTHTABLE_74107 0 +#endif + +#ifndef NL_USE_TRUTHTABLE_7448 +#define NL_USE_TRUTHTABLE_7448 0 +#endif + +#if 1 +// +#elif %&/() +// +#endif + /* * DM7400: Quad 2-Input NAND Gates * @@ -1139,9 +1153,8 @@ NETLIST_END() * Naming conventions follow Fairchild Semiconductor datasheet * */ - -#if !NL_AUTO_DEVICES #ifndef __PLIB_PREPROCESSOR__ +#if !NL_AUTO_DEVICES #define TTL_74279A(name) \ NET_REGISTER_DEV(TTL_74279A, name) #define TTL_74279B(name) \ @@ -1299,13 +1312,8 @@ NETLIST_END() * */ -#ifndef __PLIB_PREPROCESSOR__ -#define DM9312_TT(name) \ - NET_REGISTER_DEV(DM9312, name) -#endif - static NETLIST_START(DM9312_DIP) - DM9312_TT(s) + DM9312(s) DIPPINS( /* +--------------+ */ s.D0, /* D0 |1 ++ 16| VCC */ s.VCC, diff --git a/src/lib/netlist/macro/nlm_ttl74xx.h b/src/lib/netlist/macro/nlm_ttl74xx.h index d041a9e6e3d..bf1a791c841 100644 --- a/src/lib/netlist/macro/nlm_ttl74xx.h +++ b/src/lib/netlist/macro/nlm_ttl74xx.h @@ -333,22 +333,8 @@ #define TTL_74379_DIP(name) \ NET_REGISTER_DEV(TTL_74379_DIP, name) -#define DM9312(name, cA, cB, cC, cSTROBE, cD0, cD1, cD2, cD3, cD4, cD5, cD6, cD7) \ - NET_REGISTER_DEV(DM9312, name) \ - NET_CONNECT(name, VCC, VCC) \ - NET_CONNECT(name, GND, GND) \ - NET_CONNECT(name, A, cA) \ - NET_CONNECT(name, B, cB) \ - NET_CONNECT(name, C, cC) \ - NET_CONNECT(name, G, cSTROBE) \ - NET_CONNECT(name, D0, cD0) \ - NET_CONNECT(name, D1, cD1) \ - NET_CONNECT(name, D2, cD2) \ - NET_CONNECT(name, D3, cD3) \ - NET_CONNECT(name, D4, cD4) \ - NET_CONNECT(name, D5, cD5) \ - NET_CONNECT(name, D6, cD6) \ - NET_CONNECT(name, D7, cD7) +#define DM9312(...) \ + NET_REGISTER_DEVEXT(DM9312, __VA_ARGS__) #define DM9312_DIP(name) \ NET_REGISTER_DEV(DM9312_DIP, name) @@ -359,7 +345,7 @@ * External declarations * ---------------------------------------------------------------------------*/ -NETLIST_EXTERNAL(TTL74XX_lib) +// moved to net_lib.h #endif // __PLIB_PREPROCESSOR__ diff --git a/src/lib/netlist/nl_base.cpp b/src/lib/netlist/nl_base.cpp index 3b07912a8d4..6eb2ec8c6c3 100644 --- a/src/lib/netlist/nl_base.cpp +++ b/src/lib/netlist/nl_base.cpp @@ -142,7 +142,19 @@ namespace netlist "#define IND_N(ind) ((ind) * 1e-9) \n" "#define IND_P(ind) ((ind) * 1e-12) \n"; m_setup->parser().add_include<a>("netlist/devices/net_lib.h", content); +#if 1 NETLIST_NAME(base)(m_setup->parser()); +#else + // FIXME: This is very slow - need optimized parsing scanning + pstring dir = "src/lib/netlist/macro/"; + m_setup->parser().register_source<source_file_t>(dir + "nlm_base.cpp"); + m_setup->parser().register_source<source_file_t>(dir + "nlm_opamp.cpp"); + m_setup->parser().register_source<source_file_t>(dir + "nlm_roms.cpp"); + 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"); +#endif } diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp index e6424649149..e399d5c28a9 100644 --- a/src/lib/netlist/nl_setup.cpp +++ b/src/lib/netlist/nl_setup.cpp @@ -110,7 +110,7 @@ namespace netlist //break; } pstring output_name = *ptok; - log().debug("Link: {1} {2}\n", tp, output_name); + log().debug("Link: {1} {2}", tp, output_name); register_link(name + "." + tp.substr(1), output_name); ++ptok; @@ -118,7 +118,7 @@ namespace netlist else if (plib::startsWith(tp, "@")) { pstring term = tp.substr(1); - log().debug("Link: {1} {2}\n", tp, term); + log().debug("Link: {1} {2}", tp, term); register_link(name + "." + term, term); } @@ -353,7 +353,7 @@ namespace netlist bool nlparse_t::parse_stream(plib::psource_t::stream_ptr &&istrm, const pstring &name) { auto y = std::make_unique<plib::ppreprocessor>(m_includes, &m_defines); - y->process(std::move(istrm)); + y->process(std::move(istrm), "<stream>"); return parser_t(std::move(y), *this).parse(name); //return parser_t(std::move(plib::ppreprocessor(&m_defines).process(std::move(istrm))), *this).parse(name); } diff --git a/src/lib/netlist/plib/ppreprocessor.h b/src/lib/netlist/plib/ppreprocessor.h index 9758da6c8ac..d5dcc3d5fa7 100644 --- a/src/lib/netlist/plib/ppreprocessor.h +++ b/src/lib/netlist/plib/ppreprocessor.h @@ -68,10 +68,17 @@ namespace plib { delete rdbuf(); } + /// \brief process stream + /// + /// \param filename a filename or identifier identifying the stream. + /// + /// FIXME: this is sub-optimal. Refactor input_context into pinput_context + /// and pass this to ppreprocessor. + /// template <typename T> - ppreprocessor & process(T &&istrm) + ppreprocessor & process(T &&istrm, const pstring &filename) { - m_stack.emplace_back(input_context(std::forward<T>(istrm),"","<stream>")); + m_stack.emplace_back(input_context(std::forward<T>(istrm),plib::util::path(filename), filename)); process_stack(); return *this; } |