diff options
author | 2015-05-05 21:43:45 +0200 | |
---|---|---|
committer | 2015-05-06 20:38:04 +0200 | |
commit | ef8b1168b35695d6875092ca42d9844a783a2402 (patch) | |
tree | bdcf1be8d1ed4aeee8896627b8b11d1f073df6c1 /src/emu/netlist | |
parent | 1dd58681aa0ee817568c0cac7e033b13dbe8a8ea (diff) | |
parent | 0c705c7c6f43112bb057410fa4ad3ab006d9b480 (diff) |
- improved 9312 device ==> 20% speed increase
- remove netlist_state_t ==> no added value
- removed dead code in solver
- various minor modifications
- performance monitoring now also displays stats for subdevices
- fixed save-state issues
[Couriersud]
Diffstat (limited to 'src/emu/netlist')
39 files changed, 219 insertions, 271 deletions
diff --git a/src/emu/netlist/analog/nld_ms_direct.h b/src/emu/netlist/analog/nld_ms_direct.h index 42e29d04b33..71780de6893 100644 --- a/src/emu/netlist/analog/nld_ms_direct.h +++ b/src/emu/netlist/analog/nld_ms_direct.h @@ -21,7 +21,7 @@ public: ATTR_COLD virtual void vsetup(netlist_analog_net_t::list_t &nets); ATTR_COLD virtual void reset() { netlist_matrix_solver_t::reset(); } - ATTR_HOT inline const int N() const { if (m_N == 0) return m_dim; else return m_N; } + ATTR_HOT inline const int N() const { return (m_N == 0 ? m_dim : m_N); } ATTR_HOT inline int vsolve_non_dynamic(); @@ -52,7 +52,6 @@ protected: terms_t *m_rails_temp; private: - vector_ops_t *m_row_ops[_storage_N + 1]; int m_dim; nl_double m_lp_fact; @@ -72,9 +71,7 @@ netlist_matrix_solver_direct_t<m_N, _storage_N>::~netlist_matrix_solver_direct_t 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); @@ -243,16 +240,12 @@ ATTR_HOT void netlist_matrix_solver_direct_t<m_N, _storage_N>::build_LE() const nl_double * RESTRICT gt = m_terms[k]->gt(); const nl_double * RESTRICT go = m_terms[k]->go(); const nl_double * RESTRICT Idr = m_terms[k]->Idr(); -#if VECTALT - for (int i = 0; i < terms_count; i++) { rhsk = rhsk + Idr[i]; akk = akk + gt[i]; } -#else - m_terms[k]->ops()->sum2(Idr, gt, rhsk, akk); -#endif + nl_double * const * RESTRICT other_cur_analog = m_terms[k]->other_curanalog(); for (int i = m_terms[k]->m_railstart; i < terms_count; i++) { @@ -345,13 +338,8 @@ ATTR_HOT void netlist_matrix_solver_direct_t<m_N, _storage_N>::gauss_LE( const nl_double f1 = - m_A[j][i] * f; if (f1 != 0.0) { -#if 0 && VECTALT for (int k = i + 1; k < kN; k++) m_A[j][k] += m_A[i][k] * f1; -#else - // addmult gives some performance increase here... - m_row_ops[kN - (i + 1)]->addmult(&m_A[j][i+1], &m_A[i][i+1], f1) ; -#endif m_RHS[j] += m_RHS[i] * f1; } } @@ -464,9 +452,7 @@ netlist_matrix_solver_direct_t<m_N, _storage_N>::netlist_matrix_solver_direct_t( 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()); } template <int m_N, int _storage_N> @@ -481,9 +467,7 @@ netlist_matrix_solver_direct_t<m_N, _storage_N>::netlist_matrix_solver_direct_t( 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 a3641c0b29b..be7c60d7ca1 100644 --- a/src/emu/netlist/analog/nld_ms_gauss_seidel.h +++ b/src/emu/netlist/analog/nld_ms_gauss_seidel.h @@ -260,6 +260,7 @@ ATTR_HOT inline int netlist_matrix_solver_gauss_seidel_t<m_N, _storage_N>::vsolv ATTR_ALIGN nl_double one_m_w[_storage_N]; ATTR_ALIGN nl_double RHS[_storage_N]; ATTR_ALIGN nl_double new_V[_storage_N]; + ATTR_ALIGN nl_double old_V[_storage_N]; for (int k = 0; k < iN; k++) { @@ -275,21 +276,15 @@ ATTR_HOT inline int netlist_matrix_solver_gauss_seidel_t<m_N, _storage_N>::vsolv const nl_double * const RESTRICT go = this->m_terms[k]->go(); const nl_double * const RESTRICT Idr = this->m_terms[k]->Idr(); const nl_double * const *other_cur_analog = this->m_terms[k]->other_curanalog(); -#if VECTALT + for (int i = 0; i < term_count; i++) { gtot_t = gtot_t + gt[i]; RHS_t = RHS_t + Idr[i]; - } - if (USE_GABS) - for (int i = 0; i < term_count; i++) + if (USE_GABS) gabs_t = gabs_t + fabs(go[i]); -#else - if (USE_GABS) - this->m_terms[k]->ops()->sum2a(gt, Idr, go, gtot_t, RHS_t, gabs_t); - else - this->m_terms[k]->ops()->sum2(gt, Idr, gtot_t, RHS_t); -#endif + } + for (int i = this->m_terms[k]->m_railstart; i < term_count; i++) RHS_t = RHS_t + go[i] * *other_cur_analog[i]; } diff --git a/src/emu/netlist/analog/nld_solver.c b/src/emu/netlist/analog/nld_solver.c index 62b1661abcf..d8815f48f33 100644 --- a/src/emu/netlist/analog/nld_solver.c +++ b/src/emu/netlist/analog/nld_solver.c @@ -39,39 +39,6 @@ #include "omp.h" #endif -vector_ops_t *vector_ops_t::create_ops(const int size) -{ - switch (size) - { - case 1: - return nl_alloc(vector_ops_impl_t<1>); - case 2: - return nl_alloc(vector_ops_impl_t<2>); - case 3: - return nl_alloc(vector_ops_impl_t<3>); - case 4: - return nl_alloc(vector_ops_impl_t<4>); - case 5: - return nl_alloc(vector_ops_impl_t<5>); - case 6: - return nl_alloc(vector_ops_impl_t<6>); - case 7: - return nl_alloc(vector_ops_impl_t<7>); - case 8: - return nl_alloc(vector_ops_impl_t<8>); - case 9: - return nl_alloc(vector_ops_impl_t<9>); - case 10: - return nl_alloc(vector_ops_impl_t<10>); - case 11: - return nl_alloc(vector_ops_impl_t<11>); - case 12: - return nl_alloc(vector_ops_impl_t<12>); - default: - return nl_alloc(vector_ops_impl_t<0>, size); - } -} - ATTR_COLD void terms_t::add(netlist_terminal_t *term, int net_other) { m_term.add(term); @@ -556,7 +523,7 @@ ATTR_COLD void NETLIB_NAME(solver)::post_start() break; } - register_sub(*ms, pstring::sprintf("Solver %d",m_mat_solvers.count())); + register_sub(*ms, pstring::sprintf("Solver_%d",m_mat_solvers.count())); ms->vsetup(groups[i]); diff --git a/src/emu/netlist/analog/nld_solver.h b/src/emu/netlist/analog/nld_solver.h index a0cdec5c786..44e5ccf0158 100644 --- a/src/emu/netlist/analog/nld_solver.h +++ b/src/emu/netlist/analog/nld_solver.h @@ -48,107 +48,6 @@ struct netlist_solver_parameters_t netlist_time m_nt_sync_delay; }; -class vector_ops_t -{ -public: - - vector_ops_t(int size) - : m_dim(size) - { - } - - virtual ~vector_ops_t() {} - - virtual const nl_double sum(const nl_double * v) = 0; - virtual void sum2(const nl_double * RESTRICT v1, const nl_double * RESTRICT v2, nl_double & RESTRICT s1, nl_double & RESTRICT s2) = 0; - virtual void addmult(nl_double * RESTRICT v1, const nl_double * RESTRICT v2, const nl_double &mult) = 0; - virtual void sum2a(const nl_double * RESTRICT v1, const nl_double * RESTRICT v2, const nl_double * RESTRICT v3abs, nl_double & RESTRICT s1, nl_double & RESTRICT s2, nl_double & RESTRICT s3abs) = 0; - - virtual const nl_double sumabs(const nl_double * v) = 0; - - static vector_ops_t *create_ops(const int size); - -protected: - int m_dim; - -private: - -}; - -template <int m_N> -class vector_ops_impl_t : public vector_ops_t -{ -public: - - vector_ops_impl_t() - : vector_ops_t(m_N) - { - } - - vector_ops_impl_t(int size) - : vector_ops_t(size) - { - nl_assert(m_N == 0); - } - - virtual ~vector_ops_impl_t() {} - - ATTR_HOT inline const int N() const { if (m_N == 0) return m_dim; else return m_N; } - - const nl_double sum(const nl_double * v) - { - const nl_double * RESTRICT vl = v; - nl_double tmp = 0.0; - for (int i=0; i < N(); i++) - tmp += vl[i]; - return tmp; - } - - void sum2(const nl_double * RESTRICT v1, const nl_double * RESTRICT v2, nl_double & RESTRICT s1, nl_double & RESTRICT s2) - { - const nl_double * RESTRICT v1l = v1; - const nl_double * RESTRICT v2l = v2; - for (int i=0; i < N(); i++) - { - s1 += v1l[i]; - s2 += v2l[i]; - } - } - - void addmult(nl_double * RESTRICT v1, const nl_double * RESTRICT v2, const nl_double &mult) - { - nl_double * RESTRICT v1l = v1; - const nl_double * RESTRICT v2l = v2; - for (int i=0; i < N(); i++) - { - v1l[i] += v2l[i] * mult; - } - } - - void sum2a(const nl_double * RESTRICT v1, const nl_double * RESTRICT v2, const nl_double * RESTRICT v3abs, nl_double & RESTRICT s1, nl_double & RESTRICT s2, nl_double & RESTRICT s3abs) - { - const nl_double * RESTRICT v1l = v1; - const nl_double * RESTRICT v2l = v2; - const nl_double * RESTRICT v3l = v3abs; - for (int i=0; i < N(); i++) - { - s1 += v1l[i]; - s2 += v2l[i]; - s3abs += fabs(v3l[i]); - } - } - - const nl_double sumabs(const nl_double * v) - { - const nl_double * RESTRICT vl = v; - nl_double tmp = 0.0; - for (int i=0; i < N(); i++) - tmp += fabs(vl[i]); - return tmp; - } - -private: -}; class ATTR_ALIGNED(64) terms_t { diff --git a/src/emu/netlist/devices/nld_4020.h b/src/emu/netlist/devices/nld_4020.h index 3ecf7923a38..10d5fa4e1da 100644 --- a/src/emu/netlist/devices/nld_4020.h +++ b/src/emu/netlist/devices/nld_4020.h @@ -47,7 +47,7 @@ NETLIB_SUBDEVICE(4020_sub, netlist_ttl_input_t m_IP; - netlist_state_t<UINT16> m_cnt; + UINT16 m_cnt; netlist_ttl_output_t m_Q[14]; ); diff --git a/src/emu/netlist/devices/nld_4066.c b/src/emu/netlist/devices/nld_4066.c index f512fdd598d..a7021d67345 100644 --- a/src/emu/netlist/devices/nld_4066.c +++ b/src/emu/netlist/devices/nld_4066.c @@ -20,10 +20,10 @@ NETLIB_RESET(4066) NETLIB_UPDATE(4066) { - nl_double sup = (m_supply.get()->vdd() - m_supply.get()->vss()); + nl_double sup = (m_supply->vdd() - m_supply->vss()); nl_double low = 0.45 * sup; nl_double high = 0.55 * sup; - nl_double in = INPANALOG(m_control) - m_supply.get()->vss(); + nl_double in = INPANALOG(m_control) - m_supply->vss(); nl_double rON = m_base_r * 5.0 / sup; nl_double R = -1.0; diff --git a/src/emu/netlist/devices/nld_4066.h b/src/emu/netlist/devices/nld_4066.h index 63bb7b764e3..d70b4047803 100644 --- a/src/emu/netlist/devices/nld_4066.h +++ b/src/emu/netlist/devices/nld_4066.h @@ -40,8 +40,8 @@ public: netlist_analog_input_t m_control; NETLIB_NAME(R) m_R; - netlist_state_t<NETLIB_NAME(vdd_vss) *>m_supply; - netlist_state_t<nl_double> m_base_r; + NETLIB_NAME(vdd_vss) *m_supply; + nl_double m_base_r; ); NETLIB_DEVICE(4066_dip, diff --git a/src/emu/netlist/devices/nld_74107.h b/src/emu/netlist/devices/nld_74107.h index 8f96841d3c0..150516a00c3 100644 --- a/src/emu/netlist/devices/nld_74107.h +++ b/src/emu/netlist/devices/nld_74107.h @@ -80,9 +80,9 @@ NETLIB_SUBDEVICE(74107Asub, netlist_ttl_output_t m_Q; netlist_ttl_output_t m_QQ; - netlist_state_t<netlist_sig_t> m_Q1; - netlist_state_t<netlist_sig_t> m_Q2; - netlist_state_t<netlist_sig_t> m_F; + netlist_sig_t m_Q1; + netlist_sig_t m_Q2; + netlist_sig_t m_F; ATTR_HOT void newstate(const netlist_sig_t state); diff --git a/src/emu/netlist/devices/nld_74123.h b/src/emu/netlist/devices/nld_74123.h index de030f38db4..a5c9f430577 100644 --- a/src/emu/netlist/devices/nld_74123.h +++ b/src/emu/netlist/devices/nld_74123.h @@ -59,9 +59,9 @@ public: netlist_analog_input_t m_CV; - netlist_state_t<netlist_sig_t> m_last_trig; - netlist_state_t<UINT8> m_state; - netlist_state_t<double> m_KP; + netlist_sig_t m_last_trig; + UINT8 m_state; + double m_KP; netlist_param_double_t m_K; netlist_param_double_t m_RI; diff --git a/src/emu/netlist/devices/nld_74153.h b/src/emu/netlist/devices/nld_74153.h index 5f633ef00f0..03c942f9a70 100644 --- a/src/emu/netlist/devices/nld_74153.h +++ b/src/emu/netlist/devices/nld_74153.h @@ -66,7 +66,7 @@ NETLIB_SUBDEVICE(74153sub, netlist_ttl_output_t m_Y; - netlist_state_t<int> m_chan; + int m_chan; ); NETLIB_DEVICE(74153, diff --git a/src/emu/netlist/devices/nld_74175.h b/src/emu/netlist/devices/nld_74175.h index 47b094f1ba2..08c825ca09e 100644 --- a/src/emu/netlist/devices/nld_74175.h +++ b/src/emu/netlist/devices/nld_74175.h @@ -50,8 +50,8 @@ NETLIB_SUBDEVICE(74175_sub, netlist_ttl_output_t m_Q[4]; netlist_ttl_output_t m_QQ[4]; - netlist_state_t<netlist_sig_t> m_clrq; - netlist_state_t<UINT8> m_data; + netlist_sig_t m_clrq; + UINT8 m_data; ); NETLIB_DEVICE(74175, diff --git a/src/emu/netlist/devices/nld_74192.h b/src/emu/netlist/devices/nld_74192.h index 2b5ba415940..036358db9b5 100644 --- a/src/emu/netlist/devices/nld_74192.h +++ b/src/emu/netlist/devices/nld_74192.h @@ -47,9 +47,9 @@ NETLIB_DEVICE(74192, netlist_ttl_input_t m_CU; netlist_ttl_input_t m_CD; - netlist_state_t<INT8> m_cnt; - netlist_state_t<UINT8> m_last_CU; - netlist_state_t<UINT8> m_last_CD; + INT8 m_cnt; + UINT8 m_last_CU; + UINT8 m_last_CD; netlist_ttl_output_t m_Q[4]; netlist_ttl_output_t m_BORROWQ; diff --git a/src/emu/netlist/devices/nld_74193.h b/src/emu/netlist/devices/nld_74193.h index fc2a7de8105..ffe92f5fd94 100644 --- a/src/emu/netlist/devices/nld_74193.h +++ b/src/emu/netlist/devices/nld_74193.h @@ -46,9 +46,9 @@ NETLIB_DEVICE(74193, netlist_ttl_input_t m_CU; netlist_ttl_input_t m_CD; - netlist_state_t<INT8> m_cnt; - netlist_state_t<UINT8> m_last_CU; - netlist_state_t<UINT8> m_last_CD; + INT8 m_cnt; + UINT8 m_last_CU; + UINT8 m_last_CD; netlist_ttl_output_t m_Q[4]; netlist_ttl_output_t m_BORROWQ; diff --git a/src/emu/netlist/devices/nld_7448.h b/src/emu/netlist/devices/nld_7448.h index f1b0fd7fcaa..2c06638f93a 100644 --- a/src/emu/netlist/devices/nld_7448.h +++ b/src/emu/netlist/devices/nld_7448.h @@ -49,7 +49,7 @@ NETLIB_SUBDEVICE(7448_sub, netlist_ttl_input_t m_D; netlist_ttl_input_t m_RBIQ; - netlist_state_t<UINT8> m_state; + UINT8 m_state; netlist_ttl_output_t m_a; netlist_ttl_output_t m_b; diff --git a/src/emu/netlist/devices/nld_7474.h b/src/emu/netlist/devices/nld_7474.h index 3452400dd54..d2d8ac08cf2 100644 --- a/src/emu/netlist/devices/nld_7474.h +++ b/src/emu/netlist/devices/nld_7474.h @@ -57,7 +57,7 @@ NETLIB_SUBDEVICE(7474sub, netlist_ttl_input_t m_CLK; - netlist_state_t<UINT8> m_nextD; + INT8 m_nextD; netlist_ttl_output_t m_Q; netlist_ttl_output_t m_QQ; diff --git a/src/emu/netlist/devices/nld_7483.h b/src/emu/netlist/devices/nld_7483.h index 82a3e2f4f8f..d2da6ecc517 100644 --- a/src/emu/netlist/devices/nld_7483.h +++ b/src/emu/netlist/devices/nld_7483.h @@ -55,7 +55,7 @@ NETLIB_DEVICE(7483, netlist_ttl_input_t m_B3; netlist_ttl_input_t m_B4; - netlist_state_t<UINT8> m_lastr; + UINT8 m_lastr; netlist_ttl_output_t m_S1; netlist_ttl_output_t m_S2; diff --git a/src/emu/netlist/devices/nld_7486.c b/src/emu/netlist/devices/nld_7486.c index 4eddfb828ef..301eb2dee2f 100644 --- a/src/emu/netlist/devices/nld_7486.c +++ b/src/emu/netlist/devices/nld_7486.c @@ -16,9 +16,10 @@ NETLIB_RESET(7486) { } +static const netlist_time delay[2] = { NLTIME_FROM_NS(15), NLTIME_FROM_NS(22) }; + NETLIB_UPDATE(7486) { - static const netlist_time delay[2] = { NLTIME_FROM_NS(15), NLTIME_FROM_NS(22) }; UINT8 t = INPLOGIC(m_A) ^ INPLOGIC(m_B); OUTLOGIC(m_Q, t, delay[t]); } diff --git a/src/emu/netlist/devices/nld_7490.h b/src/emu/netlist/devices/nld_7490.h index 1a83dbaa711..4b4d84ff612 100644 --- a/src/emu/netlist/devices/nld_7490.h +++ b/src/emu/netlist/devices/nld_7490.h @@ -80,9 +80,9 @@ NETLIB_DEVICE(7490, netlist_ttl_input_t m_A; netlist_ttl_input_t m_B; - netlist_state_t<UINT8> m_cnt; - netlist_state_t<UINT8> m_last_A; - netlist_state_t<UINT8> m_last_B; + UINT8 m_cnt; + UINT8 m_last_A; + UINT8 m_last_B; netlist_ttl_output_t m_Q[4]; ); diff --git a/src/emu/netlist/devices/nld_7493.h b/src/emu/netlist/devices/nld_7493.h index 4ff18ec9e18..8c856048a7c 100644 --- a/src/emu/netlist/devices/nld_7493.h +++ b/src/emu/netlist/devices/nld_7493.h @@ -73,7 +73,7 @@ NETLIB_SUBDEVICE(7493ff, netlist_ttl_input_t m_I; netlist_ttl_output_t m_Q; - netlist_state_t<UINT8> m_reset; + UINT8 m_reset; ); NETLIB_DEVICE(7493, diff --git a/src/emu/netlist/devices/nld_74ls629.h b/src/emu/netlist/devices/nld_74ls629.h index c32c0c283ad..c571b5c29ed 100644 --- a/src/emu/netlist/devices/nld_74ls629.h +++ b/src/emu/netlist/devices/nld_74ls629.h @@ -40,8 +40,8 @@ NETLIB_SUBDEVICE(SN74LS629clk, netlist_logic_output_t m_Y; netlist_time m_inc; - netlist_state_t<netlist_sig_t> m_enableq; - netlist_state_t<netlist_sig_t> m_out; + netlist_sig_t m_enableq; + netlist_sig_t m_out; ); NETLIB_DEVICE_WITH_PARAMS(SN74LS629, diff --git a/src/emu/netlist/devices/nld_82S16.c b/src/emu/netlist/devices/nld_82S16.c index 368a9060138..5a7328f0b86 100644 --- a/src/emu/netlist/devices/nld_82S16.c +++ b/src/emu/netlist/devices/nld_82S16.c @@ -84,7 +84,10 @@ NETLIB_START(82S16_dip) register_input("12", m_WEQ); register_input("13", m_DIN); - register_output("6", m_DOUTQ);} + register_output("6", m_DOUTQ); + + save(NLNAME(m_ram)); +} NETLIB_RESET(82S16_dip) { diff --git a/src/emu/netlist/devices/nld_82S16.h b/src/emu/netlist/devices/nld_82S16.h index 6992e252ca3..1d3c64e0ca6 100644 --- a/src/emu/netlist/devices/nld_82S16.h +++ b/src/emu/netlist/devices/nld_82S16.h @@ -33,7 +33,6 @@ NETLIB_DEVICE(82S16, - UINT8 m_ram[256]; netlist_ttl_input_t m_A[8]; netlist_ttl_input_t m_CE1Q; netlist_ttl_input_t m_CE2Q; @@ -41,6 +40,9 @@ NETLIB_DEVICE(82S16, netlist_ttl_input_t m_WEQ; netlist_ttl_input_t m_DIN; netlist_ttl_output_t m_DOUTQ; + + //netlist_state_t<UINT8[256]> m_ram; + UINT8 m_ram[256]; ); NETLIB_DEVICE_DERIVED(82S16_dip, 82S16, diff --git a/src/emu/netlist/devices/nld_9310.c b/src/emu/netlist/devices/nld_9310.c index 9d31f2cf13c..2f5a790cf6e 100644 --- a/src/emu/netlist/devices/nld_9310.c +++ b/src/emu/netlist/devices/nld_9310.c @@ -94,7 +94,7 @@ NETLIB_UPDATE(9310_sub) update_outputs(m_cnt); OUTLOGIC(m_RC, m_ent & (m_cnt == MAXCNT), NLTIME_FROM_NS(20)); #else - switch (m_cnt.get()) + switch (m_cnt) { case MAXCNT - 1: m_cnt = MAXCNT; @@ -114,7 +114,7 @@ NETLIB_UPDATE(9310_sub) } else { - m_cnt = m_ABCD.get()->read_ABCD(); + m_cnt = m_ABCD->read_ABCD(); update_outputs_all(m_cnt, NLTIME_FROM_NS(22)); OUTLOGIC(m_RC, m_ent & (m_cnt == MAXCNT), NLTIME_FROM_NS(27)); } diff --git a/src/emu/netlist/devices/nld_9310.h b/src/emu/netlist/devices/nld_9310.h index 35d6f14a3c1..95e3061bdca 100644 --- a/src/emu/netlist/devices/nld_9310.h +++ b/src/emu/netlist/devices/nld_9310.h @@ -81,10 +81,10 @@ NETLIB_SUBDEVICE(9310_sub, netlist_ttl_input_t m_CLK; - netlist_state_t<UINT8> m_cnt; - netlist_state_t<NETLIB_NAME(9310_subABCD) *> m_ABCD; - netlist_state_t<netlist_sig_t> m_loadq; - netlist_state_t<netlist_sig_t> m_ent; + UINT8 m_cnt; + NETLIB_NAME(9310_subABCD) *m_ABCD; + netlist_sig_t m_loadq; + netlist_sig_t m_ent; netlist_ttl_output_t m_QA; netlist_ttl_output_t m_QB; diff --git a/src/emu/netlist/devices/nld_9312.c b/src/emu/netlist/devices/nld_9312.c index 2bdaf0714d5..1565a5dada9 100644 --- a/src/emu/netlist/devices/nld_9312.c +++ b/src/emu/netlist/devices/nld_9312.c @@ -20,7 +20,7 @@ */ #include "nld_9312.h" -//#if (USE_TRUTHTABLE) +#if (USE_TRUTHTABLE) nld_9312::truthtable_t nld_9312::m_ttbl; /* FIXME: Data changes are propagating faster than changing selects A,B,C @@ -50,13 +50,78 @@ const char *nld_9312::m_desc[] = { " 1, 1, 1, 0, X, X, X, X, X, X, X, 1| 1, 0|33,28", "" }; -//#endif +#endif + +NETLIB_UPDATE(9312) +{ + const UINT8 G = INPLOGIC(m_G); + if ((m_last_G ^ G) == 1) + { + static const netlist_time delay[2] = { NLTIME_FROM_NS(33), NLTIME_FROM_NS(19) }; + OUTLOGIC(m_Y, !G, delay[!G]); + OUTLOGIC(m_YQ, G, delay[G]); + if (G) + { + m_A.inactivate(); + m_B.inactivate(); + m_C.inactivate(); + } else { + m_A.activate(); + m_B.activate(); + m_C.activate(); + } + m_last_G = G; + } + if (!G) + { + static const netlist_time delay[2] = { NLTIME_FROM_NS(33), NLTIME_FROM_NS(28) }; + const UINT8 chan = INPLOGIC(m_A) | (INPLOGIC(m_B)<<1) | (INPLOGIC(m_C)<<2); + if (m_last_chan != chan) + { + m_D[m_last_chan].inactivate(); + m_D[chan].activate(); + } + const UINT8 val = INPLOGIC(m_D[chan]); + OUTLOGIC(m_Y, val, delay[val]); + OUTLOGIC(m_YQ, !val, delay[!val]); + m_last_chan = chan; + } +} + +NETLIB_START(9312) +{ + register_input("G", m_G); + register_input("A", m_A); + register_input("B", m_B); + register_input("C", m_C); + + register_input("D0", m_D[0]); + register_input("D1", m_D[1]); + register_input("D2", m_D[2]); + register_input("D3", m_D[3]); + register_input("D4", m_D[4]); + register_input("D5", m_D[5]); + register_input("D6", m_D[6]); + register_input("D7", m_D[7]); + + register_output("Y", m_Y); + register_output("YQ", m_YQ); + + m_last_chan = 0; + m_last_G = 0; +} + +NETLIB_RESET(9312) +{ +} NETLIB_START(9312_dip) { register_sub(m_sub, "1"); +#if (USE_TRUTHTABLE) + register_subalias("13", m_sub.m_i[0]); register_subalias("12", m_sub.m_i[1]); register_subalias("11", m_sub.m_i[2]); @@ -73,6 +138,27 @@ NETLIB_START(9312_dip) register_subalias("15", m_sub.m_Q[0]); // Y register_subalias("14", m_sub.m_Q[1]); // YQ + +#else + + register_subalias("13", m_sub.m_C); + register_subalias("12", m_sub.m_B); + register_subalias("11", m_sub.m_A); + register_subalias("10", m_sub.m_G); + + register_subalias("1", m_sub.m_D[0]); + register_subalias("2", m_sub.m_D[1]); + register_subalias("3", m_sub.m_D[2]); + register_subalias("4", m_sub.m_D[3]); + register_subalias("5", m_sub.m_D[4]); + register_subalias("6", m_sub.m_D[5]); + register_subalias("7", m_sub.m_D[6]); + register_subalias("9", m_sub.m_D[7]); + + register_subalias("15", m_sub.m_Y); // Y + register_subalias("14", m_sub.m_YQ); // YQ + +#endif } NETLIB_UPDATE(9312_dip) diff --git a/src/emu/netlist/devices/nld_9312.h b/src/emu/netlist/devices/nld_9312.h index 677197d00cf..055419808dc 100644 --- a/src/emu/netlist/devices/nld_9312.h +++ b/src/emu/netlist/devices/nld_9312.h @@ -41,10 +41,27 @@ #define TTL_9312(_name) \ NET_REGISTER_DEV(9312, _name) -//#if (USE_TRUTHTABLE) +#if (USE_TRUTHTABLE) #include "nld_truthtable.h" NETLIB_TRUTHTABLE(9312, 12, 2, 0); -//#endif +#else + +NETLIB_DEVICE(9312, +public: +// C, B, A, G,D0,D1,D2,D3,D4,D5,D6,D7| Y,YQ + netlist_ttl_input_t m_A; + netlist_ttl_input_t m_B; + netlist_ttl_input_t m_C; + netlist_ttl_input_t m_G; + netlist_ttl_input_t m_D[8]; + netlist_ttl_output_t m_Y; + netlist_ttl_output_t m_YQ; + + UINT8 m_last_chan; + UINT8 m_last_G; +); + +#endif #define TTL_9312_DIP(_name) \ diff --git a/src/emu/netlist/devices/nld_9316.c b/src/emu/netlist/devices/nld_9316.c index 1de05bdd9bb..e62927f41bc 100644 --- a/src/emu/netlist/devices/nld_9316.c +++ b/src/emu/netlist/devices/nld_9316.c @@ -89,12 +89,7 @@ NETLIB_UPDATE(9316_sub) { if (m_loadq) { -#if 0 - m_cnt = (m_cnt < MAXCNT) ? m_cnt + 1 : 0; - update_outputs(m_cnt); - OUTLOGIC(m_RC, m_ent & (m_cnt == MAXCNT), NLTIME_FROM_NS(20)); -#else - switch (m_cnt.get()) + switch (m_cnt) { case MAXCNT - 1: m_cnt = MAXCNT; @@ -109,12 +104,12 @@ NETLIB_UPDATE(9316_sub) default: m_cnt++; update_outputs(m_cnt); + break; } -#endif } else { - m_cnt = m_ABCD.get()->read_ABCD(); + m_cnt = m_ABCD->read_ABCD(); OUTLOGIC(m_RC, m_ent & (m_cnt == MAXCNT), NLTIME_FROM_NS(27)); update_outputs_all(m_cnt, NLTIME_FROM_NS(22)); } diff --git a/src/emu/netlist/devices/nld_9316.h b/src/emu/netlist/devices/nld_9316.h index 316face36d9..57de7efee51 100644 --- a/src/emu/netlist/devices/nld_9316.h +++ b/src/emu/netlist/devices/nld_9316.h @@ -85,16 +85,17 @@ NETLIB_SUBDEVICE(9316_sub, netlist_ttl_input_t m_CLK; - netlist_state_t<UINT8> m_cnt; - netlist_state_t<NETLIB_NAME(9316_subABCD) *> m_ABCD; - netlist_state_t<netlist_sig_t> m_loadq; - netlist_state_t<netlist_sig_t> m_ent; - netlist_ttl_output_t m_QA; netlist_ttl_output_t m_QB; netlist_ttl_output_t m_QC; netlist_ttl_output_t m_QD; netlist_ttl_output_t m_RC; + + UINT8 m_cnt; + NETLIB_NAME(9316_subABCD) *m_ABCD; + netlist_sig_t m_loadq; + netlist_sig_t m_ent; + ); NETLIB_DEVICE(9316, diff --git a/src/emu/netlist/devices/nld_legacy.h b/src/emu/netlist/devices/nld_legacy.h index f9e085bf65f..5ace1a82b90 100644 --- a/src/emu/netlist/devices/nld_legacy.h +++ b/src/emu/netlist/devices/nld_legacy.h @@ -46,7 +46,7 @@ NETLIB_DEVICE_WITH_PARAMS(nicDelay, netlist_param_int_t m_L_to_H; netlist_param_int_t m_H_to_L; - netlist_state_t<UINT8> m_last; + UINT8 m_last; ); diff --git a/src/emu/netlist/devices/nld_log.h b/src/emu/netlist/devices/nld_log.h index 700e38d22ec..bf0bbe31a0d 100644 --- a/src/emu/netlist/devices/nld_log.h +++ b/src/emu/netlist/devices/nld_log.h @@ -28,7 +28,7 @@ NETLIB_DEVICE(log, ~NETLIB_NAME(log)(); netlist_analog_input_t m_I; protected: - netlist_state_t<FILE *> m_file; + FILE * m_file; ); #define LOGD(_name, _I, _I2) \ diff --git a/src/emu/netlist/devices/nld_ne555.c b/src/emu/netlist/devices/nld_ne555.c index 3a3646a01c8..c360c1088e2 100644 --- a/src/emu/netlist/devices/nld_ne555.c +++ b/src/emu/netlist/devices/nld_ne555.c @@ -79,7 +79,7 @@ NETLIB_UPDATE(NE555) m_ff = false; } - bool out = (!INPLOGIC(m_RESET) ? false : m_ff.get()); + bool out = (!INPLOGIC(m_RESET) ? false : m_ff); if (m_last_out && !out) { diff --git a/src/emu/netlist/devices/nld_ne555.h b/src/emu/netlist/devices/nld_ne555.h index 1d70dc9e170..2d42675a386 100644 --- a/src/emu/netlist/devices/nld_ne555.h +++ b/src/emu/netlist/devices/nld_ne555.h @@ -37,8 +37,8 @@ NETLIB_DEVICE(NE555, netlist_analog_input_t m_TRIG; netlist_analog_output_t m_OUT; - netlist_state_t<bool> m_last_out; - netlist_state_t<bool> m_ff; + bool m_last_out; + bool m_ff; inline nl_double clamp(const nl_double v, const nl_double a, const nl_double b); diff --git a/src/emu/netlist/devices/nld_signal.h b/src/emu/netlist/devices/nld_signal.h index 965d1cd36d8..e73e941d8c2 100644 --- a/src/emu/netlist/devices/nld_signal.h +++ b/src/emu/netlist/devices/nld_signal.h @@ -148,7 +148,7 @@ public: ATTR_HOT ATTR_ALIGN void update() { - const netlist_time times[2] = { NLTIME_FROM_NS(15), NLTIME_FROM_NS(22)}; + static const netlist_time times[2] = { NLTIME_FROM_NS(15), NLTIME_FROM_NS(22)}; // FIXME: this check is needed because update is called during startup as well //if (m_active == 0 && netlist().use_deactivate()) diff --git a/src/emu/netlist/devices/nld_system.h b/src/emu/netlist/devices/nld_system.h index 4ae3f9e0844..350e62cbffe 100644 --- a/src/emu/netlist/devices/nld_system.h +++ b/src/emu/netlist/devices/nld_system.h @@ -219,7 +219,7 @@ protected: ATTR_HOT ATTR_ALIGN void update_param(); private: - netlist_state_t<UINT8> m_last_state; + UINT8 m_last_state; }; diff --git a/src/emu/netlist/devices/nld_truthtable.h b/src/emu/netlist/devices/nld_truthtable.h index a503a77d856..62b8533d0f1 100644 --- a/src/emu/netlist/devices/nld_truthtable.h +++ b/src/emu/netlist/devices/nld_truthtable.h @@ -65,6 +65,7 @@ public: register_output(out[i].trim(), m_Q[i]); } } + m_ign = 0; setup_tt(); // FIXME: save state } @@ -191,18 +192,19 @@ public: UINT32 state = 0; for (int i = 0; i < m_NI; i++) { - m_i[i].activate(); + if ((m_ign & (1<<i)) != 0) + m_i[i].activate(); state |= (INPLOGIC(m_i[i]) << i); } const UINT32 nstate = state | (has_state ? (m_last_state << m_NI) : 0); const UINT32 out = m_ttp->m_outs[nstate] & ((1 << m_NO) - 1); - const UINT32 ign = m_ttp->m_outs[nstate] >> m_NO; + m_ign = m_ttp->m_outs[nstate] >> m_NO; if (has_state) m_last_state = (state << m_NO) | out; for (int i = 0; i < m_NI; i++) - if (ign & (1 << i)) + if (m_ign & (1 << i)) m_i[i].inactivate(); for (int i = 0; i < m_NO; i++) @@ -235,6 +237,7 @@ public: private: UINT32 m_last_state; + UINT32 m_ign; INT32 m_active; truthtable_t *m_ttp; diff --git a/src/emu/netlist/nl_base.c b/src/emu/netlist/nl_base.c index c0c46858777..8d2e2b42dc0 100644 --- a/src/emu/netlist/nl_base.c +++ b/src/emu/netlist/nl_base.c @@ -362,8 +362,9 @@ ATTR_COLD void netlist_base_t::log(const char *format, ...) const ATTR_COLD netlist_core_device_t::netlist_core_device_t(const family_t afamily) : netlist_object_t(DEVICE, afamily) #if (NL_KEEP_STATISTICS) - , total_time(0) - , stat_count(0) + , stat_total_time(0) + , stat_update_count(0) + , stat_call_count(0) #endif { } @@ -383,6 +384,14 @@ ATTR_COLD netlist_core_device_t::~netlist_core_device_t() { } +ATTR_COLD void netlist_core_device_t::start_dev() +{ +#if (NL_KEEP_STATISTICS) + netlist().m_started_devices.add(this, false); +#endif + start(); +} + ATTR_HOT ATTR_ALIGN const netlist_sig_t netlist_core_device_t::INPLOGIC_PASSIVE(netlist_logic_input_t &inp) { if (inp.state() != netlist_input_t::STATE_INP_PASSIVE) @@ -596,19 +605,20 @@ ATTR_COLD void netlist_net_t::save_register() netlist_object_t::save_register(); } -ATTR_HOT ATTR_ALIGN static inline void update_dev(const netlist_core_terminal_t *inp, const UINT32 mask) +ATTR_HOT /*ATTR_ALIGN*/ static inline void update_dev(const netlist_core_terminal_t *inp, const UINT32 mask) { + netlist_core_device_t &netdev = inp->netdev(); + inc_stat(netdev.stat_call_count); if ((inp->state() & mask) != 0) { - netlist_core_device_t &netdev = inp->netdev(); - begin_timing(netdev.total_time); - inc_stat(netdev.stat_count); + begin_timing(netdev.stat_total_time); + inc_stat(netdev.stat_update_count); netdev.update_dev(); - end_timing(netdev.total_time); + end_timing(netdev.stat_total_time); } } -ATTR_HOT ATTR_ALIGN inline void netlist_net_t::update_devs() +ATTR_HOT /*ATTR_ALIGN*/ inline void netlist_net_t::update_devs() { //assert(m_num_cons != 0); nl_assert(this->isRailNet()); diff --git a/src/emu/netlist/nl_base.h b/src/emu/netlist/nl_base.h index fb318a7ce70..7dbb80b7777 100644 --- a/src/emu/netlist/nl_base.h +++ b/src/emu/netlist/nl_base.h @@ -301,23 +301,6 @@ extern const netlist_logic_family_desc_t &netlist_family_CD4000; // ----------------------------------------------------------------------------- -// netlist_state_t -// ----------------------------------------------------------------------------- - -template< typename X> -class netlist_state_t { -public: - inline netlist_state_t() : m_x(static_cast<X>(0)) {} - inline netlist_state_t(const X& x_) : m_x(x_) {} - inline const X& get() const { return m_x; } - inline X& ref() { return m_x; } - inline operator const X&() const { return m_x; } - inline operator X&() { return m_x; } -private: - X m_x; -}; - -// ----------------------------------------------------------------------------- // netlist_object_t // ----------------------------------------------------------------------------- @@ -365,11 +348,6 @@ public: ATTR_COLD const pstring &name() const; PSTATE_INTERFACE_DECL() - template<typename C> ATTR_COLD void save(netlist_state_t<C> &state, - const pstring &stname) - { - save(state.ref(), stname); - } ATTR_HOT inline const type_t type() const { return m_objtype; } ATTR_HOT inline const family_t family() const { return m_family; } @@ -995,10 +973,7 @@ public: update(); #endif } - ATTR_HOT inline void start_dev() - { - start(); - } + ATTR_COLD void start_dev(); ATTR_HOT const netlist_sig_t INPLOGIC_PASSIVE(netlist_logic_input_t &inp); @@ -1033,8 +1008,9 @@ public: #if (NL_KEEP_STATISTICS) /* stats */ - osd_ticks_t total_time; - INT32 stat_count; + osd_ticks_t stat_total_time; + INT32 stat_update_count; + INT32 stat_call_count; #endif #if USE_PMFDELEGATES @@ -1205,6 +1181,9 @@ public: pnamedlist_t<netlist_device_t *> m_devices; netlist_net_t::list_t m_nets; +#if (NL_KEEP_STATISTICS) + pnamedlist_t<netlist_core_device_t *> m_started_devices; +#endif protected: diff --git a/src/emu/netlist/nl_setup.c b/src/emu/netlist/nl_setup.c index 8387f7b2918..487bbae44b6 100644 --- a/src/emu/netlist/nl_setup.c +++ b/src/emu/netlist/nl_setup.c @@ -726,10 +726,10 @@ void netlist_setup_t::print_stats() const { #if (NL_KEEP_STATISTICS) { - for (netlist_device_t * const *entry = netlist().m_devices.first(); entry != NULL; entry = netlist().m_devices.next(entry)) + for (netlist_core_device_t * const *entry = netlist().m_started_devices.first(); entry != NULL; entry = netlist().m_started_devices.next(entry)) { //entry->object()->s - printf("Device %20s : %12d %15ld\n", (*entry)->name().cstr(), (*entry)->stat_count, (long int) (*entry)->total_time / ((*entry)->stat_count + 1)); + printf("Device %20s : %12d %12d %15ld\n", (*entry)->name().cstr(), (*entry)->stat_call_count, (*entry)->stat_update_count, (long int) (*entry)->stat_total_time / ((*entry)->stat_update_count + 1)); } printf("Queue Start %15d\n", m_netlist.queue().m_prof_start); printf("Queue End %15d\n", m_netlist.queue().m_prof_end); diff --git a/src/emu/netlist/pstate.h b/src/emu/netlist/pstate.h index 3dad87c2333..0ec2f8ba4fd 100644 --- a/src/emu/netlist/pstate.h +++ b/src/emu/netlist/pstate.h @@ -16,13 +16,17 @@ // ---------------------------------------------------------------------------------------- #define PSTATE_INTERFACE_DECL() \ - template<typename C> ATTR_COLD void save(C &state, const pstring &stname); + template<typename C> ATTR_COLD void save(C &state, const pstring &stname); \ + template<typename C, std::size_t N> ATTR_COLD void save(C (&state)[N], const pstring &stname); \ + template<typename C> ATTR_COLD void save(C *state, const pstring &stname, const int count); #define PSTATE_INTERFACE(obj, manager, module) \ template<typename C> ATTR_COLD void obj::save(C &state, const pstring &stname) \ - { \ - manager->save_item(state, this, module + "." + stname); \ - } + { manager->save_item(state, this, module + "." + stname); } \ + template<typename C, std::size_t N> ATTR_COLD void obj::save(C (&state)[N], const pstring &stname) \ + { manager->save_state_ptr(module + "." + stname, nl_datatype<C>::type, this, sizeof(state[0]), N, &(state[0]), false); } \ + template<typename C> ATTR_COLD void obj::save(C *state, const pstring &stname, const int count) \ + { manager->save_state_ptr(module + "." + stname, nl_datatype<C>::type, this, sizeof(C), count, state, false); } enum pstate_data_type_e { NOT_SUPPORTED, @@ -140,9 +144,11 @@ public: inline const pstate_entry_t::list_t &save_list() const { return m_save; } -protected: + // FIXME: should be protected ATTR_COLD void save_state_ptr(const pstring &stname, const pstate_data_type_e, const void *owner, const int size, const int count, void *ptr, bool is_ptr); +protected: + private: pstate_entry_t::list_t m_save; }; |