summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author couriersud <couriersud@gmx.org>2019-11-08 23:52:14 +0100
committer couriersud <couriersud@gmx.org>2019-11-08 23:52:14 +0100
commit88f702b416ba9eb930e6c1e932124d5f24b1a24c (patch)
tree955f3047b79156d7b2bbab55fcbd4fbc94661f1d
parent731c4fe52073a7a7561bf04559e9f0b3b791388d (diff)
netlist: code maintenance and bug fixes. (nw)
- comment style migration continues. - Fixed a two bugs in the truthtable ignore inputs code - refactored the truthtable code a bit for better readability. - updated netlist specific gitignore.
-rw-r--r--src/lib/netlist/.gitignore2
-rw-r--r--src/lib/netlist/analog/nld_bjt.cpp129
-rw-r--r--src/lib/netlist/analog/nld_bjt.h10
-rw-r--r--src/lib/netlist/analog/nld_fourterm.h9
-rw-r--r--src/lib/netlist/analog/nld_generic_models.h14
-rw-r--r--src/lib/netlist/analog/nld_mosfet.cpp180
-rw-r--r--src/lib/netlist/analog/nld_mosfet.h10
-rw-r--r--src/lib/netlist/analog/nld_opamps.cpp118
-rw-r--r--src/lib/netlist/analog/nld_opamps.h10
-rw-r--r--src/lib/netlist/analog/nld_switches.cpp6
-rw-r--r--src/lib/netlist/analog/nld_switches.h10
-rw-r--r--src/lib/netlist/analog/nld_twoterm.h10
-rw-r--r--src/lib/netlist/analog/nlid_fourterm.cpp6
-rw-r--r--src/lib/netlist/analog/nlid_fourterm.h129
-rw-r--r--src/lib/netlist/analog/nlid_twoterm.cpp13
-rw-r--r--src/lib/netlist/analog/nlid_twoterm.h119
-rw-r--r--src/lib/netlist/devices/net_lib.cpp15
-rw-r--r--src/lib/netlist/devices/net_lib.h13
-rw-r--r--src/lib/netlist/devices/nlid_truthtable.cpp270
-rw-r--r--src/lib/netlist/devices/nlid_truthtable.h77
-rw-r--r--src/lib/netlist/documentation/mainpage.dox.h14
-rw-r--r--src/lib/netlist/documentation/structure.dox.h19
-rw-r--r--src/lib/netlist/nl_config.h6
-rw-r--r--src/lib/netlist/nl_parser.cpp2
-rw-r--r--src/lib/netlist/nl_setup.cpp4
-rw-r--r--src/lib/netlist/nl_setup.h5
-rw-r--r--src/lib/netlist/nltypes.h10
-rw-r--r--src/lib/netlist/plib/gmres.h142
-rw-r--r--src/lib/netlist/plib/mat_cr.h121
-rw-r--r--src/lib/netlist/plib/palloc.h22
-rw-r--r--src/lib/netlist/plib/parray.h41
-rw-r--r--src/lib/netlist/plib/pchrono.h50
-rw-r--r--src/lib/netlist/plib/pconfig.h117
-rw-r--r--src/lib/netlist/plib/pdynlib.cpp4
-rw-r--r--src/lib/netlist/plib/pdynlib.h9
-rw-r--r--src/lib/netlist/plib/pexception.cpp4
-rw-r--r--src/lib/netlist/plib/pexception.h46
-rw-r--r--src/lib/netlist/plib/pfmtlog.cpp4
-rw-r--r--src/lib/netlist/plib/pfmtlog.h11
-rw-r--r--src/lib/netlist/plib/pfunction.cpp4
-rw-r--r--src/lib/netlist/plib/pfunction.h84
-rw-r--r--src/lib/netlist/plib/plists.h58
-rw-r--r--src/lib/netlist/plib/pmain.cpp8
-rw-r--r--src/lib/netlist/plib/pmain.h15
-rw-r--r--src/lib/netlist/plib/pmath.h245
-rw-r--r--src/lib/netlist/plib/pmatrix2d.h12
-rw-r--r--src/lib/netlist/plib/pmempool.h10
-rw-r--r--src/lib/netlist/plib/pomp.h13
-rw-r--r--src/lib/netlist/plib/poptions.cpp7
-rw-r--r--src/lib/netlist/plib/poptions.h369
-rw-r--r--src/lib/netlist/plib/ppmf.h74
-rw-r--r--src/lib/netlist/plib/ppreprocessor.cpp27
-rw-r--r--src/lib/netlist/plib/ppreprocessor.h16
-rw-r--r--src/lib/netlist/plib/pstate.h10
-rw-r--r--src/lib/netlist/plib/pstonum.h10
-rw-r--r--src/lib/netlist/plib/pstream.h28
-rw-r--r--src/lib/netlist/plib/pstring.cpp4
-rw-r--r--src/lib/netlist/plib/pstring.h23
-rw-r--r--src/lib/netlist/plib/pstrutil.h11
-rw-r--r--src/lib/netlist/plib/ptime.h9
-rw-r--r--src/lib/netlist/plib/ptokenizer.cpp18
-rw-r--r--src/lib/netlist/plib/ptokenizer.h17
-rw-r--r--src/lib/netlist/plib/ptypes.h12
-rw-r--r--src/lib/netlist/plib/putil.h64
-rw-r--r--src/lib/netlist/plib/vector_ops.h14
-rw-r--r--src/lib/netlist/prg/nltool.cpp87
-rw-r--r--src/lib/netlist/prg/nlwav.cpp67
-rw-r--r--src/lib/netlist/solver/nld_matrix_solver.cpp105
-rw-r--r--src/lib/netlist/solver/nld_matrix_solver.h67
-rw-r--r--src/lib/netlist/solver/nld_ms_direct.h26
-rw-r--r--src/lib/netlist/solver/nld_ms_direct1.h10
-rw-r--r--src/lib/netlist/solver/nld_ms_direct2.h10
-rw-r--r--src/lib/netlist/solver/nld_ms_gcr.h28
-rw-r--r--src/lib/netlist/solver/nld_ms_gmres.h22
-rw-r--r--src/lib/netlist/solver/nld_ms_sm.h77
-rw-r--r--src/lib/netlist/solver/nld_ms_sor.h32
-rw-r--r--src/lib/netlist/solver/nld_ms_sor_mat.h31
-rw-r--r--src/lib/netlist/solver/nld_ms_w.h108
-rw-r--r--src/lib/netlist/solver/nld_solver.cpp37
-rw-r--r--src/lib/netlist/solver/nld_solver.h10
-rw-r--r--src/lib/netlist/tools/nl_convert.cpp94
-rw-r--r--src/lib/netlist/tools/nl_convert.h16
-rw-r--r--src/mame/machine/nl_pongf.cpp33
83 files changed, 1889 insertions, 1914 deletions
diff --git a/src/lib/netlist/.gitignore b/src/lib/netlist/.gitignore
index ed125b65632..79cfb40c0dd 100644
--- a/src/lib/netlist/.gitignore
+++ b/src/lib/netlist/.gitignore
@@ -5,3 +5,5 @@ buildVS/x64/*
buildVS/.vs/*
nltool
nlwav
+nltool.exe
+nlwav.exe
diff --git a/src/lib/netlist/analog/nld_bjt.cpp b/src/lib/netlist/analog/nld_bjt.cpp
index 7ddf42c1b5c..2bc84654ddd 100644
--- a/src/lib/netlist/analog/nld_bjt.cpp
+++ b/src/lib/netlist/analog/nld_bjt.cpp
@@ -45,57 +45,56 @@ namespace analog
// nld_Q - Base classes
// -----------------------------------------------------------------------------
- /*! Class representing the bjt model parameters.
- *
- * This is the model representation of the bjt model. Typically, SPICE uses
- * the following parameters. A "Y" in the first column indicates that the
- * parameter is actually used in netlist.
- *
- * | NL? | name | parameter | units | default | example | area |
- * |:---:|------|-----------------------------------------------------------------------|-------|---------:|----------------:|:----:|
- * | Y | IS | transport saturation current | A | 1E-016 | 1E-015 | * |
- * | Y | BF | ideal maximum forward beta | - | 100 | 100 | |
- * | Y | NF | forward current emission coefficient | - | 1 | 1 | |
- * | | VAF | forward Early voltage | V | infinite | 200 | |
- * | | IKF | corner for forward beta high current roll-off | A | infinite | 0.01 | * |
- * | | ISE | B-E leakage saturation current | A | 0 | 0.0000000000001 | * |
- * | | NE | B-E leakage emission coefficient | - | 1.5 | 2 | |
- * | Y | BR | ideal maximum reverse beta | - | 1 | 0.1 | |
- * | Y | NR | reverse current emission coefficient | - | 1 | 1 | |
- * | | VAR | reverse Early voltage | V | infinite | 200 | |
- * | | IKR | corner for reverse beta high current roll-off | A | infinite | 0.01 | * |
- * | | ISC | leakage saturation current | A | 0 | 8 | |
- * | | NC | leakage emission coefficient | - | 2 | 1.5 | |
- * | | RB | zero bias base resistance | | 0 | 100 | * |
- * | | IRB | current where base resistance falls halfway to its min value | A | infinite | 0.1 | * |
- * | | RBM | minimum base resistance at high currents | | RB | 10 | * |
- * | | RE | emitter resistance | | 0 | 1 | * |
- * | | RC | collector resistance | | 0 | 10 | * |
- * | Y | CJE | B-E zero-bias depletion capacitance | F | 0 | 2pF | * |
- * | | VJE | B-E built-in potential | V | 0.75 | 0.6 | |
- * | | MJE | B-E junction exponential factor | - | 0.33 | 0.33 | |
- * | | TF | ideal forward transit time | sec | 0 | 0.1ns | |
- * | | XTF | coefficient for bias dependence of TF | - | 0 | | |
- * | | VTF | voltage describing VBC dependence of TF | V | infinite | | |
- * | | ITF | high-current parameter for effect on TF | A | 0 | | * |
- * | | PTF | excess phase at freq=1.0/(TF*2PI) Hz | deg | 0 | | |
- * | Y | CJC | B-C zero-bias depletion capacitance | F | 0 | 2pF | * |
- * | | VJC | B-C built-in potential | V | 0.75 | 0.5 | |
- * | | MJC | B-C junction exponential factor | - | 0.33 | 0.5 | |
- * | | XCJC | fraction of B-C depletion capacitance connected to internal base node | - | 1 | | |
- * | | TR | ideal reverse transit time | sec | 0 | 10ns | |
- * | | CJS | zero-bias collector-substrate capacitance | F | 0 | 2pF | * |
- * | | VJS | substrate junction built-in potential | V | 0.75 | | |
- * | | MJS | substrate junction exponential factor | - | 0 | 0.5 | |
- * | | XTB | forward and reverse beta temperature exponent | - | 0 | | |
- * | | EG | energy gap for temperature effect on IS | eV | 1.11 | | |
- * | | XTI | temperature exponent for effect on IS | - | 3 | | |
- * | | KF | flicker-noise coefficient | - | 0 | | |
- * | | AF | flicker-noise exponent | - | 1 | | |
- * | | FC | coefficient for forward-bias depletion capacitance formula | - | 0.5 | | |
- * | | TNOM | Parameter measurement temperature | C | 27 | 50 | |
- * */
-
+ /// \brief Class representing the bjt model parameters.
+ ///
+ /// This is the model representation of the bjt model. Typically, SPICE uses
+ /// the following parameters. A "Y" in the first column indicates that the
+ /// parameter is actually used in netlist.
+ ///
+ /// | NL? | name | parameter | units | default | example | area |
+ /// |:---:|------|-----------------------------------------------------------------------|-------|---------:|----------------:|:----:|
+ /// | Y | IS | transport saturation current | A | 1E-016 | 1E-015 | * |
+ /// | Y | BF | ideal maximum forward beta | - | 100 | 100 | |
+ /// | Y | NF | forward current emission coefficient | - | 1 | 1 | |
+ /// | | VAF | forward Early voltage | V | infinite | 200 | |
+ /// | | IKF | corner for forward beta high current roll-off | A | infinite | 0.01 | * |
+ /// | | ISE | B-E leakage saturation current | A | 0 | 0.0000000000001 | * |
+ /// | | NE | B-E leakage emission coefficient | - | 1.5 | 2 | |
+ /// | Y | BR | ideal maximum reverse beta | - | 1 | 0.1 | |
+ /// | Y | NR | reverse current emission coefficient | - | 1 | 1 | |
+ /// | | VAR | reverse Early voltage | V | infinite | 200 | |
+ /// | | IKR | corner for reverse beta high current roll-off | A | infinite | 0.01 | * |
+ /// | | ISC | leakage saturation current | A | 0 | 8 | |
+ /// | | NC | leakage emission coefficient | - | 2 | 1.5 | |
+ /// | | RB | zero bias base resistance | | 0 | 100 | * |
+ /// | | IRB | current where base resistance falls halfway to its min value | A | infinite | 0.1 | * |
+ /// | | RBM | minimum base resistance at high currents | | RB | 10 | * |
+ /// | | RE | emitter resistance | | 0 | 1 | * |
+ /// | | RC | collector resistance | | 0 | 10 | * |
+ /// | Y | CJE | B-E zero-bias depletion capacitance | F | 0 | 2pF | * |
+ /// | | VJE | B-E built-in potential | V | 0.75 | 0.6 | |
+ /// | | MJE | B-E junction exponential factor | - | 0.33 | 0.33 | |
+ /// | | TF | ideal forward transit time | sec | 0 | 0.1ns | |
+ /// | | XTF | coefficient for bias dependence of TF | - | 0 | | |
+ /// | | VTF | voltage describing VBC dependence of TF | V | infinite | | |
+ /// | | ITF | high-current parameter for effect on TF | A | 0 | | * |
+ /// | | PTF | excess phase at freq=1.0/(TF*2PI) Hz | deg | 0 | | |
+ /// | Y | CJC | B-C zero-bias depletion capacitance | F | 0 | 2pF | * |
+ /// | | VJC | B-C built-in potential | V | 0.75 | 0.5 | |
+ /// | | MJC | B-C junction exponential factor | - | 0.33 | 0.5 | |
+ /// | | XCJC | fraction of B-C depletion capacitance connected to internal base node | - | 1 | | |
+ /// | | TR | ideal reverse transit time | sec | 0 | 10ns | |
+ /// | | CJS | zero-bias collector-substrate capacitance | F | 0 | 2pF | * |
+ /// | | VJS | substrate junction built-in potential | V | 0.75 | | |
+ /// | | MJS | substrate junction exponential factor | - | 0 | 0.5 | |
+ /// | | XTB | forward and reverse beta temperature exponent | - | 0 | | |
+ /// | | EG | energy gap for temperature effect on IS | eV | 1.11 | | |
+ /// | | XTI | temperature exponent for effect on IS | - | 3 | | |
+ /// | | KF | flicker-noise coefficient | - | 0 | | |
+ /// | | AF | flicker-noise exponent | - | 1 | | |
+ /// | | FC | coefficient for forward-bias depletion capacitance formula | - | 0.5 | | |
+ /// | | TNOM | Parameter measurement temperature | C | 27 | 50 | |
+ ///
class bjt_model_t : public param_model_t
{
public:
@@ -156,18 +155,18 @@ namespace analog
// -----------------------------------------------------------------------------
- /*
- * + - C
- * B ----VVV----+ |
- * | |
- * Rb Rc
- * Rb Rc
- * Rb Rc
- * | |
- * +----+----+
- * |
- * E
- */
+ //
+ // + - C
+ // B ----VVV----+ |
+ // | |
+ // Rb Rc
+ // Rb Rc
+ // Rb Rc
+ // | |
+ // +----+----+
+ // |
+ // E
+ //
NETLIB_OBJECT_DERIVED(QBJT_switch, QBJT)
{
@@ -329,8 +328,8 @@ namespace analog
const auto cc(nlconst::magic(0.005));
m_V = d.V(cc / alpha);
- /* Base current is 0.005 / beta
- * as a rough estimate, we just scale the conductance down */
+ // Base current is 0.005 / beta
+ // as a rough estimate, we just scale the conductance down
m_gB = plib::reciprocal((m_V/(cc / BF)));
diff --git a/src/lib/netlist/analog/nld_bjt.h b/src/lib/netlist/analog/nld_bjt.h
index 3a8478f19f7..f6ee74e3872 100644
--- a/src/lib/netlist/analog/nld_bjt.h
+++ b/src/lib/netlist/analog/nld_bjt.h
@@ -1,13 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * nld_bjt.h
- *
- */
#ifndef NLD_BJT_H_
#define NLD_BJT_H_
+///
+/// \file nld_bjt.h
+///
+
#include "netlist/nl_setup.h"
// -----------------------------------------------------------------------------
@@ -22,4 +22,4 @@
NET_REGISTER_DEV(QBJT_EB, name) \
NETDEV_PARAMI(name, MODEL, model)
-#endif /* NLD_BJT_H_ */
+#endif // NLD_BJT_H_
diff --git a/src/lib/netlist/analog/nld_fourterm.h b/src/lib/netlist/analog/nld_fourterm.h
index 66c47c0be29..dcd32744263 100644
--- a/src/lib/netlist/analog/nld_fourterm.h
+++ b/src/lib/netlist/analog/nld_fourterm.h
@@ -1,13 +1,12 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * nld_fourterm.h
- *
- */
#ifndef NLD_FOURTERM_H_
#define NLD_FOURTERM_H_
+///
+/// \file nld_fourterm.h
+///
#include "netlist/nl_setup.h"
@@ -27,4 +26,4 @@
#define LVCCS(name) \
NET_REGISTER_DEV(LVCCS, name)
-#endif /* NLD_FOURTERM_H_ */
+#endif // NLD_FOURTERM_H_
diff --git a/src/lib/netlist/analog/nld_generic_models.h b/src/lib/netlist/analog/nld_generic_models.h
index 6c510f1d25d..c2a5e5363a3 100644
--- a/src/lib/netlist/analog/nld_generic_models.h
+++ b/src/lib/netlist/analog/nld_generic_models.h
@@ -1,13 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * nl_generic_models.h
- *
- */
#ifndef NLD_GENERIC_MODELS_H_
#define NLD_GENERIC_MODELS_H_
+///
+/// \file nl_generic_models.h
+///
+
#include "netlist/nl_base.h"
#include "netlist/nl_setup.h"
@@ -188,7 +188,7 @@ namespace analog
m_G = m_Is * m_VtInv + m_gmin;
m_Id = m_G * m_Vd;
}
- else /* log stepping should already be done in mosfet */
+ else // log stepping should already be done in mosfet
{
m_Vd = nVd;
IseVDVt = plib::exp(std::min(+fp_constants<nl_fptype>::DIODE_MAXVOLT(), m_logIs + m_Vd * m_VtInv));
@@ -220,7 +220,7 @@ namespace analog
nl_fptype Ieq() const noexcept { return (m_Id - m_Vd * m_G); }
nl_fptype Vd() const noexcept { return m_Vd; }
- /* owning object must save those ... */
+ // owning object must save those ...
private:
state_var<nl_fptype> m_Vd;
@@ -244,4 +244,4 @@ namespace analog
} // namespace analog
} // namespace netlist
-#endif /* NLD_GENERIC_MODELS_H_ */
+#endif // NLD_GENERIC_MODELS_H_
diff --git a/src/lib/netlist/analog/nld_mosfet.cpp b/src/lib/netlist/analog/nld_mosfet.cpp
index 78f4b4df615..340b2f7dd15 100644
--- a/src/lib/netlist/analog/nld_mosfet.cpp
+++ b/src/lib/netlist/analog/nld_mosfet.cpp
@@ -1,22 +1,22 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * nld_mosfet.cpp
- *
- * Formulas in here based on the following Sources:
- *
- * https://www.imperial.ac.uk/pls/portallive/docs/1/7292573.PDF
- * http://www3.imperial.ac.uk/pls/portallive/docs/1/56133736.PDF
- * https://people.rit.edu/lffeee/SPICE_MOSFET_Model_Intro.pdf
- * https://people.rit.edu/lffeee/SPICE.pdf
- * http://web.mit.edu/course/6/6.012/SPR98/www/lectures/S98_Lecture10.pdf
- * http://homepages.rpi.edu/~sawyes/Models_review.pdf
- * http://jaco.ec.t.kanazawa-u.ac.jp/edu/mix/pdf/3.pdf
- *
- * Farid N. Naim, Circuit Simulation (Wiley-IEEE Press, 2010).
- * Stefan Jahn, Michael Margraf, Vincent Habchi and Raimund Jacob, "Qucs Technical Papers" (2007)
- *
- */
+
+//
+// nld_mosfet.cpp
+//
+// Formulas in here based on the following Sources:
+//
+// https://www.imperial.ac.uk/pls/portallive/docs/1/7292573.PDF
+// http://www3.imperial.ac.uk/pls/portallive/docs/1/56133736.PDF
+// https://people.rit.edu/lffeee/SPICE_MOSFET_Model_Intro.pdf
+// https://people.rit.edu/lffeee/SPICE.pdf
+// http://web.mit.edu/course/6/6.012/SPR98/www/lectures/S98_Lecture10.pdf
+// http://homepages.rpi.edu/~sawyes/Models_review.pdf
+// http://jaco.ec.t.kanazawa-u.ac.jp/edu/mix/pdf/3.pdf
+//
+// Farid N. Naim, Circuit Simulation (Wiley-IEEE Press, 2010).
+// Stefan Jahn, Michael Margraf, Vincent Habchi and Raimund Jacob, "Qucs Technical Papers" (2007)
+//
#include "netlist/solver/nld_solver.h"
#include "netlist/nl_setup.h"
@@ -35,65 +35,65 @@ namespace analog
// nld_FET - Base classes
// -----------------------------------------------------------------------------
- /*! Class representing the nmos/pmos model paramers.
- *
- * This is the model representation of the nmos model.
- *
- * Netlist has an additional parameter caller CAPMOD:
- *
- * CAPMOD=0: Capacitance model disabled
- * CAPMOD=2: Meyer capacitance model
- *
- * Typically, SPICE uses the following parameters. A "Y" in the first
- * column indicates that the parameter is actually used in netlist.
- *
- * | NL? |Name | Description|Units |Default |Example |
- * |:---:|------|-----------------------------------------------------------------------|-------|---------:|----------------:|
- * | Y |Vto | Zero-bias threshold voltage | V | 0 | 1 |
- * | Y |Kp | Transconductance parameter | A/V² | 0.00002 | 0.00003 |
- * | Y |Gamma | Bulk threshold parameter | V^½ | 0 | 0.37 |
- * | Y |Phi | Surface inversion potential | V | 0.6 | 0.65 |
- * | Y |Lambda| Channel-length modulation (level 1 and 2 only) | 1/V | 0 | 0.02 |
- * | |Rd | Drain ohmic resistance |W|0|1|
- * | |Rs | Source ohmic resistance |W|0|1|
- * | |Cbd | Zero-bias B-D junction capacitance |F|0|20f|
- * | |Cbs | Zero-bias B-S junction capacitance |F|0|20f|
- * | Y |Is | Bulk junction saturation current |A|0.00000000000001|1E-015|
- * | Y |N | Bulk diode emission coefficient |-|1|*|
- * | |Pb | Bulk junction potential |V|0.8|0.87|
- * | Y |Cgso | Gate-source overlap capacitance per meter channel width |F/m|0|0.00000000004|
- * | Y |Cgdo | Gate-drain overlap capacitance per meter channel width |F/m|0|0.00000000004*|
- * | Y |Cgbo | Gate-bulk overlap capacitance per meter channel width |F/m|0|0.0000000002*|
- * | |Rsh | Drain and source diffusion sheet resistance |W|0|10*|
- * | |Cj | Zero-bias bulk junction bottom capacitance per square meter of junction area|F/m²|0|0.0002*|
- * | |Mj | Bulk junction bottom grading coefficient |-|0.5|0.5*|
- * | |Cjsw | Zero-bias bulk junction sidewall capacitance per meter of junction perimeter|F/m|0|1p*|
- * | |Mjsw | Bulk junction sidewall grading coefficient |-|.50 level 1 .33 level 2,3||
- * | |Js | Bulk junction saturation current per square-meter of junction area|A/m|0|0.00000001|
- * | Y |Tox | Oxide thickness |m|0.0000001|0.0000001|
- * | Y |Nsub | Substrate doping |1/cm³|0|4000000000000000|
- * | |Nss | Surface state density |1/cm²|0|10000000000|
- * | |Nfs | Fast surface state |1/cm²|0|10000000000*|
- * | |TPG | Type of gate material: +1 opp. to substrate -1 same as substrate |Al gate|-|1|
- * | |Xj | Metallurgical junction depth |m|0|1µ*|
- * | Y |Ld | Lateral diffusion |m|0|0.8µ|
- * | Y |Uo | Surface mobility |cm²/V/s|600|700|
- * | |Ucrit | Critical field for mobility degradation (level 2 only) |V/cm|10000|10000|
- * | |Uexp | Critical field exponent in mobility degradation (level 2 only) |-|0|0.1|
- * | |Utra | Transverse field coefficient (level 2 only) |-|0|0.3*|
- * | |Vmax | Maximum carrier drift velocity (levels 2 & 3 only) |m/s|0|50000|
- * | |Neff | Total channel-charge exponent (level 2 only) |-|1|5|
- * | |Kf | Flicker noise coefficient |-|0|1E-026|
- * | |Af | Flicker noise exponent |-|1|1.2|
- * | |Fc | Coefficient for forward-bias depletion capacitance formula |-|0.5||
- * | |Delta | Width effect on threshold voltage(levels 2 and 3) |-|0|1|
- * | |Theta | Mobility modulation (level 3 only) |-|0|0.1|
- * | |Eta | Static feedback (level 3 only) |-|0|1|
- * | |Kappa | Saturation field (level 3 only) |-|0.2|0.5|
- * | |Tnom | Parameter measurement temperature |ºC|27|50|
- * | Y |L | Length scaling |-|100e-6||
- * | Y |W | Width scaling |-|100e-6||
- * */
+ /// \brief Class representing the nmos/pmos model paramers.
+ ///
+ /// This is the model representation of the nmos model.
+ ///
+ /// Netlist has an additional parameter caller CAPMOD:
+ ///
+ /// CAPMOD=0: Capacitance model disabled
+ /// CAPMOD=2: Meyer capacitance model
+ ///
+ /// Typically, SPICE uses the following parameters. A "Y" in the first
+ /// column indicates that the parameter is actually used in netlist.
+ ///
+ /// | NL? |Name | Description|Units |Default |Example |
+ /// |:---:|------|-----------------------------------------------------------------------|-------|---------:|----------------:|
+ /// | Y |Vto | Zero-bias threshold voltage | V | 0 | 1 |
+ /// | Y |Kp | Transconductance parameter | A/V² | 0.00002 | 0.00003 |
+ /// | Y |Gamma | Bulk threshold parameter | V^½ | 0 | 0.37 |
+ /// | Y |Phi | Surface inversion potential | V | 0.6 | 0.65 |
+ /// | Y |Lambda| Channel-length modulation (level 1 and 2 only) | 1/V | 0 | 0.02 |
+ /// | |Rd | Drain ohmic resistance |W|0|1|
+ /// | |Rs | Source ohmic resistance |W|0|1|
+ /// | |Cbd | Zero-bias B-D junction capacitance |F|0|20f|
+ /// | |Cbs | Zero-bias B-S junction capacitance |F|0|20f|
+ /// | Y |Is | Bulk junction saturation current |A|0.00000000000001|1E-015|
+ /// | Y |N | Bulk diode emission coefficient |-|1|*|
+ /// | |Pb | Bulk junction potential |V|0.8|0.87|
+ /// | Y |Cgso | Gate-source overlap capacitance per meter channel width |F/m|0|0.00000000004|
+ /// | Y |Cgdo | Gate-drain overlap capacitance per meter channel width |F/m|0|0.00000000004*|
+ /// | Y |Cgbo | Gate-bulk overlap capacitance per meter channel width |F/m|0|0.0000000002*|
+ /// | |Rsh | Drain and source diffusion sheet resistance |W|0|10*|
+ /// | |Cj | Zero-bias bulk junction bottom capacitance per square meter of junction area|F/m²|0|0.0002*|
+ /// | |Mj | Bulk junction bottom grading coefficient |-|0.5|0.5*|
+ /// | |Cjsw | Zero-bias bulk junction sidewall capacitance per meter of junction perimeter|F/m|0|1p*|
+ /// | |Mjsw | Bulk junction sidewall grading coefficient |-|.50 level 1 .33 level 2,3||
+ /// | |Js | Bulk junction saturation current per square-meter of junction area|A/m|0|0.00000001|
+ /// | Y |Tox | Oxide thickness |m|0.0000001|0.0000001|
+ /// | Y |Nsub | Substrate doping |1/cm³|0|4000000000000000|
+ /// | |Nss | Surface state density |1/cm²|0|10000000000|
+ /// | |Nfs | Fast surface state |1/cm²|0|10000000000*|
+ /// | |TPG | Type of gate material: +1 opp. to substrate -1 same as substrate |Al gate|-|1|
+ /// | |Xj | Metallurgical junction depth |m|0|1µ*|
+ /// | Y |Ld | Lateral diffusion |m|0|0.8µ|
+ /// | Y |Uo | Surface mobility |cm²/V/s|600|700|
+ /// | |Ucrit | Critical field for mobility degradation (level 2 only) |V/cm|10000|10000|
+ /// | |Uexp | Critical field exponent in mobility degradation (level 2 only) |-|0|0.1|
+ /// | |Utra | Transverse field coefficient (level 2 only) |-|0|0.3*|
+ /// | |Vmax | Maximum carrier drift velocity (levels 2 & 3 only) |m/s|0|50000|
+ /// | |Neff | Total channel-charge exponent (level 2 only) |-|1|5|
+ /// | |Kf | Flicker noise coefficient |-|0|1E-026|
+ /// | |Af | Flicker noise exponent |-|1|1.2|
+ /// | |Fc | Coefficient for forward-bias depletion capacitance formula |-|0.5||
+ /// | |Delta | Width effect on threshold voltage(levels 2 and 3) |-|0|1|
+ /// | |Theta | Mobility modulation (level 3 only) |-|0|0.1|
+ /// | |Eta | Static feedback (level 3 only) |-|0|1|
+ /// | |Kappa | Saturation field (level 3 only) |-|0.2|0.5|
+ /// | |Tnom | Parameter measurement temperature |ºC|27|50|
+ /// | Y |L | Length scaling |-|100e-6||
+ /// | Y |W | Width scaling |-|100e-6||
+ ///
class fet_model_t : public param_model_t
{
@@ -224,16 +224,15 @@ namespace analog
// printf("capmod %d %g %g\n", m_capmod, (nl_fptype)m_model.m_VTO, m_polarity);
nl_assert_always(m_capmod == 0 || m_capmod == 2, "Error: CAPMODEL invalid value for " + m_model.name());
- /*
- * From http://ltwiki.org/LTspiceHelp/LTspiceHelp/M_MOSFET.htm :
- *
- * VTO, KP, LAMBDA, PHI and GAMMA. These parameters are computed
- * if the process parameters(NSUB, TOX,...) are given, but
- * user-specified values always override.
- *
- * But couldn't find a formula for lambda anywhere
- *
- */
+ //
+ // From http://ltwiki.org/LTspiceHelp/LTspiceHelp/M_MOSFET.htm :
+ //
+ // VTO, KP, LAMBDA, PHI and GAMMA. These parameters are computed
+ // if the process parameters(NSUB, TOX,...) are given, but
+ // user-specified values always override.
+ //
+ // But couldn't find a formula for lambda anywhere
+ //
m_lambda = m_model.m_LAMBDA; // FIXME: m_lambda only set once
@@ -284,9 +283,8 @@ namespace analog
if(m_vto != nlconst::zero())
log().warning(MW_MOSFET_THRESHOLD_VOLTAGE(m_model.name()));
- /* FIXME: VTO if missing may be calculated from TPG, NSS and temperature. Usually models
- * specify VTO so skip this here.
- */
+ // FIXME: VTO if missing may be calculated from TPG, NSS and temperature. Usually models
+ // specify VTO so skip this here.
m_CoxWL = Cox * m_model.m_W * m_Leff;
@@ -350,12 +348,12 @@ namespace analog
nl_fptype m_beta;
nl_fptype m_lambda;
- /* used in capacitance calculation */
+ // used in capacitance calculation
nl_fptype m_Leff;
nl_fptype m_CoxWL;
nl_fptype m_polarity;
- /* capacitance values */
+ // capacitance values
nl_fptype m_Cgb;
nl_fptype m_Cgs;
diff --git a/src/lib/netlist/analog/nld_mosfet.h b/src/lib/netlist/analog/nld_mosfet.h
index 32011d709d8..23c6cacc3bd 100644
--- a/src/lib/netlist/analog/nld_mosfet.h
+++ b/src/lib/netlist/analog/nld_mosfet.h
@@ -1,15 +1,15 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * nld_mosfet.h
- *
- */
#ifndef NLD_MOSFET_H_
#define NLD_MOSFET_H_
#include "netlist/nl_setup.h"
+///
+/// \file nld_mosfet.h
+///
+
// -----------------------------------------------------------------------------
// Macros
// -----------------------------------------------------------------------------
@@ -18,4 +18,4 @@
NET_REGISTER_DEV(MOSFET, name) \
NETDEV_PARAMI(name, MODEL, model)
-#endif /* NLD_MOSFET_H_ */
+#endif // NLD_MOSFET_H_
diff --git a/src/lib/netlist/analog/nld_opamps.cpp b/src/lib/netlist/analog/nld_opamps.cpp
index ac21037671f..6a1502dab00 100644
--- a/src/lib/netlist/analog/nld_opamps.cpp
+++ b/src/lib/netlist/analog/nld_opamps.cpp
@@ -1,9 +1,5 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * nld_opamps.c
- *
- */
#include "nld_opamps.h"
#include "netlist/nl_base.h"
@@ -15,63 +11,63 @@ namespace netlist
{
namespace analog
{
- /*
- * Type = 0: Impedance changer
- * 1; Idealized opamp
- * 2; opamp with first pole
- * 3: opamp with first pole + output limit
- * 4: opamp with input stage, first pole + output limit
- *
- * Type 1 parameters:
- * FPF = frequency of first pole in Hz (ony used for open-loop gain)
- * UGF = unity gain frequency in Hz (only used for open-loop gain)
- * RI = input resistance in Ohms
- * RO = output resistance in Ohms
- *
- * Type 3 parameters:
- * VLH = high supply rail minus high output swing in V
- * VLL = low output swing minus low supply rail in V
- * FPF = frequency of first pole in Hz
- * UGF = unity gain frequency (transition frequency) in Hz
- * SLEW = unity gain slew rate in V/s
- * RI = input resistance in Ohms
- * RO = output resistance in Ohms
- * DAB = Differential Amp Bias ~ op amp's total quiescent current.
- *
- * .model abc OPAMP(VLH=2.0 VLL=0.2 FPF=5 UGF=10k SLEW=0.6u RI=1000k RO=50 DAB=0.002)
- *
- * http://www.ecircuitcenter.com/Circuits/opmodel1/opmodel1.htm
- *
- * */
-
- /*! Class representing the opamp model parameters.
- * The opamp model was designed based on designs from
- * http://www.ecircuitcenter.com/Circuits/opmodel1/opmodel1.htm.
- * Currently 2 different types are supported: Type 1 and Type 3. Type 1
- * is less complex and should run faster than Type 3.
- *
- * This is an extension to the traditional SPICE approach which
- * assumes that you will be using an manufacturer model. These models may
- * have copyrights incompatible with the netlist license. Thus they may not
- * be suitable for certain implementations of netlist.
- *
- * For the typical use cases in low frequency (< 100 KHz) applications at
- * which netlist is targeted, this model is certainly suitable. All parameters
- * can be determined from a typical opamp datasheet.
- *
- * |Type|name |parameter |units|default| example|
- * |:--:|:-----|:----------------------------------------------|:----|------:|-------:|
- * | 3 |TYPE |Model Type, 1 and 3 are supported | | | |
- * |1,3 |FPF |frequency of first pole |Hz | |100 |
- * | 3 |SLEW |unity gain slew rate |V/s | | 1|
- * |1,3 |RI |input resistance |Ohm | |1M |
- * |1,3 |RO |output resistance |Ohm | |50 |
- * |1,3 |UGF |unity gain frequency (transition frequency) |Hz | |1000 |
- * | 3 |VLL |low output swing minus low supply rail |V | |1.5 |
- * | 3 |VLH |high supply rail minus high output swing |V | |1.5 |
- * | 3 |DAB |Differential Amp Bias - total quiescent current|A | |0.001 |
- */
+ /// \brief Class representing the opamp model parameters.
+ ///
+ /// The opamp model was designed based on designs from
+ /// http://www.ecircuitcenter.com/Circuits/opmodel1/opmodel1.htm.
+ /// Currently 2 different types are supported: Type 1 and Type 3. Type 1
+ /// is less complex and should run faster than Type 3.
+ ///
+ /// This is an extension to the traditional SPICE approach which
+ /// assumes that you will be using an manufacturer model. These models may
+ /// have copyrights incompatible with the netlist license. Thus they may not
+ /// be suitable for certain implementations of netlist.
+ ///
+ /// For the typical use cases in low frequency (< 100 KHz) applications at
+ /// which netlist is targeted, this model is certainly suitable. All parameters
+ /// can be determined from a typical opamp datasheet.
+ ///
+ /// |Type|name |parameter |units|default| example|
+ /// |:--:|:-----|:----------------------------------------------|:----|------:|-------:|
+ /// | 3 |TYPE |Model Type, 1 and 3 are supported | | | |
+ /// |1,3 |FPF |frequency of first pole |Hz | |100 |
+ /// | 3 |SLEW |unity gain slew rate |V/s | | 1|
+ /// |1,3 |RI |input resistance |Ohm | |1M |
+ /// |1,3 |RO |output resistance |Ohm | |50 |
+ /// |1,3 |UGF |unity gain frequency (transition frequency) |Hz | |1000 |
+ /// | 3 |VLL |low output swing minus low supply rail |V | |1.5 |
+ /// | 3 |VLH |high supply rail minus high output swing |V | |1.5 |
+ /// | 3 |DAB |Differential Amp Bias - total quiescent current|A | |0.001 |
+ ///
+ ///
+ /// Type = 0: Impedance changer
+ /// 1; Idealized opamp
+ /// 2; opamp with first pole
+ /// 3: opamp with first pole + output limit
+ /// 4: opamp with input stage, first pole + output limit
+ ///
+ /// Type 1 parameters:
+ /// FPF = frequency of first pole in Hz (ony used for open-loop gain)
+ /// UGF = unity gain frequency in Hz (only used for open-loop gain)
+ /// RI = input resistance in Ohms
+ /// RO = output resistance in Ohms
+ ///
+ /// Type 3 parameters:
+ /// VLH = high supply rail minus high output swing in V
+ /// VLL = low output swing minus low supply rail in V
+ /// FPF = frequency of first pole in Hz
+ /// UGF = unity gain frequency (transition frequency) in Hz
+ /// SLEW = unity gain slew rate in V/s
+ /// RI = input resistance in Ohms
+ /// RO = output resistance in Ohms
+ /// DAB = Differential Amp Bias ~ op amp's total quiescent current.
+ ///
+ /// .model abc OPAMP(VLH=2.0 VLL=0.2 FPF=5 UGF=10k SLEW=0.6u RI=1000k RO=50 DAB=0.002)
+ ///
+ /// http://www.ecircuitcenter.com/Circuits/opmodel1/opmodel1.htm
+ ///
+ ///
class opamp_model_t : public param_model_t
{
public:
@@ -192,7 +188,7 @@ namespace netlist
analog_output_t m_VL;
analog_output_t m_VREF;
- /* state */
+ // state
int m_type;
};
diff --git a/src/lib/netlist/analog/nld_opamps.h b/src/lib/netlist/analog/nld_opamps.h
index d20fc0515dc..aa59eb3d442 100644
--- a/src/lib/netlist/analog/nld_opamps.h
+++ b/src/lib/netlist/analog/nld_opamps.h
@@ -1,13 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * nld_opamps.h
- *
- */
#ifndef NLD_OPAMPS_H_
#define NLD_OPAMPS_H_
+///
+/// \file nld_opamps.h
+///
+
#include "netlist/nl_setup.h"
// ----------------------------------------------------------------------------------------
@@ -19,4 +19,4 @@
NETDEV_PARAMI(name, MODEL, model)
-#endif /* NLD_OPAMPS_H_ */
+#endif // NLD_OPAMPS_H_
diff --git a/src/lib/netlist/analog/nld_switches.cpp b/src/lib/netlist/analog/nld_switches.cpp
index 09bf62d29de..9861b4fd1e5 100644
--- a/src/lib/netlist/analog/nld_switches.cpp
+++ b/src/lib/netlist/analog/nld_switches.cpp
@@ -1,16 +1,12 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * nld_legacy.c
- *
- */
#include "nlid_twoterm.h"
#include "netlist/nl_base.h"
#include "netlist/nl_factory.h"
#include "netlist/solver/nld_solver.h"
-/* FIXME : convert to parameters */
+// FIXME : convert to parameters
#define R_OFF (plib::reciprocal(exec().gmin()))
#define R_ON nlconst::magic(0.01)
diff --git a/src/lib/netlist/analog/nld_switches.h b/src/lib/netlist/analog/nld_switches.h
index 13be9372f52..969db12112b 100644
--- a/src/lib/netlist/analog/nld_switches.h
+++ b/src/lib/netlist/analog/nld_switches.h
@@ -1,13 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * nld_switches.h
- *
- */
#ifndef NLD_SWITCHES_H_
#define NLD_SWITCHES_H_
+///
+/// \file nld_switches.h
+///
+
#include "netlist/nl_setup.h"
// ----------------------------------------------------------------------------------------
@@ -20,4 +20,4 @@
#define SWITCH2(name) \
NET_REGISTER_DEV(SWITCH2, name)
-#endif /* NLD_SWITCHES_H_ */
+#endif // NLD_SWITCHES_H_
diff --git a/src/lib/netlist/analog/nld_twoterm.h b/src/lib/netlist/analog/nld_twoterm.h
index 39ad2dfc162..a1ebf8f4892 100644
--- a/src/lib/netlist/analog/nld_twoterm.h
+++ b/src/lib/netlist/analog/nld_twoterm.h
@@ -4,6 +4,10 @@
#ifndef NLD_TWOTERM_H_
#define NLD_TWOTERM_H_
+///
+/// \file nld_twoterm.h
+///
+
#include "netlist/nl_setup.h"
// -----------------------------------------------------------------------------
@@ -18,7 +22,7 @@
NET_REGISTER_DEV(POT, name) \
NETDEV_PARAMI(name, R, p_R)
-/* Does not have pin 3 connected */
+// Does not have pin 3 connected
#define POT2(name, p_R) \
NET_REGISTER_DEV(POT2, name) \
NETDEV_PARAMI(name, R, p_R)
@@ -32,7 +36,7 @@
NET_REGISTER_DEV(IND, name) \
NETDEV_PARAMI(name, L, p_L)
-/* Generic Diode */
+// Generic Diode
#define DIODE(name, model) \
NET_REGISTER_DEV(DIODE, name) \
NETDEV_PARAMI(name, MODEL, model)
@@ -64,4 +68,4 @@
#define IND_P(ind) ((ind) * 1e-12)
#endif
-#endif /* NLD_TWOTERM_H_ */
+#endif // NLD_TWOTERM_H_
diff --git a/src/lib/netlist/analog/nlid_fourterm.cpp b/src/lib/netlist/analog/nlid_fourterm.cpp
index 6cc4083d6b3..0450874c8de 100644
--- a/src/lib/netlist/analog/nlid_fourterm.cpp
+++ b/src/lib/netlist/analog/nlid_fourterm.cpp
@@ -1,9 +1,5 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * nld_fourterm.c
- *
- */
#include "netlist/solver/nld_solver.h"
#include "netlist/nl_factory.h"
@@ -36,7 +32,7 @@ NETLIB_RESET(VCCS)
NETLIB_UPDATE(VCCS)
{
- /* only called if connected to a rail net ==> notify the solver to recalculate */
+ // only called if connected to a rail net ==> notify the solver to recalculate
if (!m_IP.net().isRailNet())
m_IP.solve_now();
else if (!m_IN.net().isRailNet())
diff --git a/src/lib/netlist/analog/nlid_fourterm.h b/src/lib/netlist/analog/nlid_fourterm.h
index a977bdd5260..367a02f392f 100644
--- a/src/lib/netlist/analog/nlid_fourterm.h
+++ b/src/lib/netlist/analog/nlid_fourterm.h
@@ -1,40 +1,38 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * nlid_fourterm.h
- *
- */
#ifndef NLID_FOURTERM_H_
#define NLID_FOURTERM_H_
+///
+/// \file nlid_fourterm.h
+///
+
#include "netlist/nl_base.h"
#include "plib/putil.h"
namespace netlist {
- namespace analog {
+namespace analog {
// ----------------------------------------------------------------------------------------
// nld_VCCS
// ----------------------------------------------------------------------------------------
- /*
- * Voltage controlled current source
- *
- * IP ---+ +------> OP
- * | |
- * RI I
- * RI => G => I IOut = (V(IP)-V(IN)) * G
- * RI I
- * | |
- * IN ---+ +------< ON
- *
- * G=1 ==> 1V ==> 1A
- *
- * RI = 1 / NETLIST_GMIN
- *
- */
-
+ //
+ // Voltage controlled current source
+ //
+ // IP ---+ +------> OP
+ // | |
+ // RI I
+ // RI => G => I IOut = (V(IP)-V(IN)) * G
+ // RI I
+ // | |
+ // IN ---+ +------< ON
+ //
+ // G=1 ==> 1V ==> 1A
+ //
+ // RI = 1 / NETLIST_GMIN
+ //
NETLIB_OBJECT(VCCS)
{
public:
@@ -79,7 +77,7 @@ namespace netlist {
nl_fptype m_gfac;
};
- /* Limited Current source*/
+ // Limited Current source
NETLIB_OBJECT_DERIVED(LVCCS, VCCS)
{
@@ -99,7 +97,7 @@ namespace netlist {
NETLIB_UPDATE_TERMINALSI();
private:
- param_fp_t m_cur_limit; /* current limit */
+ param_fp_t m_cur_limit; // current limit
nl_fptype m_vi;
};
@@ -107,24 +105,23 @@ namespace netlist {
// nld_CCCS
// ----------------------------------------------------------------------------------------
- /*
- * Current controlled current source
- *
- * IP ---+ +------> OP
- * | |
- * RI I
- * RI => G => I IOut = (V(IP)-V(IN)) / RI * G
- * RI I
- * | |
- * IN ---+ +------< ON
- *
- * G=1 ==> 1A ==> 1A
- *
- * RI = 1
- *
- * This needs high levels of accuracy to work with 1 Ohm RI.
- *
- */
+ //
+ // Current controlled current source
+ //
+ // IP ---+ +------> OP
+ // | |
+ // RI I
+ // RI => G => I IOut = (V(IP)-V(IN)) / RI * G
+ // RI I
+ // | |
+ // IN ---+ +------< ON
+ //
+ // G=1 ==> 1A ==> 1A
+ //
+ // RI = 1
+ //
+ // This needs high levels of accuracy to work with 1 Ohm RI.
+ //
NETLIB_OBJECT_DERIVED(CCCS, VCCS)
{
@@ -146,29 +143,27 @@ namespace netlist {
// nld_VCVS
// ----------------------------------------------------------------------------------------
- /*
- * Voltage controlled voltage source
- *
- * Parameters:
- * G Default: 1
- * RO Default: 1 (would be typically 50 for an op-amp
- *
- * IP ---+ +--+---- OP
- * | | |
- * RI I RO
- * RI => G => I RO V(OP) - V(ON) = (V(IP)-V(IN)) * G
- * RI I RO
- * | | |
- * IN ---+ +--+---- ON
- *
- * G=1 ==> 1V ==> 1V
- *
- * RI = 1 / NETLIST_GMIN
- *
- * Internal GI = G / RO
- *
- */
-
+ //
+ // Voltage controlled voltage source
+ //
+ // Parameters:
+ // G Default: 1
+ // RO Default: 1 (would be typically 50 for an op-amp
+ //
+ // IP ---+ +--+---- OP
+ // | | |
+ // RI I RO
+ // RI => G => I RO V(OP) - V(ON) = (V(IP)-V(IN)) * G
+ // RI I RO
+ // | | |
+ // IN ---+ +--+---- ON
+ //
+ // G=1 ==> 1V ==> 1V
+ //
+ // RI = 1 / NETLIST_GMIN
+ //
+ // Internal GI = G / RO
+ //
NETLIB_OBJECT_DERIVED(VCVS, VCCS)
{
@@ -196,7 +191,7 @@ namespace netlist {
};
- } // namespace analog
+} // namespace analog
} // namespace netlist
-#endif /* NLD_FOURTERM_H_ */
+#endif // NLD_FOURTERM_H_
diff --git a/src/lib/netlist/analog/nlid_twoterm.cpp b/src/lib/netlist/analog/nlid_twoterm.cpp
index 82c4099c15c..f59c366f2ee 100644
--- a/src/lib/netlist/analog/nlid_twoterm.cpp
+++ b/src/lib/netlist/analog/nlid_twoterm.cpp
@@ -1,9 +1,5 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * nld_twoterm.c
- *
- */
#include "netlist/solver/nld_solver.h"
@@ -21,7 +17,7 @@ namespace netlist
void NETLIB_NAME(twoterm)::solve_now()
{
- /* we only need to call the non-rail terminal */
+ // we only need to call the non-rail terminal
if (m_P.has_net() && !m_P.net().isRailNet())
m_P.solve_now();
else if (m_N.has_net() && !m_N.net().isRailNet())
@@ -30,7 +26,7 @@ void NETLIB_NAME(twoterm)::solve_now()
void NETLIB_NAME(twoterm)::solve_later(netlist_time delay)
{
- /* we only need to call the non-rail terminal */
+ // we only need to call the non-rail terminal
if (m_P.has_net() && !m_P.net().isRailNet())
m_P.schedule_solve_after(delay);
else if (m_N.has_net() && !m_N.net().isRailNet())
@@ -40,7 +36,7 @@ void NETLIB_NAME(twoterm)::solve_later(netlist_time delay)
NETLIB_UPDATE(twoterm)
{
- /* only called if connected to a rail net ==> notify the solver to recalculate */
+ // only called if connected to a rail net ==> notify the solver to recalculate
solve_now();
}
@@ -132,12 +128,11 @@ NETLIB_UPDATE_PARAM(L)
NETLIB_TIMESTEP(L)
{
- /* Gpar should support convergence */
+ // Gpar should support convergence
m_I += m_I + m_G * deltaV();
m_G = step / m_L() + m_gmin;
set_mat( m_G, -m_G, -m_I,
-m_G, m_G, m_I);
- //set(m_G, 0.0, m_I);
}
// ----------------------------------------------------------------------------------------
diff --git a/src/lib/netlist/analog/nlid_twoterm.h b/src/lib/netlist/analog/nlid_twoterm.h
index 816729bb4af..d50fda77f39 100644
--- a/src/lib/netlist/analog/nlid_twoterm.h
+++ b/src/lib/netlist/analog/nlid_twoterm.h
@@ -1,38 +1,39 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * nld_twoterm.h
- *
- * Devices with two terminals ...
- *
- *
- * (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.
- *
- */
#ifndef NLID_TWOTERM_H_
#define NLID_TWOTERM_H_
+///
+/// \file nld_twoterm.h
+///
+/// Devices with two terminals ...
+///
+///
+/// (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.
+///
+////
+
#include "netlist/nl_base.h"
#include "netlist/nl_setup.h"
#include "netlist/solver/nld_solver.h"
@@ -91,7 +92,7 @@ namespace analog
void set_G_V_I(nl_fptype G, nl_fptype V, nl_fptype I) const noexcept
{
- /* GO, GT, I */
+ // GO, GT, I
m_P.set_go_gt_I( -G, G, ( V) * G - I);
m_N.set_go_gt_I( -G, G, ( -V) * G + I);
}
@@ -104,7 +105,7 @@ namespace analog
void set_mat(nl_fptype a11, nl_fptype a12, nl_fptype rhs1,
nl_fptype a21, nl_fptype a22, nl_fptype rhs2) const noexcept
{
- /* GO, GT, I */
+ // GO, GT, I
m_P.set_go_gt_I(a12, a11, rhs1);
m_N.set_go_gt_I(a21, a22, rhs2);
}
@@ -162,7 +163,7 @@ namespace analog
private:
param_fp_t m_R;
- /* protect set_R ... it's a recipe to desaster when used to bypass the parameter */
+ // protect set_R ... it's a recipe to desaster when used to bypass the parameter
using NETLIB_NAME(R_base)::set_R;
};
@@ -312,31 +313,30 @@ namespace analog
nl_fptype m_I;
};
- /*! Class representing the diode model paramers.
- * This is the model representation of the diode model. Typically, SPICE uses
- * the following parameters. A "Y" in the first column indicates that the
- * parameter is actually used in netlist.
- *
- * |NL? |name |parameter |units|default| example|area |
- * |:--:|:-----|:--------------------------------|:----|------:|-------:|:----:|
- * | Y |IS |saturation current |A |1.0e-14| 1.0e-14| * |
- * | |RS |ohmic resistance |Ohm | 0| 10| * |
- * | Y |N |emission coefficient |- | 1| 1| |
- * | |TT |transit-time |sec | 0| 0.1ns| |
- * | |CJO |zero-bias junction capacitance |F | 0| 2pF| * |
- * | |VJ |junction potential |V | 1| 0.6| |
- * | |M |grading coefficient |- | 0.5| 0.5| |
- * | |EG |band-gap energy |eV | 1.11| 1.11 Si| |
- * | |XTI |saturation-current temp.exp |- | 3|3.0 pn. 2.0 Schottky| |
- * | |KF |flicker noise coefficient |- | 0| | |
- * | |AF |flicker noise exponent |- | 1| | |
- * | |FC |coefficient for forward-bias depletion capacitance formula|-|0.5|| |
- * | |BV |reverse breakdown voltage |V |infinite| 40| |
- * | |IBV |current at breakdown voltage |V | 0.001| | |
- * | |TNOM |parameter measurement temperature|deg C| 27| 50| |
- *
- */
-
+ /// \brief Class representing the diode model paramers.
+ ///
+ /// This is the model representation of the diode model. Typically, SPICE uses
+ /// the following parameters. A "Y" in the first column indicates that the
+ /// parameter is actually used in netlist.
+ ///
+ /// |NL? |name |parameter |units|default| example|area |
+ /// |:--:|:-----|:--------------------------------|:----|------:|-------:|:----:|
+ /// | Y |IS |saturation current |A |1.0e-14| 1.0e-14| * |
+ /// | |RS |ohmic resistance |Ohm | 0| 10| * |
+ /// | Y |N |emission coefficient |- | 1| 1| |
+ /// | |TT |transit-time |sec | 0| 0.1ns| |
+ /// | |CJO |zero-bias junction capacitance |F | 0| 2pF| * |
+ /// | |VJ |junction potential |V | 1| 0.6| |
+ /// | |M |grading coefficient |- | 0.5| 0.5| |
+ /// | |EG |band-gap energy |eV | 1.11| 1.11 Si| |
+ /// | |XTI |saturation-current temp.exp |- | 3|3.0 pn. 2.0 Schottky| |
+ /// | |KF |flicker noise coefficient |- | 0| | |
+ /// | |AF |flicker noise exponent |- | 1| | |
+ /// | |FC |coefficient for forward-bias depletion capacitance formula|-|0.5|| |
+ /// | |BV |reverse breakdown voltage |V |infinite| 40| |
+ /// | |IBV |current at breakdown voltage |V | 0.001| | |
+ /// | |TNOM |parameter measurement temperature|deg C| 27| 50| |
+ ///
class diode_model_t : public param_model_t
{
public:
@@ -350,7 +350,6 @@ namespace analog
value_t m_N; //!< emission coefficient.
};
-
// -----------------------------------------------------------------------------
// nld_D
// -----------------------------------------------------------------------------
@@ -379,7 +378,6 @@ namespace analog
generic_diode<diode_e::BIPOLAR> m_D;
};
-
// -----------------------------------------------------------------------------
// nld_VS - Voltage source
//
@@ -491,8 +489,7 @@ namespace analog
std::vector<nl_fptype> m_funcparam;
};
-
} // namespace analog
} // namespace netlist
-#endif /* NLD_TWOTERM_H_ */
+#endif // NLD_TWOTERM_H_
diff --git a/src/lib/netlist/devices/net_lib.cpp b/src/lib/netlist/devices/net_lib.cpp
index a1c9eb36bbf..2b6070dc864 100644
--- a/src/lib/netlist/devices/net_lib.cpp
+++ b/src/lib/netlist/devices/net_lib.cpp
@@ -1,12 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/***************************************************************************
- netlib.c
-
- Discrete netlist implementation.
-
-****************************************************************************/
+// ***************************************************************************
+//
+// netlib.c
+//
+// Discrete netlist implementation.
+//
+// ***************************************************************************
#include "net_lib.h"
#include "netlist/nl_factory.h"
@@ -134,7 +135,7 @@ namespace devices
LIB_ENTRY(CD4316_GATE)
LIB_ENTRY(4538_dip)
LIB_ENTRY(schmitt_trigger)
- /* entries with suffix WI are legacy only */
+ // entries with suffix WI are legacy only
//ENTRY(4066, CD_4066, "+A,B")
LIB_ENTRY(NE555)
LIB_ENTRY(NE555_dip)
diff --git a/src/lib/netlist/devices/net_lib.h b/src/lib/netlist/devices/net_lib.h
index abf58ccee16..342733f6c82 100644
--- a/src/lib/netlist/devices/net_lib.h
+++ b/src/lib/netlist/devices/net_lib.h
@@ -1,16 +1,15 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/***************************************************************************
-
- net_lib.h
-
- Discrete netlist implementation.
-
-****************************************************************************/
#ifndef NET_LIB_H
#define NET_LIB_H
+///
+/// \file net_lib.h
+///
+/// Discrete netlist implementation.
+///
+
#include "netlist/nl_setup.h"
//#define NL_AUTO_DEVICES 1
diff --git a/src/lib/netlist/devices/nlid_truthtable.cpp b/src/lib/netlist/devices/nlid_truthtable.cpp
index 695370d0737..1eda00ed546 100644
--- a/src/lib/netlist/devices/nlid_truthtable.cpp
+++ b/src/lib/netlist/devices/nlid_truthtable.cpp
@@ -1,9 +1,5 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * nld_truthtable.c
- *
- */
#include "nlid_truthtable.h"
#include "netlist/nl_setup.h"
@@ -11,33 +7,37 @@
#include "plib/plists.h"
#include <bitset>
+#include <vector>
+#include <cstdint>
namespace netlist
{
- namespace devices
- {
+namespace devices
+{
// ----------------------------------------------------------------------------------------
// int compatible bitset ....
// ----------------------------------------------------------------------------------------
template <typename T>
- struct sbitset
+ struct pbitset
{
using type = T;
- sbitset() : m_bs(0) { }
- /* explicit */ sbitset(T v) : m_bs(v) { }
+ pbitset() noexcept : m_bs(0) { }
+ pbitset(T v) noexcept : m_bs(v) { }
- sbitset &set() { *this = all_bits(); return *this; }
- sbitset &set(const std::size_t bit) { m_bs |= (static_cast<T>(1) << bit); return *this; }
- sbitset &reset() { *this = no_bits(); return *this; }
- sbitset &reset(const std::size_t bit) { m_bs &= ~(static_cast<T>(1) << bit); return *this; }
+ pbitset &set() noexcept { *this = all_bits(); return *this; }
+ pbitset &set(std::size_t bit) noexcept { m_bs |= (static_cast<T>(1) << bit); return *this; }
+ pbitset &reset() noexcept { *this = no_bits(); return *this; }
+ pbitset &reset(std::size_t bit) noexcept { m_bs &= ~(static_cast<T>(1) << bit); return *this; }
- sbitset invert() const { return sbitset(~m_bs); }
- std::size_t count() const
+ pbitset flip() const noexcept { return pbitset(~m_bs); }
+ pbitset flip(std::size_t bit) const noexcept { return pbitset(m_bs ^ (static_cast<T>(1) << bit)); }
+
+ std::size_t count() const noexcept
{
- std::size_t ret = 0;
+ std::size_t ret(0);
for (T v = m_bs; v != 0; v = v >> 1)
{
ret += (v & 1);
@@ -46,23 +46,27 @@ namespace netlist
}
constexpr bool test(const std::size_t bit) const { return ((m_bs >> bit) & 1) == 1; }
- operator T&() { return m_bs; }
- operator const T&() const { return m_bs; }
- constexpr T as_uint() const { return m_bs; }
-
- constexpr bool all() const { return *this == all_bits(); }
-
- /*
- * And all bits set with compressed bits from b
- *
- * Example: b = {b3,b2,b1,b0}
- * v = {v7, 0, v5, 0, v3, v2, 0, 0}
- * Returns {v7 & b3, 0, v5 & b2, 0, v3 & b1, v2 & b0, 0, 0}
- */
-
- sbitset expand_and(sbitset b) const
+ operator T&() noexcept { return m_bs; }
+ operator const T&() const noexcept { return m_bs; }
+ constexpr T as_uint() const noexcept { return m_bs; }
+
+ constexpr bool all() const noexcept { return *this == all_bits(); }
+
+ /// \brief And all bits set with compressed bits from b
+ ///
+ /// Example:
+ ///
+ /// \code
+ /// b = {b3,b2,b1,b0}
+ /// v = {v7, 0, v5, 0, v3, v2, 0, 0}
+ /// return {v7 & b3, 0, v5 & b2, 0, v3 & b1, v2 & b0, 0, 0}
+ /// \endcode
+ ///
+ /// \returns pbitset
+ ///
+ pbitset expand_and(pbitset b) const noexcept
{
- sbitset ret;
+ pbitset ret;
T v( m_bs);
for (size_t i = 0; v != 0; v = v >> 1, ++i)
@@ -77,59 +81,58 @@ namespace netlist
return ret;
}
- static constexpr const sbitset all_bits() noexcept { return sbitset(~static_cast<T>(0)); }
- static constexpr const sbitset no_bits() noexcept{ return sbitset(static_cast<T>(0)); }
+ static constexpr const pbitset all_bits() noexcept { return pbitset(~static_cast<T>(0)); }
+ static constexpr const pbitset no_bits() noexcept{ return pbitset(static_cast<T>(0)); }
private:
T m_bs;
};
+
// ----------------------------------------------------------------------------------------
// Truthtable parsing ....
// ----------------------------------------------------------------------------------------
- //static const uint_least64_t all_set = ~(static_cast<uint_least64_t>(0));
-
- using tt_bitset = sbitset<uint_least64_t>;
+ using tt_bitset = pbitset<std::uint_least64_t>;
struct packed_int
{
- packed_int(void *data, std::size_t bits)
+ packed_int(void *data, std::size_t bits) noexcept
: m_data(data)
, m_size(bits)
{}
- void set(const size_t pos, const uint_least64_t val)
+ void set(size_t pos, std::uint_least64_t val) noexcept
{
switch (m_size)
{
- case 8: static_cast<uint_least8_t *>(m_data)[pos] = static_cast<uint_least8_t>(val); break;
- case 16: static_cast<uint_least16_t *>(m_data)[pos] = static_cast<uint_least16_t>(val); break;
- case 32: static_cast<uint_least32_t *>(m_data)[pos] = static_cast<uint_least32_t>(val); break;
- case 64: static_cast<uint_least64_t *>(m_data)[pos] = static_cast<uint_least64_t>(val); break;
+ case 8: static_cast<std::uint_least8_t *>(m_data)[pos] = static_cast<std::uint_least8_t>(val); break;
+ case 16: static_cast<std::uint_least16_t *>(m_data)[pos] = static_cast<std::uint_least16_t>(val); break;
+ case 32: static_cast<std::uint_least32_t *>(m_data)[pos] = static_cast<std::uint_least32_t>(val); break;
+ case 64: static_cast<std::uint_least64_t *>(m_data)[pos] = static_cast<std::uint_least64_t>(val); break;
default: { }
}
}
- uint_least64_t operator[] (size_t pos) const
+ std::uint_least64_t operator[] (size_t pos) const noexcept
{
switch (m_size)
{
- case 8: return static_cast<uint_least8_t *>(m_data)[pos];
- case 16: return static_cast<uint_least16_t *>(m_data)[pos];
- case 32: return static_cast<uint_least32_t *>(m_data)[pos];
- case 64: return static_cast<uint_least64_t *>(m_data)[pos];
+ case 8: return static_cast<std::uint_least8_t *>(m_data)[pos];
+ case 16: return static_cast<std::uint_least16_t *>(m_data)[pos];
+ case 32: return static_cast<std::uint_least32_t *>(m_data)[pos];
+ case 64: return static_cast<std::uint_least64_t *>(m_data)[pos];
default:
return 0; //should never happen
}
}
- uint_least64_t mask() const
+ std::uint_least64_t mask() const noexcept
{
switch (m_size)
{
- case 8: return static_cast<uint_least8_t>(-1);
- case 16: return static_cast<uint_least16_t>(-1);
- case 32: return static_cast<uint_least32_t>(-1);
- case 64: return static_cast<uint_least64_t>(-1);
+ case 8: return static_cast<std::uint_least8_t>(-1);
+ case 16: return static_cast<std::uint_least16_t>(-1);
+ case 32: return static_cast<std::uint_least32_t>(-1);
+ case 64: return static_cast<std::uint_least64_t>(-1);
default:
return 0; //should never happen
}
@@ -157,7 +160,7 @@ namespace netlist
private:
void parseline(unsigned cur, std::vector<pstring> list,
- tt_bitset state, uint_least64_t val, std::vector<uint_least8_t> &timing_index);
+ tt_bitset state, std::uint_least64_t val, std::vector<uint_least8_t> &timing_index);
tt_bitset calculate_ignored_inputs(tt_bitset i) const;
@@ -167,8 +170,6 @@ namespace netlist
uint_least8_t *m_timing;
netlist_time *m_timing_nt;
- /* additional values */
-
const std::size_t m_num_bits;
const std::size_t m_size;
@@ -193,11 +194,30 @@ namespace netlist
std::vector<pstring> outputs(plib::psplit(io[1], ","));
nl_assert_always(outputs.size() == m_NO, "output count wrong");
+#if !USE_TT_ALTERNATIVE
for (std::size_t i=0; i < m_NI; i++)
{
inout[i] = plib::trim(inout[i]);
m_I.emplace(i, *this, inout[i]);
}
+#else
+ for (std::size_t i=0; i < m_NI; i++)
+ {
+ inout[i] = plib::trim(inout[i]);
+ }
+ if (0 < m_NI) m_I.emplace(0, *this, inout[0]); //, nldelegate(&nld_truthtable_t<m_NI, m_NO>::update_N<0>, this));
+ if (1 < m_NI) m_I.emplace(1, *this, inout[1]); //, nldelegate(&nld_truthtable_t<m_NI, m_NO>::update_N<1>, this));
+ if (2 < m_NI) m_I.emplace(2, *this, inout[2]); //, nldelegate(&nld_truthtable_t<m_NI, m_NO>::update_N<2>, this));
+ if (3 < m_NI) m_I.emplace(3, *this, inout[3]); //, nldelegate(&nld_truthtable_t<m_NI, m_NO>::update_N<3>, this));
+ if (4 < m_NI) m_I.emplace(4, *this, inout[4]); //, nldelegate(&nld_truthtable_t<m_NI, m_NO>::update_N<4>, this));
+ if (5 < m_NI) m_I.emplace(5, *this, inout[5]); //, nldelegate(&nld_truthtable_t<m_NI, m_NO>::update_N<5>, this));
+ if (6 < m_NI) m_I.emplace(6, *this, inout[6]); //, nldelegate(&nld_truthtable_t<m_NI, m_NO>::update_N<6>, this));
+ if (7 < m_NI) m_I.emplace(7, *this, inout[7]); //, nldelegate(&nld_truthtable_t<m_NI, m_NO>::update_N<7>, this));
+ if (8 < m_NI) m_I.emplace(8, *this, inout[8]); //, nldelegate(&nld_truthtable_t<m_NI, m_NO>::update_N<8>, this));
+ if (9 < m_NI) m_I.emplace(9, *this, inout[9]); //, nldelegate(&nld_truthtable_t<m_NI, m_NO>::update_N<9>, this));
+ if (10 < m_NI) m_I.emplace(10, *this, inout[10]); //, nldelegate(&nld_truthtable_t<m_NI, m_NO>::update_N<10>, this));
+ if (11 < m_NI) m_I.emplace(11, *this, inout[11]); //, nldelegate(&nld_truthtable_t<m_NI, m_NO>::update_N<11>, this));
+#endif
for (std::size_t i=0; i < m_NO; i++)
{
outputs[i] = plib::trim(outputs[i]);
@@ -217,12 +237,12 @@ namespace netlist
// ----------------------------------------------------------------------------------------
template<unsigned m_NI, unsigned m_NO>
- class netlist_factory_truthtable_t : public netlist_base_factory_truthtable_t
+ class netlist_factory_truthtable_t : public factory::truthtable_base_element_t
{
public:
netlist_factory_truthtable_t(const pstring &name, const pstring &classname,
const pstring &def_param, const pstring &sourcefile)
- : netlist_base_factory_truthtable_t(name, classname, def_param, sourcefile)
+ : truthtable_base_element_t(name, classname, def_param, sourcefile)
{ }
unique_pool_ptr<device_t> Create(netlist_state_t &anetlist, const pstring &name) override
@@ -239,7 +259,7 @@ namespace netlist
desc_s.parse(m_desc);
}
- /* update truthtable family definitions */
+ // update truthtable family definitions
if (m_family_name != "")
m_family_desc = anetlist.setup().family_from_model(m_family_name);
@@ -259,33 +279,32 @@ namespace netlist
for (std::size_t j=0; j<m_NI; j++)
{
// if changing the input directly doesn't change outputs we can ignore
- if (m_out_state[state] == m_out_state[tt_bitset(state).set(j)])
+ if (m_out_state[state] == m_out_state[tt_bitset(state).flip(j)])
ignore.set(j);
}
- /* Check all permutations of ign
- * We have to remove those where the ignored inputs
- * may change the output
- */
-
+ // Check all permutations of ign
+ // We have to remove those where the ignored inputs
+ // may change the output
+ //
tt_bitset bits = tt_bitset().set(ignore.count());
std::vector<bool> t(bits);
// loop over all combinations of bits set in ignore
- for (uint_least64_t j=1; j < bits; j++)
+ for (std::uint_least64_t j = 1; j < bits; j++)
{
tt_bitset tign = ignore.expand_and(j);
t[j] = false;
- tt_bitset bitsk = tt_bitset().set(tign.count());
+ tt_bitset bitsk(tt_bitset().set(tign.count()));
// now loop over all combinations of the bits set currently set
- for (uint_least64_t k=0; k < bitsk; k++)
+ for (std::uint_least64_t k=0; k < bitsk; k++)
{
tt_bitset b = tign.expand_and(k);
// will any of the inputs ignored change the output if changed?
- if (m_out_state[state] != m_out_state[(state & tign.invert()) | b])
+ if (m_out_state[state] != m_out_state[state ^ b])
{
t[j] = true;
break;
@@ -293,15 +312,15 @@ namespace netlist
}
}
- /* find the ignore mask without potential for change with the most bits */
+ // find the ignore mask without potential for change with the most bits
- size_t jb=0;
- tt_bitset jm=0;
+ size_t jb(0);
+ tt_bitset jm(0);
- for (uint_least64_t j=1; j<bits; j++)
+ for (std::uint_least64_t j=1; j<bits; j++)
{
tt_bitset bj(j);
- size_t nb = bj.count();
+ size_t nb(bj.count());
if ((t[j] == false) && (nb>jb))
{
jb = nb;
@@ -316,11 +335,11 @@ namespace netlist
// ----------------------------------------------------------------------------------------
void truthtable_parser::parseline(unsigned cur, std::vector<pstring> list,
- tt_bitset state, uint_least64_t val, std::vector<uint_least8_t> &timing_index)
+ tt_bitset state, std::uint_least64_t val, std::vector<uint_least8_t> &timing_index)
{
pstring elem = plib::trim(list[cur]);
- uint_least64_t start = 0;
- uint_least64_t end = 0;
+ std::uint_least64_t start = 0;
+ std::uint_least64_t end = 0;
if (elem == "0")
{
@@ -339,7 +358,7 @@ void truthtable_parser::parseline(unsigned cur, std::vector<pstring> list,
}
else
nl_assert_always(false, "unknown input value (not 0, 1, or X)");
- for (uint_least64_t i = start; i <= end; i++)
+ for (std::uint_least64_t i = start; i <= end; i++)
{
tt_bitset nstate = state;
if (i==1)
@@ -392,11 +411,11 @@ void truthtable_parser::parse(const std::vector<pstring> &truthtable)
tt_bitset val = 0;
std::vector<uint_least8_t> tindex;
- /*
- * FIXME: evaluation of outputs should be done in parseline to
- * enable the use of inputs for output values, i.e. "I1" or "~I1"
- * in addition to "0" and "1".
- */
+ //
+ // FIXME: evaluation of outputs should be done in parseline to
+ // enable the use of inputs for output values, i.e. "I1" or "~I1"
+ // in addition to "0" and "1".
+
for (unsigned j=0; j<m_NO; j++)
{
pstring outs = plib::trim(out[j]);
@@ -426,7 +445,7 @@ void truthtable_parser::parse(const std::vector<pstring> &truthtable)
for (tt_bitset &x : ign)
x.set();
- for (uint_least64_t i=0; i < m_size; i++)
+ for (std::uint_least64_t i=0; i < m_size; i++)
{
if (ign[i].all()) // not yet visited
{
@@ -434,18 +453,18 @@ void truthtable_parser::parse(const std::vector<pstring> &truthtable)
ign[i] = tign;
- /* don't need to recalculate similar ones */
-
+ // don't need to recalculate similar ones
tt_bitset bitsk;
bitsk.set(tign.count());
- for (uint_least64_t k=0; k < bitsk; k++)
+ for (std::uint_least64_t k=0; k < bitsk; k++)
{
tt_bitset b = tign.expand_and(k);
- ign[(i & tign.invert()) | b] = tign;
+ ign[(i & tign.flip()) | b] = tign;
}
}
}
+
for (size_t i=0; i<m_size; i++)
{
if (m_out_state[i] == m_out_state.mask())
@@ -454,47 +473,52 @@ void truthtable_parser::parse(const std::vector<pstring> &truthtable)
}
}
-netlist_base_factory_truthtable_t::netlist_base_factory_truthtable_t(const pstring &name, const pstring &classname,
- const pstring &def_param, const pstring &sourcefile)
-: factory::element_t(name, classname, def_param, sourcefile), m_family_desc(family_TTL())
+} // namespace devices
+
+namespace factory
{
-}
-#define ENTRYY(n, m, s) case (n * 100 + m): \
- { using xtype = netlist_factory_truthtable_t<n, m>; \
- ret = plib::make_unique<xtype>(desc.name, desc.classname, desc.def_param, s); } break
+ truthtable_base_element_t::truthtable_base_element_t(const pstring &name, const pstring &classname,
+ const pstring &def_param, const pstring &sourcefile)
+ : factory::element_t(name, classname, def_param, sourcefile), m_family_desc(family_TTL())
+ {
+ }
-#define ENTRY(n, s) ENTRYY(n, 1, s); ENTRYY(n, 2, s); ENTRYY(n, 3, s); \
- ENTRYY(n, 4, s); ENTRYY(n, 5, s); ENTRYY(n, 6, s); \
- ENTRYY(n, 7, s); ENTRYY(n, 8, s)
+ #define ENTRYY(n, m, s) case (n * 100 + m): \
+ { using xtype = devices::netlist_factory_truthtable_t<n, m>; \
+ ret = plib::make_unique<xtype>(desc.name, desc.classname, desc.def_param, s); } break
-plib::unique_ptr<netlist_base_factory_truthtable_t> tt_factory_create(tt_desc &desc, const pstring &sourcefile)
-{
- plib::unique_ptr<netlist_base_factory_truthtable_t> ret;
+ #define ENTRY(n, s) ENTRYY(n, 1, s); ENTRYY(n, 2, s); ENTRYY(n, 3, s); \
+ ENTRYY(n, 4, s); ENTRYY(n, 5, s); ENTRYY(n, 6, s); \
+ ENTRYY(n, 7, s); ENTRYY(n, 8, s)
- switch (desc.ni * 100 + desc.no)
+ plib::unique_ptr<truthtable_base_element_t> truthtable_create(tt_desc &desc, const pstring &sourcefile)
{
- ENTRY(1, sourcefile);
- ENTRY(2, sourcefile);
- ENTRY(3, sourcefile);
- ENTRY(4, sourcefile);
- ENTRY(5, sourcefile);
- ENTRY(6, sourcefile);
- ENTRY(7, sourcefile);
- ENTRY(8, sourcefile);
- ENTRY(9, sourcefile);
- ENTRY(10, sourcefile);
- ENTRY(11, sourcefile);
- ENTRY(12, sourcefile);
- default:
- pstring msg = plib::pfmt("unable to create truthtable<{1},{2}>")(desc.ni)(desc.no);
- nl_assert_always(false, msg);
- }
- ret->m_desc = desc.desc;
- ret->m_family_name = desc.family;
+ plib::unique_ptr<truthtable_base_element_t> ret;
- return ret;
-}
+ switch (desc.ni * 100 + desc.no)
+ {
+ ENTRY(1, sourcefile);
+ ENTRY(2, sourcefile);
+ ENTRY(3, sourcefile);
+ ENTRY(4, sourcefile);
+ ENTRY(5, sourcefile);
+ ENTRY(6, sourcefile);
+ ENTRY(7, sourcefile);
+ ENTRY(8, sourcefile);
+ ENTRY(9, sourcefile);
+ ENTRY(10, sourcefile);
+ ENTRY(11, sourcefile);
+ ENTRY(12, sourcefile);
+ default:
+ pstring msg = plib::pfmt("unable to create truthtable<{1},{2}>")(desc.ni)(desc.no);
+ nl_assert_always(false, msg);
+ }
+ ret->m_desc = desc.desc;
+ ret->m_family_name = desc.family;
+
+ return ret;
+ }
- } //namespace devices
+} // namespace factory
} // namespace netlist
diff --git a/src/lib/netlist/devices/nlid_truthtable.h b/src/lib/netlist/devices/nlid_truthtable.h
index 00890eb302d..484928207cf 100644
--- a/src/lib/netlist/devices/nlid_truthtable.h
+++ b/src/lib/netlist/devices/nlid_truthtable.h
@@ -13,6 +13,8 @@
#include "netlist/nl_setup.h"
#include "plib/putil.h"
+#define USE_TT_ALTERNATIVE (0)
+
namespace netlist
{
namespace devices
@@ -65,6 +67,9 @@ namespace devices
truthtable_t &ttp, const std::vector<pstring> &desc)
: device_t(owner, name)
, m_fam(*this, fam)
+#if USE_TT_ALTERNATIVE
+ , m_state(*this, "m_state", 0)
+#endif
, m_ign(*this, "m_ign", 0)
, m_ttp(ttp)
/* FIXME: the family should provide the names of the power-terminals! */
@@ -79,19 +84,45 @@ namespace devices
{
int active_outputs = 0;
m_ign = 0;
- for (auto &i : m_I)
- i.activate();
+#if USE_TT_ALTERNATIVE
+ m_state = 0;
+#endif
+ for (std::size_t i = 0; i < m_NI; ++i)
+ {
+ m_I[i].activate();
+#if USE_TT_ALTERNATIVE
+ m_state |= (m_I[i]() << i);
+#endif
+ }
for (auto &q : m_Q)
if (q.has_net() && q.net().num_cons() > 0)
active_outputs++;
set_active_outputs(active_outputs);
}
+ // update is only called during startup here ...
NETLIB_UPDATEI()
{
+#if USE_TT_ALTERNATIVE
+ m_state = 0;
+ for (std::size_t i = 0; i < m_NI; ++i)
+ {
+ m_state |= (m_I[i]() << i);
+ }
+#endif
process<true>();
}
+#if USE_TT_ALTERNATIVE
+ template <std::size_t N>
+ void update_N() noexcept
+ {
+ m_state &= ~(1<<N);
+ m_state |= (m_I[N]() << N);
+ process<true>();
+ }
+#endif
+
void inc_active() noexcept override
{
process<false>();
@@ -104,9 +135,6 @@ namespace devices
m_ign = (1<<m_NI)-1;
}
- plib::uninitialised_array_t<logic_input_t, m_NI> m_I;
- plib::uninitialised_array_t<logic_output_t, m_NO> m_Q;
-
protected:
private:
@@ -115,17 +143,29 @@ namespace devices
void process() noexcept
{
netlist_time mt(netlist_time::zero());
-
type_t nstate(0);
type_t ign(m_ign);
if (doOUT)
{
+#if !USE_TT_ALTERNATIVE
for (auto I = m_I.begin(); ign != 0; ign >>= 1, ++I)
if (ign & 1)
I->activate();
for (std::size_t i = 0; i < m_NI; i++)
nstate |= (m_I[i]() << i);
+#else
+ nstate = m_state;
+ for (std::size_t i = 0; ign != 0; ign >>= 1, ++i)
+ {
+ if (ign & 1)
+ {
+ nstate &= ~(1 << i);
+ m_I[i].activate();
+ nstate |= (m_I[i]() << i);
+ }
+ }
+#endif
}
else
for (std::size_t i = 0; i < m_NI; i++)
@@ -155,19 +195,32 @@ namespace devices
for (auto I = m_I.begin(); ign != 0; ign >>= 1, ++I)
if (ign & 1)
I->inactivate();
+#if USE_TT_ALTERNATIVE
+ m_state = nstate;
+#endif
}
+ plib::uninitialised_array_t<logic_input_t, m_NI> m_I;
+ plib::uninitialised_array_t<logic_output_t, m_NO> m_Q;
+
/* FIXME: check width */
+#if USE_TT_ALTERNATIVE
+ state_var<type_t> m_state;
+#endif
state_var<type_t> m_ign;
const truthtable_t &m_ttp;
/* FIXME: the family should provide the names of the power-terminals! */
nld_power_pins m_power_pins;
};
- class netlist_base_factory_truthtable_t : public factory::element_t
+} // namespace devices
+
+namespace factory
+{
+ class truthtable_base_element_t : public factory::element_t
{
public:
- netlist_base_factory_truthtable_t(const pstring &name, const pstring &classname,
+ truthtable_base_element_t(const pstring &name, const pstring &classname,
const pstring &def_param, const pstring &sourcefile);
std::vector<pstring> m_desc;
@@ -175,12 +228,12 @@ namespace devices
const logic_family_desc_t *m_family_desc;
};
- /* the returned element is still missing a pointer to the family ... */
- plib::unique_ptr<netlist_base_factory_truthtable_t> tt_factory_create(tt_desc &desc, const pstring &sourcefile);
+ // FIXME: the returned element is missing a pointer to the family ...
+ plib::unique_ptr<truthtable_base_element_t> truthtable_create(tt_desc &desc, const pstring &sourcefile);
-} //namespace devices
+} // namespace factory
} // namespace netlist
-#endif /* NLID_TRUTHTABLE_H_ */
+#endif // NLID_TRUTHTABLE_H_
diff --git a/src/lib/netlist/documentation/mainpage.dox.h b/src/lib/netlist/documentation/mainpage.dox.h
index cfe098845ed..053271f64ae 100644
--- a/src/lib/netlist/documentation/mainpage.dox.h
+++ b/src/lib/netlist/documentation/mainpage.dox.h
@@ -1,12 +1,10 @@
-/*
- * Documentation settings
- */
-
-/*!
- *
- * \mainpage Netlist
-
+//
+// Documentation settings
+//
+///
+/// \mainpage Netlist
+///
##Netlist
diff --git a/src/lib/netlist/documentation/structure.dox.h b/src/lib/netlist/documentation/structure.dox.h
index d284208a51b..9d49656e161 100644
--- a/src/lib/netlist/documentation/structure.dox.h
+++ b/src/lib/netlist/documentation/structure.dox.h
@@ -12,12 +12,11 @@
///
/// The define statements below thus show the default value.
///
-///@{
-///@}
+///\{
+///\}
/// \brief The netlist namespace.
/// All netlist related code is contained in the netlist namespace
-
namespace netlist
{
/// \brief The netlist::devices namespace.
@@ -26,6 +25,20 @@ namespace netlist
{
}
+ /// \brief The netlist::analog namespace.
+ /// Netlist analog devices and related code are contained in the
+ /// netlist::analog namespace.
+ namespace analog
+ {
+ }
+
+ /// \brief The netlist::solver namespace.
+ /// All linear equation solving code and related code is contained in the
+ /// netlist::solver namespace.
+ namespace solver
+ {
+ }
+
/// \brief Internal support classes you should not use in code using netlist api.
/// This namespace contains all internal support classes not intended
/// to be used outside of the core.
diff --git a/src/lib/netlist/nl_config.h b/src/lib/netlist/nl_config.h
index 72926478a50..8737dc7ae69 100644
--- a/src/lib/netlist/nl_config.h
+++ b/src/lib/netlist/nl_config.h
@@ -10,7 +10,7 @@
#include "plib/pconfig.h"
/// \addtogroup compiledefine
-/// @{
+/// \{
//============================================================
// GENERAL
@@ -107,7 +107,7 @@ static constexpr const auto NETLIST_INTERNAL_RES = 1000000000;
// FIXME: Belongs into MAME netlist.h
static constexpr const auto NETLIST_CLOCK = NETLIST_INTERNAL_RES;
-/// @}
+/// \}
/// \brief Floating point types used
///
@@ -127,7 +127,7 @@ namespace netlist
{
/// \brief Specific constants depending on floating type
///
- /// @tparam FT floating point type: double/float
+ /// \tparam FT floating point type: double/float
///
template <typename FT>
struct fp_constants
diff --git a/src/lib/netlist/nl_parser.cpp b/src/lib/netlist/nl_parser.cpp
index 3db19416193..92473fcdb74 100644
--- a/src/lib/netlist/nl_parser.cpp
+++ b/src/lib/netlist/nl_parser.cpp
@@ -185,7 +185,7 @@ void parser_t::net_truthtable_start(const pstring &nlname)
require_token(token, m_tok_TRUTHTABLE_END);
require_token(m_tok_param_left);
require_token(m_tok_param_right);
- m_setup.tt_factory_create(desc, nlname);
+ m_setup.truthtable_create(desc, nlname);
return;
}
}
diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp
index 61672b5b73f..dff5606dc40 100644
--- a/src/lib/netlist/nl_setup.cpp
+++ b/src/lib/netlist/nl_setup.cpp
@@ -184,9 +184,9 @@ namespace netlist
register_link(attach, frontier_name + ".Q");
}
- void nlparse_t::tt_factory_create(tt_desc &desc, const pstring &sourcefile)
+ void nlparse_t::truthtable_create(tt_desc &desc, const pstring &sourcefile)
{
- auto fac = devices::tt_factory_create(desc, sourcefile);
+ auto fac = factory::truthtable_create(desc, sourcefile);
m_factory.register_device(std::move(fac));
}
diff --git a/src/lib/netlist/nl_setup.h b/src/lib/netlist/nl_setup.h
index caa25c6092f..98a25be69c2 100644
--- a/src/lib/netlist/nl_setup.h
+++ b/src/lib/netlist/nl_setup.h
@@ -65,6 +65,7 @@
#define NETLIST_START(name) \
void NETLIST_NAME(name)(netlist::nlparse_t &setup) \
{
+
#define NETLIST_END() }
#define LOCAL_SOURCE(name) \
@@ -109,7 +110,7 @@ void NETLIST_NAME(name)(netlist::nlparse_t &setup) \
desc.family = x;
#define TRUTHTABLE_END() \
- setup.tt_factory_create(desc, __FILE__); \
+ setup.truthtable_create(desc, __FILE__); \
}
namespace netlist
@@ -270,7 +271,7 @@ namespace netlist
m_sources.add_source(std::move(src));
}
- void tt_factory_create(tt_desc &desc, const pstring &sourcefile);
+ void truthtable_create(tt_desc &desc, const pstring &sourcefile);
// handle namespace
diff --git a/src/lib/netlist/nltypes.h b/src/lib/netlist/nltypes.h
index 2cebef3b428..308afccfa59 100644
--- a/src/lib/netlist/nltypes.h
+++ b/src/lib/netlist/nltypes.h
@@ -25,20 +25,20 @@
namespace netlist
{
- /// @brief plib::constants struct specialized for nl_fptype.
+ /// \brief plib::constants struct specialized for nl_fptype.
///
struct nlconst : public plib::constants<nl_fptype>
{
};
- /// @brief netlist_sig_t is the type used for logic signals.
+ /// \brief netlist_sig_t is the type used for logic signals.
///
- /// This may be any of bool, uint8_t, uint16_t, uin32_t and uint64_t.
- /// The choice has little to no impact on performance.
+ /// This may be any of bool, uint8_t, uint16_t, uin32_t and uint64_t.
+ /// The choice has little to no impact on performance.
///
using netlist_sig_t = std::uint32_t;
- /// @brief Interface definition for netlist callbacks into calling code
+ /// \brief Interface definition for netlist callbacks into calling code
///
/// A class inheriting from netlist_callbacks_t has to be passed to the netlist_t
/// constructor. Netlist does processing during construction and thus needs
diff --git a/src/lib/netlist/plib/gmres.h b/src/lib/netlist/plib/gmres.h
index ab7e72bcb76..c1c03ea7bd9 100644
--- a/src/lib/netlist/plib/gmres.h
+++ b/src/lib/netlist/plib/gmres.h
@@ -1,13 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * gmres.h
- *
- */
#ifndef PLIB_GMRES_H_
#define PLIB_GMRES_H_
+///
+/// \file gmres.h
+///
+
#include "mat_cr.h"
#include "parray.h"
#include "pconfig.h"
@@ -206,9 +206,9 @@ namespace plib
plib::pmatrix_cr_t<FT, SIZE> m_mat;
};
- /* FIXME: hardcoding RESTART to 20 becomes an issue on very large
- * systems.
- */
+ // FIXME: hardcoding RESTART to 20 becomes an issue on very large
+ // systems.
+
template <typename FT, int SIZE, int RESTART = 80>
struct gmres_t
{
@@ -282,8 +282,8 @@ namespace plib
if (rho <= rho_delta || k == RESTART-1)
{
- /* Solve the system H * y = g */
- /* x += m_v[j] * m_y[j] */
+ // Solve the system H * y = g
+ // x += m_v[j] * m_y[j]
for (std::size_t i = k + 1; i-- > 0;)
{
auto tmp(m_g[i]);
@@ -310,27 +310,27 @@ namespace plib
template <typename OPS, typename VT, typename VRHS>
std::size_t solve(OPS &ops, VT &x, const VRHS & rhs, const std::size_t itr_max, float_type accuracy)
{
- /*-------------------------------------------------------------------------
- * The code below was inspired by code published by John Burkardt under
- * the LPGL here:
- *
- * http://people.sc.fsu.edu/~jburkardt/cpp_src/mgmres/mgmres.html
- *
- * The code below was completely written from scratch based on the pseudo code
- * found here:
- *
- * http://de.wikipedia.org/wiki/GMRES-Verfahren
- *
- * The Algorithm itself is described in
- *
- * Yousef Saad,
- * Iterative Methods for Sparse Linear Systems,
- * Second Edition,
- * SIAM, 20003,
- * ISBN: 0898715342,
- * LC: QA188.S17.
- *
- *------------------------------------------------------------------------*/
+ // -------------------------------------------------------------------------
+ // The code below was inspired by code published by John Burkardt under
+ // the LPGL here:
+ //
+ // http://people.sc.fsu.edu/~jburkardt/cpp_src/mgmres/mgmres.html
+ //
+ // The code below was completely written from scratch based on the pseudo code
+ // found here:
+ //
+ // http://de.wikipedia.org/wiki/GMRES-Verfahren
+ //
+ // The Algorithm itself is described in
+ //
+ // Yousef Saad,
+ // Iterative Methods for Sparse Linear Systems,
+ // Second Edition,
+ // SIAM, 20003,
+ // ISBN: 0898715342,
+ // LC: QA188.S17.
+ //
+ //------------------------------------------------------------------------
std::size_t itr_used = 0;
auto rho_delta(plib::constants<float_type>::zero());
@@ -341,16 +341,16 @@ namespace plib
if (m_use_more_precise_stop_condition)
{
- /* derive residual for a given delta x
- *
- * LU y = A dx
- *
- * ==> rho / accuracy = sqrt(y * y)
- *
- * This approach will approximate the iterative stop condition
- * based |xnew - xold| pretty precisely. But it is slow, or expressed
- * differently: The invest doesn't pay off.
- */
+ // derive residual for a given delta x
+ //
+ // LU y = A dx
+ //
+ // ==> rho / accuracy = sqrt(y * y)
+ //
+ // This approach will approximate the iterative stop condition
+ // based |xnew - xold| pretty precisely. But it is slow, or expressed
+ // differently: The invest doesn't pay off.
+ //
vec_set_scalar(n, residual, accuracy);
ops.calc_rhs(Ax, residual);
@@ -364,18 +364,17 @@ namespace plib
else
rho_delta = accuracy * plib::sqrt(static_cast<FT>(n));
- /*
- * Using
- *
- * vec_set(n, x, rhs);
- * ops.solve_inplace(x);
- *
- * to get a starting point for x degrades convergence speed compared
- * to using the last solution for x.
- *
- * LU x = b; solve for x;
- *
- */
+ //
+ // Using
+ //
+ // vec_set(n, x, rhs);
+ // ops.solve_inplace(x);
+ //
+ // to get a starting point for x degrades convergence speed compared
+ // to using the last solution for x.
+ //
+ // LU x = b; solve for x;
+ //
while (itr_used < itr_max)
{
@@ -392,10 +391,10 @@ namespace plib
if (rho < rho_delta)
return itr_used + 1;
- /* FIXME: The "+" is necessary to avoid link issues
- * on some systems / compiler versions. Issue reported by
- * AJR, no details known yet.
- */
+ // FIXME: The "+" is necessary to avoid link issues
+ // on some systems / compiler versions. Issue reported by
+ // AJR, no details known yet.
+
vec_set_scalar(RESTART+1, m_g, +constants<FT>::zero());
m_g[0] = rho;
@@ -415,14 +414,13 @@ namespace plib
plib::parray<float_type, SIZE> residual;
plib::parray<float_type, SIZE> Ax;
- plib::parray<float_type, RESTART + 1> m_c; /* mr + 1 */
- plib::parray<float_type, RESTART + 1> m_g; /* mr + 1 */
- plib::parray2D<float_type, RESTART + 1, RESTART> m_ht; /* (mr + 1), mr */
- plib::parray<float_type, RESTART + 1> m_s; /* mr + 1 */
- plib::parray<float_type, RESTART + 1> m_y; /* mr + 1 */
+ plib::parray<float_type, RESTART + 1> m_c; // mr + 1
+ plib::parray<float_type, RESTART + 1> m_g; // mr + 1
+ plib::parray2D<float_type, RESTART + 1, RESTART> m_ht; // (mr + 1), mr
+ plib::parray<float_type, RESTART + 1> m_s; // mr + 1
+ plib::parray<float_type, RESTART + 1> m_y; // mr + 1
- //plib::parray<plib::parray<float_type, storage_N>, RESTART + 1> m_v; /* mr + 1, n */
- plib::parray2D<float_type, RESTART + 1, SIZE> m_v; /* mr + 1, n */
+ plib::parray2D<float_type, RESTART + 1, SIZE> m_v; // mr + 1, n
std::size_t m_size;
@@ -433,12 +431,11 @@ namespace plib
#if 0
- /* Example of a Chebyshev iteration solver. This one doesn't work yet,
- * it needs to be extended for non-symmetric matrix operation and
- * depends on spectral radius estimates - which we don't have.
- *
- * Left here as another example.
- */
+ // Example of a Chebyshev iteration solver. This one doesn't work yet,
+ // it needs to be extended for non-symmetric matrix operation and
+ // depends on spectral radius estimates - which we don't have.
+ //
+ // Left here as another example.
template <typename FT, int SIZE>
struct ch_t
@@ -464,11 +461,6 @@ namespace plib
template <typename OPS, typename VT, typename VRHS>
std::size_t solve(OPS &ops, VT &x0, const VRHS & rhs, const std::size_t iter_max, float_type accuracy)
{
- /*-------------------------------------------------------------------------
- *
- *
- *------------------------------------------------------------------------*/
-
ops.precondition();
const FT lmax = 20.0;
@@ -531,4 +523,4 @@ namespace plib
} // namespace plib
-#endif /* PLIB_GMRES_H_ */
+#endif // PLIB_GMRES_H_
diff --git a/src/lib/netlist/plib/mat_cr.h b/src/lib/netlist/plib/mat_cr.h
index d87faef8225..9d885ffb884 100644
--- a/src/lib/netlist/plib/mat_cr.h
+++ b/src/lib/netlist/plib/mat_cr.h
@@ -1,15 +1,15 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * mat_cr.h
- *
- * Compressed row format matrices
- *
- */
#ifndef MAT_CR_H_
#define MAT_CR_H_
+///
+/// \file mat_cr.h
+///
+/// Compressed row format matrices
+///
+
#include "palloc.h"
#include "parray.h"
#include "pconfig.h"
@@ -132,7 +132,7 @@ namespace plib
row_idx[size()] = nz;
nz_num = nz;
- /* build nzbd */
+ // build nzbd
for (std::size_t k=0; k < size(); k++)
{
@@ -147,9 +147,8 @@ namespace plib
template <typename VTV, typename VTR>
void mult_vec(VTR & res, const VTV & x) const noexcept
{
- /*
- * res = A * x
- */
+
+ // res = A * x
#if 0
//plib::omp::set_num_threads(4);
plib::omp::for_static(0, constants<std::size_t>::zero(), m_size, [this, &res, &x](std::size_t row)
@@ -176,7 +175,7 @@ namespace plib
#endif
}
- /* throws error if P(source)>P(destination) */
+ // throws error if P(source)>P(destination)
template <typename LUMAT>
void slim_copy_from(LUMAT & src)
{
@@ -185,20 +184,20 @@ namespace plib
C dp = row_idx[r];
for (C sp = src.row_idx[r]; sp < src.row_idx[r+1]; sp++)
{
- /* advance dp to source column and fill 0s if necessary */
+ // advance dp to source column and fill 0s if necessary
while (col_idx[dp] < src.col_idx[sp])
A[dp++] = 0;
if (row_idx[r+1] <= dp || col_idx[dp] != src.col_idx[sp])
pthrow<pexception>("slim_copy_from error");
A[dp++] = src.A[sp];
}
- /* fill remaining elements in row */
+ // fill remaining elements in row
while (dp < row_idx[r+1])
A[dp++] = 0;
}
}
- /* only copies common elements */
+ // only copies common elements
template <typename LUMAT>
void reduction_copy_from(LUMAT & src) noexcept
{
@@ -208,7 +207,7 @@ namespace plib
C dp(row_idx[r]);
while(sp < src.row_idx[r+1])
{
- /* advance dp to source column and fill 0s if necessary */
+ // advance dp to source column and fill 0s if necessary
if (col_idx[dp] < src.col_idx[sp])
A[dp++] = 0;
else if (col_idx[dp] == src.col_idx[sp])
@@ -216,13 +215,13 @@ namespace plib
else
sp++;
}
- /* fill remaining elements in row */
+ // fill remaining elements in row
while (dp < row_idx[r+1])
A[dp++] = 0;
}
}
- /* no checks at all - may crash */
+ // no checks at all - may crash
template <typename LUMAT>
void raw_copy_from(LUMAT & src) noexcept
{
@@ -379,7 +378,7 @@ namespace plib
void gaussian_back_substitution(V1 &V, const V2 &RHS)
{
const std::size_t iN = base::size();
- /* row n-1 */
+ // row n-1
V[iN - 1] = RHS[iN - 1] / base::A[base::diag[iN - 1]];
for (std::size_t j = iN - 1; j-- > 0;)
@@ -397,7 +396,7 @@ namespace plib
void gaussian_back_substitution(V1 &V)
{
const std::size_t iN = base::size();
- /* row n-1 */
+ // row n-1
V[iN - 1] = V[iN - 1] / base::A[base::diag[iN - 1]];
for (std::size_t j = iN - 1; j-- > 0;)
@@ -492,7 +491,7 @@ namespace plib
void build(M &fill, std::size_t ilup)
{
std::size_t p(0);
- /* build ilu_rows */
+ // build ilu_rows
for (decltype(fill.size()) i=1; i < fill.size(); i++)
{
bool found(false);
@@ -526,25 +525,25 @@ namespace plib
m_ILUp = ilup;
}
+ /// \brief incomplete LU Factorization.
+ ///
+ /// We are following http://de.wikipedia.org/wiki/ILU-Zerlegung here.
+ ///
+ /// The result is stored in matrix LU
+ ///
+ /// For i = 1,...,N-1
+ /// For k = 0, ... , i - 1
+ /// If a[i,k] != 0
+ /// a[i,k] = a[i,k] / a[k,k]
+ /// For j = k + 1, ... , N - 1
+ /// If a[i,j] != 0
+ /// a[i,j] = a[i,j] - a[i,k] * a[k,j]
+ /// j=j+1
+ /// k=k+1
+ /// i=i+1
+ ///
void incomplete_LU_factorization(const base &mat)
{
- /*
- * incomplete LU Factorization according to http://de.wikipedia.org/wiki/ILU-Zerlegung
- *
- * Result is stored in matrix LU
- *
- * For i = 1,...,N-1
- * For k = 0, ... , i - 1
- * If a[i,k] != 0
- * a[i,k] = a[i,k] / a[k,k]
- * For j = k + 1, ... , N - 1
- * If a[i,j] != 0
- * a[i,j] = a[i,j] - a[i,k] * a[k,j]
- * j=j+1
- * k=k+1
- * i=i+1
- *
- */
if (m_ILUp < 1)
this->raw_copy_from(mat);
else
@@ -568,7 +567,7 @@ namespace plib
while (i_j < p_i_end && k_j < p_k_end ) // pj = (i, j)
{
- // we can assume that within a row ja increases continuously */
+ // we can assume that within a row ja increases continuously
const std::size_t c_i_j(base::col_idx[i_j]); // row i, column j
const auto c_k_j(base::col_idx[k_j]); // row k, column j
@@ -582,30 +581,32 @@ namespace plib
}
}
+
+ /// \brief Solve a linear equation
+ ///
+ /// Solve a linear equation Ax = r
+ ///
+ /// where
+ /// A = L*U
+ ///
+ /// L unit lower triangular
+ /// U upper triangular
+ ///
+ /// ==> LUx = r
+ ///
+ /// ==> Ux = L⁻¹ r = w
+ ///
+ /// ==> r = Lw
+ ///
+ /// This can be solved for w using backwards elimination in L.
+ ///
+ /// Now Ux = w
+ ///
+ /// This can be solved for x using backwards elimination in U.
+ ///
template <typename R>
void solveLU (R &r)
{
- /*
- * Solve a linear equation Ax = r
- * where
- * A = L*U
- *
- * L unit lower triangular
- * U upper triangular
- *
- * ==> LUx = r
- *
- * ==> Ux = L⁻¹ r = w
- *
- * ==> r = Lw
- *
- * This can be solved for w using backwards elimination in L.
- *
- * Now Ux = w
- *
- * This can be solved for x using backwards elimination in U.
- *
- */
for (std::size_t i = 1; i < base::size(); ++i )
{
typename base::value_type tmp(0);
@@ -634,4 +635,4 @@ namespace plib
} // namespace plib
-#endif /* MAT_CR_H_ */
+#endif // MAT_CR_H_
diff --git a/src/lib/netlist/plib/palloc.h b/src/lib/netlist/plib/palloc.h
index 2873d5a0be9..8b83a1970d6 100644
--- a/src/lib/netlist/plib/palloc.h
+++ b/src/lib/netlist/plib/palloc.h
@@ -1,13 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * palloc.h
- *
- */
#ifndef PALLOC_H_
#define PALLOC_H_
+///
+/// \file palloc.h
+///
+
#include "pconfig.h"
#include "pstring.h"
#include "ptypes.h"
@@ -59,9 +59,9 @@ namespace plib {
std::enable_if<std::is_convertible< U*, T*>::value>::type>
arena_deleter(const arena_deleter<PU, U> &rhs) : m_a(rhs.m_a) { }
#endif
- void operator()(T *p) noexcept //const
+ void operator()(T *p) noexcept
{
- /* call destructor */
+ // call destructor
p->~T();
getref(m_a).deallocate(p);
}
@@ -156,9 +156,9 @@ namespace plib {
m_ptr = nullptr;
}
- /**
- * \brief Return @c true if the stored pointer is not null.
- */
+ ///
+ /// \brief Return \c true if the stored pointer is not null.
+ ///
explicit operator bool() const noexcept { return m_ptr != nullptr; }
pointer release()
@@ -349,7 +349,7 @@ namespace plib {
};
template <typename T, std::size_t ALIGN>
- /*inline */ C14CONSTEXPR T *assume_aligned_ptr(T *p) noexcept
+ 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");
@@ -473,4 +473,4 @@ namespace plib {
} // namespace plib
-#endif /* PALLOC_H_ */
+#endif // PALLOC_H_
diff --git a/src/lib/netlist/plib/parray.h b/src/lib/netlist/plib/parray.h
index 174d047f35c..ea240faaac7 100644
--- a/src/lib/netlist/plib/parray.h
+++ b/src/lib/netlist/plib/parray.h
@@ -1,13 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * parray.h
- *
- */
#ifndef PARRAY_H_
#define PARRAY_H_
+///
+/// \file parray.h
+///
+
#include "palloc.h"
#include "pconfig.h"
#include "pexception.h"
@@ -36,21 +36,20 @@ namespace plib {
using container = typename std::vector<FT, aligned_allocator<FT, PALIGN_VECTOROPT>>;
};
- /**
- * \brief Array with preallocated or dynamic allocation
- *
- * Passing SIZE > 0 has the same functionality as a std::array.
- * SIZE = 0 is pure dynamic allocation, the actual array size is passed to the
- * constructor.
- * SIZE < 0 reserves abs(SIZE) elements statically in place allocated. The
- * actual size is passed in by the constructor.
- * This array is purely intended for HPC application where depending on the
- * architecture a preference dynamic/static has to be made.
- *
- * This struct is not intended to be a full replacement to std::array.
- * It is a subset to enable switching between dynamic and static allocation.
- * I consider > 10% performance difference to be a use case.
- */
+ /// \brief Array with preallocated or dynamic allocation.
+ ///
+ /// Passing SIZE > 0 has the same functionality as a std::array.
+ /// SIZE = 0 is pure dynamic allocation, the actual array size is passed to the
+ /// constructor.
+ /// SIZE < 0 reserves abs(SIZE) elements statically in place allocated. The
+ /// actual size is passed in by the constructor.
+ /// This array is purely intended for HPC application where depending on the
+ /// architecture a preference dynamic/static has to be made.
+ ///
+ /// This struct is not intended to be a full replacement to std::array.
+ /// It is a subset to enable switching between dynamic and static allocation.
+ /// I consider > 10% performance difference to be a use case.
+ ///
template <typename FT, int SIZE>
struct parray
@@ -96,7 +95,7 @@ namespace plib {
}
- /* allow construction in fixed size arrays */
+ // allow construction in fixed size arrays
parray()
: m_size(SIZEABS())
{
@@ -176,4 +175,4 @@ namespace plib {
-#endif /* PARRAY_H_ */
+#endif // PARRAY_H_
diff --git a/src/lib/netlist/plib/pchrono.h b/src/lib/netlist/plib/pchrono.h
index 63c21a419d3..640921e15d8 100644
--- a/src/lib/netlist/plib/pchrono.h
+++ b/src/lib/netlist/plib/pchrono.h
@@ -1,13 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * pchrono.h
- *
- */
#ifndef PCHRONO_H_
#define PCHRONO_H_
+///
+/// \file pchrono.h
+///
+
#include "pconfig.h"
#include "ptypes.h"
@@ -65,9 +65,9 @@ namespace plib {
"rdtscp;"
"shl $32, %%rdx;"
"or %%rdx, %%rax;"
- : "=a"(v) /* outputs */
- : /* inputs */
- : "%rcx", "%rdx" /* clobbers */
+ : "=a"(v) // outputs
+ : // inputs
+ : "%rcx", "%rdx" // clobbers
);
return v;
}
@@ -88,9 +88,9 @@ namespace plib {
"rdtsc;"
"shl $32, %%rdx;"
"or %%rdx, %%rax;"
- : "=a"(v) /* outputs */
- : /* inputs */
- : "%rdx" /* clobbers */
+ : "=a"(v) // outputs
+ : // inputs
+ : "%rdx" // clobbers
);
return v;
}
@@ -103,16 +103,14 @@ namespace plib {
#endif
- /* Based on "How to Benchmark Code Execution Times on Intel?? IA-32 and IA-64
- * Instruction Set Architectures", Intel, 2010
- *
- */
+ // Based on "How to Benchmark Code Execution Times on Intel?? IA-32 and IA-64
+ // Instruction Set Architectures", Intel, 2010
+
#if PUSE_ACCURATE_STATS && PHAS_RDTSCP
- /*
- * kills performance completely, but is accurate
- * cpuid serializes, but clobbers ebx and ecx
- *
- */
+ //
+ // kills performance completely, but is accurate
+ // cpuid serializes, but clobbers ebx and ecx
+ //
struct exact_ticks : public base_ticks<exact_ticks, int64_t>
{
@@ -127,9 +125,9 @@ namespace plib {
"rdtsc;"
"shl $32, %%rdx;"
"or %%rdx, %%rax;"
- : "=a"(v) /* outputs */
- : "a"(0x0) /* inputs */
- : "%ebx", "%ecx", "%rdx" /* clobbers*/
+ : "=a"(v) // outputs
+ : "a"(0x0) // inputs
+ : "%ebx", "%ecx", "%rdx" // clobbers
);
return v;
}
@@ -235,9 +233,9 @@ namespace plib {
{
guard_t() = default;
COPYASSIGNMOVE(guard_t, default)
- /* using default constructor will trigger warning on
- * unused local variable.
- */
+ // using default constructor will trigger warning on
+ // unused local variable.
+
// NOLINTNEXTLINE(modernize-use-equals-default)
~guard_t() { }
};
@@ -265,4 +263,4 @@ namespace plib {
using pperfcount_t = plib::chrono::counter<enabled_>;
} // namespace plib
-#endif /* PCHRONO_H_ */
+#endif // PCHRONO_H_
diff --git a/src/lib/netlist/plib/pconfig.h b/src/lib/netlist/plib/pconfig.h
index 58a9387c51c..bb954eefa48 100644
--- a/src/lib/netlist/plib/pconfig.h
+++ b/src/lib/netlist/plib/pconfig.h
@@ -1,102 +1,117 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * pconfig.h
- *
- */
#ifndef PCONFIG_H_
#define PCONFIG_H_
-/*
- * Define this for more accurate measurements if you processor supports
- * RDTSCP.
- */
+///
+/// \file pconfig.h
+///
+
+/// \brief More accurate measurements if you processor supports RDTSCP.
+///
#ifndef PHAS_RDTSCP
#define PHAS_RDTSCP (0)
#endif
-/*
- * Define this to use accurate timing measurements. Only works
- * if PHAS_RDTSCP == 1
- */
+/// \brief Use accurate timing measurements.
+///
+/// Only works if \ref PHAS_RDTSCP == 1
+///
#ifndef PUSE_ACCURATE_STATS
#define PUSE_ACCURATE_STATS (0)
#endif
-/*
- * Set this to one if you want to use 128 bit int for ptime.
- * This is about 5% slower on a kaby lake processor.
- */
-
+/// \brief System supports INT128
+///
+/// Set this to one if you want to use 128 bit int for ptime.
+/// This is about 5% slower on a kaby lake processor.
+///
#ifndef PHAS_INT128
#define PHAS_INT128 (0)
#endif
-/*! Add support for the __float128 floating point type.
- *
- *
- */
-
+/// \brief Add support for the __float128 floating point type.
+///
#ifndef PUSE_FLOAT128
#define PUSE_FLOAT128 (0)
#endif
-/*
- * OpenMP adds about 10% to 20% performance for analog
- * netlists like kidniki.
- */
-
+/// \brief Compile with support for OPENMP
+///
+/// OpenMP adds about 10% to 20% performance for analog netlists.
+///
#ifndef PUSE_OPENMP
#define PUSE_OPENMP (0)
#endif
-/*
- * Set this to one if you want to use aligned storage optimizations.
- */
-
+/// \brief Use aligned optimizations.
+///
+/// Set this to one if you want to use aligned storage optimizations.
+///
#ifndef PUSE_ALIGNED_OPTIMIZATIONS
#define PUSE_ALIGNED_OPTIMIZATIONS (0)
#endif
+/// \brief Use aligned allocations.
+///
+/// Set this to one if you want to use aligned storage optimizations.
+///
+/// Defaults to \ref PUSE_ALIGNED_OPTIMIZATIONS.
+///
#define PUSE_ALIGNED_ALLOCATION (PUSE_ALIGNED_OPTIMIZATIONS)
+
+/// \brief Use aligned hints.
+///
+/// Some compilers support special functions to mark a pointer as being
+/// aligned. Set this to one if you want to use these functions.
+///
+/// Defaults to \ref PUSE_ALIGNED_OPTIMIZATIONS.
+///
#define PUSE_ALIGNED_HINTS (PUSE_ALIGNED_OPTIMIZATIONS)
-/*
- * Standard alignment macros
- */
+/// \brief Number of bytes for cache line alignment
+///
#define PALIGN_CACHELINE (64)
+
+/// \brief Number of bytes for vector alignment
+///
#define PALIGN_VECTOROPT (64)
#define PALIGNAS_CACHELINE() PALIGNAS(PALIGN_CACHELINE)
#define PALIGNAS_VECTOROPT() PALIGNAS(PALIGN_VECTOROPT)
-/* Breaks mame build on windows due to -Wattribute
- * FIXME: no error on cross-compile - need further checks */
+// Breaks mame build on windows due to -Wattribute
+// FIXME: no error on cross-compile - need further checks
#if defined(_WIN32) && defined(__GNUC__)
#define PALIGNAS(x)
#else
#define PALIGNAS(x) alignas(x)
#endif
-/*============================================================
- * Check for CPP Version
- *
- * C++11: __cplusplus is 201103L.
- * C++14: __cplusplus is 201402L.
- * c++17/c++1z__cplusplus is 201703L.
- *
- * VS2015 returns 199711L here. This is the bug filed in
- * 2012 which obviously never was picked up by MS:
- * https://connect.microsoft.com/VisualStudio/feedback/details/763051/a-value-of-predefined-macro-cplusplus-is-still-199711l
- *
- *
- *============================================================*/
-
+/// \brief nvcc build flag.
+///
+/// Set this to 1 if you are building with NVIDIA nvcc
+///
#ifndef NVCCBUILD
#define NVCCBUILD (0)
#endif
+// ============================================================
+// Check for CPP Version
+//
+// C++11: __cplusplus is 201103L.
+// C++14: __cplusplus is 201402L.
+// c++17/c++1z__cplusplus is 201703L.
+//
+// VS2015 returns 199711L here. This is the bug filed in
+// 2012 which obviously never was picked up by MS:
+// https://connect.microsoft.com/VisualStudio/feedback/details/763051/a-value-of-predefined-macro-cplusplus-is-still-199711l
+//
+//
+//============================================================
+
+
#if NVCCBUILD
#define C14CONSTEXPR
#else
@@ -150,4 +165,4 @@ typedef __int128_t INT128;
#endif
-#endif /* PCONFIG_H_ */
+#endif // PCONFIG_H_
diff --git a/src/lib/netlist/plib/pdynlib.cpp b/src/lib/netlist/plib/pdynlib.cpp
index 828096d1b0c..a569d36dad5 100644
--- a/src/lib/netlist/plib/pdynlib.cpp
+++ b/src/lib/netlist/plib/pdynlib.cpp
@@ -1,9 +1,5 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * dynlib.c
- *
- */
#include "pdynlib.h"
diff --git a/src/lib/netlist/plib/pdynlib.h b/src/lib/netlist/plib/pdynlib.h
index b2fbb1487d2..b776d8e9b89 100644
--- a/src/lib/netlist/plib/pdynlib.h
+++ b/src/lib/netlist/plib/pdynlib.h
@@ -1,12 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * pdynlib.h
- */
#ifndef PDYNLIB_H_
#define PDYNLIB_H_
+///
+/// \file pdynlib.h
+///
+
#include "pstring.h"
#include "ptypes.h"
@@ -69,4 +70,4 @@ private:
} // namespace plib
-#endif /* PSTRING_H_ */
+#endif // PSTRING_H_
diff --git a/src/lib/netlist/plib/pexception.cpp b/src/lib/netlist/plib/pexception.cpp
index 1b32549be87..6b53d362c79 100644
--- a/src/lib/netlist/plib/pexception.cpp
+++ b/src/lib/netlist/plib/pexception.cpp
@@ -1,9 +1,5 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * palloc.c
- *
- */
#include "pexception.h"
#include "pfmtlog.h"
diff --git a/src/lib/netlist/plib/pexception.h b/src/lib/netlist/plib/pexception.h
index ba99b71cf73..7317a320e28 100644
--- a/src/lib/netlist/plib/pexception.h
+++ b/src/lib/netlist/plib/pexception.h
@@ -1,13 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * palloc.h
- *
- */
#ifndef PEXCEPTION_H_
#define PEXCEPTION_H_
+///
+/// \file: pexception.h
+///
+
#include "pstring.h"
#include "ptypes.h"
@@ -15,19 +15,18 @@
namespace plib {
- /*! Terminate the program.
- *
- * \note could be enhanced by setting a termination handler
- */
+ /// \brief Terminate the program.
+ ///
+ /// \note could be enhanced by setting a termination handler
+ ///
[[noreturn]] void terminate(const pstring &msg) noexcept;
-
- ///! throw an exception.
+ /// \brief throw an exception.
///
/// throws an exception E. The purpose is to clearly identify exception
/// throwing in the code
///
- /// @tparam E Type of exception to be thrown
+ /// \tparam E Type of exception to be thrown
///
template<typename E, typename... Args>
[[noreturn]] static inline void pthrow(Args&&... args) noexcept(false)
@@ -87,9 +86,9 @@ namespace plib {
explicit out_of_mem_e(const pstring &location);
};
- /* FIXME: currently only a stub for later use. More use could be added by
- * using “-fnon-call-exceptions" and sigaction to enable c++ exception supported.
- */
+ // FIXME: currently only a stub for later use. More use could be added by
+ // using “-fnon-call-exceptions" and sigaction to enable c++ exception supported.
+ //
class fpexception_e : public pexception
{
@@ -104,10 +103,8 @@ namespace plib {
static constexpr unsigned FP_INVALID = 0x00010;
static constexpr unsigned FP_ALL = 0x0001f;
- /*
- * Catch SIGFPE on linux for debugging purposes.
- */
-
+ /// \brief Catch SIGFPE on linux for debugging purposes.
+ ///
class fpsignalenabler
{
public:
@@ -117,9 +114,16 @@ namespace plib {
~fpsignalenabler();
- /* is the functionality supported ? */
+ /// \brief is the functionality supported.
+ ///
+ /// \return current status
+ ///
static bool supported();
- /* returns last global enable state */
+ /// \brief get/set global enable status
+ ///
+ /// \param enable new status
+ /// \return returns last global enable state
+ ///
static bool global_enable(bool enable);
private:
@@ -131,4 +135,4 @@ namespace plib {
} // namespace plib
-#endif /* PEXCEPTION_H_ */
+#endif // PEXCEPTION_H_
diff --git a/src/lib/netlist/plib/pfmtlog.cpp b/src/lib/netlist/plib/pfmtlog.cpp
index 8f6836fee0c..77a9034ac26 100644
--- a/src/lib/netlist/plib/pfmtlog.cpp
+++ b/src/lib/netlist/plib/pfmtlog.cpp
@@ -1,9 +1,5 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * pfm_log.cpp
- *
- */
#include "pfmtlog.h"
#include "palloc.h"
diff --git a/src/lib/netlist/plib/pfmtlog.h b/src/lib/netlist/plib/pfmtlog.h
index fecb3dd95bd..aaa43505293 100644
--- a/src/lib/netlist/plib/pfmtlog.h
+++ b/src/lib/netlist/plib/pfmtlog.h
@@ -1,8 +1,9 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * pfmtlog.h
- */
+
+///
+/// \file pfmtlog.h
+///
#ifndef PFMT_H_
#define PFMT_H_
@@ -310,7 +311,7 @@ public:
COPYASSIGNMOVE(pfmt_writer_t, delete)
- /* runtime enable */
+ // runtime enable
template<bool enabled, typename... Args>
void log(const pstring & fmt, Args&&... args) const noexcept
{
@@ -405,4 +406,4 @@ public:
template<typename T>
plib::pfmt& operator<<(plib::pfmt &p, T&& val) { return p(std::forward<T>(val)); }
-#endif /* PSTRING_H_ */
+#endif // PSTRING_H_
diff --git a/src/lib/netlist/plib/pfunction.cpp b/src/lib/netlist/plib/pfunction.cpp
index 44b037e827b..a1530a5590e 100644
--- a/src/lib/netlist/plib/pfunction.cpp
+++ b/src/lib/netlist/plib/pfunction.cpp
@@ -1,9 +1,5 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * palloc.c
- *
- */
#include "pfunction.h"
#include "pexception.h"
diff --git a/src/lib/netlist/plib/pfunction.h b/src/lib/netlist/plib/pfunction.h
index d62d79cc00d..643a8b1ae26 100644
--- a/src/lib/netlist/plib/pfunction.h
+++ b/src/lib/netlist/plib/pfunction.h
@@ -1,13 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * pfunction.h
- *
- */
#ifndef PFUNCTION_H_
#define PFUNCTION_H_
+///
+/// \file pfunction.h
+///
+
#include "pmath.h"
#include "pstate.h"
#include "pstring.h"
@@ -21,10 +21,10 @@ namespace plib {
// function evaluation
//============================================================
- /*! Class providing support for evaluating expressions
- *
- * @tparam NT Number type, should be float or double
- */
+ /// \brief Class providing support for evaluating expressions
+ ///
+ /// \tparam NT Number type, should be float or double
+ ///
template <typename NT>
class pfunction
{
@@ -37,7 +37,7 @@ namespace plib {
POW,
SIN,
COS,
- RAND, /* random number between 0 and 1 */
+ RAND, /// random number between 0 and 1
TRUNC,
PUSH_CONST,
PUSH_INPUT
@@ -49,52 +49,54 @@ namespace plib {
NT m_param;
};
public:
- /*! Constructor with state saving support
- *
- * @param name Name of this object
- * @param owner Owner of this object
- * @param state_manager State manager to handle saving object state
- *
- */
+
+ /// \brief Constructor with state saving support
+ ///
+ /// \param name Name of this object
+ /// \param owner Owner of this object
+ /// \param state_manager State manager to handle saving object state
+ ///
+ ///
pfunction(const pstring &name, const void *owner, state_manager_t &state_manager)
: m_lfsr(0xACE1u)
{
state_manager.save_item(owner, m_lfsr, name + ".lfsr");
}
- /*! Constructor without state saving support
- *
- */
+ /// \brief Constructor without state saving support
+ ///
pfunction()
: m_lfsr(0xACE1u)
{
}
- /*! Compile an expression
- *
- * @param inputs Vector of input variables, e.g. {"A","B"}
- * @param expr infix or postfix expression. default is infix, postrix
- * to be prefixed with rpn, e.g. "rpn:A B + 1.3 /"
- */
+ /// \brief Compile an expression
+ ///
+ /// \param inputs Vector of input variables, e.g. {"A","B"}
+ /// \param expr infix or postfix expression. default is infix, postrix
+ /// to be prefixed with rpn, e.g. "rpn:A B + 1.3 /"
+ ///
void compile(const std::vector<pstring> &inputs, const pstring &expr);
- /*! Compile a rpn expression
- *
- * @param inputs Vector of input variables, e.g. {"A","B"}
- * @param expr Reverse polish notation expression, e.g. "A B + 1.3 /"
- */
+ /// \brief Compile a rpn expression
+ ///
+ /// \param inputs Vector of input variables, e.g. {"A","B"}
+ /// \param expr Reverse polish notation expression, e.g. "A B + 1.3 /"
+ ///
void compile_postfix(const std::vector<pstring> &inputs, const pstring &expr);
- /*! Compile an infix expression
- *
- * @param inputs Vector of input variables, e.g. {"A","B"}
- * @param expr Infix expression, e.g. "(A+B)/1.3"
- */
+
+ /// \brief Compile an infix expression
+ ///
+ /// \param inputs Vector of input variables, e.g. {"A","B"}
+ /// \param expr Infix expression, e.g. "(A+B)/1.3"
+ ///
void compile_infix(const std::vector<pstring> &inputs, const pstring &expr);
- /*! Evaluate the expression
- *
- * @param values for input variables, e.g. {1.1, 2.2}
- * @return value of expression
- */
+
+ /// \brief Evaluate the expression
+ ///
+ /// \param values for input variables, e.g. {1.1, 2.2}
+ /// \return value of expression
+ ///
NT evaluate(const std::vector<NT> &values) noexcept;
private:
@@ -124,4 +126,4 @@ namespace plib {
#endif
} // namespace plib
-#endif /* PEXCEPTION_H_ */
+#endif // PEXCEPTION_H_
diff --git a/src/lib/netlist/plib/plists.h b/src/lib/netlist/plib/plists.h
index 792d157e837..8356d1d6199 100644
--- a/src/lib/netlist/plib/plists.h
+++ b/src/lib/netlist/plib/plists.h
@@ -1,13 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * plists.h
- *
- */
#ifndef PLISTS_H_
#define PLISTS_H_
+///
+/// \file plists.h
+///
+
#include "palloc.h"
#include "pchrono.h"
#include "pstring.h"
@@ -22,12 +22,12 @@
namespace plib {
- /**! fixed size array allowing to override constructor and initialize members by placement new.
- *
- * Use with care. This template is provided to improve locality of storage
- * in high frequency applications. It should not be used for anything else.
- *
- */
+ /// \brief fixed size array allowing to override constructor and initialize members by placement new.
+ ///
+ /// Use with care. This template is provided to improve locality of storage
+ /// in high frequency applications. It should not be used for anything else.
+ ///
+ ///
template <class C, std::size_t N>
class uninitialised_array_t
{
@@ -92,16 +92,16 @@ namespace plib {
private:
- /* ensure proper alignment */
+ // ensure proper alignment
PALIGNAS_VECTOROPT()
std::array<typename std::aligned_storage<sizeof(C), alignof(C)>::type, N> m_buf;
unsigned m_initialized;
};
- /**! a simple linked list.
- *
- * the list allows insertions deletions whilst being processed.
- */
+ /// \brief a simple linked list.
+ ///
+ /// The list allows insertions deletions whilst being processed.
+ ///
template <class LC>
class linkedlist_t
{
@@ -194,7 +194,7 @@ namespace plib {
elem->m_next->m_prev = elem->m_prev;
else
{
- /* update tail */
+ // update tail
}
}
@@ -292,7 +292,7 @@ namespace plib {
Element m_object;
};
- /* Use TS = true for a threadsafe queue */
+ // Use TS = true for a threadsafe queue
template <class T, bool TS>
class timed_queue_linear : nocopyassignmove
{
@@ -311,7 +311,7 @@ namespace plib {
void push(T && e) noexcept
{
#if 0
- /* Lock */
+ // Lock
lock_guard_type lck(m_lock);
T * i(m_end-1);
for (; *i < e; --i)
@@ -323,7 +323,7 @@ namespace plib {
*(i+1) = std::move(e);
++m_end;
#else
- /* Lock */
+ // Lock
lock_guard_type lck(m_lock);
T * i(m_end++);
*i = std::move(e);
@@ -344,7 +344,7 @@ namespace plib {
template <bool KEEPSTAT, class R>
void remove(const R &elem) noexcept
{
- /* Lock */
+ // Lock
lock_guard_type lck(m_lock);
if (KEEPSTAT)
m_prof_remove.inc();
@@ -362,7 +362,7 @@ namespace plib {
template <bool KEEPSTAT, class R>
void retime(R && elem) noexcept
{
- /* Lock */
+ // Lock
lock_guard_type lck(m_lock);
if (KEEPSTAT)
m_prof_retime.inc();
@@ -391,10 +391,10 @@ namespace plib {
{
lock_guard_type lck(m_lock);
m_end = &m_list[0];
- /* put an empty element with maximum time into the queue.
- * the insert algo above will run into this element and doesn't
- * need a comparison with queue start.
- */
+ // put an empty element with maximum time into the queue.
+ // the insert algo above will run into this element and doesn't
+ // need a comparison with queue start.
+ //
m_list[0] = T::never();
m_end++;
}
@@ -443,7 +443,7 @@ namespace plib {
template <bool KEEPSTAT>
void push(T &&e) noexcept
{
- /* Lock */
+ // Lock
lock_guard_type lck(m_lock);
*m_end++ = e;
std::push_heap(&m_list[0], m_end, compare());
@@ -464,7 +464,7 @@ namespace plib {
template <bool KEEPSTAT, class R>
void remove(const R &elem) noexcept
{
- /* Lock */
+ // Lock
lock_guard_type lck(m_lock);
if (KEEPSTAT)
m_prof_remove.inc();
@@ -484,7 +484,7 @@ namespace plib {
template <bool KEEPSTAT>
void retime(const T &elem) noexcept
{
- /* Lock */
+ // Lock
lock_guard_type lck(m_lock);
if (KEEPSTAT)
m_prof_retime.inc();
@@ -529,4 +529,4 @@ namespace plib {
} // namespace plib
-#endif /* PLISTS_H_ */
+#endif // PLISTS_H_
diff --git a/src/lib/netlist/plib/pmain.cpp b/src/lib/netlist/plib/pmain.cpp
index 1ecf0a4d032..d603baeb474 100644
--- a/src/lib/netlist/plib/pmain.cpp
+++ b/src/lib/netlist/plib/pmain.cpp
@@ -1,9 +1,5 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * pmain.cpp
- *
- */
#include "pmain.h"
@@ -29,10 +25,6 @@ namespace plib {
}
#endif
-/***************************************************************************
- Application
-***************************************************************************/
-
app::app()
: options()
, pout(&std::cout)
diff --git a/src/lib/netlist/plib/pmain.h b/src/lib/netlist/plib/pmain.h
index 288e3bc8536..afa5adb3267 100644
--- a/src/lib/netlist/plib/pmain.h
+++ b/src/lib/netlist/plib/pmain.h
@@ -1,13 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * poptions.h
- *
- */
#ifndef PMAIN_H_
#define PMAIN_H_
+///
+/// \file poptions.h
+///
+
#include "palloc.h"
#include "poptions.h"
#include "pstream.h"
@@ -27,10 +27,9 @@ int main(int argc, char **argv) { return plib::app::mainrun<appclass, char>(argc
namespace plib {
-/***************************************************************************
- Application
-***************************************************************************/
+ /// \brief Application class.
+ ///
class app : public options
{
public:
@@ -65,4 +64,4 @@ namespace plib {
-#endif /* PMAIN_H_ */
+#endif // PMAIN_H_
diff --git a/src/lib/netlist/plib/pmath.h b/src/lib/netlist/plib/pmath.h
index 1bfa12c5f26..9738994770d 100644
--- a/src/lib/netlist/plib/pmath.h
+++ b/src/lib/netlist/plib/pmath.h
@@ -1,13 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * pmath.h
- *
- */
#ifndef PMATH_H_
#define PMATH_H_
+///
+/// \file pmath.h
+///
+
#include "pconfig.h"
#include <algorithm>
@@ -21,13 +21,13 @@
namespace plib
{
- /*! Holds constants used repeatedly.
- *
- * @tparam T floating point type
- *
- * Using the structure members we can avoid magic numbers in the code.
- * In addition, this is a typesafe approach.
- */
+ /// \brief Holds constants used repeatedly.
+ ///
+ /// \tparam T floating point type
+ ///
+ /// Using the structure members we can avoid magic numbers in the code.
+ /// In addition, this is a typesafe approach.
+ ///
template <typename T>
struct constants
{
@@ -40,51 +40,50 @@ namespace plib
static inline constexpr T sqrt2() noexcept { return static_cast<T>(1.414213562373095048801688724209L); }
static inline constexpr T pi() noexcept { return static_cast<T>(3.14159265358979323846264338327950L); }
- /*!
- * \brief Electric constant of vacuum
- */
+ /// \brief Electric constant of vacuum
+ ///
static inline constexpr T eps_0() noexcept { return static_cast<T>(8.854187817e-12); }
- /*!
- * \brief Relative permittivity of Silicon dioxide
- */
+
+ // \brief Relative permittivity of Silicon dioxide
+ ///
static inline constexpr T eps_SiO2() noexcept { return static_cast<T>(3.9); }
- /*!
- * \brief Relative permittivity of Silicon
- */
+
+ /// \brief Relative permittivity of Silicon
+ ///
static inline constexpr T eps_Si() noexcept { return static_cast<T>(11.7); }
- /*!
- * \brief Boltzmann constant
- */
+
+ /// \brief Boltzmann constant
+ ///
static inline constexpr T k_b() noexcept { return static_cast<T>(1.38064852e-23); }
- /*!
- * \brief room temperature (gives VT = 0.02585 at T=300)
- */
+
+ /// \brief room temperature (gives VT = 0.02585 at T=300)
+ ///
static inline constexpr T T0() noexcept { return static_cast<T>(300); }
- /*!
- * \brief Elementary charge
- */
+
+ /// \brief Elementary charge
+ ///
static inline constexpr T Q_e() noexcept { return static_cast<T>(1.6021765314e-19); }
- /*!
- * \brief Intrinsic carrier concentration in 1/m^3 of Silicon
- */
+
+ /// \brief Intrinsic carrier concentration in 1/m^3 of Silicon
+ ///
static inline constexpr T NiSi() noexcept { return static_cast<T>(1.45e16); }
- /*!
- * \brief clearly identify magic numbers in code
- *
- * Magic numbers should be avoided. The magic member at least clearly
- * identifies them and makes it easier to convert them to named constants
- * later.
- */
+
+ /// \brief clearly identify magic numbers in code
+ ///
+ /// Magic numbers should be avoided. The magic member at least clearly
+ /// identifies them and makes it easier to convert them to named constants
+ /// later.
+ ///
template <typename V>
static inline constexpr const T magic(V &&v) noexcept { return static_cast<T>(v); }
};
- /*! typesafe reciprocal function
- *
- * @tparam T type of the argument
- * @param v argument
- * @return reciprocal of argument
- */
+ /// \brief typesafe reciprocal function
+ ///
+ /// \tparam T type of the argument
+ /// \param v argument
+ /// \return reciprocal of argument
+ ///
template <typename T>
static inline constexpr typename std::enable_if<std::is_floating_point<T>::value, T>::type
reciprocal(T v) noexcept
@@ -92,12 +91,12 @@ namespace plib
return constants<T>::one() / v;
}
- /*! abs function
- *
- * @tparam T type of the argument
- * @param v argument
- * @return absolute value of argument
- */
+ /// \brief abs function
+ ///
+ /// \tparam T type of the argument
+ /// \param v argument
+ /// \return absolute value of argument
+ ///
template <typename T>
static inline constexpr typename std::enable_if<std::is_floating_point<T>::value, T>::type
abs(T v) noexcept
@@ -105,12 +104,12 @@ namespace plib
return std::abs(v);
}
- /*! sqrt function
- *
- * @tparam T type of the argument
- * @param v argument
- * @return absolute value of argument
- */
+ /// \brief sqrt function
+ ///
+ /// \tparam T type of the argument
+ /// \param v argument
+ /// \return absolute value of argument
+ ///
template <typename T>
static inline constexpr typename std::enable_if<std::is_floating_point<T>::value, T>::type
sqrt(T v) noexcept
@@ -118,13 +117,13 @@ namespace plib
return std::sqrt(v);
}
- /*! hypot function
- *
- * @tparam T type of the arguments
- * @param v1 first argument
- * @param v2 second argument
- * @return sqrt(v1*v1+v2*v2)
- */
+ /// \brief hypot function
+ ///
+ /// \tparam T type of the arguments
+ /// \param v1 first argument
+ /// \param v2 second argument
+ /// \return sqrt(v1*v1+v2*v2)
+ ///
template <typename T>
static inline constexpr typename std::enable_if<std::is_floating_point<T>::value, T>::type
hypot(T v1, T v2) noexcept
@@ -132,12 +131,12 @@ namespace plib
return std::hypot(v1, v2);
}
- /*! exp function
- *
- * @tparam T type of the argument
- * @param v argument
- * @return exp(v)
- */
+ /// \brief exp function
+ ///
+ /// \tparam T type of the argument
+ /// \param v argument
+ /// \return exp(v)
+ ///
template <typename T>
static inline constexpr typename std::enable_if<std::is_floating_point<T>::value, T>::type
exp(T v) noexcept
@@ -145,12 +144,12 @@ namespace plib
return std::exp(v);
}
- /*! log function
- *
- * @tparam T type of the argument
- * @param v argument
- * @return log(v)
- */
+ /// \brief log function
+ ///
+ /// \tparam T type of the argument
+ /// \param v argument
+ /// \return log(v)
+ ///
template <typename T>
static inline constexpr typename std::enable_if<std::is_floating_point<T>::value, T>::type
log(T v) noexcept
@@ -158,12 +157,12 @@ namespace plib
return std::log(v);
}
- /*! tanh function
- *
- * @tparam T type of the argument
- * @param v argument
- * @return tanh(v)
- */
+ /// \brief tanh function
+ ///
+ /// \tparam T type of the argument
+ /// \param v argument
+ /// \return tanh(v)
+ ///
template <typename T>
static inline constexpr typename std::enable_if<std::is_floating_point<T>::value, T>::type
tanh(T v) noexcept
@@ -171,12 +170,12 @@ namespace plib
return std::tanh(v);
}
- /*! floor function
- *
- * @tparam T type of the argument
- * @param v argument
- * @return floor(v)
- */
+ /// \brief floor function
+ ///
+ /// \tparam T type of the argument
+ /// \param v argument
+ /// \return floor(v)
+ ///
template <typename T>
static inline constexpr typename std::enable_if<std::is_floating_point<T>::value, T>::type
floor(T v) noexcept
@@ -184,12 +183,12 @@ namespace plib
return std::floor(v);
}
- /*! log1p function
- *
- * @tparam T type of the argument
- * @param v argument
- * @return log(1 + v)
- */
+ /// \brief log1p function
+ ///
+ /// \tparam T type of the argument
+ /// \param v argument
+ /// \return log(1 + v)
+ ///
template <typename T>
static inline constexpr typename std::enable_if<std::is_floating_point<T>::value, T>::type
log1p(T v) noexcept
@@ -197,12 +196,12 @@ namespace plib
return std::log1p(v);
}
- /*! sin function
- *
- * @tparam T type of the argument
- * @param v argument
- * @return sin(v)
- */
+ /// \brief sin function
+ ///
+ /// \tparam T type of the argument
+ /// \param v argument
+ /// \return sin(v)
+ ///
template <typename T>
static inline constexpr typename std::enable_if<std::is_floating_point<T>::value, T>::type
sin(T v) noexcept
@@ -210,12 +209,12 @@ namespace plib
return std::sin(v);
}
- /*! cos function
- *
- * @tparam T type of the argument
- * @param v argument
- * @return cos(v)
- */
+ /// \brief cos function
+ ///
+ /// \tparam T type of the argument
+ /// \param v argument
+ /// \return cos(v)
+ ///
template <typename T>
static inline constexpr typename std::enable_if<std::is_floating_point<T>::value, T>::type
cos(T v) noexcept
@@ -223,12 +222,12 @@ namespace plib
return std::cos(v);
}
- /*! trunc function
- *
- * @tparam T type of the argument
- * @param v argument
- * @return trunc(v)
- */
+ /// \brief trunc function
+ ///
+ /// \tparam T type of the argument
+ /// \param v argument
+ /// \return trunc(v)
+ ///
template <typename T>
static inline constexpr typename std::enable_if<std::is_floating_point<T>::value, T>::type
trunc(T v) noexcept
@@ -236,16 +235,16 @@ namespace plib
return std::trunc(v);
}
- /*! pow function
- *
- * @tparam T1 type of the first argument
- * @tparam T2 type of the second argument
- * @param v argument
- * @param p power
- * @return v^p
- *
- * FIXME: limited implementation
- */
+ /// \brief pow function
+ ///
+ /// \tparam T1 type of the first argument
+ /// \tparam T2 type of the second argument
+ /// \param v argument
+ /// \param p power
+ /// \return v^p
+ ///
+ /// FIXME: limited implementation
+ ///
template <typename T1, typename T2>
static inline T1
pow(T1 v, T2 p) noexcept
@@ -334,4 +333,4 @@ namespace plib
} // namespace plib
-#endif /* PMATH_H_ */
+#endif // PMATH_H_
diff --git a/src/lib/netlist/plib/pmatrix2d.h b/src/lib/netlist/plib/pmatrix2d.h
index 435ef4d44b7..efa70da5b2a 100644
--- a/src/lib/netlist/plib/pmatrix2d.h
+++ b/src/lib/netlist/plib/pmatrix2d.h
@@ -1,15 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * pmatrix2d.h
- *
- * NxM regular matrix
- *
- */
#ifndef PMATRIX2D_H_
#define PMATRIX2D_H_
+///
+/// \file pmatrix2d.h
+///
+
#include "palloc.h"
#include <algorithm>
@@ -80,4 +78,4 @@ namespace plib
} // namespace plib
-#endif /* MAT_CR_H_ */
+#endif // PMATRIX2D_H_
diff --git a/src/lib/netlist/plib/pmempool.h b/src/lib/netlist/plib/pmempool.h
index 1d4bb52694d..59ca2d6f56c 100644
--- a/src/lib/netlist/plib/pmempool.h
+++ b/src/lib/netlist/plib/pmempool.h
@@ -1,13 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * pmempool.h
- *
- */
#ifndef PMEMPOOL_H_
#define PMEMPOOL_H_
+///
+/// \file pmempool.h
+///
+
#include "palloc.h"
#include "pstream.h"
#include "pstring.h"
@@ -231,4 +231,4 @@ namespace plib {
} // namespace plib
-#endif /* PMEMPOOL_H_ */
+#endif // PMEMPOOL_H_
diff --git a/src/lib/netlist/plib/pomp.h b/src/lib/netlist/plib/pomp.h
index 26e037bca1d..26dd6072c3d 100644
--- a/src/lib/netlist/plib/pomp.h
+++ b/src/lib/netlist/plib/pomp.h
@@ -1,14 +1,15 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * pomp.h
- *
- * Wrap all OPENMP stuff here in a hopefully c++ compliant way.
- */
#ifndef POMP_H_
#define POMP_H_
+///
+/// \file pomp.h
+///
+/// Wrap all OPENMP stuff here in a hopefully c++ compliant way.
+///
+
#include "pconfig.h"
#include "ptypes.h"
@@ -81,4 +82,4 @@ inline std::size_t get_max_threads() noexcept
} // namespace omp
} // namespace plib
-#endif /* PSTRING_H_ */
+#endif // PSTRING_H_
diff --git a/src/lib/netlist/plib/poptions.cpp b/src/lib/netlist/plib/poptions.cpp
index 941b55c5b94..6f6ace0599c 100644
--- a/src/lib/netlist/plib/poptions.cpp
+++ b/src/lib/netlist/plib/poptions.cpp
@@ -1,9 +1,5 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * poptions.cpp
- *
- */
#include "poptions.h"
#include "pexception.h"
@@ -11,9 +7,6 @@
#include "ptypes.h"
namespace plib {
-/***************************************************************************
- Options
-***************************************************************************/
option_base::option_base(options &parent, const pstring &help)
: m_help(help)
diff --git a/src/lib/netlist/plib/poptions.h b/src/lib/netlist/plib/poptions.h
index 8420cf7e587..15f43e0330e 100644
--- a/src/lib/netlist/plib/poptions.h
+++ b/src/lib/netlist/plib/poptions.h
@@ -1,252 +1,251 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * poptions.h
- *
- */
#ifndef POPTIONS_H_
#define POPTIONS_H_
+///
+/// \file poptions.h
+///
+
#include "plists.h"
#include "pstonum.h"
#include "pstring.h"
#include "putil.h"
namespace plib {
-/***************************************************************************
- Options
-***************************************************************************/
-class options;
+ /// \brief options base class
+ ///
+ class options;
-class option_base
-{
-public:
- option_base(options &parent, const pstring &help);
- virtual ~option_base() = default;
+ class option_base
+ {
+ public:
+ option_base(options &parent, const pstring &help);
+ virtual ~option_base() = default;
- COPYASSIGNMOVE(option_base, delete)
+ COPYASSIGNMOVE(option_base, delete)
- pstring help() const { return m_help; }
-private:
- pstring m_help;
-};
+ pstring help() const { return m_help; }
+ private:
+ pstring m_help;
+ };
-class option_group : public option_base
-{
-public:
- option_group(options &parent, const pstring &group, const pstring &help)
- : option_base(parent, help), m_group(group) { }
+ class option_group : public option_base
+ {
+ public:
+ option_group(options &parent, const pstring &group, const pstring &help)
+ : option_base(parent, help), m_group(group) { }
- pstring group() const { return m_group; }
-private:
- pstring m_group;
-};
+ pstring group() const { return m_group; }
+ private:
+ pstring m_group;
+ };
-class option_example : public option_base
-{
-public:
- option_example(options &parent, const pstring &group, const pstring &help)
- : option_base(parent, help), m_example(group) { }
+ class option_example : public option_base
+ {
+ public:
+ option_example(options &parent, const pstring &group, const pstring &help)
+ : option_base(parent, help), m_example(group) { }
- pstring example() const { return m_example; }
-private:
- pstring m_example;
-};
+ pstring example() const { return m_example; }
+ private:
+ pstring m_example;
+ };
-class option : public option_base
-{
-public:
- option(options &parent, const pstring &ashort, const pstring &along, const pstring &help, bool has_argument);
+ class option : public option_base
+ {
+ public:
+ option(options &parent, const pstring &ashort, const pstring &along, const pstring &help, bool has_argument);
- /* no_argument options will be called with "" argument */
+ // no_argument options will be called with "" argument
- pstring short_opt() const { return m_short; }
- pstring long_opt() const { return m_long; }
- bool has_argument() const { return m_has_argument ; }
- bool was_specified() const { return m_specified; }
+ pstring short_opt() const { return m_short; }
+ pstring long_opt() const { return m_long; }
+ bool has_argument() const { return m_has_argument ; }
+ bool was_specified() const { return m_specified; }
- int do_parse(const pstring &argument)
- {
- m_specified = true;
- return parse(argument);
- }
+ int do_parse(const pstring &argument)
+ {
+ m_specified = true;
+ return parse(argument);
+ }
-protected:
- virtual int parse(const pstring &argument) = 0;
+ protected:
+ virtual int parse(const pstring &argument) = 0;
-private:
- pstring m_short;
- pstring m_long;
- bool m_has_argument;
- bool m_specified;
-};
+ private:
+ pstring m_short;
+ pstring m_long;
+ bool m_has_argument;
+ bool m_specified;
+ };
-class option_str : public option
-{
-public:
- 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)
- {}
+ class option_str : public option
+ {
+ public:
+ 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)
+ {}
- pstring operator ()() const { return m_val; }
+ pstring operator ()() const { return m_val; }
-protected:
- int parse(const pstring &argument) override;
+ protected:
+ int parse(const pstring &argument) override;
-private:
- pstring m_val;
-};
+ private:
+ pstring m_val;
+ };
-class option_str_limit_base : public option
-{
-public:
- 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)
+ class option_str_limit_base : public option
{
- }
- const std::vector<pstring> &limit() const { return m_limit; }
+ public:
+ 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)
+ {
+ }
+ const std::vector<pstring> &limit() const { return m_limit; }
-protected:
+ protected:
-private:
- std::vector<pstring> m_limit;
-};
+ private:
+ std::vector<pstring> m_limit;
+ };
-template <typename T>
-class option_str_limit : public option_str_limit_base
-{
-public:
- 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)
+ template <typename T>
+ class option_str_limit : public option_str_limit_base
{
- }
-
- T operator ()() const { return m_val; }
+ public:
+ 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)
+ {
+ }
- pstring as_string() const { return limit()[m_val]; }
+ T operator ()() const { return m_val; }
-protected:
- int parse(const pstring &argument) override
- {
- auto raw = plib::container::indexof(limit(), argument);
+ pstring as_string() const { return limit()[m_val]; }
- if (raw != plib::container::npos)
+ protected:
+ int parse(const pstring &argument) override
{
- m_val = static_cast<T>(raw);
- return 0;
+ auto raw = plib::container::indexof(limit(), argument);
+
+ if (raw != plib::container::npos)
+ {
+ m_val = static_cast<T>(raw);
+ return 0;
+ }
+ else
+ return 1;
}
- else
- return 1;
- }
-private:
- T m_val;
-};
+ private:
+ T m_val;
+ };
-class option_bool : public option
-{
-public:
- option_bool(options &parent, const pstring &ashort, const pstring &along, const pstring &help)
- : option(parent, ashort, along, help, false), m_val(false)
- {}
+ class option_bool : public option
+ {
+ public:
+ option_bool(options &parent, const pstring &ashort, const pstring &along, const pstring &help)
+ : option(parent, ashort, along, help, false), m_val(false)
+ {}
- bool operator ()() const { return m_val; }
+ bool operator ()() const { return m_val; }
-protected:
- int parse(const pstring &argument) override;
+ protected:
+ int parse(const pstring &argument) override;
-private:
- bool m_val;
-};
+ private:
+ bool m_val;
+ };
-template <typename T>
-class option_num : public option
-{
-public:
- 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)
- , m_val(defval)
- , m_min(minval)
- , m_max(maxval)
- {}
-
- T operator ()() const { return m_val; }
-
-protected:
- int parse(const pstring &argument) override
+ template <typename T>
+ class option_num : public option
{
- bool err(false);
- m_val = pstonum_ne<T>(argument, err);
- return (err ? 1 : (m_val < m_min || m_val > m_max));
- }
+ public:
+ 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)
+ , m_val(defval)
+ , m_min(minval)
+ , m_max(maxval)
+ {}
+
+ T operator ()() const { return m_val; }
+
+ protected:
+ int parse(const pstring &argument) override
+ {
+ bool err(false);
+ m_val = pstonum_ne<T>(argument, err);
+ return (err ? 1 : (m_val < m_min || m_val > m_max));
+ }
-private:
- T m_val;
- T m_min;
- T m_max;
-};
+ private:
+ T m_val;
+ T m_min;
+ T m_max;
+ };
-class option_vec : public option
-{
-public:
- option_vec(options &parent, const pstring &ashort, const pstring &along, const pstring &help)
- : option(parent, ashort, along, help, true)
- {}
+ class option_vec : public option
+ {
+ public:
+ option_vec(options &parent, const pstring &ashort, const pstring &along, const pstring &help)
+ : option(parent, ashort, along, help, true)
+ {}
- const std::vector<pstring> &operator ()() const { return m_val; }
+ const std::vector<pstring> &operator ()() const { return m_val; }
-protected:
- int parse(const pstring &argument) override;
+ protected:
+ int parse(const pstring &argument) override;
-private:
- std::vector<pstring> m_val;
-};
+ private:
+ std::vector<pstring> m_val;
+ };
-class option_args : public option_vec
-{
-public:
- option_args(options &parent, const pstring &help)
- : option_vec(parent, "", "", help)
- {}
-};
+ class option_args : public option_vec
+ {
+ public:
+ option_args(options &parent, const pstring &help)
+ : option_vec(parent, "", "", help)
+ {}
+ };
-class options : public nocopyassignmove
-{
-public:
+ class options : public nocopyassignmove
+ {
+ public:
- options();
- explicit options(option **o);
+ options();
+ explicit options(option **o);
- void register_option(option_base *opt);
- int parse(int argc, char **argv);
+ void register_option(option_base *opt);
+ int parse(int argc, char **argv);
- pstring help(const pstring &description, const pstring &usage,
- unsigned width = 72, unsigned indent = 20) const;
+ pstring help(const pstring &description, const pstring &usage,
+ unsigned width = 72, unsigned indent = 20) const;
- pstring app() const { return m_app; }
+ pstring app() const { return m_app; }
-private:
- static pstring split_paragraphs(const pstring &text, unsigned width, unsigned indent,
- unsigned firstline_indent);
+ private:
+ static pstring split_paragraphs(const pstring &text, unsigned width, unsigned indent,
+ unsigned firstline_indent);
- void check_consistency();
+ void check_consistency();
- template <typename T>
- T *getopt_type() const
- {
- for (auto & optbase : m_opts )
+ template <typename T>
+ T *getopt_type() const
{
- if (auto opt = dynamic_cast<T *>(optbase))
- return opt;
- }
+ for (auto & optbase : m_opts )
+ {
+ if (auto opt = dynamic_cast<T *>(optbase))
+ return opt;
+ }
return nullptr;
}
@@ -260,4 +259,4 @@ private:
} // namespace plib
-#endif /* POPTIONS_H_ */
+#endif // POPTIONS_H_
diff --git a/src/lib/netlist/plib/ppmf.h b/src/lib/netlist/plib/ppmf.h
index 5875aeb0a13..bbbe95ded05 100644
--- a/src/lib/netlist/plib/ppmf.h
+++ b/src/lib/netlist/plib/ppmf.h
@@ -1,45 +1,44 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * ppmf.h
- *
- */
#ifndef PPMF_H_
#define PPMF_H_
+///
+/// \file ppmf.h
+///
+///
+/// PMF_TYPE_GNUC_PMF
+/// Use standard pointer to member function syntax C++11
+///
+/// PMF_TYPE_GNUC_PMF_CONV
+/// Use gnu extension and convert the pmf to a function pointer.
+/// This is not standard compliant and needs
+/// -Wno-pmf-conversions to compile.
+///
+/// PMF_TYPE_INTERNAL
+/// Use the same approach as MAME for deriving the function pointer.
+/// This is compiler-dependent as well
+///
+/// Benchmarks for ./nltool -c run -f src/mame/machine/nl_pong.cpp -t 10 -n pong_fast
+///
+/// PMF_TYPE_INTERNAL: 215% 215%
+/// PMF_TYPE_GNUC_PMF: 163% 196%
+/// PMF_TYPE_GNUC_PMF_CONV: 215% 215%
+/// PMF_TYPE_VIRTUAL: 213% 209%
+///
+/// The whole exercise was done to avoid virtual calls. In prior versions of
+/// netlist, the INTERNAL and GNUC_PMF_CONV approach provided significant improvement.
+/// Since than, "hot" was removed from functions declared as virtual.
+/// This may explain that the recent benchmarks show no difference at all.
+///
+
#include "pconfig.h"
#include <cstdint> // uintptr_t
#include <utility>
-/*
- *
- * PMF_TYPE_GNUC_PMF
- * Use standard pointer to member function syntax C++11
- *
- * PMF_TYPE_GNUC_PMF_CONV
- * Use gnu extension and convert the pmf to a function pointer.
- * This is not standard compliant and needs
- * -Wno-pmf-conversions to compile.
- *
- * PMF_TYPE_INTERNAL
- * Use the same approach as MAME for deriving the function pointer.
- * This is compiler-dependent as well
- *
- * Benchmarks for ./nltool -c run -f src/mame/machine/nl_pong.cpp -t 10 -n pong_fast
- *
- * PMF_TYPE_INTERNAL: 215% 215%
- * PMF_TYPE_GNUC_PMF: 163% 196%
- * PMF_TYPE_GNUC_PMF_CONV: 215% 215%
- * PMF_TYPE_VIRTUAL: 213% 209%
- *
- * The whole exercise was done to avoid virtual calls. In prior versions of
- * netlist, the INTERNAL and GNUC_PMF_CONV approach provided significant improvement.
- * Since than, "hot" was removed from functions declared as virtual.
- * This may explain that the recent benchmarks show no difference at all.
- *
- */
+
//============================================================
// Macro magic
@@ -52,7 +51,7 @@
#define PPMF_TYPE_INTERNAL 2
#if defined(__GNUC__)
- /* does not work in versions over 4.7.x of 32bit MINGW */
+ // does not work in versions over 4.7.x of 32bit MINGW
#if defined(__MINGW32__) && !defined(__x86_64) && defined(__i386__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)))
#define PHAS_PMF_INTERNAL 0
#elif defined(__MINGW32__) && !defined(__x86_64) && defined(__i386__)
@@ -98,12 +97,13 @@
#endif
namespace plib {
-/*
- * The following class was derived from the MAME delegate.h code.
- * It derives a pointer to a member function.
- */
#if (PHAS_PMF_INTERNAL > 0)
+ ///
+ /// \brief Used to derive a pointer to a member function.
+ ///
+ /// The following class was derived from the MAME delegate.h code.
+ ///
class mfp
{
public:
@@ -325,4 +325,4 @@ namespace plib {
} // namespace plib
-#endif /* PPMF_H_ */
+#endif // PPMF_H_
diff --git a/src/lib/netlist/plib/ppreprocessor.cpp b/src/lib/netlist/plib/ppreprocessor.cpp
index 80564064bb2..377c37d9fca 100644
--- a/src/lib/netlist/plib/ppreprocessor.cpp
+++ b/src/lib/netlist/plib/ppreprocessor.cpp
@@ -1,9 +1,5 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * ppreprocessor.cpp
- *
- */
#include "ppreprocessor.h"
#include "palloc.h"
@@ -77,19 +73,18 @@ namespace plib {
: m_tokens(tokens), m_parent(parent), m_pos(0)
{}
- /**! skip white space in token list
- *
- */
+ /// \brief skip white space in token list
+ ///
void skip_ws()
{
while (m_pos < m_tokens.size() && (m_tokens[m_pos] == " " || m_tokens[m_pos] == "\t"))
m_pos++;
}
- /**! return next token skipping white space
- *
- * @return next token
- */
+ /// \brief return next token skipping white space
+ ///
+ /// \return next token
+ ///
pstring next()
{
skip_ws();
@@ -98,10 +93,10 @@ namespace plib {
return m_tokens[m_pos++];
}
- /**! return next token including white space
- *
- * @return next token
- */
+ /// \brief return next token including white space
+ ///
+ /// \return next token
+ ///
pstring next_ws()
{
if (m_pos >= m_tokens.size())
@@ -497,7 +492,7 @@ namespace plib {
if (startsWith(arg, "\"") && endsWith(arg, "\""))
{
arg = arg.substr(1, arg.length() - 2);
- /* first try local context */
+ // first try local context
auto l(plib::util::buildpath({m_stack.back().m_local_path, arg}));
auto lstrm(m_sources.get_stream<>(l));
if (lstrm)
diff --git a/src/lib/netlist/plib/ppreprocessor.h b/src/lib/netlist/plib/ppreprocessor.h
index 3dc924d3f67..d87c06657ef 100644
--- a/src/lib/netlist/plib/ppreprocessor.h
+++ b/src/lib/netlist/plib/ppreprocessor.h
@@ -1,13 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * ppreprocessor.h
- *
- */
#ifndef PPREPROCESSOR_H_
#define PPREPROCESSOR_H_
+///
+/// \file ppreprocessor.h
+///
+
#include "plists.h"
#include "pstream.h"
#include "pstring.h"
@@ -95,7 +95,7 @@ namespace plib {
{
if (this->gptr() == this->egptr())
{
- /* clang reports sign error - weird */
+ // clang reports sign error - weird
std::size_t bytes = pstring_mem_t_size(m_strm->m_outbuf) - static_cast<std::size_t>(m_strm->m_pos);
if (bytes > m_buf.size())
@@ -104,7 +104,7 @@ namespace plib {
//printf("%ld\n", (long int)bytes);
this->setg(m_buf.data(), m_buf.data(), m_buf.data() + bytes);
- m_strm->m_pos += static_cast</*pos_type*/long>(bytes);
+ m_strm->m_pos += static_cast<long>(bytes);
}
return this->gptr() == this->egptr()
@@ -160,7 +160,7 @@ namespace plib {
pstring m_name;
};
- /* vector used as stack because we need to loop through stack */
+ // vector used as stack because we need to loop through stack
std::vector<input_context> m_stack;
pstring_t<pu8_traits> m_outbuf;
std::istream::pos_type m_pos;
@@ -173,4 +173,4 @@ namespace plib {
} // namespace plib
-#endif /* PPREPROCESSOR_H_ */
+#endif // PPREPROCESSOR_H_
diff --git a/src/lib/netlist/plib/pstate.h b/src/lib/netlist/plib/pstate.h
index 8dc6bf9424a..659c6991c42 100644
--- a/src/lib/netlist/plib/pstate.h
+++ b/src/lib/netlist/plib/pstate.h
@@ -1,13 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * pstate.h
- *
- */
#ifndef PSTATE_H_
#define PSTATE_H_
+///
+/// \file pstate.h
+///
+
#include "palloc.h"
#include "pstring.h"
#include "ptypes.h"
@@ -173,4 +173,4 @@ template<> inline void state_manager_t::save_item(const void *owner, callback_t
} // namespace plib
-#endif /* PSTATE_H_ */
+#endif // PSTATE_H_
diff --git a/src/lib/netlist/plib/pstonum.h b/src/lib/netlist/plib/pstonum.h
index 65ec6355b38..eed69e85883 100644
--- a/src/lib/netlist/plib/pstonum.h
+++ b/src/lib/netlist/plib/pstonum.h
@@ -1,13 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * pstonuml.h
- *
- */
#ifndef PSTONUM_H_
#define PSTONUM_H_
+///
+/// \file pstonum.h
+///
+
#include "pconfig.h"
#include "pexception.h"
#include "pmath.h" // for pstonum
@@ -145,4 +145,4 @@ namespace plib
} // namespace plib
-#endif /* PUTIL_H_ */
+#endif // PUTIL_H_
diff --git a/src/lib/netlist/plib/pstream.h b/src/lib/netlist/plib/pstream.h
index 6b438e83c1a..4425842882c 100644
--- a/src/lib/netlist/plib/pstream.h
+++ b/src/lib/netlist/plib/pstream.h
@@ -1,12 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * pstream.h
- */
+
#ifndef PSTREAM_H_
#define PSTREAM_H_
+///
+/// \file pstream.h
+///
#include "palloc.h"
#include "pconfig.h"
@@ -25,19 +26,17 @@
namespace plib {
-// -----------------------------------------------------------------------------
-// putf8reader_t: reader on top of istream
-// -----------------------------------------------------------------------------
-
-/* this digests linux & dos/windows text files */
-
-
template <typename T>
struct constructor_helper
{
plib::unique_ptr<std::istream> operator()(T &&s) { return std::move(plib::make_unique<T>(std::move(s))); }
};
+///
+/// \brief: putf8reader_t: reader on top of istream.
+///
+/// putf8reader_t digests linux & dos/windows text files
+///
// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions)
class putf8_reader
{
@@ -70,7 +69,7 @@ public:
{
if (c == 10)
break;
- else if (c != 13) /* ignore CR */
+ else if (c != 13) // ignore CR
m_linebuf += putf8string(1, c);
if (!this->readcode(c))
break;
@@ -303,8 +302,11 @@ private:
namespace filesystem
{
+
+ // FIXME: u8path should return a path object (c++17)
+
template< class Source >
- pstring /*path */ u8path( const Source& source )
+ pstring u8path( const Source& source )
{
return source;
}
@@ -313,4 +315,4 @@ namespace filesystem
} // namespace plib
-#endif /* PSTREAM_H_ */
+#endif // PSTREAM_H_
diff --git a/src/lib/netlist/plib/pstring.cpp b/src/lib/netlist/plib/pstring.cpp
index 357bce847f1..7af1228ef6d 100644
--- a/src/lib/netlist/plib/pstring.cpp
+++ b/src/lib/netlist/plib/pstring.cpp
@@ -1,9 +1,5 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * pstring.cpp
- *
- */
#include "pstring.h"
#include "palloc.h"
diff --git a/src/lib/netlist/plib/pstring.h b/src/lib/netlist/plib/pstring.h
index 25e79f5bdec..5c2ac2b9c47 100644
--- a/src/lib/netlist/plib/pstring.h
+++ b/src/lib/netlist/plib/pstring.h
@@ -1,12 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * pstring.h
- */
#ifndef PSTRING_H_
#define PSTRING_H_
+///
+/// \file pstring.h
+///
+
#include "ptypes.h"
#include <exception>
@@ -99,7 +100,7 @@ public:
{
}
- /* mingw treats string constants as char* instead of char[N] */
+ // mingw treats string constants as char* instead of char[N]
#if !defined(_WIN32) && !defined(_WIN64)
explicit
#endif
@@ -207,7 +208,7 @@ public:
static constexpr const size_type npos = static_cast<size_type>(-1);
- /* the following are extensions to <string> */
+ // the following are extensions to <string>
// FIXME: remove those
size_type mem_t_size() const { return m_str.size(); }
@@ -229,7 +230,7 @@ struct pu8_traits
static const mem_t *nthcode(const mem_t *p, const std::size_t n) { return &(p[n]); }
};
-/* No checking, this may deliver invalid codes */
+// No checking, this may deliver invalid codes
struct putf8_traits
{
using mem_t = char;
@@ -269,8 +270,8 @@ struct putf8_traits
return 2;
else if (c < 0x10000)
return 3;
- else /* U+10000 U+1FFFFF */
- return 4; /* no checks */
+ else // U+10000 U+1FFFFF
+ return 4; // no checks
}
static code_t code(const mem_t *p)
{
@@ -303,7 +304,7 @@ struct putf8_traits
s += static_cast<mem_t>(0x80 | ((c>>6) & 0x3f));
s += static_cast<mem_t>(0x80 | (c & 0x3f));
}
- else /* U+10000 U+1FFFFF */
+ else // U+10000 U+1FFFFF
{
s += static_cast<mem_t>(0xF0 | (c >> 18));
s += static_cast<mem_t>(0x80 | ((c>>12) & 0x3f));
@@ -348,7 +349,7 @@ struct putf16_traits
{
if (c < 0x10000)
return 1;
- else /* U+10000 U+1FFFFF */
+ else // U+10000 U+1FFFFF
return 2;
}
static code_t code(const mem_t *p)
@@ -512,4 +513,4 @@ namespace std
};
} // namespace std
-#endif /* PSTRING_H_ */
+#endif // PSTRING_H_
diff --git a/src/lib/netlist/plib/pstrutil.h b/src/lib/netlist/plib/pstrutil.h
index 69b9651ab0e..608f42cb4c2 100644
--- a/src/lib/netlist/plib/pstrutil.h
+++ b/src/lib/netlist/plib/pstrutil.h
@@ -1,12 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * pstrutil.h
- */
#ifndef PSTRUTIL_H_
#define PSTRUTIL_H_
+///
+/// \file pstrutil.h
+///
+
#include "pstring.h"
#include "ptypes.h"
@@ -67,7 +68,7 @@ namespace plib
template<typename T>
typename T::size_type find_last_not_of(const T &str, const T &no)
{
- /* FIXME: reverse iterator */
+ // FIXME: use reverse iterator
typename T::size_type last_found = T::npos;
typename T::size_type pos = 0;
for (auto it = str.begin(); it != str.end(); ++it, ++pos)
@@ -225,4 +226,4 @@ namespace plib
} // namespace plib
-#endif /* PSTRUTIL_H_ */
+#endif // PSTRUTIL_H_
diff --git a/src/lib/netlist/plib/ptime.h b/src/lib/netlist/plib/ptime.h
index 4f1b5af445f..214f121c2df 100644
--- a/src/lib/netlist/plib/ptime.h
+++ b/src/lib/netlist/plib/ptime.h
@@ -1,12 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * ptime.h
- */
#ifndef PTIME_H_
#define PTIME_H_
+///
+/// \file ptime.h
+///
+
#include "pconfig.h"
#include "pmath.h" // std::floor
#include "ptypes.h"
@@ -164,4 +165,4 @@ namespace plib
} // namespace plib
-#endif /* PTIME_H_ */
+#endif // PTIME_H_
diff --git a/src/lib/netlist/plib/ptokenizer.cpp b/src/lib/netlist/plib/ptokenizer.cpp
index 0e8cabe4e8b..23d0903ae2a 100644
--- a/src/lib/netlist/plib/ptokenizer.cpp
+++ b/src/lib/netlist/plib/ptokenizer.cpp
@@ -1,9 +1,5 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * ptokenizer.cpp
- *
- */
#include "ptokenizer.h"
#include "palloc.h"
@@ -198,7 +194,7 @@ namespace plib {
ptokenizer::token_t ptokenizer::get_token_internal()
{
- /* skip ws */
+ // skip ws
pstring::value_type c = getc();
while (m_whitespace.find(c) != pstring::npos)
{
@@ -212,10 +208,8 @@ namespace plib {
return token_t(LINEMARKER, "#");
else if (m_number_chars_start.find(c) != pstring::npos)
{
- /* read number while we receive number or identifier chars
- * treat it as an identifier when there are identifier chars in it
- *
- */
+ // read number while we receive number or identifier chars
+ // treat it as an identifier when there are identifier chars in it
token_type ret = NUMBER;
pstring tokstr = "";
while (true) {
@@ -231,7 +225,7 @@ namespace plib {
}
else if (m_identifier_chars.find(c) != pstring::npos)
{
- /* read identifier till non identifier char */
+ // read identifier till non identifier char
pstring tokstr = "";
while (m_identifier_chars.find(c) != pstring::npos)
{
@@ -258,12 +252,12 @@ namespace plib {
}
else
{
- /* read identifier till first identifier char or ws */
+ // read identifier till first identifier char or ws
pstring tokstr = "";
while ((m_identifier_chars.find(c) == pstring::npos) && (m_whitespace.find(c) == pstring::npos))
{
tokstr += c;
- /* expensive, check for single char tokens */
+ // expensive, check for single char tokens
if (tokstr.length() == 1)
{
auto id = m_tokens.find(tokstr);
diff --git a/src/lib/netlist/plib/ptokenizer.h b/src/lib/netlist/plib/ptokenizer.h
index b6f8411eaa3..66365bcc017 100644
--- a/src/lib/netlist/plib/ptokenizer.h
+++ b/src/lib/netlist/plib/ptokenizer.h
@@ -1,13 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * ptokenizer.h
- *
- */
#ifndef PTOKENIZER_H_
#define PTOKENIZER_H_
+///
+/// \file ptokenizer.h
+///
+
#include "plists.h"
#include "pstream.h"
#include "pstring.h"
@@ -94,7 +94,7 @@ namespace plib {
pstring currentline_str();
- /* tokenizer stuff follows ... */
+ // tokenizer stuff follows ...
token_t get_token();
pstring get_string();
@@ -147,7 +147,7 @@ namespace plib {
pstring::const_iterator m_px;
pstring::value_type m_unget;
- /* tokenizer stuff follows ... */
+ // tokenizer stuff follows ...
pstring m_identifier_chars;
pstring m_number_chars;
@@ -160,11 +160,12 @@ namespace plib {
token_id_t m_tok_comment_end;
token_id_t m_tok_line_comment;
- /* source locations, vector used as stack because we need to loop through stack */
+ // source locations, vector used as stack because we need to loop through stack
+
bool m_support_line_markers;
std::vector<plib::source_location> m_source_location;
};
} // namespace plib
-#endif /* PTOKENIZER_H_ */
+#endif // PTOKENIZER_H_
diff --git a/src/lib/netlist/plib/ptypes.h b/src/lib/netlist/plib/ptypes.h
index afc25bc0d0a..d34651b9f70 100644
--- a/src/lib/netlist/plib/ptypes.h
+++ b/src/lib/netlist/plib/ptypes.h
@@ -1,13 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * ptypes.h
- *
- */
#ifndef PTYPES_H_
#define PTYPES_H_
+///
+/// \file ptypes.h
+///
+
#include "pconfig.h"
#include <limits>
@@ -30,7 +30,7 @@ namespace plib
template<typename T> struct is_integral : public std::is_integral<T> { };
template<typename T> struct numeric_limits : public std::numeric_limits<T> { };
- /* 128 bit support at least on GCC is not fully supported */
+ // 128 bit support at least on GCC is not fully supported
#if PHAS_INT128
template<> struct is_integral<UINT128> { static constexpr bool value = true; };
template<> struct is_integral<INT128> { static constexpr bool value = true; };
@@ -149,4 +149,4 @@ namespace plib
static constexpr const bool value = sizeof(test<T>(nullptr)) == sizeof(long); \
}
-#endif /* PTYPES_H_ */
+#endif // PTYPES_H_
diff --git a/src/lib/netlist/plib/putil.h b/src/lib/netlist/plib/putil.h
index 6a79dadae90..128e804a1ae 100644
--- a/src/lib/netlist/plib/putil.h
+++ b/src/lib/netlist/plib/putil.h
@@ -1,26 +1,20 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * putil.h
- *
- */
#ifndef PUTIL_H_
#define PUTIL_H_
+///
+/// \file putil.h
+///
+
#include "palloc.h"
#include "pexception.h"
#include "pstring.h"
#include <algorithm>
-//#include <initializer_list>
-//#include <iostream>
-//#include <locale>
-//#include <sstream>
#include <vector>
-// FIXME: pstonum should get an own header
-
#define PSTRINGIFY_HELP(y) # y
#define PSTRINGIFY(x) PSTRINGIFY_HELP(x)
@@ -31,13 +25,12 @@
namespace plib
{
- /**! Source code locations
- *
- * The c++20 draft for source locations is based on const char * strings.
- * It is thus only suitable for c++ source code and not for programmatic
- * parsing of files. This class is a replacement for dynamic use cases.
- *
- */
+ /// \brief Source code locations.
+ ///
+ /// The c++20 draft for source locations is based on const char * strings.
+ /// It is thus only suitable for c++ source code and not for programmatic
+ /// parsing of files. This class is a replacement for dynamic use cases.
+ ///
struct source_location
{
source_location() noexcept
@@ -70,13 +63,12 @@ namespace plib
unsigned m_col;
};
- /**! Base source class
- *
- * Pure virtual class all other source implementations are based on.
- * Sources provide an abstraction to read input from a variety of
- * sources, e.g. files, memory, remote locations.
- *
- */
+ /// \brief Base source class.
+ ///
+ /// Pure virtual class all other source implementations are based on.
+ /// Sources provide an abstraction to read input from a variety of
+ /// sources, e.g. files, memory, remote locations.
+ ///
class psource_t
{
public:
@@ -93,13 +85,13 @@ namespace plib
private:
};
- /**! Generic string source
- *
- * Will return the given string when name matches.
- * Is used in preprocessor code to eliminate inclusion of certain files.
- *
- * @tparam TS base stream class. Default is psource_t
- */
+ /// \brief Generic string source.
+ ///
+ /// Will return the given string when name matches.
+ /// Is used in preprocessor code to eliminate inclusion of certain files.
+ ///
+ /// \tparam TS base stream class. Default is psource_t
+ ///
template <typename TS = psource_t>
class psource_str_t : public TS
{
@@ -123,10 +115,10 @@ namespace plib
pstring m_str;
};
- /**! Generic sources collection
- *
- * @tparam TS base stream class. Default is psource_t
- */
+ /// \brief Generic sources collection.
+ ///
+ /// \tparam TS base stream class. Default is psource_t
+ ///
template <typename TS = psource_t>
class psource_collection_t
{
@@ -273,4 +265,4 @@ namespace plib
} \
};
-#endif /* PUTIL_H_ */
+#endif // PUTIL_H_
diff --git a/src/lib/netlist/plib/vector_ops.h b/src/lib/netlist/plib/vector_ops.h
index c603a3c43db..a34a9bf8a54 100644
--- a/src/lib/netlist/plib/vector_ops.h
+++ b/src/lib/netlist/plib/vector_ops.h
@@ -1,15 +1,15 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * vector_ops.h
- *
- * Base vector operations
- *
- */
#ifndef PLIB_VECTOR_OPS_H_
#define PLIB_VECTOR_OPS_H_
+///
+/// \file vector_ops.h
+///
+/// Base vector operations
+///
+///
#include "pconfig.h"
#include "pmath.h"
@@ -149,4 +149,4 @@ namespace plib
#endif
#endif
-#endif /* PLIB_VECTOR_OPS_H_ */
+#endif // PLIB_VECTOR_OPS_H_
diff --git a/src/lib/netlist/prg/nltool.cpp b/src/lib/netlist/prg/nltool.cpp
index 31cbecf2bb4..2591d49bc49 100644
--- a/src/lib/netlist/prg/nltool.cpp
+++ b/src/lib/netlist/prg/nltool.cpp
@@ -1,12 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/***************************************************************************
- nltool.c
-
- Simple tool to debug netlists outside MAME.
-
-****************************************************************************/
+// ***************************************************************************
+//
+// nltool.cpp
+//
+// Simple tool to debug netlists outside MAME.
+//
+// ***************************************************************************
#include "netlist/plib/pmain.h"
#include "netlist/plib/pstrutil.h"
@@ -149,16 +150,16 @@ private:
};
static NETLIST_START(dummy)
- /* Standard stuff */
+ // Standard stuff
CLOCK(clk, 1000) // 1000 Hz
SOLVER(Solver, 48000)
NETLIST_END()
-/***************************************************************************
- CORE IMPLEMENTATION
-***************************************************************************/
+// **************************************************************************
+// CORE IMPLEMENTATION
+// **************************************************************************
class netlist_data_folder_t : public netlist::source_data_t
{
@@ -244,7 +245,6 @@ public:
for (auto & log : logs)
{
pstring name = "log_" + log;
- /*netlist_device_t *nc = */ setup().register_dev("LOG", name);
setup().register_link(name + ".I", log);
}
}
@@ -544,15 +544,15 @@ void tool_app_t::static_compile()
-/* "Description: The Swiss army knife for timing purposes\n"
-* " which has a ton of applications.\n"
-* "DipAlias: GND,TRIG,OUT,RESET,VCC,DISCH,THRES,CONT\n"
-* "Package: DIP\n"
-* "NamingConvention: Naming conventions follow Texas Instruments datasheet\n"
-* "Limitations: Internal resistor network currently fixed to 5k\n"
-* " more limitations\n"
-* "FunctionTable:\n"
-*/
+// "Description: The Swiss army knife for timing purposes\n"
+// " which has a ton of applications.\n"
+// "DipAlias: GND,TRIG,OUT,RESET,VCC,DISCH,THRES,CONT\n"
+// "Package: DIP\n"
+// "NamingConvention: Naming conventions follow Texas Instruments datasheet\n"
+// "Limitations: Internal resistor network currently fixed to 5k\n"
+// " more limitations\n"
+// "FunctionTable:\n"
+//
struct doc_ext
{
@@ -733,9 +733,9 @@ void tool_app_t::create_header()
pout("#include \"nl_setup.h\"\n");
pout("#ifndef __PLIB_PREPROCESSOR__\n");
pout("\n");
- pout("/* ----------------------------------------------------------------------------\n");
- pout(" * Netlist Macros\n");
- pout(" * ---------------------------------------------------------------------------*/\n");
+ pout("// ----------------------------------------------------------------------------\n");
+ pout("// Netlist Macros\n");
+ pout("// ---------------------------------------------------------------------------\n");
pout("\n");
pstring last_source("");
@@ -774,19 +774,20 @@ void tool_app_t::create_docheader()
pout("// license:GPL-2.0+\n");
pout("// copyright-holders:Couriersud\n");
- pout("/* ----------------------------------------------------------------------------\n");
- pout(" * Automatically created file. DO NOT MODIFY.\n");
- pout(" * ---------------------------------------------------------------------------*/\n");
- pout("/*!\n");
- pout(" * \\page devices Devices\n");
- pout(" *\n");
- pout(" * Below is a list of all the devices currently known to the system ...\n");
- pout(" *\n");
+ pout("\n");
+ pout("// ----------------------------------------------------------------------------\n");
+ pout("// Automatically created file. DO NOT MODIFY.\n");
+ pout("// ---------------------------------------------------------------------------\n");
+ pout("///\n");
+ pout("/// \\page devices Devices\n");
+ pout("///\n");
+ pout("/// Below is a list of all the devices currently known to the system ...\n");
+ pout("///\n");
for (auto &s : devs)
- pout(" * - @subpage {1}\n", s);
+ pout("/// - @subpage {1}\n", s);
- pout(" */\n");
+ pout("\n");
for (auto &e : nt.setup().factory())
{
@@ -873,9 +874,9 @@ void tool_app_t::create_docheader()
}
-/*-------------------------------------------------
- listdevices - list all known devices
--------------------------------------------------*/
+// -------------------------------------------------
+// listdevices - list all known devices
+// -------------------------------------------------
void tool_app_t::listdevices()
{
@@ -924,9 +925,9 @@ void tool_app_t::listdevices()
}
}
-/*-------------------------------------------------
- convert - convert spice et al to netlist
--------------------------------------------------*/
+// -------------------------------------------------
+// convert - convert spice et al to netlist
+// -------------------------------------------------
void tool_app_t::convert()
{
@@ -966,13 +967,13 @@ void tool_app_t::convert()
c.convert(contents);
result = c.result();
}
- /* present result */
+ // present result
pout.write(result);
}
-/*-------------------------------------------------
- main - primary entry point
--------------------------------------------------*/
+// -------------------------------------------------
+// main - primary entry point
+// -------------------------------------------------
#if 0
static const pstring pmf_verbose[] =
diff --git a/src/lib/netlist/prg/nlwav.cpp b/src/lib/netlist/prg/nlwav.cpp
index 4b8f1da0391..84e32bfc04a 100644
--- a/src/lib/netlist/prg/nlwav.cpp
+++ b/src/lib/netlist/prg/nlwav.cpp
@@ -9,16 +9,17 @@
#include <cstdio>
-/* From: https://ffmpeg.org/pipermail/ffmpeg-devel/2007-October/038122.html
- * The most compatible way to make a wav header for unknown length is to put
- * 0xffffffff in the header. 0 as the RIFF length and 0 as the data chunk length
- * is a common agreement in serious recording applications while
- * still recording the file. So a playback application can determine that the
- * given file is still being recorded. As soon as the recording application
- * finishes the ongoing recording, it writes the correct values for RIFF lenth
- * and data chunk length to the file.
- */
-/* http://de.wikipedia.org/wiki/RIFF_WAVE */
+// From: https://ffmpeg.org/pipermail/ffmpeg-devel/2007-October/038122.html
+// The most compatible way to make a wav header for unknown length is to put
+// 0xffffffff in the header. 0 as the RIFF length and 0 as the data chunk length
+// is a common agreement in serious recording applications while
+// still recording the file. So a playback application can determine that the
+// given file is still being recorded. As soon as the recording application
+// finishes the ongoing recording, it writes the correct values for RIFF lenth
+// and data chunk length to the file.
+//
+// http://de.wikipedia.org/wiki/RIFF_WAVE
+//
class wav_t
{
@@ -27,7 +28,7 @@ public:
wav_t(std::ostream &strm, bool is_seekable, std::size_t sr, std::size_t channels)
: m_f(strm)
, m_stream_is_seekable(is_seekable)
- /* force "play" to play and warn about eof instead of being silent */
+ // force "play" to play and warn about eof instead of being silent
, m_fmt(static_cast<std::uint16_t>(channels), static_cast<std::uint32_t>(sr))
, m_data(is_seekable ? 0 : 0xffffffff)
{
@@ -67,7 +68,7 @@ public:
m_data.len += m_fmt.block_align;
for (std::size_t i = 0; i < channels(); i++)
{
- auto ps = static_cast<int16_t>(sample[i]); /* 16 bit sample, FIXME: Endianess? */
+ auto ps = static_cast<int16_t>(sample[i]); // 16 bit sample, FIXME: Endianess?
write(ps);
}
}
@@ -548,24 +549,24 @@ int nlwav_app::execute()
PMAIN(nlwav_app)
-/*
-Der Daten-Abschnitt enth??lt die Abtastwerte:
-Offset L??nge Inhalt Beschreibung
-36 (0x24) 4 'data' Header-Signatur
-40 (0x28) 4 <length> L??nge des Datenblocks, max. <Dateigr????e>?????????44
-
-0 (0x00) char 4 'RIFF'
-4 (0x04) unsigned 4 <Dateigr????e>?????????8
-8 (0x08) char 4 'WAVE'
-
-Der fmt-Abschnitt (24 Byte) beschreibt das Format der einzelnen Abtastwerte:
-Offset L??nge Inhalt Beschreibung
-12 (0x0C) 4 'fmt ' Header-Signatur (folgendes Leerzeichen beachten)
-16 (0x10) 4 <fmt length> L??nge des restlichen fmt-Headers (16 Bytes)
-20 (0x14) 2 <format tag> Datenformat der Abtastwerte (siehe separate Tabelle weiter unten)
-22 (0x16) 2 <channels> Anzahl der Kan??le: 1 = mono, 2 = stereo; mittlerweile sind auch mehr als 2 Kan??le (z. B. f??r Raumklang) m??glich.[2]
-24 (0x18) 4 <sample rate> Samples pro Sekunde je Kanal (z. B. 44100)
-28 (0x1C) 4 <bytes/second> Abtastrate????????Frame-Gr????e
-32 (0x20) 2 <block align> Frame-Gr????e = <Anzahl der Kan??le>????????((<Bits/Sample (eines Kanals)>???+???7)???/???8) (Division ohne Rest)
-34 (0x22) 2 <bits/sample> Anzahl der Datenbits pro Samplewert je Kanal (z. B. 12)
-*/
+//
+// Der Daten-Abschnitt enth??lt die Abtastwerte:
+// Offset L??nge Inhalt Beschreibung
+// 36 (0x24) 4 'data' Header-Signatur
+// 40 (0x28) 4 <length> L??nge des Datenblocks, max. <Dateigr????e>?????????44
+//
+// 0 (0x00) char 4 'RIFF'
+// 4 (0x04) unsigned 4 <Dateigr????e>?????????8
+// 8 (0x08) char 4 'WAVE'
+//
+// Der fmt-Abschnitt (24 Byte) beschreibt das Format der einzelnen Abtastwerte:
+// Offset L??nge Inhalt Beschreibung
+// 12 (0x0C) 4 'fmt ' Header-Signatur (folgendes Leerzeichen beachten)
+// 16 (0x10) 4 <fmt length> L??nge des restlichen fmt-Headers (16 Bytes)
+// 20 (0x14) 2 <format tag> Datenformat der Abtastwerte (siehe separate Tabelle weiter unten)
+// 22 (0x16) 2 <channels> Anzahl der Kan??le: 1 = mono, 2 = stereo; mittlerweile sind auch mehr als 2 Kan??le (z. B. f??r Raumklang) m??glich.[2]
+// 24 (0x18) 4 <sample rate> Samples pro Sekunde je Kanal (z. B. 44100)
+// 28 (0x1C) 4 <bytes/second> Abtastrate????????Frame-Gr????e
+// 32 (0x20) 2 <block align> Frame-Gr????e = <Anzahl der Kan??le>????????((<Bits/Sample (eines Kanals)>???+???7)???/???8) (Division ohne Rest)
+// 34 (0x22) 2 <bits/sample> Anzahl der Datenbits pro Samplewert je Kanal (z. B. 12)
+//
diff --git a/src/lib/netlist/solver/nld_matrix_solver.cpp b/src/lib/netlist/solver/nld_matrix_solver.cpp
index 0a368207233..1b6340a0dbc 100644
--- a/src/lib/netlist/solver/nld_matrix_solver.cpp
+++ b/src/lib/netlist/solver/nld_matrix_solver.cpp
@@ -1,9 +1,5 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * nld_matrix_solver.cpp
- *
- */
#include "nld_matrix_solver.h"
#include "plib/putil.h"
@@ -57,7 +53,7 @@ namespace solver
connect_post_start(m_fb_sync, m_Q_sync);
setup_base(nets);
- /* now setup the matrix */
+ // now setup the matrix
setup_matrix();
}
@@ -133,25 +129,24 @@ namespace solver
void matrix_solver_t::sort_terms(matrix_sort_type_e sort)
{
- /* Sort in descending order by number of connected matrix voltages.
- * The idea is, that for Gauss-Seidel algo the first voltage computed
- * depends on the greatest number of previous voltages thus taking into
- * account the maximum amout of information.
- *
- * This actually improves performance on popeye slightly. Average
- * GS computations reduce from 2.509 to 2.370
- *
- * Smallest to largest : 2.613
- * Unsorted : 2.509
- * Largest to smallest : 2.370
- *
- * Sorting as a general matrix pre-conditioning is mentioned in
- * literature but I have found no articles about Gauss Seidel.
- *
- * For Gaussian Elimination however increasing order is better suited.
- * NOTE: Even better would be to sort on elements right of the matrix diagonal.
- *
- */
+ // Sort in descending order by number of connected matrix voltages.
+ // The idea is, that for Gauss-Seidel algo the first voltage computed
+ // depends on the greatest number of previous voltages thus taking into
+ // account the maximum amout of information.
+ //
+ // This actually improves performance on popeye slightly. Average
+ // GS computations reduce from 2.509 to 2.370
+ //
+ // Smallest to largest : 2.613
+ // Unsorted : 2.509
+ // Largest to smallest : 2.370
+ //
+ // Sorting as a general matrix pre-conditioning is mentioned in
+ // literature but I have found no articles about Gauss Seidel.
+ //
+ // For Gaussian Elimination however increasing order is better suited.
+ // NOTE: Even better would be to sort on elements right of the matrix diagonal.
+ //
const std::size_t iN = m_terms.size();
@@ -209,7 +204,7 @@ namespace solver
case matrix_sort_type_e::NOSORT:
break;
}
- /* rebuild */
+ // rebuild
for (auto &term : m_terms)
{
int *other = term.m_connected_net_idx.data();
@@ -238,11 +233,11 @@ namespace solver
this->set_pointers();
- /* create a list of non zero elements. */
+ // create a list of non zero elements.
for (unsigned k = 0; k < iN; k++)
{
terms_for_net_t & t = m_terms[k];
- /* pretty brutal */
+ // pretty brutal
int *other = t.m_connected_net_idx.data();
t.m_nz.clear();
@@ -253,18 +248,18 @@ namespace solver
t.m_nz.push_back(k); // add diagonal
- /* and sort */
+ // and sort
std::sort(t.m_nz.begin(), t.m_nz.end());
}
- /* create a list of non zero elements right of the diagonal
- * These list anticipate the population of array elements by
- * Gaussian elimination.
- */
+ // create a list of non zero elements right of the diagonal
+ // These list anticipate the population of array elements by
+ // Gaussian elimination.
+
for (std::size_t k = 0; k < iN; k++)
{
terms_for_net_t & t = m_terms[k];
- /* pretty brutal */
+ // pretty brutal
int *other = t.m_connected_net_idx.data();
if (k==0)
@@ -285,13 +280,12 @@ namespace solver
if (!plib::container::contains(t.m_nzrd, static_cast<unsigned>(other[i])) && other[i] >= static_cast<int>(k + 1))
t.m_nzrd.push_back(static_cast<unsigned>(other[i]));
- /* and sort */
+ // and sort
std::sort(t.m_nzrd.begin(), t.m_nzrd.end());
}
- /* create a list of non zero elements below diagonal k
- * This should reduce cache misses ...
- */
+ // create a list of non zero elements below diagonal k
+ // This should reduce cache misses ...
std::vector<std::vector<bool>> touched(iN, std::vector<bool>(iN));
@@ -334,9 +328,9 @@ namespace solver
log().verbose("{1}", line);
}
- /*
- * save states
- */
+ //
+ // save states
+ //
for (std::size_t k = 0; k < iN; k++)
{
@@ -358,7 +352,7 @@ namespace solver
void matrix_solver_t::update_dynamic()
{
- /* update all non-linear devices */
+ // update all non-linear devices
for (auto &dyn : m_dynamic_devices)
dyn->update_terminals();
}
@@ -379,12 +373,11 @@ namespace solver
}
}
- /* update_forced is called from within param_update
- *
- * this should only occur outside of execution and thus
- * using time should be safe.
- *
- */
+ // update_forced is called from within param_update
+ //
+ // this should only occur outside of execution and thus
+ // using time should be safe.
+
void matrix_solver_t::update_forced()
{
const netlist_time new_timestep = solve(exec().time());
@@ -414,7 +407,7 @@ namespace solver
if (delta < netlist_time::quantum())
return netlist_time::zero();
- /* update all terminals for new time step */
+ // update all terminals for new time step
m_last_step = now;
step(delta);
@@ -459,10 +452,10 @@ namespace solver
std::pair<int, int> matrix_solver_t::get_left_right_of_diag(std::size_t irow, std::size_t idiag)
{
- /*
- * return the maximum column left of the diagonal (-1 if no cols found)
- * return the minimum column right of the diagonal (999999 if no cols found)
- */
+ //
+ // return the maximum column left of the diagonal (-1 if no cols found)
+ // return the minimum column right of the diagonal (999999 if no cols found)
+ //
const auto row = static_cast<int>(irow);
const auto diag = static_cast<int>(idiag);
@@ -492,9 +485,9 @@ namespace solver
nl_fptype matrix_solver_t::get_weight_around_diag(std::size_t row, std::size_t diag)
{
{
- /*
- * return average absolute distance
- */
+ //
+ // return average absolute distance
+ //
std::vector<bool> touched(1024, false); // FIXME!
@@ -533,7 +526,7 @@ namespace solver
{
m_terms[net_idx].add_terminal(term, ot, true);
}
- /* Should this be allowed ? */
+ // Should this be allowed ?
else // if (ot<0)
{
m_rails_temp[net_idx].add_terminal(term, ot, true);
diff --git a/src/lib/netlist/solver/nld_matrix_solver.h b/src/lib/netlist/solver/nld_matrix_solver.h
index 90c13e6a974..a538775bcc5 100644
--- a/src/lib/netlist/solver/nld_matrix_solver.h
+++ b/src/lib/netlist/solver/nld_matrix_solver.h
@@ -1,13 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * nld_matrix_solver.h
- *
- */
#ifndef NLD_MATRIX_SOLVER_H_
#define NLD_MATRIX_SOLVER_H_
+///
+/// \file nld_matrix_solver.h
+///
+
#include "netlist/nl_base.h"
#include "netlist/nl_errstr.h"
#include "plib/mat_cr.h"
@@ -58,7 +58,7 @@ namespace solver
solver_parameters_t(device_t &parent)
: m_freq(parent, "FREQ", nlconst::magic(48000.0))
- /* iteration parameters */
+ // iteration parameters
, 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)
@@ -68,22 +68,22 @@ namespace solver
, 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
- /* general parameters */
+ // general parameters
, m_gmin(parent, "GMIN", nlconst::magic(1e-9))
, m_pivot(parent, "PIVOT", false) ///< use pivoting on supported solvers
, m_nr_recalc_delay(parent, "NR_RECALC_DELAY",
netlist_time::quantum().as_fp<nl_fptype>()) ///< Delay to next solve attempt if nr loops exceeded
, m_parallel(parent, "PARALLEL", 0)
- /* automatic time step */
+ // automatic time step
, 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
- /* matrix sorting */
+ // matrix sorting
, m_sort_type(parent, "SORT_TYPE", matrix_sort_type_e::PREFER_IDENTITY_TOP_LEFT)
- /* special */
+ // special
, m_use_gabs(parent, "USE_GABS", true)
, m_use_linear_prediction(parent, "USE_LINEAR_PREDICTION", false) // // savings are eaten up by effort
@@ -154,9 +154,9 @@ namespace solver
PALIGNAS_VECTOROPT()
- plib::aligned_vector<unsigned> m_nz; /* all non zero for multiplication */
- plib::aligned_vector<unsigned> m_nzrd; /* non zero right of the diagonal for elimination, may include RHS element */
- plib::aligned_vector<unsigned> m_nzbd; /* non zero below of the diagonal for elimination */
+ plib::aligned_vector<unsigned> m_nz; //!< all non zero for multiplication
+ plib::aligned_vector<unsigned> m_nzrd; //!< non zero right of the diagonal for elimination, may include RHS element
+ plib::aligned_vector<unsigned> m_nzbd; //!< non zero below of the diagonal for elimination
plib::aligned_vector<int> m_connected_net_idx;
private:
@@ -184,9 +184,9 @@ namespace solver
public:
using list_t = std::vector<matrix_solver_t *>;
- /* after every call to solve, update inputs must be called.
- * this can be done as well as a batch to ease parallel processing.
- */
+ // after every call to solve, update inputs must be called.
+ // this can be done as well as a batch to ease parallel processing.
+
const netlist_time solve(netlist_time now);
void update_inputs();
@@ -199,7 +199,7 @@ namespace solver
m_Q_sync.net().toggle_and_push_to_queue(after);
}
- /* netdevice functions */
+ // netdevice functions
NETLIB_UPDATEI();
NETLIB_RESETI();
@@ -215,7 +215,7 @@ namespace solver
return std::pair<pstring, pstring>("", plib::pfmt("/* solver doesn't support static compile */\n\n"));
}
- /* return number of floating point operations for solve */
+ // return number of floating point operations for solve
std::size_t ops() { return m_ops; }
protected:
@@ -355,10 +355,10 @@ namespace solver
logic_input_t m_fb_sync;
logic_output_t m_Q_sync;
- /* base setup - called from constructor */
+ // base setup - called from constructor
void setup_base(const analog_net_t::list_t &nets);
- /* calculate matrix */
+ // calculate matrix
void setup_matrix();
void step(const netlist_time &delta);
@@ -386,9 +386,9 @@ namespace solver
, m_DD_n_m_1(size, nlconst::zero())
, m_h_n_m_1(size, nlconst::zero())
{
- /*
- * save states
- */
+ //
+ // save states
+ //
state().save(*this, m_last_V.as_base(), this->name(), "m_last_V");
state().save(*this, m_DD_n_m_1.as_base(), this->name(), "m_DD_n_m_1");
state().save(*this, m_h_n_m_1.as_base(), this->name(), "m_h_n_m_1");
@@ -411,7 +411,7 @@ namespace solver
plib::parray2D<float_type *, SIZE, 0> m_mat_ptr;
// FIXME: below should be private
- /* state - variable time_stepping */
+ // state - variable time_stepping
PALIGNAS_VECTOROPT()
plib::parray<nl_fptype, SIZE> m_last_V;
PALIGNAS_VECTOROPT()
@@ -433,10 +433,9 @@ namespace solver
bool check_err()
{
- /* NOTE: Ideally we should also include currents (RHS) here. This would
- * need a reevaluation of the right hand side after voltages have been updated
- * and thus belong into a different calculation. This applies to all solvers.
- */
+ // NOTE: Ideally we should also include currents (RHS) here. This would
+ // need a reevaluation of the right hand side after voltages have been updated
+ // and thus belong into a different calculation. This applies to all solvers.
const std::size_t iN = size();
const auto reltol(static_cast<FT>(m_params.m_reltol));
@@ -491,9 +490,9 @@ namespace solver
}
//if (new_solver_timestep > 10.0 * hn)
// new_solver_timestep = 10.0 * hn;
- /*
- * FIXME: Factor 2 below is important. Without, we get timing issues. This must be a bug elsewhere.
- */
+ //
+ // FIXME: Factor 2 below is important. Without, we get timing issues. This must be a bug elsewhere.
+
return std::max(netlist_time::from_fp(new_solver_timestep), netlist_time::quantum() * 2);
}
@@ -506,7 +505,7 @@ namespace solver
for (std::size_t k=0; k<iN; k++)
{
std::size_t cnt(0);
- /* build pointers into the compressed row format matrix for each terminal */
+ // build pointers into the compressed row format matrix for each terminal
for (std::size_t j=0; j< this->m_terms[k].railstart();j++)
{
int other = this->m_terms[k].m_connected_net_idx[j];
@@ -555,7 +554,7 @@ namespace solver
for (std::size_t i = 0; i < railstart; i++)
*tcr_r[i] += static_cast<FT>(go[i]);
- /* use native floattype for now */
+ // use native floattype for now
auto gtot_t(nlconst::zero());
auto RHS_t (nlconst::zero());
@@ -572,7 +571,7 @@ namespace solver
for (std::size_t i = railstart; i < term_count; i++)
{
- RHS_t += (/*m_Idr[i]*/ (- go[i]) * *cnV[i]);
+ RHS_t += (- go[i]) * *cnV[i];
}
m_RHS[k] = static_cast<FT>(RHS_t);
@@ -587,4 +586,4 @@ namespace solver
} // namespace solver
} // namespace netlist
-#endif /* NLD_MS_DIRECT_H_ */
+#endif // NLD_MS_DIRECT_H_
diff --git a/src/lib/netlist/solver/nld_ms_direct.h b/src/lib/netlist/solver/nld_ms_direct.h
index ecaf311b76e..c72b08717ca 100644
--- a/src/lib/netlist/solver/nld_ms_direct.h
+++ b/src/lib/netlist/solver/nld_ms_direct.h
@@ -1,13 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * nld_ms_direct.h
- *
- */
#ifndef NLD_MS_DIRECT_H_
#define NLD_MS_DIRECT_H_
+///
+/// \file nld_ms_direct.h
+///
+
#include "nld_matrix_solver.h"
#include "nld_solver.h"
#include "plib/parray.h"
@@ -66,7 +66,7 @@ namespace solver
{
for (std::size_t i = 0; i < kN; i++)
{
- /* FIXME: Singular matrix? */
+ // FIXME: Singular matrix?
const FT f = plib::reciprocal(m_A[i][i]);
const auto &nzrd = this->m_terms[i].m_nzrd;
const auto &nzbd = this->m_terms[i].m_nzbd;
@@ -84,7 +84,7 @@ namespace solver
{
for (std::size_t i = 0; i < kN; i++)
{
- /* Find the row with the largest first value */
+ // Find the row with the largest first value
std::size_t maxrow = i;
for (std::size_t j = i + 1; j < kN; j++)
{
@@ -95,16 +95,16 @@ namespace solver
if (maxrow != i)
{
- /* Swap the maxrow and ith row */
+ // Swap the maxrow and ith row
for (std::size_t k = 0; k < kN; k++) {
std::swap(m_A[i][k], m_A[maxrow][k]);
}
std::swap(this->m_RHS[i], this->m_RHS[maxrow]);
}
- /* FIXME: Singular matrix? */
+ // FIXME: Singular matrix?
const FT f = plib::reciprocal(m_A[i][i]);
- /* Eliminate column i from row j */
+ // Eliminate column i from row j
for (std::size_t j = i + 1; j < kN; j++)
{
@@ -132,7 +132,7 @@ namespace solver
{
const std::size_t kN = this->size();
- /* back substitution */
+ // back substitution
if (this->m_params.m_pivot)
{
for (std::size_t j = kN; j-- > 0; )
@@ -149,7 +149,7 @@ namespace solver
{
FT tmp = 0;
const auto &nzrd = this->m_terms[j].m_nzrd;
- const auto e = nzrd.size(); // - 1; /* exclude RHS element */
+ const auto e = nzrd.size(); // - 1; // exclude RHS element
for ( std::size_t k = 0; k < e; k++)
tmp += m_A[j][nzrd[k]] * x[nzrd[k]];
x[j] = (this->m_RHS[j] - tmp) / m_A[j][j];
@@ -173,7 +173,7 @@ namespace solver
template <typename FT, int SIZE>
unsigned matrix_solver_direct_t<FT, SIZE>::vsolve_non_dynamic(const bool newton_raphson)
{
- /* populate matrix */
+ // populate matrix
this->clear_square_mat(m_A);
this->fill_matrix_and_rhs();
@@ -196,4 +196,4 @@ namespace solver
} // namespace solver
} // namespace netlist
-#endif /* NLD_MS_DIRECT_H_ */
+#endif // NLD_MS_DIRECT_H_
diff --git a/src/lib/netlist/solver/nld_ms_direct1.h b/src/lib/netlist/solver/nld_ms_direct1.h
index 3a04107103f..3a4e3778208 100644
--- a/src/lib/netlist/solver/nld_ms_direct1.h
+++ b/src/lib/netlist/solver/nld_ms_direct1.h
@@ -1,13 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * nld_ms_direct1.h
- *
- */
#ifndef NLD_MS_DIRECT1_H_
#define NLD_MS_DIRECT1_H_
+///
+/// \file nld_ms_direct1.h
+///
+
#include "nld_ms_direct.h"
#include "nld_solver.h"
@@ -52,4 +52,4 @@ namespace solver
} // namespace netlist
-#endif /* NLD_MS_DIRECT1_H_ */
+#endif // NLD_MS_DIRECT1_H_
diff --git a/src/lib/netlist/solver/nld_ms_direct2.h b/src/lib/netlist/solver/nld_ms_direct2.h
index 26123730b59..7be8e006baf 100644
--- a/src/lib/netlist/solver/nld_ms_direct2.h
+++ b/src/lib/netlist/solver/nld_ms_direct2.h
@@ -1,13 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * nld_ms_direct1.h
- *
- */
#ifndef NLD_MS_DIRECT2_H_
#define NLD_MS_DIRECT2_H_
+///
+/// \file nld_ms_direct2.h
+///
+
#include "nld_ms_direct.h"
#include "nld_solver.h"
@@ -60,4 +60,4 @@ namespace solver
} // namespace solver
} // namespace netlist
-#endif /* NLD_MS_DIRECT2_H_ */
+#endif // NLD_MS_DIRECT2_H_
diff --git a/src/lib/netlist/solver/nld_ms_gcr.h b/src/lib/netlist/solver/nld_ms_gcr.h
index 5d4730ea3b1..b6625bc576f 100644
--- a/src/lib/netlist/solver/nld_ms_gcr.h
+++ b/src/lib/netlist/solver/nld_ms_gcr.h
@@ -1,15 +1,15 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * nld_ms_gcr.h
- *
- * Gaussian elimination using compressed row format.
- *
- */
#ifndef NLD_MS_GCR_H_
#define NLD_MS_GCR_H_
+///
+/// \file nld_ms_gcr.h
+///
+/// Gaussian elimination using compressed row format.
+///
+
#include "plib/mat_cr.h"
#include "nld_ms_direct.h"
@@ -41,7 +41,7 @@ namespace solver
{
const std::size_t iN = this->size();
- /* build the final matrix */
+ // build the final matrix
std::vector<std::vector<unsigned>> fill(iN);
@@ -67,7 +67,7 @@ namespace solver
for (mat_index_type k=0; k<iN; k++)
{
std::size_t cnt(0);
- /* build pointers into the compressed row format matrix for each terminal */
+ // build pointers into the compressed row format matrix for each terminal
for (std::size_t j=0; j< this->m_terms[k].railstart();j++)
{
int other = this->m_terms[k].m_connected_net_idx[j];
@@ -164,7 +164,7 @@ namespace solver
strm("\tconst {1} f{2}_{3} = -f{4} * m_A{5};\n", fptype, i, j, i, pj);
pj++;
- // subtract row i from j */
+ // subtract row i from j
for (std::size_t pii = pi; pii<piie; )
{
while (mat.col_idx[pj] < mat.col_idx[pii])
@@ -224,11 +224,11 @@ namespace solver
template <typename FT, int SIZE>
unsigned matrix_solver_GCR_t<FT, SIZE>::vsolve_non_dynamic(const bool newton_raphson)
{
- /* populate matrix */
+ // populate matrix
mat.set_scalar(plib::constants<FT>::zero());
this->fill_matrix_and_rhs();
- /* now solve it */
+ // now solve it
if (m_proc.resolved())
{
@@ -237,9 +237,9 @@ namespace solver
else
{
// parallel is slow -- very slow
- //mat.gaussian_elimination_parallel(RHS);
+ // mat.gaussian_elimination_parallel(RHS);
mat.gaussian_elimination(this->m_RHS);
- /* backward substitution */
+ // backward substitution
mat.gaussian_back_substitution(this->m_new_V, this->m_RHS);
}
@@ -255,4 +255,4 @@ namespace solver
} // namespace solver
} // namespace netlist
-#endif /* NLD_MS_GCR_H_ */
+#endif // NLD_MS_GCR_H_
diff --git a/src/lib/netlist/solver/nld_ms_gmres.h b/src/lib/netlist/solver/nld_ms_gmres.h
index fbc59fef598..566a003110e 100644
--- a/src/lib/netlist/solver/nld_ms_gmres.h
+++ b/src/lib/netlist/solver/nld_ms_gmres.h
@@ -1,13 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * nld_ms_gmres.h
- *
- */
#ifndef NLD_MS_GMRES_H_
#define NLD_MS_GMRES_H_
+///
+/// \file nld_ms_gmres.h
+///
+
#include "nld_ms_direct.h"
#include "nld_solver.h"
#include "plib/gmres.h"
@@ -29,10 +29,10 @@ namespace solver
using float_type = FT;
- /* Sort rows in ascending order. This should minimize fill-in and thus
- * maximize the efficiency of the incomplete LUT.
- * This is already preconditioning.
- */
+ // Sort rows in ascending order. This should minimize fill-in and thus
+ // maximize the efficiency of the incomplete LUT.
+ // This is already preconditioning.
+
matrix_solver_GMRES_t(netlist_state_t &anetlist, const pstring &name,
analog_net_t::list_t &nets,
const solver_parameters_t *params,
@@ -58,7 +58,7 @@ namespace solver
m_ops.build(fill);
this->log_fill(fill, m_ops.m_mat);
- /* build pointers into the compressed row format matrix for each terminal */
+ // build pointers into the compressed row format matrix for each terminal
for (std::size_t k=0; k<iN; k++)
{
@@ -101,7 +101,7 @@ namespace solver
m_ops.m_mat.set_scalar(plib::constants<FT>::zero());
- /* populate matrix and V for first estimate */
+ // populate matrix and V for first estimate
this->fill_matrix_and_rhs();
for (std::size_t k = 0; k < iN; k++)
@@ -136,4 +136,4 @@ namespace solver
} // namespace solver
} // namespace netlist
-#endif /* NLD_MS_GMRES_H_ */
+#endif // NLD_MS_GMRES_H_
diff --git a/src/lib/netlist/solver/nld_ms_sm.h b/src/lib/netlist/solver/nld_ms_sm.h
index 13a38c34946..481b957bf6c 100644
--- a/src/lib/netlist/solver/nld_ms_sm.h
+++ b/src/lib/netlist/solver/nld_ms_sm.h
@@ -1,38 +1,37 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * nld_ms_direct.h
- *
- *
- * Sherman-Morrison Solver
- *
- * Computes the updated inverse of A given that the change in A is
- *
- * A <- A + (u x v) u,v vectors
- *
- * In this specific implementation, u is a unit vector specifying the row which
- * changed. Thus v contains the changed column.
- *
- * Than z = A^-1 u , w = transpose(A^-1) v , lambda = v z
- *
- * A^-1 <- 1.0 / (1.0 + lambda) * (z x w)
- *
- * The approach is iterative and applied for each row changed.
- *
- * The performance for a typical circuit like kidniki compared to Gaussian
- * elimination is poor:
- *
- * a) The code needs to be run for each row change.
- * b) The inverse of A typically is fully occupied.
- *
- * It may have advantages for circuits with a high number of elements and only
- * few dynamic/active components.
- *
- */
#ifndef NLD_MS_SM_H_
#define NLD_MS_SM_H_
+///
+/// \file nld_ms_sm.h
+///
+/// Sherman-Morrison Solver
+///
+/// Computes the updated inverse of A given that the change in A is
+///
+/// A <- A + (u x v) u,v vectors
+///
+/// In this specific implementation, u is a unit vector specifying the row which
+/// changed. Thus v contains the changed column.
+///
+/// Than z = A^-1 u , w = transpose(A^-1) v , lambda = v z
+///
+/// A^-1 <- 1.0 / (1.0 + lambda) * (z x w)
+///
+/// The approach is iterative and applied for each row changed.
+///
+/// The performance for a typical circuit like kidniki compared to Gaussian
+/// elimination is poor:
+///
+/// a) The code needs to be run for each row change.
+/// b) The inverse of A typically is fully occupied.
+///
+/// It may have advantages for circuits with a high number of elements and only
+/// few dynamic/active components.
+///
+
#include "nld_matrix_solver.h"
#include "nld_solver.h"
#include "plib/vector_ops.h"
@@ -127,15 +126,15 @@ namespace solver
}
Ainv(i,i) = plib::constants<FT>::one();
}
- /* down */
+ // down
for (std::size_t i = 0; i < kN; i++)
{
- /* FIXME: Singular matrix? */
+ // FIXME: Singular matrix?
const float_type f = plib::reciprocal(W(i,i));
const auto * const p = this->m_terms[i].m_nzrd.data();
const std::size_t e = this->m_terms[i].m_nzrd.size();
- /* Eliminate column i from row j */
+ // Eliminate column i from row j
const auto * const pb = this->m_terms[i].m_nzbd.data();
const std::size_t eb = this->m_terms[i].m_nzbd.size();
@@ -153,10 +152,10 @@ namespace solver
}
}
}
- /* up */
+ // up
for (std::size_t i = kN; i-- > 0; )
{
- /* FIXME: Singular matrix? */
+ // FIXME: Singular matrix?
const float_type f = plib::reciprocal(W(i,i));
for (std::size_t j = i; j-- > 0; )
{
@@ -212,7 +211,7 @@ namespace solver
if ((m_cnt % 50) == 0)
{
- /* complete calculation */
+ // complete calculation
this->LE_invert();
}
else
@@ -243,9 +242,9 @@ namespace solver
auto lamba(plib::constants<FT>::zero());
std::array<float_type, m_pitch> w = {0};
- /* compute w and lamba */
+ // compute w and lamba
for (std::size_t i = 0; i < iN; i++)
- z[i] = Ainv(i, row); /* u is row'th column */
+ z[i] = Ainv(i, row); // u is row'th column
for (std::size_t j = 0; j < colcount; j++)
lamba += v[cols[j]] * z[cols[j]];
@@ -255,7 +254,7 @@ namespace solver
std::size_t col = cols[j];
float_type f = v[col];
for (std::size_t k = 0; k < iN; k++)
- w[k] += Ainv(col,k) * f; /* Transpose(Ainv) * v */
+ w[k] += Ainv(col,k) * f; // Transpose(Ainv) * v
}
lamba = -plib::reciprocal(plib::constants<float_type>::one() + lamba);
@@ -298,4 +297,4 @@ namespace solver
} // namespace solver
} // namespace netlist
-#endif /* NLD_MS_DIRECT_H_ */
+#endif // NLD_MS_SM_H_
diff --git a/src/lib/netlist/solver/nld_ms_sor.h b/src/lib/netlist/solver/nld_ms_sor.h
index 7ee7dea6742..44669e5b6af 100644
--- a/src/lib/netlist/solver/nld_ms_sor.h
+++ b/src/lib/netlist/solver/nld_ms_sor.h
@@ -1,17 +1,17 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * nld_ms_sor.h
- *
- * Generic successive over relaxation solver.
- *
- * Fow w==1 we will do the classic Gauss-Seidel approach
- *
- */
#ifndef NLD_MS_SOR_H_
#define NLD_MS_SOR_H_
+///
+/// \file nld_ms_sor.h
+///
+/// Generic successive over relaxation solver.
+///
+/// Fow w==1 we will do the classic Gauss-Seidel approach.
+///
+
#include "nld_ms_direct.h"
#include "nld_solver.h"
@@ -58,13 +58,13 @@ namespace solver
bool resched = false;
unsigned resched_cnt = 0;
- /* ideally, we could get an estimate for the spectral radius of
- * Inv(D - L) * U
- *
- * and estimate using
- *
- * omega = 2.0 / (1.0 + std::sqrt(1-rho))
- */
+ // ideally, we could get an estimate for the spectral radius of
+ // Inv(D - L) * U
+ //
+ // and estimate using
+ //
+ // omega = 2.0 / (1.0 + std::sqrt(1-rho))
+ //
const auto ws(static_cast<float_type>(this->m_params.m_gs_sor));
@@ -164,4 +164,4 @@ namespace solver
} // namespace solver
} // namespace netlist
-#endif /* NLD_MS_SOR_H_ */
+#endif // NLD_MS_SOR_H_
diff --git a/src/lib/netlist/solver/nld_ms_sor_mat.h b/src/lib/netlist/solver/nld_ms_sor_mat.h
index ddc340053df..1e1f8aba071 100644
--- a/src/lib/netlist/solver/nld_ms_sor_mat.h
+++ b/src/lib/netlist/solver/nld_ms_sor_mat.h
@@ -1,17 +1,17 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * nld_ms_sor.h
- *
- * Generic successive over relaxation solver.
- *
- * Fow w==1 we will do the classic Gauss-Seidel approach
- *
- */
#ifndef NLD_MS_SOR_MAT_H_
#define NLD_MS_SOR_MAT_H_
+///
+/// \file nld_ms_sor.h
+///
+/// Generic successive over relaxation solver.
+///
+/// For w==1 we will do the classic Gauss-Seidel approach
+///
+
#include "nld_matrix_solver.h"
#include "nld_ms_direct.h"
#include "nld_solver.h"
@@ -62,9 +62,9 @@ namespace solver
template <unsigned m_N, unsigned storage_N>
float_type matrix_solver_SOR_mat_t<m_N, storage_N>::vsolve()
{
- /*
- * enable linear prediction on first newton pass
- */
+ //
+ // enable linear prediction on first newton pass
+ //
if (this->m_params->use_linear_prediction)
for (unsigned k = 0; k < this->size(); k++)
@@ -109,10 +109,9 @@ namespace solver
template <typename FT, int SIZE>
unsigned matrix_solver_SOR_mat_t<FT, SIZE>::vsolve_non_dynamic(const bool newton_raphson)
{
- /* The matrix based code looks a lot nicer but actually is 30% slower than
- * the optimized code which works directly on the data structures.
- * Need something like that for gaussian elimination as well.
- */
+ // The matrix based code looks a lot nicer but actually is 30% slower than
+ // the optimized code which works directly on the data structures.
+ // Need something like that for gaussian elimination as well.
const std::size_t iN = this->size();
@@ -220,4 +219,4 @@ namespace solver
} // namespace solver
} // namespace netlist
-#endif /* NLD_MS_GAUSS_SEIDEL_H_ */
+#endif // NLD_MS_SOR_MAT_
diff --git a/src/lib/netlist/solver/nld_ms_w.h b/src/lib/netlist/solver/nld_ms_w.h
index eaf793146d3..07a4635d7dc 100644
--- a/src/lib/netlist/solver/nld_ms_w.h
+++ b/src/lib/netlist/solver/nld_ms_w.h
@@ -1,45 +1,45 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * nld_ms_direct.h
- *
- *
- * Woodbury Solver
- *
- * Computes the updated solution of A given that the change in A is
- *
- * A <- A + (U x transpose(V)) U,V matrices
- *
- * The approach is describes in "Numerical Recipes in C", Second edition, Page 75ff
- *
- * Whilst the book proposes to invert the matrix R=(I+transpose(V)*Z) we define
- *
- * w = transpose(V)*y
- * a = R^-1 * w
- *
- * and consequently
- *
- * R * a = w
- *
- * And solve for a using Gaussian elimination. This is a lot faster.
- *
- * One fact omitted in the book is the fact that actually the matrix Z which contains
- * in it's columns the solutions of
- *
- * A * zk = uk
- *
- * for uk being unit vectors for full rank (max(k) == n) is identical to the
- * inverse of A.
- *
- * The approach performs relatively well for matrices up to n ~ 40 (kidniki using frontiers).
- * Kidniki without frontiers has n==88. Here, the average number of Newton-Raphson
- * loops increase to 20. It looks like that the approach for larger matrices
- * introduces numerical instability.
- */
#ifndef NLD_MS_W_H_
#define NLD_MS_W_H_
+///
+/// \file nld_ms_direct.h
+///
+/// Woodbury Solver
+///
+/// Computes the updated solution of A given that the change in A is
+///
+/// A <- A + (U x transpose(V)) U,V matrices
+///
+/// The approach is describes in "Numerical Recipes in C", Second edition, Page 75ff
+///
+/// Whilst the book proposes to invert the matrix R=(I+transpose(V)*Z) we define
+///
+/// w = transpose(V)*y
+/// a = R^-1 * w
+///
+/// and consequently
+///
+/// R * a = w
+///
+/// And solve for a using Gaussian elimination. This is a lot faster.
+///
+/// One fact omitted in the book is the fact that actually the matrix Z which contains
+/// in it's columns the solutions of
+///
+/// A * zk = uk
+///
+/// for uk being unit vectors for full rank (max(k) == n) is identical to the
+/// inverse of A.
+///
+/// The approach performs relatively well for matrices up to n ~ 40 (kidniki using frontiers).
+/// Kidniki without frontiers has n==88. Here, the average number of Newton-Raphson
+/// loops increase to 20. It looks like that the approach for larger matrices
+/// introduces numerical instability.
+///
+
#include "nld_matrix_solver.h"
#include "nld_solver.h"
#include "plib/vector_ops.h"
@@ -89,7 +89,7 @@ namespace solver
template <typename T1, typename T2>
float_ext_type &W(const T1 &r, const T2 &c) { return m_W[r][c]; }
- /* access to Ainv for fixed columns over row, there store transposed */
+ // access to Ainv for fixed columns over row, there store transposed
template <typename T1, typename T2>
float_ext_type &Ainv(const T1 &r, const T2 &c) { return m_Ainv[c][r]; }
template <typename T1>
@@ -110,7 +110,7 @@ namespace solver
array2D<float_ext_type, storage_N, m_pitch> m_lA;
- /* temporary */
+ // temporary
array2D<float_ext_type, storage_N, m_pitch> H;
std::array<unsigned, storage_N> rows;
array2D<unsigned, storage_N, m_pitch> cols;
@@ -137,15 +137,15 @@ namespace solver
}
Ainv(i,i) = plib::constants<FT>::one();
}
- /* down */
+ // down
for (std::size_t i = 0; i < kN; i++)
{
- /* FIXME: Singular matrix? */
+ // FIXME: Singular matrix?
const float_type f = plib::reciprocal(W(i,i));
const auto * const p = this->m_terms[i].m_nzrd.data();
const size_t e = this->m_terms[i].m_nzrd.size();
- /* Eliminate column i from row j */
+ // Eliminate column i from row j
const auto * const pb = this->m_terms[i].m_nzbd.data();
const size_t eb = this->m_terms[i].m_nzbd.size();
@@ -163,10 +163,10 @@ namespace solver
}
}
}
- /* up */
+ // up
for (std::size_t i = kN; i-- > 0; )
{
- /* FIXME: Singular matrix? */
+ // FIXME: Singular matrix?
const float_type f = plib::reciprocal(W(i,i));
for (std::size_t j = i; j-- > 0; )
{
@@ -219,16 +219,16 @@ namespace solver
if ((m_cnt % 50) == 0)
{
- /* complete calculation */
+ // complete calculation
this->LE_invert();
this->LE_compute_x(this->m_new_V);
}
else
{
- /* Solve Ay = b for y */
+ // Solve Ay = b for y
this->LE_compute_x(this->m_new_V);
- /* determine changed rows */
+ // determine changed rows
unsigned rowcount=0;
#define VT(r,c) (A(r,c) - lA(r,c))
@@ -250,9 +250,9 @@ namespace solver
}
if (rowcount > 0)
{
- /* construct w = transform(V) * y
- * dim: rowcount x iN
- * */
+ // construct w = transform(V) * y
+ // dim: rowcount x iN
+ //
for (unsigned i = 0; i < rowcount; i++)
{
const unsigned r = rows[i];
@@ -268,7 +268,7 @@ namespace solver
for (unsigned i = 0; i < rowcount; i++)
H[i][i] = plib::constants<FT>::one();
- /* Construct H = (I + VT*Z) */
+ // Construct H = (I + VT*Z)
for (unsigned i = 0; i < rowcount; i++)
for (unsigned k=0; k< colcount[i]; k++)
{
@@ -280,7 +280,7 @@ namespace solver
H[i][j] += f * Ainv(col,rows[j]);
}
- /* Gaussian elimination of H */
+ // Gaussian elimination of H
for (unsigned i = 0; i < rowcount; i++)
{
// FIXME: comparison to zero
@@ -303,7 +303,7 @@ namespace solver
}
}
}
- /* Back substitution */
+ // Back substitution
//inv(H) w = t w = H t
for (unsigned j = rowcount; j-- > 0; )
{
@@ -316,7 +316,7 @@ namespace solver
t[j] = (w[j] - tmp) / H[j][j];
}
- /* x = y - Zt */
+ // x = y - Zt
for (unsigned i=0; i<iN; i++)
{
float_type tmp = plib::constants<FT>::zero();
@@ -363,4 +363,4 @@ namespace solver
} // namespace solver
} // namespace netlist
-#endif /* NLD_MS_DIRECT_H_ */
+#endif // NLD_MS_DIRECT_H_
diff --git a/src/lib/netlist/solver/nld_solver.cpp b/src/lib/netlist/solver/nld_solver.cpp
index 16f2f68cb5a..c9cd5534ee0 100644
--- a/src/lib/netlist/solver/nld_solver.cpp
+++ b/src/lib/netlist/solver/nld_solver.cpp
@@ -1,14 +1,9 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * nld_solver.c
- *
- */
-
-/* Commented out for now. Relatively low number of terminals / nets make
- * the vectorizations fast-math enables pretty expensive
- */
+// Commented out for now. Relatively low number of terminals / nets make
+// the vectorizations fast-math enables pretty expensive
+//
#if 0
#pragma GCC optimize "-ftree-vectorize"
#pragma GCC optimize "-ffast-math"
@@ -74,8 +69,8 @@ namespace devices
return;
netlist_time now(exec().time());
- /* force solving during start up if there are no time-step devices */
- /* FIXME: Needs a more elegant solution */
+ // force solving during start up if there are no time-step devices
+ // FIXME: Needs a more elegant solution
bool force_solve = (now < netlist_time::from_fp<decltype(m_params.m_max_timestep)>(2 * m_params.m_max_timestep));
std::size_t nthreads = std::min(static_cast<std::size_t>(m_params.m_parallel()), plib::omp::get_max_threads());
@@ -101,7 +96,7 @@ namespace devices
for (auto & solver : solvers)
solver->update_inputs();
- /* step circuit */
+ // step circuit
if (!m_Q_step.net().is_queued())
{
m_Q_step.net().toggle_and_push_to_queue(netlist_time::from_fp(m_params.m_max_timestep));
@@ -137,10 +132,10 @@ namespace devices
case solver::matrix_type_e::MAT:
return create_it<solver::matrix_solver_direct_t<FT, SIZE>>(state(), solvername, nets, m_params, size);
case solver::matrix_type_e::SM:
- /* Sherman-Morrison Formula */
+ // Sherman-Morrison Formula
return create_it<solver::matrix_solver_sm_t<FT, SIZE>>(state(), solvername, nets, m_params, size);
case solver::matrix_type_e::W:
- /* Woodbury Formula */
+ // Woodbury Formula
return create_it<solver::matrix_solver_w_t<FT, SIZE>>(state(), solvername, nets, m_params, size);
case solver::matrix_type_e::SOR:
return create_it<solver::matrix_solver_SOR_t<FT, SIZE>>(state(), solvername, nets, m_params, size);
@@ -261,10 +256,10 @@ namespace devices
bool already_processed(const analog_net_t &n) const
{
- /* no need to process rail nets - these are known variables */
+ // no need to process rail nets - these are known variables
if (n.isRailNet())
return true;
- /* if it's already processed - no need to continue */
+ // if it's already processed - no need to continue
for (auto & grp : groups)
if (plib::container::contains(grp, &n))
return true;
@@ -273,19 +268,19 @@ namespace devices
void process_net(analog_net_t &n)
{
- /* ignore empty nets. FIXME: print a warning message */
+ // ignore empty nets. FIXME: print a warning message
if (n.num_cons() == 0)
return;
- /* add the net */
+ // add the net
groups.back().push_back(&n);
- /* process all terminals connected to this net */
+ // process all terminals connected to this net
for (auto &term : n.core_terms())
{
- /* only process analog terminals */
+ // only process analog terminals
if (term->is_type(detail::terminal_type::TERMINAL))
{
auto *pt = static_cast<terminal_t *>(term);
- /* check the connected terminal */
+ // check the connected terminal
analog_net_t &connected_net = pt->connected_terminal()->net();
if (!already_processed(connected_net))
process_net(connected_net);
@@ -301,7 +296,7 @@ namespace devices
if (!net->isRailNet() && net->num_cons() > 0)
{
netlist.log().debug(" ==> not a rail net\n");
- /* Must be an analog net */
+ // Must be an analog net
auto &n = *static_cast<analog_net_t *>(net.get());
if (!already_processed(n))
{
diff --git a/src/lib/netlist/solver/nld_solver.h b/src/lib/netlist/solver/nld_solver.h
index 02b231655ee..c6a69846ab3 100644
--- a/src/lib/netlist/solver/nld_solver.h
+++ b/src/lib/netlist/solver/nld_solver.h
@@ -1,13 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * nld_solver.h
- *
- */
#ifndef NLD_SOLVER_H_
#define NLD_SOLVER_H_
+///
+/// \file nld_solver.h
+///
+
#include "netlist/nl_base.h"
#include "nld_matrix_solver.h"
#include "plib/pstream.h"
@@ -69,4 +69,4 @@ namespace devices
} // namespace devices
} // namespace netlist
-#endif /* NLD_SOLVER_H_ */
+#endif // NLD_SOLVER_H_
diff --git a/src/lib/netlist/tools/nl_convert.cpp b/src/lib/netlist/tools/nl_convert.cpp
index 4e5dc6632ff..8bcabe5a56a 100644
--- a/src/lib/netlist/tools/nl_convert.cpp
+++ b/src/lib/netlist/tools/nl_convert.cpp
@@ -1,9 +1,5 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * nl_convert.cpp
- *
- */
#include "plib/palloc.h"
#include "plib/pstonum.h"
@@ -14,11 +10,11 @@
#include <algorithm>
#include <unordered_map>
-/* FIXME: temporarily defined here - should be in a file */
-/* FIXME: family logic in netlist is convoluted, create
- * define a model param on core device
- */
-/* Format: external name,netlist device,model */
+// FIXME: temporarily defined here - should be in a file
+// FIXME: family logic in netlist is convoluted, create
+// define a model param on core device
+
+// Format: external name,netlist device,model
static constexpr const char s_lib_map[] =
"SN74LS00D, TTL_7400_DIP, 74LSXX\n"
"SN74LS04D, TTL_7404_DIP, 74LSXX\n"
@@ -56,9 +52,9 @@ static lib_map_t read_lib_map(const pstring &lm)
return m;
}
-/*-------------------------------------------------
- convert - convert a spice netlist
--------------------------------------------------*/
+// -------------------------------------------------
+// convert - convert a spice netlist
+// -------------------------------------------------
nl_convert_base_t::nl_convert_base_t()
: out(&m_buf)
@@ -69,11 +65,11 @@ nl_convert_base_t::nl_convert_base_t()
{"T", "", 1.0e12 },
{"G", "", 1.0e9 },
{"MEG", "RES_M({1})", 1.0e6 },
- {"k", "RES_K({1})", 1.0e3 }, /* eagle */
+ {"k", "RES_K({1})", 1.0e3 }, // eagle
{"K", "RES_K({1})", 1.0e3 },
{"", "{1}", 1.0e0 },
{"M", "CAP_M({1})", 1.0e-3 },
- {"u", "CAP_U({1})", 1.0e-6 }, /* eagle */
+ {"u", "CAP_U({1})", 1.0e-6 }, // eagle
{"U", "CAP_U({1})", 1.0e-6 },
{"μ", "CAP_U({1})", 1.0e-6 },
{"µ", "CAP_U({1})", 1.0e-6 },
@@ -142,7 +138,7 @@ void nl_convert_base_t::add_term(const pstring &netname, const pstring &termname
m_nets.emplace(netname, std::move(nets));
}
- /* if there is a pin alias, translate ... */
+ // if there is a pin alias, translate ...
pin_alias_t *alias = m_pins[termname].get();
if (alias != nullptr)
@@ -240,11 +236,11 @@ std::vector<nl_convert_base_t::unit_t> nl_convert_base_t::m_units = {
{"T", "", 1.0e12 },
{"G", "", 1.0e9 },
{"MEG", "RES_M({1})", 1.0e6 },
- {"k", "RES_K({1})", 1.0e3 }, /* eagle */
+ {"k", "RES_K({1})", 1.0e3 }, // eagle
{"K", "RES_K({1})", 1.0e3 },
{"", "{1}", 1.0e0 },
{"M", "CAP_M({1})", 1.0e-3 },
- {"u", "CAP_U({1})", 1.0e-6 }, /* eagle */
+ {"u", "CAP_U({1})", 1.0e-6 }, // eagle
{"U", "CAP_U({1})", 1.0e-6 },
{"μ", "CAP_U({1})", 1.0e-6 },
{"µ", "CAP_U({1})", 1.0e-6 },
@@ -333,9 +329,9 @@ void nl_convert_spice_t::process_line(const pstring &line)
break;
case 'Q':
{
- /* check for fourth terminal ... should be numeric net
- * including "0" or start with "N" (ltspice)
- */
+ // check for fourth terminal ... should be numeric net
+ // including "0" or start with "N" (ltspice)
+
pstring model;
pstring pins ="CBE";
bool err(false);
@@ -428,7 +424,7 @@ void nl_convert_spice_t::process_line(const pstring &line)
#endif
case 'D':
add_device("DIODE", tt[0], tt[3]);
- /* FIXME ==> does Kicad use different notation from LTSPICE */
+ // FIXME ==> does Kicad use different notation from LTSPICE
add_term(tt[1], tt[0] + ".K");
add_term(tt[2], tt[0] + ".A");
break;
@@ -455,9 +451,9 @@ void nl_convert_spice_t::process_line(const pstring &line)
}
}
-/*-------------------------------------------------
- Eagle converter
--------------------------------------------------*/
+//-------------------------------------------------
+// Eagle converter
+// -------------------------------------------------
nl_convert_eagle_t::tokenizer::tokenizer(nl_convert_eagle_t &convert, plib::putf8_reader &&strm)
: plib::ptokenizer(std::move(strm))
@@ -466,14 +462,14 @@ nl_convert_eagle_t::tokenizer::tokenizer(nl_convert_eagle_t &convert, plib::putf
this->identifier_chars("abcdefghijklmnopqrstuvwvxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_.-")
.number_chars(".0123456789", "0123456789eE-.") //FIXME: processing of numbers
.whitespace(pstring("") + ' ' + static_cast<char>(9) + static_cast<char>(10) + static_cast<char>(13))
- /* FIXME: gnetlist doesn't print comments */
+ // FIXME: gnetlist doesn't print comments
.comment("/*", "*/", "//")
.string_char('\'');
m_tok_ADD = register_token("ADD");
m_tok_VALUE = register_token("VALUE");
m_tok_SIGNAL = register_token("SIGNAL");
m_tok_SEMICOLON = register_token(";");
- /* currently not used, but required for parsing */
+ // currently not used, but required for parsing
register_token(")");
register_token("(");
}
@@ -505,13 +501,13 @@ void nl_convert_eagle_t::convert(const pstring &contents)
}
else if (token.is(tok.m_tok_SEMICOLON))
{
- /* ignore empty statements */
+ // ignore empty statements
token = tok.get_token();
}
else if (token.is(tok.m_tok_ADD))
{
pstring name = tok.get_string();
- /* skip to semicolon */
+ // skip to semicolon
do
{
token = tok.get_token();
@@ -554,7 +550,7 @@ void nl_convert_eagle_t::convert(const pstring &contents)
add_pin_alias(name, "1", "Q");
break;
case 'D':
- /* Pin 1 = Anode, Pin 2 = Cathode */
+ // Pin 1 = Anode, Pin 2 = Cathode
add_device("DIODE", name, sval);
add_pin_alias(name, "1", "A");
add_pin_alias(name, "2", "K");
@@ -577,7 +573,7 @@ void nl_convert_eagle_t::convert(const pstring &contents)
token = tok.get_token();
while (!token.is(tok.m_tok_SEMICOLON))
{
- /* fixme: should check for string */
+ // fixme: should check for string
pstring devname = token.str();
pstring pin = tok.get_string();
add_term(netname, devname + "." + pin);
@@ -592,9 +588,9 @@ void nl_convert_eagle_t::convert(const pstring &contents)
}
-/*-------------------------------------------------
- RINF converter
--------------------------------------------------*/
+// -------------------------------------------------
+// RINF converter
+// -------------------------------------------------
nl_convert_rinf_t::tokenizer::tokenizer(nl_convert_rinf_t &convert, plib::putf8_reader &&strm)
: plib::ptokenizer(std::move(strm))
@@ -603,7 +599,7 @@ nl_convert_rinf_t::tokenizer::tokenizer(nl_convert_rinf_t &convert, plib::putf8_
this->identifier_chars(".abcdefghijklmnopqrstuvwvxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_-")
.number_chars("0123456789", "0123456789eE-.") //FIXME: processing of numbers
.whitespace(pstring("") + ' ' + static_cast<char>(9) + static_cast<char>(10) + static_cast<char>(13))
- /* FIXME: gnetlist doesn't print comments */
+ // FIXME: gnetlist doesn't print comments
.comment("","","//") // FIXME:needs to be confirmed
.string_char('"');
m_tok_HEA = register_token(".HEA");
@@ -622,16 +618,14 @@ void nl_convert_rinf_t::tokenizer::verror(const pstring &msg)
m_convert.out("{}\n", msg);
}
-/* token_id_t m_tok_HFA;
- token_id_t m_tok_APP;
- token_id_t m_tok_TIM;
- token_id_t m_tok_TYP;
- token_id_t m_tok_ADDC;
- token_id_t m_tok_ATTC;
- token_id_t m_tok_NET;
- token_id_t m_tok_TER;
- *
- */
+// token_id_t m_tok_HFA;
+// token_id_t m_tok_APP;
+// token_id_t m_tok_TIM;
+// token_id_t m_tok_TYP;
+// token_id_t m_tok_ADDC;
+// token_id_t m_tok_ATTC;
+// token_id_t m_tok_NET;
+// token_id_t m_tok_TER;
void nl_convert_rinf_t::convert(const pstring &contents)
{
@@ -654,19 +648,19 @@ void nl_convert_rinf_t::convert(const pstring &contents)
}
else if (token.is(tok.m_tok_HEA))
{
- /* seems to be start token - ignore */
+ // seems to be start token - ignore
token = tok.get_token();
}
else if (token.is(tok.m_tok_APP))
{
- /* version string */
+ // version string
pstring app = tok.get_string();
out("// APP: {}\n", app);
token = tok.get_token();
}
else if (token.is(tok.m_tok_TIM))
{
- /* time */
+ // time
out("// TIM:");
for (int i=0; i<6; i++)
{
@@ -747,7 +741,7 @@ void nl_convert_rinf_t::convert(const pstring &contents)
}
#if 0
token = tok.get_token();
- /* skip to semicolon */
+ // skip to semicolon
do
{
token = tok.get_token();
@@ -790,7 +784,7 @@ void nl_convert_rinf_t::convert(const pstring &contents)
add_pin_alias(name, "1", "Q");
break;
case 'D':
- /* Pin 1 = Anode, Pin 2 = Cathode */
+ // Pin 1 = Anode, Pin 2 = Cathode
add_device("DIODE", name, sval);
add_pin_alias(name, "1", "A");
add_pin_alias(name, "2", "K");
@@ -813,7 +807,7 @@ void nl_convert_rinf_t::convert(const pstring &contents)
token = tok.get_token();
while (!token.is(tok.m_tok_SEMICOLON))
{
- /* fixme: should check for string */
+ // fixme: should check for string
pstring devname = token.str();
pstring pin = tok.get_string();
add_term(netname, devname + "." + pin);
diff --git a/src/lib/netlist/tools/nl_convert.h b/src/lib/netlist/tools/nl_convert.h
index 13af926a5af..ac1597bf628 100644
--- a/src/lib/netlist/tools/nl_convert.h
+++ b/src/lib/netlist/tools/nl_convert.h
@@ -1,13 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * nl_convert.h
- *
- */
#ifndef NL_CONVERT_H_
#define NL_CONVERT_H_
+///
+/// \file nl_convert.h
+///
+
#include "plib/plists.h"
#include "plib/pstring.h"
#include "plib/ptokenizer.h"
@@ -15,9 +15,9 @@
#include <memory>
-/*-------------------------------------------------
- convert - convert a spice netlist
--------------------------------------------------*/
+// -------------------------------------------------
+// convert - convert a spice netlist
+// -------------------------------------------------
class nl_convert_base_t
{
@@ -236,4 +236,4 @@ private:
};
-#endif /* NL_CONVERT_H_ */
+#endif // NL_CONVERT_H_
diff --git a/src/mame/machine/nl_pongf.cpp b/src/mame/machine/nl_pongf.cpp
index 4ce0e73ba1c..afb8fcedf4a 100644
--- a/src/mame/machine/nl_pongf.cpp
+++ b/src/mame/machine/nl_pongf.cpp
@@ -575,37 +575,4 @@ NETLIST_START(pongf)
ALIAS(videomix, RV3.2)
-#if 1
- HINT(clk, NO_DEACTIVATE)
- HINT(ic_e1d, NO_DEACTIVATE)
- HINT(ic_e1c, NO_DEACTIVATE)
- HINT(ic_f1, NO_DEACTIVATE)
- HINT(ic_g1d, NO_DEACTIVATE)
- HINT(ic_h1a, NO_DEACTIVATE)
- HINT(ic_h1d, NO_DEACTIVATE)
- HINT(ic_h3b, NO_DEACTIVATE)
- HINT(ic_g6b, NO_DEACTIVATE)
- HINT(ic_c2a, NO_DEACTIVATE)
- HINT(hit_sound, NO_DEACTIVATE)
- HINT(topbothitsound, NO_DEACTIVATE)
- HINT(ic_c9b, NO_DEACTIVATE)
- HINT(ic_b8, NO_DEACTIVATE)
- HINT(ic_b7a, NO_DEACTIVATE)
- HINT(ic_a7b, NO_DEACTIVATE)
- HINT(ic_c9a, NO_DEACTIVATE)
- HINT(ic_a8, NO_DEACTIVATE)
- HINT(ic_b7d, NO_DEACTIVATE)
- HINT(ic_a7a, NO_DEACTIVATE)
- HINT(ic_g1a, NO_DEACTIVATE)
-
- HINT(ic_c8a, NO_DEACTIVATE)
- HINT(ic_c8b, NO_DEACTIVATE)
- HINT(ic_d8b, NO_DEACTIVATE)
-
- HINT(ic_d6b, NO_DEACTIVATE)
- HINT(ic_c6a, NO_DEACTIVATE)
- HINT(ic_c6b, NO_DEACTIVATE)
-#endif
-
-
NETLIST_END()