diff options
-rw-r--r-- | src/lib/netlist/analog/nlid_twoterm.h | 26 | ||||
-rw-r--r-- | src/lib/netlist/devices/nlid_proxy.h | 2 | ||||
-rw-r--r-- | src/lib/netlist/nl_base.cpp | 12 | ||||
-rw-r--r-- | src/lib/netlist/nl_base.h | 1 | ||||
-rwxr-xr-x | src/lib/netlist/nl_setup.cpp | 14 | ||||
-rw-r--r-- | src/lib/netlist/nl_setup.h | 40 | ||||
-rw-r--r-- | src/lib/netlist/solver/nld_matrix_solver.cpp | 6 |
7 files changed, 46 insertions, 55 deletions
diff --git a/src/lib/netlist/analog/nlid_twoterm.h b/src/lib/netlist/analog/nlid_twoterm.h index f0f90867a36..e318a508817 100644 --- a/src/lib/netlist/analog/nlid_twoterm.h +++ b/src/lib/netlist/analog/nlid_twoterm.h @@ -89,7 +89,7 @@ namespace analog void solve_now() const; template <typename F> - void change_state(F f, netlist_time delay = netlist_time::quantum()) + void change_state(F f, netlist_time delay = netlist_time::quantum()) const { auto *solv(solver()); if (solv) @@ -126,21 +126,37 @@ namespace analog m_N.set_go_gt_I(a21, a22, rhs2); } - /// \brief Get a reference to the m_P terminal + /// \brief Get a const reference to the m_P terminal /// /// This is typically called during initialization to connect /// terminals. /// /// \returns Reference to m_P terminal. - terminal_t &P() noexcept { return m_P; } + const terminal_t &P() const noexcept { return m_P; } - /// \brief Get a reference to the m_N terminal + /// \brief Get a const reference to the m_N terminal /// /// This is typically called during initialization to connect /// terminals. /// /// \returns Reference to m_N terminal. - terminal_t &N() noexcept { return m_N; } + const terminal_t &N() const noexcept { return m_N; } + + /// \brief Get a reference to the m_P terminal + /// + /// This call is only allowed from the core. Device code should never + /// need to call this. + /// + /// \returns Reference to m_P terminal. + terminal_t &setup_P() noexcept { return m_P; } + + /// \brief Get a reference to the m_N terminal + /// + /// This call is only allowed from the core. Device code should never + /// need to call this. + /// + /// \returns Reference to m_P terminal. + terminal_t &setup_N() noexcept { return m_N; } private: terminal_t m_P; diff --git a/src/lib/netlist/devices/nlid_proxy.h b/src/lib/netlist/devices/nlid_proxy.h index 5de5e27c4f8..5ba505cd03d 100644 --- a/src/lib/netlist/devices/nlid_proxy.h +++ b/src/lib/netlist/devices/nlid_proxy.h @@ -103,7 +103,7 @@ namespace devices detail::core_terminal_t &proxy_term() noexcept override { - return m_RN.P(); + return m_RN.setup_P(); } protected: diff --git a/src/lib/netlist/nl_base.cpp b/src/lib/netlist/nl_base.cpp index 68778d1b878..7db9354ba0e 100644 --- a/src/lib/netlist/nl_base.cpp +++ b/src/lib/netlist/nl_base.cpp @@ -630,18 +630,6 @@ namespace netlist state().setup().register_link_fqn(name() + "." + t1, name() + "." + t2); } - // FIXME: this is only used by solver code since matrix solvers are started in - // post_start. - void device_t::connect_post_start(detail::core_terminal_t &t1, detail::core_terminal_t &t2) - { - if (!state().setup().connect(t1, t2)) - { - log().fatal(MF_ERROR_CONNECTING_1_TO_2(t1.name(), t2.name())); - throw nl_exception(MF_ERROR_CONNECTING_1_TO_2(t1.name(), t2.name())); - } - } - - // ----------------------------------------------------------------------------- // family_setter_t // ----------------------------------------------------------------------------- diff --git a/src/lib/netlist/nl_base.h b/src/lib/netlist/nl_base.h index 1bbd2bd483d..8893294f76c 100644 --- a/src/lib/netlist/nl_base.h +++ b/src/lib/netlist/nl_base.h @@ -1098,7 +1098,6 @@ namespace netlist void connect(const pstring &t1, const pstring &t2); void connect(const detail::core_terminal_t &t1, const detail::core_terminal_t &t2); - void connect_post_start(detail::core_terminal_t &t1, detail::core_terminal_t &t2) noexcept(false); protected: NETLIB_UPDATEI() { } diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp index 20fdf3eeaff..3ba4345267a 100755 --- a/src/lib/netlist/nl_setup.cpp +++ b/src/lib/netlist/nl_setup.cpp @@ -1036,16 +1036,6 @@ void setup_t::register_dynamic_log_devices(const std::vector<pstring> &loglist) } } -log_type &setup_t::log() -{ - return m_nlstate.log(); -} -const log_type &setup_t::log() const -{ - return m_nlstate.log(); -} - - // ---------------------------------------------------------------------------------------- // Models // ---------------------------------------------------------------------------------------- @@ -1339,8 +1329,8 @@ void setup_t::prepare_to_run() { log().info(MI_REMOVE_DEVICE_1_CONNECTED_ONLY_TO_RAILS_2_3( t->name(), t->N().net().name(), t->P().net().name())); - t->N().net().remove_terminal(t->N()); - t->P().net().remove_terminal(t->P()); + t->setup_N().net().remove_terminal(t->setup_N()); + t->setup_P().net().remove_terminal(t->setup_P()); m_nlstate.remove_device(t); } } diff --git a/src/lib/netlist/nl_setup.h b/src/lib/netlist/nl_setup.h index ecd52bf3afb..92c605f7c4c 100644 --- a/src/lib/netlist/nl_setup.h +++ b/src/lib/netlist/nl_setup.h @@ -68,7 +68,8 @@ #define NETLIST_START(name) \ void NETLIST_NAME(name)(netlist::nlparse_t &setup) \ -{ +{ \ + plib::unused_var(setup); #define NETLIST_END() } @@ -378,54 +379,47 @@ namespace netlist netlist_state_t &nlstate() { return m_nlstate; } const netlist_state_t &nlstate() const { return m_nlstate; } + // called from param_t creation void register_param_t(const pstring &name, param_t ¶m); - pstring get_initial_param_val(const pstring &name, const pstring &def) const; void register_term(detail::core_terminal_t &term); void register_term(terminal_t &term, terminal_t &other_term); + // called from net_splitter terminal_t *get_connected_terminal(const terminal_t &term) const noexcept { auto ret(m_connected_terminals.find(&term)); return (ret != m_connected_terminals.end()) ? ret->second : nullptr; } - void remove_connections(const pstring &pin); - - bool connect(detail::core_terminal_t &t1, detail::core_terminal_t &t2); - - param_t *find_param(const pstring ¶m_in, bool required = true) const; - - // get family + // get family -> truthtable const logic_family_desc_t *family_from_model(const pstring &model); + // tools use this -> FIXME: needs another place void register_dynamic_log_devices(const std::vector<pstring> &loglist); - void resolve_inputs(); - - // helper - also used by nltool - pstring resolve_alias(const pstring &name) const; - pstring de_alias(const pstring &alias) const; - + param_t *find_param(const pstring ¶m_in, bool required = true) const; // needed by nltool std::vector<pstring> get_terminals_for_device_name(const pstring &devname) const; - log_type &log(); - const log_type &log() const; - - // needed by proxy + // needed by proxy device to check power terminals -> FIXME: this should be a setup_t task detail::core_terminal_t *find_terminal(const pstring &terminal_in, detail::terminal_type atype, bool required = true) const; detail::core_terminal_t *find_terminal(const pstring &terminal_in, bool required = true) const; - - // core net handling - - void delete_empty_nets(); + pstring de_alias(const pstring &alias) const; + // FIXME: only needed by solver code outside of setup_t + bool connect(detail::core_terminal_t &t1, detail::core_terminal_t &t2); // run preparation void prepare_to_run(); private: + // FIXME: stale? - remove later + void remove_connections(const pstring &pin); + + void resolve_inputs(); + pstring resolve_alias(const pstring &name) const; + void delete_empty_nets(); void merge_nets(detail::net_t &thisnet, detail::net_t &othernet); diff --git a/src/lib/netlist/solver/nld_matrix_solver.cpp b/src/lib/netlist/solver/nld_matrix_solver.cpp index cbb9f138a4a..291f56100a8 100644 --- a/src/lib/netlist/solver/nld_matrix_solver.cpp +++ b/src/lib/netlist/solver/nld_matrix_solver.cpp @@ -51,7 +51,11 @@ namespace solver , m_Q_sync(*this, "Q_sync") , m_ops(0) { - connect_post_start(m_fb_sync, m_Q_sync); + if (!anetlist.setup().connect(m_fb_sync, m_Q_sync)) + { + log().fatal(MF_ERROR_CONNECTING_1_TO_2(m_fb_sync.name(), m_Q_sync.name())); + throw nl_exception(MF_ERROR_CONNECTING_1_TO_2(m_fb_sync.name(), m_Q_sync.name())); + } setup_base(nets); // now setup the matrix |