mirror of
https://github.com/holub/mame
synced 2025-04-20 15:32:45 +03:00
netlist: fix visibility issues and more issues reported by tidy. (nw)
This commit is contained in:
parent
779b762626
commit
66154af0f2
@ -209,6 +209,7 @@ NETLIB_OBJECT_DERIVED(QBJT_switch, QBJT)
|
||||
NETLIB_UPDATE_PARAMI();
|
||||
NETLIB_UPDATE_TERMINALSI();
|
||||
|
||||
private:
|
||||
nld_twoterm m_RB;
|
||||
nld_twoterm m_RC;
|
||||
|
||||
@ -216,9 +217,6 @@ NETLIB_OBJECT_DERIVED(QBJT_switch, QBJT)
|
||||
|
||||
nld_twoterm m_BC_dummy;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
nl_double m_gB; // base conductance / switch on
|
||||
nl_double m_gC; // collector conductance / switch on
|
||||
nl_double m_V; // internal voltage source
|
||||
@ -261,10 +259,10 @@ protected:
|
||||
NETLIB_UPDATE_PARAMI();
|
||||
NETLIB_UPDATE_TERMINALSI();
|
||||
|
||||
private:
|
||||
generic_diode m_gD_BC;
|
||||
generic_diode m_gD_BE;
|
||||
|
||||
private:
|
||||
nld_twoterm m_D_CB; // gcc, gce - gcc, gec - gcc, gcc - gce | Ic
|
||||
nld_twoterm m_D_EB; // gee, gec - gee, gce - gee, gee - gec | Ie
|
||||
nld_twoterm m_D_EC; // 0, -gec, -gcc, 0 | 0
|
||||
|
@ -66,6 +66,7 @@ namespace netlist {
|
||||
NETLIB_NAME(VCCS)::reset();
|
||||
}
|
||||
|
||||
|
||||
terminal_t m_OP;
|
||||
terminal_t m_ON;
|
||||
|
||||
@ -91,14 +92,14 @@ namespace netlist {
|
||||
|
||||
NETLIB_IS_DYNAMIC(true)
|
||||
|
||||
param_double_t m_cur_limit; /* current limit */
|
||||
|
||||
protected:
|
||||
//NETLIB_UPDATEI();
|
||||
NETLIB_RESETI();
|
||||
NETLIB_UPDATE_PARAMI();
|
||||
NETLIB_UPDATE_TERMINALSI();
|
||||
|
||||
private:
|
||||
param_double_t m_cur_limit; /* current limit */
|
||||
nl_double m_vi;
|
||||
};
|
||||
|
||||
@ -185,13 +186,14 @@ namespace netlist {
|
||||
|
||||
param_double_t m_RO;
|
||||
|
||||
protected:
|
||||
private:
|
||||
//NETLIB_UPDATEI();
|
||||
//NETLIB_UPDATE_PARAMI();
|
||||
|
||||
terminal_t m_OP2;
|
||||
terminal_t m_ON2;
|
||||
|
||||
|
||||
};
|
||||
|
||||
} // namespace analog
|
||||
|
@ -20,7 +20,7 @@ namespace netlist
|
||||
// generic_diode
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
generic_diode::generic_diode(device_t &dev, pstring name)
|
||||
generic_diode::generic_diode(device_t &dev, const pstring &name)
|
||||
: m_Vd(dev, name + ".m_Vd", 0.7)
|
||||
, m_Id(dev, name + ".m_Id", 0.0)
|
||||
, m_G(dev, name + ".m_G", 1e-15)
|
||||
|
@ -141,7 +141,6 @@ NETLIB_OBJECT_DERIVED(R, R_base)
|
||||
{
|
||||
}
|
||||
|
||||
param_double_t m_R;
|
||||
|
||||
protected:
|
||||
|
||||
@ -150,6 +149,7 @@ protected:
|
||||
NETLIB_UPDATE_PARAMI();
|
||||
|
||||
private:
|
||||
param_double_t m_R;
|
||||
/* protect set_R ... it's a recipe to desaster when used to bypass the parameter */
|
||||
using NETLIB_NAME(R_base)::set_R;
|
||||
};
|
||||
@ -267,13 +267,13 @@ public:
|
||||
NETLIB_TIMESTEPI();
|
||||
NETLIB_RESETI();
|
||||
|
||||
param_double_t m_L;
|
||||
|
||||
protected:
|
||||
//NETLIB_UPDATEI();
|
||||
NETLIB_UPDATE_PARAMI();
|
||||
|
||||
private:
|
||||
param_double_t m_L;
|
||||
|
||||
nl_double m_GParallel;
|
||||
nl_double m_G;
|
||||
nl_double m_I;
|
||||
@ -286,7 +286,7 @@ private:
|
||||
class generic_diode
|
||||
{
|
||||
public:
|
||||
generic_diode(device_t &dev, pstring name);
|
||||
generic_diode(device_t &dev, const pstring &name);
|
||||
|
||||
void update_diode(const double nVd);
|
||||
|
||||
@ -383,12 +383,12 @@ public:
|
||||
NETLIB_UPDATE_TERMINALSI();
|
||||
NETLIB_RESETI();
|
||||
|
||||
diode_model_t m_model;
|
||||
|
||||
protected:
|
||||
//NETLIB_UPDATEI();
|
||||
NETLIB_UPDATE_PARAMI();
|
||||
|
||||
private:
|
||||
diode_model_t m_model;
|
||||
generic_diode m_D;
|
||||
};
|
||||
|
||||
|
@ -21,12 +21,12 @@ TIDY_FLAGSX += -modernize-use-default-member-init,-cppcoreguidelines-pro-bounds-
|
||||
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,-cppcoreguidelines-avoid-magic-numbers,
|
||||
TIDY_FLAGSX += performance-unnecessary-value-param,-cppcoreguidelines-avoid-magic-numbers,
|
||||
TIDY_FLAGSX += -cppcoreguidelines-macro-usage,
|
||||
TIDY_FLAGSX += -cppcoreguidelines-non-private-member-variables-in-classes,-misc-non-private-member-variables-in-classes,
|
||||
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 += performance-unnecessary-copy-initialization,
|
||||
TIDY_FLAGSX += -bugprone-macro-parentheses,-misc-macro-parentheses
|
||||
|
||||
space :=
|
||||
|
@ -29,7 +29,7 @@ namespace netlist
|
||||
NETLIB_RESETI();
|
||||
NETLIB_UPDATEI();
|
||||
|
||||
public:
|
||||
private:
|
||||
NETLIB_SUB(vdd_vss) m_supply;
|
||||
analog::NETLIB_SUB(R_base) m_R;
|
||||
|
||||
|
@ -119,10 +119,10 @@ namespace netlist
|
||||
{
|
||||
m_CLKA.inactivate();
|
||||
m_CLKB.inactivate();
|
||||
m_QA.push_force(0, NLTIME_FROM_NS(40));
|
||||
m_QB.push_force(0, NLTIME_FROM_NS(40));
|
||||
m_QC.push_force(0, NLTIME_FROM_NS(40));
|
||||
m_QD.push_force(0, NLTIME_FROM_NS(40));
|
||||
m_QA.push(0, NLTIME_FROM_NS(40));
|
||||
m_QB.push(0, NLTIME_FROM_NS(40));
|
||||
m_QC.push(0, NLTIME_FROM_NS(40));
|
||||
m_QD.push(0, NLTIME_FROM_NS(40));
|
||||
m_a = m_bcd = 0;
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ namespace netlist
|
||||
NETLIB_RESETI();
|
||||
NETLIB_UPDATEI();
|
||||
|
||||
protected:
|
||||
private:
|
||||
logic_input_t m_S;
|
||||
logic_input_t m_R;
|
||||
|
||||
@ -49,7 +49,7 @@ namespace netlist
|
||||
NETLIB_RESETI();
|
||||
NETLIB_UPDATEI();
|
||||
|
||||
protected:
|
||||
private:
|
||||
logic_input_t m_I;
|
||||
logic_output_t m_Q;
|
||||
|
||||
|
@ -90,8 +90,6 @@ namespace netlist
|
||||
logic_output_t *out_proxied, detail::core_terminal_t &proxy_out);
|
||||
|
||||
logic_input_t m_I;
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
NETLIB_OBJECT_DERIVED(d_to_a_proxy, base_d_to_a_proxy)
|
||||
|
@ -72,9 +72,9 @@ namespace netlist
|
||||
|
||||
public:
|
||||
logic_output_t m_Q;
|
||||
|
||||
param_double_t m_freq;
|
||||
netlist_time m_inc;
|
||||
private:
|
||||
param_double_t m_freq;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -96,7 +96,7 @@ namespace netlist
|
||||
//NETLIB_RESETI();
|
||||
NETLIB_UPDATE_PARAMI();
|
||||
|
||||
protected:
|
||||
private:
|
||||
logic_input_t m_feedback;
|
||||
logic_output_t m_Q;
|
||||
|
||||
@ -154,7 +154,7 @@ namespace netlist
|
||||
NETLIB_HANDLERI(clk2);
|
||||
NETLIB_HANDLERI(clk2_pow2);
|
||||
|
||||
protected:
|
||||
private:
|
||||
|
||||
param_double_t m_freq;
|
||||
param_str_t m_pattern;
|
||||
@ -187,7 +187,7 @@ namespace netlist
|
||||
NETLIB_RESETI() { m_Q.initial(0); }
|
||||
NETLIB_UPDATE_PARAMI() { m_Q.push(m_IN() & 1, netlist_time::from_nsec(1)); }
|
||||
|
||||
protected:
|
||||
private:
|
||||
logic_output_t m_Q;
|
||||
|
||||
param_logic_t m_IN;
|
||||
@ -206,7 +206,7 @@ namespace netlist
|
||||
NETLIB_RESETI() { m_Q.initial(0.0); }
|
||||
NETLIB_UPDATE_PARAMI() { m_Q.push(m_IN()); }
|
||||
|
||||
protected:
|
||||
private:
|
||||
analog_output_t m_Q;
|
||||
param_double_t m_IN;
|
||||
};
|
||||
@ -358,16 +358,17 @@ namespace netlist
|
||||
register_subalias("2", m_R.m_N);
|
||||
}
|
||||
|
||||
NETLIB_RESETI();
|
||||
//NETLIB_UPDATE_PARAMI();
|
||||
NETLIB_UPDATEI();
|
||||
|
||||
analog::NETLIB_SUB(R_base) m_R;
|
||||
logic_input_t m_I;
|
||||
param_double_t m_RON;
|
||||
param_double_t m_ROFF;
|
||||
|
||||
NETLIB_RESETI();
|
||||
//NETLIB_UPDATE_PARAMI();
|
||||
NETLIB_UPDATEI();
|
||||
|
||||
private:
|
||||
|
||||
state_var<netlist_sig_t> m_last_state;
|
||||
};
|
||||
|
||||
|
@ -361,7 +361,7 @@ void netlist_state_t::reset()
|
||||
std::vector<nldelegate *> t;
|
||||
log().verbose("Using default startup strategy");
|
||||
for (auto &n : m_nets)
|
||||
for (auto & term : n->m_core_terms)
|
||||
for (auto & term : n->core_terms())
|
||||
if (term->m_delegate.has_object())
|
||||
{
|
||||
if (!plib::container::contains(t, &term->m_delegate))
|
||||
|
@ -773,7 +773,7 @@ namespace netlist
|
||||
void rebuild_list(); /* rebuild m_list after a load */
|
||||
void move_connections(net_t &dest_net);
|
||||
|
||||
std::vector<core_terminal_t *> m_core_terms; // save post-start m_list ...
|
||||
std::vector<core_terminal_t *> &core_terms() { return m_core_terms; }
|
||||
#if USE_COPY_INSTEAD_OF_REFERENCE
|
||||
void update_inputs()
|
||||
{
|
||||
@ -786,34 +786,20 @@ namespace netlist
|
||||
/* nothing needs to be done */
|
||||
}
|
||||
#endif
|
||||
|
||||
protected:
|
||||
state_var<netlist_sig_t> m_new_Q;
|
||||
state_var<netlist_sig_t> m_cur_Q;
|
||||
state_var<queue_status> m_in_queue; /* 0: not in queue, 1: in queue, 2: last was taken */
|
||||
|
||||
state_var<netlist_time> m_next_scheduled_time;
|
||||
|
||||
private:
|
||||
plib::linkedlist_t<core_terminal_t> m_list_active;
|
||||
core_terminal_t * m_railterminal;
|
||||
|
||||
template <typename T>
|
||||
void process(const T mask, netlist_sig_t sig);
|
||||
};
|
||||
|
||||
class logic_net_t : public detail::net_t
|
||||
{
|
||||
public:
|
||||
|
||||
logic_net_t(netlist_state_t &nl, const pstring &aname, detail::core_terminal_t *mr = nullptr);
|
||||
|
||||
/* only used for logic nets */
|
||||
netlist_sig_t Q() const noexcept { return m_cur_Q; }
|
||||
|
||||
/* only used for logic nets */
|
||||
void initial(const netlist_sig_t val) noexcept
|
||||
{
|
||||
m_cur_Q = m_new_Q = val;
|
||||
update_inputs();
|
||||
}
|
||||
|
||||
/* only used for logic nets */
|
||||
void set_Q_and_push(const netlist_sig_t newQ, const netlist_time delay) NL_NOEXCEPT
|
||||
{
|
||||
if (newQ != m_new_Q)
|
||||
@ -822,15 +808,8 @@ namespace netlist
|
||||
push_to_queue(delay);
|
||||
}
|
||||
}
|
||||
void set_Q_and_push_force(const netlist_sig_t newQ, const netlist_time delay) NL_NOEXCEPT
|
||||
{
|
||||
if (newQ != m_new_Q || is_queued())
|
||||
{
|
||||
m_new_Q = newQ;
|
||||
push_to_queue(delay);
|
||||
}
|
||||
}
|
||||
|
||||
/* only used for logic nets */
|
||||
void set_Q_time(const netlist_sig_t newQ, const netlist_time at) NL_NOEXCEPT
|
||||
{
|
||||
if (newQ != m_new_Q)
|
||||
@ -845,10 +824,34 @@ namespace netlist
|
||||
/* internal state support
|
||||
* FIXME: get rid of this and implement export/import in MAME
|
||||
*/
|
||||
/* only used for logic nets */
|
||||
netlist_sig_t *Q_state_ptr() { return m_cur_Q.ptr(); }
|
||||
|
||||
protected:
|
||||
private:
|
||||
state_var<netlist_sig_t> m_new_Q;
|
||||
state_var<netlist_sig_t> m_cur_Q;
|
||||
state_var<queue_status> m_in_queue; /* 0: not in queue, 1: in queue, 2: last was taken */
|
||||
state_var<netlist_time> m_next_scheduled_time;
|
||||
|
||||
core_terminal_t * m_railterminal;
|
||||
plib::linkedlist_t<core_terminal_t> m_list_active;
|
||||
std::vector<core_terminal_t *> m_core_terms; // save post-start m_list ...
|
||||
|
||||
template <typename T>
|
||||
void process(const T mask, netlist_sig_t sig);
|
||||
};
|
||||
|
||||
class logic_net_t : public detail::net_t
|
||||
{
|
||||
public:
|
||||
|
||||
logic_net_t(netlist_state_t &nl, const pstring &aname, detail::core_terminal_t *mr = nullptr);
|
||||
|
||||
using detail::net_t::Q;
|
||||
using detail::net_t::initial;
|
||||
using detail::net_t::set_Q_and_push;
|
||||
using detail::net_t::set_Q_time;
|
||||
using detail::net_t::Q_state_ptr;
|
||||
|
||||
};
|
||||
|
||||
@ -892,11 +895,6 @@ namespace netlist
|
||||
m_my_net.set_Q_and_push(newQ, delay); // take the shortcut
|
||||
}
|
||||
|
||||
void push_force(const netlist_sig_t newQ, const netlist_time delay) NL_NOEXCEPT
|
||||
{
|
||||
m_my_net.set_Q_and_push_force(newQ, delay); // take the shortcut
|
||||
}
|
||||
|
||||
void set_Q_time(const netlist_sig_t newQ, const netlist_time at) NL_NOEXCEPT
|
||||
{
|
||||
m_my_net.set_Q_time(newQ, at); // take the shortcut
|
||||
@ -1462,6 +1460,7 @@ namespace netlist
|
||||
netlist_time m_time;
|
||||
devices::NETLIB_NAME(mainclock) * m_mainclock;
|
||||
|
||||
PALIGNAS_CACHELINE()
|
||||
detail::queue_t m_queue;
|
||||
|
||||
// performance
|
||||
|
@ -54,6 +54,7 @@ namespace netlist
|
||||
{
|
||||
constexpr pqentry_t() noexcept : m_exec_time(), m_object(nullptr) { }
|
||||
constexpr pqentry_t(const Time t, const Element o) noexcept : m_exec_time(t), m_object(o) { }
|
||||
#if 0
|
||||
~pqentry_t() = default;
|
||||
constexpr pqentry_t(const pqentry_t &e) noexcept = default;
|
||||
constexpr pqentry_t(pqentry_t &&e) noexcept = default;
|
||||
@ -65,7 +66,7 @@ namespace netlist
|
||||
std::swap(m_exec_time, other.m_exec_time);
|
||||
std::swap(m_object, other.m_object);
|
||||
}
|
||||
|
||||
#endif
|
||||
struct QueueOp
|
||||
{
|
||||
inline static constexpr bool less(const pqentry_t &lhs, const pqentry_t &rhs) noexcept
|
||||
@ -110,7 +111,7 @@ namespace netlist
|
||||
std::size_t capacity() const noexcept { return m_list.capacity() - 1; }
|
||||
bool empty() const noexcept { return (m_end == &m_list[1]); }
|
||||
|
||||
void push(T e) noexcept
|
||||
void push(T && e) noexcept
|
||||
{
|
||||
/* Lock */
|
||||
lock_guard_type lck(m_lock);
|
||||
@ -120,7 +121,7 @@ namespace netlist
|
||||
*(i+1) = *(i);
|
||||
m_prof_sortmove.inc();
|
||||
}
|
||||
*(i+1) = e;
|
||||
*(i+1) = std::move(e);
|
||||
++m_end;
|
||||
m_prof_call.inc();
|
||||
}
|
||||
@ -129,7 +130,7 @@ namespace netlist
|
||||
const T &top() const noexcept { return *(m_end-1); }
|
||||
|
||||
template <class R>
|
||||
void remove(const R elem) noexcept
|
||||
void remove(const R &elem) noexcept
|
||||
{
|
||||
/* Lock */
|
||||
lock_guard_type lck(m_lock);
|
||||
@ -145,7 +146,7 @@ namespace netlist
|
||||
}
|
||||
}
|
||||
|
||||
void retime(T elem) noexcept
|
||||
void retime(T && elem) noexcept
|
||||
{
|
||||
/* Lock */
|
||||
lock_guard_type lck(m_lock);
|
||||
@ -155,7 +156,7 @@ namespace netlist
|
||||
{
|
||||
if (QueueOp::equal(*i, elem)) // partial equal!
|
||||
{
|
||||
*i = elem;
|
||||
*i = std::move(elem);
|
||||
while (QueueOp::less(*(i-1), *i))
|
||||
{
|
||||
std::swap(*(i-1), *i);
|
||||
|
@ -462,14 +462,14 @@ devices::nld_base_proxy *setup_t::get_d_a_proxy(detail::core_terminal_t &out)
|
||||
m_proxy_cnt++;
|
||||
/* connect all existing terminals to new net */
|
||||
|
||||
for (auto & p : out.net().m_core_terms)
|
||||
for (auto & p : out.net().core_terms())
|
||||
{
|
||||
p->clear_net(); // de-link from all nets ...
|
||||
if (!connect(new_proxy->proxy_term(), *p))
|
||||
log().fatal(MF_2_CONNECTING_1_TO_2,
|
||||
new_proxy->proxy_term().name(), (*p).name());
|
||||
}
|
||||
out.net().m_core_terms.clear(); // clear the list
|
||||
out.net().core_terms().clear(); // clear the list
|
||||
|
||||
out.net().add_terminal(new_proxy->in());
|
||||
out_cast.set_proxy(proxy);
|
||||
@ -505,14 +505,14 @@ devices::nld_base_proxy *setup_t::get_a_d_proxy(detail::core_terminal_t &inp)
|
||||
|
||||
if (inp.has_net())
|
||||
{
|
||||
for (auto & p : inp.net().m_core_terms)
|
||||
for (auto & p : inp.net().core_terms())
|
||||
{
|
||||
p->clear_net(); // de-link from all nets ...
|
||||
if (!connect(ret->proxy_term(), *p))
|
||||
log().fatal(MF_2_CONNECTING_1_TO_2,
|
||||
ret->proxy_term().name(), (*p).name());
|
||||
}
|
||||
inp.net().m_core_terms.clear(); // clear the list
|
||||
inp.net().core_terms().clear(); // clear the list
|
||||
}
|
||||
ret->out().net().add_terminal(inp);
|
||||
m_netlist.nlstate().add_dev(new_proxy->name(), std::move(new_proxy));
|
||||
@ -667,7 +667,7 @@ bool setup_t::connect_input_input(detail::core_terminal_t &t1, detail::core_term
|
||||
ret = connect(t2, t1.net().railterminal());
|
||||
if (!ret)
|
||||
{
|
||||
for (auto & t : t1.net().m_core_terms)
|
||||
for (auto & t : t1.net().core_terms())
|
||||
{
|
||||
if (t->is_type(detail::terminal_type::TERMINAL))
|
||||
ret = connect(t2, *t);
|
||||
@ -682,7 +682,7 @@ bool setup_t::connect_input_input(detail::core_terminal_t &t1, detail::core_term
|
||||
ret = connect(t1, t2.net().railterminal());
|
||||
if (!ret)
|
||||
{
|
||||
for (auto & t : t2.net().m_core_terms)
|
||||
for (auto & t : t2.net().core_terms())
|
||||
{
|
||||
if (t->is_type(detail::terminal_type::TERMINAL))
|
||||
ret = connect(t1, *t);
|
||||
@ -1123,7 +1123,7 @@ void setup_t::prepare_to_run()
|
||||
solver->post_start();
|
||||
|
||||
for (auto &n : netlist().nets())
|
||||
for (auto & term : n->m_core_terms)
|
||||
for (auto & term : n->core_terms())
|
||||
{
|
||||
//core_device_t *dev = reinterpret_cast<core_device_t *>(term->m_delegate.object());
|
||||
core_device_t *dev = &term->device();
|
||||
|
@ -253,7 +253,7 @@ namespace netlist
|
||||
/* FIXME: used by source_t - need a different approach at some time */
|
||||
bool parse_stream(plib::unique_ptr<plib::pistream> &&istrm, const pstring &name);
|
||||
|
||||
void add_define(pstring def, pstring val)
|
||||
void add_define(const pstring &def, const pstring &val)
|
||||
{
|
||||
m_defines.insert({ def, plib::ppreprocessor::define_t(def, val)});
|
||||
}
|
||||
@ -444,7 +444,7 @@ namespace netlist
|
||||
class source_proc_t : public source_t
|
||||
{
|
||||
public:
|
||||
source_proc_t(pstring name, void (*setup_func)(nlparse_t &))
|
||||
source_proc_t(const pstring &name, void (*setup_func)(nlparse_t &))
|
||||
: source_t(),
|
||||
m_setup_func(setup_func),
|
||||
m_setup_func_name(name)
|
||||
|
@ -40,18 +40,26 @@ namespace plib {
|
||||
}
|
||||
return p;
|
||||
#else
|
||||
return aligned_alloc(alignment, size);
|
||||
return aligned_alloc(alignment, size);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void pfree( void *ptr )
|
||||
{
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-no-malloc)
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
static constexpr bool is_pow2(std::size_t v) noexcept { return !(v & (v-1)); }
|
||||
|
||||
template <typename T, std::size_t ALIGN>
|
||||
inline C14CONSTEXPR T *assume_aligned_ptr(T *p) noexcept
|
||||
{
|
||||
static_assert(ALIGN >= alignof(T), "Alignment must be greater or equal to alignof(T)");
|
||||
static_assert(is_pow2(ALIGN), "Alignment must be a power of 2");
|
||||
//auto t = reinterpret_cast<std::uintptr_t>(p);
|
||||
//if (t & (ALIGN-1))
|
||||
// printf("alignment error!");
|
||||
return reinterpret_cast<T *>(__builtin_assume_aligned(p, ALIGN));
|
||||
}
|
||||
|
||||
@ -246,10 +254,14 @@ namespace plib {
|
||||
static_assert(ALIGN >= alignof(T) && (ALIGN % alignof(T)) == 0,
|
||||
"ALIGN must be greater than alignof(T) and a multiple");
|
||||
|
||||
aligned_allocator() = default;
|
||||
aligned_allocator() noexcept = default;
|
||||
~aligned_allocator() noexcept = default;
|
||||
|
||||
aligned_allocator(const aligned_allocator&) = default;
|
||||
aligned_allocator& operator=(const aligned_allocator&) = delete;
|
||||
aligned_allocator(const aligned_allocator&) noexcept = default;
|
||||
aligned_allocator& operator=(const aligned_allocator&) noexcept = delete;
|
||||
|
||||
aligned_allocator(aligned_allocator&&) noexcept = default;
|
||||
aligned_allocator& operator=(aligned_allocator&&) = delete;
|
||||
|
||||
template <class U>
|
||||
aligned_allocator(const aligned_allocator<U, ALIGN>& rhs) noexcept
|
||||
@ -308,6 +320,8 @@ namespace plib {
|
||||
|
||||
using reference = typename base::reference;
|
||||
using const_reference = typename base::const_reference;
|
||||
using pointer = typename base::pointer;
|
||||
using const_pointer = typename base::const_pointer;
|
||||
using size_type = typename base::size_type;
|
||||
|
||||
using base::base;
|
||||
@ -321,6 +335,9 @@ namespace plib {
|
||||
return assume_aligned_ptr<T, ALIGN>(this->data())[i];
|
||||
}
|
||||
|
||||
pointer data() noexcept { return assume_aligned_ptr<T, ALIGN>(base::data()); }
|
||||
const_pointer data() const noexcept { return assume_aligned_ptr<T, ALIGN>(base::data()); }
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -8,9 +8,9 @@
|
||||
#ifndef PARRAY_H_
|
||||
#define PARRAY_H_
|
||||
|
||||
#include "palloc.h"
|
||||
#include "pconfig.h"
|
||||
#include "pexception.h"
|
||||
#include "palloc.h"
|
||||
|
||||
#include <array>
|
||||
#include <memory>
|
||||
|
@ -46,7 +46,7 @@
|
||||
*/
|
||||
|
||||
#define PALIGN_CACHELINE (64)
|
||||
#define PALIGN_VECTOROPT (16)
|
||||
#define PALIGN_VECTOROPT (32)
|
||||
|
||||
#define PALIGNAS_CACHELINE() PALIGNAS(PALIGN_CACHELINE)
|
||||
#define PALIGNAS_VECTOROPT() PALIGNAS(PALIGN_VECTOROPT)
|
||||
|
@ -58,7 +58,7 @@ WCHAR *wstring_from_utf8(const char *utf8string)
|
||||
#endif
|
||||
|
||||
namespace plib {
|
||||
dynlib::dynlib(const pstring libname)
|
||||
dynlib::dynlib(const pstring &libname)
|
||||
: m_isLoaded(false), m_lib(nullptr)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
@ -88,7 +88,7 @@ dynlib::dynlib(const pstring libname)
|
||||
#endif
|
||||
}
|
||||
|
||||
dynlib::dynlib(const pstring path, const pstring libname)
|
||||
dynlib::dynlib(const pstring &path, const pstring &libname)
|
||||
: m_isLoaded(false), m_lib(nullptr)
|
||||
{
|
||||
// FIXME: implement path search
|
||||
@ -141,7 +141,7 @@ bool dynlib::isLoaded() const
|
||||
return m_isLoaded;
|
||||
}
|
||||
|
||||
void *dynlib::getsym_p(const pstring name)
|
||||
void *dynlib::getsym_p(const pstring &name)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return (void *) GetProcAddress((HMODULE) m_lib, name.c_str());
|
||||
|
@ -18,8 +18,8 @@ namespace plib {
|
||||
class dynlib : public nocopyassignmove
|
||||
{
|
||||
public:
|
||||
explicit dynlib(const pstring libname);
|
||||
dynlib(const pstring path, const pstring libname);
|
||||
explicit dynlib(const pstring &libname);
|
||||
dynlib(const pstring &path, const pstring &libname);
|
||||
|
||||
~dynlib();
|
||||
COPYASSIGNMOVE(dynlib, delete)
|
||||
@ -27,12 +27,12 @@ public:
|
||||
bool isLoaded() const;
|
||||
|
||||
template <typename T>
|
||||
T getsym(const pstring name)
|
||||
T getsym(const pstring &name)
|
||||
{
|
||||
return reinterpret_cast<T>(getsym_p(name));
|
||||
}
|
||||
private:
|
||||
void *getsym_p(const pstring name);
|
||||
void *getsym_p(const pstring &name);
|
||||
|
||||
bool m_isLoaded;
|
||||
void *m_lib;
|
||||
|
@ -23,7 +23,7 @@ namespace plib {
|
||||
// terminate
|
||||
//============================================================
|
||||
|
||||
void terminate(pstring msg) noexcept
|
||||
void terminate(const pstring &msg) noexcept
|
||||
{
|
||||
std::cerr << msg.c_str() << "\n";
|
||||
std::terminate();
|
||||
|
@ -23,7 +23,7 @@ namespace plib {
|
||||
*
|
||||
* \note could be enhanced by setting a termination handler
|
||||
*/
|
||||
[[noreturn]] void terminate(pstring msg) noexcept;
|
||||
[[noreturn]] void terminate(const pstring &msg) noexcept;
|
||||
|
||||
//============================================================
|
||||
// exception base
|
||||
|
@ -9,13 +9,13 @@
|
||||
#include "palloc.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cstdarg>
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <locale>
|
||||
#include <array>
|
||||
|
||||
namespace plib {
|
||||
|
||||
@ -28,6 +28,8 @@ pfmt &pfmt::format_element(const char *l, const unsigned cfmt_spec, ...)
|
||||
std::array<char, 2048> buf;
|
||||
std::size_t sl;
|
||||
|
||||
buf[0] = 0;
|
||||
|
||||
m_arg++;
|
||||
|
||||
pstring search("{");
|
||||
|
@ -84,7 +84,7 @@ void pfunction::compile_postfix(const std::vector<pstring> &inputs,
|
||||
throw plib::pexception(plib::pfmt("nld_function: stack count different to one on <{2}>")(expr));
|
||||
}
|
||||
|
||||
static int get_prio(pstring v)
|
||||
static int get_prio(const pstring &v)
|
||||
{
|
||||
if (v == "(" || v == ")")
|
||||
return 1;
|
||||
|
@ -205,7 +205,8 @@ public:
|
||||
iter_t& operator=(const iter_t &rhs) { iter_t t(rhs); std::swap(*this, t); return *this; }
|
||||
iter_t& operator=(iter_t &&rhs) noexcept { std::swap(*this, rhs); return *this; }
|
||||
iter_t& operator++() noexcept {p = p->next();return *this;}
|
||||
iter_t operator++(int) noexcept {const iter_t tmp(*this); operator++(); return tmp;}
|
||||
// NOLINTNEXTLINE(cert-dcl21-cpp)
|
||||
iter_t operator++(int) & noexcept {const iter_t tmp(*this); operator++(); return tmp;}
|
||||
|
||||
~iter_t() = default;
|
||||
|
||||
|
@ -139,8 +139,8 @@ namespace plib {
|
||||
auto *ret = reinterpret_cast<void *>(b->m_data + b->m_cur);
|
||||
auto capacity(rs);
|
||||
ret = std::align(align, size, ret, capacity);
|
||||
if (ret == nullptr)
|
||||
printf("Oh no\n");
|
||||
// FIXME: if (ret == nullptr)
|
||||
// printf("Oh no\n");
|
||||
sinfo().insert({ ret, info(b, b->m_cur)});
|
||||
rs -= (capacity - size);
|
||||
b->m_cur += rs;
|
||||
@ -155,8 +155,8 @@ namespace plib {
|
||||
auto *ret = reinterpret_cast<void *>(b->m_data + b->m_cur);
|
||||
auto capacity(rs);
|
||||
ret = std::align(align, size, ret, capacity);
|
||||
if (ret == nullptr)
|
||||
printf("Oh no\n");
|
||||
// FIXME: if (ret == nullptr)
|
||||
// printf("Oh no\n");
|
||||
sinfo().insert({ ret, info(b, b->m_cur)});
|
||||
rs -= (capacity - size);
|
||||
b->m_cur += rs;
|
||||
|
@ -14,13 +14,13 @@ namespace plib {
|
||||
Options
|
||||
***************************************************************************/
|
||||
|
||||
option_base::option_base(options &parent, pstring help)
|
||||
option_base::option_base(options &parent, const pstring &help)
|
||||
: m_help(help)
|
||||
{
|
||||
parent.register_option(this);
|
||||
}
|
||||
|
||||
option::option(options &parent, pstring ashort, pstring along, pstring help, bool has_argument)
|
||||
option::option(options &parent, const pstring &ashort, const pstring &along, const pstring &help, bool has_argument)
|
||||
: option_base(parent, help), m_short(ashort), m_long(along),
|
||||
m_has_argument(has_argument), m_specified(false)
|
||||
{
|
||||
@ -174,7 +174,7 @@ namespace plib {
|
||||
return argc;
|
||||
}
|
||||
|
||||
pstring options::split_paragraphs(pstring text, unsigned width, unsigned indent,
|
||||
pstring options::split_paragraphs(const pstring &text, unsigned width, unsigned indent,
|
||||
unsigned firstline_indent)
|
||||
{
|
||||
auto paragraphs = psplit(text,"\n");
|
||||
@ -197,7 +197,7 @@ namespace plib {
|
||||
return ret;
|
||||
}
|
||||
|
||||
pstring options::help(pstring description, pstring usage,
|
||||
pstring options::help(const pstring &description, const pstring &usage,
|
||||
unsigned width, unsigned indent) const
|
||||
{
|
||||
pstring ret;
|
||||
@ -272,7 +272,7 @@ namespace plib {
|
||||
return ret;
|
||||
}
|
||||
|
||||
option *options::getopt_short(pstring arg) const
|
||||
option *options::getopt_short(const pstring &arg) const
|
||||
{
|
||||
for (auto & optbase : m_opts)
|
||||
{
|
||||
@ -282,7 +282,7 @@ namespace plib {
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
option *options::getopt_long(pstring arg) const
|
||||
option *options::getopt_long(const pstring &arg) const
|
||||
{
|
||||
for (auto & optbase : m_opts)
|
||||
{
|
||||
|
@ -24,7 +24,7 @@ class options;
|
||||
class option_base
|
||||
{
|
||||
public:
|
||||
option_base(options &parent, pstring help);
|
||||
option_base(options &parent, const pstring &help);
|
||||
virtual ~option_base() = default;
|
||||
|
||||
COPYASSIGNMOVE(option_base, delete)
|
||||
@ -37,7 +37,7 @@ private:
|
||||
class option_group : public option_base
|
||||
{
|
||||
public:
|
||||
option_group(options &parent, pstring group, pstring help)
|
||||
option_group(options &parent, const pstring &group, const pstring &help)
|
||||
: option_base(parent, help), m_group(group) { }
|
||||
|
||||
pstring group() const { return m_group; }
|
||||
@ -48,7 +48,7 @@ private:
|
||||
class option_example : public option_base
|
||||
{
|
||||
public:
|
||||
option_example(options &parent, pstring group, pstring help)
|
||||
option_example(options &parent, const pstring &group, const pstring &help)
|
||||
: option_base(parent, help), m_example(group) { }
|
||||
|
||||
pstring example() const { return m_example; }
|
||||
@ -60,7 +60,7 @@ private:
|
||||
class option : public option_base
|
||||
{
|
||||
public:
|
||||
option(options &parent, pstring ashort, pstring along, pstring help, bool has_argument);
|
||||
option(options &parent, const pstring &ashort, const pstring &along, const pstring &help, bool has_argument);
|
||||
|
||||
/* no_argument options will be called with "" argument */
|
||||
|
||||
@ -88,7 +88,7 @@ private:
|
||||
class option_str : public option
|
||||
{
|
||||
public:
|
||||
option_str(options &parent, pstring ashort, pstring along, pstring defval, pstring help)
|
||||
option_str(options &parent, const pstring &ashort, const pstring &along, const pstring &defval, const pstring &help)
|
||||
: option(parent, ashort, along, help, true), m_val(defval)
|
||||
{}
|
||||
|
||||
@ -104,7 +104,7 @@ private:
|
||||
class option_str_limit_base : public option
|
||||
{
|
||||
public:
|
||||
option_str_limit_base(options &parent, pstring ashort, pstring along, std::vector<pstring> &&limit, pstring help)
|
||||
option_str_limit_base(options &parent, const pstring &ashort, const pstring &along, std::vector<pstring> &&limit, const pstring &help)
|
||||
: option(parent, ashort, along, help, true)
|
||||
, m_limit(limit)
|
||||
{
|
||||
@ -122,7 +122,7 @@ template <typename T>
|
||||
class option_str_limit : public option_str_limit_base
|
||||
{
|
||||
public:
|
||||
option_str_limit(options &parent, pstring ashort, pstring along, const T &defval, std::vector<pstring> &&limit, pstring help)
|
||||
option_str_limit(options &parent, const pstring &ashort, const pstring &along, const T &defval, std::vector<pstring> &&limit, const pstring &help)
|
||||
: option_str_limit_base(parent, ashort, along, std::move(limit), help), m_val(defval)
|
||||
{
|
||||
}
|
||||
@ -152,7 +152,7 @@ private:
|
||||
class option_bool : public option
|
||||
{
|
||||
public:
|
||||
option_bool(options &parent, pstring ashort, pstring along, pstring help)
|
||||
option_bool(options &parent, const pstring &ashort, const pstring &along, const pstring &help)
|
||||
: option(parent, ashort, along, help, false), m_val(false)
|
||||
{}
|
||||
|
||||
@ -169,8 +169,8 @@ template <typename T>
|
||||
class option_num : public option
|
||||
{
|
||||
public:
|
||||
option_num(options &parent, pstring ashort, pstring along, T defval,
|
||||
pstring help,
|
||||
option_num(options &parent, const pstring &ashort, const pstring &along, T defval,
|
||||
const pstring &help,
|
||||
T minval = std::numeric_limits<T>::min(),
|
||||
T maxval = std::numeric_limits<T>::max() )
|
||||
: option(parent, ashort, along, help, true)
|
||||
@ -198,7 +198,7 @@ private:
|
||||
class option_vec : public option
|
||||
{
|
||||
public:
|
||||
option_vec(options &parent, pstring ashort, pstring along, pstring help)
|
||||
option_vec(options &parent, const pstring &ashort, const pstring &along, const pstring &help)
|
||||
: option(parent, ashort, along, help, true)
|
||||
{}
|
||||
|
||||
@ -214,7 +214,7 @@ private:
|
||||
class option_args : public option_vec
|
||||
{
|
||||
public:
|
||||
option_args(options &parent, pstring help)
|
||||
option_args(options &parent, const pstring &help)
|
||||
: option_vec(parent, "", "", help)
|
||||
{}
|
||||
};
|
||||
@ -229,13 +229,13 @@ public:
|
||||
void register_option(option_base *opt);
|
||||
int parse(int argc, char **argv);
|
||||
|
||||
pstring help(pstring description, pstring usage,
|
||||
pstring help(const pstring &description, const pstring &usage,
|
||||
unsigned width = 72, unsigned indent = 20) const;
|
||||
|
||||
pstring app() const { return m_app; }
|
||||
|
||||
private:
|
||||
static pstring split_paragraphs(pstring text, unsigned width, unsigned indent,
|
||||
static pstring split_paragraphs(const pstring &text, unsigned width, unsigned indent,
|
||||
unsigned firstline_indent);
|
||||
|
||||
void check_consistency();
|
||||
@ -251,8 +251,8 @@ private:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
option *getopt_short(pstring arg) const;
|
||||
option *getopt_long(pstring arg) const;
|
||||
option *getopt_short(const pstring &arg) const;
|
||||
option *getopt_long(const pstring &arg) const;
|
||||
|
||||
std::vector<option_base *> m_opts;
|
||||
pstring m_app;
|
||||
|
@ -98,18 +98,18 @@ public:
|
||||
void require_token(const token_id_t &token_num);
|
||||
void require_token(const token_t &tok, const token_id_t &token_num);
|
||||
|
||||
token_id_t register_token(pstring token)
|
||||
token_id_t register_token(const pstring &token)
|
||||
{
|
||||
token_id_t ret(m_tokens.size());
|
||||
m_tokens.emplace(token, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ptokenizer & identifier_chars(pstring s) { m_identifier_chars = s; return *this; }
|
||||
ptokenizer & number_chars(pstring st, pstring rem) { m_number_chars_start = st; m_number_chars = rem; return *this; }
|
||||
ptokenizer & identifier_chars(pstring s) { m_identifier_chars = std::move(s); return *this; }
|
||||
ptokenizer & number_chars(pstring st, pstring rem) { m_number_chars_start = std::move(st); m_number_chars = std::move(rem); return *this; }
|
||||
ptokenizer & string_char(pstring::value_type c) { m_string = c; return *this; }
|
||||
ptokenizer & whitespace(pstring s) { m_whitespace = s; return *this; }
|
||||
ptokenizer & comment(pstring start, pstring end, pstring line)
|
||||
ptokenizer & whitespace(pstring s) { m_whitespace = std::move(s); return *this; }
|
||||
ptokenizer & comment(const pstring &start, const pstring &end, const pstring &line)
|
||||
{
|
||||
m_tok_comment_start = register_token(start);
|
||||
m_tok_comment_end = register_token(end);
|
||||
|
@ -95,6 +95,7 @@ namespace plib {
|
||||
if (PHAS_PMF_INTERNAL == 1)
|
||||
{
|
||||
// apply the "this" delta to the object first
|
||||
// NOLINTNEXTLINE(clang-analyzer-core.UndefinedBinaryOperatorResult)
|
||||
auto o_p_delta = reinterpret_cast<generic_class *>(reinterpret_cast<std::uint8_t *>(object) + m_this_delta);
|
||||
|
||||
// if the low bit of the vtable index is clear, then it is just a raw function pointer
|
||||
|
@ -8,9 +8,9 @@
|
||||
#ifndef PSTATE_H_
|
||||
#define PSTATE_H_
|
||||
|
||||
#include "palloc.h"
|
||||
#include "pstring.h"
|
||||
#include "ptypes.h"
|
||||
#include "palloc.h"
|
||||
|
||||
#include <array>
|
||||
#include <memory>
|
||||
|
@ -530,7 +530,8 @@ public:
|
||||
|
||||
void write(const pstring &text) const
|
||||
{
|
||||
putf8string conv_utf8(text);
|
||||
// NOLINTNEXTLINE(performance-unnecessary-copy-initialization)
|
||||
const putf8string conv_utf8(text);
|
||||
m_strm->write(reinterpret_cast<const pistream::value_type *>(conv_utf8.c_str()), conv_utf8.mem_t_size());
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,8 @@ public:
|
||||
explicit constexpr pstring_const_iterator(const typename string_type::const_iterator &x) noexcept : p(x) { }
|
||||
|
||||
pstring_const_iterator& operator++() noexcept { p += static_cast<difference_type>(traits_type::codelen(&(*p))); return *this; }
|
||||
pstring_const_iterator operator++(int) noexcept { pstring_const_iterator tmp(*this); operator++(); return tmp; }
|
||||
// NOLINTNEXTLINE(cert-dcl21-cpp)
|
||||
pstring_const_iterator operator++(int) & noexcept { pstring_const_iterator tmp(*this); operator++(); return tmp; }
|
||||
|
||||
constexpr bool operator==(const pstring_const_iterator& rhs) const noexcept { return p == rhs.p; }
|
||||
constexpr bool operator!=(const pstring_const_iterator& rhs) const noexcept { return p != rhs.p; }
|
||||
@ -207,10 +208,8 @@ public:
|
||||
|
||||
static const size_type npos = static_cast<size_type>(-1);
|
||||
|
||||
protected:
|
||||
string_type m_str;
|
||||
|
||||
private:
|
||||
string_type m_str;
|
||||
};
|
||||
|
||||
struct pu8_traits
|
||||
|
@ -43,7 +43,8 @@ namespace plib
|
||||
template<typename T, typename V1, typename V2>
|
||||
T vec_mult (const std::size_t n, const V1 & v1, const V2 & v2 )
|
||||
{
|
||||
PALIGNAS_VECTOROPT() T value[8] = {0};
|
||||
using b8 = T[8];
|
||||
PALIGNAS_VECTOROPT() b8 value = {0};
|
||||
for (std::size_t i = 0; i < n ; i++ )
|
||||
{
|
||||
value[i & 7] += v1[i] * v2[i];
|
||||
@ -54,7 +55,8 @@ namespace plib
|
||||
template<typename T, typename VT>
|
||||
T vec_mult2 (const std::size_t n, const VT &v)
|
||||
{
|
||||
PALIGNAS_VECTOROPT() T value[8] = {0};
|
||||
using b8 = T[8];
|
||||
PALIGNAS_VECTOROPT() b8 value = {0};
|
||||
for (std::size_t i = 0; i < n ; i++ )
|
||||
{
|
||||
value[i & 7] += v[i] * v[i];
|
||||
@ -67,7 +69,7 @@ namespace plib
|
||||
{
|
||||
if (n<8)
|
||||
{
|
||||
PALIGNAS_VECTOROPT() T value(0);
|
||||
T value(0);
|
||||
for (std::size_t i = 0; i < n ; i++ )
|
||||
value += v[i];
|
||||
|
||||
@ -75,7 +77,8 @@ namespace plib
|
||||
}
|
||||
else
|
||||
{
|
||||
PALIGNAS_VECTOROPT() T value[8] = {0};
|
||||
using b8 = T[8];
|
||||
PALIGNAS_VECTOROPT() b8 value = {0};
|
||||
for (std::size_t i = 0; i < n ; i++ )
|
||||
value[i & 7] += v[i];
|
||||
|
||||
|
@ -120,7 +120,7 @@ NETLIST_END()
|
||||
class netlist_data_folder_t : public netlist::source_t
|
||||
{
|
||||
public:
|
||||
netlist_data_folder_t(pstring folder)
|
||||
netlist_data_folder_t(const pstring &folder)
|
||||
: netlist::source_t(netlist::source_t::DATA)
|
||||
, m_folder(folder)
|
||||
{
|
||||
@ -311,7 +311,7 @@ struct input_t
|
||||
double m_value;
|
||||
};
|
||||
|
||||
static std::vector<input_t> read_input(const netlist::setup_t &setup, pstring fname)
|
||||
static std::vector<input_t> read_input(const netlist::setup_t &setup, const pstring &fname)
|
||||
{
|
||||
std::vector<input_t> ret;
|
||||
if (fname != "")
|
||||
|
@ -363,17 +363,17 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
std::size_t m_channels;
|
||||
double m_last_time;
|
||||
|
||||
private:
|
||||
void write(pstring line)
|
||||
void write(const pstring &line)
|
||||
{
|
||||
auto p = static_cast<const char *>(line.c_str());
|
||||
std::size_t len = std::strlen(p);
|
||||
m_fo.write(p, len);
|
||||
}
|
||||
|
||||
std::size_t m_channels;
|
||||
double m_last_time;
|
||||
|
||||
plib::postream &m_fo;
|
||||
std::vector<pstring> m_ids;
|
||||
pstring m_buf;
|
||||
@ -410,6 +410,14 @@ public:
|
||||
"convert all files starting with \"log_V\" into a multichannel wav file"),
|
||||
m_outstrm(nullptr)
|
||||
{}
|
||||
|
||||
int execute() override;
|
||||
pstring usage() override;
|
||||
|
||||
private:
|
||||
void convert_wav();
|
||||
void convert_vcd(vcdwriter::format_e format);
|
||||
|
||||
plib::option_str_limit<unsigned> opt_fmt;
|
||||
plib::option_str opt_out;
|
||||
plib::option_num<std::size_t> opt_rate;
|
||||
@ -423,14 +431,8 @@ public:
|
||||
plib::option_bool opt_help;
|
||||
plib::option_example opt_ex1;
|
||||
plib::option_example opt_ex2;
|
||||
|
||||
int execute() override;
|
||||
pstring usage() override;
|
||||
|
||||
plib::pstdin pin_strm;
|
||||
private:
|
||||
void convert_wav();
|
||||
void convert_vcd(vcdwriter::format_e format);
|
||||
|
||||
std::vector<plib::unique_ptr<plib::pistream>> m_instrms;
|
||||
plib::postream *m_outstrm;
|
||||
};
|
||||
|
@ -111,7 +111,7 @@ void matrix_solver_t::setup_base(analog_net_t::list_t &nets)
|
||||
|
||||
net->set_solver(this);
|
||||
|
||||
for (auto &p : net->m_core_terms)
|
||||
for (auto &p : net->core_terms())
|
||||
{
|
||||
log().debug("{1} {2} {3}\n", p->name(), net->name(), net->isRailNet());
|
||||
switch (p->type())
|
||||
@ -159,7 +159,7 @@ void matrix_solver_t::setup_base(analog_net_t::list_t &nets)
|
||||
break;
|
||||
}
|
||||
}
|
||||
log().debug("added net with {1} populated connections\n", net->m_core_terms.size());
|
||||
log().debug("added net with {1} populated connections\n", net->core_terms().size());
|
||||
}
|
||||
|
||||
/* now setup the matrix */
|
||||
@ -336,9 +336,7 @@ void matrix_solver_t::setup_matrix()
|
||||
* This should reduce cache misses ...
|
||||
*/
|
||||
|
||||
auto **touched = plib::pnew_array<bool *>(iN);
|
||||
for (std::size_t k=0; k<iN; k++)
|
||||
touched[k] = plib::pnew_array<bool>(iN);
|
||||
std::vector<std::vector<bool>> touched(iN, std::vector<bool>(iN));
|
||||
|
||||
for (std::size_t k = 0; k < iN; k++)
|
||||
{
|
||||
@ -395,10 +393,6 @@ void matrix_solver_t::setup_matrix()
|
||||
state().save(*this, m_terms[k]->gt(),"GT" + num, this->name(), m_terms[k]->count());
|
||||
state().save(*this, m_terms[k]->Idr(),"IDR" + num, this->name(), m_terms[k]->count());
|
||||
}
|
||||
|
||||
for (std::size_t k=0; k<iN; k++)
|
||||
plib::pdelete_array(touched[k]);
|
||||
plib::pdelete_array(touched);
|
||||
}
|
||||
|
||||
void matrix_solver_t::update_inputs()
|
||||
|
@ -213,7 +213,7 @@ struct net_splitter
|
||||
return;
|
||||
/* add the net */
|
||||
groups.back().push_back(n);
|
||||
for (auto &p : n->m_core_terms)
|
||||
for (auto &p : n->core_terms())
|
||||
{
|
||||
if (p->is_type(detail::terminal_type::TERMINAL))
|
||||
{
|
||||
@ -399,7 +399,7 @@ void NETLIB_NAME(solver)::post_start()
|
||||
for (auto &n : grp)
|
||||
{
|
||||
log().verbose("Net {1}", n->name());
|
||||
for (const auto &pcore : n->m_core_terms)
|
||||
for (const auto &pcore : n->core_terms())
|
||||
{
|
||||
log().verbose(" {1}", pcore->name());
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ NETLIB_OBJECT(solver)
|
||||
NETLIB_RESETI();
|
||||
// NETLIB_UPDATE_PARAMI();
|
||||
|
||||
protected:
|
||||
private:
|
||||
logic_input_t m_fb_step;
|
||||
logic_output_t m_Q_step;
|
||||
|
||||
@ -96,7 +96,6 @@ protected:
|
||||
|
||||
param_logic_t m_log_stats;
|
||||
|
||||
private:
|
||||
std::vector<poolptr<matrix_solver_t>> m_mat_solvers;
|
||||
std::vector<matrix_solver_t *> m_mat_solvers_all;
|
||||
std::vector<matrix_solver_t *> m_mat_solvers_timestepping;
|
||||
|
@ -105,7 +105,7 @@ void nl_convert_base_t::add_device(const pstring &atype, const pstring &aname)
|
||||
add_device(plib::make_unique<dev_t>(atype, aname));
|
||||
}
|
||||
|
||||
void nl_convert_base_t::add_term(pstring netname, pstring termname)
|
||||
void nl_convert_base_t::add_term(const pstring &netname, const pstring &termname)
|
||||
{
|
||||
net_t * net = nullptr;
|
||||
auto idx = m_nets.find(netname);
|
||||
|
@ -43,7 +43,7 @@ protected:
|
||||
void add_device(const pstring &atype, const pstring &aname, double aval);
|
||||
void add_device(const pstring &atype, const pstring &aname);
|
||||
|
||||
void add_term(pstring netname, pstring termname);
|
||||
void add_term(const pstring &netname, const pstring &termname);
|
||||
|
||||
void dump_nl();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user