diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/netlist/devices/nld_devinc.h | 63 | ||||
-rw-r--r-- | src/lib/netlist/devices/nlid_truthtable.cpp | 37 | ||||
-rw-r--r-- | src/lib/netlist/devices/nlid_truthtable.h | 5 | ||||
-rw-r--r-- | src/lib/netlist/nl_factory.cpp | 7 | ||||
-rw-r--r-- | src/lib/netlist/nl_factory.h | 35 | ||||
-rw-r--r-- | src/lib/netlist/nl_parser.cpp | 7 | ||||
-rwxr-xr-x | src/lib/netlist/nl_setup.cpp | 8 | ||||
-rw-r--r-- | src/lib/netlist/nl_setup.h | 12 | ||||
-rw-r--r-- | src/lib/netlist/plib/putil.h | 2 | ||||
-rw-r--r-- | src/lib/netlist/prg/nltool.cpp | 8 |
10 files changed, 101 insertions, 83 deletions
diff --git a/src/lib/netlist/devices/nld_devinc.h b/src/lib/netlist/devices/nld_devinc.h index 421379899df..f8c2753903b 100644 --- a/src/lib/netlist/devices/nld_devinc.h +++ b/src/lib/netlist/devices/nld_devinc.h @@ -233,17 +233,13 @@ NET_REGISTER_DEVEXT(RAM_2102A_DIP, __VA_ARGS__) // --------------------------------------------------------------------- -// Source: src/lib/netlist/devices/nld_2716.cpp +// Source: src/lib/netlist/devices/nld_roms.cpp // --------------------------------------------------------------------- -// usage : EPROM_2716(name, pGQ, pEPQ, pA0, pA1, pA2, pA3, pA4, pA5, pA6, pA7, pA8, pA9, pA10) +// usage : EPROM_2716(name, pCE2Q, pCE1Q, pA0, pA1, pA2, pA3, pA4, pA5, pA6, pA7, pA8, pA9, pA10) // auto connect: VCC, GND #define EPROM_2716(...) \ NET_REGISTER_DEVEXT(EPROM_2716, __VA_ARGS__) -// usage : EPROM_2716_DIP(name) -#define EPROM_2716_DIP(...) \ - NET_REGISTER_DEVEXT(EPROM_2716_DIP, __VA_ARGS__) - // --------------------------------------------------------------------- // Source: src/lib/netlist/devices/nld_7448.cpp // --------------------------------------------------------------------- @@ -435,13 +431,13 @@ // --------------------------------------------------------------------- // Source: src/lib/netlist/devices/nld_74125.cpp // --------------------------------------------------------------------- -// usage : TTL_74125(name) -#define TTL_74125(...) \ - NET_REGISTER_DEVEXT(TTL_74125, __VA_ARGS__) +// usage : TTL_74125_GATE(name) +#define TTL_74125_GATE(...) \ + NET_REGISTER_DEVEXT(TTL_74125_GATE, __VA_ARGS__) -// usage : TTL_74126(name) -#define TTL_74126(...) \ - NET_REGISTER_DEVEXT(TTL_74126, __VA_ARGS__) +// usage : TTL_74126_GATE(name) +#define TTL_74126_GATE(...) \ + NET_REGISTER_DEVEXT(TTL_74126_GATE, __VA_ARGS__) // --------------------------------------------------------------------- // Source: src/lib/netlist/devices/nld_74153.cpp @@ -605,16 +601,13 @@ NET_REGISTER_DEVEXT(PROM_82S115, __VA_ARGS__) // --------------------------------------------------------------------- -// Source: src/lib/netlist/devices/nld_82S123.cpp +// Source: src/lib/netlist/devices/nld_roms.cpp // --------------------------------------------------------------------- // usage : PROM_82S123(name, pCEQ, pA0, pA1, pA2, pA3, pA4) // auto connect: VCC, GND #define PROM_82S123(...) \ NET_REGISTER_DEVEXT(PROM_82S123, __VA_ARGS__) -// --------------------------------------------------------------------- -// Source: src/lib/netlist/devices/nld_82S126.cpp -// --------------------------------------------------------------------- // usage : PROM_82S126(name, pCE1Q, pCE2Q, pA0, pA1, pA2, pA3, pA4, pA5, pA6, pA7) // auto connect: VCC, GND #define PROM_82S126(...) \ @@ -830,13 +823,6 @@ NET_REGISTER_DEVEXT(PROM_82S115_DIP, __VA_ARGS__) // --------------------------------------------------------------------- -// Source: src/lib/netlist/devices/nld_82S123.cpp -// --------------------------------------------------------------------- -// usage : PROM_82S123_DIP(name) -#define PROM_82S123_DIP(...) \ - NET_REGISTER_DEVEXT(PROM_82S123_DIP, __VA_ARGS__) - -// --------------------------------------------------------------------- // Source: src/lib/netlist/devices/nld_74123.cpp // --------------------------------------------------------------------- // usage : TTL_9602_DIP(name) @@ -1140,6 +1126,14 @@ #define TTL_7486_DIP(...) \ NET_REGISTER_DEVEXT(TTL_7486_DIP, __VA_ARGS__) +// usage : TTL_74125_DIP(name) +#define TTL_74125_DIP(...) \ + NET_REGISTER_DEVEXT(TTL_74125_DIP, __VA_ARGS__) + +// usage : TTL_74126_DIP(name) +#define TTL_74126_DIP(...) \ + NET_REGISTER_DEVEXT(TTL_74126_DIP, __VA_ARGS__) + // usage : TTL_74155_DIP(name) #define TTL_74155_DIP(...) \ NET_REGISTER_DEVEXT(TTL_74155_DIP, __VA_ARGS__) @@ -1179,16 +1173,21 @@ #define CD4001_GATE(...) \ NET_REGISTER_DEVEXT(CD4001_GATE, __VA_ARGS__) +// usage : CD4069_GATE(name) +#define CD4069_GATE(...) \ + NET_REGISTER_DEVEXT(CD4069_GATE, __VA_ARGS__) + // usage : CD4070_GATE(name) #define CD4070_GATE(...) \ NET_REGISTER_DEVEXT(CD4070_GATE, __VA_ARGS__) -#define CD4069_GATE(name) \ - NET_REGISTER_DEVEXT(CD4069_GATE, name) - // usage : CD4001_DIP(name) -#define CD4001_DIP(name) \ - NET_REGISTER_DEVEXT(CD4001_DIP, name) +#define CD4001_DIP(...) \ + NET_REGISTER_DEVEXT(CD4001_DIP, __VA_ARGS__) + +// usage : CD4069_DIP(name) +#define CD4069_DIP(...) \ + NET_REGISTER_DEVEXT(CD4069_DIP, __VA_ARGS__) // usage : CD4070_DIP(name) #define CD4070_DIP(...) \ @@ -1303,6 +1302,10 @@ // --------------------------------------------------------------------- // Source: src/lib/netlist/macro/nlm_roms.cpp // --------------------------------------------------------------------- +// usage : PROM_82S123_DIP(name) +#define PROM_82S123_DIP(...) \ + NET_REGISTER_DEVEXT(PROM_82S123_DIP, __VA_ARGS__) + // usage : PROM_82S126_DIP(name) #define PROM_82S126_DIP(...) \ NET_REGISTER_DEVEXT(PROM_82S126_DIP, __VA_ARGS__) @@ -1311,5 +1314,9 @@ #define PROM_74S287_DIP(...) \ NET_REGISTER_DEVEXT(PROM_74S287_DIP, __VA_ARGS__) +// usage : EPROM_2716_DIP(name) +#define EPROM_2716_DIP(...) \ + NET_REGISTER_DEVEXT(EPROM_2716_DIP, __VA_ARGS__) + #endif // __PLIB_PREPROCESSOR__ #endif diff --git a/src/lib/netlist/devices/nlid_truthtable.cpp b/src/lib/netlist/devices/nlid_truthtable.cpp index afce37cc28d..59cb3e819a7 100644 --- a/src/lib/netlist/devices/nlid_truthtable.cpp +++ b/src/lib/netlist/devices/nlid_truthtable.cpp @@ -241,8 +241,8 @@ namespace devices { public: netlist_factory_truthtable_t(const pstring &name, - const pstring &def_param, const pstring &sourcefile) - : truthtable_base_element_t(name, def_param, sourcefile) + const pstring &def_param, plib::source_location &&sourceloc) + : truthtable_base_element_t(name, def_param, std::move(sourceloc)) { } unique_pool_ptr<core_device_t> make_device(nlmempool &pool, netlist_state_t &anetlist, const pstring &name) override @@ -472,39 +472,40 @@ namespace factory { truthtable_base_element_t::truthtable_base_element_t(const pstring &name, - const pstring &def_param, const pstring &sourcefile) - : factory::element_t(name, def_param, sourcefile) + const pstring &def_param, plib::source_location &&sourceloc) + : factory::element_t(name, def_param, std::move(sourceloc)) , m_family_name(NETLIST_DEFAULT_LOGIC_FAMILY) { } #define ENTRYY(n, m, s) case (n * 100 + m): \ { using xtype = devices::netlist_factory_truthtable_t<n, m>; \ - ret = plib::make_unique<xtype>(desc.name, desc.def_param, s); } \ + auto cs=s; \ + ret = plib::make_unique<xtype>(desc.name, desc.def_param, std::move(cs)); } \ break #define ENTRY(n, s) ENTRYY(n, 1, s); ENTRYY(n, 2, s); ENTRYY(n, 3, s); \ ENTRYY(n, 4, s); ENTRYY(n, 5, s); ENTRYY(n, 6, s); \ ENTRYY(n, 7, s); ENTRYY(n, 8, s) - plib::unique_ptr<truthtable_base_element_t> truthtable_create(tt_desc &desc, const pstring &sourcefile) + plib::unique_ptr<truthtable_base_element_t> truthtable_create(tt_desc &desc, plib::source_location &&sourceloc) { plib::unique_ptr<truthtable_base_element_t> ret; switch (desc.ni * 100 + desc.no) { - ENTRY(1, sourcefile); - ENTRY(2, sourcefile); - ENTRY(3, sourcefile); - ENTRY(4, sourcefile); - ENTRY(5, sourcefile); - ENTRY(6, sourcefile); - ENTRY(7, sourcefile); - ENTRY(8, sourcefile); - ENTRY(9, sourcefile); - ENTRY(10, sourcefile); - ENTRY(11, sourcefile); - ENTRY(12, sourcefile); + ENTRY(1, sourceloc); + ENTRY(2, sourceloc); + ENTRY(3, sourceloc); + ENTRY(4, sourceloc); + ENTRY(5, sourceloc); + ENTRY(6, sourceloc); + ENTRY(7, sourceloc); + ENTRY(8, sourceloc); + ENTRY(9, sourceloc); + ENTRY(10, sourceloc); + ENTRY(11, sourceloc); + ENTRY(12, sourceloc); default: pstring msg = plib::pfmt("unable to create truthtable<{1},{2}>")(desc.ni)(desc.no); nl_assert_always(false, msg.c_str()); diff --git a/src/lib/netlist/devices/nlid_truthtable.h b/src/lib/netlist/devices/nlid_truthtable.h index 41cd5c309d2..0af5248c3ee 100644 --- a/src/lib/netlist/devices/nlid_truthtable.h +++ b/src/lib/netlist/devices/nlid_truthtable.h @@ -201,13 +201,14 @@ namespace factory { public: truthtable_base_element_t(const pstring &name, - const pstring &def_param, const pstring &sourcefile); + const pstring &def_param, plib::source_location &&sourceloc); std::vector<pstring> m_desc; pstring m_family_name; }; - plib::unique_ptr<truthtable_base_element_t> truthtable_create(tt_desc &desc, const pstring &sourcefile); + plib::unique_ptr<truthtable_base_element_t> truthtable_create(tt_desc &desc, + plib::source_location &&sourceloc); } // namespace factory } // namespace netlist diff --git a/src/lib/netlist/nl_factory.cpp b/src/lib/netlist/nl_factory.cpp index 21280dc801d..be641f2ae42 100644 --- a/src/lib/netlist/nl_factory.cpp +++ b/src/lib/netlist/nl_factory.cpp @@ -27,15 +27,16 @@ namespace factory { NETLIB_UPDATEI() { } }; - element_t::element_t(const pstring &name, const pstring &def_param, const pstring &sourcefile) + element_t::element_t(const pstring &name, const pstring &def_param, + plib::source_location &&sourceloc) : m_name(name), m_def_param(def_param), - m_sourcefile(sourcefile) + m_sourceloc(sourceloc) { } element_t::element_t(const pstring &name, const pstring &def_param) : m_name(name), m_def_param(def_param), - m_sourcefile("<unknown>") + m_sourceloc("<unknown>", 1) { } diff --git a/src/lib/netlist/nl_factory.h b/src/lib/netlist/nl_factory.h index 2d7132ca2c6..66cce44e8d0 100644 --- a/src/lib/netlist/nl_factory.h +++ b/src/lib/netlist/nl_factory.h @@ -11,6 +11,7 @@ #include "nltypes.h" #include "plib/palloc.h" #include "plib/ptypes.h" +#include "plib/putil.h" #include <vector> @@ -28,7 +29,8 @@ () \ { \ using devtype = factory::device_element_t<ns :: NETLIB_NAME(chip)>; \ - return devtype::create(p_name, p_def_param, __FILE__); \ + auto sl(PSOURCELOC()); \ + return devtype::create(p_name, p_def_param, std::move(sl)); \ } \ \ factory::constructor_ptr_t decl_ ## p_alias = NETLIB_NAME(p_alias ## _c); @@ -49,7 +51,7 @@ namespace factory { public: element_t(const pstring &name, const pstring &def_param); element_t(const pstring &name, const pstring &def_param, - const pstring &sourcefile); + plib::source_location &&sourceloc); virtual ~element_t() = default; PCOPYASSIGNMOVE(element_t, default) @@ -66,35 +68,39 @@ namespace factory { const pstring &name() const noexcept { return m_name; } const pstring ¶m_desc() const noexcept { return m_def_param; } - const pstring &sourcefile() const noexcept { return m_sourcefile; } + const plib::source_location &source() const noexcept { return m_sourceloc; } private: pstring m_name; ///< device name pstring m_def_param; ///< default parameter - pstring m_sourcefile; ///< source file + plib::source_location m_sourceloc; ///< source file }; template <class C> class device_element_t : public element_t { public: + + using device_ptr = unique_pool_ptr<core_device_t>; + using element_ptr = plib::unique_ptr<device_element_t<C>>; + device_element_t(const pstring &name, const pstring &def_param) : element_t(name, def_param) { } device_element_t(const pstring &name, const pstring &def_param, - const pstring &sourcefile) - : element_t(name, def_param, sourcefile) { } + plib::source_location &&sourceloc) + : element_t(name, def_param, std::move(sourceloc)) { } - unique_pool_ptr<core_device_t> make_device(nlmempool &pool, + device_ptr make_device(nlmempool &pool, netlist_state_t &anetlist, const pstring &name) override { return pool.make_unique<C>(anetlist, name); } - static plib::unique_ptr<device_element_t<C>> create(const pstring &name, - const pstring &def_param, const pstring &sourcefile) + static element_ptr create(const pstring &name, + const pstring &def_param, plib::source_location &&sourceloc) { - return plib::make_unique<device_element_t<C>>(name, def_param, sourcefile); + return plib::make_unique<device_element_t<C>>(name, def_param, std::move(sourceloc)); } }; @@ -108,9 +114,9 @@ namespace factory { template<class device_class> void add(const pstring &name, const pstring &def_param, - const pstring &sourcefile) + plib::source_location &&sourceloc) { - add(device_element_t<device_class>::create(name, def_param, sourcefile)); + add(device_element_t<device_class>::create(name, def_param, std::move(sourceloc))); } void add(plib::unique_ptr<element_t> &&factory) noexcept(false); @@ -147,8 +153,9 @@ namespace factory { { public: - library_element_t(const pstring &name, const pstring &def_param, const pstring &source) - : element_t(name, def_param, source) + library_element_t(const pstring &name, const pstring &def_param, + plib::source_location &&sourceloc) + : element_t(name, def_param, std::move(sourceloc)) { } diff --git a/src/lib/netlist/nl_parser.cpp b/src/lib/netlist/nl_parser.cpp index 28ef731820b..84b09bde1e0 100644 --- a/src/lib/netlist/nl_parser.cpp +++ b/src/lib/netlist/nl_parser.cpp @@ -132,8 +132,8 @@ void parser_t::parse_netlist(const pstring &nlname) else if (token.is(m_tok_LOCAL_LIB_ENTRY)) { require_token(m_tok_paren_left); - // FIXME: Need to pass in parameter definition - m_setup.register_lib_entry(get_identifier(), "", "parser: " + nlname); + // FIXME: Need to pass in parameter definition FIXME: get line number right + m_setup.register_lib_entry(get_identifier(), "", plib::source_location("parser: " + nlname, 1)); require_token(m_tok_paren_right); } else if (token.is(m_tok_NETLIST_END)) @@ -199,7 +199,8 @@ void parser_t::net_truthtable_start(const pstring &nlname) require_token(token, m_tok_TRUTHTABLE_END); require_token(m_tok_paren_left); require_token(m_tok_paren_right); - m_setup.truthtable_create(desc, nlname); + // FIXME: proper location + m_setup.truthtable_create(desc, plib::source_location(nlname, 1)); return; } } diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp index 202bbc33f49..b6df8b562e5 100755 --- a/src/lib/netlist/nl_setup.cpp +++ b/src/lib/netlist/nl_setup.cpp @@ -235,9 +235,9 @@ namespace netlist } void nlparse_t::register_lib_entry(const pstring &name, const - pstring ¶mdef, const pstring &sourcefile) + pstring ¶mdef, plib::source_location &&sourceloc) { - m_factory.add(plib::make_unique<factory::library_element_t>(name, paramdef, sourcefile)); + m_factory.add(plib::make_unique<factory::library_element_t>(name, paramdef, std::move(sourceloc))); } void nlparse_t::register_frontier(const pstring &attach, const pstring &r_IN, @@ -273,9 +273,9 @@ namespace netlist register_link(attach, frontier_name + ".Q"); } - void nlparse_t::truthtable_create(tt_desc &desc, const pstring &sourcefile) + void nlparse_t::truthtable_create(tt_desc &desc, plib::source_location &&sourceloc) { - auto fac = factory::truthtable_create(desc, sourcefile); + auto fac = factory::truthtable_create(desc, std::move(sourceloc)); m_factory.add(std::move(fac)); } diff --git a/src/lib/netlist/nl_setup.h b/src/lib/netlist/nl_setup.h index efbf16d339c..ebd602d04de 100644 --- a/src/lib/netlist/nl_setup.h +++ b/src/lib/netlist/nl_setup.h @@ -84,13 +84,11 @@ void NETLIST_NAME(name)(netlist::nlparse_t &setup) \ // FIXME: Need to pass in parameter definition #define LOCAL_LIB_ENTRY_1(name) \ LOCAL_SOURCE(name) \ - setup.register_lib_entry(# name, "", __FILE__); + setup.register_lib_entry(# name, "", PSOURCELOC()); #define LOCAL_LIB_ENTRY_2(name, param_spec) \ LOCAL_SOURCE(name) \ - setup.register_lib_entry(# name, param_spec, __FILE__); - -//#define LOCAL_LIB_ENTRY(...) PMSVC_VARARG_BUG(PCONCAT, (LOCAL_LIB_ENTRY_, PNARGS(__VA_ARGS__)))(__VA_ARGS__) + setup.register_lib_entry(# name, param_spec, PSOURCELOC()); #define LOCAL_LIB_ENTRY(...) PCALLVARARG(LOCAL_LIB_ENTRY_, __VA_ARGS__) @@ -128,7 +126,7 @@ void NETLIST_NAME(name)(netlist::nlparse_t &setup) \ desc.family = x; #define TRUTHTABLE_END() \ - setup.truthtable_create(desc, __FILE__); \ + setup.truthtable_create(desc, PSOURCELOC()); \ } namespace netlist @@ -311,7 +309,7 @@ namespace netlist register_param(param, static_cast<nl_fptype>(value)); } - void register_lib_entry(const pstring &name, const pstring ¶mdef, const pstring &sourcefile); + void register_lib_entry(const pstring &name, const pstring ¶mdef, plib::source_location &&sourceloc); void register_frontier(const pstring &attach, const pstring &r_IN, const pstring &r_OUT); @@ -325,7 +323,7 @@ namespace netlist m_sources.add_source(std::move(src)); } - void truthtable_create(tt_desc &desc, const pstring &sourcefile); + void truthtable_create(tt_desc &desc, plib::source_location &&sourceloc); // handle namespace diff --git a/src/lib/netlist/plib/putil.h b/src/lib/netlist/plib/putil.h index a0c18f82591..f453637fe5b 100644 --- a/src/lib/netlist/plib/putil.h +++ b/src/lib/netlist/plib/putil.h @@ -121,6 +121,8 @@ namespace plib : m_file(std::move(file)), m_func(std::move(func)), m_line(line), m_col(0) { } + PCOPYASSIGNMOVE(source_location, default) + unsigned line() const noexcept { return m_line; } unsigned column() const noexcept { return m_col; } pstring file_name() const noexcept { return m_file; } diff --git a/src/lib/netlist/prg/nltool.cpp b/src/lib/netlist/prg/nltool.cpp index 99b90d611e5..baef3c197f8 100644 --- a/src/lib/netlist/prg/nltool.cpp +++ b/src/lib/netlist/prg/nltool.cpp @@ -881,11 +881,11 @@ void tool_app_t::create_header() if (found) { - if (last_source != e->sourcefile()) + if (last_source != e->source().file_name()) { - last_source = e->sourcefile(); + last_source = e->source().file_name(); pout("{1}\n", plib::rpad(pstring("// "), pstring("-"), opt_linewidth())); - pout("{1}{2}\n", "// Source: ", plib::replace_all(e->sourcefile(), "../", "")); + pout("{1}{2}\n", "// Source: ", plib::replace_all(e->source().file_name(), "../", "")); pout("{1}\n", plib::rpad(pstring("// "), pstring("-"), opt_linewidth())); } header_entry(e.get()); @@ -947,7 +947,7 @@ void tool_app_t::create_docheader() for (auto &e : nt.parser().factory()) { - auto d(read_docsrc(e->sourcefile(), e->name())); + auto d(read_docsrc(e->source().file_name(), e->name())); if (d.id != "") { |