diff options
author | 2019-11-15 21:55:41 +0100 | |
---|---|---|
committer | 2019-11-15 22:16:37 +0100 | |
commit | bcfa9eae6f16c35254a5cee1fb992f988c0a86ce (patch) | |
tree | 8b42ff7a46d9be7b73e2c5b7170afe7c27d15180 /src/lib/netlist/devices/nld_schmitt.cpp | |
parent | df143446696cee294a6ffd7ea6bc0b09a43d9c02 (diff) |
netlist: maintenance and bug fixes, remove DUMMY_INPUT. [Couriersud]
- Removed DUMMY_INPUT. NC (not connected) pins should now use NC_PIN.
If a NC_PIN is actually connected, an error will be logged and
validation will fail.
- Enabled "extended" validation. This will catch now if power terminals
are not connected.
- Added const and noexcept where appropriate.
- Removed dead code.
- Fixed the 7414 Schmitt-Trigger device to use nld_power_pins
Diffstat (limited to 'src/lib/netlist/devices/nld_schmitt.cpp')
-rw-r--r-- | src/lib/netlist/devices/nld_schmitt.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/lib/netlist/devices/nld_schmitt.cpp b/src/lib/netlist/devices/nld_schmitt.cpp index 81624733278..c36ce978b0d 100644 --- a/src/lib/netlist/devices/nld_schmitt.cpp +++ b/src/lib/netlist/devices/nld_schmitt.cpp @@ -8,6 +8,7 @@ #include "nld_schmitt.h" #include "netlist/analog/nlid_twoterm.h" +#include "netlist/devices/nlid_system.h" #include "netlist/nl_base.h" #include "netlist/nl_errstr.h" #include "netlist/solver/nld_solver.h" @@ -61,7 +62,7 @@ namespace netlist { NETLIB_CONSTRUCTOR(schmitt_trigger) , m_A(*this, "A") - , m_GND(*this, "GND") + , m_supply(*this) , m_RVI(*this, "RVI") , m_RVO(*this, "RVO") , m_model(*this, "MODEL", "TTL_7414_GATE") @@ -71,8 +72,8 @@ namespace netlist register_subalias("Q", m_RVO.m_P); connect(m_A, m_RVI.m_P); - connect(m_GND, m_RVI.m_N); - connect(m_GND, m_RVO.m_N); + connect(m_supply.GND(), m_RVI.m_N); + connect(m_supply.GND(), m_RVO.m_N); } protected: @@ -88,9 +89,10 @@ namespace netlist NETLIB_UPDATEI() { + const auto va(m_A.Q_Analog() - m_supply.GND().Q_Analog()); if (m_last_state) { - if (m_A.Q_Analog() < m_model.m_VTM) + if (va < m_model.m_VTM) { m_last_state = 0; if (m_is_timestep) @@ -101,7 +103,7 @@ namespace netlist } else { - if (m_A.Q_Analog() > m_model.m_VTP) + if (va > m_model.m_VTP) { m_last_state = 1; if (m_is_timestep) @@ -114,7 +116,7 @@ namespace netlist private: analog_input_t m_A; - analog_input_t m_GND; + NETLIB_NAME(power_pins) m_supply; analog::NETLIB_SUB(twoterm) m_RVI; analog::NETLIB_SUB(twoterm) m_RVO; schmitt_trigger_model_t m_model; |