diff options
author | couriersud <couriersud@gmx.org> | 2017-01-27 21:12:24 +0100 |
---|---|---|
committer | couriersud <couriersud@gmx.org> | 2017-01-28 03:52:42 +0100 |
commit | bd202228663fbbe1becf86999137b342d177d800 (patch) | |
tree | 5714bd7ebe38429274a891c4789e3a0d26fbd6df /src/lib/netlist | |
parent | 5a0a9748972ca0c41ce7679197d8e655264a73ce (diff) |
Fix bug which caused hazl1500 to crash. (nw)
Diffstat (limited to 'src/lib/netlist')
-rw-r--r-- | src/lib/netlist/nl_base.cpp | 26 | ||||
-rw-r--r-- | src/lib/netlist/nl_setup.cpp | 13 | ||||
-rw-r--r-- | src/lib/netlist/plib/ppmf.h | 1 |
3 files changed, 21 insertions, 19 deletions
diff --git a/src/lib/netlist/nl_base.cpp b/src/lib/netlist/nl_base.cpp index 90149f44e8e..adf06c8a164 100644 --- a/src/lib/netlist/nl_base.cpp +++ b/src/lib/netlist/nl_base.cpp @@ -319,6 +319,7 @@ void netlist_t::start() /* create devices */ + log().debug("Creating devices ...\n"); for (auto & e : setup().m_device_factory) { if ( !setup().factory().is_class<devices::NETLIB_NAME(solver)>(e.second) @@ -356,6 +357,25 @@ void netlist_t::start() /* resolve inputs */ setup().resolve_inputs(); + /* Make sure devices are fully created - now done in register_dev */ + + log().debug("Setting delegate pointers ...\n"); + for (auto &dev : m_devices) + dev->set_delegate_pointer(); + + log().verbose("looking for two terms connected to rail nets ..."); + for (auto & t : get_device_list<analog::NETLIB_NAME(twoterm)>()) + { + if (t->m_N.net().isRailNet() && t->m_P.net().isRailNet()) + { + log().warning(MW_3_REMOVE_DEVICE_1_CONNECTED_ONLY_TO_RAILS_2_3, + t->name(), t->m_N.net().name(), t->m_P.net().name()); + t->m_N.net().remove_terminal(t->m_N); + t->m_P.net().remove_terminal(t->m_P); + remove_dev(t); + } + } + log().verbose("initialize solver ...\n"); if (m_solver == nullptr) @@ -367,12 +387,6 @@ void netlist_t::start() else m_solver->post_start(); - /* finally, set the pointers */ - - log().debug("Setting delegate pointers ...\n"); - for (auto &dev : m_devices) - dev->set_delegate_pointer(); - } void netlist_t::stop() diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp index 5b176f1d266..a36b1bc77ba 100644 --- a/src/lib/netlist/nl_setup.cpp +++ b/src/lib/netlist/nl_setup.cpp @@ -747,19 +747,6 @@ void setup_t::resolve_inputs() if (errstr != "") log().fatal("{1}", errstr); - - log().verbose("looking for two terms connected to rail nets ..."); - for (auto & t : netlist().get_device_list<analog::NETLIB_NAME(twoterm)>()) - { - if (t->m_N.net().isRailNet() && t->m_P.net().isRailNet()) - { - log().warning(MW_3_REMOVE_DEVICE_1_CONNECTED_ONLY_TO_RAILS_2_3, - t->name(), t->m_N.net().name(), t->m_P.net().name()); - t->m_N.net().remove_terminal(t->m_N); - t->m_P.net().remove_terminal(t->m_P); - netlist().remove_dev(t); - } - } } void setup_t::start_devices() diff --git a/src/lib/netlist/plib/ppmf.h b/src/lib/netlist/plib/ppmf.h index 8cff664d08b..7d7b4e4cb7c 100644 --- a/src/lib/netlist/plib/ppmf.h +++ b/src/lib/netlist/plib/ppmf.h @@ -152,6 +152,7 @@ namespace plib { using function_ptr = MEMBER_ABI R (*)(O *obj, Targs... args); return (reinterpret_cast<function_ptr>(m_func))(obj, std::forward<Targs>(args)...); } + bool is_set() { return m_func != nullptr; } private: generic_function m_func; }; |