diff options
Diffstat (limited to 'src/lib/netlist/devices/nld_mm5837.cpp')
-rw-r--r-- | src/lib/netlist/devices/nld_mm5837.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/lib/netlist/devices/nld_mm5837.cpp b/src/lib/netlist/devices/nld_mm5837.cpp index acd009497f6..ea987e68e4b 100644 --- a/src/lib/netlist/devices/nld_mm5837.cpp +++ b/src/lib/netlist/devices/nld_mm5837.cpp @@ -9,9 +9,6 @@ #include "netlist/analog/nlid_twoterm.h" #include "netlist/solver/nld_matrix_solver.h" -#define R_LOW (1000.0) -#define R_HIGH (1000.0) - namespace netlist { namespace devices @@ -24,6 +21,8 @@ namespace netlist , m_VGG(*this, "2") , m_VSS(*this, "4") , m_FREQ(*this, "FREQ", 24000) + , m_R_LOW(*this, "R_LOW", 1000) + , m_R_HIGH(*this, "R_HIGH", 1000) /* clock */ , m_feedback(*this, "_FB") , m_Q(*this, "_Q") @@ -52,6 +51,8 @@ namespace netlist analog_input_t m_VGG; analog_input_t m_VSS; param_fp_t m_FREQ; + param_fp_t m_R_LOW; + param_fp_t m_R_HIGH; /* clock stage */ logic_input_t m_feedback; @@ -69,7 +70,7 @@ namespace netlist { //m_V0.initial(0.0); //m_RV.do_reset(); - m_RV.set_G_V_I(nlconst::one() / nlconst::magic(R_LOW), + m_RV.set_G_V_I(plib::reciprocal(m_R_LOW()), nlconst::zero(), nlconst::zero()); m_inc = netlist_time::from_fp(plib::reciprocal(m_FREQ())); @@ -104,13 +105,13 @@ namespace netlist if (state != last_state) { - const nl_fptype R = nlconst::magic(state ? R_HIGH : R_LOW); + const nl_fptype R = state ? m_R_HIGH : m_R_LOW; const nl_fptype V = state ? m_VDD() : m_VSS(); // We only need to update the net first if this is a time stepping net if (m_is_timestep) m_RV.update(); - m_RV.set_G_V_I(nlconst::one() / R, V, nlconst::zero()); + m_RV.set_G_V_I(plib::reciprocal(R), V, nlconst::zero()); m_RV.solve_later(NLTIME_FROM_NS(1)); } |