diff options
Diffstat (limited to 'src/emu/netlist/analog')
| -rw-r--r-- | src/emu/netlist/analog/nld_ms_direct.h | 44 | ||||
| -rw-r--r-- | src/emu/netlist/analog/nld_ms_gauss_seidel.h | 46 | ||||
| -rw-r--r-- | src/emu/netlist/analog/nld_opamps.c | 2 | ||||
| -rw-r--r-- | src/emu/netlist/analog/nld_solver.c | 16 | ||||
| -rw-r--r-- | src/emu/netlist/analog/nld_solver.h | 12 |
5 files changed, 60 insertions, 60 deletions
diff --git a/src/emu/netlist/analog/nld_ms_direct.h b/src/emu/netlist/analog/nld_ms_direct.h index 1e3f1f28b79..42e29d04b33 100644 --- a/src/emu/netlist/analog/nld_ms_direct.h +++ b/src/emu/netlist/analog/nld_ms_direct.h @@ -14,7 +14,7 @@ class netlist_matrix_solver_direct_t: public netlist_matrix_solver_t public: netlist_matrix_solver_direct_t(const netlist_solver_parameters_t ¶ms, int size); - netlist_matrix_solver_direct_t(const eSolverType type, const netlist_solver_parameters_t ¶ms, int size); + netlist_matrix_solver_direct_t(const eSolverType type, const netlist_solver_parameters_t ¶ms, int size); virtual ~netlist_matrix_solver_direct_t(); @@ -69,13 +69,13 @@ netlist_matrix_solver_direct_t<m_N, _storage_N>::~netlist_matrix_solver_direct_t { //delete[] m_A[k]; } - for (int k = 0; k < N(); k++) - { - nl_free(m_terms[k]); - nl_free(m_row_ops[k]); - } - nl_free(m_row_ops[N()]); - //delete[] m_last_RHS; + for (int k = 0; k < N(); k++) + { + nl_free(m_terms[k]); + nl_free(m_row_ops[k]); + } + nl_free(m_row_ops[N()]); + //delete[] m_last_RHS; //delete[] m_RHS; nl_free_array(m_terms); nl_free_array(m_rails_temp); @@ -193,17 +193,17 @@ ATTR_COLD void netlist_matrix_solver_direct_t<m_N, _storage_N>::vsetup(netlist_a * Sorting as a general matrix pre-conditioning is mentioned in * literature but I have found no articles about Gauss Seidel. * - * For Gaussian Elimination however increasing order is better suited. - * FIXME: Even better would be to sort on elements right of the matrix diagonal. - * + * For Gaussian Elimination however increasing order is better suited. + * FIXME: Even better would be to sort on elements right of the matrix diagonal. + * */ - int sort_order = (type() == GAUSS_SEIDEL ? 1 : -1); + int sort_order = (type() == GAUSS_SEIDEL ? 1 : -1); for (int k = 0; k < N() / 2; k++) for (int i = 0; i < N() - 1; i++) { - if ((m_terms[i]->m_railstart - m_terms[i+1]->m_railstart) * sort_order < 0) + if ((m_terms[i]->m_railstart - m_terms[i+1]->m_railstart) * sort_order < 0) { std::swap(m_terms[i],m_terms[i+1]); m_nets.swap(i, i+1); @@ -475,15 +475,15 @@ netlist_matrix_solver_direct_t<m_N, _storage_N>::netlist_matrix_solver_direct_t( , m_dim(size) , m_lp_fact(0) { - m_terms = nl_alloc_array(terms_t *, N()); - m_rails_temp = nl_alloc_array(terms_t, N()); - - for (int k = 0; k < N(); k++) - { - m_terms[k] = nl_alloc(terms_t); - m_row_ops[k] = vector_ops_t::create_ops(k); - } - m_row_ops[N()] = vector_ops_t::create_ops(N()); + m_terms = nl_alloc_array(terms_t *, N()); + m_rails_temp = nl_alloc_array(terms_t, N()); + + for (int k = 0; k < N(); k++) + { + m_terms[k] = nl_alloc(terms_t); + m_row_ops[k] = vector_ops_t::create_ops(k); + } + m_row_ops[N()] = vector_ops_t::create_ops(N()); } diff --git a/src/emu/netlist/analog/nld_ms_gauss_seidel.h b/src/emu/netlist/analog/nld_ms_gauss_seidel.h index 2cc7a8cda3d..a3641c0b29b 100644 --- a/src/emu/netlist/analog/nld_ms_gauss_seidel.h +++ b/src/emu/netlist/analog/nld_ms_gauss_seidel.h @@ -17,16 +17,16 @@ class ATTR_ALIGNED(64) netlist_matrix_solver_gauss_seidel_t: public netlist_matr public: netlist_matrix_solver_gauss_seidel_t(const netlist_solver_parameters_t ¶ms, int size) - : netlist_matrix_solver_direct_t<m_N, _storage_N>(netlist_matrix_solver_t::GAUSS_SEIDEL, params, size) + : netlist_matrix_solver_direct_t<m_N, _storage_N>(netlist_matrix_solver_t::GAUSS_SEIDEL, params, size) , m_lp_fact(0) , m_gs_fail(0) , m_gs_total(0) { - const char *p = osd_getenv("NETLIST_STATS"); - if (p != NULL) - m_log_stats = (bool) atoi(p); - else - m_log_stats = false; + const char *p = osd_getenv("NETLIST_STATS"); + if (p != NULL) + m_log_stats = (bool) atoi(p); + else + m_log_stats = false; } virtual ~netlist_matrix_solver_gauss_seidel_t() {} @@ -52,21 +52,21 @@ private: template <int m_N, int _storage_N> void netlist_matrix_solver_gauss_seidel_t<m_N, _storage_N>::log_stats() { - if (this->m_stat_calculations != 0 && m_log_stats) - { - printf("==============================================\n"); - printf("Solver %s\n", this->name().cstr()); - printf(" ==> %d nets\n", this->N()); //, (*(*groups[i].first())->m_core_terms.first())->name().cstr()); - printf(" has %s elements\n", this->is_dynamic() ? "dynamic" : "no dynamic"); - printf(" has %s elements\n", this->is_timestep() ? "timestep" : "no timestep"); - printf(" %6.3f average newton raphson loops\n", (double) this->m_stat_newton_raphson / (double) this->m_stat_vsolver_calls); - printf(" %10d invocations (%6d Hz) %10d gs fails (%6.2f%%) %6.3f average\n", - this->m_stat_calculations, - this->m_stat_calculations * 10 / (int) (this->netlist().time().as_double() * 10.0), - this->m_gs_fail, - 100.0 * (double) this->m_gs_fail / (double) this->m_stat_calculations, - (double) this->m_gs_total / (double) this->m_stat_calculations); - } + if (this->m_stat_calculations != 0 && m_log_stats) + { + printf("==============================================\n"); + printf("Solver %s\n", this->name().cstr()); + printf(" ==> %d nets\n", this->N()); //, (*(*groups[i].first())->m_core_terms.first())->name().cstr()); + printf(" has %s elements\n", this->is_dynamic() ? "dynamic" : "no dynamic"); + printf(" has %s elements\n", this->is_timestep() ? "timestep" : "no timestep"); + printf(" %6.3f average newton raphson loops\n", (double) this->m_stat_newton_raphson / (double) this->m_stat_vsolver_calls); + printf(" %10d invocations (%6d Hz) %10d gs fails (%6.2f%%) %6.3f average\n", + this->m_stat_calculations, + this->m_stat_calculations * 10 / (int) (this->netlist().time().as_double() * 10.0), + this->m_gs_fail, + 100.0 * (double) this->m_gs_fail / (double) this->m_stat_calculations, + (double) this->m_gs_total / (double) this->m_stat_calculations); + } } template <int m_N, int _storage_N> @@ -299,7 +299,7 @@ ATTR_HOT inline int netlist_matrix_solver_gauss_seidel_t<m_N, _storage_N>::vsolv //if (fabs(gabs_t - fabs(gtot_t)) > 1e-20) // printf("%d %e abs: %f tot: %f\n",k, gabs_t / gtot_t -1.0, gabs_t, gtot_t); - gabs_t *= 0.95; // avoid rounding issues + gabs_t *= 0.95; // avoid rounding issues if (!USE_GABS || gabs_t <= gtot_t) { w[k] = ws / gtot_t; @@ -343,7 +343,7 @@ ATTR_HOT inline int netlist_matrix_solver_gauss_seidel_t<m_N, _storage_N>::vsolv this->m_nets[k]->m_cur_Analog = new_V[k]; this->m_gs_total += resched_cnt; - this->m_stat_calculations++; + this->m_stat_calculations++; if (resched) { diff --git a/src/emu/netlist/analog/nld_opamps.c b/src/emu/netlist/analog/nld_opamps.c index 32d2457e71f..697b504e415 100644 --- a/src/emu/netlist/analog/nld_opamps.c +++ b/src/emu/netlist/analog/nld_opamps.c @@ -31,7 +31,7 @@ NETLIST_START(opamp_lm3900) NET_C(R1.2, R2.2, G1.ON) VCVS(G1) PARAM(G1.G, 10000000) - //PARAM(G1.RI, 1) + //PARAM(G1.RI, 1) PARAM(G1.RO, RES_K(8)) NETLIST_END() diff --git a/src/emu/netlist/analog/nld_solver.c b/src/emu/netlist/analog/nld_solver.c index c20277e507c..22a10ea1a3d 100644 --- a/src/emu/netlist/analog/nld_solver.c +++ b/src/emu/netlist/analog/nld_solver.c @@ -99,11 +99,11 @@ ATTR_COLD void terms_t::set_pointers() ATTR_COLD netlist_matrix_solver_t::netlist_matrix_solver_t(const eSolverType type, const netlist_solver_parameters_t ¶ms) : m_stat_calculations(0), - m_stat_newton_raphson(0), - m_stat_vsolver_calls(0), - m_params(params), - m_cur_ts(0), - m_type(type) + m_stat_newton_raphson(0), + m_stat_vsolver_calls(0), + m_params(params), + m_cur_ts(0), + m_type(type) { } @@ -257,7 +257,7 @@ ATTR_HOT void netlist_matrix_solver_t::step(const netlist_time delta) template<class C > void netlist_matrix_solver_t::solve_base(C *p) { - m_stat_vsolver_calls++; + m_stat_vsolver_calls++; if (is_dynamic()) { int this_resched; @@ -270,7 +270,7 @@ void netlist_matrix_solver_t::solve_base(C *p) newton_loops++; } while (this_resched > 1 && newton_loops < m_params.m_nr_loops); - m_stat_newton_raphson += newton_loops; + m_stat_newton_raphson += newton_loops; // reschedule .... if (this_resched > 1 && !m_Q_sync.net().is_queued()) { @@ -438,7 +438,7 @@ netlist_matrix_solver_t * NETLIB_NAME(solver)::create_solver(int size, const int return nl_alloc(netlist_matrix_solver_direct2_t, m_params); else { - typedef netlist_matrix_solver_gauss_seidel_t<m_N,_storage_N> solver_N; + typedef netlist_matrix_solver_gauss_seidel_t<m_N,_storage_N> solver_N; if (size >= gs_threshold) return nl_alloc(solver_N, m_params, size); else diff --git a/src/emu/netlist/analog/nld_solver.h b/src/emu/netlist/analog/nld_solver.h index b6baa1d31da..a0cdec5c786 100644 --- a/src/emu/netlist/analog/nld_solver.h +++ b/src/emu/netlist/analog/nld_solver.h @@ -197,8 +197,8 @@ public: enum eSolverType { - GAUSSIAN_ELIMINATION, - GAUSS_SEIDEL + GAUSSIAN_ELIMINATION, + GAUSS_SEIDEL }; ATTR_COLD netlist_matrix_solver_t(const eSolverType type, const netlist_solver_parameters_t ¶ms); @@ -243,9 +243,9 @@ protected: plinearlist_t<netlist_analog_net_t *> m_nets; plinearlist_t<netlist_analog_output_t *> m_inps; - int m_stat_calculations; - int m_stat_newton_raphson; - int m_stat_vsolver_calls; + int m_stat_calculations; + int m_stat_newton_raphson; + int m_stat_vsolver_calls; const netlist_solver_parameters_t &m_params; @@ -264,7 +264,7 @@ private: ATTR_HOT void update_inputs(); - const eSolverType m_type; + const eSolverType m_type; }; |
