summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatarGravatar couriersud <couriersud@gmx.org>2020-04-28 18:24:24 +0200
committerGravatarGravatar couriersud <couriersud@gmx.org>2020-04-28 21:08:05 +0200
commit14e4c4bb3f708eb63b757cefcb86245e991a424a (patch) (github)
treeb5e7e6f4cec3001dca3750c234cfbfd3e2bc5140
parent097c736f7971156d6318b0e8aa3740513c23421c (diff)
downloadmame-14e4c4bb3f708eb63b757cefcb86245e991a424a.tar.bz2
mame-14e4c4bb3f708eb63b757cefcb86245e991a424a.zip
netlist: improve const-awareness and tidy changes. (nw)
Identified a number of code locations which could accept const arguments.
-rw-r--r--src/lib/netlist/analog/nlid_twoterm.h1
-rw-r--r--src/lib/netlist/devices/nlid_proxy.cpp10
-rw-r--r--src/lib/netlist/devices/nlid_proxy.h10
-rw-r--r--src/lib/netlist/nl_base.cpp18
-rw-r--r--src/lib/netlist/nl_base.h13
-rwxr-xr-xsrc/lib/netlist/nl_setup.cpp34
-rw-r--r--src/lib/netlist/nl_setup.h4
-rw-r--r--src/lib/netlist/plib/palloc.h2
-rw-r--r--src/lib/netlist/solver/nld_solver.cpp6
9 files changed, 49 insertions, 49 deletions
diff --git a/src/lib/netlist/analog/nlid_twoterm.h b/src/lib/netlist/analog/nlid_twoterm.h
index 8a9f8110aa6..f0f90867a36 100644
--- a/src/lib/netlist/analog/nlid_twoterm.h
+++ b/src/lib/netlist/analog/nlid_twoterm.h
@@ -186,7 +186,6 @@ namespace analog
//NETLIB_UPDATEI() { }
NETLIB_RESETI()
{
- NETLIB_NAME(twoterm)::reset();
set_R(std::max(m_R(), exec().gmin()));
}
diff --git a/src/lib/netlist/devices/nlid_proxy.cpp b/src/lib/netlist/devices/nlid_proxy.cpp
index 736179d450a..7f76a0049a2 100644
--- a/src/lib/netlist/devices/nlid_proxy.cpp
+++ b/src/lib/netlist/devices/nlid_proxy.cpp
@@ -18,7 +18,7 @@ namespace netlist
// -----------------------------------------------------------------------------
nld_base_proxy::nld_base_proxy(netlist_state_t &anetlist, const pstring &name,
- logic_t *inout_proxied)
+ const logic_t *inout_proxied)
: device_t(anetlist, name)
, m_tp(nullptr)
, m_tn(nullptr)
@@ -69,12 +69,12 @@ namespace netlist
// ----------------------------------------------------------------------------------------
nld_base_a_to_d_proxy::nld_base_a_to_d_proxy(netlist_state_t &anetlist, const pstring &name,
- logic_input_t *in_proxied)
+ const logic_input_t *in_proxied)
: nld_base_proxy(anetlist, name, in_proxied)
{
}
- nld_a_to_d_proxy::nld_a_to_d_proxy(netlist_state_t &anetlist, const pstring &name, logic_input_t *in_proxied)
+ nld_a_to_d_proxy::nld_a_to_d_proxy(netlist_state_t &anetlist, const pstring &name, const logic_input_t *in_proxied)
: nld_base_a_to_d_proxy(anetlist, name, in_proxied)
, m_Q(*this, "Q")
, m_I(*this, "I")
@@ -106,12 +106,12 @@ namespace netlist
// ----------------------------------------------------------------------------------------
nld_base_d_to_a_proxy::nld_base_d_to_a_proxy(netlist_state_t &anetlist, const pstring &name,
- logic_output_t *out_proxied)
+ const logic_output_t *out_proxied)
: nld_base_proxy(anetlist, name, out_proxied)
{
}
- nld_d_to_a_proxy::nld_d_to_a_proxy(netlist_state_t &anetlist, const pstring &name, logic_output_t *out_proxied)
+ nld_d_to_a_proxy::nld_d_to_a_proxy(netlist_state_t &anetlist, const pstring &name, const logic_output_t *out_proxied)
: nld_base_d_to_a_proxy(anetlist, name, out_proxied)
, m_I(*this, "I")
, m_RP(*this, "RP")
diff --git a/src/lib/netlist/devices/nlid_proxy.h b/src/lib/netlist/devices/nlid_proxy.h
index 008c234dabf..5de5e27c4f8 100644
--- a/src/lib/netlist/devices/nlid_proxy.h
+++ b/src/lib/netlist/devices/nlid_proxy.h
@@ -27,7 +27,7 @@ namespace devices
{
public:
nld_base_proxy(netlist_state_t &anetlist, const pstring &name,
- logic_t *inout_proxied);
+ const logic_t *inout_proxied);
// only used during setup
virtual detail::core_terminal_t &proxy_term() noexcept = 0;
@@ -51,7 +51,7 @@ namespace devices
protected:
nld_base_a_to_d_proxy(netlist_state_t &anetlist, const pstring &name,
- logic_input_t *in_proxied);
+ const logic_input_t *in_proxied);
};
@@ -59,7 +59,7 @@ namespace devices
{
public:
nld_a_to_d_proxy(netlist_state_t &anetlist, const pstring &name,
- logic_input_t *in_proxied);
+ const logic_input_t *in_proxied);
logic_output_t &out() noexcept override { return m_Q; }
@@ -89,7 +89,7 @@ namespace devices
protected:
nld_base_d_to_a_proxy(netlist_state_t &anetlist, const pstring &name,
- logic_output_t *out_proxied);
+ const logic_output_t *out_proxied);
};
@@ -97,7 +97,7 @@ namespace devices
{
public:
nld_d_to_a_proxy(netlist_state_t &anetlist, const pstring &name,
- logic_output_t *out_proxied);
+ const logic_output_t *out_proxied);
logic_input_t &in() noexcept override { return m_I; }
diff --git a/src/lib/netlist/nl_base.cpp b/src/lib/netlist/nl_base.cpp
index 118d3857ebd..68778d1b878 100644
--- a/src/lib/netlist/nl_base.cpp
+++ b/src/lib/netlist/nl_base.cpp
@@ -52,15 +52,15 @@ namespace netlist
m_R_low = nlconst::magic(1.0);
m_R_high = nlconst::magic(130.0);
}
- unique_pool_ptr<devices::nld_base_d_to_a_proxy> create_d_a_proxy(netlist_state_t &anetlist, const pstring &name, logic_output_t *proxied) const override;
- unique_pool_ptr<devices::nld_base_a_to_d_proxy> create_a_d_proxy(netlist_state_t &anetlist, const pstring &name, logic_input_t *proxied) const override;
+ unique_pool_ptr<devices::nld_base_d_to_a_proxy> create_d_a_proxy(netlist_state_t &anetlist, const pstring &name, const logic_output_t *proxied) const override;
+ unique_pool_ptr<devices::nld_base_a_to_d_proxy> create_a_d_proxy(netlist_state_t &anetlist, const pstring &name, const logic_input_t *proxied) const override;
};
- unique_pool_ptr<devices::nld_base_d_to_a_proxy> logic_family_ttl_t::create_d_a_proxy(netlist_state_t &anetlist, const pstring &name, logic_output_t *proxied) const
+ unique_pool_ptr<devices::nld_base_d_to_a_proxy> logic_family_ttl_t::create_d_a_proxy(netlist_state_t &anetlist, const pstring &name, const logic_output_t *proxied) const
{
return anetlist.make_object<devices::nld_d_to_a_proxy>(anetlist, name, proxied);
}
- unique_pool_ptr<devices::nld_base_a_to_d_proxy> logic_family_ttl_t::create_a_d_proxy(netlist_state_t &anetlist, const pstring &name, logic_input_t *proxied) const
+ unique_pool_ptr<devices::nld_base_a_to_d_proxy> logic_family_ttl_t::create_a_d_proxy(netlist_state_t &anetlist, const pstring &name, const logic_input_t *proxied) const
{
return anetlist.make_object<devices::nld_a_to_d_proxy>(anetlist, name, proxied);
}
@@ -80,16 +80,16 @@ namespace netlist
m_R_low = nlconst::magic(500.0);
m_R_high = nlconst::magic(500.0);
}
- unique_pool_ptr<devices::nld_base_d_to_a_proxy> create_d_a_proxy(netlist_state_t &anetlist, const pstring &name, logic_output_t *proxied) const override;
- unique_pool_ptr<devices::nld_base_a_to_d_proxy> create_a_d_proxy(netlist_state_t &anetlist, const pstring &name, logic_input_t *proxied) const override;
+ unique_pool_ptr<devices::nld_base_d_to_a_proxy> create_d_a_proxy(netlist_state_t &anetlist, const pstring &name, const logic_output_t *proxied) const override;
+ unique_pool_ptr<devices::nld_base_a_to_d_proxy> create_a_d_proxy(netlist_state_t &anetlist, const pstring &name, const logic_input_t *proxied) const override;
};
- unique_pool_ptr<devices::nld_base_d_to_a_proxy> logic_family_cd4xxx_t::create_d_a_proxy(netlist_state_t &anetlist, const pstring &name, logic_output_t *proxied) const
+ unique_pool_ptr<devices::nld_base_d_to_a_proxy> logic_family_cd4xxx_t::create_d_a_proxy(netlist_state_t &anetlist, const pstring &name, const logic_output_t *proxied) const
{
return anetlist.make_object<devices::nld_d_to_a_proxy>(anetlist, name, proxied);
}
- unique_pool_ptr<devices::nld_base_a_to_d_proxy> logic_family_cd4xxx_t::create_a_d_proxy(netlist_state_t &anetlist, const pstring &name, logic_input_t *proxied) const
+ unique_pool_ptr<devices::nld_base_a_to_d_proxy> logic_family_cd4xxx_t::create_a_d_proxy(netlist_state_t &anetlist, const pstring &name, const logic_input_t *proxied) const
{
return anetlist.make_object<devices::nld_a_to_d_proxy>(anetlist, name, proxied);
}
@@ -811,7 +811,7 @@ namespace netlist
state().setup().register_term(*this, *otherterm);
}
- void terminal_t::solve_now()
+ void terminal_t::solve_now() const
{
const auto *solv(solver());
// Nets may belong to railnets which do not have a solver attached
diff --git a/src/lib/netlist/nl_base.h b/src/lib/netlist/nl_base.h
index 4259e9f663b..1bbd2bd483d 100644
--- a/src/lib/netlist/nl_base.h
+++ b/src/lib/netlist/nl_base.h
@@ -264,9 +264,9 @@ namespace netlist
virtual ~logic_family_desc_t() noexcept = default;
virtual unique_pool_ptr<devices::nld_base_d_to_a_proxy> create_d_a_proxy(netlist_state_t &anetlist, const pstring &name,
- logic_output_t *proxied) const = 0;
+ const logic_output_t *proxied) const = 0;
virtual unique_pool_ptr<devices::nld_base_a_to_d_proxy> create_a_d_proxy(netlist_state_t &anetlist, const pstring &name,
- logic_input_t *proxied) const = 0;
+ const logic_input_t *proxied) const = 0;
nl_fptype low_thresh_V(nl_fptype VN, nl_fptype VP) const noexcept{ return VN + (VP - VN) * m_low_thresh_PCNT; }
nl_fptype high_thresh_V(nl_fptype VN, nl_fptype VP) const noexcept{ return VN + (VP - VN) * m_high_thresh_PCNT; }
@@ -468,9 +468,7 @@ namespace netlist
/// \brief The base class for netlist devices, terminals and parameters.
///
/// This class serves as the base class for all device, terminal and
- /// objects. It provides new and delete operators to support e.g. pooled
- /// memory allocation to enhance locality. Please refer to \ref NL_USE_MEMPOOL as
- /// well.
+ /// objects.
class object_t
{
@@ -621,8 +619,7 @@ namespace netlist
void clear_net() noexcept { m_net = nullptr; }
bool has_net() const noexcept { return (m_net != nullptr); }
- const net_t & net() const noexcept { return *m_net;}
- net_t & net() noexcept { return *m_net;}
+ net_t & net() const noexcept { return *m_net;}
bool is_logic() const noexcept;
bool is_logic_input() const noexcept;
@@ -838,7 +835,7 @@ namespace netlist
}
}
- void solve_now();
+ void solve_now() const;
void set_ptrs(nl_fptype *gt, nl_fptype *go, nl_fptype *Idr) noexcept(false);
diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp
index a948ecb01f7..20fdf3eeaff 100755
--- a/src/lib/netlist/nl_setup.cpp
+++ b/src/lib/netlist/nl_setup.cpp
@@ -577,11 +577,11 @@ param_t *setup_t::find_param(const pstring &param_in, bool required) const
return (ret == m_params.end() ? nullptr : ret->second.param());
}
-devices::nld_base_proxy *setup_t::get_d_a_proxy(detail::core_terminal_t &out)
+devices::nld_base_proxy *setup_t::get_d_a_proxy(const detail::core_terminal_t &out)
{
nl_assert(out.is_logic());
- auto &out_cast = static_cast<logic_output_t &>(out);
+ const auto &out_cast = static_cast<const logic_output_t &>(out);
auto iter_proxy(m_proxies.find(&out));
if (iter_proxy != m_proxies.end())
@@ -622,7 +622,7 @@ devices::nld_base_proxy *setup_t::get_a_d_proxy(detail::core_terminal_t &inp)
{
nl_assert(inp.is_logic());
- auto &incast = dynamic_cast<logic_input_t &>(inp);
+ const auto &incast = dynamic_cast<const logic_input_t &>(inp);
auto iter_proxy(m_proxies.find(&inp));
@@ -668,7 +668,7 @@ detail::core_terminal_t &setup_t::resolve_proxy(detail::core_terminal_t &term)
{
if (term.is_logic())
{
- auto &out = dynamic_cast<logic_t &>(term);
+ const auto &out = dynamic_cast<const logic_t &>(term);
auto iter_proxy(m_proxies.find(&out));
if (iter_proxy != m_proxies.end())
return iter_proxy->second->proxy_term();
@@ -777,7 +777,7 @@ void setup_t::connect_terminal_output(terminal_t &in, detail::core_terminal_t &o
}
}
-void setup_t::connect_terminals(detail::core_terminal_t &t1, detail::core_terminal_t &t2)
+void setup_t::connect_terminals(detail::core_terminal_t &t1,detail::core_terminal_t &t2)
{
if (t1.has_net() && t2.has_net())
{
@@ -1145,15 +1145,15 @@ nl_fptype models_t::value(const pstring &model, const pstring &entity)
auto p = std::next(tmp.begin(), static_cast<pstring::difference_type>(tmp.size() - 1));
switch (*p)
{
- case 'M': factor = nlconst::magic(1e6); break; // NO_LINT
+ case 'M': factor = nlconst::magic(1e6); break; // NOLINT
case 'k':
- case 'K': factor = nlconst::magic(1e3); break; // NO_LINT
- case 'm': factor = nlconst::magic(1e-3); break; // NO_LINT
- case 'u': factor = nlconst::magic(1e-6); break; // NO_LINT
- case 'n': factor = nlconst::magic(1e-9); break; // NO_LINT
- case 'p': factor = nlconst::magic(1e-12); break; // NO_LINT
- case 'f': factor = nlconst::magic(1e-15); break; // NO_LINT
- case 'a': factor = nlconst::magic(1e-18); break; // NO_LINT
+ case 'K': factor = nlconst::magic(1e3); break; // NOLINT
+ case 'm': factor = nlconst::magic(1e-3); break; // NOLINT
+ case 'u': factor = nlconst::magic(1e-6); break; // NOLINT
+ case 'n': factor = nlconst::magic(1e-9); break; // NOLINT
+ case 'p': factor = nlconst::magic(1e-12); break; // NOLINT
+ case 'f': factor = nlconst::magic(1e-15); break; // NOLINT
+ case 'a': factor = nlconst::magic(1e-18); break; // NOLINT
default:
if (*p < '0' || *p > '9')
throw nl_exception(MF_UNKNOWN_NUMBER_FACTOR_IN_1(entity));
@@ -1174,16 +1174,16 @@ class logic_family_std_proxy_t : public logic_family_desc_t
public:
logic_family_std_proxy_t() = default;
unique_pool_ptr<devices::nld_base_d_to_a_proxy> create_d_a_proxy(netlist_state_t &anetlist,
- const pstring &name, logic_output_t *proxied) const override;
- unique_pool_ptr<devices::nld_base_a_to_d_proxy> create_a_d_proxy(netlist_state_t &anetlist, const pstring &name, logic_input_t *proxied) const override;
+ const pstring &name, const logic_output_t *proxied) const override;
+ unique_pool_ptr<devices::nld_base_a_to_d_proxy> create_a_d_proxy(netlist_state_t &anetlist, const pstring &name, const logic_input_t *proxied) const override;
};
unique_pool_ptr<devices::nld_base_d_to_a_proxy> logic_family_std_proxy_t::create_d_a_proxy(netlist_state_t &anetlist,
- const pstring &name, logic_output_t *proxied) const
+ const pstring &name, const logic_output_t *proxied) const
{
return anetlist.make_object<devices::nld_d_to_a_proxy>(anetlist, name, proxied);
}
-unique_pool_ptr<devices::nld_base_a_to_d_proxy> logic_family_std_proxy_t::create_a_d_proxy(netlist_state_t &anetlist, const pstring &name, logic_input_t *proxied) const
+unique_pool_ptr<devices::nld_base_a_to_d_proxy> logic_family_std_proxy_t::create_a_d_proxy(netlist_state_t &anetlist, const pstring &name, const logic_input_t *proxied) const
{
return anetlist.make_object<devices::nld_a_to_d_proxy>(anetlist, name, proxied);
}
diff --git a/src/lib/netlist/nl_setup.h b/src/lib/netlist/nl_setup.h
index 42fb4f26dfc..ecd52bf3afb 100644
--- a/src/lib/netlist/nl_setup.h
+++ b/src/lib/netlist/nl_setup.h
@@ -438,7 +438,7 @@ namespace netlist
// helpers
static pstring termtype_as_str(detail::core_terminal_t &in);
- devices::nld_base_proxy *get_d_a_proxy(detail::core_terminal_t &out);
+ devices::nld_base_proxy *get_d_a_proxy(const detail::core_terminal_t &out);
devices::nld_base_proxy *get_a_d_proxy(detail::core_terminal_t &inp);
detail::core_terminal_t &resolve_proxy(detail::core_terminal_t &term);
@@ -448,7 +448,7 @@ namespace netlist
netlist_state_t &m_nlstate;
devices::nld_netlistparams *m_netlist_params;
std::unordered_map<pstring, param_ref_t> m_params;
- std::unordered_map<detail::core_terminal_t *,
+ std::unordered_map<const detail::core_terminal_t *,
devices::nld_base_proxy *> m_proxies;
unsigned m_proxy_cnt;
diff --git a/src/lib/netlist/plib/palloc.h b/src/lib/netlist/plib/palloc.h
index ccee19f318e..3c33795103f 100644
--- a/src/lib/netlist/plib/palloc.h
+++ b/src/lib/netlist/plib/palloc.h
@@ -225,7 +225,7 @@ namespace plib {
T* allocate(std::size_t n)
{
- return reinterpret_cast<T *>(m_a.allocate(ALIGN, sizeof(T) * n));
+ return reinterpret_cast<T *>(m_a.allocate(ALIGN, sizeof(T) * n)); //NOLINT
}
void deallocate(T* p, std::size_t n) noexcept
diff --git a/src/lib/netlist/solver/nld_solver.cpp b/src/lib/netlist/solver/nld_solver.cpp
index f9870bf68d5..10c2909145f 100644
--- a/src/lib/netlist/solver/nld_solver.cpp
+++ b/src/lib/netlist/solver/nld_solver.cpp
@@ -137,7 +137,11 @@ namespace devices
// Woodbury Formula
return create_it<solver::matrix_solver_w_t<FT, SIZE>>(state(), solvername, nets, m_params, size);
#else
- default:
+ case solver::matrix_type_e::GMRES:
+ case solver::matrix_type_e::SOR:
+ case solver::matrix_type_e::SOR_MAT:
+ case solver::matrix_type_e::SM:
+ case solver::matrix_type_e::W:
state().log().warning(MW_SOLVER_METHOD_NOT_SUPPORTED(m_params.m_method().name(), "MAT_CR"));
return create_it<solver::matrix_solver_GCR_t<FT, SIZE>>(state(), solvername, nets, m_params, size);
#endif