summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib
diff options
context:
space:
mode:
authorGravatarGravatar couriersud <couriersud@gmx.org>2019-11-01 18:49:22 +0100
committerGravatarGravatar couriersud <couriersud@gmx.org>2019-11-01 18:49:22 +0100
commit5f1427ab0f2582ee20b0a3f8a0da438c99ad3267 (patch)
tree2c5f6b80a6b4b112ce09eb7e075aec8a7c43f38d /src/lib
parent7ea9ee947bdb5e7df446aa82255eb2cb5a41b927 (diff)
netlist: code maintenance and bugfixes. (nw)
- fixed a bug in the parray constructor - replaced NL_NOEXCEPT with noexcept where appropriate
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/netlist/devices/nld_4020.cpp36
-rw-r--r--src/lib/netlist/devices/nld_7448.cpp33
-rw-r--r--src/lib/netlist/devices/nld_7490.cpp33
-rw-r--r--src/lib/netlist/devices/nld_am2847.cpp28
-rw-r--r--src/lib/netlist/devices/nlid_truthtable.h4
-rw-r--r--src/lib/netlist/nl_base.cpp22
-rw-r--r--src/lib/netlist/nl_base.h185
-rw-r--r--src/lib/netlist/nl_config.h3
-rw-r--r--src/lib/netlist/nl_setup.cpp2
-rw-r--r--src/lib/netlist/plib/parray.h35
-rw-r--r--src/lib/netlist/solver/nld_matrix_solver.h10
11 files changed, 199 insertions, 192 deletions
diff --git a/src/lib/netlist/devices/nld_4020.cpp b/src/lib/netlist/devices/nld_4020.cpp
index 97161071306..f542ff51aad 100644
--- a/src/lib/netlist/devices/nld_4020.cpp
+++ b/src/lib/netlist/devices/nld_4020.cpp
@@ -34,8 +34,22 @@ namespace netlist
NETLIB_UPDATEI();
public:
- void update_outputs(const unsigned cnt) NL_NOEXCEPT;
-
+ void update_outputs(const unsigned cnt) NL_NOEXCEPT
+ {
+ static constexpr const std::array<netlist_time, 14> out_delayQn = {
+ NLTIME_FROM_NS(180), NLTIME_FROM_NS(280),
+ NLTIME_FROM_NS(380), NLTIME_FROM_NS(480),
+ NLTIME_FROM_NS(580), NLTIME_FROM_NS(680),
+ NLTIME_FROM_NS(780), NLTIME_FROM_NS(880),
+ NLTIME_FROM_NS(980), NLTIME_FROM_NS(1080),
+ NLTIME_FROM_NS(1180), NLTIME_FROM_NS(1280),
+ NLTIME_FROM_NS(1380), NLTIME_FROM_NS(1480),
+ };
+
+ m_Q[0].push(cnt & 1, out_delayQn[0]);
+ for (std::size_t i=3; i<14; i++)
+ m_Q[i].push((cnt >> i) & 1, out_delayQn[i]);
+ }
logic_input_t m_IP;
object_array_t<logic_output_t, 14> m_Q;
@@ -74,7 +88,6 @@ namespace netlist
logic_input_t m_RESET;
};
-
NETLIB_UPDATE(CD4020_sub)
{
++m_cnt;
@@ -97,23 +110,6 @@ namespace netlist
m_sub.m_IP.activate_hl();
}
- NETLIB_FUNC_VOID(CD4020_sub, update_outputs, (const unsigned cnt))
- {
- static constexpr const std::array<netlist_time, 14> out_delayQn = {
- NLTIME_FROM_NS(180), NLTIME_FROM_NS(280),
- NLTIME_FROM_NS(380), NLTIME_FROM_NS(480),
- NLTIME_FROM_NS(580), NLTIME_FROM_NS(680),
- NLTIME_FROM_NS(780), NLTIME_FROM_NS(880),
- NLTIME_FROM_NS(980), NLTIME_FROM_NS(1080),
- NLTIME_FROM_NS(1180), NLTIME_FROM_NS(1280),
- NLTIME_FROM_NS(1380), NLTIME_FROM_NS(1480),
- };
-
- m_Q[0].push(cnt & 1, out_delayQn[0]);
- for (std::size_t i=3; i<14; i++)
- m_Q[i].push((cnt >> i) & 1, out_delayQn[i]);
- }
-
NETLIB_DEVICE_IMPL(CD4020, "CD4020", "")
NETLIB_DEVICE_IMPL_ALIAS(CD4020_WI, CD4020, "CD4020_WI", "+IP,+RESET,+VDD,+VSS")
diff --git a/src/lib/netlist/devices/nld_7448.cpp b/src/lib/netlist/devices/nld_7448.cpp
index cc24e402cfa..bd53ff1f7eb 100644
--- a/src/lib/netlist/devices/nld_7448.cpp
+++ b/src/lib/netlist/devices/nld_7448.cpp
@@ -36,7 +36,19 @@ namespace netlist
NETLIB_UPDATEI();
public:
- void update_outputs(unsigned v) NL_NOEXCEPT;
+ void update_outputs(unsigned v) NL_NOEXCEPT
+ {
+ nl_assert(v<16);
+ if (v != m_state)
+ {
+ // max transfer time is 100 NS */
+
+ uint8_t t = tab7448[v];
+ for (std::size_t i = 0; i < 7; i++)
+ m_Q[i].push((t >> (6-i)) & 1, NLTIME_FROM_NS(100));
+ m_state = v;
+ }
+ }
logic_input_t m_A;
logic_input_t m_B;
@@ -50,7 +62,8 @@ namespace netlist
object_array_t<logic_output_t, 7> m_Q; /* a .. g */
nld_power_pins m_power_pins;
-
+ private:
+ static const std::array<uint8_t, 16> tab7448;
};
NETLIB_OBJECT_DERIVED(7448_dip, 7448)
@@ -83,7 +96,7 @@ namespace netlist
#define BITS7(b6,b5,b4,b3,b2,b1,b0) ((b6)<<6) | ((b5)<<5) | ((b4)<<4) | ((b3)<<3) | ((b2)<<2) | ((b1)<<1) | ((b0)<<0)
- static constexpr const std::array<uint8_t, 16> tab7448 =
+ const std::array<uint8_t, 16> NETLIB_NAME(7448)::tab7448 =
{
BITS7( 1, 1, 1, 1, 1, 1, 0 ), /* 00 - not blanked ! */
BITS7( 0, 1, 1, 0, 0, 0, 0 ), /* 01 */
@@ -145,20 +158,6 @@ namespace netlist
#endif
}
- NETLIB_FUNC_VOID(7448, update_outputs, (unsigned v))
- {
- nl_assert(v<16);
- if (v != m_state)
- {
- // max transfer time is 100 NS */
-
- uint8_t t = tab7448[v];
- for (std::size_t i = 0; i < 7; i++)
- m_Q[i].push((t >> (6-i)) & 1, NLTIME_FROM_NS(100));
- m_state = v;
- }
- }
-
NETLIB_DEVICE_IMPL(7448, "TTL_7448", "+A,+B,+C,+D,+LTQ,+BIQ,+RBIQ,@VCC,@GND")
NETLIB_DEVICE_IMPL(7448_dip, "TTL_7448_DIP", "")
diff --git a/src/lib/netlist/devices/nld_7490.cpp b/src/lib/netlist/devices/nld_7490.cpp
index 497547c3630..aa58541526d 100644
--- a/src/lib/netlist/devices/nld_7490.cpp
+++ b/src/lib/netlist/devices/nld_7490.cpp
@@ -11,8 +11,17 @@
namespace netlist
{
- namespace devices
+namespace devices
+{
+
+ static constexpr const std::array<netlist_time, 4> delay =
{
+ NLTIME_FROM_NS(18),
+ NLTIME_FROM_NS(36) - NLTIME_FROM_NS(18),
+ NLTIME_FROM_NS(54) - NLTIME_FROM_NS(18),
+ NLTIME_FROM_NS(72) - NLTIME_FROM_NS(18)
+ };
+
NETLIB_OBJECT(7490)
{
NETLIB_CONSTRUCTOR(7490)
@@ -34,7 +43,11 @@ namespace netlist
NETLIB_UPDATEI();
NETLIB_RESETI();
- void update_outputs() NL_NOEXCEPT;
+ void update_outputs() noexcept
+ {
+ for (std::size_t i=0; i<4; i++)
+ m_Q[i].push((m_cnt >> i) & 1, delay[i]);
+ }
logic_input_t m_A;
logic_input_t m_B;
@@ -81,14 +94,6 @@ namespace netlist
m_last_B = 0;
}
- static constexpr const std::array<netlist_time, 4> delay =
- {
- NLTIME_FROM_NS(18),
- NLTIME_FROM_NS(36) - NLTIME_FROM_NS(18),
- NLTIME_FROM_NS(54) - NLTIME_FROM_NS(18),
- NLTIME_FROM_NS(72) - NLTIME_FROM_NS(18)
- };
-
NETLIB_UPDATE(7490)
{
const netlist_sig_t new_A = m_A();
@@ -123,14 +128,8 @@ namespace netlist
m_last_B = new_B;
}
- NETLIB_FUNC_VOID(7490, update_outputs, ())
- {
- for (std::size_t i=0; i<4; i++)
- m_Q[i].push((m_cnt >> i) & 1, delay[i]);
- }
-
NETLIB_DEVICE_IMPL(7490, "TTL_7490", "+A,+B,+R1,+R2,+R91,+R92,@VCC,@GND")
NETLIB_DEVICE_IMPL(7490_dip, "TTL_7490_DIP", "")
- } //namespace devices
+} // namespace devices
} // namespace netlist
diff --git a/src/lib/netlist/devices/nld_am2847.cpp b/src/lib/netlist/devices/nld_am2847.cpp
index 1a64767873c..670477c6e06 100644
--- a/src/lib/netlist/devices/nld_am2847.cpp
+++ b/src/lib/netlist/devices/nld_am2847.cpp
@@ -27,7 +27,19 @@ namespace netlist
NETLIB_UPDATEI();
public:
- void shift() NL_NOEXCEPT;
+ void shift() noexcept
+ {
+ uint32_t out = m_buffer[0] & 1;
+ uint32_t in = (m_RC() ? out : m_IN());
+ for (std::size_t i=0; i < 5; i++)
+ {
+ uint32_t shift_in = (i == 4) ? in : m_buffer[i + 1];
+ m_buffer[i] >>= 1;
+ m_buffer[i] |= shift_in << 15;
+ }
+
+ m_OUT.push(out, NLTIME_FROM_NS(200));
+ }
logic_input_t m_RC;
logic_input_t m_IN;
@@ -131,20 +143,6 @@ namespace netlist
/* do nothing */
}
- NETLIB_FUNC_VOID(Am2847_shifter, shift, ())
- {
- uint32_t out = m_buffer[0] & 1;
- uint32_t in = (m_RC() ? out : m_IN());
- for (std::size_t i=0; i < 5; i++)
- {
- uint32_t shift_in = (i == 4) ? in : m_buffer[i + 1];
- m_buffer[i] >>= 1;
- m_buffer[i] |= shift_in << 15;
- }
-
- m_OUT.push(out, NLTIME_FROM_NS(200));
- }
-
NETLIB_DEVICE_IMPL(AM2847, "TTL_AM2847", "+CP,+INA,+INB,+INC,+IND,+RCA,+RCB,+RCC,+RCD,@VSS,@VDD")
NETLIB_DEVICE_IMPL(AM2847_dip, "TTL_AM2847_DIP", "")
diff --git a/src/lib/netlist/devices/nlid_truthtable.h b/src/lib/netlist/devices/nlid_truthtable.h
index ed7c39fae24..00890eb302d 100644
--- a/src/lib/netlist/devices/nlid_truthtable.h
+++ b/src/lib/netlist/devices/nlid_truthtable.h
@@ -92,12 +92,12 @@ namespace devices
process<true>();
}
- void inc_active() NL_NOEXCEPT override
+ void inc_active() noexcept override
{
process<false>();
}
- void dec_active() NL_NOEXCEPT override
+ void dec_active() noexcept override
{
for (std::size_t i = 0; i< m_NI; i++)
m_I[i].inactivate();
diff --git a/src/lib/netlist/nl_base.cpp b/src/lib/netlist/nl_base.cpp
index f3cdef98e1d..f0b5735ff26 100644
--- a/src/lib/netlist/nl_base.cpp
+++ b/src/lib/netlist/nl_base.cpp
@@ -408,7 +408,7 @@ namespace netlist
}
- void netlist_t::print_stats() const NL_NOEXCEPT
+ void netlist_t::print_stats() const
{
if (m_use_stats)
{
@@ -894,7 +894,7 @@ namespace netlist
}
- void param_t::update_param() NL_NOEXCEPT
+ void param_t::update_param() noexcept
{
device().update_param();
}
@@ -949,48 +949,48 @@ namespace netlist
return device().state().setup().get_data_stream(str());
}
- bool detail::core_terminal_t::is_logic() const NL_NOEXCEPT
+ bool detail::core_terminal_t::is_logic() const noexcept
{
return dynamic_cast<const logic_t *>(this) != nullptr;
}
- bool detail::core_terminal_t::is_logic_input() const NL_NOEXCEPT
+ bool detail::core_terminal_t::is_logic_input() const noexcept
{
return dynamic_cast<const logic_input_t *>(this) != nullptr;
}
- bool detail::core_terminal_t::is_logic_output() const NL_NOEXCEPT
+ bool detail::core_terminal_t::is_logic_output() const noexcept
{
return dynamic_cast<const logic_output_t *>(this) != nullptr;
}
- bool detail::core_terminal_t::is_analog() const NL_NOEXCEPT
+ bool detail::core_terminal_t::is_analog() const noexcept
{
return dynamic_cast<const analog_t *>(this) != nullptr;
}
- bool detail::core_terminal_t::is_analog_input() const NL_NOEXCEPT
+ bool detail::core_terminal_t::is_analog_input() const noexcept
{
return dynamic_cast<const analog_input_t *>(this) != nullptr;
}
- bool detail::core_terminal_t::is_analog_output() const NL_NOEXCEPT
+ bool detail::core_terminal_t::is_analog_output() const noexcept
{
return dynamic_cast<const analog_output_t *>(this) != nullptr;
}
- bool detail::net_t::is_logic() const NL_NOEXCEPT
+ bool detail::net_t::is_logic() const noexcept
{
return dynamic_cast<const logic_net_t *>(this) != nullptr;
}
- bool detail::net_t::is_analog() const NL_NOEXCEPT
+ bool detail::net_t::is_analog() const noexcept
{
return dynamic_cast<const analog_net_t *>(this) != nullptr;
}
- void netlist_t::process_queue(const netlist_time delta) NL_NOEXCEPT
+ void netlist_t::process_queue(const netlist_time delta) noexcept
{
if (!m_use_stats)
process_queue_stats<false>(delta, m_mainclock);
diff --git a/src/lib/netlist/nl_base.h b/src/lib/netlist/nl_base.h
index aed0661d8d7..ca1e121536c 100644
--- a/src/lib/netlist/nl_base.h
+++ b/src/lib/netlist/nl_base.h
@@ -98,7 +98,7 @@ class NETLIB_NAME(name) : public device_t
* device a dynamic device if parameter m_func is set.
*/
#define NETLIB_IS_DYNAMIC(expr) \
- public: virtual bool is_dynamic() const NL_NOEXCEPT override { return expr; }
+ public: virtual bool is_dynamic() const noexcept override { return expr; }
/*! Add this to a device definition to mark the device as a time-stepping device.
*
@@ -122,26 +122,26 @@ class NETLIB_NAME(name) : public device_t
*
*/
#define NETLIB_IS_TIMESTEP(expr) \
- public: virtual bool is_timestep() const NL_NOEXCEPT override { return expr; }
+ public: virtual bool is_timestep() const noexcept override { return expr; }
/*! Used to implement the time stepping code.
*
* Please see NETLIB_IS_TIMESTEP for an example.
*/
#define NETLIB_TIMESTEPI() \
- public: virtual void timestep(const nl_fptype step) NL_NOEXCEPT override
+ public: virtual void timestep(const nl_fptype step) noexcept override
#define NETLIB_FAMILY(family) , m_famsetter(*this, family)
#define NETLIB_DELEGATE(chip, name) nldelegate(&NETLIB_NAME(chip) :: name, this)
-#define NETLIB_UPDATE_TERMINALSI() virtual void update_terminals() NL_NOEXCEPT override
+#define NETLIB_UPDATE_TERMINALSI() virtual void update_terminals() noexcept override
#define NETLIB_HANDLERI(name) virtual void name() NL_NOEXCEPT
#define NETLIB_UPDATEI() virtual void update() NL_NOEXCEPT override
-#define NETLIB_UPDATE_PARAMI() virtual void update_param() NL_NOEXCEPT override
+#define NETLIB_UPDATE_PARAMI() virtual void update_param() noexcept override
#define NETLIB_RESETI() virtual void reset() override
-#define NETLIB_TIMESTEP(chip) void NETLIB_NAME(chip) :: timestep(nl_fptype step) NL_NOEXCEPT
+#define NETLIB_TIMESTEP(chip) void NETLIB_NAME(chip) :: timestep(nl_fptype step) noexcept
#define NETLIB_SUB(chip) nld_ ## chip
#define NETLIB_SUBXX(ns, chip) unique_pool_ptr< ns :: nld_ ## chip >
@@ -151,21 +151,20 @@ class NETLIB_NAME(name) : public device_t
#define NETLIB_RESET(chip) void NETLIB_NAME(chip) :: reset(void)
-#define NETLIB_UPDATE_PARAM(chip) void NETLIB_NAME(chip) :: update_param() NL_NOEXCEPT
-#define NETLIB_FUNC_VOID(chip, name, params) void NETLIB_NAME(chip) :: name params NL_NOEXCEPT
+#define NETLIB_UPDATE_PARAM(chip) void NETLIB_NAME(chip) :: update_param() noexcept
-#define NETLIB_UPDATE_TERMINALS(chip) void NETLIB_NAME(chip) :: update_terminals() NL_NOEXCEPT
+#define NETLIB_UPDATE_TERMINALS(chip) void NETLIB_NAME(chip) :: update_terminals() noexcept
//============================================================
// Asserts
//============================================================
-#if defined(MAME_DEBUG)
+#if defined(MAME_DEBUG) || (NL_DEBUG == true)
#define nl_assert(x) do { if (1) if (!(x)) throw nl_exception(plib::pfmt("assert: {1}:{2}: {3}")(__FILE__)(__LINE__)(#x) ); } while (0)
#define NL_NOEXCEPT
#else
#define nl_assert(x) do { if (0) if (!(x)) { /*throw nl_exception(plib::pfmt("assert: {1}:{2}: {3}")(__FILE__)(__LINE__)(#x) ); */} } while (0)
-#define NL_NOEXCEPT noexcept
+#define NL_NOEXCEPT noexcept
#endif
#define nl_assert_always(x, msg) do { if (!(x)) throw nl_exception("Fatal error: {1}\nCaused by assert: {2}:{3}: {4}", msg, __FILE__, __LINE__, #x); } while (0)
@@ -514,11 +513,11 @@ namespace netlist
/*! The netlist owning the owner of this object.
* \returns reference to netlist object.
*/
- netlist_state_t &state() NL_NOEXCEPT;
- const netlist_state_t &state() const NL_NOEXCEPT;
+ netlist_state_t &state() noexcept;
+ const netlist_state_t &state() const noexcept;
- netlist_t &exec() NL_NOEXCEPT;
- const netlist_t &exec() const NL_NOEXCEPT;
+ netlist_t &exec() noexcept;
+ const netlist_t &exec() const noexcept;
private:
core_device_t & m_device;
@@ -576,12 +575,12 @@ namespace netlist
const net_t & net() const noexcept { return *m_net;}
net_t & net() noexcept { return *m_net;}
- bool is_logic() const NL_NOEXCEPT;
- bool is_logic_input() const NL_NOEXCEPT;
- bool is_logic_output() const NL_NOEXCEPT;
- bool is_analog() const NL_NOEXCEPT;
- bool is_analog_input() const NL_NOEXCEPT;
- bool is_analog_output() const NL_NOEXCEPT;
+ bool is_logic() const noexcept;
+ bool is_logic_input() const noexcept;
+ bool is_logic_output() const noexcept;
+ bool is_analog() const noexcept;
+ bool is_analog_input() const noexcept;
+ bool is_analog_output() const noexcept;
bool is_state(state_e astate) const noexcept { return (m_state == astate); }
state_e terminal_state() const noexcept { return m_state; }
@@ -633,13 +632,13 @@ namespace netlist
void toggle_new_Q() noexcept { m_new_Q = (m_cur_Q ^ 1); }
- void toggle_and_push_to_queue(netlist_time delay) NL_NOEXCEPT
+ void toggle_and_push_to_queue(netlist_time delay) noexcept
{
toggle_new_Q();
push_to_queue(delay);
}
- void push_to_queue(netlist_time delay) NL_NOEXCEPT;
+ void push_to_queue(netlist_time delay) noexcept;
bool is_queued() const noexcept { return m_in_queue == queue_status::QUEUED; }
template <bool KEEP_STATS>
@@ -653,16 +652,16 @@ namespace netlist
std::size_t num_cons() const noexcept { return m_core_terms.size(); }
- void add_to_active_list(core_terminal_t &term) NL_NOEXCEPT;
- void remove_from_active_list(core_terminal_t &term) NL_NOEXCEPT;
+ void add_to_active_list(core_terminal_t &term) noexcept;
+ void remove_from_active_list(core_terminal_t &term) noexcept;
/* setup stuff */
void add_terminal(core_terminal_t &terminal) NL_NOEXCEPT;
void remove_terminal(core_terminal_t &terminal) NL_NOEXCEPT;
- bool is_logic() const NL_NOEXCEPT;
- bool is_analog() const NL_NOEXCEPT;
+ bool is_logic() const noexcept;
+ bool is_analog() const noexcept;
void rebuild_list(); /* rebuild m_list after a load */
void move_connections(net_t &dest_net);
@@ -694,7 +693,7 @@ namespace netlist
}
/* only used for logic nets */
- void set_Q_and_push(netlist_sig_t newQ, netlist_time delay) NL_NOEXCEPT
+ void set_Q_and_push(netlist_sig_t newQ, netlist_time delay) noexcept
{
if (newQ != m_new_Q)
{
@@ -704,7 +703,7 @@ namespace netlist
}
/* only used for logic nets */
- void set_Q_time(netlist_sig_t newQ, netlist_time at) NL_NOEXCEPT
+ void set_Q_time(netlist_sig_t newQ, netlist_time at) noexcept
{
if (newQ != m_new_Q)
{
@@ -747,8 +746,8 @@ namespace netlist
analog_t(core_device_t &dev, const pstring &aname, const state_e state,
nldelegate delegate = nldelegate());
- const analog_net_t & net() const NL_NOEXCEPT;
- analog_net_t & net() NL_NOEXCEPT;
+ const analog_net_t & net() const noexcept;
+ analog_net_t & net() noexcept;
};
// -----------------------------------------------------------------------------
@@ -761,7 +760,7 @@ namespace netlist
terminal_t(core_device_t &dev, const pstring &aname, terminal_t *otherterm);
- nl_fptype operator ()() const NL_NOEXCEPT;
+ nl_fptype operator ()() const noexcept;
void set_conductivity(const nl_fptype G) noexcept
{
@@ -814,8 +813,8 @@ namespace netlist
devices::nld_base_proxy *get_proxy() const noexcept { return m_proxy; }
void set_proxy(devices::nld_base_proxy *proxy) noexcept { m_proxy = proxy; }
- logic_net_t & net() NL_NOEXCEPT;
- const logic_net_t & net() const NL_NOEXCEPT;
+ logic_net_t & net() noexcept;
+ const logic_net_t & net() const noexcept;
protected:
@@ -833,15 +832,15 @@ namespace netlist
logic_input_t(core_device_t &dev, const pstring &aname,
nldelegate delegate = nldelegate());
- netlist_sig_t operator()() const NL_NOEXCEPT
+ netlist_sig_t operator()() const noexcept
{
return Q();
}
- void inactivate() NL_NOEXCEPT;
- void activate() NL_NOEXCEPT;
- void activate_hl() NL_NOEXCEPT;
- void activate_lh() NL_NOEXCEPT;
+ void inactivate() noexcept;
+ void activate() noexcept;
+ void activate_hl() noexcept;
+ void activate_lh() noexcept;
private:
netlist_sig_t Q() const NL_NOEXCEPT;
};
@@ -867,12 +866,12 @@ namespace netlist
/*! returns voltage at terminal.
* \returns voltage at terminal.
*/
- nl_fptype operator()() const NL_NOEXCEPT { return Q_Analog(); }
+ nl_fptype operator()() const noexcept { return Q_Analog(); }
/*! returns voltage at terminal.
* \returns voltage at terminal.
*/
- nl_fptype Q_Analog() const NL_NOEXCEPT;
+ nl_fptype Q_Analog() const noexcept;
};
@@ -903,7 +902,7 @@ namespace netlist
nl_fptype Q_Analog() const noexcept { return m_cur_Analog; }
void set_Q_Analog(const nl_fptype v) noexcept { m_cur_Analog = v; }
- nl_fptype *Q_Analog_state_ptr() NL_NOEXCEPT { return m_cur_Analog.ptr(); }
+ nl_fptype *Q_Analog_state_ptr() noexcept { return m_cur_Analog.ptr(); }
//FIXME: needed by current solver code
solver::matrix_solver_t *solver() const noexcept { return m_solver; }
@@ -926,12 +925,12 @@ namespace netlist
void initial(netlist_sig_t val);
- void push(netlist_sig_t newQ, netlist_time delay) NL_NOEXCEPT
+ void push(netlist_sig_t newQ, netlist_time delay) noexcept
{
m_my_net.set_Q_and_push(newQ, delay); // take the shortcut
}
- void set_Q_time(netlist_sig_t newQ, netlist_time at) NL_NOEXCEPT
+ void set_Q_time(netlist_sig_t newQ, netlist_time at) noexcept
{
m_my_net.set_Q_time(newQ, at); // take the shortcut
}
@@ -945,11 +944,11 @@ namespace netlist
public:
analog_output_t(core_device_t &dev, const pstring &aname);
- void push(const nl_fptype val) NL_NOEXCEPT { set_Q(val); }
+ void push(const nl_fptype val) noexcept { set_Q(val); }
void initial(const nl_fptype val);
private:
- void set_Q(const nl_fptype newQ) NL_NOEXCEPT;
+ void set_Q(const nl_fptype newQ) noexcept;
analog_net_t m_my_net;
};
@@ -978,7 +977,7 @@ namespace netlist
protected:
virtual ~param_t() noexcept = default; /* not intended to be destroyed */
- void update_param() NL_NOEXCEPT;
+ void update_param() noexcept;
pstring get_initial(const device_t &dev, bool *found);
@@ -1004,8 +1003,8 @@ namespace netlist
public:
param_num_t(device_t &device, const pstring &name, const T val);
- T operator()() const NL_NOEXCEPT { return m_param; }
- operator T() const NL_NOEXCEPT { return m_param; }
+ T operator()() const noexcept { return m_param; }
+ operator T() const noexcept { return m_param; }
void setTo(const T &param) noexcept { set(m_param, param); }
private:
@@ -1018,8 +1017,8 @@ namespace netlist
public:
param_enum_t(device_t &device, const pstring &name, const T val);
- T operator()() const NL_NOEXCEPT { return T(m_param); }
- operator T() const NL_NOEXCEPT { return T(m_param); }
+ T operator()() const noexcept { return T(m_param); }
+ operator T() const noexcept { return T(m_param); }
void setTo(const T &param) noexcept { set(m_param, static_cast<int>(param)); }
private:
int m_param;
@@ -1038,7 +1037,7 @@ namespace netlist
{
public:
param_ptr_t(device_t &device, const pstring &name, std::uint8_t* val);
- std::uint8_t * operator()() const NL_NOEXCEPT { return m_param; }
+ std::uint8_t * operator()() const noexcept { return m_param; }
void setTo(std::uint8_t *param) noexcept { set(m_param, param); }
private:
std::uint8_t* m_param;
@@ -1053,8 +1052,8 @@ namespace netlist
public:
param_str_t(device_t &device, const pstring &name, const pstring &val);
- const pstring &operator()() const NL_NOEXCEPT { return str(); }
- void setTo(const pstring &param) NL_NOEXCEPT
+ const pstring &operator()() const noexcept { return str(); }
+ void setTo(const pstring &param) noexcept
{
if (m_param != param)
{
@@ -1065,7 +1064,7 @@ namespace netlist
}
protected:
virtual void changed();
- const pstring &str() const NL_NOEXCEPT { return m_param; }
+ const pstring &str() const noexcept { return m_param; }
private:
PALIGNAS_CACHELINE()
pstring m_param;
@@ -1139,7 +1138,7 @@ namespace netlist
param_rom_t(device_t &device, const pstring &name);
- ST operator[] (std::size_t n) const NL_NOEXCEPT { return m_data[n]; }
+ ST operator[] (std::size_t n) const noexcept { return m_data[n]; }
protected:
void changed() override
{
@@ -1167,7 +1166,7 @@ namespace netlist
virtual ~core_device_t() noexcept = default;
- void do_inc_active() NL_NOEXCEPT
+ void do_inc_active() noexcept
{
if (m_hint_deactivate)
{
@@ -1180,7 +1179,7 @@ namespace netlist
}
}
- void do_dec_active() NL_NOEXCEPT
+ void do_dec_active() noexcept
{
if (m_hint_deactivate)
if (--m_active_outputs == 0)
@@ -1212,18 +1211,18 @@ namespace netlist
protected:
- virtual void inc_active() NL_NOEXCEPT { }
- virtual void dec_active() NL_NOEXCEPT { }
+ virtual void inc_active() noexcept { }
+ virtual void dec_active() noexcept { }
log_type & log();
public:
- virtual void timestep(const nl_fptype st) NL_NOEXCEPT { plib::unused_var(st); }
- virtual void update_terminals() NL_NOEXCEPT { }
+ virtual void timestep(const nl_fptype st) noexcept { plib::unused_var(st); }
+ virtual void update_terminals() noexcept { }
- virtual void update_param() NL_NOEXCEPT {}
- virtual bool is_dynamic() const NL_NOEXCEPT { return false; }
- virtual bool is_timestep() const NL_NOEXCEPT { return false; }
+ virtual void update_param() noexcept {}
+ virtual bool is_dynamic() const noexcept { return false; }
+ virtual bool is_timestep() const noexcept { return false; }
private:
bool m_hint_deactivate;
@@ -1550,10 +1549,10 @@ namespace netlist
/* run functions */
- netlist_time time() const NL_NOEXCEPT { return m_time; }
+ netlist_time time() const noexcept { return m_time; }
- void process_queue(netlist_time delta) NL_NOEXCEPT;
- void abort_current_queue_slice() NL_NOEXCEPT
+ void process_queue(netlist_time delta) noexcept;
+ void abort_current_queue_slice() noexcept
{
if (!NL_USE_QUEUE_STATS || !m_use_stats)
m_queue.retime<false>(detail::queue_t::entry_t(m_time, nullptr));
@@ -1561,7 +1560,7 @@ namespace netlist
m_queue.retime<true>(detail::queue_t::entry_t(m_time, nullptr));
}
- const detail::queue_t &queue() const NL_NOEXCEPT { return m_queue; }
+ const detail::queue_t &queue() const noexcept { return m_queue; }
template <typename E>
void qpush(E && e) noexcept
@@ -1595,7 +1594,7 @@ namespace netlist
/* force late type resolution */
template <typename X = devices::NETLIB_NAME(solver)>
- nl_fptype gmin(X *solv = nullptr) const NL_NOEXCEPT
+ nl_fptype gmin(X *solv = nullptr) const noexcept
{
plib::unused_var(solv);
return static_cast<X *>(m_solver)->gmin();
@@ -1604,10 +1603,10 @@ namespace netlist
netlist_state_t &nlstate() noexcept { return *m_state; }
const netlist_state_t &nlstate() const noexcept { return *m_state; }
- log_type & log() NL_NOEXCEPT { return m_state->log(); }
- const log_type &log() const NL_NOEXCEPT { return m_state->log(); }
+ log_type & log() noexcept { return m_state->log(); }
+ const log_type &log() const noexcept { return m_state->log(); }
- void print_stats() const NL_NOEXCEPT;
+ void print_stats() const;
bool stats_enabled() const noexcept { return m_use_stats; }
void enable_stats(bool val) noexcept { m_use_stats = val; }
@@ -1615,7 +1614,7 @@ namespace netlist
private:
template <bool KEEP_STATS, typename MCT>
- void process_queue_stats(netlist_time delta, MCT *mainclock) NL_NOEXCEPT;
+ void process_queue_stats(netlist_time delta, MCT *mainclock) noexcept;
plib::unique_ptr<netlist_state_t> m_state;
devices::NETLIB_NAME(solver) * m_solver;
@@ -1718,7 +1717,7 @@ namespace netlist
device.state().log().warning(MW_ROM_NOT_FOUND(str()));
}
- inline void logic_input_t::inactivate() NL_NOEXCEPT
+ inline void logic_input_t::inactivate() noexcept
{
if (!is_state(STATE_INP_PASSIVE))
{
@@ -1727,7 +1726,7 @@ namespace netlist
}
}
- inline void logic_input_t::activate() NL_NOEXCEPT
+ inline void logic_input_t::activate() noexcept
{
if (is_state(STATE_INP_PASSIVE))
{
@@ -1736,7 +1735,7 @@ namespace netlist
}
}
- inline void logic_input_t::activate_hl() NL_NOEXCEPT
+ inline void logic_input_t::activate_hl() noexcept
{
if (is_state(STATE_INP_PASSIVE))
{
@@ -1745,7 +1744,7 @@ namespace netlist
}
}
- inline void logic_input_t::activate_lh() NL_NOEXCEPT
+ inline void logic_input_t::activate_lh() noexcept
{
if (is_state(STATE_INP_PASSIVE))
{
@@ -1754,7 +1753,7 @@ namespace netlist
}
}
- inline void detail::net_t::push_to_queue(netlist_time delay) NL_NOEXCEPT
+ inline void detail::net_t::push_to_queue(netlist_time delay) noexcept
{
if ((num_cons() != 0))
{
@@ -1776,7 +1775,7 @@ namespace netlist
}
}
- inline void detail::net_t::add_to_active_list(core_terminal_t &term) NL_NOEXCEPT
+ inline void detail::net_t::add_to_active_list(core_terminal_t &term) noexcept
{
if (m_list_active.empty())
{
@@ -1806,24 +1805,24 @@ namespace netlist
}
}
- inline void detail::net_t::remove_from_active_list(core_terminal_t &term) NL_NOEXCEPT
+ inline void detail::net_t::remove_from_active_list(core_terminal_t &term) noexcept
{
m_list_active.remove(&term);
if (m_list_active.empty())
railterminal().device().do_dec_active();
}
- inline const analog_net_t & analog_t::net() const NL_NOEXCEPT
+ inline const analog_net_t & analog_t::net() const noexcept
{
return static_cast<const analog_net_t &>(core_terminal_t::net());
}
- inline analog_net_t & analog_t::net() NL_NOEXCEPT
+ inline analog_net_t & analog_t::net() noexcept
{
return static_cast<analog_net_t &>(core_terminal_t::net());
}
- inline nl_fptype terminal_t::operator ()() const NL_NOEXCEPT { return net().Q_Analog(); }
+ inline nl_fptype terminal_t::operator ()() const noexcept { return net().Q_Analog(); }
inline void terminal_t::set_ptrs(nl_fptype *gt, nl_fptype *go, nl_fptype *Idr) noexcept
{
@@ -1837,12 +1836,12 @@ namespace netlist
}
}
- inline logic_net_t & logic_t::net() NL_NOEXCEPT
+ inline logic_net_t & logic_t::net() noexcept
{
return static_cast<logic_net_t &>(core_terminal_t::net());
}
- inline const logic_net_t & logic_t::net() const NL_NOEXCEPT
+ inline const logic_net_t & logic_t::net() const noexcept
{
return static_cast<const logic_net_t &>(core_terminal_t::net());
}
@@ -1859,12 +1858,12 @@ namespace netlist
#endif
}
- inline nl_fptype analog_input_t::Q_Analog() const NL_NOEXCEPT
+ inline nl_fptype analog_input_t::Q_Analog() const noexcept
{
return net().Q_Analog();
}
- inline void analog_output_t::set_Q(const nl_fptype newQ) NL_NOEXCEPT
+ inline void analog_output_t::set_Q(const nl_fptype newQ) noexcept
{
if (newQ != m_my_net.Q_Analog())
{
@@ -1873,22 +1872,22 @@ namespace netlist
}
}
- inline netlist_state_t &detail::device_object_t::state() NL_NOEXCEPT
+ inline netlist_state_t &detail::device_object_t::state() noexcept
{
return m_device.state();
}
- inline const netlist_state_t &detail::device_object_t::state() const NL_NOEXCEPT
+ inline const netlist_state_t &detail::device_object_t::state() const noexcept
{
return m_device.state();
}
- inline netlist_t &detail::device_object_t::exec() NL_NOEXCEPT
+ inline netlist_t &detail::device_object_t::exec() noexcept
{
return m_device.exec();
}
- inline const netlist_t &detail::device_object_t::exec() const NL_NOEXCEPT
+ inline const netlist_t &detail::device_object_t::exec() const noexcept
{
return m_device.exec();
}
@@ -1968,7 +1967,7 @@ namespace netlist
}
template <bool KEEP_STATS, typename MCT>
- inline void netlist_t::process_queue_stats(const netlist_time delta, MCT *mainclock) NL_NOEXCEPT
+ inline void netlist_t::process_queue_stats(const netlist_time delta, MCT *mainclock) noexcept
{
netlist_time stop(m_time + delta);
diff --git a/src/lib/netlist/nl_config.h b/src/lib/netlist/nl_config.h
index 58479eae3ef..80f74cb1582 100644
--- a/src/lib/netlist/nl_config.h
+++ b/src/lib/netlist/nl_config.h
@@ -108,6 +108,7 @@ using nl_fptype = double;
//using nl_fptype = float;
using nl_mat_fptype = nl_fptype;
+//using nl_mat_fptype = float;
namespace netlist
{
@@ -124,7 +125,7 @@ namespace netlist
template <>
struct fp_constants<double>
{
- static inline constexpr const double DIODE_MAXDIFF() noexcept { return 1e100; }
+ static inline constexpr double DIODE_MAXDIFF() noexcept { return 1e100; }
static inline constexpr double DIODE_MAXVOLT() noexcept { return 300.0; }
static inline constexpr double TIMESTEP_MAXDIFF() noexcept { return 1e100; }
diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp
index b35445e78d5..a9ff47959fa 100644
--- a/src/lib/netlist/nl_setup.cpp
+++ b/src/lib/netlist/nl_setup.cpp
@@ -96,7 +96,7 @@ namespace netlist
}
log().fatal(MF_NOT_FOUND_IN_SOURCE_COLLECTION(netlist_name));
#endif
- if (m_sources.for_all<source_netlist_t>([this, &netlist_name] (auto &src)
+ if (m_sources.for_all<source_netlist_t>([this, &netlist_name] (source_netlist_t *src)
{
return src->parse(*this, netlist_name);
}))
diff --git a/src/lib/netlist/plib/parray.h b/src/lib/netlist/plib/parray.h
index a1e3c2c504a..6570c8e592f 100644
--- a/src/lib/netlist/plib/parray.h
+++ b/src/lib/netlist/plib/parray.h
@@ -70,6 +70,32 @@ namespace plib {
{
}
+ template <int X = SIZE >
+ parray(size_type size, FT val, typename std::enable_if<(X==0), int>::type = 0)
+ : m_a(size, val), m_size(size)
+ {
+ }
+
+ template <int X = SIZE >
+ parray(size_type size, typename std::enable_if<(X != 0), int>::type = 0)
+ : m_size(size)
+ {
+ if ((SIZE < 0 && size > SIZEABS())
+ || (SIZE > 0 && size != SIZEABS()))
+ throw plib::pexception("parray: size error " + plib::to_string(size) + ">" + plib::to_string(SIZE));
+ }
+
+ template <int X = SIZE >
+ parray(size_type size, FT val, typename std::enable_if<(X != 0), int>::type = 0)
+ : m_size(size)
+ {
+ if ((SIZE < 0 && size > SIZEABS())
+ || (SIZE > 0 && size != SIZEABS()))
+ throw plib::pexception("parray: size error " + plib::to_string(size) + ">" + plib::to_string(SIZE));
+ m_a.fill(val);
+ }
+
+
/* allow construction in fixed size arrays */
parray()
: m_size(SIZEABS())
@@ -96,15 +122,6 @@ namespace plib {
~parray() noexcept = default;
- template <int X = SIZE >
- parray(size_type size, typename std::enable_if<(X != 0), int>::type = 0)
- : m_size(size)
- {
- if ((SIZE < 0 && size > SIZEABS())
- || (SIZE > 0 && size != SIZEABS()))
- throw plib::pexception("parray: size error " + plib::to_string(size) + ">" + plib::to_string(SIZE));
- }
-
base_type &as_base() noexcept { return m_a; }
inline size_type size() const noexcept { return SIZE <= 0 ? m_size : SIZEABS(); }
diff --git a/src/lib/netlist/solver/nld_matrix_solver.h b/src/lib/netlist/solver/nld_matrix_solver.h
index 3a14c896d70..632d038594f 100644
--- a/src/lib/netlist/solver/nld_matrix_solver.h
+++ b/src/lib/netlist/solver/nld_matrix_solver.h
@@ -403,18 +403,16 @@ namespace solver
static constexpr const std::size_t SIZEABS = plib::parray<FT, SIZE>::SIZEABS();
static constexpr const std::size_t m_pitch_ABS = (((SIZEABS + 0) + 7) / 8) * 8;
+ PALIGNAS_VECTOROPT()
plib::parray2D<float_type *, SIZE, 0> m_mat_ptr;
/* state - variable time_stepping */
+ PALIGNAS_VECTOROPT()
plib::parray<float_type, SIZE> m_last_V;
+ PALIGNAS_VECTOROPT()
plib::parray<float_type, SIZE> m_DD_n_m_1;
+ PALIGNAS_VECTOROPT()
plib::parray<float_type, SIZE> m_h_n_m_1;
- // FIXME: it should be like this, however dimensions are determined
- // in vsetup.
- //state_container<std::vector<nl_fptype>> m_last_V;
- //state_container<std::vector<nl_fptype>> m_DD_n_m_1;
- //state_container<std::vector<nl_fptype>> m_h_n_m_1;
-
constexpr std::size_t size() const noexcept { return (SIZE > 0) ? static_cast<std::size_t>(SIZE) : m_dim; }
netlist_time compute_next_timestep(const nl_fptype cur_ts) override