diff options
author | 2019-03-26 11:13:37 +1100 | |
---|---|---|
committer | 2019-03-26 11:13:37 +1100 | |
commit | 97b67170277437131adf6ed4d60139c172529e4f (patch) | |
tree | 7a5cbf608f191075f1612b1af15832c206a3fe2d /src/lib/netlist/devices/nld_system.cpp | |
parent | b380514764cf857469bae61c11143a19f79a74c5 (diff) |
(nw) Clean up the mess on master
This effectively reverts b380514764cf857469bae61c11143a19f79a74c5 and
c24473ddff715ecec2e258a6eb38960cf8c8e98e, restoring the state at
598cd5227223c3b04ca31f0dbc1981256d9ea3ff.
Before pushing, please check that what you're about to push is sane.
Check your local commit log and ensure there isn't anything out-of-place
before pushing to mainline. When things like this happen, it wastes
everyone's time. I really don't need this in a week when real work⢠is
busting my balls and I'm behind where I want to be with preparing for
MAME release.
Diffstat (limited to 'src/lib/netlist/devices/nld_system.cpp')
-rw-r--r-- | src/lib/netlist/devices/nld_system.cpp | 95 |
1 files changed, 37 insertions, 58 deletions
diff --git a/src/lib/netlist/devices/nld_system.cpp b/src/lib/netlist/devices/nld_system.cpp index eabc4b4fbff..03aa5c678f1 100644 --- a/src/lib/netlist/devices/nld_system.cpp +++ b/src/lib/netlist/devices/nld_system.cpp @@ -5,8 +5,8 @@ * */ -#include "../solver/nld_solver.h" -#include "../solver/nld_matrix_solver.h" +#include "netlist/solver/nld_solver.h" +#include "netlist/solver/nld_matrix_solver.h" #include "nlid_system.h" namespace netlist @@ -40,54 +40,40 @@ namespace netlist { m_cnt = 0; m_off = netlist_time::from_double(m_offset()); + m_feedback.m_delegate = NETLIB_DELEGATE(extclock, update); + + //m_feedback.m_delegate .set(&NETLIB_NAME(extclock)::update, this); //m_Q.initial(0); } - NETLIB_UPDATE(extclock) + NETLIB_HANDLER(extclock, clk2) { - m_Q.push((m_cnt & 1) ^ 1, m_inc[m_cnt] + m_off); - m_off = netlist_time::zero(); + m_Q.push((m_cnt & 1) ^ 1, m_inc[m_cnt]); if (++m_cnt >= m_size) m_cnt = 0; } - // ---------------------------------------------------------------------------------------- - // logic_input - // ---------------------------------------------------------------------------------------- - - NETLIB_RESET(logic_input) - { - m_Q.initial(0); - } - - NETLIB_UPDATE(logic_input) + NETLIB_HANDLER(extclock, clk2_pow2) { - m_Q.push(m_IN() & 1, netlist_time::from_nsec(1)); + m_Q.push((m_cnt & 1) ^ 1, m_inc[m_cnt]); + m_cnt = (++m_cnt) & (m_size-1); } - NETLIB_UPDATE_PARAM(logic_input) - { - } - - // ---------------------------------------------------------------------------------------- - // analog_input - // ---------------------------------------------------------------------------------------- - - NETLIB_RESET(analog_input) + NETLIB_UPDATE(extclock) { - m_Q.initial(0.0); - } + m_Q.push((m_cnt & 1) ^ 1, m_inc[m_cnt] + m_off); + m_off = netlist_time::zero(); + if (++m_cnt >= m_size) + m_cnt = 0; - NETLIB_UPDATE(analog_input) - { - m_Q.push(m_IN()); - } + // continue with optimized clock handlers .... - NETLIB_UPDATE_PARAM(analog_input) - { + if ((m_size & (m_size-1)) == 0) // power of 2? + m_feedback.m_delegate.set(&NETLIB_NAME(extclock)::clk2_pow2, this); + else + m_feedback.m_delegate.set(&NETLIB_NAME(extclock)::clk2, this); } - // ----------------------------------------------------------------------------- // nld_res_sw // ----------------------------------------------------------------------------- @@ -106,19 +92,10 @@ namespace netlist m_last_state = state; const nl_double R = state ? m_RON() : m_ROFF(); - // We only need to update the net first if this is a time stepping net - if ((0)) // m_R->m_P.net().as_analog().solver()->is_timestep()) - { - m_R.update_dev(); - m_R.set_R(R); - m_R.m_P.schedule_solve_after(NLTIME_FROM_NS(1)); - } - else - { - m_R.set_R(R); - m_R.m_P.schedule_solve_after(NLTIME_FROM_NS(1)); - //m_R->update_dev(); - } + // FIXME: We only need to update the net first if this is a time stepping net + m_R.update(); + m_R.set_R(R); + m_R.solve_later(); } } @@ -141,17 +118,19 @@ namespace netlist } - NETLIB_DEVICE_IMPL(dummy_input) - NETLIB_DEVICE_IMPL(frontier) - NETLIB_DEVICE_IMPL(function) - NETLIB_DEVICE_IMPL(logic_input) - NETLIB_DEVICE_IMPL(analog_input) - NETLIB_DEVICE_IMPL(clock) - NETLIB_DEVICE_IMPL(extclock) - NETLIB_DEVICE_IMPL(res_sw) - NETLIB_DEVICE_IMPL(mainclock) - NETLIB_DEVICE_IMPL(gnd) - NETLIB_DEVICE_IMPL(netlistparams) + NETLIB_DEVICE_IMPL(dummy_input, "DUMMY_INPUT", "") + NETLIB_DEVICE_IMPL(frontier, "FRONTIER_DEV", "+I,+G,+Q") + NETLIB_DEVICE_IMPL(function, "AFUNC", "N,FUNC") + NETLIB_DEVICE_IMPL(analog_input, "ANALOG_INPUT", "IN") + NETLIB_DEVICE_IMPL(clock, "CLOCK", "FREQ") + NETLIB_DEVICE_IMPL(extclock, "EXTCLOCK", "FREQ,PATTERN") + NETLIB_DEVICE_IMPL(res_sw, "RES_SWITCH", "+IN,+P1,+P2") + NETLIB_DEVICE_IMPL(mainclock, "MAINCLOCK", "FREQ") + NETLIB_DEVICE_IMPL(gnd, "GND", "") + NETLIB_DEVICE_IMPL(netlistparams, "PARAMETER", "") + + NETLIB_DEVICE_IMPL(logic_input, "LOGIC_INPUT", "IN,FAMILY") + NETLIB_DEVICE_IMPL_ALIAS(logic_input_ttl, logic_input, "TTL_INPUT", "IN") } //namespace devices } // namespace netlist |