summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author couriersud <couriersud@gmx.org>2019-11-11 15:04:21 +0100
committer couriersud <couriersud@gmx.org>2019-11-11 15:04:21 +0100
commit63561e2c2c64d1fc3376fcd7d54051068e39b5f7 (patch)
tree2f98d2a0b93dbc4b854efed4c01eb2e4b04672fa /src
parent82e9ccb3a9ea067615c24d3fe1979a3676bb6746 (diff)
netlist: maintenance. (nw)
- Fix automatic header generation - clang lint fixes. - srcclean - remove dead code
Diffstat (limited to 'src')
-rw-r--r--src/lib/netlist/analog/nld_mosfet.cpp2
-rw-r--r--src/lib/netlist/build/makefile4
-rw-r--r--src/lib/netlist/devices/net_lib.h2
-rw-r--r--src/lib/netlist/devices/nld_7448.cpp7
-rw-r--r--src/lib/netlist/devices/nld_7490.cpp2
-rw-r--r--src/lib/netlist/devices/nld_74ls629.h12
-rw-r--r--src/lib/netlist/devices/nld_system.h6
-rw-r--r--src/lib/netlist/devices/nld_tms4800.cpp2
-rw-r--r--src/lib/netlist/devices/nlid_system.h39
-rw-r--r--src/lib/netlist/devices/nlid_truthtable.cpp2
-rw-r--r--src/lib/netlist/documentation/mainpage.dox.h122
-rw-r--r--src/lib/netlist/nl_base.cpp11
-rw-r--r--src/lib/netlist/nl_base.h8
-rw-r--r--src/lib/netlist/nl_errstr.h4
-rw-r--r--src/lib/netlist/nl_parser.cpp94
-rw-r--r--src/lib/netlist/nl_setup.cpp11
-rw-r--r--src/lib/netlist/nl_setup.h10
-rw-r--r--src/lib/netlist/plib/mat_cr.h7
-rw-r--r--src/lib/netlist/plib/palloc.h9
-rw-r--r--src/lib/netlist/plib/pfmtlog.cpp4
-rw-r--r--src/lib/netlist/plib/pfunction.cpp2
-rw-r--r--src/lib/netlist/plib/plists.h12
-rw-r--r--src/lib/netlist/plib/ppreprocessor.h4
-rw-r--r--src/lib/netlist/plib/putil.h29
-rw-r--r--src/lib/netlist/prg/nltool.cpp4
-rw-r--r--src/lib/netlist/solver/nld_matrix_solver.h8
-rw-r--r--src/lib/netlist/solver/nld_solver.cpp4
-rw-r--r--src/lib/netlist/solver/nld_solver.h2
28 files changed, 129 insertions, 294 deletions
diff --git a/src/lib/netlist/analog/nld_mosfet.cpp b/src/lib/netlist/analog/nld_mosfet.cpp
index 340b2f7dd15..c698484e5bd 100644
--- a/src/lib/netlist/analog/nld_mosfet.cpp
+++ b/src/lib/netlist/analog/nld_mosfet.cpp
@@ -273,7 +273,7 @@ namespace analog
if (Cox > nlconst::zero() && m_model.m_NSUB > nlconst::zero())
m_gamma = plib::sqrt (nlconst::two()
* constants::Q_e() * constants::eps_Si() * constants::eps_0()
- * m_model.m_NSUB * nlconst::magic(1e6)) / Cox;
+ * m_model.m_NSUB * nlconst::magic(1e6)) / Cox;
else
m_gamma = nlconst::zero();
}
diff --git a/src/lib/netlist/build/makefile b/src/lib/netlist/build/makefile
index af02b100c86..5fd059b91f7 100644
--- a/src/lib/netlist/build/makefile
+++ b/src/lib/netlist/build/makefile
@@ -235,10 +235,10 @@ native:
$(MAKE) CEXTRAFLAGS="-march=native -msse4.2 -Wall -Wpedantic -Wsign-compare -Wextra "
gcc9:
- $(MAKE) CC=g++-9 LD=g++-9 CEXTRAFLAGS="-march=native -msse4.2 -Wall -Wpedantic -Wsign-compare -Wextra" EXTRALIBS="-lquadmath"
+ $(MAKE) CC=g++-9 LD=g++-9 CEXTRAFLAGS="-march=native -msse4.2 -Wall -pedantic -Wpedantic -Wsign-compare -Wextra" EXTRALIBS="-lquadmath"
clang:
- $(MAKE) CC=clang++-10 LD=clang++-10 CEXTRAFLAGS="-march=native -msse4.2 -Weverything -Werror -Wno-padded -Wno-weak-vtables -Wno-unused-template -Wno-missing-variable-declarations -Wno-float-equal -Wconversion -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-format-nonliteral -Wno-exit-time-destructors"
+ $(MAKE) CC=clang++-10 LD=clang++-10 CEXTRAFLAGS="-march=native -msse4.2 -Weverything -Wall -pedantic -Wpedantic -Werror -Wno-padded -Wno-weak-vtables -Wno-unused-template -Wno-missing-variable-declarations -Wno-float-equal -Wconversion -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-format-nonliteral -Wno-exit-time-destructors"
clang-5:
$(MAKE) CC=clang++-5.0 LD=clang++-5.0 CEXTRAFLAGS="-march=native -Weverything -Werror -Wno-inconsistent-missing-destructor-override -Wno-unreachable-code -Wno-padded -Wno-weak-vtables -Wno-missing-variable-declarations -Wconversion -Wno-c++98-compat -Wno-float-equal -Wno-global-constructors -Wno-c++98-compat-pedantic -Wno-format-nonliteral -Wno-weak-template-vtables -Wno-exit-time-destructors"
diff --git a/src/lib/netlist/devices/net_lib.h b/src/lib/netlist/devices/net_lib.h
index 4cd621cd019..159d1a24c36 100644
--- a/src/lib/netlist/devices/net_lib.h
+++ b/src/lib/netlist/devices/net_lib.h
@@ -34,9 +34,9 @@
#endif
#include "netlist/macro/nlm_cd4xxx.h"
-#include "netlist/macro/nlm_ttl74xx.h"
#include "netlist/macro/nlm_opamp.h"
#include "netlist/macro/nlm_other.h"
+#include "netlist/macro/nlm_ttl74xx.h"
#include "nld_7448.h"
diff --git a/src/lib/netlist/devices/nld_7448.cpp b/src/lib/netlist/devices/nld_7448.cpp
index bd53ff1f7eb..b27995b9a8e 100644
--- a/src/lib/netlist/devices/nld_7448.cpp
+++ b/src/lib/netlist/devices/nld_7448.cpp
@@ -149,13 +149,6 @@ namespace netlist
NETLIB_RESET(7448)
{
m_state = 0;
-#if 0
- m_A.set_state(logic_t::STATE_INP_PASSIVE);
- m_B.set_state(logic_t::STATE_INP_PASSIVE);
- m_C.set_state(logic_t::STATE_INP_PASSIVE);
- m_D.set_state(logic_t::STATE_INP_PASSIVE);
- m_RBIQ.set_state(logic_t::STATE_INP_PASSIVE);
-#endif
}
NETLIB_DEVICE_IMPL(7448, "TTL_7448", "+A,+B,+C,+D,+LTQ,+BIQ,+RBIQ,@VCC,@GND")
diff --git a/src/lib/netlist/devices/nld_7490.cpp b/src/lib/netlist/devices/nld_7490.cpp
index aa58541526d..7def9243ea1 100644
--- a/src/lib/netlist/devices/nld_7490.cpp
+++ b/src/lib/netlist/devices/nld_7490.cpp
@@ -14,7 +14,7 @@ namespace netlist
namespace devices
{
- static constexpr const std::array<netlist_time, 4> delay =
+ static C14CONSTEXPR const std::array<netlist_time, 4> delay =
{
NLTIME_FROM_NS(18),
NLTIME_FROM_NS(36) - NLTIME_FROM_NS(18),
diff --git a/src/lib/netlist/devices/nld_74ls629.h b/src/lib/netlist/devices/nld_74ls629.h
index dd2b657bc9b..7a695e16a17 100644
--- a/src/lib/netlist/devices/nld_74ls629.h
+++ b/src/lib/netlist/devices/nld_74ls629.h
@@ -30,20 +30,10 @@
#include "netlist/nl_setup.h"
-#if 0
-#define SN74LS629(name, p_cap) \
- NET_REGISTER_DEV(SN74LS629, name) \
- NETDEV_PARAMI(name, CAP, p_cap)
-
-#define SN74LS629_DIP(name, p_cap1, p_cap2) \
- NET_REGISTER_DEV(SN74LS629_DIP, name) \
- NETDEV_PARAMI(name, 1.CAP, p_cap1) \
- NETDEV_PARAMI(name, 2.CAP, p_cap2)
-#else
#define SN74LS629(name, p_cap) \
NET_REGISTER_DEVEXT(SN74LS629, name, p_cap)
#define SN74LS629_DIP(name, p_cap1, p_cap2) \
NET_REGISTER_DEVEXT(SN74LS629_DIP, name, p_cap1, p_cap2)
-#endif
+
#endif /* NLD_74LS629_H_ */
diff --git a/src/lib/netlist/devices/nld_system.h b/src/lib/netlist/devices/nld_system.h
index d5e69bd10ec..af577a9d543 100644
--- a/src/lib/netlist/devices/nld_system.h
+++ b/src/lib/netlist/devices/nld_system.h
@@ -28,14 +28,8 @@
NET_REGISTER_DEV(ANALOG_INPUT, name) \
PARAM(name.IN, v)
-#if 0
-#define MAINCLOCK(name, freq) \
- NET_REGISTER_DEV(MAINCLOCK, name) \
- PARAM(name.FREQ, freq)
-#else
#define MAINCLOCK(name, freq) \
NET_REGISTER_DEVEXT(MAINCLOCK, name, freq)
-#endif
#define CLOCK(name, freq) \
NET_REGISTER_DEV(CLOCK, name) \
diff --git a/src/lib/netlist/devices/nld_tms4800.cpp b/src/lib/netlist/devices/nld_tms4800.cpp
index dbe9977f6a8..cecdf8c2384 100644
--- a/src/lib/netlist/devices/nld_tms4800.cpp
+++ b/src/lib/netlist/devices/nld_tms4800.cpp
@@ -85,7 +85,7 @@ namespace netlist
}
else
{
- unsigned d = 0x00;
+ unsigned d = 0x00;
for (std::size_t i=0; i<4; i++)
{
if (m_OE1())
diff --git a/src/lib/netlist/devices/nlid_system.h b/src/lib/netlist/devices/nlid_system.h
index fb5403ed909..6448dfff3d6 100644
--- a/src/lib/netlist/devices/nlid_system.h
+++ b/src/lib/netlist/devices/nlid_system.h
@@ -40,45 +40,6 @@ namespace devices
param_num_t<unsigned> m_max_link_loops;
};
-#if 0
- // -----------------------------------------------------------------------------
- // mainclock
- // -----------------------------------------------------------------------------
-
- NETLIB_OBJECT(mainclock)
- {
- NETLIB_CONSTRUCTOR(mainclock)
- , m_Q(*this, "Q")
- , m_freq(*this, "FREQ", nlconst::magic(7159000.0 * 5))
- {
- m_inc = netlist_time::from_fp(plib::reciprocal(m_freq()*nlconst::two()));
- }
-
- NETLIB_RESETI()
- {
- m_Q.net().set_next_scheduled_time(netlist_time::zero());
- }
-
- NETLIB_UPDATE_PARAMI()
- {
- m_inc = netlist_time::from_fp(plib::reciprocal(m_freq()*nlconst::two()));
- }
-
- NETLIB_UPDATEI()
- {
- logic_net_t &net = m_Q.net();
- // this is only called during setup ...
- net.toggle_new_Q();
- net.set_next_scheduled_time(exec().time() + m_inc);
- }
-
- public:
- logic_output_t m_Q;
- netlist_time m_inc;
- private:
- param_fp_t m_freq;
- };
-#endif
// -----------------------------------------------------------------------------
// clock
// -----------------------------------------------------------------------------
diff --git a/src/lib/netlist/devices/nlid_truthtable.cpp b/src/lib/netlist/devices/nlid_truthtable.cpp
index 1eda00ed546..951465b0515 100644
--- a/src/lib/netlist/devices/nlid_truthtable.cpp
+++ b/src/lib/netlist/devices/nlid_truthtable.cpp
@@ -7,8 +7,8 @@
#include "plib/plists.h"
#include <bitset>
-#include <vector>
#include <cstdint>
+#include <vector>
namespace netlist
{
diff --git a/src/lib/netlist/documentation/mainpage.dox.h b/src/lib/netlist/documentation/mainpage.dox.h
index 053271f64ae..686a77913e9 100644
--- a/src/lib/netlist/documentation/mainpage.dox.h
+++ b/src/lib/netlist/documentation/mainpage.dox.h
@@ -17,15 +17,15 @@
The following example shows a typical connection between several devices:
- +---+ +---+ +---+ +---+ +---+
- | | | | | | | | | |
- | D | | D | | D | | D | | D |
- | | | | | | | | | |
- +-O-+ +-I-+ +-I-+ +-T-+ +-T-+
- | | | | |
- +-+---------+---------+---------+---------+-+
- | rail net |
- +-------------------------------------------+
+ +---+ +---+ +---+ +---+ +---+
+ | | | | | | | | | |
+ | D | | D | | D | | D | | D |
+ | | | | | | | | | |
+ +-O-+ +-I-+ +-I-+ +-T-+ +-T-+
+ | | | | |
+ +-+---------+---------+---------+---------+-+
+ | rail net |
+ +-------------------------------------------+
A rail net is a net which is driven by exactly one output with an
(idealized) internal resistance of zero.
@@ -39,29 +39,29 @@ The system differentiates between analog and logic input and outputs and
analog terminals. Analog and logic devices can not be connected to the
same net. Instead, proxy devices are inserted automatically:
- +---+ +---+
- | | | |
- | D1| | D2|
- | A | | L |
- +-O-+ +-I-+
- | |
- +-+---------+---+
- | rail net |
- +---------------+
+ +---+ +---+
+ | | | |
+ | D1| | D2|
+ | A | | L |
+ +-O-+ +-I-+
+ | |
+ +-+---------+---+
+ | rail net |
+ +---------------+
is converted into
- +----------+
- | |
- +---+ +-+-+ | +---+
- | | | L | A-L | | |
- | D1| | D | Proxy | | D2|
- | A | | A | | | |
- +-O-+ +-I-+ | +-I-+
- | | | |
- +-+---------+--+ +-+-----+-------+
- | rail net (A) | | rail net (L) |
- +--------------| +---------------+
+ +----------+
+ | |
+ +---+ +-+-+ | +---+
+ | | | L | A-L | | |
+ | D1| | D | Proxy | | D2|
+ | A | | A | | | |
+ +-O-+ +-I-+ | +-I-+
+ | | | |
+ +-+---------+--+ +-+-----+-------+
+ | rail net (A) | | rail net (L) |
+ +--------------| +---------------+
This works both analog to logic as well as logic to analog.
@@ -74,61 +74,61 @@ and transistors again.
Instead, the following approach in case of a pure terminal/input network
is taken:
- +---+ +---+ +---+ +---+ +---+
- | | | | | | | | | |
- | D | | D | | D | | D | | D |
- | | | | | | | | | |
- +-T-+ +-I-+ +-I-+ +-T-+ +-T-+
- | | | | |
- '+' | | '-' '-'
- +-+---------+---------+---------+---------+-+
- | Calculated net |
- +-------------------------------------------+
+ +---+ +---+ +---+ +---+ +---+
+ | | | | | | | | | |
+ | D | | D | | D | | D | | D |
+ | | | | | | | | | |
+ +-T-+ +-I-+ +-I-+ +-T-+ +-T-+
+ | | | | |
+ '+' | | '-' '-'
+ +-+---------+---------+---------+---------+-+
+ | Calculated net |
+ +-------------------------------------------+
Netlist uses the following basic two terminal device:
- (k)
- +-----T-----+
- | | |
- | +--+--+ |
- | | | |
- | R | |
- | R | |
- | R I |
- | | I | Device n
- | V+ I |
- | V | |
- | V- | |
- | | | |
- | +--+--+ |
- | | |
- +-----T-----+
- (l)
+ (k)
+ +-----T-----+
+ | | |
+ | +--+--+ |
+ | | | |
+ | R | |
+ | R | |
+ | R I |
+ | | I | Device n
+ | V+ I |
+ | V | |
+ | V- | |
+ | | | |
+ | +--+--+ |
+ | | |
+ +-----T-----+
+ (l)
This is a resistance in series to a voltage source and paralleled by a
current source. This is suitable to model voltage sources, current sources,
resistors, capacitors, inductances and diodes.
\f[
- I_{n,l} = - I_{n,k} = ( V_k - V^N - V_l ) \frac{1}{R^n} + I^n
+ I_{n,l} = - I_{n,k} = ( V_k - V^N - V_l ) \frac{1}{R^n} + I^n
\f]
Now, the sum of all currents for a given net must be 0:
\f[
- \sum_n I_{n,l} = 0 = \sum_{n,k} (V_k - V^n - V_l ) \frac{1}{R^n} + I^n
+ \sum_n I_{n,l} = 0 = \sum_{n,k} (V_k - V^n - V_l ) \frac{1}{R^n} + I^n
\f]
With \f$ G^n = \frac{1}{R^n} \f$ and \f$ \sum_n G^n = G^{tot} \f$ and \f$k=k(n)\f$
\f[
- 0 = - V_l G^{tot} + \sum_n (V_{k(n)} - V^n) G^n + I^n)
+ 0 = - V_l G^{tot} + \sum_n (V_{k(n)} - V^n) G^n + I^n)
\f]
and with \f$ l=l(n)\f$ and fixed \f$ k\f$
\f[
- 0 = -V_k G^{tot} + sum_n( V_{l(n)} + V^n ) G^n - I^n)
+ 0 = -V_k G^{tot} + sum_n( V_{l(n)} + V^n ) G^n - I^n)
\f]
These equations represent a linear Matrix equation (with more math).
@@ -136,7 +136,7 @@ These equations represent a linear Matrix equation (with more math).
In the end the solution of the analog subsystem boils down to
\f[
- \mathbf{\it{(G - D) v = i}}
+ \mathbf{\it{(G - D) v = i}}
\f]
with G being the conductance matrix, D a diagonal matrix with the total
diff --git a/src/lib/netlist/nl_base.cpp b/src/lib/netlist/nl_base.cpp
index 1eddb063f20..80c3be33e66 100644
--- a/src/lib/netlist/nl_base.cpp
+++ b/src/lib/netlist/nl_base.cpp
@@ -562,17 +562,6 @@ namespace netlist
: core_device_t(owner, name)
{
}
-#if 0
- setup_t &device_t::setup() noexcept
- {
- return state().setup();
- }
-
- const setup_t &device_t::setup() const noexcept
- {
- return state().setup();
- }
-#endif
void device_t::register_subalias(const pstring &name, detail::core_terminal_t &term)
{
diff --git a/src/lib/netlist/nl_base.h b/src/lib/netlist/nl_base.h
index 4553d19ea2a..b4f41396298 100644
--- a/src/lib/netlist/nl_base.h
+++ b/src/lib/netlist/nl_base.h
@@ -15,6 +15,7 @@
#include "plib/palloc.h" // owned_ptr
#include "plib/pdynlib.h"
#include "plib/pfmtlog.h"
+#include "plib/pfunction.h"
#include "plib/plists.h"
#include "plib/pmempool.h"
#include "plib/ppmf.h"
@@ -22,7 +23,6 @@
#include "plib/pstonum.h"
#include "plib/pstream.h"
#include "plib/ptime.h"
-#include "plib/pfunction.h"
#include "nl_errstr.h"
#include "nltypes.h"
@@ -144,7 +144,7 @@ class NETLIB_NAME(name) : public device_t
///
/// \param cname Name of object as given to \ref NETLIB_OBJECT
///
-#define NETLIB_TIMESTEP(cname) \
+#define NETLIB_TIMESTEP(cname) \
void NETLIB_NAME(cname) :: timestep(nl_fptype step) noexcept
#define NETLIB_FAMILY(family) , m_famsetter(*this, family)
@@ -587,7 +587,7 @@ namespace netlist
/// \param atype type to check object against.
/// \returns true if object is of specified type else false.
- bool is_type(const terminal_type atype) const noexcept { return (type() == atype); }
+ bool is_type(const terminal_type atype) const noexcept(false) { return (type() == atype); }
void set_net(net_t *anet) noexcept { m_net = anet; }
void clear_net() noexcept { m_net = nullptr; }
@@ -1336,7 +1336,7 @@ namespace netlist
using base_queue = timed_queue<plib::pqentry_t<net_t *, netlist_time>, false>;
using entry_t = plib::pqentry_t<net_t *, netlist_time>;
explicit queue_t(netlist_state_t &nl);
- virtual ~queue_t() noexcept override = default;
+ ~queue_t() noexcept override = default;
queue_t(const queue_t &) = delete;
queue_t(queue_t &&) = delete;
diff --git a/src/lib/netlist/nl_errstr.h b/src/lib/netlist/nl_errstr.h
index e3dde969338..12de0696712 100644
--- a/src/lib/netlist/nl_errstr.h
+++ b/src/lib/netlist/nl_errstr.h
@@ -68,8 +68,8 @@ namespace netlist
PERRMSGV(MF_DEVICE_ALREADY_EXISTS_1, 1, "Device already exists: {1}")
PERRMSGV(MF_ADDING_ALI1_TO_ALIAS_LIST, 1, "Error adding alias {1} to alias list")
PERRMSGV(MF_DIP_PINS_MUST_BE_AN_EQUAL_NUMBER_OF_PINS_1, 1,"You must pass an equal number of pins to DIPPINS {1}")
- PERRMSGV(MF_PARAM_COUNT_MISMATCH_2, 2, "Parameter count mismatch for {1} - only found {2}")
- PERRMSGV(MF_PARAM_COUNT_EXCEEDED_2, 2, "Parameter count exceed for {1} - found {2}")
+ PERRMSGV(MF_PARAM_COUNT_MISMATCH_2, 2, "Parameter count mismatch for {1} - only found {2}")
+ PERRMSGV(MF_PARAM_COUNT_EXCEEDED_2, 2, "Parameter count exceed for {1} - found {2}")
PERRMSGV(MF_UNKNOWN_OBJECT_TYPE_1, 1, "Unknown object type {1}")
PERRMSGV(MF_INVALID_NUMBER_CONVERSION_1_2, 2, "Invalid number conversion {1} : {2}")
PERRMSGV(MF_INVALID_ENUM_CONVERSION_1_2, 2, "Invalid element found {1} : {2}")
diff --git a/src/lib/netlist/nl_parser.cpp b/src/lib/netlist/nl_parser.cpp
index bf12c97f141..77d174bc038 100644
--- a/src/lib/netlist/nl_parser.cpp
+++ b/src/lib/netlist/nl_parser.cpp
@@ -354,7 +354,6 @@ void parser_t::netdev_hint()
void parser_t::device(const pstring &dev_type)
{
-#if 1
std::vector<pstring> params;
pstring devname = get_identifier();
@@ -368,12 +367,8 @@ void parser_t::device(const pstring &dev_type)
{
tok = get_token();
//printf("%d %s\n", tok.type(), tok.str().c_str());
- if (tok.is_type(IDENTIFIER))
+ if (tok.is_type(IDENTIFIER) || tok.is_type(STRING))
params.push_back(tok.str());
- else if (tok.is_type(STRING))
- {
- params.push_back(tok.str());
- }
else
{
// FIXME: Do we really need this?
@@ -389,92 +384,6 @@ void parser_t::device(const pstring &dev_type)
require_token(tok, m_tok_param_right);
m_setup.register_dev(dev_type, devname, params);
-
-#else
- factory::element_t *f = m_setup.factory().factory_by_name(dev_type);
- auto paramlist = plib::psplit(f->param_desc(), ",");
- std::vector<pstring> params;
-
- pstring devname = get_identifier();
-
- m_setup.register_dev(dev_type, devname);
- m_setup.log().debug("Parser: IC: {1}\n", devname);
-
- auto tok(get_token());
-
- //printf("enter\n");
- while (tok.is(m_tok_comma))
- {
- tok = get_token();
- //printf("%d %s\n", tok.type(), tok.str().c_str());
- if (tok.is_type(IDENTIFIER))
- params.push_back(tok.str());
- else if (tok.is_type(STRING))
- {
- params.push_back(tok.str());
- }
- else
- {
- // FIXME: Do we really need this?
- nl_fptype value = eval_param(tok);
- if (plib::abs(value - plib::floor(value)) > nlconst::magic(1e-30)
- || plib::abs(value) > nlconst::magic(1e9))
- params.push_back(plib::pfmt("{1:.9}").e(value));
- else
- params.push_back(plib::pfmt("{1}")(static_cast<long>(value)));
- }
- tok = get_token();
- }
-
- require_token(tok, m_tok_param_right);
-
- if (params.size() > 0)
- {
- auto ptok(params.begin());
-
- for (const pstring &tp : paramlist)
- {
- //printf("x %s %s\n", tp.c_str(), ptok->c_str());
- if (plib::startsWith(tp, "+"))
- {
- if (ptok == params.end())
- {
- error(plib::pfmt("Input count mismatch for {1} - only found {2}")(devname)(params.size()));
- break;
- }
- pstring output_name = *ptok;
- m_setup.log().debug("Link: {1} {2}\n", tp, output_name);
-
- m_setup.register_link(devname + "." + tp.substr(1), output_name);
- ++ptok;
- }
- else if (plib::startsWith(tp, "@"))
- {
- pstring term = tp.substr(1);
- m_setup.log().debug("Link: {1} {2}\n", tp, term);
-
- m_setup.register_link(devname + "." + term, term);
- }
- else
- {
- if (ptok == params.end())
- {
- error(plib::pfmt("Input count mismatch for {1} - only found {2}")(devname)(params.size()));
- break;
- }
- pstring paramfq = devname + "." + tp;
-
- m_setup.log().debug("Defparam: {1}\n", paramfq);
- m_setup.register_param(paramfq, *ptok);
- ++ptok;
- }
- }
- if (ptok != params.end())
- {
- error(plib::pfmt("Input count exceed for {1} - found {2}")(devname)(params.size()));
- }
- }
-#endif
}
@@ -482,7 +391,6 @@ void parser_t::device(const pstring &dev_type)
// private
// ----------------------------------------------------------------------------------------
-
nl_fptype parser_t::eval_param(const token_t &tok)
{
static std::array<pstring, 7> macs = {"", "RES_R", "RES_K", "RES_M", "CAP_U", "CAP_N", "CAP_P"};
diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp
index bcf3b2109d9..8943fb41dab 100644
--- a/src/lib/netlist/nl_setup.cpp
+++ b/src/lib/netlist/nl_setup.cpp
@@ -58,12 +58,17 @@ namespace netlist
register_dev(classname, name, params);
}
- void nlparse_t::register_dev(const pstring &classname, const pstring &name,
+ void nlparse_t::register_devx(const pstring &classname,
std::initializer_list<const char *> params_and_connections)
{
std::vector<pstring> params;
- for (auto &i : params_and_connections)
- params.push_back(pstring(i));
+ auto i(params_and_connections.begin());
+ pstring name(*i);
+ ++i;
+ for (; i != params_and_connections.end(); ++i)
+ {
+ params.emplace_back(*i);
+ }
register_dev(classname, name, params);
}
diff --git a/src/lib/netlist/nl_setup.h b/src/lib/netlist/nl_setup.h
index f8fb642768a..68d0e6d41ee 100644
--- a/src/lib/netlist/nl_setup.h
+++ b/src/lib/netlist/nl_setup.h
@@ -17,11 +17,11 @@
#include "nl_factory.h"
#include "nltypes.h"
+#include <initializer_list>
#include <memory>
#include <stack>
#include <unordered_map>
#include <vector>
-#include <initializer_list>
//============================================================
// MACROS / inline netlist definitions
@@ -42,8 +42,9 @@
#define NET_REGISTER_DEV(type, name) \
setup.register_dev(# type, # name);
-#define NET_REGISTER_DEVEXT(type, name, ...) \
- setup.register_dev(# type, # name, # __VA_ARGS__);
+// name is first element so that __VA_ARGS__ always has one element
+#define NET_REGISTER_DEVEXT(type, ...) \
+ setup.register_devx(# type, { PSTRINGIFY_VA(__VA_ARGS__) });
#define NET_CONNECT(name, input, output) \
setup.register_link(# name "." # input, # output);
@@ -247,8 +248,7 @@ namespace netlist
void register_dev(const pstring &classname, const pstring &name,
const std::vector<pstring> &params_and_connections);
- void register_dev(const pstring &classname, const pstring &name,
- std::initializer_list<const char *> params_and_connections);
+ void register_devx(const pstring &classname, std::initializer_list<const char *> params_and_connections);
void register_dev(const pstring &classname, const pstring &name,
const char *params_and_connections);
diff --git a/src/lib/netlist/plib/mat_cr.h b/src/lib/netlist/plib/mat_cr.h
index 9d885ffb884..3208ceeed3f 100644
--- a/src/lib/netlist/plib/mat_cr.h
+++ b/src/lib/netlist/plib/mat_cr.h
@@ -505,14 +505,7 @@ namespace plib
{
auto f = std::min(fill[i][j], 1 + fill[i][k] + fill[k][j]);
if (f <= ilup)
- {
-#if 0
- if (f > fill_max)
- fill_max = f;
- ops += 2;
-#endif
fill[i][j] = f;
- }
}
found = true;
}
diff --git a/src/lib/netlist/plib/palloc.h b/src/lib/netlist/plib/palloc.h
index 8b83a1970d6..0a79302787d 100644
--- a/src/lib/netlist/plib/palloc.h
+++ b/src/lib/netlist/plib/palloc.h
@@ -400,15 +400,6 @@ namespace plib {
return plib::unique_ptr<T>(pnew<T>(std::forward<Args>(args)...));
}
-#if 0
- template<typename T, typename... Args>
- static owned_ptr<T> make_owned(Args&&... args)
- {
- return owned_ptr<T>(pnew<T>(std::forward<Args>(args)...), true);
- }
-#endif
-
-
template <class T, std::size_t ALIGN = alignof(T)>
using aligned_allocator = aligned_arena::allocator_type<T, ALIGN>;
diff --git a/src/lib/netlist/plib/pfmtlog.cpp b/src/lib/netlist/plib/pfmtlog.cpp
index 77a9034ac26..d776e0133da 100644
--- a/src/lib/netlist/plib/pfmtlog.cpp
+++ b/src/lib/netlist/plib/pfmtlog.cpp
@@ -90,8 +90,8 @@ pfmt::rtype pfmt::setfmt(std::stringstream &strm, char32_t cfmt_spec)
if (r.p != pstring::npos)
{
// a.b format here ...
- char32_t pend(0);
- int width(0);
+ char32_t pend(0);
+ int width(0);
if (fmt != "" && pstring("duxofge").find(static_cast<pstring::value_type>(cfmt_spec)) != pstring::npos)
{
pend = static_cast<char32_t>(fmt.at(fmt.size() - 1));
diff --git a/src/lib/netlist/plib/pfunction.cpp b/src/lib/netlist/plib/pfunction.cpp
index 6f563ee9bbf..dee38f86416 100644
--- a/src/lib/netlist/plib/pfunction.cpp
+++ b/src/lib/netlist/plib/pfunction.cpp
@@ -227,7 +227,7 @@ namespace plib {
}
//printf("e : %s\n", expr.c_str());
//for (auto &s : postfix)
- // printf("x : %s\n", s.c_str());
+ // printf("x : %s\n", s.c_str());
compile_postfix(inputs, postfix, expr);
}
diff --git a/src/lib/netlist/plib/plists.h b/src/lib/netlist/plib/plists.h
index 8356d1d6199..5f2c7b6706d 100644
--- a/src/lib/netlist/plib/plists.h
+++ b/src/lib/netlist/plib/plists.h
@@ -250,19 +250,7 @@ namespace plib {
{
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;
- pqentry_t& operator=(pqentry_t && other) noexcept = default;
- pqentry_t& operator=(const pqentry_t &other) noexcept = default;
- void swap(pqentry_t &other) noexcept
- {
- std::swap(m_exec_time, other.m_exec_time);
- std::swap(m_object, other.m_object);
- }
-#endif
inline bool operator ==(const pqentry_t &rhs) const noexcept
{
return m_object == rhs.m_object;
diff --git a/src/lib/netlist/plib/ppreprocessor.h b/src/lib/netlist/plib/ppreprocessor.h
index d87c06657ef..892015b7f5a 100644
--- a/src/lib/netlist/plib/ppreprocessor.h
+++ b/src/lib/netlist/plib/ppreprocessor.h
@@ -54,7 +54,7 @@ namespace plib {
, m_expr_sep(std::move(s.m_expr_sep))
, m_if_flag(s.m_if_flag)
, m_if_level(s.m_if_level)
- , m_stack(std::move(s.m_stack))
+ , m_stack(std::move(s.m_stack))
, m_outbuf(std::move(s.m_outbuf))
, m_pos(s.m_pos)
, m_state(s.m_state)
@@ -84,7 +84,7 @@ namespace plib {
class readbuffer : public std::streambuf
{
public:
- explicit readbuffer(ppreprocessor *strm) : m_strm(strm), m_buf()
+ explicit readbuffer(ppreprocessor *strm) : m_strm(strm), m_buf()
{ setg(nullptr, nullptr, nullptr); }
readbuffer(readbuffer &&rhs) noexcept : m_strm(rhs.m_strm), m_buf() {}
COPYASSIGN(readbuffer, delete)
diff --git a/src/lib/netlist/plib/putil.h b/src/lib/netlist/plib/putil.h
index 437c78052b1..22abf637f87 100644
--- a/src/lib/netlist/plib/putil.h
+++ b/src/lib/netlist/plib/putil.h
@@ -13,12 +13,37 @@
#include "pstring.h"
#include <algorithm>
-#include <vector>
#include <initializer_list>
+#include <vector>
#define PSTRINGIFY_HELP(y) # y
#define PSTRINGIFY(x) PSTRINGIFY_HELP(x)
+#define PNARGS_(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, N, ...) N
+#define PNARGS(...) PNARGS_(__VA_ARGS__, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1)
+
+#define PCONCAT_(a, b) a ## b
+#define PCONCAT(a, b) PCONCAT_(a, b)
+
+#define PSTRINGIFY_1(x) #x
+#define PSTRINGIFY_2(x, x2) #x, #x2
+#define PSTRINGIFY_3(x, ...) #x, PSTRINGIFY_2(__VA_ARGS__)
+#define PSTRINGIFY_4(x, ...) #x, PSTRINGIFY_3(__VA_ARGS__)
+#define PSTRINGIFY_5(x, ...) #x, PSTRINGIFY_4(__VA_ARGS__)
+#define PSTRINGIFY_6(x, ...) #x, PSTRINGIFY_5(__VA_ARGS__)
+#define PSTRINGIFY_7(x, ...) #x, PSTRINGIFY_6(__VA_ARGS__)
+#define PSTRINGIFY_8(x, ...) #x, PSTRINGIFY_7(__VA_ARGS__)
+#define PSTRINGIFY_9(x, ...) #x, PSTRINGIFY_8(__VA_ARGS__)
+#define PSTRINGIFY_10(x, ...) #x, PSTRINGIFY_9(__VA_ARGS__)
+#define PSTRINGIFY_11(x, ...) #x, PSTRINGIFY_10(__VA_ARGS__)
+#define PSTRINGIFY_12(x, ...) #x, PSTRINGIFY_11(__VA_ARGS__)
+#define PSTRINGIFY_13(x, ...) #x, PSTRINGIFY_12(__VA_ARGS__)
+#define PSTRINGIFY_14(x, ...) #x, PSTRINGIFY_13(__VA_ARGS__)
+#define PSTRINGIFY_15(x, ...) #x, PSTRINGIFY_14(__VA_ARGS__)
+#define PSTRINGIFY_16(x, ...) #x, PSTRINGIFY_15(__VA_ARGS__)
+
+#define PSTRINGIFY_VA(...) PCONCAT(PSTRINGIFY_, PNARGS(__VA_ARGS__))(__VA_ARGS__)
+
// FIXME:: __FUNCTION__ may be not be supported by all compilers.
#define PSOURCELOC() plib::source_location(__FILE__, __LINE__)
@@ -43,7 +68,7 @@ namespace plib
{ }
source_location(pstring file, pstring func, unsigned line) noexcept
- : m_file(std::move(file)), m_func(func), m_line(line), m_col(0)
+ : m_file(std::move(file)), m_func(std::move(func)), m_line(line), m_col(0)
{ }
unsigned line() const noexcept { return m_line; }
diff --git a/src/lib/netlist/prg/nltool.cpp b/src/lib/netlist/prg/nltool.cpp
index a9c1244f191..114ec2f764e 100644
--- a/src/lib/netlist/prg/nltool.cpp
+++ b/src/lib/netlist/prg/nltool.cpp
@@ -10,11 +10,11 @@
// ***************************************************************************
#include "netlist/plib/pmain.h"
-#include "netlist/plib/pstrutil.h"
#include "netlist/devices/net_lib.h"
#include "netlist/nl_errstr.h"
#include "netlist/nl_parser.h"
#include "netlist/nl_setup.h"
+#include "netlist/plib/pstrutil.h"
#include "netlist/solver/nld_solver.h"
#include "netlist/tools/nl_convert.h"
@@ -117,7 +117,7 @@ public:
pstring usage() override;
template<typename... ARGS>
- void poutprefix(pstring prefix, pstring fmt, ARGS&&... args)
+ void poutprefix(const pstring &prefix, const pstring &fmt, ARGS&&... args)
{
pstring res = plib::pfmt(fmt)(std::forward<ARGS>(args)...);
auto lines(plib::psplit(res, "\n", false));
diff --git a/src/lib/netlist/solver/nld_matrix_solver.h b/src/lib/netlist/solver/nld_matrix_solver.h
index e3b7e9c02cb..218fc819c23 100644
--- a/src/lib/netlist/solver/nld_matrix_solver.h
+++ b/src/lib/netlist/solver/nld_matrix_solver.h
@@ -54,9 +54,9 @@ namespace solver
, m_gs_sor(parent, "SOR_FACTOR", nlconst::magic(1.059))
, m_method(parent, "METHOD", matrix_type_e::MAT_CR)
, m_fp_type(parent, "FPTYPE", matrix_fp_type_e::DOUBLE)
- , m_reltol(parent, "RELTOL", nlconst::magic(1e-3)) ///< SPICE RELTOL parameter
- , m_vntol(parent, "VNTOL", nlconst::magic(1e-7)) ///< SPICE VNTOL parameter
- , m_accuracy(parent, "ACCURACY", nlconst::magic(1e-7)) ///< Iterative solver accuracy
+ , m_reltol(parent, "RELTOL", nlconst::magic(1e-3)) ///< SPICE RELTOL parameter
+ , m_vntol(parent, "VNTOL", nlconst::magic(1e-7)) ///< SPICE VNTOL parameter
+ , m_accuracy(parent, "ACCURACY", nlconst::magic(1e-7)) ///< Iterative solver accuracy
, m_nr_loops(parent, "NR_LOOPS", 250) ///< Maximum number of Newton-Raphson loops
, m_gs_loops(parent, "GS_LOOPS", 9) ///< Maximum number of Gauss-Seidel loops
@@ -68,7 +68,7 @@ namespace solver
, m_parallel(parent, "PARALLEL", 0)
// automatic time step
- , m_dynamic_ts(parent, "DYNAMIC_TS", false) ///< Use dynamic time stepping
+ , m_dynamic_ts(parent, "DYNAMIC_TS", false) ///< Use dynamic time stepping
, m_dynamic_lte(parent, "DYNAMIC_LTE", nlconst::magic(1e-5)) ///< dynamic time stepping slope
, m_dynamic_min_ts(parent, "DYNAMIC_MIN_TIMESTEP", nlconst::magic(1e-6)) ///< smallest time step allowed
diff --git a/src/lib/netlist/solver/nld_solver.cpp b/src/lib/netlist/solver/nld_solver.cpp
index d4d78ce521d..4b24e003d52 100644
--- a/src/lib/netlist/solver/nld_solver.cpp
+++ b/src/lib/netlist/solver/nld_solver.cpp
@@ -159,7 +159,7 @@ namespace devices
case 2:
return plib::make_unique<solver::matrix_solver_direct2_t<FT>>(state(), sname, nets, &m_params);
break;
-#if 0
+#if 1
case 3:
return create_solver<FT, 3>(3, sname, nets);
break;
@@ -206,8 +206,6 @@ namespace devices
case 49:
return create_solver<FT, 49>(49, sname);
break;
-#endif
-#if 1
case 87:
return create_solver<FT,86>(86, sname, nets);
break;
diff --git a/src/lib/netlist/solver/nld_solver.h b/src/lib/netlist/solver/nld_solver.h
index c47b356ab61..b389c207c2c 100644
--- a/src/lib/netlist/solver/nld_solver.h
+++ b/src/lib/netlist/solver/nld_solver.h
@@ -8,9 +8,9 @@
/// \file nld_solver.h
///
+#include "../plib/pstream.h"
#include "netlist/nl_base.h"
#include "nld_matrix_solver.h"
-#include "../plib/pstream.h"
#include <map>
#include <memory>