mirror of
https://github.com/holub/mame
synced 2025-10-04 16:34:53 +03:00
netlist: more core guidelines work. (nw)
This commit is contained in:
parent
ac124a896b
commit
9d8cb783e3
@ -117,7 +117,7 @@ namespace {
|
||||
class NETLIB_NAME(analog_callback) : public netlist::device_t
|
||||
{
|
||||
public:
|
||||
NETLIB_NAME(analog_callback)(netlist::netlist_base_t &anetlist, const pstring &name)
|
||||
NETLIB_NAME(analog_callback)(netlist::netlist_state_t &anetlist, const pstring &name)
|
||||
: device_t(anetlist, name)
|
||||
, m_in(*this, "IN")
|
||||
, m_cpu_device(nullptr)
|
||||
@ -165,7 +165,7 @@ private:
|
||||
class NETLIB_NAME(logic_callback) : public netlist::device_t
|
||||
{
|
||||
public:
|
||||
NETLIB_NAME(logic_callback)(netlist::netlist_base_t &anetlist, const pstring &name)
|
||||
NETLIB_NAME(logic_callback)(netlist::netlist_state_t &anetlist, const pstring &name)
|
||||
: device_t(anetlist, name)
|
||||
, m_in(*this, "IN")
|
||||
, m_cpu_device(nullptr)
|
||||
@ -273,7 +273,7 @@ std::unique_ptr<plib::pistream> netlist_data_memregions_t::stream(const pstring
|
||||
class NETLIB_NAME(sound_out) : public netlist::device_t
|
||||
{
|
||||
public:
|
||||
NETLIB_NAME(sound_out)(netlist::netlist_base_t &anetlist, const pstring &name)
|
||||
NETLIB_NAME(sound_out)(netlist::netlist_state_t &anetlist, const pstring &name)
|
||||
: netlist::device_t(anetlist, name)
|
||||
, m_channel(*this, "CHAN", 0)
|
||||
, m_mult(*this, "MULT", 1000.0)
|
||||
@ -355,7 +355,7 @@ public:
|
||||
|
||||
static const int MAX_INPUT_CHANNELS = 16;
|
||||
|
||||
NETLIB_NAME(sound_in)(netlist::netlist_base_t &anetlist, const pstring &name)
|
||||
NETLIB_NAME(sound_in)(netlist::netlist_state_t &anetlist, const pstring &name)
|
||||
: netlist::device_t(anetlist, name)
|
||||
, m_inc(netlist::netlist_time::from_nsec(1))
|
||||
, m_feedback(*this, "FB") // clock part
|
||||
|
@ -56,7 +56,7 @@ namespace netlist
|
||||
return b ? *h : d2;
|
||||
}
|
||||
template<>
|
||||
inline core_device_t &bselect(bool b, netlist_base_t &d1, core_device_t &d2)
|
||||
inline core_device_t &bselect(bool b, netlist_state_t &d1, core_device_t &d2)
|
||||
{
|
||||
plib::unused_var(d1);
|
||||
if (b)
|
||||
|
@ -14,18 +14,20 @@ VSBUILD = $(SRC)/buildVS
|
||||
DOC = $(SRC)/documentation
|
||||
TIDY_DB = ../compile_commands.json
|
||||
|
||||
TIDY_FLAGSX = -checks=*,-google*,-hicpp*,-readability*,-fuchsia*,-llvm-header-guard,
|
||||
TIDY_FLAGSX += -modernize-use-using,-cppcoreguidelines-pro-type-reinterpret-cast,
|
||||
TIDY_FLAGSX = -checks=*,-google*,-hicpp*,-readability*,-fuchsia*,-cert-*,
|
||||
TIDY_FLAGSX += -llvm-header-guard,-cppcoreguidelines-pro-type-reinterpret-cast,
|
||||
TIDY_FLAGSX += -cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-owning-memory,
|
||||
TIDY_FLAGSX += -modernize-use-default-member-init,-cert-*,-cppcoreguidelines-pro-bounds-constant-array-index,
|
||||
TIDY_FLAGSX += -modernize-pass-by-value,-misc-macro-parentheses,-cppcoreguidelines-pro-type-static-cast-downcast,
|
||||
TIDY_FLAGSX += -cppcoreguidelines-special-member-functions,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
|
||||
TIDY_FLAGSX += -modernize-use-default-member-init,-cppcoreguidelines-pro-bounds-constant-array-index,
|
||||
TIDY_FLAGSX += -modernize-pass-by-value,-cppcoreguidelines-pro-type-static-cast-downcast,
|
||||
//TIDY_FLAGSX += -cppcoreguidelines-special-member-functions,
|
||||
TIDY_FLAGSX += -cppcoreguidelines-pro-bounds-array-to-pointer-decay,
|
||||
TIDY_FLAGSX += -performance-unnecessary-value-param,-android-*,-cppcoreguidelines-avoid-magic-numbers,
|
||||
TIDY_FLAGSX += -cppcoreguidelines-macro-usage,-misc-non-private-member-variables-in-classes,
|
||||
TIDY_FLAGSX += -cppcoreguidelines-non-private-member-variables-in-classes,
|
||||
TIDY_FLAGSX += -cppcoreguidelines-macro-usage,
|
||||
TIDY_FLAGSX += -cppcoreguidelines-non-private-member-variables-in-classes,-misc-non-private-member-variables-in-classes,
|
||||
#TIDY_FLAGSX += -cppcoreguidelines-avoid-c-arrays,-modernize-avoid-c-arrays,
|
||||
#TIDY_FLAGSX += -modernize-use-using,
|
||||
TIDY_FLAGSX += -performance-unnecessary-copy-initialization,
|
||||
TIDY_FLAGSX += -bugprone-macro-parentheses
|
||||
TIDY_FLAGSX += -bugprone-macro-parentheses,-misc-macro-parentheses
|
||||
|
||||
space :=
|
||||
space +=
|
||||
@ -34,6 +36,7 @@ TIDY_FLAGS = $(subst $(space),,$(TIDY_FLAGSX))
|
||||
#TIDY_FLAGS = -checks=llvm-include-order -fix
|
||||
#TIDY_FLAGS = -checks=llvm-namespace-comment -fix
|
||||
#TIDY_FLAGS = -checks=modernize-use-override -fix
|
||||
#TIDY_FLAGS = -checks=modernize-use-using -fix
|
||||
|
||||
ifeq ($(subst Windows_NT,windows,$(OS)),windows)
|
||||
OBJ = obj/mingw
|
||||
|
@ -20,7 +20,7 @@ namespace netlist
|
||||
// nld_base_proxy
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
nld_base_proxy::nld_base_proxy(netlist_base_t &anetlist, const pstring &name,
|
||||
nld_base_proxy::nld_base_proxy(netlist_state_t &anetlist, const pstring &name,
|
||||
logic_t *inout_proxied, detail::core_terminal_t *proxy_inout)
|
||||
: device_t(anetlist, name)
|
||||
{
|
||||
@ -33,14 +33,14 @@ namespace netlist
|
||||
// nld_a_to_d_proxy
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
nld_base_a_to_d_proxy::nld_base_a_to_d_proxy(netlist_base_t &anetlist, const pstring &name,
|
||||
nld_base_a_to_d_proxy::nld_base_a_to_d_proxy(netlist_state_t &anetlist, const pstring &name,
|
||||
logic_input_t *in_proxied, detail::core_terminal_t *in_proxy)
|
||||
: nld_base_proxy(anetlist, name, in_proxied, in_proxy)
|
||||
, m_Q(*this, "Q")
|
||||
{
|
||||
}
|
||||
|
||||
nld_a_to_d_proxy::nld_a_to_d_proxy(netlist_base_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, logic_input_t *in_proxied)
|
||||
: nld_base_a_to_d_proxy(anetlist, name, in_proxied, &m_I)
|
||||
, m_I(*this, "I")
|
||||
{
|
||||
@ -71,35 +71,32 @@ namespace netlist
|
||||
// nld_d_to_a_proxy
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
nld_base_d_to_a_proxy::nld_base_d_to_a_proxy(netlist_base_t &anetlist, const pstring &name,
|
||||
nld_base_d_to_a_proxy::nld_base_d_to_a_proxy(netlist_state_t &anetlist, const pstring &name,
|
||||
logic_output_t *out_proxied, detail::core_terminal_t &proxy_out)
|
||||
: nld_base_proxy(anetlist, name, out_proxied, &proxy_out)
|
||||
, m_I(*this, "I")
|
||||
{
|
||||
}
|
||||
|
||||
nld_d_to_a_proxy::nld_d_to_a_proxy(netlist_base_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, logic_output_t *out_proxied)
|
||||
: nld_base_d_to_a_proxy(anetlist, name, out_proxied, m_RV.m_P)
|
||||
, m_GNDHack(*this, "_Q")
|
||||
, m_RV(*this, "RV")
|
||||
, m_last_state(*this, "m_last_var", -1)
|
||||
, m_is_timestep(false)
|
||||
{
|
||||
const pstring power_syms[3][2] ={ {"VCC", "VEE"}, {"VCC", "GND"}, {"VDD", "VSS"}};
|
||||
//register_sub(m_RV);
|
||||
//register_term("1", m_RV.m_P);
|
||||
//register_term("2", m_RV.m_N);
|
||||
const std::vector<std::pair<pstring, pstring>> power_syms = { {"VCC", "VEE"}, {"VCC", "GND"}, {"VDD", "VSS"}};
|
||||
|
||||
register_subalias("Q", m_RV.m_P);
|
||||
|
||||
connect(m_RV.m_N, m_GNDHack);
|
||||
bool f = false;
|
||||
for (int i = 0; i < 3; i++)
|
||||
for (auto & pwr_sym : power_syms)
|
||||
{
|
||||
pstring devname = out_proxied->device().name();
|
||||
auto tp = setup().find_terminal(devname + "." + power_syms[i][0],
|
||||
auto tp = setup().find_terminal(devname + "." + pwr_sym.first,
|
||||
detail::terminal_type::INPUT, false);
|
||||
auto tn = setup().find_terminal(devname + "." + power_syms[i][1],
|
||||
auto tn = setup().find_terminal(devname + "." + pwr_sym.second,
|
||||
detail::terminal_type::INPUT, false);
|
||||
if (tp != nullptr && tn != nullptr)
|
||||
{
|
||||
|
@ -26,7 +26,7 @@ namespace netlist
|
||||
NETLIB_OBJECT(base_proxy)
|
||||
{
|
||||
public:
|
||||
nld_base_proxy(netlist_base_t &anetlist, const pstring &name,
|
||||
nld_base_proxy(netlist_state_t &anetlist, const pstring &name,
|
||||
logic_t *inout_proxied, detail::core_terminal_t *proxy_inout);
|
||||
|
||||
~nld_base_proxy() override = default;
|
||||
@ -55,7 +55,7 @@ namespace netlist
|
||||
|
||||
protected:
|
||||
|
||||
nld_base_a_to_d_proxy(netlist_base_t &anetlist, const pstring &name,
|
||||
nld_base_a_to_d_proxy(netlist_state_t &anetlist, const pstring &name,
|
||||
logic_input_t *in_proxied, detail::core_terminal_t *in_proxy);
|
||||
|
||||
private:
|
||||
@ -67,7 +67,7 @@ namespace netlist
|
||||
NETLIB_OBJECT_DERIVED(a_to_d_proxy, base_a_to_d_proxy)
|
||||
{
|
||||
public:
|
||||
nld_a_to_d_proxy(netlist_base_t &anetlist, const pstring &name, logic_input_t *in_proxied);
|
||||
nld_a_to_d_proxy(netlist_state_t &anetlist, const pstring &name, logic_input_t *in_proxied);
|
||||
|
||||
~nld_a_to_d_proxy() override = default;
|
||||
|
||||
@ -93,7 +93,7 @@ namespace netlist
|
||||
virtual logic_input_t &in() { return m_I; }
|
||||
|
||||
protected:
|
||||
nld_base_d_to_a_proxy(netlist_base_t &anetlist, const pstring &name,
|
||||
nld_base_d_to_a_proxy(netlist_state_t &anetlist, const pstring &name,
|
||||
logic_output_t *out_proxied, detail::core_terminal_t &proxy_out);
|
||||
|
||||
logic_input_t m_I;
|
||||
@ -104,7 +104,7 @@ namespace netlist
|
||||
NETLIB_OBJECT_DERIVED(d_to_a_proxy, base_d_to_a_proxy)
|
||||
{
|
||||
public:
|
||||
nld_d_to_a_proxy(netlist_base_t &anetlist, const pstring &name, logic_output_t *out_proxied);
|
||||
nld_d_to_a_proxy(netlist_state_t &anetlist, const pstring &name, logic_output_t *out_proxied);
|
||||
~nld_d_to_a_proxy() override = default;
|
||||
|
||||
protected:
|
||||
|
@ -24,7 +24,7 @@ namespace netlist
|
||||
template <typename T>
|
||||
struct sbitset
|
||||
{
|
||||
typedef T type;
|
||||
using type = T;
|
||||
|
||||
sbitset() : m_bs(0) { }
|
||||
/* explicit */ sbitset(T v) : m_bs(v) { }
|
||||
@ -224,9 +224,9 @@ namespace netlist
|
||||
: netlist_base_factory_truthtable_t(name, classname, def_param, sourcefile)
|
||||
{ }
|
||||
|
||||
plib::owned_ptr<device_t> Create(netlist_base_t &anetlist, const pstring &name) override
|
||||
plib::owned_ptr<device_t> Create(netlist_state_t &anetlist, const pstring &name) override
|
||||
{
|
||||
typedef nld_truthtable_t<m_NI, m_NO> tt_type;
|
||||
using tt_type = nld_truthtable_t<m_NI, m_NO>;
|
||||
truthtable_parser desc_s(m_NO, m_NI, &m_ttbl.m_initialized,
|
||||
packed_int(m_ttbl.m_out_state.data(), sizeof(m_ttbl.m_out_state[0]) * 8),
|
||||
m_ttbl.m_timing_index.data(), m_ttbl.m_timing_nt.data());
|
||||
|
@ -44,10 +44,10 @@ namespace devices
|
||||
};
|
||||
|
||||
template<unsigned bits> struct uint_for_size;
|
||||
template<> struct uint_for_size<1> { typedef uint_least8_t type; };
|
||||
template<> struct uint_for_size<2> { typedef uint_least16_t type; };
|
||||
template<> struct uint_for_size<4> { typedef uint_least32_t type; };
|
||||
template<> struct uint_for_size<8> { typedef uint_least64_t type; };
|
||||
template<> struct uint_for_size<1> { using type = uint_least8_t; };
|
||||
template<> struct uint_for_size<2> { using type = uint_least16_t; };
|
||||
template<> struct uint_for_size<4> { using type = uint_least32_t; };
|
||||
template<> struct uint_for_size<8> { using type = uint_least64_t; };
|
||||
|
||||
template<std::size_t NUM, typename R>
|
||||
struct aa
|
||||
@ -81,7 +81,7 @@ namespace devices
|
||||
detail::family_setter_t m_fam;
|
||||
public:
|
||||
|
||||
typedef typename uint_for_size<need_bytes_for_bits<m_NO + m_NI>::value>::type type_t;
|
||||
using type_t = typename uint_for_size<need_bytes_for_bits<m_NO + m_NI>::value>::type;
|
||||
|
||||
static constexpr const std::size_t m_num_bits = m_NI;
|
||||
static constexpr const std::size_t m_size = (1 << (m_num_bits));
|
||||
|
@ -82,15 +82,15 @@ public:
|
||||
m_R_low = 1.0;
|
||||
m_R_high = 130.0;
|
||||
}
|
||||
plib::owned_ptr<devices::nld_base_d_to_a_proxy> create_d_a_proxy(netlist_base_t &anetlist, const pstring &name, logic_output_t *proxied) const override;
|
||||
plib::owned_ptr<devices::nld_base_a_to_d_proxy> create_a_d_proxy(netlist_base_t &anetlist, const pstring &name, logic_input_t *proxied) const override;
|
||||
plib::owned_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;
|
||||
plib::owned_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;
|
||||
};
|
||||
|
||||
plib::owned_ptr<devices::nld_base_d_to_a_proxy> logic_family_ttl_t::create_d_a_proxy(netlist_base_t &anetlist, const pstring &name, logic_output_t *proxied) const
|
||||
plib::owned_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
|
||||
{
|
||||
return plib::owned_ptr<devices::nld_base_d_to_a_proxy>::Create<devices::nld_d_to_a_proxy>(anetlist, name, proxied);
|
||||
}
|
||||
plib::owned_ptr<devices::nld_base_a_to_d_proxy> logic_family_ttl_t::create_a_d_proxy(netlist_base_t &anetlist, const pstring &name, logic_input_t *proxied) const
|
||||
plib::owned_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
|
||||
{
|
||||
return plib::owned_ptr<devices::nld_base_a_to_d_proxy>::Create<devices::nld_a_to_d_proxy>(anetlist, name, proxied);
|
||||
}
|
||||
@ -109,15 +109,15 @@ public:
|
||||
m_R_low = 10.0;
|
||||
m_R_high = 10.0;
|
||||
}
|
||||
plib::owned_ptr<devices::nld_base_d_to_a_proxy> create_d_a_proxy(netlist_base_t &anetlist, const pstring &name, logic_output_t *proxied) const override;
|
||||
plib::owned_ptr<devices::nld_base_a_to_d_proxy> create_a_d_proxy(netlist_base_t &anetlist, const pstring &name, logic_input_t *proxied) const override;
|
||||
plib::owned_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;
|
||||
plib::owned_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;
|
||||
};
|
||||
|
||||
plib::owned_ptr<devices::nld_base_d_to_a_proxy> logic_family_cd4xxx_t::create_d_a_proxy(netlist_base_t &anetlist, const pstring &name, logic_output_t *proxied) const
|
||||
plib::owned_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
|
||||
{
|
||||
return plib::owned_ptr<devices::nld_base_d_to_a_proxy>::Create<devices::nld_d_to_a_proxy>(anetlist, name, proxied);
|
||||
}
|
||||
plib::owned_ptr<devices::nld_base_a_to_d_proxy> logic_family_cd4xxx_t::create_a_d_proxy(netlist_base_t &anetlist, const pstring &name, logic_input_t *proxied) const
|
||||
plib::owned_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
|
||||
{
|
||||
return plib::owned_ptr<devices::nld_base_a_to_d_proxy>::Create<devices::nld_a_to_d_proxy>(anetlist, name, proxied);
|
||||
}
|
||||
@ -565,7 +565,7 @@ core_device_t *netlist_state_t::get_single_device(const pstring &classname, bool
|
||||
// core_device_t
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
core_device_t::core_device_t(netlist_base_t &owner, const pstring &name)
|
||||
core_device_t::core_device_t(netlist_state_t &owner, const pstring &name)
|
||||
: object_t(name)
|
||||
, logic_family_t()
|
||||
, netlist_ref(owner)
|
||||
@ -604,7 +604,7 @@ log_type & core_device_t::log()
|
||||
// device_t
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
device_t::device_t(netlist_base_t &owner, const pstring &name)
|
||||
device_t::device_t(netlist_state_t &owner, const pstring &name)
|
||||
: core_device_t(owner, name)
|
||||
{
|
||||
}
|
||||
@ -684,7 +684,7 @@ detail::family_setter_t::family_setter_t(core_device_t &dev, const logic_family_
|
||||
// net_t
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
detail::net_t::net_t(netlist_base_t &nl, const pstring &aname, core_terminal_t *mr)
|
||||
detail::net_t::net_t(netlist_state_t &nl, const pstring &aname, core_terminal_t *mr)
|
||||
: object_t(aname)
|
||||
, netlist_ref(nl)
|
||||
, m_new_Q(*this, "m_new_Q", 0)
|
||||
@ -815,7 +815,7 @@ void detail::net_t::move_connections(detail::net_t &dest_net)
|
||||
// logic_net_t
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
logic_net_t::logic_net_t(netlist_base_t &nl, const pstring &aname, detail::core_terminal_t *mr)
|
||||
logic_net_t::logic_net_t(netlist_state_t &nl, const pstring &aname, detail::core_terminal_t *mr)
|
||||
: net_t(nl, aname, mr)
|
||||
{
|
||||
}
|
||||
@ -824,7 +824,7 @@ logic_net_t::logic_net_t(netlist_base_t &nl, const pstring &aname, detail::core_
|
||||
// analog_net_t
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
analog_net_t::analog_net_t(netlist_base_t &nl, const pstring &aname, detail::core_terminal_t *mr)
|
||||
analog_net_t::analog_net_t(netlist_state_t &nl, const pstring &aname, detail::core_terminal_t *mr)
|
||||
: net_t(nl, aname, mr)
|
||||
, m_cur_Analog(*this, "m_cur_Analog", 0.0)
|
||||
, m_solver(nullptr)
|
||||
|
@ -172,7 +172,7 @@ namespace netlist
|
||||
/*! Delegate type for device notification.
|
||||
*
|
||||
*/
|
||||
typedef plib::pmfp<void> nldelegate;
|
||||
using nldelegate = plib::pmfp<void>;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// forward definitions
|
||||
@ -207,7 +207,6 @@ namespace netlist
|
||||
class setup_t;
|
||||
class netlist_t;
|
||||
class netlist_state_t;
|
||||
typedef netlist_state_t netlist_base_t;
|
||||
class core_device_t;
|
||||
class device_t;
|
||||
class callbacks_t;
|
||||
@ -242,9 +241,9 @@ namespace netlist
|
||||
logic_family_desc_t();
|
||||
virtual ~logic_family_desc_t() = default;
|
||||
|
||||
virtual plib::owned_ptr<devices::nld_base_d_to_a_proxy> create_d_a_proxy(netlist_base_t &anetlist, const pstring &name,
|
||||
virtual plib::owned_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;
|
||||
virtual plib::owned_ptr<devices::nld_base_a_to_d_proxy> create_a_d_proxy(netlist_base_t &anetlist, const pstring &name,
|
||||
virtual plib::owned_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;
|
||||
|
||||
double fixed_V() const { return m_fixed_V; }
|
||||
@ -472,8 +471,8 @@ namespace netlist
|
||||
/*! The netlist owning the owner of this object.
|
||||
* \returns reference to netlist object.
|
||||
*/
|
||||
netlist_base_t &state() NL_NOEXCEPT;
|
||||
const netlist_base_t &state() const NL_NOEXCEPT;
|
||||
netlist_state_t &state() NL_NOEXCEPT;
|
||||
const netlist_state_t &state() const NL_NOEXCEPT;
|
||||
|
||||
netlist_t &exec() NL_NOEXCEPT;
|
||||
const netlist_t &exec() const NL_NOEXCEPT;
|
||||
@ -713,7 +712,7 @@ namespace netlist
|
||||
DELIVERED
|
||||
};
|
||||
|
||||
net_t(netlist_base_t &nl, const pstring &aname, core_terminal_t *mr = nullptr);
|
||||
net_t(netlist_state_t &nl, const pstring &aname, core_terminal_t *mr = nullptr);
|
||||
virtual ~net_t();
|
||||
|
||||
void reset();
|
||||
@ -785,7 +784,7 @@ namespace netlist
|
||||
{
|
||||
public:
|
||||
|
||||
logic_net_t(netlist_base_t &nl, const pstring &aname, detail::core_terminal_t *mr = nullptr);
|
||||
logic_net_t(netlist_state_t &nl, const pstring &aname, detail::core_terminal_t *mr = nullptr);
|
||||
|
||||
netlist_sig_t Q() const noexcept { return m_cur_Q; }
|
||||
void initial(const netlist_sig_t val) noexcept
|
||||
@ -840,7 +839,7 @@ namespace netlist
|
||||
|
||||
friend class detail::net_t;
|
||||
|
||||
analog_net_t(netlist_base_t &nl, const pstring &aname, detail::core_terminal_t *mr = nullptr);
|
||||
analog_net_t(netlist_state_t &nl, const pstring &aname, detail::core_terminal_t *mr = nullptr);
|
||||
|
||||
nl_double Q_Analog() const NL_NOEXCEPT { return m_cur_Analog; }
|
||||
void set_Q_Analog(const nl_double v) NL_NOEXCEPT { m_cur_Analog = v; }
|
||||
@ -954,9 +953,9 @@ namespace netlist
|
||||
};
|
||||
|
||||
/* FIXME: these should go as well */
|
||||
typedef param_num_t<bool> param_logic_t;
|
||||
typedef param_num_t<int> param_int_t;
|
||||
typedef param_num_t<double> param_double_t;
|
||||
using param_logic_t = param_num_t<bool>;
|
||||
using param_int_t = param_num_t<int>;
|
||||
using param_double_t = param_num_t<double>;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// pointer parameter
|
||||
@ -1084,7 +1083,7 @@ namespace netlist
|
||||
public detail::netlist_ref
|
||||
{
|
||||
public:
|
||||
core_device_t(netlist_base_t &owner, const pstring &name);
|
||||
core_device_t(netlist_state_t &owner, const pstring &name);
|
||||
core_device_t(core_device_t &owner, const pstring &name);
|
||||
|
||||
virtual ~core_device_t() = default;
|
||||
@ -1153,7 +1152,7 @@ namespace netlist
|
||||
{
|
||||
public:
|
||||
|
||||
device_t(netlist_base_t &owner, const pstring &name);
|
||||
device_t(netlist_state_t &owner, const pstring &name);
|
||||
device_t(core_device_t &owner, const pstring &name);
|
||||
|
||||
~device_t() override = default;
|
||||
@ -1220,7 +1219,7 @@ namespace netlist
|
||||
public plib::state_manager_t::callback_t
|
||||
{
|
||||
public:
|
||||
typedef pqentry_t<net_t *, netlist_time> entry_t;
|
||||
using entry_t = pqentry_t<net_t *, netlist_time>;
|
||||
explicit queue_t(netlist_state_t &nl);
|
||||
|
||||
protected:
|
||||
@ -1652,12 +1651,12 @@ namespace netlist
|
||||
}
|
||||
}
|
||||
|
||||
inline netlist_base_t &detail::device_object_t::state() NL_NOEXCEPT
|
||||
inline netlist_state_t &detail::device_object_t::state() NL_NOEXCEPT
|
||||
{
|
||||
return m_device.state();
|
||||
}
|
||||
|
||||
inline const netlist_base_t &detail::device_object_t::state() const NL_NOEXCEPT
|
||||
inline const netlist_state_t &detail::device_object_t::state() const NL_NOEXCEPT
|
||||
{
|
||||
return m_device.state();
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ namespace netlist { namespace factory
|
||||
class NETLIB_NAME(wrapper) : public device_t
|
||||
{
|
||||
public:
|
||||
NETLIB_NAME(wrapper)(netlist_base_t &anetlist, const pstring &name)
|
||||
NETLIB_NAME(wrapper)(netlist_state_t &anetlist, const pstring &name)
|
||||
: device_t(anetlist, name)
|
||||
{
|
||||
}
|
||||
@ -81,12 +81,12 @@ namespace netlist { namespace factory
|
||||
// factory_lib_entry_t: factory class to wrap macro based chips/elements
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
plib::owned_ptr<device_t> library_element_t::Create(netlist_base_t &anetlist, const pstring &name)
|
||||
plib::owned_ptr<device_t> library_element_t::Create(netlist_state_t &anetlist, const pstring &name)
|
||||
{
|
||||
return plib::owned_ptr<device_t>::Create<NETLIB_NAME(wrapper)>(anetlist, name);
|
||||
}
|
||||
|
||||
void library_element_t::macro_actions(netlist_base_t &anetlist, const pstring &name)
|
||||
void library_element_t::macro_actions(netlist_state_t &anetlist, const pstring &name)
|
||||
{
|
||||
anetlist.setup().namespace_push(name);
|
||||
anetlist.setup().include(this->name());
|
||||
|
@ -766,7 +766,7 @@ void setup_t::register_dynamic_log_devices()
|
||||
{
|
||||
log().debug("Creating dynamic logs ...");
|
||||
std::vector<pstring> loglist(plib::psplit(env, ":"));
|
||||
for (pstring ll : loglist)
|
||||
for (const pstring &ll : loglist)
|
||||
{
|
||||
pstring name = "log_" + ll;
|
||||
auto nc = factory().factory_by_name("LOG")->Create(netlist(), name);
|
||||
@ -891,17 +891,17 @@ class logic_family_std_proxy_t : public logic_family_desc_t
|
||||
{
|
||||
public:
|
||||
logic_family_std_proxy_t() = default;
|
||||
plib::owned_ptr<devices::nld_base_d_to_a_proxy> create_d_a_proxy(netlist_base_t &anetlist,
|
||||
plib::owned_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;
|
||||
plib::owned_ptr<devices::nld_base_a_to_d_proxy> create_a_d_proxy(netlist_base_t &anetlist, const pstring &name, logic_input_t *proxied) const override;
|
||||
plib::owned_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;
|
||||
};
|
||||
|
||||
plib::owned_ptr<devices::nld_base_d_to_a_proxy> logic_family_std_proxy_t::create_d_a_proxy(netlist_base_t &anetlist,
|
||||
plib::owned_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
|
||||
{
|
||||
return plib::owned_ptr<devices::nld_base_d_to_a_proxy>::Create<devices::nld_d_to_a_proxy>(anetlist, name, proxied);
|
||||
}
|
||||
plib::owned_ptr<devices::nld_base_a_to_d_proxy> logic_family_std_proxy_t::create_a_d_proxy(netlist_base_t &anetlist, const pstring &name, logic_input_t *proxied) const
|
||||
plib::owned_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
|
||||
{
|
||||
return plib::owned_ptr<devices::nld_base_a_to_d_proxy>::Create<devices::nld_a_to_d_proxy>(anetlist, name, proxied);
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ namespace plib
|
||||
template <typename FT, int SIZE>
|
||||
struct mat_precondition_ILU
|
||||
{
|
||||
typedef plib::matrix_compressed_rows_t<FT, SIZE> mat_type;
|
||||
using mat_type = plib::matrix_compressed_rows_t<FT, SIZE>;
|
||||
|
||||
mat_precondition_ILU(std::size_t size, int ilu_scale = 4
|
||||
, std::size_t bw = plib::matrix_compressed_rows_t<FT, SIZE>::FILL_INFINITY)
|
||||
@ -138,7 +138,7 @@ namespace plib
|
||||
{
|
||||
public:
|
||||
|
||||
typedef FT float_type;
|
||||
using float_type = FT;
|
||||
// FIXME: dirty hack to make this compile
|
||||
static constexpr const std::size_t storage_N = plib::sizeabs<FT, SIZE>::ABS();
|
||||
|
||||
|
@ -30,8 +30,8 @@ namespace plib
|
||||
template<typename T, int N, typename C = uint16_t>
|
||||
struct matrix_compressed_rows_t
|
||||
{
|
||||
typedef C index_type;
|
||||
typedef T value_type;
|
||||
using index_type = C;
|
||||
using value_type = T;
|
||||
|
||||
enum constants_e
|
||||
{
|
||||
|
@ -23,14 +23,14 @@ namespace plib {
|
||||
struct sizeabs
|
||||
{
|
||||
static constexpr std::size_t ABS() { return (SIZE < 0) ? static_cast<std::size_t>(0 - SIZE) : static_cast<std::size_t>(SIZE); }
|
||||
typedef typename std::array<FT, ABS()> container;
|
||||
using container = typename std::array<FT, ABS()> ;
|
||||
};
|
||||
|
||||
template <typename FT>
|
||||
struct sizeabs<FT, 0>
|
||||
{
|
||||
static constexpr const std::size_t ABS = 0;
|
||||
typedef typename std::vector<FT> container;
|
||||
using container = typename std::vector<FT> ;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -55,10 +55,10 @@ namespace plib {
|
||||
public:
|
||||
static constexpr std::size_t SIZEABS() { return sizeabs<FT, SIZE>::ABS(); }
|
||||
|
||||
typedef typename sizeabs<FT, SIZE>::container base_type;
|
||||
typedef typename base_type::size_type size_type;
|
||||
typedef typename base_type::reference reference;
|
||||
typedef typename base_type::const_reference const_reference;
|
||||
using base_type = typename sizeabs<FT, SIZE>::container;
|
||||
using size_type = typename base_type::size_type;
|
||||
using reference = typename base_type::reference;
|
||||
using const_reference = typename base_type::const_reference;
|
||||
|
||||
template <int X = SIZE >
|
||||
parray(size_type size, typename std::enable_if<X==0, int>::type = 0)
|
||||
|
@ -18,7 +18,7 @@ namespace chrono {
|
||||
template <typename T>
|
||||
struct sys_ticks
|
||||
{
|
||||
typedef typename T::rep type;
|
||||
using type = typename T::rep;
|
||||
static inline type start() { return T::now().time_since_epoch().count(); }
|
||||
static inline type stop() { return T::now().time_since_epoch().count(); }
|
||||
static inline constexpr type per_second() { return T::period::den / T::period::num; }
|
||||
@ -145,7 +145,7 @@ namespace chrono {
|
||||
struct counter
|
||||
{
|
||||
counter() : m_count(0) { }
|
||||
typedef uint_least64_t type;
|
||||
using type = uint_least64_t;
|
||||
type operator()() const { return m_count; }
|
||||
void inc() { ++m_count; }
|
||||
void reset() { m_count = 0; }
|
||||
@ -157,7 +157,7 @@ namespace chrono {
|
||||
template<>
|
||||
struct counter<false>
|
||||
{
|
||||
typedef uint_least64_t type;
|
||||
using type = uint_least64_t;
|
||||
constexpr type operator()() const { return 0; }
|
||||
void inc() const { }
|
||||
void reset() const { }
|
||||
@ -168,8 +168,8 @@ namespace chrono {
|
||||
template< typename T, bool enabled_ = true>
|
||||
struct timer
|
||||
{
|
||||
typedef typename T::type type;
|
||||
typedef uint_least64_t ctype;
|
||||
using type = typename T::type;
|
||||
using ctype = uint_least64_t;
|
||||
constexpr static bool enabled = enabled_;
|
||||
|
||||
struct guard_t
|
||||
@ -206,8 +206,8 @@ namespace chrono {
|
||||
template<typename T>
|
||||
struct timer<T, false>
|
||||
{
|
||||
typedef typename T::type type;
|
||||
typedef uint_least64_t ctype;
|
||||
using type = typename T::type;
|
||||
using ctype = uint_least64_t;
|
||||
|
||||
struct guard_t
|
||||
{
|
||||
|
@ -187,7 +187,7 @@ case OP: \
|
||||
|
||||
double pfunction::evaluate(const std::vector<double> &values)
|
||||
{
|
||||
double stack[20];
|
||||
std::array<double, 20> stack = { 0 };
|
||||
unsigned ptr = 0;
|
||||
stack[0] = 0.0;
|
||||
for (auto &rc : m_precompiled)
|
||||
|
@ -29,8 +29,8 @@ class uninitialised_array_t
|
||||
{
|
||||
public:
|
||||
|
||||
typedef C* iterator;
|
||||
typedef const C* const_iterator;
|
||||
using iterator = C *;
|
||||
using const_iterator = const C *;
|
||||
|
||||
uninitialised_array_t() = default;
|
||||
|
||||
|
@ -47,17 +47,16 @@ public:
|
||||
std::is_floating_point<T>::value);
|
||||
}
|
||||
|
||||
class callback_t
|
||||
class callback_t : nocopyassignmove
|
||||
{
|
||||
public:
|
||||
using list_t = std::vector<callback_t *>;
|
||||
|
||||
virtual ~callback_t() = default;
|
||||
|
||||
virtual void register_state(state_manager_t &manager, const pstring &module) = 0;
|
||||
virtual void on_pre_save(state_manager_t &manager) = 0;
|
||||
virtual void on_post_load(state_manager_t &manager) = 0;
|
||||
protected:
|
||||
virtual ~callback_t() = default;
|
||||
};
|
||||
|
||||
struct entry_t
|
||||
|
@ -103,7 +103,7 @@ class pistream_base : public pstream
|
||||
{
|
||||
public:
|
||||
|
||||
typedef T value_type;
|
||||
using value_type = T;
|
||||
|
||||
bool eof() const { return ((flags() & FLAG_EOF) != 0); }
|
||||
|
||||
@ -120,7 +120,7 @@ protected:
|
||||
virtual size_type vread(T *buf, const size_type n) = 0;
|
||||
};
|
||||
|
||||
typedef pistream_base<char> pistream;
|
||||
using pistream = pistream_base<char>;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// postream: output stream
|
||||
@ -132,7 +132,7 @@ class postream_base : public pstream
|
||||
{
|
||||
public:
|
||||
|
||||
typedef T value_type;
|
||||
using value_type = T;
|
||||
|
||||
void write(const T *buf, const size_type n)
|
||||
{
|
||||
@ -148,7 +148,7 @@ protected:
|
||||
private:
|
||||
};
|
||||
|
||||
typedef postream_base<char> postream;
|
||||
using postream = postream_base<char>;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// pomemstream: output string stream
|
||||
|
@ -66,12 +66,12 @@ struct pstring_t
|
||||
public:
|
||||
using traits_type = F;
|
||||
|
||||
typedef typename traits_type::mem_t mem_t;
|
||||
typedef typename traits_type::code_t code_t;
|
||||
typedef typename traits_type::code_t value_type;
|
||||
typedef std::size_t size_type;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef typename traits_type::string_type string_type;
|
||||
using mem_t = typename traits_type::mem_t;
|
||||
using code_t = typename traits_type::code_t;
|
||||
using value_type = typename traits_type::code_t;
|
||||
using size_type = std::size_t;
|
||||
using difference_type = std::ptrdiff_t;
|
||||
using string_type = typename traits_type::string_type;
|
||||
|
||||
// FIXME: this is ugly
|
||||
class ref_value_type final
|
||||
@ -87,8 +87,8 @@ public:
|
||||
private:
|
||||
const mem_t m;
|
||||
};
|
||||
typedef const ref_value_type& const_reference;
|
||||
typedef const_reference reference;
|
||||
using const_reference = const ref_value_type &;
|
||||
using reference = const_reference;
|
||||
|
||||
// simple construction/destruction
|
||||
pstring_t() = default;
|
||||
@ -153,8 +153,8 @@ public:
|
||||
}
|
||||
|
||||
// no non-const const_iterator for now
|
||||
typedef pstring_const_iterator<pstring_t> iterator;
|
||||
typedef pstring_const_iterator<pstring_t> const_iterator;
|
||||
using iterator = pstring_const_iterator<pstring_t<F> >;
|
||||
using const_iterator = pstring_const_iterator<pstring_t<F> >;
|
||||
|
||||
iterator begin() { return iterator(m_str.begin()); }
|
||||
iterator end() { return iterator(m_str.end()); }
|
||||
@ -215,9 +215,9 @@ private:
|
||||
|
||||
struct pu8_traits
|
||||
{
|
||||
typedef char mem_t;
|
||||
typedef char code_t;
|
||||
typedef std::string string_type;
|
||||
using mem_t = char;
|
||||
using code_t = char;
|
||||
using string_type = std::string;
|
||||
static std::size_t len(const string_type &p) { return p.size(); }
|
||||
static std::size_t codelen(const mem_t *p) { plib::unused_var(p); return 1; }
|
||||
static std::size_t codelen(const code_t c) { plib::unused_var(c); return 1; }
|
||||
@ -229,9 +229,9 @@ struct pu8_traits
|
||||
/* No checking, this may deliver invalid codes */
|
||||
struct putf8_traits
|
||||
{
|
||||
typedef char mem_t;
|
||||
typedef char32_t code_t;
|
||||
typedef std::string string_type;
|
||||
using mem_t = char;
|
||||
using code_t = char32_t;
|
||||
using string_type = std::string;
|
||||
static std::size_t len(const string_type &p)
|
||||
{
|
||||
std::size_t ret = 0;
|
||||
@ -320,9 +320,9 @@ struct putf8_traits
|
||||
|
||||
struct putf16_traits
|
||||
{
|
||||
typedef char16_t mem_t;
|
||||
typedef char32_t code_t;
|
||||
typedef std::u16string string_type;
|
||||
using mem_t = char16_t;
|
||||
using code_t = char32_t;
|
||||
using string_type = std::u16string;
|
||||
static std::size_t len(const string_type &p)
|
||||
{
|
||||
std::size_t ret = 0;
|
||||
@ -384,9 +384,9 @@ struct putf16_traits
|
||||
|
||||
struct pwchar_traits
|
||||
{
|
||||
typedef wchar_t mem_t;
|
||||
typedef char32_t code_t;
|
||||
typedef std::wstring string_type;
|
||||
using mem_t = wchar_t;
|
||||
using code_t = char32_t;
|
||||
using string_type = std::wstring;
|
||||
static std::size_t len(const string_type &p)
|
||||
{
|
||||
if (sizeof(wchar_t) == 2)
|
||||
@ -481,24 +481,24 @@ extern template struct pstring_t<pwchar_traits>;
|
||||
#if (PSTRING_USE_STD_STRING)
|
||||
typedef std::string pstring;
|
||||
#else
|
||||
typedef pstring_t<putf8_traits> pstring;
|
||||
using pstring = pstring_t<putf8_traits>;
|
||||
#endif
|
||||
typedef pstring_t<putf8_traits> putf8string;
|
||||
typedef pstring_t<putf16_traits> pu16string;
|
||||
typedef pstring_t<pwchar_traits> pwstring;
|
||||
using putf8string = pstring_t<putf8_traits>;
|
||||
using pu16string = pstring_t<putf16_traits>;
|
||||
using pwstring = pstring_t<pwchar_traits>;
|
||||
|
||||
namespace plib
|
||||
{
|
||||
template<class T>
|
||||
struct string_info
|
||||
{
|
||||
typedef typename T::mem_t mem_t;
|
||||
using mem_t = typename T::mem_t;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct string_info<std::string>
|
||||
{
|
||||
typedef char mem_t;
|
||||
using mem_t = char;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
@ -554,7 +554,7 @@ namespace plib
|
||||
decltype(arg.c_str()) cstr = arg.c_str();
|
||||
std::size_t idx(0);
|
||||
auto ret = pstonum_helper<T>()(cstr, &idx);
|
||||
typedef decltype(ret) ret_type;
|
||||
using ret_type = decltype(ret);
|
||||
if (ret >= static_cast<ret_type>(std::numeric_limits<T>::lowest())
|
||||
&& ret <= static_cast<ret_type>(std::numeric_limits<T>::max()))
|
||||
//&& (ret == T(0) || std::abs(ret) >= std::numeric_limits<T>::min() ))
|
||||
@ -741,8 +741,8 @@ namespace std
|
||||
|
||||
template<typename T> struct hash<pstring_t<T>>
|
||||
{
|
||||
typedef pstring_t<T> argument_type;
|
||||
typedef std::size_t result_type;
|
||||
using argument_type = pstring_t<T>;
|
||||
using result_type = std::size_t;
|
||||
result_type operator()(argument_type const& s) const
|
||||
{
|
||||
const typename argument_type::mem_t *string = s.c_str();
|
||||
|
@ -163,29 +163,6 @@ namespace plib
|
||||
}
|
||||
std::string penum_base::nthstr(int n, const char *str)
|
||||
{
|
||||
char buf[64];
|
||||
char *bufp = buf;
|
||||
int cur = 0;
|
||||
while (*str)
|
||||
{
|
||||
if (cur == n)
|
||||
{
|
||||
if (*str == ',')
|
||||
{
|
||||
*bufp = 0;
|
||||
return pstring(buf);
|
||||
}
|
||||
else if (*str != ' ')
|
||||
*bufp++ = *str;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*str == ',')
|
||||
cur++;
|
||||
}
|
||||
str++;
|
||||
}
|
||||
*bufp = 0;
|
||||
return std::string(buf);
|
||||
return psplit(str, ",", false)[static_cast<std::size_t>(n)];
|
||||
}
|
||||
} // namespace plib
|
||||
|
@ -125,7 +125,7 @@ private:
|
||||
class log_processor
|
||||
{
|
||||
public:
|
||||
typedef plib::pmfp<void, std::size_t, double, double> callback_type;
|
||||
using callback_type = plib::pmfp<void, std::size_t, double, double>;
|
||||
|
||||
struct elem
|
||||
{
|
||||
@ -202,7 +202,7 @@ private:
|
||||
|
||||
struct aggregator
|
||||
{
|
||||
typedef plib::pmfp<void, std::size_t, double, double> callback_type;
|
||||
using callback_type = plib::pmfp<void, std::size_t, double, double>;
|
||||
|
||||
aggregator(std::size_t channels, double quantum, callback_type cb)
|
||||
: m_channels(channels)
|
||||
|
@ -70,7 +70,7 @@ void terms_for_net_t::set_pointers()
|
||||
// matrix_solver
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
matrix_solver_t::matrix_solver_t(netlist_base_t &anetlist, const pstring &name,
|
||||
matrix_solver_t::matrix_solver_t(netlist_state_t &anetlist, const pstring &name,
|
||||
const eSortType sort, const solver_parameters_t *params)
|
||||
: device_t(anetlist, name)
|
||||
, m_params(*params)
|
||||
@ -374,8 +374,8 @@ void matrix_solver_t::setup_matrix()
|
||||
for (std::size_t k = 0; k < iN; k++)
|
||||
{
|
||||
pstring line = plib::pfmt("{1:3}")(k);
|
||||
for (std::size_t j = 0; j < m_terms[k]->m_nzrd.size(); j++)
|
||||
line += plib::pfmt(" {1:3}")(m_terms[k]->m_nzrd[j]);
|
||||
for (const auto & nzrd : m_terms[k]->m_nzrd)
|
||||
line += plib::pfmt(" {1:3}")(nzrd);
|
||||
log().verbose("{1}", line);
|
||||
}
|
||||
|
||||
|
@ -181,7 +181,7 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
matrix_solver_t(netlist_base_t &anetlist, const pstring &name,
|
||||
matrix_solver_t(netlist_state_t &anetlist, const pstring &name,
|
||||
eSortType sort, const solver_parameters_t *params);
|
||||
|
||||
void sort_terms(eSortType sort);
|
||||
@ -264,7 +264,7 @@ void matrix_solver_t::store(const T & V)
|
||||
template <typename T>
|
||||
void matrix_solver_t::build_LE_A(T &child)
|
||||
{
|
||||
typedef typename T::float_type float_type;
|
||||
using float_type = typename T::float_type;
|
||||
static_assert(std::is_base_of<matrix_solver_t, T>::value, "T must derive from matrix_solver_t");
|
||||
|
||||
const std::size_t iN = child.size();
|
||||
@ -300,7 +300,7 @@ template <typename T>
|
||||
void matrix_solver_t::build_LE_RHS(T &child)
|
||||
{
|
||||
static_assert(std::is_base_of<matrix_solver_t, T>::value, "T must derive from matrix_solver_t");
|
||||
typedef typename T::float_type float_type;
|
||||
using float_type = typename T::float_type;
|
||||
|
||||
const std::size_t iN = child.size();
|
||||
for (std::size_t k = 0; k < iN; k++)
|
||||
|
@ -27,10 +27,10 @@ class matrix_solver_direct_t: public matrix_solver_t
|
||||
friend class matrix_solver_t;
|
||||
public:
|
||||
|
||||
typedef FT float_type;
|
||||
using float_type = FT;
|
||||
|
||||
matrix_solver_direct_t(netlist_base_t &anetlist, const pstring &name, const solver_parameters_t *params, const std::size_t size);
|
||||
matrix_solver_direct_t(netlist_base_t &anetlist, const pstring &name, const eSortType sort, const solver_parameters_t *params, const std::size_t size);
|
||||
matrix_solver_direct_t(netlist_state_t &anetlist, const pstring &name, const solver_parameters_t *params, const std::size_t size);
|
||||
matrix_solver_direct_t(netlist_state_t &anetlist, const pstring &name, const eSortType sort, const solver_parameters_t *params, const std::size_t size);
|
||||
|
||||
~matrix_solver_direct_t() override = default;
|
||||
|
||||
@ -212,7 +212,7 @@ unsigned matrix_solver_direct_t<FT, SIZE>::vsolve_non_dynamic(const bool newton_
|
||||
}
|
||||
|
||||
template <typename FT, int SIZE>
|
||||
matrix_solver_direct_t<FT, SIZE>::matrix_solver_direct_t(netlist_base_t &anetlist, const pstring &name,
|
||||
matrix_solver_direct_t<FT, SIZE>::matrix_solver_direct_t(netlist_state_t &anetlist, const pstring &name,
|
||||
const solver_parameters_t *params, const std::size_t size)
|
||||
: matrix_solver_t(anetlist, name, ASCENDING, params)
|
||||
, m_new_V(size)
|
||||
@ -223,7 +223,7 @@ matrix_solver_direct_t<FT, SIZE>::matrix_solver_direct_t(netlist_base_t &anetlis
|
||||
}
|
||||
|
||||
template <typename FT, int SIZE>
|
||||
matrix_solver_direct_t<FT, SIZE>::matrix_solver_direct_t(netlist_base_t &anetlist, const pstring &name,
|
||||
matrix_solver_direct_t<FT, SIZE>::matrix_solver_direct_t(netlist_state_t &anetlist, const pstring &name,
|
||||
const eSortType sort, const solver_parameters_t *params, const std::size_t size)
|
||||
: matrix_solver_t(anetlist, name, sort, params)
|
||||
, m_new_V(size)
|
||||
|
@ -20,10 +20,10 @@ namespace devices
|
||||
{
|
||||
public:
|
||||
|
||||
typedef FT float_type;
|
||||
typedef matrix_solver_direct_t<FT, 1> base_type;
|
||||
using float_type = FT;
|
||||
using base_type = matrix_solver_direct_t<FT, 1>;
|
||||
|
||||
matrix_solver_direct1_t(netlist_base_t &anetlist, const pstring &name, const solver_parameters_t *params)
|
||||
matrix_solver_direct1_t(netlist_state_t &anetlist, const pstring &name, const solver_parameters_t *params)
|
||||
: matrix_solver_direct_t<FT, 1>(anetlist, name, params, 1)
|
||||
{}
|
||||
|
||||
@ -36,7 +36,7 @@ namespace devices
|
||||
this->build_LE_RHS(*this);
|
||||
//NL_VERBOSE_OUT(("{1} {2}\n", new_val, m_RHS[0] / m_A[0][0]);
|
||||
|
||||
FT new_V[1] = { this->RHS(0) / this->A(0,0) };
|
||||
std::array<FT, 1> new_V = { this->RHS(0) / this->A(0,0) };
|
||||
|
||||
const FT err = (newton_raphson ? this->delta(new_V) : 0.0);
|
||||
this->store(new_V);
|
||||
|
@ -21,9 +21,9 @@ namespace devices
|
||||
{
|
||||
public:
|
||||
|
||||
typedef FT float_type;
|
||||
using float_type = FT;
|
||||
|
||||
matrix_solver_direct2_t(netlist_base_t &anetlist, const pstring &name, const solver_parameters_t *params)
|
||||
matrix_solver_direct2_t(netlist_state_t &anetlist, const pstring &name, const solver_parameters_t *params)
|
||||
: matrix_solver_direct_t<double, 2>(anetlist, name, params, 2)
|
||||
{}
|
||||
unsigned vsolve_non_dynamic(const bool newton_raphson) override;
|
||||
@ -45,9 +45,9 @@ namespace devices
|
||||
const float_type c = this->A(1,0);
|
||||
const float_type d = this->A(1,1);
|
||||
|
||||
float_type new_V[2];
|
||||
new_V[1] = (a * this->RHS(1) - c * this->RHS(0)) / (a * d - b * c);
|
||||
new_V[0] = (this->RHS(0) - b * new_V[1]) / a;
|
||||
const float_type v1 = (a * this->RHS(1) - c * this->RHS(0)) / (a * d - b * c);
|
||||
const float_type v0 = (this->RHS(0) - b * v1) / a;
|
||||
std::array<float_type, 2> new_V = {v0, v1};
|
||||
|
||||
const float_type err = (newton_raphson ? this->delta(new_V) : 0.0);
|
||||
this->store(new_V);
|
||||
|
@ -29,11 +29,11 @@ class matrix_solver_GCR_t: public matrix_solver_t
|
||||
{
|
||||
public:
|
||||
|
||||
typedef plib::matrix_compressed_rows_t<FT, SIZE> mat_type;
|
||||
using mat_type = plib::matrix_compressed_rows_t<FT, SIZE>;
|
||||
// FIXME: dirty hack to make this compile
|
||||
static constexpr const std::size_t storage_N = 100;
|
||||
|
||||
matrix_solver_GCR_t(netlist_base_t &anetlist, const pstring &name,
|
||||
matrix_solver_GCR_t(netlist_state_t &anetlist, const pstring &name,
|
||||
const solver_parameters_t *params, const std::size_t size)
|
||||
: matrix_solver_t(anetlist, name, matrix_solver_t::PREFER_IDENTITY_TOP_LEFT, params)
|
||||
, m_dim(size)
|
||||
@ -68,7 +68,7 @@ private:
|
||||
plib::parray<FT, SIZE> RHS;
|
||||
plib::parray<FT, SIZE> new_V;
|
||||
|
||||
std::vector<FT *> m_term_cr[storage_N];
|
||||
std::array<std::vector<FT *>, storage_N> m_term_cr;
|
||||
|
||||
mat_type mat;
|
||||
|
||||
|
@ -29,13 +29,13 @@ namespace devices
|
||||
{
|
||||
public:
|
||||
|
||||
typedef FT float_type;
|
||||
using float_type = FT;
|
||||
|
||||
/* Sort rows in ascending order. This should minimize fill-in and thus
|
||||
* maximize the efficiency of the incomplete LUT.
|
||||
* This is already preconditioning.
|
||||
*/
|
||||
matrix_solver_GMRES_t(netlist_base_t &anetlist, const pstring &name, const solver_parameters_t *params, const std::size_t size)
|
||||
matrix_solver_GMRES_t(netlist_state_t &anetlist, const pstring &name, const solver_parameters_t *params, const std::size_t size)
|
||||
: matrix_solver_direct_t<FT, SIZE>(anetlist, name, matrix_solver_t::PREFER_BAND_MATRIX, params, size)
|
||||
, m_term_cr(size)
|
||||
//, m_ops(size, 2)
|
||||
@ -51,7 +51,7 @@ namespace devices
|
||||
|
||||
private:
|
||||
|
||||
typedef typename plib::matrix_compressed_rows_t<FT, SIZE>::index_type mattype;
|
||||
using mattype = typename plib::matrix_compressed_rows_t<FT, SIZE>::index_type;
|
||||
|
||||
plib::parray<std::vector<FT *>, SIZE> m_term_cr;
|
||||
plib::mat_precondition_ILU<FT, SIZE> m_ops;
|
||||
@ -76,9 +76,9 @@ namespace devices
|
||||
{
|
||||
fill[k].resize(iN, decltype(m_ops.m_mat)::FILL_INFINITY);
|
||||
terms_for_net_t * row = this->m_terms[k].get();
|
||||
for (std::size_t j=0; j < row->m_nz.size(); j++)
|
||||
for (const auto &nz_j : row->m_nz)
|
||||
{
|
||||
fill[k][static_cast<mattype>(row->m_nz[j])] = 0;
|
||||
fill[k][static_cast<mattype>(nz_j)] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,12 +51,12 @@ class matrix_solver_sm_t: public matrix_solver_t
|
||||
|
||||
public:
|
||||
|
||||
typedef FT float_ext_type;
|
||||
typedef FT float_type;
|
||||
using float_ext_type = FT;
|
||||
using float_type = FT;
|
||||
// FIXME: dirty hack to make this compile
|
||||
static constexpr const std::size_t storage_N = 100;
|
||||
|
||||
matrix_solver_sm_t(netlist_base_t &anetlist, const pstring &name,
|
||||
matrix_solver_sm_t(netlist_state_t &anetlist, const pstring &name,
|
||||
const solver_parameters_t *params, const std::size_t size);
|
||||
|
||||
~matrix_solver_sm_t() override = default;
|
||||
@ -298,7 +298,7 @@ unsigned matrix_solver_sm_t<FT, SIZE>::vsolve_non_dynamic(const bool newton_raph
|
||||
}
|
||||
|
||||
template <typename FT, int SIZE>
|
||||
matrix_solver_sm_t<FT, SIZE>::matrix_solver_sm_t(netlist_base_t &anetlist, const pstring &name,
|
||||
matrix_solver_sm_t<FT, SIZE>::matrix_solver_sm_t(netlist_state_t &anetlist, const pstring &name,
|
||||
const solver_parameters_t *params, const std::size_t size)
|
||||
: matrix_solver_t(anetlist, name, NOSORT, params)
|
||||
, m_dim(size)
|
||||
|
@ -27,9 +27,9 @@ class matrix_solver_SOR_t: public matrix_solver_direct_t<FT, SIZE>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef FT float_type;
|
||||
using float_type = FT;
|
||||
|
||||
matrix_solver_SOR_t(netlist_base_t &anetlist, const pstring &name, const solver_parameters_t *params, const std::size_t size)
|
||||
matrix_solver_SOR_t(netlist_state_t &anetlist, const pstring &name, const solver_parameters_t *params, const std::size_t size)
|
||||
: matrix_solver_direct_t<FT, SIZE>(anetlist, name, matrix_solver_t::ASCENDING, params, size)
|
||||
, m_lp_fact(*this, "m_lp_fact", 0)
|
||||
, w(size, 0.0)
|
||||
|
@ -30,9 +30,9 @@ class matrix_solver_SOR_mat_t: public matrix_solver_direct_t<FT, SIZE>
|
||||
|
||||
public:
|
||||
|
||||
typedef FT float_type;
|
||||
using float_type = FT;
|
||||
|
||||
matrix_solver_SOR_mat_t(netlist_base_t &anetlist, const pstring &name, const solver_parameters_t *params, std::size_t size)
|
||||
matrix_solver_SOR_mat_t(netlist_state_t &anetlist, const pstring &name, const solver_parameters_t *params, std::size_t size)
|
||||
: matrix_solver_direct_t<FT, SIZE>(anetlist, name, matrix_solver_t::ASCENDING, params, size)
|
||||
, m_Vdelta(*this, "m_Vdelta", std::vector<float_type>(size))
|
||||
, m_omega(*this, "m_omega", params->m_gs_sor)
|
||||
|
@ -57,13 +57,13 @@ class matrix_solver_w_t: public matrix_solver_t
|
||||
friend class matrix_solver_t;
|
||||
|
||||
public:
|
||||
typedef FT float_ext_type;
|
||||
typedef FT float_type;
|
||||
using float_ext_type = FT;
|
||||
using float_type = FT;
|
||||
|
||||
// FIXME: dirty hack to make this compile
|
||||
static constexpr const std::size_t storage_N = 100;
|
||||
|
||||
matrix_solver_w_t(netlist_base_t &anetlist, const pstring &name, const solver_parameters_t *params, const std::size_t size);
|
||||
matrix_solver_w_t(netlist_state_t &anetlist, const pstring &name, const solver_parameters_t *params, const std::size_t size);
|
||||
|
||||
~matrix_solver_w_t() override = default;
|
||||
|
||||
@ -367,7 +367,7 @@ unsigned matrix_solver_w_t<FT, SIZE>::vsolve_non_dynamic(const bool newton_raphs
|
||||
}
|
||||
|
||||
template <typename FT, int SIZE>
|
||||
matrix_solver_w_t<FT, SIZE>::matrix_solver_w_t(netlist_base_t &anetlist, const pstring &name,
|
||||
matrix_solver_w_t<FT, SIZE>::matrix_solver_w_t(netlist_state_t &anetlist, const pstring &name,
|
||||
const solver_parameters_t *params, const std::size_t size)
|
||||
: matrix_solver_t(anetlist, name, NOSORT, params)
|
||||
, m_cnt(0)
|
||||
|
@ -129,7 +129,7 @@ NETLIB_UPDATE(solver)
|
||||
}
|
||||
|
||||
template <class C>
|
||||
matrix_solver_t * create_it(netlist_base_t &nl, pstring name, solver_parameters_t ¶ms, std::size_t size)
|
||||
matrix_solver_t * create_it(netlist_state_t &nl, pstring name, solver_parameters_t ¶ms, std::size_t size)
|
||||
{
|
||||
return plib::palloc<C>(nl, name, ¶ms, size);
|
||||
}
|
||||
@ -214,7 +214,7 @@ struct net_splitter
|
||||
}
|
||||
}
|
||||
|
||||
void run(netlist_base_t &netlist)
|
||||
void run(netlist_state_t &netlist)
|
||||
{
|
||||
for (auto & net : netlist.nets())
|
||||
{
|
||||
|
@ -129,11 +129,11 @@ void nl_convert_base_t::add_term(pstring netname, pstring termname)
|
||||
|
||||
void nl_convert_base_t::dump_nl()
|
||||
{
|
||||
for (std::size_t i=0; i<m_ext_alias.size(); i++)
|
||||
for (auto & alias : m_ext_alias)
|
||||
{
|
||||
net_t *net = m_nets[m_ext_alias[i]].get();
|
||||
net_t *net = m_nets[alias].get();
|
||||
// use the first terminal ...
|
||||
out("ALIAS({}, {})\n", m_ext_alias[i].c_str(), net->terminals()[0].c_str());
|
||||
out("ALIAS({}, {})\n", alias.c_str(), net->terminals()[0].c_str());
|
||||
// if the aliased net only has this one terminal connected ==> don't dump
|
||||
if (net->terminals().size() == 1)
|
||||
net->set_no_export();
|
||||
|
Loading…
Reference in New Issue
Block a user