diff options
author | Couriersud <couriersud@gmx.org> | 2019-04-28 20:42:59 +0200 |
---|---|---|
committer | Couriersud <couriersud@gmx.org> | 2019-04-28 20:42:59 +0200 |
commit | 9694ec54c90b4b73f53f9b94a1080bdaedc8406e (patch) | |
tree | 80ad6262d186a4f4c9f3e78b08cbf9cd91d34ec8 | |
parent | 339de811ec4f336dfd0d02f58d5056e5f8de7336 (diff) |
netlist: code maintenance
- converted NL_MAX_LINK_RESOLVE_LOOPS into a netlist parameter.
- Reduced potential bit-rot.
- nltool -v --version now displays values of all compile time defines.
There are still far too many compile time defines. However, most of them
ensure and test future scalability.
-rw-r--r-- | src/devices/machine/netlist.cpp | 8 | ||||
-rw-r--r-- | src/lib/netlist/devices/nlid_system.h | 7 | ||||
-rw-r--r-- | src/lib/netlist/nl_base.cpp | 19 | ||||
-rw-r--r-- | src/lib/netlist/nl_base.h | 33 | ||||
-rw-r--r-- | src/lib/netlist/nl_config.h | 5 | ||||
-rw-r--r-- | src/lib/netlist/nl_setup.cpp | 4 | ||||
-rw-r--r-- | src/lib/netlist/prg/nltool.cpp | 9 |
7 files changed, 46 insertions, 39 deletions
diff --git a/src/devices/machine/netlist.cpp b/src/devices/machine/netlist.cpp index 9d7bed491e0..dd119f46a30 100644 --- a/src/devices/machine/netlist.cpp +++ b/src/devices/machine/netlist.cpp @@ -1320,11 +1320,11 @@ offs_t netlist_disassembler::disassemble(std::ostream &stream, offs_t pc, const { unsigned startpc = pc; int relpc = pc - m_dev->genPC(); - if (relpc >= 0 && relpc < m_dev->netlist().queuex().size()) + if (relpc >= 0 && relpc < m_dev->netlist().queue().size()) { - int dpc = m_dev->netlist().queuex().size() - relpc - 1; - util::stream_format(stream, "%c %s @%10.7f", (relpc == 0) ? '*' : ' ', m_dev->netlist().queuex()[dpc].m_object->name().c_str(), - m_dev->netlist().queuex()[dpc].m_exec_time.as_double()); + int dpc = m_dev->netlist().queue().size() - relpc - 1; + util::stream_format(stream, "%c %s @%10.7f", (relpc == 0) ? '*' : ' ', m_dev->netlist().queue()[dpc].m_object->name().c_str(), + m_dev->netlist().queue()[dpc].m_exec_time.as_double()); } pc+=1; diff --git a/src/lib/netlist/devices/nlid_system.h b/src/lib/netlist/devices/nlid_system.h index 51b8239ee32..3bb651106b2 100644 --- a/src/lib/netlist/devices/nlid_system.h +++ b/src/lib/netlist/devices/nlid_system.h @@ -30,6 +30,7 @@ namespace devices , m_use_deactivate(*this, "USE_DEACTIVATE", false) , m_startup_strategy(*this, "STARTUP_STRATEGY", 1) , m_mos_capmodel(*this, "DEFAULT_MOS_CAPMODEL", 2) + , m_max_link_loops(*this, "MAX_LINK_RESOLVE_LOOPS", 100) { } NETLIB_UPDATEI() { } @@ -37,8 +38,10 @@ namespace devices //NETLIB_UPDATE_PARAMI() { } public: param_logic_t m_use_deactivate; - param_int_t m_startup_strategy; - param_int_t m_mos_capmodel; + param_num_t<unsigned> m_startup_strategy; + param_num_t<unsigned> m_mos_capmodel; + //! How many times do we try to resolve links (connections) + param_num_t<unsigned> m_max_link_loops; }; // ----------------------------------------------------------------------------- diff --git a/src/lib/netlist/nl_base.cpp b/src/lib/netlist/nl_base.cpp index 9242386c71f..a0ce98b54bf 100644 --- a/src/lib/netlist/nl_base.cpp +++ b/src/lib/netlist/nl_base.cpp @@ -254,6 +254,25 @@ void netlist_state_t::rebuild_lists() } +void netlist_state_t::compile_defines(std::vector<std::pair<pstring, pstring>> &defs) +{ +#define ENTRY(x) { #x, PSTRINGIFY(x) } + defs.push_back(ENTRY(PHAS_RDTSCP)); + defs.push_back(ENTRY(PUSE_ACCURATE_STATS)); + defs.push_back(ENTRY(PHAS_INT128)); + defs.push_back(ENTRY(USE_ALIGNED_OPTIMIZATIONS)); + defs.push_back(ENTRY(NVCCBUILD)); + defs.push_back(ENTRY(USE_MEMPOOL)); + defs.push_back(ENTRY(USE_QUEUE_STATS)); + defs.push_back(ENTRY(USE_COPY_INSTEAD_OF_REFERENCE)); + defs.push_back(ENTRY(USE_TRUTHTABLE_7448)); + defs.push_back(ENTRY(NL_DEBUG)); + defs.push_back(ENTRY(HAS_OPENMP)); + defs.push_back(ENTRY(USE_OPENMP)); + +#undef ENTRY +} + void netlist_t::reset() { log().debug("Searching for mainclock\n"); diff --git a/src/lib/netlist/nl_base.h b/src/lib/netlist/nl_base.h index f995e0a26fd..7c0fabed160 100644 --- a/src/lib/netlist/nl_base.h +++ b/src/lib/netlist/nl_base.h @@ -1457,6 +1457,8 @@ namespace netlist // FIXME: make a postload member and include code there void rebuild_lists(); /* must be called after post_load ! */ + static void compile_defines(std::vector<std::pair<pstring, pstring>> &defs); + private: void reset(); @@ -1498,44 +1500,23 @@ namespace netlist void process_queue(const netlist_time delta) NL_NOEXCEPT; void abort_current_queue_slice() NL_NOEXCEPT { m_queue.retime(detail::queue_t::entry_t(m_time, nullptr)); } - const detail::queue_t &queuex() const NL_NOEXCEPT { return m_queue; } -#if 0 const detail::queue_t &queue() const NL_NOEXCEPT { return m_queue; } - detail::queue_t &queue() NL_NOEXCEPT { return m_queue; } -#endif void qpush(detail::queue_t::entry_t && e) noexcept { -#if (USE_QUEUE_STATS) - #if 0 - // clang treats -Wswitch-bool as error - switch (m_stats) - { - case false: m_queue.push_nostats(std::move(e)); break; - case true: m_queue.push(std::move(e)); break; - } - #else - if (!m_stats) - m_queue.push_nostats(std::move(e)); - else - m_queue.push(std::move(e)); - #endif -#else - m_queue.push_nostats(std::move(e)); -#endif + if (!USE_QUEUE_STATS || !m_stats) + m_queue.push_nostats(std::move(e)); + else + m_queue.push(std::move(e)); } template <class R> void qremove(const R &elem) noexcept { -#if (USE_QUEUE_STATS) - if (!m_stats) + if (!USE_QUEUE_STATS || !m_stats) m_queue.remove_nostats(elem); else m_queue.remove(elem); -#else - m_queue.remove_nostats(elem); -#endif } /* Control functions */ diff --git a/src/lib/netlist/nl_config.h b/src/lib/netlist/nl_config.h index a668362bae9..daf5ebae427 100644 --- a/src/lib/netlist/nl_config.h +++ b/src/lib/netlist/nl_config.h @@ -65,11 +65,6 @@ #define USE_TRUTHTABLE_7448 (0) -// How many times do we try to resolve links (connections) -#ifndef NL_MAX_LINK_RESOLVE_LOOPS -#define NL_MAX_LINK_RESOLVE_LOOPS (100) -#endif - //============================================================ // DEBUGGING //============================================================ diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp index 42efe0cf37c..8162e769a54 100644 --- a/src/lib/netlist/nl_setup.cpp +++ b/src/lib/netlist/nl_setup.cpp @@ -744,7 +744,7 @@ void setup_t::resolve_inputs() * We therefore first park connecting inputs and retry * after all other terminals were connected. */ - int tries = NL_MAX_LINK_RESOLVE_LOOPS; + unsigned tries = m_netlist_params->m_max_link_loops(); while (m_links.size() > 0 && tries > 0) { @@ -768,7 +768,7 @@ void setup_t::resolve_inputs() for (auto & link : m_links) log().warning(MF_CONNECTING_1_TO_2(setup().de_alias(link.first), setup().de_alias(link.second))); - log().fatal(MF_LINK_TRIES_EXCEEDED(NL_MAX_LINK_RESOLVE_LOOPS)); + log().fatal(MF_LINK_TRIES_EXCEEDED(m_netlist_params->m_max_link_loops())); } log().verbose("deleting empty nets ..."); diff --git a/src/lib/netlist/prg/nltool.cpp b/src/lib/netlist/prg/nltool.cpp index ec8fe57d448..ee0b80f7e08 100644 --- a/src/lib/netlist/prg/nltool.cpp +++ b/src/lib/netlist/prg/nltool.cpp @@ -807,6 +807,15 @@ int tool_app_t::execute() "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n\n" "Written by Couriersud.\n"); + if (opt_verb()) + { + std::vector<std::pair<pstring, pstring>> defs; + netlist::netlist_state_t::compile_defines(defs); + pout("\nCompile defines:\n"); + for (auto &x : defs) + pout("{1:-30} = {2}\n", x.first, x.second); + + } return 0; } |