summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author couriersud <couriersud@gmx.org>2020-01-29 18:53:06 +0100
committer couriersud <couriersud@gmx.org>2020-01-29 18:53:06 +0100
commitd7fd89afe1a384e268cb8a9fbd0f6c4c994e195d (patch)
treee10ad631090b03b0660b148a86b784926d794bde /src
parent2742727a0beabaf5b8ae82ff9ee8596cce91b7f4 (diff)
netlist: fix parameter update recalculation. (nw)
Diffstat (limited to 'src')
-rw-r--r--src/lib/netlist/analog/nld_switches.cpp11
-rw-r--r--src/lib/netlist/analog/nlid_twoterm.cpp5
-rw-r--r--src/lib/netlist/analog/nlid_twoterm.h4
-rw-r--r--src/lib/netlist/devices/nld_r2r_dac.cpp3
-rw-r--r--src/lib/netlist/devices/nld_r2r_dac.h5
-rw-r--r--src/lib/netlist/devices/nlid_system.h7
6 files changed, 18 insertions, 17 deletions
diff --git a/src/lib/netlist/analog/nld_switches.cpp b/src/lib/netlist/analog/nld_switches.cpp
index 9861b4fd1e5..a5d68228af1 100644
--- a/src/lib/netlist/analog/nld_switches.cpp
+++ b/src/lib/netlist/analog/nld_switches.cpp
@@ -108,13 +108,13 @@ namespace netlist
m_R1.set_R(R_OFF);
m_R2.set_R(R_ON);
}
-
- //m_R1.update_dev(time);
- //m_R2.update_dev(time);
}
NETLIB_UPDATE_PARAM(switch2)
{
+ // FIXME: We only need to update the net first if this is a time stepping net
+ m_R1.solve_now();
+ m_R2.solve_now();
if (!m_POS())
{
m_R1.set_R(R_ON);
@@ -125,9 +125,8 @@ namespace netlist
m_R1.set_R(R_OFF);
m_R2.set_R(R_ON);
}
-
- m_R1.solve_now();
- m_R2.solve_now();
+ m_R1.solve_later();
+ m_R2.solve_later();
}
} //namespace analog
diff --git a/src/lib/netlist/analog/nlid_twoterm.cpp b/src/lib/netlist/analog/nlid_twoterm.cpp
index e06a9cf275a..5aa312bc64a 100644
--- a/src/lib/netlist/analog/nlid_twoterm.cpp
+++ b/src/lib/netlist/analog/nlid_twoterm.cpp
@@ -66,6 +66,7 @@ namespace analog
NETLIB_UPDATE_PARAM(POT)
{
+ // FIXME: We only need to update the net first if this is a time stepping net
m_R1.solve_now();
m_R2.solve_now();
@@ -76,6 +77,8 @@ namespace analog
v = nlconst::one() - v;
m_R1.set_R(std::max(m_R() * v, exec().gmin()));
m_R2.set_R(std::max(m_R() * (nlconst::one() - v), exec().gmin()));
+ m_R1.solve_later();
+ m_R2.solve_later();
}
@@ -97,6 +100,7 @@ namespace analog
NETLIB_UPDATE_PARAM(POT2)
{
+ // FIXME: We only need to update the net first if this is a time stepping net
m_R1.solve_now();
nl_fptype v = m_Dial();
@@ -106,6 +110,7 @@ namespace analog
if (m_Reverse())
v = nlconst::one() - v;
m_R1.set_R(std::max(m_R() * v, exec().gmin()));
+ m_R1.solve_later();
}
// ----------------------------------------------------------------------------------------
diff --git a/src/lib/netlist/analog/nlid_twoterm.h b/src/lib/netlist/analog/nlid_twoterm.h
index ee3acdd1132..d869144cbe2 100644
--- a/src/lib/netlist/analog/nlid_twoterm.h
+++ b/src/lib/netlist/analog/nlid_twoterm.h
@@ -167,8 +167,10 @@ namespace analog
NETLIB_UPDATE_PARAMI()
{
+ // FIXME: We only need to update the net first if this is a time stepping net
solve_now();
set_R(std::max(m_R(), exec().gmin()));
+ solve_later();
}
private:
@@ -485,11 +487,13 @@ namespace analog
NETLIB_UPDATE_PARAMI()
{
+ // FIXME: We only need to update the net first if this is a time stepping net
//FIXME: works only for CS without function
solve_now();
const auto zero(nlconst::zero());
set_mat(zero, zero, -m_I(),
zero, zero, m_I());
+ solve_later();
}
private:
diff --git a/src/lib/netlist/devices/nld_r2r_dac.cpp b/src/lib/netlist/devices/nld_r2r_dac.cpp
index 8f2c62d2185..361652a373a 100644
--- a/src/lib/netlist/devices/nld_r2r_dac.cpp
+++ b/src/lib/netlist/devices/nld_r2r_dac.cpp
@@ -39,12 +39,13 @@ namespace netlist
NETLIB_UPDATE_PARAM(r2r_dac)
{
+ // FIXME: We only need to update the net first if this is a time stepping net
solve_now();
-
nl_fptype V = m_VIN() / static_cast<nl_fptype>(1 << m_num())
* static_cast<nl_fptype>(m_val());
this->set_G_V_I(plib::reciprocal(m_R()), V, nlconst::zero());
+ solve_later();
}
} //namespace analog
diff --git a/src/lib/netlist/devices/nld_r2r_dac.h b/src/lib/netlist/devices/nld_r2r_dac.h
index 8a4257a3cbf..d440f999d67 100644
--- a/src/lib/netlist/devices/nld_r2r_dac.h
+++ b/src/lib/netlist/devices/nld_r2r_dac.h
@@ -49,9 +49,6 @@
#include "netlist/nl_setup.h"
#define R2R_DAC(name, p_VIN, p_R, p_N) \
- NET_REGISTER_DEV(R2R_DAC, name) \
- NETDEV_PARAMI(name, VIN, p_VIN) \
- NETDEV_PARAMI(name, R, p_R) \
- NETDEV_PARAMI(name, N, p_N)
+ NET_REGISTER_DEVEXT(R2R_DAC, name, p_VIN, p_R, p_N)
#endif /* NLD_R2R_DAC_H_ */
diff --git a/src/lib/netlist/devices/nlid_system.h b/src/lib/netlist/devices/nlid_system.h
index a2c4951794a..ce9970df81e 100644
--- a/src/lib/netlist/devices/nlid_system.h
+++ b/src/lib/netlist/devices/nlid_system.h
@@ -179,8 +179,6 @@ namespace devices
netlist_time::mult_type total = 0;
for (unsigned i=0; i<m_size; i++)
{
- // FIXME: use pstonum_ne
- //pati[i] = plib::pstonum<decltype(pati[i])>(pat[i]);
pati[i] = plib::pstonum<std::int64_t>(pat[i]);
total += pati[i];
}
@@ -344,7 +342,6 @@ namespace devices
private:
analog::NETLIB_NAME(twoterm) m_RIN;
- // Fixme: only works if the device is time-stepped - need to rework
analog::NETLIB_NAME(twoterm) m_ROUT;
analog_input_t m_I;
analog_output_t m_Q;
@@ -355,8 +352,6 @@ namespace devices
// -----------------------------------------------------------------------------
// nld_function
- //
- // FIXME: Currently a proof of concept to get congo bongo working
// ----------------------------------------------------------------------------- */
NETLIB_OBJECT(function)
@@ -437,7 +432,7 @@ namespace devices
const nl_fptype R = state ? m_RON() : m_ROFF();
// FIXME: We only need to update the net first if this is a time stepping net
- m_R.update();
+ m_R.solve_now();
m_R.set_R(R);
m_R.solve_later();
}