summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/devices/nlid_proxy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/netlist/devices/nlid_proxy.cpp')
-rw-r--r--src/lib/netlist/devices/nlid_proxy.cpp54
1 files changed, 38 insertions, 16 deletions
diff --git a/src/lib/netlist/devices/nlid_proxy.cpp b/src/lib/netlist/devices/nlid_proxy.cpp
index a2fd18e85a7..4c3ec6f67aa 100644
--- a/src/lib/netlist/devices/nlid_proxy.cpp
+++ b/src/lib/netlist/devices/nlid_proxy.cpp
@@ -6,7 +6,7 @@
*/
#include "nlid_proxy.h"
-#include "netlist/solver/nld_solver.h"
+#include "../solver/nld_solver.h"
//#include "plib/pstream.h"
//#include "plib/pfmtlog.h"
//#include "nld_log.h"
@@ -20,7 +20,7 @@ namespace netlist
// nld_base_proxy
// -----------------------------------------------------------------------------
- nld_base_proxy::nld_base_proxy(netlist_state_t &anetlist, const pstring &name,
+ nld_base_proxy::nld_base_proxy(netlist_t &anetlist, const pstring &name,
logic_t *inout_proxied, detail::core_terminal_t *proxy_inout)
: device_t(anetlist, name)
{
@@ -29,23 +29,33 @@ namespace netlist
m_proxy_term = proxy_inout;
}
+ nld_base_proxy::~nld_base_proxy()
+ {
+ }
+
// ----------------------------------------------------------------------------------------
// nld_a_to_d_proxy
// ----------------------------------------------------------------------------------------
- nld_base_a_to_d_proxy::nld_base_a_to_d_proxy(netlist_state_t &anetlist, const pstring &name,
+ nld_base_a_to_d_proxy::nld_base_a_to_d_proxy(netlist_t &anetlist, const pstring &name,
logic_input_t *in_proxied, detail::core_terminal_t *in_proxy)
: nld_base_proxy(anetlist, name, in_proxied, in_proxy)
, m_Q(*this, "Q")
{
}
- nld_a_to_d_proxy::nld_a_to_d_proxy(netlist_state_t &anetlist, const pstring &name, logic_input_t *in_proxied)
+ nld_base_a_to_d_proxy::~nld_base_a_to_d_proxy() {}
+
+ nld_a_to_d_proxy::nld_a_to_d_proxy(netlist_t &anetlist, const pstring &name, logic_input_t *in_proxied)
: nld_base_a_to_d_proxy(anetlist, name, in_proxied, &m_I)
, m_I(*this, "I")
{
}
+ nld_a_to_d_proxy::~nld_a_to_d_proxy()
+ {
+ }
+
NETLIB_RESET(a_to_d_proxy)
{
}
@@ -71,32 +81,39 @@ namespace netlist
// nld_d_to_a_proxy
// ----------------------------------------------------------------------------------------
- nld_base_d_to_a_proxy::nld_base_d_to_a_proxy(netlist_state_t &anetlist, const pstring &name,
+ nld_base_d_to_a_proxy::nld_base_d_to_a_proxy(netlist_t &anetlist, const pstring &name,
logic_output_t *out_proxied, detail::core_terminal_t &proxy_out)
: nld_base_proxy(anetlist, name, out_proxied, &proxy_out)
, m_I(*this, "I")
{
}
- nld_d_to_a_proxy::nld_d_to_a_proxy(netlist_state_t &anetlist, const pstring &name, logic_output_t *out_proxied)
+ nld_base_d_to_a_proxy::~nld_base_d_to_a_proxy()
+ {
+ }
+
+ nld_d_to_a_proxy::nld_d_to_a_proxy(netlist_t &anetlist, const pstring &name, logic_output_t *out_proxied)
: nld_base_d_to_a_proxy(anetlist, name, out_proxied, m_RV.m_P)
, m_GNDHack(*this, "_Q")
, m_RV(*this, "RV")
, m_last_state(*this, "m_last_var", -1)
, m_is_timestep(false)
{
- const std::vector<std::pair<pstring, pstring>> power_syms = { {"VCC", "VEE"}, {"VCC", "GND"}, {"VDD", "VSS"}};
+ const pstring power_syms[3][2] ={ {"VCC", "VEE"}, {"VCC", "GND"}, {"VDD", "VSS"}};
+ //register_sub(m_RV);
+ //register_term("1", m_RV.m_P);
+ //register_term("2", m_RV.m_N);
register_subalias("Q", m_RV.m_P);
connect(m_RV.m_N, m_GNDHack);
bool f = false;
- for (auto & pwr_sym : power_syms)
+ for (int i = 0; i < 3; i++)
{
pstring devname = out_proxied->device().name();
- auto tp = setup().find_terminal(devname + "." + pwr_sym.first,
+ auto tp = netlist().setup().find_terminal(devname + "." + power_syms[i][0],
detail::terminal_type::INPUT, false);
- auto tn = setup().find_terminal(devname + "." + pwr_sym.second,
+ auto tn = netlist().setup().find_terminal(devname + "." + power_syms[i][1],
detail::terminal_type::INPUT, false);
if (tp != nullptr && tn != nullptr)
{
@@ -109,6 +126,11 @@ namespace netlist
log().warning(MW_1_NO_POWER_TERMINALS_ON_DEVICE_1, out_proxied->device().name());
else
log().verbose("D/A Proxy: Found power terminals on device {1}", out_proxied->device().name());
+#if (0)
+ printf("%s %s\n", out_proxied->name().c_str(), out_proxied->device().name().c_str());
+ auto x = netlist().setup().find_terminal(out_proxied->name(), detail::device_object_t::terminal_type::OUTPUT, false);
+ if (x) printf("==> %s\n", x->name().c_str());
+#endif
}
@@ -120,15 +142,15 @@ namespace netlist
//m_Q.initial(0.0);
m_last_state = -1;
- m_RV.reset();
+ m_RV.do_reset();
m_is_timestep = m_RV.m_P.net().solver()->has_timestep_devices();
- m_RV.set_G_V_I(plib::constants<nl_double>::one() / logic_family()->R_low(),
+ m_RV.set(NL_FCONST(1.0) / logic_family()->R_low(),
logic_family()->low_V(0.0, supply_V), 0.0);
}
NETLIB_UPDATE(d_to_a_proxy)
{
- const auto state = static_cast<int>(m_I());
+ const int state = static_cast<int>(m_I());
if (state != m_last_state)
{
// FIXME: Variable voltage
@@ -141,10 +163,10 @@ namespace netlist
// We only need to update the net first if this is a time stepping net
if (m_is_timestep)
{
- m_RV.update();
+ m_RV.update_dev();
}
- m_RV.set_G_V_I(plib::constants<nl_double>::one() / R, V, 0.0);
- m_RV.solve_later();
+ m_RV.set(NL_FCONST(1.0) / R, V, 0.0);
+ m_RV.m_P.schedule_solve_after(NLTIME_FROM_NS(1));
}
}