Implemented a fallback to Gaussian elimination if Gauss-Seidel exceeds a certain number of iterations.

This commit is contained in:
Couriersud 2014-01-31 22:43:28 +00:00
parent 2f899313a0
commit 4376c828fd
6 changed files with 11 additions and 12 deletions

View File

@ -577,6 +577,9 @@ ATTR_HOT inline int netlist_matrix_solver_gauss_seidel_t<m_N, _storage_N>::solve
resched_cnt++;
} while (resched && (resched_cnt < m_resched_loops / 3 ));
if (resched)
return m_fallback.solve_non_dynamic();
return resched_cnt;
}
@ -770,7 +773,7 @@ ATTR_COLD void NETLIB_NAME(solver)::post_start()
ms = new netlist_matrix_solver_direct_t<4,4>();
//ms = new netlist_matrix_solver_gauss_seidel_t<4,4>();
break;
#if 1
#if 0
case 5:
ms = new netlist_matrix_solver_direct_t<5,5>();
//ms = new netlist_matrix_solver_gauss_seidel_t<4,4>();

View File

@ -119,15 +119,21 @@ public:
ATTR_COLD virtual void setup(netlist_net_t::list_t &nets, NETLIB_NAME(solver) &owner)
{
netlist_matrix_solver_t::setup(nets, owner);
m_fallback.setup(nets, owner);
}
ATTR_HOT int solve_non_dynamic();
ATTR_HOT inline const int N() const { if (m_N == 0) return m_nets.count(); else return m_N; }
ATTR_COLD virtual void reset() { netlist_matrix_solver_t::reset(); }
ATTR_COLD virtual void reset()
{
netlist_matrix_solver_t::reset();
m_fallback.reset();
}
private:
netlist_matrix_solver_direct_t<m_N, _storage_N> m_fallback;
};
class netlist_matrix_solver_direct1_t: public netlist_matrix_solver_direct_t<1,1>

View File

@ -16,8 +16,6 @@ NETLIB_START(nicRSFF)
NETLIB_RESET(nicRSFF)
{
// m_Q.initial(0);
// m_QQ.initial(1);
}
NETLIB_UPDATE(nicRSFF)

View File

@ -51,15 +51,11 @@ NETLIB_RESET(ttl_input)
NETLIB_UPDATE(ttl_input)
{
//m_Q.net().m_new.Q = !(m_IN.Value() & 1);
//OUTLOGIC(m_Q, m_IN.Value() & 1, NLTIME_IMMEDIATE);
OUTLOGIC(m_Q, m_IN.Value() & 1, netlist_time::from_nsec(1));
}
NETLIB_UPDATE_PARAM(ttl_input)
{
//m_Q.net().m_new.Q = !(m_IN.Value() & 1);
//OUTLOGIC(m_Q, m_IN.Value() & 1, NLTIME_IMMEDIATE);
}
// ----------------------------------------------------------------------------------------
@ -83,5 +79,4 @@ NETLIB_UPDATE(analog_input)
NETLIB_UPDATE_PARAM(analog_input)
{
//OUTANALOG(m_Q, m_IN.Value(), NLTIME_IMMEDIATE);
}

View File

@ -98,7 +98,6 @@ protected:
ATTR_COLD void reset()
{
//m_Q.initial(0.001); // Make sure update outputs something
}
ATTR_HOT ATTR_ALIGN void update()

View File

@ -435,7 +435,6 @@ ATTR_COLD netlist_net_t::netlist_net_t(const type_t atype, const family_t afamil
, m_in_queue(2)
, m_railterminal(NULL)
{
//m_last.Analog = -123456789.0; // set to something we will never hit.
m_last.Analog = 0.0; // set to something we will never hit.
m_new.Analog = 0.0;
m_cur.Analog = 0.0;
@ -443,7 +442,6 @@ ATTR_COLD netlist_net_t::netlist_net_t(const type_t atype, const family_t afamil
ATTR_COLD void netlist_net_t::reset()
{
//m_last.Analog = -123456789.0; // set to something we will never hit.
m_last.Analog = 0.0; // set to something we will never hit.
m_cur.Analog = 0.0;
m_last.Q = 0; // set to something we will never hit.