diff --git a/src/emu/machine/netlist.c b/src/emu/machine/netlist.c index 7b7767afea1..0c7c6433233 100644 --- a/src/emu/machine/netlist.c +++ b/src/emu/machine/netlist.c @@ -63,8 +63,8 @@ void netlist_mame_analog_input_t::static_set_name(device_t &device, const char * void netlist_mame_analog_input_t::device_start() { LOG_DEV_CALLS(("start %s\n", tag())); - netlist_param_t *p = this->nl_owner().setup().find_param(m_param_name); - m_param = dynamic_cast(p); + netlist::netlist_param_t *p = this->nl_owner().setup().find_param(m_param_name); + m_param = dynamic_cast(p); if (m_param == NULL) { fatalerror("device %s wrong parameter type for %s\n", basetag(), m_param_name.cstr()); @@ -95,7 +95,7 @@ void netlist_mame_analog_output_t::static_set_params(device_t &device, const cha netlist.m_delegate = adelegate; } -void netlist_mame_analog_output_t::custom_netlist_additions(netlist_setup_t &setup) +void netlist_mame_analog_output_t::custom_netlist_additions(netlist::netlist_setup_t &setup) { pstring dname = "OUT_" + m_in; m_delegate.bind_relative_to(owner()->machine().root_device()); @@ -137,8 +137,8 @@ void netlist_mame_logic_input_t::static_set_params(device_t &device, const char void netlist_mame_logic_input_t::device_start() { LOG_DEV_CALLS(("start %s\n", tag())); - netlist_param_t *p = downcast(this->owner())->setup().find_param(m_param_name); - m_param = dynamic_cast(p); + netlist::netlist_param_t *p = downcast(this->owner())->setup().find_param(m_param_name); + m_param = dynamic_cast(p); if (m_param == NULL) { fatalerror("device %s wrong parameter type for %s\n", basetag(), m_param_name.cstr()); @@ -169,7 +169,7 @@ void netlist_mame_stream_input_t::device_start() LOG_DEV_CALLS(("start %s\n", tag())); } -void netlist_mame_stream_input_t::custom_netlist_additions(netlist_setup_t &setup) +void netlist_mame_stream_input_t::custom_netlist_additions(netlist::netlist_setup_t &setup) { NETLIB_NAME(sound_in) *snd_in = setup.netlist().get_first_device(); if (snd_in == NULL) @@ -207,7 +207,7 @@ void netlist_mame_stream_output_t::device_start() LOG_DEV_CALLS(("start %s\n", tag())); } -void netlist_mame_stream_output_t::custom_netlist_additions(netlist_setup_t &setup) +void netlist_mame_stream_output_t::custom_netlist_additions(netlist::netlist_setup_t &setup) { //NETLIB_NAME(sound_out) *snd_out; pstring sname = pstring::sprintf("STREAM_OUT_%d", m_channel); @@ -276,7 +276,7 @@ netlist_mame_device_t::netlist_mame_device_t(const machine_config &mconfig, devi { } -void netlist_mame_device_t::static_set_constructor(device_t &device, void (*setup_func)(netlist_setup_t &)) +void netlist_mame_device_t::static_set_constructor(device_t &device, void (*setup_func)(netlist::netlist_setup_t &)) { LOG_DEV_CALLS(("static_set_constructor\n")); netlist_mame_device_t &netlist = downcast(device); @@ -295,7 +295,7 @@ void netlist_mame_device_t::device_start() //printf("clock is %d\n", clock()); m_netlist = global_alloc_clear(netlist_mame_t(*this)); - m_setup = global_alloc_clear(netlist_setup_t(m_netlist)); + m_setup = global_alloc_clear(netlist::netlist_setup_t(m_netlist)); netlist().init_object(*m_netlist, "netlist"); m_setup->init(); @@ -467,14 +467,14 @@ void netlist_mame_cpu_device_t::device_start() for (int i=0; i < netlist().m_nets.size(); i++) { - netlist_net_t *n = netlist().m_nets[i]; - if (n->isFamily(netlist_object_t::LOGIC)) + netlist::netlist_net_t *n = netlist().m_nets[i]; + if (n->isFamily(netlist::netlist_object_t::LOGIC)) { - state_add(i*2, n->name(), downcast(n)->Q_state_ptr()); + state_add(i*2, n->name(), downcast(n)->Q_state_ptr()); } else { - state_add(i*2+1, n->name(), downcast(n)->Q_Analog_state_ptr()).formatstr("%20s"); + state_add(i*2+1, n->name(), downcast(n)->Q_Analog_state_ptr()).formatstr("%20s"); } } @@ -639,9 +639,9 @@ void netlist_mame_sound_device_t::sound_stream_update(sound_stream &stream, stre // memregion source support // ---------------------------------------------------------------------------------------- -bool netlist_source_memregion_t::parse(netlist_setup_t *setup, const pstring name) +bool netlist_source_memregion_t::parse(netlist::netlist_setup_t *setup, const pstring name) { const char *mem = (const char *)downcast(setup->netlist()).machine().root_device().memregion(m_name.cstr())->base(); - netlist_parser p(*setup); + netlist::netlist_parser p(*setup); return p.parse(mem, name); } diff --git a/src/emu/machine/netlist.h b/src/emu/machine/netlist.h index 829124595b5..f30e5020bdc 100644 --- a/src/emu/machine/netlist.h +++ b/src/emu/machine/netlist.h @@ -60,15 +60,15 @@ // Extensions to interface netlist with MAME code .... // ---------------------------------------------------------------------------------------- -class netlist_source_memregion_t : public netlist_setup_t::source_t +class netlist_source_memregion_t : public netlist::netlist_setup_t::source_t { public: netlist_source_memregion_t(pstring name) - : netlist_setup_t::source_t(), m_name(name) + : netlist::netlist_setup_t::source_t(), m_name(name) { } - bool parse(netlist_setup_t *setup, const pstring name); + bool parse(netlist::netlist_setup_t *setup, const pstring name); private: pstring m_name; }; @@ -81,12 +81,12 @@ private: class netlist_mame_device_t; -class netlist_mame_t : public netlist_base_t +class netlist_mame_t : public netlist::netlist_base_t { public: netlist_mame_t(netlist_mame_device_t &parent) - : netlist_base_t(), + : netlist::netlist_base_t(), m_parent(parent) {} virtual ~netlist_mame_t() { }; @@ -116,9 +116,9 @@ public: netlist_mame_device_t(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *file); virtual ~netlist_mame_device_t() {} - static void static_set_constructor(device_t &device, void (*setup_func)(netlist_setup_t &)); + static void static_set_constructor(device_t &device, void (*setup_func)(netlist::netlist_setup_t &)); - ATTR_HOT inline netlist_setup_t &setup() { return *m_setup; } + ATTR_HOT inline netlist::netlist_setup_t &setup() { return *m_setup; } ATTR_HOT inline netlist_mame_t &netlist() { return *m_netlist; } ATTR_HOT inline netlist_time last_time_update() { return m_old; } @@ -153,9 +153,9 @@ private: netlist_time m_old; netlist_mame_t * m_netlist; - netlist_setup_t * m_setup; + netlist::netlist_setup_t * m_setup; - void (*m_setup_func)(netlist_setup_t &); + void (*m_setup_func)(netlist::netlist_setup_t &); }; inline running_machine &netlist_mame_t::machine() @@ -179,7 +179,7 @@ public: netlist_mame_cpu_device_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); virtual ~netlist_mame_cpu_device_t() {} - static void static_set_constructor(device_t &device, void (*setup_func)(netlist_setup_t &)); + static void static_set_constructor(device_t &device, void (*setup_func)(netlist::netlist_setup_t &)); protected: // netlist_mame_device_t @@ -256,7 +256,7 @@ public: netlist_mame_sound_device_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); virtual ~netlist_mame_sound_device_t() {} - static void static_set_constructor(device_t &device, void (*setup_func)(netlist_setup_t &)); + static void static_set_constructor(device_t &device, void (*setup_func)(netlist::netlist_setup_t &)); inline sound_stream *get_stream() { return m_stream; } @@ -306,7 +306,7 @@ public: } virtual ~netlist_mame_sub_interface() { } - virtual void custom_netlist_additions(netlist_setup_t &setup) { } + virtual void custom_netlist_additions(netlist::netlist_setup_t &setup) { } inline netlist_mame_device_t &nl_owner() const { return *m_owner; } @@ -375,7 +375,7 @@ protected: virtual void device_start(); private: - netlist_param_double_t *m_param; + netlist::netlist_param_double_t *m_param; bool m_auto_port; pstring m_param_name; }; @@ -400,7 +400,7 @@ public: protected: // device-level overrides virtual void device_start(); - virtual void custom_netlist_additions(netlist_setup_t &setup); + virtual void custom_netlist_additions(netlist::netlist_setup_t &setup); private: pstring m_in; @@ -449,7 +449,7 @@ protected: virtual void device_start(); private: - netlist_param_int_t *m_param; + netlist::netlist_param_int_t *m_param; UINT32 m_mask; UINT32 m_shift; pstring m_param_name; @@ -473,7 +473,7 @@ public: protected: // device-level overrides virtual void device_start(); - virtual void custom_netlist_additions(netlist_setup_t &setup); + virtual void custom_netlist_additions(netlist::netlist_setup_t &setup); private: UINT32 m_channel; pstring m_param_name; @@ -497,7 +497,7 @@ public: protected: // device-level overrides virtual void device_start(); - virtual void custom_netlist_additions(netlist_setup_t &setup); + virtual void custom_netlist_additions(netlist::netlist_setup_t &setup); private: UINT32 m_channel; pstring m_out_name; @@ -506,7 +506,7 @@ private: // netdev_callback // ---------------------------------------------------------------------------------------- -class NETLIB_NAME(analog_callback) : public netlist_device_t +class NETLIB_NAME(analog_callback) : public netlist::netlist_device_t { public: NETLIB_NAME(analog_callback)() @@ -545,7 +545,7 @@ public: } private: - netlist_analog_input_t m_in; + netlist::netlist_analog_input_t m_in; netlist_analog_output_delegate m_callback; netlist_mame_cpu_device_t *m_cpu_device; nl_double m_last; @@ -555,11 +555,11 @@ private: // sound_out // ---------------------------------------------------------------------------------------- -class NETLIB_NAME(sound_out) : public netlist_device_t +class NETLIB_NAME(sound_out) : public netlist::netlist_device_t { public: NETLIB_NAME(sound_out)() - : netlist_device_t() { } + : netlist::netlist_device_t() { } static const int BUFSIZE = 2048; @@ -604,14 +604,14 @@ public: m_last_buffer = upto; } - netlist_param_int_t m_channel; - netlist_param_double_t m_mult; - netlist_param_double_t m_offset; + netlist::netlist_param_int_t m_channel; + netlist::netlist_param_double_t m_mult; + netlist::netlist_param_double_t m_offset; stream_sample_t *m_buffer; netlist_time m_sample; private: - netlist_analog_input_t m_in; + netlist::netlist_analog_input_t m_in; stream_sample_t m_cur; int m_last_pos; netlist_time m_last_buffer; @@ -621,11 +621,11 @@ private: // sound_in // ---------------------------------------------------------------------------------------- -class NETLIB_NAME(sound_in) : public netlist_device_t +class NETLIB_NAME(sound_in) : public netlist::netlist_device_t { public: NETLIB_NAME(sound_in)() - : netlist_device_t() { } + : netlist::netlist_device_t() { } static const int MAX_INPUT_CHANNELS = 10; @@ -665,7 +665,7 @@ public: if (i != m_num_channel) netlist().error("sound input numbering has to be sequential!"); m_num_channel++; - m_param[i] = dynamic_cast(setup().find_param(m_param_name[i].Value(), true)); + m_param[i] = dynamic_cast(setup().find_param(m_param_name[i].Value(), true)); } } return m_num_channel; @@ -689,16 +689,16 @@ public: m_pos = 0; } - netlist_param_str_t m_param_name[MAX_INPUT_CHANNELS]; - netlist_param_double_t *m_param[MAX_INPUT_CHANNELS]; + netlist::netlist_param_str_t m_param_name[MAX_INPUT_CHANNELS]; + netlist::netlist_param_double_t *m_param[MAX_INPUT_CHANNELS]; stream_sample_t *m_buffer[MAX_INPUT_CHANNELS]; - netlist_param_double_t m_param_mult[MAX_INPUT_CHANNELS]; - netlist_param_double_t m_param_offset[MAX_INPUT_CHANNELS]; + netlist::netlist_param_double_t m_param_mult[MAX_INPUT_CHANNELS]; + netlist::netlist_param_double_t m_param_offset[MAX_INPUT_CHANNELS]; netlist_time m_inc; private: - netlist_logic_input_t m_feedback; - netlist_logic_output_t m_Q; + netlist::netlist_logic_input_t m_feedback; + netlist::netlist_logic_output_t m_Q; int m_pos; int m_num_channel; diff --git a/src/emu/netlist/analog/mgmres.cpp b/src/emu/netlist/analog/mgmres.cpp index a6e9c0346e3..06d64eaeb26 100644 --- a/src/emu/netlist/analog/mgmres.cpp +++ b/src/emu/netlist/analog/mgmres.cpp @@ -4,6 +4,7 @@ # include # include # include +# include using namespace std; diff --git a/src/emu/netlist/analog/nld_bjt.c b/src/emu/netlist/analog/nld_bjt.c index 04de16923e2..a707ec35ac7 100644 --- a/src/emu/netlist/analog/nld_bjt.c +++ b/src/emu/netlist/analog/nld_bjt.c @@ -9,6 +9,8 @@ #include "../nl_setup.h" #include "nld_solver.h" +NETLIB_NAMESPACE_DEVICES_START() + class diode { public: @@ -248,3 +250,5 @@ NETLIB_UPDATE_TERMINALS(QBJT_EB) NETLIB_UPDATE_PARAM(QBJT_EB) { } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/analog/nld_bjt.h b/src/emu/netlist/analog/nld_bjt.h index b9bace5c032..f299f6bf6d0 100644 --- a/src/emu/netlist/analog/nld_bjt.h +++ b/src/emu/netlist/analog/nld_bjt.h @@ -24,6 +24,8 @@ NETDEV_PARAMI(_name, model, _model) +NETLIB_NAMESPACE_DEVICES_START() + // ---------------------------------------------------------------------------------------- // nld_Q - Base classes // ---------------------------------------------------------------------------------------- @@ -162,4 +164,6 @@ protected: private: }; +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_BJT_H_ */ diff --git a/src/emu/netlist/analog/nld_fourterm.c b/src/emu/netlist/analog/nld_fourterm.c index ad67ccbba4b..9e735f1f25f 100644 --- a/src/emu/netlist/analog/nld_fourterm.c +++ b/src/emu/netlist/analog/nld_fourterm.c @@ -9,6 +9,8 @@ #include "../nl_setup.h" #include "nld_solver.h" +NETLIB_NAMESPACE_DEVICES_START() + // ---------------------------------------------------------------------------------------- // nld_VCCS // ---------------------------------------------------------------------------------------- @@ -136,3 +138,5 @@ NETLIB_RESET(VCVS) NETLIB_UPDATE_PARAM(VCVS) { } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/analog/nld_fourterm.h b/src/emu/netlist/analog/nld_fourterm.h index e14a69a9944..cdc78c84206 100644 --- a/src/emu/netlist/analog/nld_fourterm.h +++ b/src/emu/netlist/analog/nld_fourterm.h @@ -26,6 +26,8 @@ NET_REGISTER_DEV(VCVS, _name) +NETLIB_NAMESPACE_DEVICES_START() + // ---------------------------------------------------------------------------------------- // nld_VCCS // ---------------------------------------------------------------------------------------- @@ -167,5 +169,7 @@ protected: netlist_param_double_t m_RO; }; +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_FOURTERM_H_ */ diff --git a/src/emu/netlist/analog/nld_ms_direct.h b/src/emu/netlist/analog/nld_ms_direct.h index 056cf774968..f52df3f3e12 100644 --- a/src/emu/netlist/analog/nld_ms_direct.h +++ b/src/emu/netlist/analog/nld_ms_direct.h @@ -12,6 +12,8 @@ #include "nld_solver.h" +NETLIB_NAMESPACE_DEVICES_START() + template class netlist_matrix_solver_direct_t: public netlist_matrix_solver_t { @@ -560,5 +562,6 @@ netlist_matrix_solver_direct_t::netlist_matrix_solver_direct_t( } } +NETLIB_NAMESPACE_DEVICES_END() #endif /* NLD_MS_DIRECT_H_ */ diff --git a/src/emu/netlist/analog/nld_ms_direct1.h b/src/emu/netlist/analog/nld_ms_direct1.h index cbd2d284c11..3158959b31e 100644 --- a/src/emu/netlist/analog/nld_ms_direct1.h +++ b/src/emu/netlist/analog/nld_ms_direct1.h @@ -11,6 +11,8 @@ #include "nld_solver.h" #include "nld_ms_direct.h" +NETLIB_NAMESPACE_DEVICES_START() + class netlist_matrix_solver_direct1_t: public netlist_matrix_solver_direct_t<1,1> { public: @@ -57,6 +59,7 @@ ATTR_HOT inline int netlist_matrix_solver_direct1_t::vsolve_non_dynamic(ATTR_UNU } +NETLIB_NAMESPACE_DEVICES_END() #endif /* NLD_MS_DIRECT1_H_ */ diff --git a/src/emu/netlist/analog/nld_ms_direct2.h b/src/emu/netlist/analog/nld_ms_direct2.h index 2996b9fbf01..6a5d452523a 100644 --- a/src/emu/netlist/analog/nld_ms_direct2.h +++ b/src/emu/netlist/analog/nld_ms_direct2.h @@ -11,7 +11,7 @@ #include "nld_solver.h" #include "nld_ms_direct.h" - +NETLIB_NAMESPACE_DEVICES_START() class netlist_matrix_solver_direct2_t: public netlist_matrix_solver_direct_t<2,2> { @@ -63,6 +63,6 @@ ATTR_HOT inline int netlist_matrix_solver_direct2_t::vsolve_non_dynamic(ATTR_UNU return 1; } - +NETLIB_NAMESPACE_DEVICES_END() #endif /* NLD_MS_DIRECT2_H_ */ diff --git a/src/emu/netlist/analog/nld_ms_gmres.h b/src/emu/netlist/analog/nld_ms_gmres.h index 9390c3dad69..54df370789b 100644 --- a/src/emu/netlist/analog/nld_ms_gmres.h +++ b/src/emu/netlist/analog/nld_ms_gmres.h @@ -19,6 +19,8 @@ #include "mgmres.hpp" +NETLIB_NAMESPACE_DEVICES_START() + template class netlist_matrix_solver_GMRES_t: public netlist_matrix_solver_direct_t { @@ -198,5 +200,6 @@ ATTR_HOT inline int netlist_matrix_solver_GMRES_t::vsolve_non_d } } +NETLIB_NAMESPACE_DEVICES_END() #endif /* NLD_MS_GMRES_H_ */ diff --git a/src/emu/netlist/analog/nld_ms_sor.h b/src/emu/netlist/analog/nld_ms_sor.h index 90fcf4254b9..73931e8b4f0 100644 --- a/src/emu/netlist/analog/nld_ms_sor.h +++ b/src/emu/netlist/analog/nld_ms_sor.h @@ -17,6 +17,8 @@ #include "nld_solver.h" #include "nld_ms_direct.h" +NETLIB_NAMESPACE_DEVICES_START() + template class netlist_matrix_solver_SOR_t: public netlist_matrix_solver_direct_t { @@ -158,6 +160,14 @@ ATTR_HOT inline int netlist_matrix_solver_SOR_t::vsolve_non_dyn const nl_double accuracy = this->m_params.m_accuracy; + /* uncommenting the line below will force dynamic updates every X iterations + * althought the system has not converged yet. This is a proof of concept, + * 91glub + * + */ + const bool interleaved_dynamic_updates = false; + //const bool interleaved_dynamic_updates = newton_raphson; + do { resched = false; double err = 0; @@ -181,19 +191,20 @@ ATTR_HOT inline int netlist_matrix_solver_SOR_t::vsolve_non_dyn resched = true; resched_cnt++; - } while (resched && (resched_cnt < this->m_params.m_gs_loops)); + //} while (resched && (resched_cnt < this->m_params.m_gs_loops)); + } while (resched && ((!interleaved_dynamic_updates && resched_cnt < this->m_params.m_gs_loops) || (interleaved_dynamic_updates && resched_cnt < 5 ))); this->m_gs_total += resched_cnt; this->m_stat_calculations++; - if (resched) + if (resched && !interleaved_dynamic_updates) { // Fallback to direct solver ... this->m_gs_fail++; return netlist_matrix_solver_direct_t::vsolve_non_dynamic(newton_raphson); } - if (newton_raphson) + if (interleaved_dynamic_updates) { for (int k = 0; k < iN; k++) this->m_nets[k]->m_cur_Analog += 1.0 * (new_V[k] - this->m_nets[k]->m_cur_Analog); @@ -207,5 +218,6 @@ ATTR_HOT inline int netlist_matrix_solver_SOR_t::vsolve_non_dyn return resched_cnt; } +NETLIB_NAMESPACE_DEVICES_END() #endif /* NLD_MS_SOR_H_ */ diff --git a/src/emu/netlist/analog/nld_ms_sor_mat.h b/src/emu/netlist/analog/nld_ms_sor_mat.h index 29875004370..a36628515bc 100644 --- a/src/emu/netlist/analog/nld_ms_sor_mat.h +++ b/src/emu/netlist/analog/nld_ms_sor_mat.h @@ -17,6 +17,7 @@ #include "nld_solver.h" #include "nld_ms_direct.h" +NETLIB_NAMESPACE_DEVICES_START() template class netlist_matrix_solver_SOR_mat_t: public netlist_matrix_solver_direct_t @@ -235,5 +236,6 @@ ATTR_HOT inline int netlist_matrix_solver_SOR_mat_t::vsolve_non } +NETLIB_NAMESPACE_DEVICES_END() #endif /* NLD_MS_GAUSS_SEIDEL_H_ */ diff --git a/src/emu/netlist/analog/nld_solver.c b/src/emu/netlist/analog/nld_solver.c index 00f93222203..ae20f91a734 100644 --- a/src/emu/netlist/analog/nld_solver.c +++ b/src/emu/netlist/analog/nld_solver.c @@ -40,6 +40,8 @@ #include "omp.h" #endif +NETLIB_NAMESPACE_DEVICES_START() + ATTR_COLD void terms_t::add(netlist_terminal_t *term, int net_other) { m_term.add(term); @@ -304,7 +306,7 @@ NETLIB_START(solver) register_param("ACCURACY", m_accuracy, 1e-7); register_param("GS_LOOPS", m_gs_loops, 9); // Gauss-Seidel loops register_param("GS_THRESHOLD", m_gs_threshold, 6); // below this value, gaussian elimination is used - register_param("NR_LOOPS", m_nr_loops, 25); // Newton-Raphson loops + register_param("NR_LOOPS", m_nr_loops, 250); // Newton-Raphson loops register_param("PARALLEL", m_parallel, 0); register_param("SOR_FACTOR", m_sor, 1.059); register_param("GMIN", m_gmin, NETLIST_GMIN_DEFAULT); @@ -562,4 +564,6 @@ ATTR_COLD void NETLIB_NAME(solver)::post_start() } } +NETLIB_NAMESPACE_DEVICES_END() + #include "mgmres.cpp" diff --git a/src/emu/netlist/analog/nld_solver.h b/src/emu/netlist/analog/nld_solver.h index c46249adc47..8bc5b9668cd 100644 --- a/src/emu/netlist/analog/nld_solver.h +++ b/src/emu/netlist/analog/nld_solver.h @@ -29,6 +29,8 @@ // solver // ---------------------------------------------------------------------------------------- +NETLIB_NAMESPACE_DEVICES_START() + class NETLIB_NAME(solver); /* FIXME: these should become proper devices */ @@ -219,6 +221,6 @@ private: netlist_matrix_solver_t *create_solver(int size, int gs_threshold, bool use_specific); }; - +NETLIB_NAMESPACE_DEVICES_END() #endif /* NLD_SOLVER_H_ */ diff --git a/src/emu/netlist/analog/nld_switches.c b/src/emu/netlist/analog/nld_switches.c index ab53c4dcc48..17495e834e2 100644 --- a/src/emu/netlist/analog/nld_switches.c +++ b/src/emu/netlist/analog/nld_switches.c @@ -11,6 +11,8 @@ #define R_OFF (1.0 / netlist().gmin()) #define R_ON 0.01 +NETLIB_NAMESPACE_DEVICES_START() + // ---------------------------------------------------------------------------------------- // SWITCH // ---------------------------------------------------------------------------------------- @@ -101,3 +103,5 @@ NETLIB_UPDATE_PARAM(switch2) { update(); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/analog/nld_switches.h b/src/emu/netlist/analog/nld_switches.h index 0465eea44ce..485100b3706 100644 --- a/src/emu/netlist/analog/nld_switches.h +++ b/src/emu/netlist/analog/nld_switches.h @@ -27,6 +27,8 @@ // Devices ... // ---------------------------------------------------------------------------------------- +NETLIB_NAMESPACE_DEVICES_START() + NETLIB_DEVICE_WITH_PARAMS(switch1, NETLIB_NAME(R_base) m_R; @@ -39,6 +41,6 @@ NETLIB_DEVICE_WITH_PARAMS(switch2, netlist_param_int_t m_POS; ); - +NETLIB_NAMESPACE_DEVICES_END() #endif /* NLD_SWITCHES_H_ */ diff --git a/src/emu/netlist/analog/nld_twoterm.c b/src/emu/netlist/analog/nld_twoterm.c index 958ad33ab51..2c58228b337 100644 --- a/src/emu/netlist/analog/nld_twoterm.c +++ b/src/emu/netlist/analog/nld_twoterm.c @@ -10,6 +10,8 @@ #include "nld_twoterm.h" #include "nld_solver.h" +NETLIB_NAMESPACE_DEVICES_START() + // ---------------------------------------------------------------------------------------- // netlist_generic_diode // ---------------------------------------------------------------------------------------- @@ -288,3 +290,5 @@ NETLIB_UPDATE_TERMINALS(D) m_D.update_diode(deltaV()); set(m_D.G(), 0.0, m_D.Ieq()); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/analog/nld_twoterm.h b/src/emu/netlist/analog/nld_twoterm.h index 8088b684902..39dedbe5c68 100644 --- a/src/emu/netlist/analog/nld_twoterm.h +++ b/src/emu/netlist/analog/nld_twoterm.h @@ -85,6 +85,8 @@ // Implementation // ---------------------------------------------------------------------------------------- +NETLIB_NAMESPACE_DEVICES_START() + // ---------------------------------------------------------------------------------------- // nld_twoterm // ---------------------------------------------------------------------------------------- @@ -292,5 +294,6 @@ protected: }; +NETLIB_NAMESPACE_DEVICES_END() #endif /* NLD_TWOTERM_H_ */ diff --git a/src/emu/netlist/devices/net_lib.c b/src/emu/netlist/devices/net_lib.c index 37eaf082493..cdc905443ae 100644 --- a/src/emu/netlist/devices/net_lib.c +++ b/src/emu/netlist/devices/net_lib.c @@ -41,7 +41,9 @@ NETLIST_END() #define ENTRY1(_nic, _name, _defparam) factory.register_device<_nic>( # _name, xstr(_nic), _defparam ); #define ENTRY(_nic, _name, _defparam) ENTRY1(NETLIB_NAME(_nic), _name, _defparam) -void nl_initialize_factory(netlist_factory_list_t &factory) +NETLIB_NAMESPACE_DEVICES_START() + +void initialize_factory(netlist_factory_list_t &factory) { ENTRY(R, RES, "R") ENTRY(POT, POT, "R") @@ -143,3 +145,13 @@ void nl_initialize_factory(netlist_factory_list_t &factory) ENTRY(SN74LS629_dip, SN74LS629_DIP, "1.CAP1,2.CAP2") ENTRY(NE555_dip, NE555_DIP, "-") } + +NETLIB_NAMESPACE_DEVICES_END() + +namespace netlist +{ + void initialize_factory(netlist_factory_list_t &factory) + { + devices::initialize_factory(factory); + } +} diff --git a/src/emu/netlist/devices/net_lib.h b/src/emu/netlist/devices/net_lib.h index 1ae4336f62e..feb38857fda 100644 --- a/src/emu/netlist/devices/net_lib.h +++ b/src/emu/netlist/devices/net_lib.h @@ -67,6 +67,8 @@ NETLIST_EXTERNAL(diode_models); NETLIST_EXTERNAL(bjt_models); -void nl_initialize_factory(netlist_factory_list_t &factory); +namespace netlist { + void initialize_factory(netlist::netlist_factory_list_t &factory); +} #endif diff --git a/src/emu/netlist/devices/nld_4020.c b/src/emu/netlist/devices/nld_4020.c index 93166b11fc4..5bfb35f399c 100644 --- a/src/emu/netlist/devices/nld_4020.c +++ b/src/emu/netlist/devices/nld_4020.c @@ -7,6 +7,8 @@ #include "nld_4020.h" +NETLIB_NAMESPACE_DEVICES_START() + NETLIB_START(4020) { register_sub("sub", sub); @@ -146,3 +148,5 @@ NETLIB_RESET(4020_dip) { NETLIB_NAME(4020)::reset(); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_4020.h b/src/emu/netlist/devices/nld_4020.h index 0b9a06364d8..b00218e17d4 100644 --- a/src/emu/netlist/devices/nld_4020.h +++ b/src/emu/netlist/devices/nld_4020.h @@ -40,6 +40,8 @@ #define CD_4020_DIP(_name) \ NET_REGISTER_DEV(4020_dip, _name) +NETLIB_NAMESPACE_DEVICES_START() + NETLIB_SUBDEVICE(4020_sub, NETLIB_LOGIC_FAMILY(CD4000) @@ -61,4 +63,6 @@ NETLIB_DEVICE(4020, NETLIB_DEVICE_DERIVED_PURE(4020_dip, 4020); +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_4020_H_ */ diff --git a/src/emu/netlist/devices/nld_4066.c b/src/emu/netlist/devices/nld_4066.c index 8225447d555..f0ba4f1c2b5 100644 --- a/src/emu/netlist/devices/nld_4066.c +++ b/src/emu/netlist/devices/nld_4066.c @@ -7,6 +7,7 @@ #include "nld_4066.h" +NETLIB_NAMESPACE_DEVICES_START() NETLIB_START(4066) { @@ -118,3 +119,5 @@ NETLIB_UPDATE(4016_dip) /* only called during startup */ NETLIB_NAME(4066_dip)::update(); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_4066.h b/src/emu/netlist/devices/nld_4066.h index 39209f386b6..ce0e32af91a 100644 --- a/src/emu/netlist/devices/nld_4066.h +++ b/src/emu/netlist/devices/nld_4066.h @@ -33,6 +33,8 @@ #define CD_4016_DIP(_name) \ NET_REGISTER_DEV(4016_dip, _name) +NETLIB_NAMESPACE_DEVICES_START() + NETLIB_SUBDEVICE(4066, NETLIB_LOGIC_FAMILY(CD4000) public: @@ -56,4 +58,6 @@ NETLIB_DEVICE(4066_dip, NETLIB_DEVICE_DERIVED_PURE(4016_dip, 4066_dip); +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_4066_H_ */ diff --git a/src/emu/netlist/devices/nld_7400.c b/src/emu/netlist/devices/nld_7400.c index 91a1bfbf472..188b8ad5529 100644 --- a/src/emu/netlist/devices/nld_7400.c +++ b/src/emu/netlist/devices/nld_7400.c @@ -7,6 +7,8 @@ #include "nld_7400.h" +NETLIB_NAMESPACE_DEVICES_START() + #if (USE_TRUTHTABLE) nld_7400::truthtable_t nld_7400::m_ttbl; const char *nld_7400::m_desc[] = { @@ -59,3 +61,5 @@ NETLIB_RESET(7400_dip) m_3.do_reset(); m_4.do_reset(); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_7400.h b/src/emu/netlist/devices/nld_7400.h index 73f5ffe33f8..ac719f64046 100644 --- a/src/emu/netlist/devices/nld_7400.h +++ b/src/emu/netlist/devices/nld_7400.h @@ -33,23 +33,24 @@ #define NLD_7400_H_ #include "nld_signal.h" +#include "nld_truthtable.h" #define TTL_7400_NAND(_name, _A, _B) \ NET_REGISTER_DEV(7400, _name) \ NET_CONNECT(_name, A, _A) \ NET_CONNECT(_name, B, _B) +#define TTL_7400_DIP(_name) \ + NET_REGISTER_DEV(7400_dip, _name) + +NETLIB_NAMESPACE_DEVICES_START() + #if (USE_TRUTHTABLE) -#include "nld_truthtable.h" NETLIB_TRUTHTABLE(7400, 2, 1, 0); #else NETLIB_SIGNAL(7400, 2, 0, 0); #endif - -#define TTL_7400_DIP(_name) \ - NET_REGISTER_DEV(7400_dip, _name) - NETLIB_DEVICE(7400_dip, NETLIB_NAME(7400) m_1; @@ -58,4 +59,6 @@ NETLIB_DEVICE(7400_dip, NETLIB_NAME(7400) m_4; ); +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_7400_H_ */ diff --git a/src/emu/netlist/devices/nld_7402.c b/src/emu/netlist/devices/nld_7402.c index f64f5e4ba96..0e5695bebc9 100644 --- a/src/emu/netlist/devices/nld_7402.c +++ b/src/emu/netlist/devices/nld_7402.c @@ -7,6 +7,8 @@ #include "nld_7402.h" +NETLIB_NAMESPACE_DEVICES_START() + #if (USE_TRUTHTABLE) nld_7402::truthtable_t nld_7402::m_ttbl; const char *nld_7402::m_desc[] = { @@ -59,3 +61,5 @@ NETLIB_RESET(7402_dip) m_3.do_reset(); m_4.do_reset(); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_7402.h b/src/emu/netlist/devices/nld_7402.h index bd0306cd3e1..91079cf6812 100644 --- a/src/emu/netlist/devices/nld_7402.h +++ b/src/emu/netlist/devices/nld_7402.h @@ -33,6 +33,7 @@ #define NLD_7402_H_ #include "nld_signal.h" +#include "nld_truthtable.h" #define TTL_7402_NOR(_name, _I1, _I2) \ NET_REGISTER_DEV(7402, _name) \ @@ -43,8 +44,9 @@ NET_REGISTER_DEV(7402_dip, _name) +NETLIB_NAMESPACE_DEVICES_START() + #if (USE_TRUTHTABLE) -#include "nld_truthtable.h" NETLIB_TRUTHTABLE(7402, 2, 1, 0); #else NETLIB_SIGNAL(7402, 2, 1, 0); @@ -58,4 +60,6 @@ NETLIB_DEVICE(7402_dip, NETLIB_NAME(7402) m_4; ); +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_7402_H_ */ diff --git a/src/emu/netlist/devices/nld_7404.c b/src/emu/netlist/devices/nld_7404.c index 8637da2fec6..5bfd08c7d1e 100644 --- a/src/emu/netlist/devices/nld_7404.c +++ b/src/emu/netlist/devices/nld_7404.c @@ -7,6 +7,8 @@ #include "nld_7404.h" +NETLIB_NAMESPACE_DEVICES_START() + #if 1 && (USE_TRUTHTABLE) nld_7404::truthtable_t nld_7404::m_ttbl; const char *nld_7404::m_desc[] = { @@ -84,3 +86,5 @@ NETLIB_RESET(7404_dip) m_5.do_reset(); m_6.do_reset(); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_7404.h b/src/emu/netlist/devices/nld_7404.h index 0988d1d1e7c..9b88306fc29 100644 --- a/src/emu/netlist/devices/nld_7404.h +++ b/src/emu/netlist/devices/nld_7404.h @@ -31,9 +31,18 @@ #define NLD_7404_H_ #include "nld_signal.h" +#include "nld_truthtable.h" + +#define TTL_7404_INVERT(_name, _A) \ + NET_REGISTER_DEV(7404, _name) \ + NET_CONNECT(_name, A, _A) + +#define TTL_7404_DIP(_name) \ + NET_REGISTER_DEV(7402_dip, _name) + +NETLIB_NAMESPACE_DEVICES_START() #if 1 && (USE_TRUTHTABLE) -#include "nld_truthtable.h" NETLIB_TRUTHTABLE(7404, 1, 1, 0); #else NETLIB_DEVICE(7404, @@ -43,13 +52,6 @@ public: ); #endif -#define TTL_7404_INVERT(_name, _A) \ - NET_REGISTER_DEV(7404, _name) \ - NET_CONNECT(_name, A, _A) - -#define TTL_7404_DIP(_name) \ - NET_REGISTER_DEV(7402_dip, _name) - NETLIB_DEVICE(7404_dip, NETLIB_NAME(7404) m_1; @@ -59,4 +61,7 @@ NETLIB_DEVICE(7404_dip, NETLIB_NAME(7404) m_5; NETLIB_NAME(7404) m_6; ); + +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_7404_H_ */ diff --git a/src/emu/netlist/devices/nld_7408.c b/src/emu/netlist/devices/nld_7408.c index 70cc8006f67..a0a54d6cf82 100644 --- a/src/emu/netlist/devices/nld_7408.c +++ b/src/emu/netlist/devices/nld_7408.c @@ -7,6 +7,8 @@ #include "nld_7408.h" +NETLIB_NAMESPACE_DEVICES_START() + #if (USE_TRUTHTABLE) nld_7408::truthtable_t nld_7408::m_ttbl; const char *nld_7408::m_desc[] = { @@ -59,3 +61,5 @@ NETLIB_RESET(7408_dip) m_3.do_reset(); m_4.do_reset(); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_7408.h b/src/emu/netlist/devices/nld_7408.h index 91967fe9ba6..f33bc5e0a17 100644 --- a/src/emu/netlist/devices/nld_7408.h +++ b/src/emu/netlist/devices/nld_7408.h @@ -33,21 +33,24 @@ #define NLD_7408_H_ #include "nld_signal.h" +#include "nld_truthtable.h" #define TTL_7408_AND(_name, _A, _B) \ NET_REGISTER_DEV(7408, _name) \ NET_CONNECT(_name, A, _A) \ NET_CONNECT(_name, B, _B) +#define TTL_7408_DIP(_name) \ + NET_REGISTER_DEV(7408_dip, _name) + +NETLIB_NAMESPACE_DEVICES_START() + #if (USE_TRUTHTABLE) -#include "nld_truthtable.h" NETLIB_TRUTHTABLE(7408, 2, 1, 0); #else NETLIB_SIGNAL(7408, 2, 0, 1); #endif -#define TTL_7408_DIP(_name) \ - NET_REGISTER_DEV(7408_dip, _name) NETLIB_DEVICE(7408_dip, @@ -57,4 +60,6 @@ NETLIB_DEVICE(7408_dip, NETLIB_NAME(7408) m_4; ); +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_7408_H_ */ diff --git a/src/emu/netlist/devices/nld_7410.c b/src/emu/netlist/devices/nld_7410.c index 05ad04f2b1c..9564ecd4e4f 100644 --- a/src/emu/netlist/devices/nld_7410.c +++ b/src/emu/netlist/devices/nld_7410.c @@ -7,6 +7,8 @@ #include "nld_7410.h" +NETLIB_NAMESPACE_DEVICES_START() + #if (USE_TRUTHTABLE) nld_7410::truthtable_t nld_7410::m_ttbl; const char *nld_7410::m_desc[] = { @@ -57,3 +59,5 @@ NETLIB_RESET(7410_dip) m_2.do_reset(); m_3.do_reset(); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_7410.h b/src/emu/netlist/devices/nld_7410.h index 23a8fba8763..6272185795d 100644 --- a/src/emu/netlist/devices/nld_7410.h +++ b/src/emu/netlist/devices/nld_7410.h @@ -33,6 +33,7 @@ #define NLD_7410_H_ #include "nld_signal.h" +#include "nld_truthtable.h" #define TTL_7410_NAND(_name, _I1, _I2, _I3) \ NET_REGISTER_DEV(7410, _name) \ @@ -40,16 +41,17 @@ NET_CONNECT(_name, B, _I2) \ NET_CONNECT(_name, C, _I3) +#define TTL_7410_DIP(_name) \ + NET_REGISTER_DEV(7410_dip, _name) + +NETLIB_NAMESPACE_DEVICES_START() + #if (USE_TRUTHTABLE) -#include "nld_truthtable.h" NETLIB_TRUTHTABLE(7410, 3, 1, 0); #else NETLIB_SIGNAL(7410, 3, 0, 0); #endif -#define TTL_7410_DIP(_name) \ - NET_REGISTER_DEV(7410_dip, _name) - NETLIB_DEVICE(7410_dip, NETLIB_NAME(7410) m_1; @@ -57,4 +59,6 @@ NETLIB_DEVICE(7410_dip, NETLIB_NAME(7410) m_3; ); +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_7410_H_ */ diff --git a/src/emu/netlist/devices/nld_74107.c b/src/emu/netlist/devices/nld_74107.c index cd0238de829..0a74f33a5fd 100644 --- a/src/emu/netlist/devices/nld_74107.c +++ b/src/emu/netlist/devices/nld_74107.c @@ -7,6 +7,8 @@ #include "nld_74107.h" +NETLIB_NAMESPACE_DEVICES_START() + NETLIB_START(74107Asub) { register_input("CLK", m_clk); @@ -141,3 +143,5 @@ NETLIB_UPDATE(74107_dip) m_1.update_dev(); m_2.update_dev(); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_74107.h b/src/emu/netlist/devices/nld_74107.h index ba2462c55c5..0525dfbaf49 100644 --- a/src/emu/netlist/devices/nld_74107.h +++ b/src/emu/netlist/devices/nld_74107.h @@ -74,6 +74,8 @@ #define TTL_74107_DIP(_name) \ NET_REGISTER_DEV(74107_dip, _name) +NETLIB_NAMESPACE_DEVICES_START() + NETLIB_SUBDEVICE(74107Asub, netlist_logic_input_t m_clk; @@ -112,4 +114,6 @@ NETLIB_DEVICE(74107_dip, NETLIB_NAME(74107) m_2; ); +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_74107_H_ */ diff --git a/src/emu/netlist/devices/nld_7411.c b/src/emu/netlist/devices/nld_7411.c index 3ac56fc11ef..2db034577cb 100644 --- a/src/emu/netlist/devices/nld_7411.c +++ b/src/emu/netlist/devices/nld_7411.c @@ -7,6 +7,8 @@ #include "nld_7411.h" +NETLIB_NAMESPACE_DEVICES_START() + #if (USE_TRUTHTABLE) nld_7411::truthtable_t nld_7411::m_ttbl; const char *nld_7411::m_desc[] = { @@ -55,3 +57,5 @@ NETLIB_RESET(7411_dip) m_2.do_reset(); m_3.do_reset(); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_7411.h b/src/emu/netlist/devices/nld_7411.h index 93e7fd7f960..0cd5358ea51 100644 --- a/src/emu/netlist/devices/nld_7411.h +++ b/src/emu/netlist/devices/nld_7411.h @@ -33,6 +33,7 @@ #define NLD_7411_H_ #include "nld_signal.h" +#include "nld_truthtable.h" #define TTL_7411_AND(_name, _I1, _I2, _I3) \ NET_REGISTER_DEV(7411, _name) \ @@ -40,15 +41,17 @@ NET_CONNECT(_name, B, _I2) \ NET_CONNECT(_name, C, _I3) +#define TTL_7411_DIP(_name) \ + NET_REGISTER_DEV(7411_dip, _name) + +NETLIB_NAMESPACE_DEVICES_START() + #if (USE_TRUTHTABLE) -#include "nld_truthtable.h" NETLIB_TRUTHTABLE(7411, 3, 1, 0); #else NETLIB_SIGNAL(7411, 3, 0, 1); #endif -#define TTL_7411_DIP(_name) \ - NET_REGISTER_DEV(7411_dip, _name) NETLIB_DEVICE(7411_dip, @@ -57,4 +60,6 @@ NETLIB_DEVICE(7411_dip, NETLIB_NAME(7411) m_3; ); +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_7411_H_ */ diff --git a/src/emu/netlist/devices/nld_74123.c b/src/emu/netlist/devices/nld_74123.c index 618f4735e26..89c6da6d4f6 100644 --- a/src/emu/netlist/devices/nld_74123.c +++ b/src/emu/netlist/devices/nld_74123.c @@ -10,6 +10,8 @@ #define R_OFF (1E20) #define R_ON (m_RI.Value()) +NETLIB_NAMESPACE_DEVICES_START() + NETLIB_START(74123) { m_dev_type = 74123; @@ -201,3 +203,5 @@ NETLIB_RESET(9602_dip) m_1.do_reset(); m_2.do_reset(); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_74123.h b/src/emu/netlist/devices/nld_74123.h index 79c6021b025..fc245a38b5c 100644 --- a/src/emu/netlist/devices/nld_74123.h +++ b/src/emu/netlist/devices/nld_74123.h @@ -42,6 +42,7 @@ #define TTL_74123(_name) \ NET_REGISTER_DEV(74123, _name) +NETLIB_NAMESPACE_DEVICES_START() NETLIB_DEVICE(74123, public: @@ -93,5 +94,7 @@ NETLIB_DEVICE(9602_dip, ); +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_74123_H_ */ diff --git a/src/emu/netlist/devices/nld_74153.c b/src/emu/netlist/devices/nld_74153.c index 23c8bc71d60..ab52808c4cc 100644 --- a/src/emu/netlist/devices/nld_74153.c +++ b/src/emu/netlist/devices/nld_74153.c @@ -7,6 +7,8 @@ #include "nld_74153.h" +NETLIB_NAMESPACE_DEVICES_START() + /* FIXME: timing is not 100% accurate, Strobe and Select inputs have a * slightly longer timing. * Convert this to sub-devices at some time. @@ -110,3 +112,5 @@ NETLIB_RESET(74153_dip) m_1.do_reset(); m_2.do_reset(); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_74153.h b/src/emu/netlist/devices/nld_74153.h index 16024114d4b..2f6dc4e99ba 100644 --- a/src/emu/netlist/devices/nld_74153.h +++ b/src/emu/netlist/devices/nld_74153.h @@ -60,6 +60,8 @@ #define TTL_74153_DIP(_name) \ NET_REGISTER_DEV(74153_dip, _name) +NETLIB_NAMESPACE_DEVICES_START() + NETLIB_SUBDEVICE(74153sub, netlist_logic_input_t m_C[4]; netlist_logic_input_t m_G; @@ -84,4 +86,6 @@ NETLIB_DEVICE(74153_dip, netlist_logic_input_t m_B; ); +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_74153_H_ */ diff --git a/src/emu/netlist/devices/nld_74175.c b/src/emu/netlist/devices/nld_74175.c index a10268bdfda..9a6a0a7b8d6 100644 --- a/src/emu/netlist/devices/nld_74175.c +++ b/src/emu/netlist/devices/nld_74175.c @@ -7,6 +7,8 @@ #include "nld_74175.h" +NETLIB_NAMESPACE_DEVICES_START() + static const netlist_time delay[2] = { NLTIME_FROM_NS(25), NLTIME_FROM_NS(25) }; static const netlist_time delay_clear[2] = { NLTIME_FROM_NS(40), NLTIME_FROM_NS(25) }; @@ -136,3 +138,5 @@ NETLIB_UPDATE(74175_dip) { NETLIB_NAME(74175)::update(); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_74175.h b/src/emu/netlist/devices/nld_74175.h index 70951ac4d42..7c1a8e7916a 100644 --- a/src/emu/netlist/devices/nld_74175.h +++ b/src/emu/netlist/devices/nld_74175.h @@ -43,6 +43,7 @@ #define TTL_74175_DIP(_name) \ NET_REGISTER_DEV(74175_dip, _name) +NETLIB_NAMESPACE_DEVICES_START() NETLIB_SUBDEVICE(74175_sub, @@ -63,4 +64,6 @@ NETLIB_DEVICE(74175, NETLIB_DEVICE_DERIVED_PURE(74175_dip, 74175); +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_74175_H_ */ diff --git a/src/emu/netlist/devices/nld_74192.c b/src/emu/netlist/devices/nld_74192.c index 2343ff2055b..c07affc8b6a 100644 --- a/src/emu/netlist/devices/nld_74192.c +++ b/src/emu/netlist/devices/nld_74192.c @@ -9,6 +9,8 @@ #include "nld_74192.h" +NETLIB_NAMESPACE_DEVICES_START() + NETLIB_START(74192) { register_sub("subABCD", m_ABCD); @@ -130,3 +132,5 @@ NETLIB_RESET(74192_dip) { NETLIB_NAME(74192)::reset(); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_74192.h b/src/emu/netlist/devices/nld_74192.h index 10db69d775e..06ea6be913f 100644 --- a/src/emu/netlist/devices/nld_74192.h +++ b/src/emu/netlist/devices/nld_74192.h @@ -38,6 +38,8 @@ #define TTL_74192_DIP(_name) \ NET_REGISTER_DEV(74192_dip, _name) +NETLIB_NAMESPACE_DEVICES_START() + NETLIB_DEVICE(74192, ATTR_HOT void update_outputs(); @@ -58,4 +60,6 @@ NETLIB_DEVICE(74192, NETLIB_DEVICE_DERIVED_PURE(74192_dip, 74192); +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_74192_H_ */ diff --git a/src/emu/netlist/devices/nld_74193.c b/src/emu/netlist/devices/nld_74193.c index ccfd29b6feb..7a857dbe5a0 100644 --- a/src/emu/netlist/devices/nld_74193.c +++ b/src/emu/netlist/devices/nld_74193.c @@ -9,6 +9,8 @@ #include "nld_74193.h" +NETLIB_NAMESPACE_DEVICES_START() + NETLIB_START(74193) { register_input("A", m_A); @@ -130,3 +132,5 @@ NETLIB_RESET(74193_dip) { NETLIB_NAME(74193)::reset(); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_74193.h b/src/emu/netlist/devices/nld_74193.h index eaa22a06ea1..fa813bc996b 100644 --- a/src/emu/netlist/devices/nld_74193.h +++ b/src/emu/netlist/devices/nld_74193.h @@ -34,6 +34,8 @@ #define TTL_74193_DIP(_name) \ NET_REGISTER_DEV(74193_dip, _name) +NETLIB_NAMESPACE_DEVICES_START() + NETLIB_DEVICE(74193, ATTR_HOT void update_outputs(); @@ -57,4 +59,6 @@ NETLIB_DEVICE(74193, NETLIB_DEVICE_DERIVED_PURE(74193_dip, 74193); +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_74193_H_ */ diff --git a/src/emu/netlist/devices/nld_7420.c b/src/emu/netlist/devices/nld_7420.c index e45b91397bc..57a25b5d7b7 100644 --- a/src/emu/netlist/devices/nld_7420.c +++ b/src/emu/netlist/devices/nld_7420.c @@ -7,6 +7,8 @@ #include "nld_7420.h" +NETLIB_NAMESPACE_DEVICES_START() + #if (USE_TRUTHTABLE) nld_7420::truthtable_t nld_7420::m_ttbl; const char *nld_7420::m_desc[] = { @@ -53,3 +55,5 @@ NETLIB_RESET(7420_dip) m_1.do_reset(); m_2.do_reset(); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_7420.h b/src/emu/netlist/devices/nld_7420.h index c537cf7467b..10e5f3596c0 100644 --- a/src/emu/netlist/devices/nld_7420.h +++ b/src/emu/netlist/devices/nld_7420.h @@ -34,6 +34,7 @@ #define NLD_7420_H_ #include "nld_signal.h" +#include "nld_truthtable.h" #define TTL_7420_NAND(_name, _I1, _I2, _I3, _I4) \ NET_REGISTER_DEV(7420, _name) \ @@ -43,20 +44,23 @@ NET_CONNECT(_name, D, _I4) +#define TTL_7420_DIP(_name) \ + NET_REGISTER_DEV(7420_dip, _name) + +NETLIB_NAMESPACE_DEVICES_START() + #if (USE_TRUTHTABLE) -#include "nld_truthtable.h" NETLIB_TRUTHTABLE(7420, 4, 1, 0); #else NETLIB_SIGNAL(7420, 4, 0, 0); #endif -#define TTL_7420_DIP(_name) \ - NET_REGISTER_DEV(7420_dip, _name) - NETLIB_DEVICE(7420_dip, NETLIB_NAME(7420) m_1; NETLIB_NAME(7420) m_2; ); +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_7420_H_ */ diff --git a/src/emu/netlist/devices/nld_7425.c b/src/emu/netlist/devices/nld_7425.c index a46f544297e..c432960a02d 100644 --- a/src/emu/netlist/devices/nld_7425.c +++ b/src/emu/netlist/devices/nld_7425.c @@ -7,6 +7,8 @@ #include "nld_7425.h" +NETLIB_NAMESPACE_DEVICES_START() + NETLIB_START(7425_dip) { register_sub("1", m_1); @@ -44,3 +46,5 @@ NETLIB_RESET(7425_dip) m_1.do_reset(); m_2.do_reset(); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_7425.h b/src/emu/netlist/devices/nld_7425.h index f7df8442851..d5e2f25e144 100644 --- a/src/emu/netlist/devices/nld_7425.h +++ b/src/emu/netlist/devices/nld_7425.h @@ -45,15 +45,19 @@ NET_CONNECT(_name, C, _I3) \ NET_CONNECT(_name, D, _I4) - -NETLIB_SIGNAL(7425, 4, 1, 0); - #define TTL_7425_DIP(_name) \ NET_REGISTER_DEV(7425_dip, _name) +NETLIB_NAMESPACE_DEVICES_START() + +NETLIB_SIGNAL(7425, 4, 1, 0); + NETLIB_DEVICE(7425_dip, NETLIB_NAME(7425) m_1; NETLIB_NAME(7425) m_2; ); + +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_7425_H_ */ diff --git a/src/emu/netlist/devices/nld_7427.c b/src/emu/netlist/devices/nld_7427.c index 6551ee1840b..fb193f74679 100644 --- a/src/emu/netlist/devices/nld_7427.c +++ b/src/emu/netlist/devices/nld_7427.c @@ -9,6 +9,8 @@ #include "nld_7402.h" +NETLIB_NAMESPACE_DEVICES_START() + #if (USE_TRUTHTABLE) nld_7427::truthtable_t nld_7427::m_ttbl; const char *nld_7427::m_desc[] = { @@ -57,3 +59,5 @@ NETLIB_RESET(7427_dip) m_2.do_reset(); m_3.do_reset(); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_7427.h b/src/emu/netlist/devices/nld_7427.h index 69d9618e246..7bef7a274aa 100644 --- a/src/emu/netlist/devices/nld_7427.h +++ b/src/emu/netlist/devices/nld_7427.h @@ -33,6 +33,7 @@ #define NLD_7427_H_ #include "nld_signal.h" +#include "nld_truthtable.h" #define TTL_7427_NOR(_name, _I1, _I2, _I3) \ NET_REGISTER_DEV(7427, _name) \ @@ -40,20 +41,25 @@ NET_CONNECT(_name, B, _I2) \ NET_CONNECT(_name, C, _I3) +#define TTL_7427_DIP(_name) \ + NET_REGISTER_DEV(7427_dip, _name) + +NETLIB_NAMESPACE_DEVICES_START() + #if (USE_TRUTHTABLE) -#include "nld_truthtable.h" NETLIB_TRUTHTABLE(7427, 3, 1, 0); #else NETLIB_SIGNAL(7427, 3, 1, 0); #endif -#define TTL_7427_DIP(_name) \ - NET_REGISTER_DEV(7427_dip, _name) - NETLIB_DEVICE(7427_dip, NETLIB_NAME(7427) m_1; NETLIB_NAME(7427) m_2; NETLIB_NAME(7427) m_3; ); + +NETLIB_NAMESPACE_DEVICES_END() + + #endif /* NLD_7427_H_ */ diff --git a/src/emu/netlist/devices/nld_74279.c b/src/emu/netlist/devices/nld_74279.c index 5740b59c6ed..ca633cfa8be 100644 --- a/src/emu/netlist/devices/nld_74279.c +++ b/src/emu/netlist/devices/nld_74279.c @@ -7,6 +7,8 @@ #include "nld_74279.h" +NETLIB_NAMESPACE_DEVICES_START() + nld_74279A::truthtable_t nld_74279A::m_ttbl; nld_74279B::truthtable_t nld_74279B::m_ttbl; @@ -160,3 +162,5 @@ NETLIB_RESET(74279_dip) m_3.do_reset(); m_4.do_reset(); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_74279.h b/src/emu/netlist/devices/nld_74279.h index cee47fb7452..926ca540873 100644 --- a/src/emu/netlist/devices/nld_74279.h +++ b/src/emu/netlist/devices/nld_74279.h @@ -38,6 +38,11 @@ #include "nld_truthtable.h" +#define TTL_74279_DIP(_name) \ + NET_REGISTER_DEV(74279_dip, _name) + +NETLIB_NAMESPACE_DEVICES_START() + #if 0 NETLIB_TRUTHTABLE(74279A, 2, 1, 1); NETLIB_TRUTHTABLE(74279B, 3, 1, 1); @@ -47,8 +52,6 @@ NETLIB_TRUTHTABLE(74279B, 4, 1, 0); //NETLIB_TRUTHTABLE(74279A, 4, 2, 0); //NETLIB_TRUTHTABLE(74279B, 5, 2, 0); #endif -#define TTL_74279_DIP(_name) \ - NET_REGISTER_DEV(74279_dip, _name) NETLIB_DEVICE(74279_dip, @@ -58,4 +61,6 @@ NETLIB_DEVICE(74279_dip, NETLIB_NAME(74279A) m_4; ); +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_74279_H_ */ diff --git a/src/emu/netlist/devices/nld_7430.c b/src/emu/netlist/devices/nld_7430.c index 24d61d7b8ac..31ea833cb27 100644 --- a/src/emu/netlist/devices/nld_7430.c +++ b/src/emu/netlist/devices/nld_7430.c @@ -7,6 +7,8 @@ #include "nld_7430.h" +NETLIB_NAMESPACE_DEVICES_START() + #if (USE_TRUTHTABLE) nld_7430::truthtable_t nld_7430::m_ttbl; const char *nld_7430::m_desc[] = { @@ -53,3 +55,5 @@ NETLIB_RESET(7430_dip) { m_1.do_reset(); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_7430.h b/src/emu/netlist/devices/nld_7430.h index ed6e239a1b5..70e7450c598 100644 --- a/src/emu/netlist/devices/nld_7430.h +++ b/src/emu/netlist/devices/nld_7430.h @@ -38,6 +38,7 @@ #define NLD_7430_H_ #include "nld_signal.h" +#include "nld_truthtable.h" #define TTL_7430_NAND(_name, _I1, _I2, _I3, _I4, _I5, _I6, _I7, _I8) \ NET_REGISTER_DEV(7430, _name) \ @@ -51,18 +52,24 @@ NET_CONNECT(_name, H, _I8) +#define TTL_7430_DIP(_name) \ + NET_REGISTER_DEV(7430_dip, _name) + +NETLIB_NAMESPACE_DEVICES_START() + #if (USE_TRUTHTABLE) -#include "nld_truthtable.h" NETLIB_TRUTHTABLE(7430, 8, 1, 0); #else NETLIB_SIGNAL(7430, 8, 0, 0); #endif -#define TTL_7430_DIP(_name) \ - NET_REGISTER_DEV(7430_dip, _name) NETLIB_DEVICE(7430_dip, NETLIB_NAME(7430) m_1; ); + +NETLIB_NAMESPACE_DEVICES_END() + + #endif /* NLD_7430_H_ */ diff --git a/src/emu/netlist/devices/nld_7432.c b/src/emu/netlist/devices/nld_7432.c index 0e176a323fc..d0b358482f8 100644 --- a/src/emu/netlist/devices/nld_7432.c +++ b/src/emu/netlist/devices/nld_7432.c @@ -7,6 +7,8 @@ #include "nld_7432.h" +NETLIB_NAMESPACE_DEVICES_START() + #if (USE_TRUTHTABLE) nld_7432::truthtable_t nld_7432::m_ttbl; const char *nld_7432::m_desc[] = { @@ -59,3 +61,5 @@ NETLIB_RESET(7432_dip) m_3.do_reset(); m_4.do_reset(); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_7432.h b/src/emu/netlist/devices/nld_7432.h index b81bc74cb26..f83c34648c5 100644 --- a/src/emu/netlist/devices/nld_7432.h +++ b/src/emu/netlist/devices/nld_7432.h @@ -33,6 +33,7 @@ #define NLD_7432_H_ #include "nld_signal.h" +#include "nld_truthtable.h" #define TTL_7432_OR(_name, _I1, _I2) \ NET_REGISTER_DEV(7432, _name) \ @@ -42,9 +43,9 @@ #define TTL_7432_DIP(_name) \ NET_REGISTER_DEV(7432_dip, _name) +NETLIB_NAMESPACE_DEVICES_START() #if (USE_TRUTHTABLE) -#include "nld_truthtable.h" NETLIB_TRUTHTABLE(7432, 2, 1, 0); #else NETLIB_SIGNAL(7432, 2, 1, 1); @@ -58,4 +59,6 @@ NETLIB_DEVICE(7432_dip, NETLIB_NAME(7432) m_4; ); +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_7432_H_ */ diff --git a/src/emu/netlist/devices/nld_7437.c b/src/emu/netlist/devices/nld_7437.c index f65c9fd016b..79fcaa5c4c5 100644 --- a/src/emu/netlist/devices/nld_7437.c +++ b/src/emu/netlist/devices/nld_7437.c @@ -7,6 +7,8 @@ #include "nld_7437.h" +NETLIB_NAMESPACE_DEVICES_START() + #if (USE_TRUTHTABLE) nld_7437::truthtable_t nld_7437::m_ttbl; const char *nld_7437::m_desc[] = { @@ -59,3 +61,5 @@ NETLIB_RESET(7437_dip) m_3.do_reset(); m_4.do_reset(); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_7437.h b/src/emu/netlist/devices/nld_7437.h index 03145ee8a8c..1fa20d19e9b 100644 --- a/src/emu/netlist/devices/nld_7437.h +++ b/src/emu/netlist/devices/nld_7437.h @@ -36,22 +36,24 @@ #define NLD_7437_H_ #include "nld_signal.h" +#include "nld_truthtable.h" #define TTL_7437_NAND(_name, _A, _B) \ NET_REGISTER_DEV(7437, _name) \ NET_CONNECT(_name, A, _A) \ NET_CONNECT(_name, B, _B) +#define TTL_7437_DIP(_name) \ + NET_REGISTER_DEV(7437_dip, _name) + +NETLIB_NAMESPACE_DEVICES_START() + #if (USE_TRUTHTABLE) -#include "nld_truthtable.h" NETLIB_TRUTHTABLE(7437, 2, 1, 0); #else NETLIB_SIGNAL(7437, 2, 0, 0); #endif -#define TTL_7437_DIP(_name) \ - NET_REGISTER_DEV(7437_dip, _name) - NETLIB_DEVICE(7437_dip, NETLIB_NAME(7437) m_1; @@ -60,4 +62,6 @@ NETLIB_DEVICE(7437_dip, NETLIB_NAME(7437) m_4; ); +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_7437_H_ */ diff --git a/src/emu/netlist/devices/nld_7448.c b/src/emu/netlist/devices/nld_7448.c index 3ee68f46c91..618b61d8c6e 100644 --- a/src/emu/netlist/devices/nld_7448.c +++ b/src/emu/netlist/devices/nld_7448.c @@ -7,6 +7,8 @@ #include "nld_7448.h" +NETLIB_NAMESPACE_DEVICES_START() + #if (0 && USE_TRUTHTABLE) nld_7448::truthtable_t nld_7448::m_ttbl; const char *nld_7448::m_desc[] = { @@ -217,3 +219,5 @@ NETLIB_RESET(7448_dip) { NETLIB_NAME(7448)::reset(); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_7448.h b/src/emu/netlist/devices/nld_7448.h index 4cc3f346809..e0e53a783f6 100644 --- a/src/emu/netlist/devices/nld_7448.h +++ b/src/emu/netlist/devices/nld_7448.h @@ -48,6 +48,8 @@ NETLIB_TRUTHTABLE(7448, 7, 7, 0); #else +NETLIB_NAMESPACE_DEVICES_START() + NETLIB_SUBDEVICE(7448_sub, ATTR_HOT void update_outputs(UINT8 v); static const UINT8 tab7448[16][7]; @@ -72,6 +74,9 @@ public: netlist_logic_input_t m_BIQ; ); #endif + NETLIB_DEVICE_DERIVED_PURE(7448_dip, 7448); +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_7448_H_ */ diff --git a/src/emu/netlist/devices/nld_7450.c b/src/emu/netlist/devices/nld_7450.c index b854b04decc..30d7916acf0 100644 --- a/src/emu/netlist/devices/nld_7450.c +++ b/src/emu/netlist/devices/nld_7450.c @@ -7,6 +7,8 @@ #include "nld_7450.h" +NETLIB_NAMESPACE_DEVICES_START() + NETLIB_START(7450) { register_input("A", m_A); @@ -88,3 +90,5 @@ NETLIB_RESET(7450_dip) m_1.do_reset(); m_2.do_reset(); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_7450.h b/src/emu/netlist/devices/nld_7450.h index 4a08f552d68..f0a0e421c50 100644 --- a/src/emu/netlist/devices/nld_7450.h +++ b/src/emu/netlist/devices/nld_7450.h @@ -36,6 +36,8 @@ #define TTL_7450_DIP(_name) \ NET_REGISTER_DEV(7450_dip, _name) +NETLIB_NAMESPACE_DEVICES_START() + NETLIB_DEVICE(7450, public: netlist_logic_input_t m_A; @@ -51,4 +53,6 @@ NETLIB_DEVICE(7450_dip, NETLIB_NAME(7450) m_2; ); +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_7450_H_ */ diff --git a/src/emu/netlist/devices/nld_7474.c b/src/emu/netlist/devices/nld_7474.c index 1aeb628030f..34f236a82a0 100644 --- a/src/emu/netlist/devices/nld_7474.c +++ b/src/emu/netlist/devices/nld_7474.c @@ -7,6 +7,8 @@ #include "nld_7474.h" +NETLIB_NAMESPACE_DEVICES_START() + ATTR_HOT inline void NETLIB_NAME(7474sub)::newstate(const UINT8 stateQ, const UINT8 stateQQ) { // 0: High-to-low 40 ns, 1: Low-to-high 25 ns @@ -124,3 +126,5 @@ NETLIB_UPDATE(7474_dip) m_1.update_dev(); m_2.update_dev(); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_7474.h b/src/emu/netlist/devices/nld_7474.h index a4c4e44466f..23a43a1d043 100644 --- a/src/emu/netlist/devices/nld_7474.h +++ b/src/emu/netlist/devices/nld_7474.h @@ -54,6 +54,8 @@ #define TTL_7474_DIP(_name) \ NET_REGISTER_DEV(7474_dip, _name) +NETLIB_NAMESPACE_DEVICES_START() + NETLIB_SUBDEVICE(7474sub, netlist_logic_input_t m_CLK; @@ -79,4 +81,6 @@ NETLIB_DEVICE(7474_dip, NETLIB_NAME(7474) m_2; ); +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_7474_H_ */ diff --git a/src/emu/netlist/devices/nld_7483.c b/src/emu/netlist/devices/nld_7483.c index fc7dbc06a3a..97c6b41b29a 100644 --- a/src/emu/netlist/devices/nld_7483.c +++ b/src/emu/netlist/devices/nld_7483.c @@ -7,6 +7,8 @@ #include "nld_7483.h" +NETLIB_NAMESPACE_DEVICES_START() + NETLIB_START(7483) { register_input("A1", m_A1); @@ -83,3 +85,5 @@ NETLIB_RESET(7483_dip) { NETLIB_NAME(7483)::reset(); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_7483.h b/src/emu/netlist/devices/nld_7483.h index d887c72f0a9..36fbc09385f 100644 --- a/src/emu/netlist/devices/nld_7483.h +++ b/src/emu/netlist/devices/nld_7483.h @@ -44,6 +44,8 @@ #define TTL_7483_DIP(_name) \ NET_REGISTER_DEV(7483_dip, _name) +NETLIB_NAMESPACE_DEVICES_START() + NETLIB_DEVICE(7483, netlist_logic_input_t m_C0; netlist_logic_input_t m_A1; @@ -67,4 +69,6 @@ NETLIB_DEVICE(7483, NETLIB_DEVICE_DERIVED_PURE(7483_dip, 7483); +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_7483_H_ */ diff --git a/src/emu/netlist/devices/nld_7486.c b/src/emu/netlist/devices/nld_7486.c index 1e8de4bf744..5957c2c0433 100644 --- a/src/emu/netlist/devices/nld_7486.c +++ b/src/emu/netlist/devices/nld_7486.c @@ -7,6 +7,8 @@ #include "nld_7486.h" +NETLIB_NAMESPACE_DEVICES_START() + #if (USE_TRUTHTABLE) nld_7486::truthtable_t nld_7486::m_ttbl; const char *nld_7486::m_desc[] = { @@ -112,3 +114,4 @@ NETLIB_RESET(7486_dip) m_4.do_reset(); } +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_7486.h b/src/emu/netlist/devices/nld_7486.h index e5ad2cb3be7..67e79f740f5 100644 --- a/src/emu/netlist/devices/nld_7486.h +++ b/src/emu/netlist/devices/nld_7486.h @@ -33,14 +33,20 @@ #define NLD_7486_H_ #include "nld_signal.h" +#include "nld_truthtable.h" #define TTL_7486_XOR(_name, _A, _B) \ NET_REGISTER_DEV(7486, _name) \ NET_CONNECT(_name, A, _A) \ NET_CONNECT(_name, B, _B) + +#define TTL_7486_DIP(_name) \ + NET_REGISTER_DEV(7486_dip, _name) + +NETLIB_NAMESPACE_DEVICES_START() + #if (USE_TRUTHTABLE) -#include "nld_truthtable.h" NETLIB_TRUTHTABLE(7486, 2, 1, 0); #else NETLIB_DEVICE(7486, @@ -54,9 +60,6 @@ public: ); #endif -#define TTL_7486_DIP(_name) \ - NET_REGISTER_DEV(7486_dip, _name) - NETLIB_DEVICE(7486_dip, NETLIB_NAME(7486) m_1; @@ -65,4 +68,6 @@ NETLIB_DEVICE(7486_dip, NETLIB_NAME(7486) m_4; ); +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_7486_H_ */ diff --git a/src/emu/netlist/devices/nld_7490.c b/src/emu/netlist/devices/nld_7490.c index ec149da7fce..a054247a070 100644 --- a/src/emu/netlist/devices/nld_7490.c +++ b/src/emu/netlist/devices/nld_7490.c @@ -7,6 +7,8 @@ #include "nld_7490.h" +NETLIB_NAMESPACE_DEVICES_START() + NETLIB_START(7490) { register_input("A", m_A); @@ -112,3 +114,5 @@ NETLIB_RESET(7490_dip) { NETLIB_NAME(7490)::reset(); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_7490.h b/src/emu/netlist/devices/nld_7490.h index 81398d69bd8..6745909cdd3 100644 --- a/src/emu/netlist/devices/nld_7490.h +++ b/src/emu/netlist/devices/nld_7490.h @@ -69,6 +69,7 @@ #define TTL_7490_DIP(_name) \ NET_REGISTER_DEV(7490_dip, _name) +NETLIB_NAMESPACE_DEVICES_START() NETLIB_DEVICE(7490, ATTR_HOT void update_outputs(); @@ -89,4 +90,6 @@ NETLIB_DEVICE(7490, NETLIB_DEVICE_DERIVED_PURE(7490_dip, 7490); +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_7490_H_ */ diff --git a/src/emu/netlist/devices/nld_7493.c b/src/emu/netlist/devices/nld_7493.c index b558410d828..1d80ded0b32 100644 --- a/src/emu/netlist/devices/nld_7493.c +++ b/src/emu/netlist/devices/nld_7493.c @@ -8,6 +8,8 @@ #include "nld_7493.h" #include "../nl_setup.h" +NETLIB_NAMESPACE_DEVICES_START() + NETLIB_START(7493) { register_sub("A", A); @@ -118,3 +120,5 @@ NETLIB_RESET(7493_dip) { NETLIB_NAME(7493)::reset(); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_7493.h b/src/emu/netlist/devices/nld_7493.h index c78b7dce4dc..b489603b59a 100644 --- a/src/emu/netlist/devices/nld_7493.h +++ b/src/emu/netlist/devices/nld_7493.h @@ -69,6 +69,8 @@ #define TTL_7493_DIP(_name) \ NET_REGISTER_DEV(7493_dip, _name) +NETLIB_NAMESPACE_DEVICES_START() + NETLIB_SUBDEVICE(7493ff, netlist_logic_input_t m_I; netlist_logic_output_t m_Q; @@ -89,5 +91,7 @@ NETLIB_DEVICE(7493, NETLIB_DEVICE_DERIVED_PURE(7493_dip, 7493); +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_7493_H_ */ diff --git a/src/emu/netlist/devices/nld_74ls629.c b/src/emu/netlist/devices/nld_74ls629.c index 31f66c562e3..a7b93f36cf2 100644 --- a/src/emu/netlist/devices/nld_74ls629.c +++ b/src/emu/netlist/devices/nld_74ls629.c @@ -42,6 +42,8 @@ #include "nld_74ls629.h" #include "../nl_setup.h" +NETLIB_NAMESPACE_DEVICES_START() + NETLIB_START(SN74LS629clk) { register_input("FB", m_FB); @@ -205,3 +207,5 @@ NETLIB_RESET(SN74LS629_dip) m_1.do_reset(); m_2.do_reset(); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_74ls629.h b/src/emu/netlist/devices/nld_74ls629.h index c571b5c29ed..c2981cfbe48 100644 --- a/src/emu/netlist/devices/nld_74ls629.h +++ b/src/emu/netlist/devices/nld_74ls629.h @@ -35,6 +35,8 @@ NET_REGISTER_DEV(SN74LS629, _name) \ NETDEV_PARAMI(_name, CAP, _cap) +NETLIB_NAMESPACE_DEVICES_START() + NETLIB_SUBDEVICE(SN74LS629clk, netlist_logic_input_t m_FB; netlist_logic_output_t m_Y; @@ -67,5 +69,7 @@ NETLIB_DEVICE(SN74LS629_dip, NETLIB_NAME(SN74LS629) m_2; ); +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_74LS629_H_ */ diff --git a/src/emu/netlist/devices/nld_82S16.c b/src/emu/netlist/devices/nld_82S16.c index 1cf8d8e8182..07990ffa598 100644 --- a/src/emu/netlist/devices/nld_82S16.c +++ b/src/emu/netlist/devices/nld_82S16.c @@ -7,6 +7,8 @@ #include "nld_82S16.h" +NETLIB_NAMESPACE_DEVICES_START() + // FIXME: timing! // FIXME: optimize device (separate address decoder!) NETLIB_UPDATE(82S16) @@ -98,3 +100,5 @@ NETLIB_UPDATE(82S16_dip) { NETLIB_NAME(82S16)::update(); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_82S16.h b/src/emu/netlist/devices/nld_82S16.h index 1f4b443c991..00d1f7289e0 100644 --- a/src/emu/netlist/devices/nld_82S16.h +++ b/src/emu/netlist/devices/nld_82S16.h @@ -31,6 +31,8 @@ #define TTL_82S16_DIP(_name) \ NET_REGISTER_DEV(82S16_dip, _name) +NETLIB_NAMESPACE_DEVICES_START() + NETLIB_DEVICE(82S16, netlist_logic_input_t m_A[8]; @@ -47,4 +49,6 @@ NETLIB_DEVICE(82S16, NETLIB_DEVICE_DERIVED_PURE(82S16_dip, 82S16); +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_82S16_H_ */ diff --git a/src/emu/netlist/devices/nld_9310.c b/src/emu/netlist/devices/nld_9310.c index 29b941d4417..be86a4a610b 100644 --- a/src/emu/netlist/devices/nld_9310.c +++ b/src/emu/netlist/devices/nld_9310.c @@ -9,6 +9,8 @@ #define MAXCNT 9 +NETLIB_NAMESPACE_DEVICES_START() + NETLIB_START(9310) { register_sub("subABCD", subABCD); @@ -231,3 +233,5 @@ NETLIB_RESET(9310_dip) { NETLIB_NAME(9310)::reset(); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_9310.h b/src/emu/netlist/devices/nld_9310.h index a485749588f..b7d47fa2262 100644 --- a/src/emu/netlist/devices/nld_9310.h +++ b/src/emu/netlist/devices/nld_9310.h @@ -62,6 +62,8 @@ #define TTL_9310_DIP(_name) \ NET_REGISTER_DEV(9310_dip, _name) +NETLIB_NAMESPACE_DEVICES_START() + NETLIB_SUBDEVICE(9310_subABCD, netlist_logic_input_t m_A; netlist_logic_input_t m_B; @@ -104,4 +106,6 @@ NETLIB_DEVICE(9310, NETLIB_DEVICE_DERIVED_PURE(9310_dip, 9310); +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_9310_H_ */ diff --git a/src/emu/netlist/devices/nld_9312.c b/src/emu/netlist/devices/nld_9312.c index 06b6c3c5f62..0821861dea4 100644 --- a/src/emu/netlist/devices/nld_9312.c +++ b/src/emu/netlist/devices/nld_9312.c @@ -22,6 +22,8 @@ */ #include "nld_9312.h" +NETLIB_NAMESPACE_DEVICES_START() + #if (1 && USE_TRUTHTABLE) nld_9312::truthtable_t nld_9312::m_ttbl; @@ -177,3 +179,4 @@ NETLIB_RESET(9312_dip) { m_sub.do_reset(); } +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_9312.h b/src/emu/netlist/devices/nld_9312.h index c4a024f1c00..b6d9c97dfdd 100644 --- a/src/emu/netlist/devices/nld_9312.h +++ b/src/emu/netlist/devices/nld_9312.h @@ -38,12 +38,17 @@ #define NLD_9312_H_ #include "nld_signal.h" +#include "nld_truthtable.h" #define TTL_9312(_name) \ NET_REGISTER_DEV(9312, _name) -#if (USE_TRUTHTABLE) -#include "nld_truthtable.h" +#define TTL_9312_DIP(_name) \ + NET_REGISTER_DEV(9312_dip, _name) + +NETLIB_NAMESPACE_DEVICES_START() + +#if (USE_TRUTHTABLE) /* The truthtable implementation is a lot faster than * the carefully crafted code :-( */ @@ -67,12 +72,10 @@ public: #endif - -#define TTL_9312_DIP(_name) \ - NET_REGISTER_DEV(9312_dip, _name) - NETLIB_DEVICE(9312_dip, NETLIB_NAME(9312) m_sub; ); +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_9312_H_ */ diff --git a/src/emu/netlist/devices/nld_9316.c b/src/emu/netlist/devices/nld_9316.c index dd922af52e3..3b4d23096a8 100644 --- a/src/emu/netlist/devices/nld_9316.c +++ b/src/emu/netlist/devices/nld_9316.c @@ -9,6 +9,8 @@ #define MAXCNT 15 +NETLIB_NAMESPACE_DEVICES_START() + NETLIB_START(9316) { register_sub("subABCD", subABCD); @@ -226,3 +228,5 @@ NETLIB_RESET(9316_dip) { NETLIB_NAME(9316)::reset(); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_9316.h b/src/emu/netlist/devices/nld_9316.h index 88c53b44ae0..77b8ea216da 100644 --- a/src/emu/netlist/devices/nld_9316.h +++ b/src/emu/netlist/devices/nld_9316.h @@ -66,6 +66,8 @@ #define TTL_9316_DIP(_name) \ NET_REGISTER_DEV(9316_dip, _name) +NETLIB_NAMESPACE_DEVICES_START() + NETLIB_SUBDEVICE(9316_subABCD, netlist_logic_input_t m_A; netlist_logic_input_t m_B; @@ -109,4 +111,6 @@ NETLIB_DEVICE(9316, NETLIB_DEVICE_DERIVED_PURE(9316_dip, 9316); +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_9316_H_ */ diff --git a/src/emu/netlist/devices/nld_cmos.h b/src/emu/netlist/devices/nld_cmos.h index 14f69240ce6..1c6f4e4bd78 100644 --- a/src/emu/netlist/devices/nld_cmos.h +++ b/src/emu/netlist/devices/nld_cmos.h @@ -11,6 +11,8 @@ #include "../nl_base.h" #include "../analog/nld_twoterm.h" +NETLIB_NAMESPACE_DEVICES_START() + class nld_vdd_vss : public netlist_device_t { public: @@ -35,4 +37,6 @@ public: ATTR_HOT inline nl_double vss() { return INPANALOG(m_vss); } }; +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_CMOS_H_ */ diff --git a/src/emu/netlist/devices/nld_legacy.c b/src/emu/netlist/devices/nld_legacy.c index ed4e384bc2a..d6b926545fe 100644 --- a/src/emu/netlist/devices/nld_legacy.c +++ b/src/emu/netlist/devices/nld_legacy.c @@ -8,6 +8,8 @@ #include "nld_legacy.h" #include "../nl_setup.h" +NETLIB_NAMESPACE_DEVICES_START() + NETLIB_START(nicRSFF) { register_input("S", m_S); @@ -72,3 +74,5 @@ NETLIB_UPDATE(nicDelay) } m_last = nval; } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_legacy.h b/src/emu/netlist/devices/nld_legacy.h index c82f172781d..d0987505d97 100644 --- a/src/emu/netlist/devices/nld_legacy.h +++ b/src/emu/netlist/devices/nld_legacy.h @@ -15,6 +15,8 @@ #include "../nl_base.h" +NETLIB_NAMESPACE_DEVICES_START() + // ---------------------------------------------------------------------------------------- // Macros // ---------------------------------------------------------------------------------------- @@ -49,5 +51,6 @@ NETLIB_DEVICE_WITH_PARAMS(nicDelay, UINT8 m_last; ); +NETLIB_NAMESPACE_DEVICES_END() #endif /* NLD_LEGACY_H_ */ diff --git a/src/emu/netlist/devices/nld_log.c b/src/emu/netlist/devices/nld_log.c index a57301df744..f6061cc3aab 100644 --- a/src/emu/netlist/devices/nld_log.c +++ b/src/emu/netlist/devices/nld_log.c @@ -10,6 +10,8 @@ #include "nld_log.h" //#include "sound/wavwrite.h" +NETLIB_NAMESPACE_DEVICES_START() + //FIXME: what to do with save states? NETLIB_START(log) @@ -70,3 +72,5 @@ NETLIB_NAME(log)::~NETLIB_NAME(wav)() fclose(m_file); } #endif + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_log.h b/src/emu/netlist/devices/nld_log.h index 99fd9541602..dec1c84e7c9 100644 --- a/src/emu/netlist/devices/nld_log.h +++ b/src/emu/netlist/devices/nld_log.h @@ -24,6 +24,8 @@ NET_REGISTER_DEV(log, _name) \ NET_CONNECT(_name, I, _I) +NETLIB_NAMESPACE_DEVICES_START() + NETLIB_DEVICE(log, ~NETLIB_NAME(log)(); netlist_analog_input_t m_I; @@ -50,4 +52,6 @@ private: ); #endif +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_LOG_H_ */ diff --git a/src/emu/netlist/devices/nld_ne555.c b/src/emu/netlist/devices/nld_ne555.c index 8caf08e024b..c33422012f8 100644 --- a/src/emu/netlist/devices/nld_ne555.c +++ b/src/emu/netlist/devices/nld_ne555.c @@ -12,6 +12,8 @@ #define R_OFF (1E20) #define R_ON (25) // Datasheet states a maximum discharge of 200mA, R = 5V / 0.2 +NETLIB_NAMESPACE_DEVICES_START() + inline nl_double NETLIB_NAME(NE555)::clamp(const nl_double v, const nl_double a, const nl_double b) { nl_double ret = v; @@ -124,3 +126,5 @@ NETLIB_RESET(NE555_dip) { NETLIB_NAME(NE555)::reset(); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_ne555.h b/src/emu/netlist/devices/nld_ne555.h index cb433732c48..9902c4e0c40 100644 --- a/src/emu/netlist/devices/nld_ne555.h +++ b/src/emu/netlist/devices/nld_ne555.h @@ -25,6 +25,7 @@ #define NE555(_name) \ NET_REGISTER_DEV(NE555, _name) +NETLIB_NAMESPACE_DEVICES_START() NETLIB_DEVICE(NE555, NETLIB_NAME(R) m_R1; @@ -49,5 +50,6 @@ NETLIB_DEVICE(NE555, NETLIB_DEVICE_DERIVED_PURE(NE555_dip, NE555); +NETLIB_NAMESPACE_DEVICES_END() #endif /* NLD_NE555_H_ */ diff --git a/src/emu/netlist/devices/nld_r2r_dac.c b/src/emu/netlist/devices/nld_r2r_dac.c index 1e76723f9e7..c1f05837d4c 100644 --- a/src/emu/netlist/devices/nld_r2r_dac.c +++ b/src/emu/netlist/devices/nld_r2r_dac.c @@ -7,6 +7,8 @@ #include "nld_r2r_dac.h" +NETLIB_NAMESPACE_DEVICES_START() + NETLIB_START(r2r_dac) { NETLIB_NAME(twoterm)::start(); @@ -38,3 +40,5 @@ NETLIB_UPDATE_PARAM(r2r_dac) this->set(1.0 / m_R.Value(), V, 0.0); } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_r2r_dac.h b/src/emu/netlist/devices/nld_r2r_dac.h index 619fad90539..ac9d7247dee 100644 --- a/src/emu/netlist/devices/nld_r2r_dac.h +++ b/src/emu/netlist/devices/nld_r2r_dac.h @@ -55,6 +55,8 @@ NETDEV_PARAMI(_name, R, _R) \ NETDEV_PARAMI(_name, N, _N) +NETLIB_NAMESPACE_DEVICES_START() + NETLIB_DEVICE_WITH_PARAMS_DERIVED(r2r_dac, twoterm, netlist_param_double_t m_VIN; netlist_param_double_t m_R; @@ -62,5 +64,7 @@ NETLIB_DEVICE_WITH_PARAMS_DERIVED(r2r_dac, twoterm, netlist_param_int_t m_val; ); +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_R2R_DAC_H_ */ diff --git a/src/emu/netlist/devices/nld_signal.h b/src/emu/netlist/devices/nld_signal.h index 0dc84e7e549..e00edd1a51b 100644 --- a/src/emu/netlist/devices/nld_signal.h +++ b/src/emu/netlist/devices/nld_signal.h @@ -22,6 +22,8 @@ : net_signal_t<_num_input, _check, _invert>() { } \ } +NETLIB_NAMESPACE_DEVICES_START() + // ---------------------------------------------------------------------------------------- // net_signal_t // ---------------------------------------------------------------------------------------- @@ -112,4 +114,6 @@ public: INT32 m_active; }; +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_SIGNAL_H_ */ diff --git a/src/emu/netlist/devices/nld_system.c b/src/emu/netlist/devices/nld_system.c index 68057768bad..ef87b7a94c7 100644 --- a/src/emu/netlist/devices/nld_system.c +++ b/src/emu/netlist/devices/nld_system.c @@ -8,6 +8,8 @@ #include "nld_system.h" #include "../analog/nld_solver.h" +NETLIB_NAMESPACE_DEVICES_START() + // ---------------------------------------------------------------------------------------- // netlistparams // ---------------------------------------------------------------------------------------- @@ -271,3 +273,5 @@ NETLIB_UPDATE_PARAM(res_sw) { // nothing, not intended to be called } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_system.h b/src/emu/netlist/devices/nld_system.h index 2552ebe018b..013ef962701 100644 --- a/src/emu/netlist/devices/nld_system.h +++ b/src/emu/netlist/devices/nld_system.h @@ -64,8 +64,10 @@ #define PARAMETERS(_name) \ NET_REGISTER_DEV(netlistparams, _name) +NETLIB_NAMESPACE_DEVICES_START() + // ----------------------------------------------------------------------------- -// mainclock +// netlistparams // ----------------------------------------------------------------------------- NETLIB_DEVICE_WITH_PARAMS(netlistparams, @@ -406,4 +408,6 @@ private: bool m_is_timestep; }; +NETLIB_NAMESPACE_DEVICES_END() + #endif /* NLD_SYSTEM_H_ */ diff --git a/src/emu/netlist/devices/nld_truthtable.c b/src/emu/netlist/devices/nld_truthtable.c index 24c3e88285e..e3bc847e80f 100644 --- a/src/emu/netlist/devices/nld_truthtable.c +++ b/src/emu/netlist/devices/nld_truthtable.c @@ -8,6 +8,8 @@ #include "nld_truthtable.h" #include "../plib/plists.h" +NETLIB_NAMESPACE_DEVICES_START() + unsigned truthtable_desc_t::count_bits(UINT32 v) { unsigned ret = 0; @@ -267,3 +269,5 @@ netlist_base_factory_truthtable_t *nl_tt_factory_create(const unsigned ni, const } return NULL; } + +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/devices/nld_truthtable.h b/src/emu/netlist/devices/nld_truthtable.h index 615f8d6b9b6..42f8d337fbb 100644 --- a/src/emu/netlist/devices/nld_truthtable.h +++ b/src/emu/netlist/devices/nld_truthtable.h @@ -24,6 +24,23 @@ static const char *m_desc[]; \ } +#define TRUTHTABLE_START(_name, _in, _out, _has_state, _def_params) \ + { \ + netlist::devices::netlist_base_factory_truthtable_t *ttd = netlist::devices::nl_tt_factory_create(_in, _out, _has_state, \ + # _name, # _name, "+" _def_params); + +#define TT_HEAD(_x) \ + ttd->m_desc.add(_x); + +#define TT_LINE(_x) \ + ttd->m_desc.add(_x); + +#define TRUTHTABLE_END() \ + setup.factory().register_device(ttd); \ + } + +NETLIB_NAMESPACE_DEVICES_START() + #if 0 static inline UINT32 remove_first_bit(UINT32 v) { @@ -308,20 +325,8 @@ netlist_base_factory_truthtable_t *nl_tt_factory_create(const unsigned ni, const const pstring &name, const pstring &classname, const pstring &def_param); -#define TRUTHTABLE_START(_name, _in, _out, _has_state, _def_params) \ - { \ - netlist_base_factory_truthtable_t *ttd = nl_tt_factory_create(_in, _out, _has_state, \ - # _name, # _name, "+" _def_params); +NETLIB_NAMESPACE_DEVICES_END() -#define TT_HEAD(_x) \ - ttd->m_desc.add(_x); - -#define TT_LINE(_x) \ - ttd->m_desc.add(_x); - -#define TRUTHTABLE_END() \ - setup.factory().register_device(ttd); \ - } #endif /* NLD_TRUTHTABLE_H_ */ diff --git a/src/emu/netlist/nl_base.c b/src/emu/netlist/nl_base.c index c8c59c37b7b..a4188d8ae98 100644 --- a/src/emu/netlist/nl_base.c +++ b/src/emu/netlist/nl_base.c @@ -7,6 +7,7 @@ #include #include +#include #include "plib/palloc.h" @@ -17,6 +18,8 @@ const netlist_time netlist_time::zero = netlist_time::from_raw(0); +namespace netlist +{ //============================================================ // Exceptions //============================================================ @@ -53,9 +56,9 @@ public: m_R_low = 1.0; m_R_high = 130.0; } - virtual nld_base_d_to_a_proxy *create_d_a_proxy(netlist_logic_output_t *proxied) const + virtual devices::nld_base_d_to_a_proxy *create_d_a_proxy(netlist_logic_output_t *proxied) const { - return palloc(nld_d_to_a_proxy , proxied); + return palloc(devices::nld_d_to_a_proxy, proxied); } }; @@ -73,9 +76,9 @@ public: m_R_low = 1.0; m_R_high = 130.0; } - virtual nld_base_d_to_a_proxy *create_d_a_proxy(netlist_logic_output_t *proxied) const + virtual devices::nld_base_d_to_a_proxy *create_d_a_proxy(netlist_logic_output_t *proxied) const { - return palloc(nld_d_to_a_proxy , proxied); + return palloc(devices::nld_d_to_a_proxy , proxied); } }; @@ -233,10 +236,10 @@ ATTR_COLD void netlist_base_t::start() NL_VERBOSE_OUT(("Searching for mainclock and solver ...\n")); - m_mainclock = get_single_device("mainclock"); - m_solver = get_single_device("solver"); - m_gnd = get_single_device("gnd"); - m_params = get_single_device("parameter"); + m_mainclock = get_single_device("mainclock"); + m_solver = get_single_device("solver"); + m_gnd = get_single_device("gnd"); + m_params = get_single_device("parameter"); /* make sure the solver and parameters are started first! */ @@ -355,7 +358,7 @@ ATTR_HOT void netlist_base_t::process_queue(const netlist_time &delta) { m_time = mc_time; mc_time += inc; - NETLIB_NAME(mainclock)::mc_update(mc_net); + devices::NETLIB_NAME(mainclock)::mc_update(mc_net); } const netlist_queue_t::entry_t e = *m_queue.pop(); @@ -365,7 +368,7 @@ ATTR_HOT void netlist_base_t::process_queue(const netlist_time &delta) } else { m_time = mc_time; mc_time += inc; - NETLIB_NAME(mainclock)::mc_update(mc_net); + devices::NETLIB_NAME(mainclock)::mc_update(mc_net); } add_to_stat(m_perf_out_processed, 1); @@ -1088,6 +1091,9 @@ ATTR_COLD nl_double netlist_param_model_t::model_value(const pstring &entity, co } } +} + +NETLIB_NAMESPACE_DEVICES_START() // ---------------------------------------------------------------------------------------- // mainclock @@ -1125,3 +1131,4 @@ NETLIB_UPDATE(mainclock) net.set_time(netlist().time() + m_inc); } +NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/emu/netlist/nl_base.h b/src/emu/netlist/nl_base.h index 9b7059efb10..9cf59c49030 100644 --- a/src/emu/netlist/nl_base.h +++ b/src/emu/netlist/nl_base.h @@ -172,6 +172,10 @@ // MACROS / netlist devices //============================================================ +#define NETLIB_NAMESPACE_DEVICES_START() namespace netlist { namespace devices { + +#define NETLIB_NAMESPACE_DEVICES_END() }} + #define NETLIB_NAME(_chip) nld_ ## _chip #define NETLIB_NAME_STR_S(_s) # _s @@ -245,21 +249,6 @@ virtual const netlist_logic_family_desc_t *default_logic_family() \ return &netlist_family_ ## _fam; \ } -//============================================================ -// Exceptions -//============================================================ - -class nl_fatalerror : public std::exception -{ -public: - nl_fatalerror(const char *format, ...) ATTR_PRINTF(2,3); - nl_fatalerror(const char *format, va_list ap); - virtual ~nl_fatalerror() throw() {} - - const pstring &text() { return m_text; } -private: - pstring m_text; -}; //============================================================ // Asserts @@ -277,1152 +266,1178 @@ private: // forward definitions // ----------------------------------------------------------------------------- -class netlist_logic_output_t; -class netlist_analog_net_t; -class netlist_logic_net_t; -class netlist_net_t; -class netlist_setup_t; -class netlist_base_t; -class netlist_matrix_solver_t; -class netlist_core_device_t; +//============================================================ +// Namespace starts +//============================================================ -class NETLIB_NAME(gnd); -class NETLIB_NAME(solver); -class NETLIB_NAME(mainclock); -class NETLIB_NAME(netlistparams); -class NETLIB_NAME(base_proxy); - -// ----------------------------------------------------------------------------- -// netlist_output_family_t -// ----------------------------------------------------------------------------- - -class nld_base_d_to_a_proxy; - -class netlist_logic_family_desc_t +namespace netlist { -public: - virtual ~netlist_logic_family_desc_t() {} - virtual nld_base_d_to_a_proxy *create_d_a_proxy(netlist_logic_output_t *proxied) const = 0; + namespace devices + { + class netlist_matrix_solver_t; + class NETLIB_NAME(gnd); + class NETLIB_NAME(solver); + class NETLIB_NAME(mainclock); + class NETLIB_NAME(netlistparams); + class NETLIB_NAME(base_proxy); + class nld_base_d_to_a_proxy; + } - nl_double m_low_thresh_V; - nl_double m_high_thresh_V; - nl_double m_low_V; - nl_double m_high_V; - nl_double m_R_low; - nl_double m_R_high; -}; + //============================================================ + // Exceptions + //============================================================ -class netlist_logic_family_t -{ -public: + class nl_fatalerror : public std::exception + { + public: + nl_fatalerror(const char *format, ...) ATTR_PRINTF(2,3); + nl_fatalerror(const char *format, va_list ap); + virtual ~nl_fatalerror() throw() {} - netlist_logic_family_t() : m_logic_family(NULL) {} - - ATTR_HOT const netlist_logic_family_desc_t *logic_family() const { return m_logic_family; } - ATTR_COLD void set_logic_family(const netlist_logic_family_desc_t *fam) { m_logic_family = fam; } - -private: - const netlist_logic_family_desc_t *m_logic_family; -}; - -/* Terminals inherit the family description from the netlist_device - * The default is the ttl family, but any device can override the family. - * For individual terminals, these can be overwritten as well. - * - * Only devices of type GENERIC should have a family description entry - */ - -extern const netlist_logic_family_desc_t &netlist_family_TTL; -extern const netlist_logic_family_desc_t &netlist_family_CD4000; - - -// ----------------------------------------------------------------------------- -// netlist_object_t -// ----------------------------------------------------------------------------- - -class netlist_object_t -{ - NETLIST_PREVENT_COPYING(netlist_object_t) -public: - enum type_t { - TERMINAL = 0, - INPUT = 1, - OUTPUT = 2, - PARAM = 3, - NET = 4, - DEVICE = 5, - NETLIST = 6, - QUEUE = 7 - }; - enum family_t { - // Terminal families - LOGIC, - ANALOG, - // Device families - GENERIC, // <== devices usually fall into this category - TWOTERM, // Generic twoterm ... - RESISTOR, // Resistor - CAPACITOR, // Capacitor - DIODE, // Diode - DUMMY, // DUMMY device without function - FRONTIER, // Net frontier - BJT_EB, // BJT(Ebers-Moll) - BJT_SWITCH, // BJT(Switch) - VCVS, // Voltage controlled voltage source - VCCS, // Voltage controlled current source - CCCS, // Current controlled current source - GND // GND device + const pstring &text() { return m_text; } + private: + pstring m_text; }; - ATTR_COLD netlist_object_t(const type_t atype, const family_t afamily); + class netlist_logic_output_t; + class netlist_analog_net_t; + class netlist_logic_net_t; + class netlist_net_t; + class netlist_setup_t; + class netlist_base_t; + class netlist_core_device_t; - virtual ~netlist_object_t(); + // ----------------------------------------------------------------------------- + // netlist_output_family_t + // ----------------------------------------------------------------------------- - ATTR_COLD void init_object(netlist_base_t &nl, const pstring &aname); - ATTR_COLD bool isInitialized() { return (m_netlist != NULL); } - - ATTR_COLD const pstring &name() const; - - PSTATE_INTERFACE_DECL() - - ATTR_HOT type_t type() const { return m_objtype; } - ATTR_HOT family_t family() const { return m_family; } - - ATTR_HOT bool isType(const type_t atype) const { return (m_objtype == atype); } - ATTR_HOT bool isFamily(const family_t afamily) const { return (m_family == afamily); } - - ATTR_HOT netlist_base_t & netlist() { return *m_netlist; } - ATTR_HOT const netlist_base_t & netlist() const { return *m_netlist; } - - ATTR_COLD void do_reset() + class netlist_logic_family_desc_t { - reset(); - } + public: + virtual ~netlist_logic_family_desc_t() {} + virtual devices::nld_base_d_to_a_proxy *create_d_a_proxy(netlist_logic_output_t *proxied) const = 0; -protected: - - virtual void reset() = 0; - // must call parent save_register ! - virtual void save_register() { }; - -private: - pstring m_name; - const type_t m_objtype; - const family_t m_family; - netlist_base_t * m_netlist; -}; - -// ----------------------------------------------------------------------------- -// netlist_owned_object_t -// ----------------------------------------------------------------------------- - -class netlist_owned_object_t : public netlist_object_t -{ - NETLIST_PREVENT_COPYING(netlist_owned_object_t) -public: - ATTR_COLD netlist_owned_object_t(const type_t atype, const family_t afamily); - - ATTR_COLD void init_object(netlist_core_device_t &dev, const pstring &aname); - - ATTR_HOT netlist_core_device_t &netdev() const { return *m_netdev; } -private: - netlist_core_device_t * m_netdev; -}; - -// ----------------------------------------------------------------------------- -// netlist_core_terminal_t -// ----------------------------------------------------------------------------- - -class netlist_core_terminal_t : public netlist_owned_object_t, public plinkedlist_element_t -{ - NETLIST_PREVENT_COPYING(netlist_core_terminal_t) -public: - - typedef plist_t list_t; - - /* needed here ... */ - - enum state_e { - STATE_INP_PASSIVE = 0, - STATE_INP_ACTIVE = 1, - STATE_INP_HL = 2, - STATE_INP_LH = 4, - STATE_OUT = 128, - STATE_NONEX = 256 + nl_double m_low_thresh_V; + nl_double m_high_thresh_V; + nl_double m_low_V; + nl_double m_high_V; + nl_double m_R_low; + nl_double m_R_high; }; - - ATTR_COLD netlist_core_terminal_t(const type_t atype, const family_t afamily); - - //ATTR_COLD void init_object(netlist_core_device_t &dev, const pstring &aname); - - ATTR_COLD void set_net(netlist_net_t &anet); - ATTR_COLD void clear_net() { m_net = NULL; } - ATTR_HOT bool has_net() const { return (m_net != NULL); } - - ATTR_HOT const netlist_net_t & net() const { return *m_net;} - ATTR_HOT netlist_net_t & net() { return *m_net;} - - ATTR_HOT bool is_state(const state_e astate) const { return (m_state == astate); } - ATTR_HOT state_e state() const { return m_state; } - ATTR_HOT void set_state(const state_e astate) + class netlist_logic_family_t { - nl_assert(astate != STATE_NONEX); - m_state = astate; - } + public: - - ATTR_HOT /* inline */ void update_dev(const UINT32 mask); + netlist_logic_family_t() : m_logic_family(NULL) {} -protected: - virtual void save_register() - { - save(NLNAME(m_state)); - netlist_owned_object_t::save_register(); - } + ATTR_HOT const netlist_logic_family_desc_t *logic_family() const { return m_logic_family; } + ATTR_COLD void set_logic_family(const netlist_logic_family_desc_t *fam) { m_logic_family = fam; } -private: - netlist_net_t * m_net; - state_e m_state; -}; + private: + const netlist_logic_family_desc_t *m_logic_family; + }; -NETLIST_SAVE_TYPE(netlist_core_terminal_t::state_e, DT_INT); - - -class netlist_terminal_t : public netlist_core_terminal_t -{ - NETLIST_PREVENT_COPYING(netlist_terminal_t) -public: - - typedef plist_t list_t; - - ATTR_COLD netlist_terminal_t(); - - nl_double *m_Idr1; // drive current - nl_double *m_go1; // conductance for Voltage from other term - nl_double *m_gt1; // conductance for total conductance - - ATTR_HOT void set(const nl_double G) - { - set_ptr(m_Idr1, 0); - set_ptr(m_go1, G); - set_ptr(m_gt1, G); - } - - ATTR_HOT void set(const nl_double GO, const nl_double GT) - { - set_ptr(m_Idr1, 0); - set_ptr(m_go1, GO); - set_ptr(m_gt1, GT); - } - - ATTR_HOT void set(const nl_double GO, const nl_double GT, const nl_double I) - { - set_ptr(m_Idr1, I); - set_ptr(m_go1, GO); - set_ptr(m_gt1, GT); - } - - ATTR_HOT void schedule_solve(); - ATTR_HOT void schedule_after(const netlist_time &after); - - netlist_terminal_t *m_otherterm; - -protected: - virtual void save_register(); - - virtual void reset(); -private: - ATTR_HOT void set_ptr(nl_double *ptr, const nl_double val) - { - if (ptr != NULL && *ptr != val) - { - *ptr = val; - } - } -}; - - -// ----------------------------------------------------------------------------- -// netlist_input_t -// ----------------------------------------------------------------------------- - -class netlist_logic_t : public netlist_core_terminal_t, public netlist_logic_family_t -{ -public: - - - ATTR_COLD netlist_logic_t(const type_t atype) - : netlist_core_terminal_t(atype, LOGIC), netlist_logic_family_t(), - m_proxy(NULL) - { - } - - ATTR_COLD bool has_proxy() const { return (m_proxy != NULL); } - ATTR_COLD nld_base_proxy *get_proxy() const { return m_proxy; } - ATTR_COLD void set_proxy(nld_base_proxy *proxy) { m_proxy = proxy; } - -protected: - -private: - nld_base_proxy *m_proxy; -}; - -class netlist_analog_t : public netlist_core_terminal_t -{ -public: - - - ATTR_COLD netlist_analog_t(const type_t atype) - : netlist_core_terminal_t(atype, ANALOG) - { - } - -protected: - -private: -}; - -// ----------------------------------------------------------------------------- -// netlist_logic_input_t -// ----------------------------------------------------------------------------- - -class netlist_logic_input_t : public netlist_logic_t -{ -public: - ATTR_COLD netlist_logic_input_t() - : netlist_logic_t(INPUT) - { - set_state(STATE_INP_ACTIVE); - } - - ATTR_HOT netlist_sig_t Q() const; - ATTR_HOT netlist_sig_t last_Q() const; - - ATTR_HOT void inactivate(); - ATTR_HOT void activate(); - ATTR_HOT void activate_hl(); - ATTR_HOT void activate_lh(); - -protected: - virtual void reset() - { - //netlist_core_terminal_t::reset(); - set_state(STATE_INP_ACTIVE); - } - -}; - -// ----------------------------------------------------------------------------- -// netlist_analog_input_t -// ----------------------------------------------------------------------------- - -class netlist_analog_input_t : public netlist_analog_t -{ -public: - ATTR_COLD netlist_analog_input_t() - : netlist_analog_t(INPUT) - { - set_state(STATE_INP_ACTIVE); - } - - ATTR_HOT nl_double Q_Analog() const; - -protected: - virtual void reset() - { - //netlist_core_terminal_t::reset(); - set_state(STATE_INP_ACTIVE); - } -}; - -// ----------------------------------------------------------------------------- -// net_net_t -// ----------------------------------------------------------------------------- - -class netlist_net_t : public netlist_object_t -{ - NETLIST_PREVENT_COPYING(netlist_net_t) -public: - - typedef plist_t list_t; - - ATTR_COLD netlist_net_t(const family_t afamily); - virtual ~netlist_net_t(); - - ATTR_COLD void init_object(netlist_base_t &nl, const pstring &aname); - - ATTR_COLD void register_con(netlist_core_terminal_t &terminal); - ATTR_COLD void merge_net(netlist_net_t *othernet); - ATTR_COLD void register_railterminal(netlist_core_terminal_t &mr); - - ATTR_HOT netlist_logic_net_t & as_logic(); - ATTR_HOT const netlist_logic_net_t & as_logic() const; - - ATTR_HOT netlist_analog_net_t & as_analog(); - ATTR_HOT const netlist_analog_net_t & as_analog() const; - - ATTR_HOT void update_devs(); - - ATTR_HOT const netlist_time &time() const { return m_time; } - ATTR_HOT void set_time(const netlist_time &ntime) { m_time = ntime; } - - ATTR_HOT bool isRailNet() const { return !(m_railterminal == NULL); } - ATTR_HOT netlist_core_terminal_t & railterminal() const { return *m_railterminal; } - - ATTR_HOT void push_to_queue(const netlist_time &delay); - ATTR_HOT void reschedule_in_queue(const netlist_time &delay); - ATTR_HOT bool is_queued() const { return m_in_queue == 1; } - - ATTR_HOT int num_cons() const { return m_core_terms.size(); } - - ATTR_HOT void inc_active(netlist_core_terminal_t &term); - ATTR_HOT void dec_active(netlist_core_terminal_t &term); - - ATTR_COLD void rebuild_list(); /* rebuild m_list after a load */ - - ATTR_COLD void move_connections(netlist_net_t *new_net); - - plist_t m_core_terms; // save post-start m_list ... - - ATTR_HOT void set_Q_time(const netlist_sig_t &newQ, const netlist_time &at) - { - if (newQ != m_new_Q) - { - m_in_queue = 0; - m_time = at; - } - m_cur_Q = m_new_Q = newQ; - } - -protected: //FIXME: needed by current solver code - - virtual void save_register(); - virtual void reset(); - - netlist_sig_t m_new_Q; - netlist_sig_t m_cur_Q; - -private: - - netlist_core_terminal_t * m_railterminal; - plinkedlist_t m_list_active; - - netlist_time m_time; - INT32 m_active; - UINT8 m_in_queue; /* 0: not in queue, 1: in queue, 2: last was taken */ - -public: - // We have to have those on one object. Dividing those does lead - // to a significant performance hit - // FIXME: Have to fix the public at some time - nl_double m_cur_Analog; - -}; - -class netlist_logic_net_t : public netlist_net_t -{ - NETLIST_PREVENT_COPYING(netlist_logic_net_t) -public: - - typedef plist_t list_t; - - ATTR_COLD netlist_logic_net_t(); - virtual ~netlist_logic_net_t() { }; - - ATTR_HOT netlist_sig_t Q() const - { - return m_cur_Q; - } - - ATTR_HOT netlist_sig_t new_Q() const - { - return m_new_Q; - } - - ATTR_HOT void set_Q(const netlist_sig_t &newQ, const netlist_time &delay) - { - if (newQ != m_new_Q) - { - m_new_Q = newQ; - push_to_queue(delay); - } - } - - ATTR_HOT void toggle_new_Q() - { - m_new_Q ^= 1; - } - - ATTR_COLD void initial(const netlist_sig_t val) - { - m_cur_Q = val; - m_new_Q = val; - } - - /* internal state support - * FIXME: get rid of this and implement export/import in MAME + /* Terminals inherit the family description from the netlist_device + * The default is the ttl family, but any device can override the family. + * For individual terminals, these can be overwritten as well. + * + * Only devices of type GENERIC should have a family description entry */ - ATTR_COLD netlist_sig_t &Q_state_ptr() + + extern const netlist_logic_family_desc_t &netlist_family_TTL; + extern const netlist_logic_family_desc_t &netlist_family_CD4000; + + + // ----------------------------------------------------------------------------- + // netlist_object_t + // ----------------------------------------------------------------------------- + + class netlist_object_t { - return m_cur_Q; - } + NETLIST_PREVENT_COPYING(netlist_object_t) + public: + enum type_t { + TERMINAL = 0, + INPUT = 1, + OUTPUT = 2, + PARAM = 3, + NET = 4, + DEVICE = 5, + NETLIST = 6, + QUEUE = 7 + }; + enum family_t { + // Terminal families + LOGIC, + ANALOG, + // Device families + GENERIC, // <== devices usually fall into this category + TWOTERM, // Generic twoterm ... + RESISTOR, // Resistor + CAPACITOR, // Capacitor + DIODE, // Diode + DUMMY, // DUMMY device without function + FRONTIER, // Net frontier + BJT_EB, // BJT(Ebers-Moll) + BJT_SWITCH, // BJT(Switch) + VCVS, // Voltage controlled voltage source + VCCS, // Voltage controlled current source + CCCS, // Current controlled current source + GND // GND device + }; -protected: //FIXME: needed by current solver code + ATTR_COLD netlist_object_t(const type_t atype, const family_t afamily); - virtual void save_register(); - virtual void reset(); + virtual ~netlist_object_t(); + ATTR_COLD void init_object(netlist_base_t &nl, const pstring &aname); + ATTR_COLD bool isInitialized() { return (m_netlist != NULL); } -private: + ATTR_COLD const pstring &name() const; -public: + PSTATE_INTERFACE_DECL() -}; + ATTR_HOT type_t type() const { return m_objtype; } + ATTR_HOT family_t family() const { return m_family; } -class netlist_analog_net_t : public netlist_net_t -{ - NETLIST_PREVENT_COPYING(netlist_analog_net_t) -public: + ATTR_HOT bool isType(const type_t atype) const { return (m_objtype == atype); } + ATTR_HOT bool isFamily(const family_t afamily) const { return (m_family == afamily); } - typedef plist_t list_t; + ATTR_HOT netlist_base_t & netlist() { return *m_netlist; } + ATTR_HOT const netlist_base_t & netlist() const { return *m_netlist; } - ATTR_COLD netlist_analog_net_t(); - virtual ~netlist_analog_net_t() { }; + ATTR_COLD void do_reset() + { + reset(); + } - ATTR_HOT nl_double Q_Analog() const - { - return m_cur_Analog; - } + protected: - ATTR_COLD nl_double &Q_Analog_state_ptr() - { - return m_cur_Analog; - } + virtual void reset() = 0; + // must call parent save_register ! + virtual void save_register() { }; - ATTR_HOT netlist_matrix_solver_t *solver() { return m_solver; } - - ATTR_COLD bool already_processed(list_t *groups, int cur_group); - ATTR_COLD void process_net(list_t *groups, int &cur_group); - -protected: - - virtual void save_register(); - virtual void reset(); - - -private: - -public: - nl_double m_DD_n_m_1; - nl_double m_h_n_m_1; - - //FIXME: needed by current solver code - netlist_matrix_solver_t *m_solver; -}; - -// ----------------------------------------------------------------------------- -// net_output_t -// ----------------------------------------------------------------------------- - -class netlist_logic_output_t : public netlist_logic_t -{ - NETLIST_PREVENT_COPYING(netlist_logic_output_t) -public: - - ATTR_COLD netlist_logic_output_t(); - - ATTR_COLD void init_object(netlist_core_device_t &dev, const pstring &aname); - virtual void reset() - { - set_state(STATE_OUT); - } - - ATTR_COLD void initial(const netlist_sig_t val); - - ATTR_HOT void set_Q(const netlist_sig_t newQ, const netlist_time &delay) - { - net().as_logic().set_Q(newQ, delay); - } - -private: - netlist_logic_net_t m_my_net; -}; - -class netlist_analog_output_t : public netlist_analog_t -{ - NETLIST_PREVENT_COPYING(netlist_analog_output_t) -public: - - ATTR_COLD netlist_analog_output_t(); - - ATTR_COLD void init_object(netlist_core_device_t &dev, const pstring &aname); - virtual void reset() - { - set_state(STATE_OUT); - } - - ATTR_COLD void initial(const nl_double val); - - ATTR_HOT void set_Q(const nl_double newQ); - - netlist_analog_net_t *m_proxied_net; // only for proxy nets in analog input logic - -private: - netlist_analog_net_t m_my_net; -}; - -// ----------------------------------------------------------------------------- -// net_param_t -// ----------------------------------------------------------------------------- - -class netlist_param_t : public netlist_owned_object_t -{ - NETLIST_PREVENT_COPYING(netlist_param_t) -public: - - enum param_type_t { - MODEL, - STRING, - DOUBLE, - INTEGER, - LOGIC + private: + pstring m_name; + const type_t m_objtype; + const family_t m_family; + netlist_base_t * m_netlist; }; - ATTR_COLD netlist_param_t(const param_type_t atype); - - ATTR_HOT param_type_t param_type() const { return m_param_type; } - -protected: - - virtual void reset() { } - -private: - const param_type_t m_param_type; -}; - -class netlist_param_double_t : public netlist_param_t -{ - NETLIST_PREVENT_COPYING(netlist_param_double_t) -public: - ATTR_COLD netlist_param_double_t(); - - ATTR_HOT void setTo(const nl_double param); - ATTR_COLD void initial(const nl_double val) { m_param = val; } - ATTR_HOT nl_double Value() const { return m_param; } - -protected: - virtual void save_register() + // ----------------------------------------------------------------------------- + // netlist_owned_object_t + // ----------------------------------------------------------------------------- + + class netlist_owned_object_t : public netlist_object_t { - save(NLNAME(m_param)); - netlist_param_t::save_register(); - } + NETLIST_PREVENT_COPYING(netlist_owned_object_t) + public: + ATTR_COLD netlist_owned_object_t(const type_t atype, const family_t afamily); -private: - nl_double m_param; -}; + ATTR_COLD void init_object(netlist_core_device_t &dev, const pstring &aname); -class netlist_param_int_t : public netlist_param_t -{ - NETLIST_PREVENT_COPYING(netlist_param_int_t) -public: - ATTR_COLD netlist_param_int_t(); + ATTR_HOT netlist_core_device_t &netdev() const { return *m_netdev; } + private: + netlist_core_device_t * m_netdev; + }; - ATTR_HOT void setTo(const int param); - ATTR_COLD void initial(const int val) { m_param = val; } + // ----------------------------------------------------------------------------- + // netlist_core_terminal_t + // ----------------------------------------------------------------------------- - ATTR_HOT int Value() const { return m_param; } - -protected: - virtual void save_register() + class netlist_core_terminal_t : public netlist_owned_object_t, public plinkedlist_element_t { - save(NLNAME(m_param)); - netlist_param_t::save_register(); - } + NETLIST_PREVENT_COPYING(netlist_core_terminal_t) + public: -private: - int m_param; -}; + typedef plist_t list_t; -class netlist_param_logic_t : public netlist_param_int_t -{ - NETLIST_PREVENT_COPYING(netlist_param_logic_t) -public: - ATTR_COLD netlist_param_logic_t(); -}; + /* needed here ... */ -class netlist_param_str_t : public netlist_param_t -{ - NETLIST_PREVENT_COPYING(netlist_param_str_t) -public: - ATTR_COLD netlist_param_str_t(); + enum state_e { + STATE_INP_PASSIVE = 0, + STATE_INP_ACTIVE = 1, + STATE_INP_HL = 2, + STATE_INP_LH = 4, + STATE_OUT = 128, + STATE_NONEX = 256 + }; - ATTR_HOT void setTo(const pstring ¶m); - ATTR_COLD void initial(const pstring &val) { m_param = val; } - ATTR_HOT const pstring &Value() const { return m_param; } + ATTR_COLD netlist_core_terminal_t(const type_t atype, const family_t afamily); -private: - pstring m_param; -}; + //ATTR_COLD void init_object(netlist_core_device_t &dev, const pstring &aname); -class netlist_param_model_t : public netlist_param_t -{ - NETLIST_PREVENT_COPYING(netlist_param_model_t) -public: - ATTR_COLD netlist_param_model_t(); + ATTR_COLD void set_net(netlist_net_t &anet); + ATTR_COLD void clear_net() { m_net = NULL; } + ATTR_HOT bool has_net() const { return (m_net != NULL); } - ATTR_COLD void initial(const pstring &val) { m_param = val; } + ATTR_HOT const netlist_net_t & net() const { return *m_net;} + ATTR_HOT netlist_net_t & net() { return *m_net;} - ATTR_HOT const pstring &Value() const { return m_param; } - - /* these should be cached! */ - ATTR_COLD nl_double model_value(const pstring &entity, const nl_double defval = 0.0) const; - ATTR_COLD const pstring model_type() const; - -private: - pstring m_param; -}; - -// ----------------------------------------------------------------------------- -// net_device_t -// ----------------------------------------------------------------------------- - -class netlist_core_device_t : public netlist_object_t, public netlist_logic_family_t -{ - NETLIST_PREVENT_COPYING(netlist_core_device_t) -public: - - typedef plist_t list_t; - - ATTR_COLD netlist_core_device_t(const family_t afamily); - - virtual ~netlist_core_device_t(); - - virtual void init(netlist_base_t &anetlist, const pstring &name); - ATTR_HOT virtual void update_param() {} - - ATTR_HOT void update_dev() - { - begin_timing(stat_total_time); - inc_stat(stat_update_count); - -#if (NL_PMF_TYPE == NL_PMF_TYPE_GNUC_PMF) - (this->*m_static_update)(); -#elif ((NL_PMF_TYPE == NL_PMF_TYPE_GNUC_PMF_CONV) || (NL_PMF_TYPE == NL_PMF_TYPE_INTERNAL)) - m_static_update(this); -#else - update(); -#endif - end_timing(stat_total_time); - } - ATTR_COLD void start_dev(); - ATTR_COLD void stop_dev(); - - ATTR_HOT netlist_sig_t INPLOGIC_PASSIVE(netlist_logic_input_t &inp); - - ATTR_HOT netlist_sig_t INPLOGIC(const netlist_logic_input_t &inp) const - { - //printf("%s %d\n", inp.name().cstr(), inp.state()); - nl_assert(inp.state() != netlist_logic_t::STATE_INP_PASSIVE); - return inp.Q(); - } - - ATTR_HOT void OUTLOGIC(netlist_logic_output_t &out, const netlist_sig_t val, const netlist_time &delay) - { - out.set_Q(val, delay); - } - - ATTR_HOT nl_double INPANALOG(const netlist_analog_input_t &inp) const { return inp.Q_Analog(); } - - ATTR_HOT nl_double TERMANALOG(const netlist_terminal_t &term) const { return term.net().as_analog().Q_Analog(); } - - ATTR_HOT void OUTANALOG(netlist_analog_output_t &out, const nl_double val) - { - out.set_Q(val); - } - - ATTR_HOT virtual void inc_active() { } - - ATTR_HOT virtual void dec_active() { } - - ATTR_HOT virtual void step_time(ATTR_UNUSED const nl_double st) { } - ATTR_HOT virtual void update_terminals() { } - -#if (NL_KEEP_STATISTICS) - /* stats */ - osd_ticks_t stat_total_time; - INT32 stat_update_count; - INT32 stat_call_count; -#endif - -protected: - - ATTR_HOT virtual void update() { } - virtual void start() { } - virtual void stop() { } \ - virtual const netlist_logic_family_desc_t *default_logic_family() - { - return &netlist_family_TTL; - } - -private: - - #if (NL_PMF_TYPE == NL_PMF_TYPE_GNUC_PMF) - typedef void (netlist_core_device_t::*net_update_delegate)(); - #elif ((NL_PMF_TYPE == NL_PMF_TYPE_GNUC_PMF_CONV) || (NL_PMF_TYPE == NL_PMF_TYPE_INTERNAL)) - typedef MEMBER_ABI void (*net_update_delegate)(netlist_core_device_t *); - #endif - -#if (NL_PMF_TYPE > NL_PMF_TYPE_VIRTUAL) - net_update_delegate m_static_update; -#endif -}; - - -class netlist_device_t : public netlist_core_device_t -{ - NETLIST_PREVENT_COPYING(netlist_device_t) -public: - - ATTR_COLD netlist_device_t(); - ATTR_COLD netlist_device_t(const family_t afamily); - - virtual ~netlist_device_t(); - - virtual void init(netlist_base_t &anetlist, const pstring &name); - - ATTR_COLD netlist_setup_t &setup(); - - ATTR_COLD void register_sub(const pstring &name, netlist_device_t &dev); - ATTR_COLD void register_subalias(const pstring &name, netlist_core_terminal_t &term); - ATTR_COLD void register_terminal(const pstring &name, netlist_terminal_t &port); - ATTR_COLD void register_output(const pstring &name, netlist_analog_output_t &out); - ATTR_COLD void register_output(const pstring &name, netlist_logic_output_t &out); - ATTR_COLD void register_input(const pstring &name, netlist_analog_input_t &in); - ATTR_COLD void register_input(const pstring &name, netlist_logic_input_t &in); - - ATTR_COLD void connect(netlist_core_terminal_t &t1, netlist_core_terminal_t &t2); - - plist_t m_terminals; - -protected: - - ATTR_HOT virtual void update() { } - ATTR_HOT virtual void start() { } - ATTR_HOT virtual void update_terminals() { } - - template - ATTR_COLD void register_param(const pstring &sname, C ¶m, const T initialVal); - -private: -}; - - -// ----------------------------------------------------------------------------- -// netlist_queue_t -// ----------------------------------------------------------------------------- - -class netlist_queue_t : public netlist_timed_queue, - public netlist_object_t, - public pstate_callback_t -{ -public: - netlist_queue_t(netlist_base_t &nl); - -protected: - - void reset() {} - - void register_state(pstate_manager_t &manager, const pstring &module); - void on_pre_save(); - void on_post_load(); - -private: - int m_qsize; - parray_t m_times; - parray_t m_names; -}; - -// ----------------------------------------------------------------------------- -// netlist_base_t -// ----------------------------------------------------------------------------- - - -class netlist_base_t : public netlist_object_t, public pstate_manager_t -{ - NETLIST_PREVENT_COPYING(netlist_base_t) -public: - - netlist_base_t(); - virtual ~netlist_base_t(); - - ATTR_COLD void start(); - ATTR_COLD void stop(); - - ATTR_HOT const netlist_queue_t &queue() const { return m_queue; } - ATTR_HOT netlist_queue_t &queue() { return m_queue; } - ATTR_HOT const netlist_time &time() const { return m_time; } - ATTR_HOT NETLIB_NAME(solver) *solver() const { return m_solver; } - ATTR_HOT NETLIB_NAME(gnd) *gnd() const { return m_gnd; } - ATTR_HOT nl_double gmin() const; - - ATTR_HOT void push_to_queue(netlist_net_t &out, const netlist_time &attime); - ATTR_HOT void remove_from_queue(netlist_net_t &out); - - ATTR_HOT void process_queue(const netlist_time &delta); - ATTR_HOT void abort_current_queue_slice() { m_stop = netlist_time::zero; } - - ATTR_HOT const bool &use_deactivate() const { return m_use_deactivate; } - - ATTR_COLD void rebuild_lists(); /* must be called after post_load ! */ - - ATTR_COLD void set_setup(netlist_setup_t *asetup) { m_setup = asetup; } - ATTR_COLD netlist_setup_t &setup() { return *m_setup; } - - ATTR_COLD netlist_net_t *find_net(const pstring &name); - - ATTR_COLD void error(const char *format, ...) const ATTR_PRINTF(2,3); - ATTR_COLD void warning(const char *format, ...) const ATTR_PRINTF(2,3); - ATTR_COLD void log(const char *format, ...) const ATTR_PRINTF(2,3); - - template - plist_t<_C *> get_device_list() - { - plist_t<_C *> tmp; - for (std::size_t i = 0; i < m_devices.size(); i++) + ATTR_HOT bool is_state(const state_e astate) const { return (m_state == astate); } + ATTR_HOT state_e state() const { return m_state; } + ATTR_HOT void set_state(const state_e astate) { - _C *dev = dynamic_cast<_C *>(m_devices[i]); - if (dev != NULL) - tmp.add(dev); + nl_assert(astate != STATE_NONEX); + m_state = astate; } - return tmp; - } - template - _C *get_first_device() - { - for (std::size_t i = 0; i < m_devices.size(); i++) + + ATTR_HOT /* inline */ void update_dev(const UINT32 mask); + + protected: + virtual void save_register() { - _C *dev = dynamic_cast<_C *>(m_devices[i]); - if (dev != NULL) - return dev; + save(NLNAME(m_state)); + netlist_owned_object_t::save_register(); } - return NULL; - } - template - _C *get_single_device(const char *classname) + private: + netlist_net_t * m_net; + state_e m_state; + }; + + class netlist_terminal_t : public netlist_core_terminal_t { - _C *ret = NULL; - for (std::size_t i = 0; i < m_devices.size(); i++) + NETLIST_PREVENT_COPYING(netlist_terminal_t) + public: + + typedef plist_t list_t; + + ATTR_COLD netlist_terminal_t(); + + nl_double *m_Idr1; // drive current + nl_double *m_go1; // conductance for Voltage from other term + nl_double *m_gt1; // conductance for total conductance + + ATTR_HOT void set(const nl_double G) { - _C *dev = dynamic_cast<_C *>(m_devices[i]); - if (dev != NULL) + set_ptr(m_Idr1, 0); + set_ptr(m_go1, G); + set_ptr(m_gt1, G); + } + + ATTR_HOT void set(const nl_double GO, const nl_double GT) + { + set_ptr(m_Idr1, 0); + set_ptr(m_go1, GO); + set_ptr(m_gt1, GT); + } + + ATTR_HOT void set(const nl_double GO, const nl_double GT, const nl_double I) + { + set_ptr(m_Idr1, I); + set_ptr(m_go1, GO); + set_ptr(m_gt1, GT); + } + + ATTR_HOT void schedule_solve(); + ATTR_HOT void schedule_after(const netlist_time &after); + + netlist_terminal_t *m_otherterm; + + protected: + virtual void save_register(); + + virtual void reset(); + private: + ATTR_HOT void set_ptr(nl_double *ptr, const nl_double val) + { + if (ptr != NULL && *ptr != val) { - if (ret != NULL) - this->error("more than one %s device found", classname); - else - ret = dev; + *ptr = val; } } - return ret; - } - - pnamedlist_t m_devices; - netlist_net_t::list_t m_nets; -#if (NL_KEEP_STATISTICS) - pnamedlist_t m_started_devices; -#endif - -protected: - - enum loglevel_e - { - NL_ERROR, - NL_WARNING, - NL_LOG }; - // any derived netlist must override this ... - virtual void verror(const loglevel_e level, - const char *format, va_list ap) const = 0; - /* from netlist_object */ - virtual void reset(); - virtual void save_register(); + // ----------------------------------------------------------------------------- + // netlist_input_t + // ----------------------------------------------------------------------------- -#if (NL_KEEP_STATISTICS) - // performance - int m_perf_out_processed; - int m_perf_inp_processed; - int m_perf_inp_active; -#endif - -private: - netlist_time m_stop; // target time for current queue processing - - netlist_time m_time; - bool m_use_deactivate; - netlist_queue_t m_queue; + class netlist_logic_t : public netlist_core_terminal_t, public netlist_logic_family_t + { + public: - NETLIB_NAME(mainclock) * m_mainclock; - NETLIB_NAME(solver) * m_solver; - NETLIB_NAME(gnd) * m_gnd; + ATTR_COLD netlist_logic_t(const type_t atype) + : netlist_core_terminal_t(atype, LOGIC), netlist_logic_family_t(), + m_proxy(NULL) + { + } + + ATTR_COLD bool has_proxy() const { return (m_proxy != NULL); } + ATTR_COLD devices::nld_base_proxy *get_proxy() const { return m_proxy; } + ATTR_COLD void set_proxy(devices::nld_base_proxy *proxy) { m_proxy = proxy; } + + protected: + + private: + devices::nld_base_proxy *m_proxy; + }; + + class netlist_analog_t : public netlist_core_terminal_t + { + public: - NETLIB_NAME(netlistparams) *m_params; - netlist_setup_t *m_setup; -}; + ATTR_COLD netlist_analog_t(const type_t atype) + : netlist_core_terminal_t(atype, ANALOG) + { + } -// ----------------------------------------------------------------------------- -// inline implementations -// ----------------------------------------------------------------------------- + protected: -PSTATE_INTERFACE(netlist_object_t, m_netlist, name()) + private: + }; -ATTR_HOT inline void netlist_param_str_t::setTo(const pstring ¶m) -{ - m_param = param; - netdev().update_param(); -} + // ----------------------------------------------------------------------------- + // netlist_logic_input_t + // ----------------------------------------------------------------------------- -ATTR_HOT inline void netlist_param_int_t::setTo(const int param) -{ - if (m_param != param) + class netlist_logic_input_t : public netlist_logic_t + { + public: + ATTR_COLD netlist_logic_input_t() + : netlist_logic_t(INPUT) + { + set_state(STATE_INP_ACTIVE); + } + + ATTR_HOT netlist_sig_t Q() const; + ATTR_HOT netlist_sig_t last_Q() const; + + ATTR_HOT void inactivate(); + ATTR_HOT void activate(); + ATTR_HOT void activate_hl(); + ATTR_HOT void activate_lh(); + + protected: + virtual void reset() + { + //netlist_core_terminal_t::reset(); + set_state(STATE_INP_ACTIVE); + } + + }; + + // ----------------------------------------------------------------------------- + // netlist_analog_input_t + // ----------------------------------------------------------------------------- + + class netlist_analog_input_t : public netlist_analog_t + { + public: + ATTR_COLD netlist_analog_input_t() + : netlist_analog_t(INPUT) + { + set_state(STATE_INP_ACTIVE); + } + + ATTR_HOT nl_double Q_Analog() const; + + protected: + virtual void reset() + { + //netlist_core_terminal_t::reset(); + set_state(STATE_INP_ACTIVE); + } + }; + + // ----------------------------------------------------------------------------- + // net_net_t + // ----------------------------------------------------------------------------- + + class netlist_net_t : public netlist_object_t + { + NETLIST_PREVENT_COPYING(netlist_net_t) + public: + + typedef plist_t list_t; + + ATTR_COLD netlist_net_t(const family_t afamily); + virtual ~netlist_net_t(); + + ATTR_COLD void init_object(netlist_base_t &nl, const pstring &aname); + + ATTR_COLD void register_con(netlist_core_terminal_t &terminal); + ATTR_COLD void merge_net(netlist_net_t *othernet); + ATTR_COLD void register_railterminal(netlist_core_terminal_t &mr); + + ATTR_HOT netlist_logic_net_t & as_logic(); + ATTR_HOT const netlist_logic_net_t & as_logic() const; + + ATTR_HOT netlist_analog_net_t & as_analog(); + ATTR_HOT const netlist_analog_net_t & as_analog() const; + + ATTR_HOT void update_devs(); + + ATTR_HOT const netlist_time &time() const { return m_time; } + ATTR_HOT void set_time(const netlist_time &ntime) { m_time = ntime; } + + ATTR_HOT bool isRailNet() const { return !(m_railterminal == NULL); } + ATTR_HOT netlist_core_terminal_t & railterminal() const { return *m_railterminal; } + + ATTR_HOT void push_to_queue(const netlist_time &delay); + ATTR_HOT void reschedule_in_queue(const netlist_time &delay); + ATTR_HOT bool is_queued() const { return m_in_queue == 1; } + + ATTR_HOT int num_cons() const { return m_core_terms.size(); } + + ATTR_HOT void inc_active(netlist_core_terminal_t &term); + ATTR_HOT void dec_active(netlist_core_terminal_t &term); + + ATTR_COLD void rebuild_list(); /* rebuild m_list after a load */ + + ATTR_COLD void move_connections(netlist_net_t *new_net); + + plist_t m_core_terms; // save post-start m_list ... + + ATTR_HOT void set_Q_time(const netlist_sig_t &newQ, const netlist_time &at) + { + if (newQ != m_new_Q) + { + m_in_queue = 0; + m_time = at; + } + m_cur_Q = m_new_Q = newQ; + } + + protected: //FIXME: needed by current solver code + + virtual void save_register(); + virtual void reset(); + + netlist_sig_t m_new_Q; + netlist_sig_t m_cur_Q; + + private: + + netlist_core_terminal_t * m_railterminal; + plinkedlist_t m_list_active; + + netlist_time m_time; + INT32 m_active; + UINT8 m_in_queue; /* 0: not in queue, 1: in queue, 2: last was taken */ + + public: + // We have to have those on one object. Dividing those does lead + // to a significant performance hit + // FIXME: Have to fix the public at some time + nl_double m_cur_Analog; + + }; + + class netlist_logic_net_t : public netlist_net_t + { + NETLIST_PREVENT_COPYING(netlist_logic_net_t) + public: + + typedef plist_t list_t; + + ATTR_COLD netlist_logic_net_t(); + virtual ~netlist_logic_net_t() { }; + + ATTR_HOT netlist_sig_t Q() const + { + return m_cur_Q; + } + + ATTR_HOT netlist_sig_t new_Q() const + { + return m_new_Q; + } + + ATTR_HOT void set_Q(const netlist_sig_t &newQ, const netlist_time &delay) + { + if (newQ != m_new_Q) + { + m_new_Q = newQ; + push_to_queue(delay); + } + } + + ATTR_HOT void toggle_new_Q() + { + m_new_Q ^= 1; + } + + ATTR_COLD void initial(const netlist_sig_t val) + { + m_cur_Q = val; + m_new_Q = val; + } + + /* internal state support + * FIXME: get rid of this and implement export/import in MAME + */ + ATTR_COLD netlist_sig_t &Q_state_ptr() + { + return m_cur_Q; + } + + protected: //FIXME: needed by current solver code + + virtual void save_register(); + virtual void reset(); + + + private: + + public: + + }; + + class netlist_analog_net_t : public netlist_net_t + { + NETLIST_PREVENT_COPYING(netlist_analog_net_t) + public: + + typedef plist_t list_t; + + ATTR_COLD netlist_analog_net_t(); + virtual ~netlist_analog_net_t() { }; + + ATTR_HOT nl_double Q_Analog() const + { + return m_cur_Analog; + } + + ATTR_COLD nl_double &Q_Analog_state_ptr() + { + return m_cur_Analog; + } + + ATTR_HOT devices::netlist_matrix_solver_t *solver() { return m_solver; } + + ATTR_COLD bool already_processed(list_t *groups, int cur_group); + ATTR_COLD void process_net(list_t *groups, int &cur_group); + + protected: + + virtual void save_register(); + virtual void reset(); + + + private: + + public: + nl_double m_DD_n_m_1; + nl_double m_h_n_m_1; + + //FIXME: needed by current solver code + devices::netlist_matrix_solver_t *m_solver; + }; + + // ----------------------------------------------------------------------------- + // net_output_t + // ----------------------------------------------------------------------------- + + class netlist_logic_output_t : public netlist_logic_t + { + NETLIST_PREVENT_COPYING(netlist_logic_output_t) + public: + + ATTR_COLD netlist_logic_output_t(); + + ATTR_COLD void init_object(netlist_core_device_t &dev, const pstring &aname); + virtual void reset() + { + set_state(STATE_OUT); + } + + ATTR_COLD void initial(const netlist_sig_t val); + + ATTR_HOT void set_Q(const netlist_sig_t newQ, const netlist_time &delay) + { + net().as_logic().set_Q(newQ, delay); + } + + private: + netlist_logic_net_t m_my_net; + }; + + class netlist_analog_output_t : public netlist_analog_t + { + NETLIST_PREVENT_COPYING(netlist_analog_output_t) + public: + + ATTR_COLD netlist_analog_output_t(); + + ATTR_COLD void init_object(netlist_core_device_t &dev, const pstring &aname); + virtual void reset() + { + set_state(STATE_OUT); + } + + ATTR_COLD void initial(const nl_double val); + + ATTR_HOT void set_Q(const nl_double newQ); + + netlist_analog_net_t *m_proxied_net; // only for proxy nets in analog input logic + + private: + netlist_analog_net_t m_my_net; + }; + + // ----------------------------------------------------------------------------- + // net_param_t + // ----------------------------------------------------------------------------- + + class netlist_param_t : public netlist_owned_object_t + { + NETLIST_PREVENT_COPYING(netlist_param_t) + public: + + enum param_type_t { + MODEL, + STRING, + DOUBLE, + INTEGER, + LOGIC + }; + + ATTR_COLD netlist_param_t(const param_type_t atype); + + ATTR_HOT param_type_t param_type() const { return m_param_type; } + + protected: + + virtual void reset() { } + + private: + const param_type_t m_param_type; + }; + + class netlist_param_double_t : public netlist_param_t + { + NETLIST_PREVENT_COPYING(netlist_param_double_t) + public: + ATTR_COLD netlist_param_double_t(); + + ATTR_HOT void setTo(const nl_double param); + ATTR_COLD void initial(const nl_double val) { m_param = val; } + ATTR_HOT nl_double Value() const { return m_param; } + + protected: + virtual void save_register() + { + save(NLNAME(m_param)); + netlist_param_t::save_register(); + } + + private: + nl_double m_param; + }; + + class netlist_param_int_t : public netlist_param_t + { + NETLIST_PREVENT_COPYING(netlist_param_int_t) + public: + ATTR_COLD netlist_param_int_t(); + + ATTR_HOT void setTo(const int param); + ATTR_COLD void initial(const int val) { m_param = val; } + + ATTR_HOT int Value() const { return m_param; } + + protected: + virtual void save_register() + { + save(NLNAME(m_param)); + netlist_param_t::save_register(); + } + + private: + int m_param; + }; + + class netlist_param_logic_t : public netlist_param_int_t + { + NETLIST_PREVENT_COPYING(netlist_param_logic_t) + public: + ATTR_COLD netlist_param_logic_t(); + }; + + class netlist_param_str_t : public netlist_param_t + { + NETLIST_PREVENT_COPYING(netlist_param_str_t) + public: + ATTR_COLD netlist_param_str_t(); + + ATTR_HOT void setTo(const pstring ¶m); + ATTR_COLD void initial(const pstring &val) { m_param = val; } + + ATTR_HOT const pstring &Value() const { return m_param; } + + private: + pstring m_param; + }; + + class netlist_param_model_t : public netlist_param_t + { + NETLIST_PREVENT_COPYING(netlist_param_model_t) + public: + ATTR_COLD netlist_param_model_t(); + + ATTR_COLD void initial(const pstring &val) { m_param = val; } + + ATTR_HOT const pstring &Value() const { return m_param; } + + /* these should be cached! */ + ATTR_COLD nl_double model_value(const pstring &entity, const nl_double defval = 0.0) const; + ATTR_COLD const pstring model_type() const; + + private: + pstring m_param; + }; + + // ----------------------------------------------------------------------------- + // net_device_t + // ----------------------------------------------------------------------------- + + class netlist_core_device_t : public netlist_object_t, public netlist_logic_family_t + { + NETLIST_PREVENT_COPYING(netlist_core_device_t) + public: + + typedef plist_t list_t; + + ATTR_COLD netlist_core_device_t(const family_t afamily); + + virtual ~netlist_core_device_t(); + + virtual void init(netlist_base_t &anetlist, const pstring &name); + ATTR_HOT virtual void update_param() {} + + ATTR_HOT void update_dev() + { + begin_timing(stat_total_time); + inc_stat(stat_update_count); + + #if (NL_PMF_TYPE == NL_PMF_TYPE_GNUC_PMF) + (this->*m_static_update)(); + #elif ((NL_PMF_TYPE == NL_PMF_TYPE_GNUC_PMF_CONV) || (NL_PMF_TYPE == NL_PMF_TYPE_INTERNAL)) + m_static_update(this); + #else + update(); + #endif + end_timing(stat_total_time); + } + ATTR_COLD void start_dev(); + ATTR_COLD void stop_dev(); + + ATTR_HOT netlist_sig_t INPLOGIC_PASSIVE(netlist_logic_input_t &inp); + + ATTR_HOT netlist_sig_t INPLOGIC(const netlist_logic_input_t &inp) const + { + //printf("%s %d\n", inp.name().cstr(), inp.state()); + nl_assert(inp.state() != netlist_logic_t::STATE_INP_PASSIVE); + return inp.Q(); + } + + ATTR_HOT void OUTLOGIC(netlist_logic_output_t &out, const netlist_sig_t val, const netlist_time &delay) + { + out.set_Q(val, delay); + } + + ATTR_HOT nl_double INPANALOG(const netlist_analog_input_t &inp) const { return inp.Q_Analog(); } + + ATTR_HOT nl_double TERMANALOG(const netlist_terminal_t &term) const { return term.net().as_analog().Q_Analog(); } + + ATTR_HOT void OUTANALOG(netlist_analog_output_t &out, const nl_double val) + { + out.set_Q(val); + } + + ATTR_HOT virtual void inc_active() { } + + ATTR_HOT virtual void dec_active() { } + + ATTR_HOT virtual void step_time(ATTR_UNUSED const nl_double st) { } + ATTR_HOT virtual void update_terminals() { } + + #if (NL_KEEP_STATISTICS) + /* stats */ + osd_ticks_t stat_total_time; + INT32 stat_update_count; + INT32 stat_call_count; + #endif + + protected: + + ATTR_HOT virtual void update() { } + virtual void start() { } + virtual void stop() { } \ + virtual const netlist_logic_family_desc_t *default_logic_family() + { + return &netlist_family_TTL; + } + + private: + + #if (NL_PMF_TYPE == NL_PMF_TYPE_GNUC_PMF) + typedef void (netlist_core_device_t::*net_update_delegate)(); + #elif ((NL_PMF_TYPE == NL_PMF_TYPE_GNUC_PMF_CONV) || (NL_PMF_TYPE == NL_PMF_TYPE_INTERNAL)) + typedef MEMBER_ABI void (*net_update_delegate)(netlist_core_device_t *); + #endif + + #if (NL_PMF_TYPE > NL_PMF_TYPE_VIRTUAL) + net_update_delegate m_static_update; + #endif + }; + + + class netlist_device_t : public netlist_core_device_t + { + NETLIST_PREVENT_COPYING(netlist_device_t) + public: + + ATTR_COLD netlist_device_t(); + ATTR_COLD netlist_device_t(const family_t afamily); + + virtual ~netlist_device_t(); + + virtual void init(netlist_base_t &anetlist, const pstring &name); + + ATTR_COLD netlist_setup_t &setup(); + + ATTR_COLD void register_sub(const pstring &name, netlist_device_t &dev); + ATTR_COLD void register_subalias(const pstring &name, netlist_core_terminal_t &term); + ATTR_COLD void register_terminal(const pstring &name, netlist_terminal_t &port); + ATTR_COLD void register_output(const pstring &name, netlist_analog_output_t &out); + ATTR_COLD void register_output(const pstring &name, netlist_logic_output_t &out); + ATTR_COLD void register_input(const pstring &name, netlist_analog_input_t &in); + ATTR_COLD void register_input(const pstring &name, netlist_logic_input_t &in); + + ATTR_COLD void connect(netlist_core_terminal_t &t1, netlist_core_terminal_t &t2); + + plist_t m_terminals; + + protected: + + ATTR_HOT virtual void update() { } + ATTR_HOT virtual void start() { } + ATTR_HOT virtual void update_terminals() { } + + template + ATTR_COLD void register_param(const pstring &sname, C ¶m, const T initialVal); + + private: + }; + + + // ----------------------------------------------------------------------------- + // netlist_queue_t + // ----------------------------------------------------------------------------- + + class netlist_queue_t : public netlist_timed_queue, + public netlist_object_t, + public pstate_callback_t + { + public: + netlist_queue_t(netlist_base_t &nl); + + protected: + + void reset() {} + + void register_state(pstate_manager_t &manager, const pstring &module); + void on_pre_save(); + void on_post_load(); + + private: + int m_qsize; + parray_t m_times; + parray_t m_names; + }; + + // ----------------------------------------------------------------------------- + // netlist_base_t + // ----------------------------------------------------------------------------- + + + class netlist_base_t : public netlist_object_t, public pstate_manager_t + { + NETLIST_PREVENT_COPYING(netlist_base_t) + public: + + netlist_base_t(); + virtual ~netlist_base_t(); + + ATTR_COLD void start(); + ATTR_COLD void stop(); + + ATTR_HOT const netlist_queue_t &queue() const { return m_queue; } + ATTR_HOT netlist_queue_t &queue() { return m_queue; } + ATTR_HOT const netlist_time &time() const { return m_time; } + ATTR_HOT devices::NETLIB_NAME(solver) *solver() const { return m_solver; } + ATTR_HOT devices::NETLIB_NAME(gnd) *gnd() const { return m_gnd; } + ATTR_HOT nl_double gmin() const; + + ATTR_HOT void push_to_queue(netlist_net_t &out, const netlist_time &attime); + ATTR_HOT void remove_from_queue(netlist_net_t &out); + + ATTR_HOT void process_queue(const netlist_time &delta); + ATTR_HOT void abort_current_queue_slice() { m_stop = netlist_time::zero; } + + ATTR_HOT const bool &use_deactivate() const { return m_use_deactivate; } + + ATTR_COLD void rebuild_lists(); /* must be called after post_load ! */ + + ATTR_COLD void set_setup(netlist_setup_t *asetup) { m_setup = asetup; } + ATTR_COLD netlist_setup_t &setup() { return *m_setup; } + + ATTR_COLD netlist_net_t *find_net(const pstring &name); + + ATTR_COLD void error(const char *format, ...) const ATTR_PRINTF(2,3); + ATTR_COLD void warning(const char *format, ...) const ATTR_PRINTF(2,3); + ATTR_COLD void log(const char *format, ...) const ATTR_PRINTF(2,3); + + template + plist_t<_C *> get_device_list() + { + plist_t<_C *> tmp; + for (std::size_t i = 0; i < m_devices.size(); i++) + { + _C *dev = dynamic_cast<_C *>(m_devices[i]); + if (dev != NULL) + tmp.add(dev); + } + return tmp; + } + + template + _C *get_first_device() + { + for (std::size_t i = 0; i < m_devices.size(); i++) + { + _C *dev = dynamic_cast<_C *>(m_devices[i]); + if (dev != NULL) + return dev; + } + return NULL; + } + + template + _C *get_single_device(const char *classname) + { + _C *ret = NULL; + for (std::size_t i = 0; i < m_devices.size(); i++) + { + _C *dev = dynamic_cast<_C *>(m_devices[i]); + if (dev != NULL) + { + if (ret != NULL) + this->error("more than one %s device found", classname); + else + ret = dev; + } + } + return ret; + } + + pnamedlist_t m_devices; + netlist_net_t::list_t m_nets; + #if (NL_KEEP_STATISTICS) + pnamedlist_t m_started_devices; + #endif + + protected: + + enum loglevel_e + { + NL_ERROR, + NL_WARNING, + NL_LOG + }; + + // any derived netlist must override this ... + virtual void verror(const loglevel_e level, + const char *format, va_list ap) const = 0; + + /* from netlist_object */ + virtual void reset(); + virtual void save_register(); + + #if (NL_KEEP_STATISTICS) + // performance + int m_perf_out_processed; + int m_perf_inp_processed; + int m_perf_inp_active; + #endif + + private: + netlist_time m_stop; // target time for current queue processing + + netlist_time m_time; + bool m_use_deactivate; + netlist_queue_t m_queue; + + + devices::NETLIB_NAME(mainclock) * m_mainclock; + devices::NETLIB_NAME(solver) * m_solver; + devices::NETLIB_NAME(gnd) * m_gnd; + + + devices::NETLIB_NAME(netlistparams) *m_params; + netlist_setup_t *m_setup; + }; + + // ----------------------------------------------------------------------------- + // inline implementations + // ----------------------------------------------------------------------------- + + PSTATE_INTERFACE(netlist_object_t, m_netlist, name()) + + ATTR_HOT inline void netlist_param_str_t::setTo(const pstring ¶m) { m_param = param; netdev().update_param(); } -} -ATTR_HOT inline void netlist_param_double_t::setTo(const nl_double param) -{ - if (m_param != param) + ATTR_HOT inline void netlist_param_int_t::setTo(const int param) { - m_param = param; - netdev().update_param(); + if (m_param != param) + { + m_param = param; + netdev().update_param(); + } } -} -ATTR_HOT inline netlist_logic_net_t & netlist_net_t::as_logic() -{ - nl_assert(family() == LOGIC); - return static_cast(*this); -} - -ATTR_HOT inline const netlist_logic_net_t & netlist_net_t::as_logic() const -{ - nl_assert(family() == LOGIC); - return static_cast(*this); -} - -ATTR_HOT inline netlist_analog_net_t & netlist_net_t::as_analog() -{ - nl_assert(family() == ANALOG); - return static_cast(*this); -} - -ATTR_HOT inline const netlist_analog_net_t & netlist_net_t::as_analog() const -{ - nl_assert(family() == ANALOG); - return static_cast(*this); -} - - -ATTR_HOT inline void netlist_logic_input_t::inactivate() -{ - if (EXPECTED(!is_state(STATE_INP_PASSIVE))) + ATTR_HOT inline void netlist_param_double_t::setTo(const nl_double param) { - //printf("inactivate %s\n", name().cstr()); - set_state(STATE_INP_PASSIVE); - net().as_logic().dec_active(*this); + if (m_param != param) + { + m_param = param; + netdev().update_param(); + } } -} -ATTR_HOT inline void netlist_logic_input_t::activate() -{ - if (is_state(STATE_INP_PASSIVE)) + ATTR_HOT inline netlist_logic_net_t & netlist_net_t::as_logic() { - net().as_logic().inc_active(*this); - set_state(STATE_INP_ACTIVE); + nl_assert(family() == LOGIC); + return static_cast(*this); } -} -ATTR_HOT inline void netlist_logic_input_t::activate_hl() -{ - if (is_state(STATE_INP_PASSIVE)) + ATTR_HOT inline const netlist_logic_net_t & netlist_net_t::as_logic() const { - net().as_logic().inc_active(*this); - set_state(STATE_INP_HL); + nl_assert(family() == LOGIC); + return static_cast(*this); } -} -ATTR_HOT inline void netlist_logic_input_t::activate_lh() -{ - if (is_state(STATE_INP_PASSIVE)) + ATTR_HOT inline netlist_analog_net_t & netlist_net_t::as_analog() { - net().as_logic().inc_active(*this); - set_state(STATE_INP_LH); + nl_assert(family() == ANALOG); + return static_cast(*this); } -} - -ATTR_HOT inline void netlist_net_t::push_to_queue(const netlist_time &delay) -{ - if (!is_queued() && (num_cons() > 0)) + ATTR_HOT inline const netlist_analog_net_t & netlist_net_t::as_analog() const { + nl_assert(family() == ANALOG); + return static_cast(*this); + } + + + ATTR_HOT inline void netlist_logic_input_t::inactivate() + { + if (EXPECTED(!is_state(STATE_INP_PASSIVE))) + { + //printf("inactivate %s\n", name().cstr()); + set_state(STATE_INP_PASSIVE); + net().as_logic().dec_active(*this); + } + } + + ATTR_HOT inline void netlist_logic_input_t::activate() + { + if (is_state(STATE_INP_PASSIVE)) + { + net().as_logic().inc_active(*this); + set_state(STATE_INP_ACTIVE); + } + } + + ATTR_HOT inline void netlist_logic_input_t::activate_hl() + { + if (is_state(STATE_INP_PASSIVE)) + { + net().as_logic().inc_active(*this); + set_state(STATE_INP_HL); + } + } + + ATTR_HOT inline void netlist_logic_input_t::activate_lh() + { + if (is_state(STATE_INP_PASSIVE)) + { + net().as_logic().inc_active(*this); + set_state(STATE_INP_LH); + } + } + + + ATTR_HOT inline void netlist_net_t::push_to_queue(const netlist_time &delay) + { + if (!is_queued() && (num_cons() > 0)) + { + m_time = netlist().time() + delay; + m_in_queue = (m_active > 0); /* queued ? */ + if (m_in_queue) + { + netlist().push_to_queue(*this, m_time); + } + } + } + + ATTR_HOT inline void netlist_net_t::reschedule_in_queue(const netlist_time &delay) + { + if (is_queued()) + netlist().remove_from_queue(*this); + m_time = netlist().time() + delay; m_in_queue = (m_active > 0); /* queued ? */ - if (m_in_queue) + if (EXPECTED(m_in_queue)) { netlist().push_to_queue(*this, m_time); } } -} -ATTR_HOT inline void netlist_net_t::reschedule_in_queue(const netlist_time &delay) -{ - if (is_queued()) - netlist().remove_from_queue(*this); - m_time = netlist().time() + delay; - m_in_queue = (m_active > 0); /* queued ? */ - if (EXPECTED(m_in_queue)) + ATTR_HOT inline netlist_sig_t netlist_logic_input_t::Q() const { - netlist().push_to_queue(*this, m_time); + return net().as_logic().Q(); } -} - -ATTR_HOT inline netlist_sig_t netlist_logic_input_t::Q() const -{ - return net().as_logic().Q(); -} - -ATTR_HOT inline nl_double netlist_analog_input_t::Q_Analog() const -{ - return net().as_analog().Q_Analog(); -} - -ATTR_HOT inline void netlist_analog_output_t::set_Q(const nl_double newQ) -{ - if (newQ != net().as_analog().m_cur_Analog) + ATTR_HOT inline nl_double netlist_analog_input_t::Q_Analog() const { - net().as_analog().m_cur_Analog = newQ; - net().push_to_queue(NLTIME_FROM_NS(1)); + return net().as_analog().Q_Analog(); } + + ATTR_HOT inline void netlist_analog_output_t::set_Q(const nl_double newQ) + { + if (newQ != net().as_analog().m_cur_Analog) + { + net().as_analog().m_cur_Analog = newQ; + net().push_to_queue(NLTIME_FROM_NS(1)); + } + } + + ATTR_HOT inline void netlist_base_t::push_to_queue(netlist_net_t &out, const netlist_time &attime) + { + m_queue.push(netlist_queue_t::entry_t(attime, &out)); + } + + ATTR_HOT inline void netlist_base_t::remove_from_queue(netlist_net_t &out) + { + m_queue.remove(&out); + } + } -ATTR_HOT inline void netlist_base_t::push_to_queue(netlist_net_t &out, const netlist_time &attime) -{ - m_queue.push(netlist_queue_t::entry_t(attime, &out)); -} +NETLIST_SAVE_TYPE(netlist::netlist_core_terminal_t::state_e, DT_INT); -ATTR_HOT inline void netlist_base_t::remove_from_queue(netlist_net_t &out) -{ - m_queue.remove(&out); -} #endif /* NLBASE_H_ */ diff --git a/src/emu/netlist/nl_dice_compat.h b/src/emu/netlist/nl_dice_compat.h index 5b24868b13a..c96f448af33 100644 --- a/src/emu/netlist/nl_dice_compat.h +++ b/src/emu/netlist/nl_dice_compat.h @@ -41,7 +41,7 @@ sed -e 's/#define \(.*\)"\(.*\)"[ \t]*,[ \t]*\(.*\)/NET_ALIAS(\1,\2.\3)/' src/ma #ifndef NL_CONVERT_CPP #ifdef NETLIST_DEVELOPMENT -#define CHIP(_n, _t) setup.register_dev( palloc(nld_ ## _t ## _dip), _n); +#define CHIP(_n, _t) setup.register_dev( palloc(netlist::devices::nld_ ## _t ## _dip), _n); #else #define CHIP(_n, _t) setup.register_dev(NETLIB_NAME_STR(_t ## _dip), _n); #endif diff --git a/src/emu/netlist/nl_factory.c b/src/emu/netlist/nl_factory.c index 15ccbc62b5e..21ab420c3cf 100644 --- a/src/emu/netlist/nl_factory.c +++ b/src/emu/netlist/nl_factory.c @@ -11,6 +11,9 @@ #include "nl_factory.h" #include "nl_setup.h" +namespace netlist +{ + // ---------------------------------------------------------------------------------------- // net_device_t_base_factory // ---------------------------------------------------------------------------------------- @@ -81,3 +84,5 @@ netlist_base_factory_t * netlist_factory_list_t::factory_by_name(const pstring & setup.netlist().error("Class %s not found!\n", name.cstr()); return NULL; // appease code analysis } + +} diff --git a/src/emu/netlist/nl_factory.h b/src/emu/netlist/nl_factory.h index c0379caced4..dd3b1415f03 100644 --- a/src/emu/netlist/nl_factory.h +++ b/src/emu/netlist/nl_factory.h @@ -14,6 +14,9 @@ #include "plib/plists.h" #include "nl_base.h" +namespace netlist +{ + // ----------------------------------------------------------------------------- // net_dev class factory // ----------------------------------------------------------------------------- @@ -91,5 +94,6 @@ private: }; +} #endif /* NLFACTORY_H_ */ diff --git a/src/emu/netlist/nl_parser.c b/src/emu/netlist/nl_parser.c index bf52363df83..3874daf7c4d 100644 --- a/src/emu/netlist/nl_parser.c +++ b/src/emu/netlist/nl_parser.c @@ -12,6 +12,8 @@ //#undef NL_VERBOSE_OUT //#define NL_VERBOSE_OUT(x) printf x +namespace netlist +{ // ---------------------------------------------------------------------------------------- // A netlist parser // ---------------------------------------------------------------------------------------- @@ -155,7 +157,7 @@ void netlist_parser::net_truthtable_start() pstring def_param = get_string(); require_token(m_tok_param_right); - netlist_base_factory_truthtable_t *ttd = nl_tt_factory_create(ni, no, hs, + netlist::devices::netlist_base_factory_truthtable_t *ttd = netlist::devices::nl_tt_factory_create(ni, no, hs, name, name, "+" + def_param); while (true) @@ -402,3 +404,4 @@ nl_double netlist_parser::eval_param(const token_t tok) return ret * facs[f]; #endif } +} diff --git a/src/emu/netlist/nl_parser.h b/src/emu/netlist/nl_parser.h index 2f44ef9992d..9ea53ead0e6 100644 --- a/src/emu/netlist/nl_parser.h +++ b/src/emu/netlist/nl_parser.h @@ -12,6 +12,9 @@ #include "nl_util.h" #include "plib/pparser.h" +namespace netlist +{ + class netlist_parser : public ptokenizer { NETLIST_PREVENT_COPYING(netlist_parser) @@ -67,5 +70,6 @@ private: const char *m_buf; }; +} #endif /* NL_PARSER_H_ */ diff --git a/src/emu/netlist/nl_setup.c b/src/emu/netlist/nl_setup.c index a22c94519e6..ce1aaa80bab 100644 --- a/src/emu/netlist/nl_setup.c +++ b/src/emu/netlist/nl_setup.c @@ -37,6 +37,9 @@ NETLIST_END() // netlist_setup_t // ---------------------------------------------------------------------------------------- +namespace netlist +{ + netlist_setup_t::netlist_setup_t(netlist_base_t *netlist) : m_netlist(netlist) , m_proxy_cnt(0) @@ -47,7 +50,7 @@ netlist_setup_t::netlist_setup_t(netlist_base_t *netlist) void netlist_setup_t::init() { - nl_initialize_factory(factory()); + initialize_factory(factory()); NETLIST_NAME(base)(*this); } @@ -295,6 +298,24 @@ void netlist_setup_t::register_link(const pstring &sin, const pstring &sout) // fatalerror("Error adding link %s<==%s to link list\n", sin.cstr(), sout.cstr()); } +void netlist_setup_t::remove_connections(const pstring pin) +{ + pstring pinfn = build_fqn(pin); + bool found = false; + for (std::size_t i = 0; i < m_links.size(); i++) + { + if ((m_links[i].e1 == pinfn) || (m_links[i].e2 == pinfn)) + { + netlist().log("removing connection: %s <==> %s\n", m_links[i].e1.cstr(), m_links[i].e2.cstr()); + m_links.remove_at(i); + found = true; + } + } + if (!found) + netlist().error("remove_connections: found no occurrence of %s\n", pin.cstr()); +} + + void netlist_setup_t::register_frontier(const pstring attach, const double r_IN, const double r_OUT) { static int frontier_cnt = 0; @@ -417,18 +438,18 @@ netlist_param_t *netlist_setup_t::find_param(const pstring ¶m_in, bool requi } // FIXME avoid dynamic cast here -nld_base_proxy *netlist_setup_t::get_d_a_proxy(netlist_core_terminal_t &out) +devices::nld_base_proxy *netlist_setup_t::get_d_a_proxy(netlist_core_terminal_t &out) { nl_assert(out.isFamily(netlist_terminal_t::LOGIC)); //printf("proxy for %s\n", out.name().cstr());; netlist_logic_output_t &out_cast = dynamic_cast(out); - nld_base_proxy *proxy = out_cast.get_proxy(); + devices::nld_base_proxy *proxy = out_cast.get_proxy(); if (proxy == NULL) { // create a new one ... - nld_base_d_to_a_proxy *new_proxy = out_cast.logic_family()->create_d_a_proxy(&out_cast); + devices::nld_base_d_to_a_proxy *new_proxy = out_cast.logic_family()->create_d_a_proxy(&out_cast); pstring x = pstring::sprintf("proxy_da_%s_%d", out.name().cstr(), m_proxy_cnt); m_proxy_cnt++; @@ -459,7 +480,7 @@ void netlist_setup_t::connect_input_output(netlist_core_terminal_t &in, netlist_ if (out.isFamily(netlist_terminal_t::ANALOG) && in.isFamily(netlist_terminal_t::LOGIC)) { netlist_logic_input_t &incast = dynamic_cast(in); - nld_a_to_d_proxy *proxy = palloc(nld_a_to_d_proxy, &incast); + devices::nld_a_to_d_proxy *proxy = palloc(devices::nld_a_to_d_proxy, &incast); incast.set_proxy(proxy); pstring x = pstring::sprintf("proxy_ad_%s_%d", in.name().cstr(), m_proxy_cnt); m_proxy_cnt++; @@ -473,7 +494,7 @@ void netlist_setup_t::connect_input_output(netlist_core_terminal_t &in, netlist_ } else if (out.isFamily(netlist_terminal_t::LOGIC) && in.isFamily(netlist_terminal_t::ANALOG)) { - nld_base_proxy *proxy = get_d_a_proxy(out); + devices::nld_base_proxy *proxy = get_d_a_proxy(out); connect_terminals(proxy->proxy_term(), in); //proxy->out().net().register_con(in); @@ -498,7 +519,7 @@ void netlist_setup_t::connect_terminal_input(netlist_terminal_t &term, netlist_c { netlist_logic_input_t &incast = dynamic_cast(inp); NL_VERBOSE_OUT(("connect_terminal_input: connecting proxy\n")); - nld_a_to_d_proxy *proxy = palloc(nld_a_to_d_proxy, &incast); + devices::nld_a_to_d_proxy *proxy = palloc(devices::nld_a_to_d_proxy, &incast); incast.set_proxy(proxy); pstring x = pstring::sprintf("proxy_ad_%s_%d", inp.name().cstr(), m_proxy_cnt); m_proxy_cnt++; @@ -534,7 +555,7 @@ void netlist_setup_t::connect_terminal_output(netlist_terminal_t &in, netlist_co else if (out.isFamily(netlist_terminal_t::LOGIC)) { NL_VERBOSE_OUT(("connect_terminal_output: connecting proxy\n")); - nld_base_proxy *proxy = get_d_a_proxy(out); + devices::nld_base_proxy *proxy = get_d_a_proxy(out); connect_terminals(proxy->proxy_term(), in); } @@ -767,7 +788,7 @@ void netlist_setup_t::resolve_inputs() // FIXME: doesn't find internal devices. This needs to be more clever for (std::size_t i=0; i < netlist().m_devices.size(); i++) { - NETLIB_NAME(twoterm) *t = dynamic_cast(netlist().m_devices[i]); + devices::NETLIB_NAME(twoterm) *t = dynamic_cast(netlist().m_devices[i]); if (t != NULL) { has_twoterms = true; @@ -855,3 +876,5 @@ bool netlist_source_mem_t::parse(netlist_setup_t *setup, const pstring name) netlist_parser p(*setup); return p.parse(m_str, name); } + +} diff --git a/src/emu/netlist/nl_setup.h b/src/emu/netlist/nl_setup.h index 6cd5afc36f0..76fdb3fc036 100644 --- a/src/emu/netlist/nl_setup.h +++ b/src/emu/netlist/nl_setup.h @@ -50,15 +50,15 @@ #define NETLIST_NAME(_name) netlist ## _ ## _name #define NETLIST_EXTERNAL(_name) \ -ATTR_COLD void NETLIST_NAME(_name)(netlist_setup_t &setup) +ATTR_COLD void NETLIST_NAME(_name)(netlist::netlist_setup_t &setup) #define NETLIST_START(_name) \ -ATTR_COLD void NETLIST_NAME(_name)(netlist_setup_t &setup) \ +ATTR_COLD void NETLIST_NAME(_name)(netlist::netlist_setup_t &setup) \ { #define NETLIST_END() } #define LOCAL_SOURCE(_name) \ - setup.register_source(palloc(netlist_source_proc_t, # _name, &NETLIST_NAME(_name))); + setup.register_source(palloc(netlist::netlist_source_proc_t, # _name, &NETLIST_NAME(_name))); #define INCLUDE(_name) \ setup.include(# _name); @@ -68,15 +68,17 @@ ATTR_COLD void NETLIST_NAME(_name)(netlist_setup_t &setup) NETLIST_NAME(_model)(setup); \ setup.namespace_pop(); -class netlist_setup_t; - // ---------------------------------------------------------------------------------------- // netlist_setup_t // ---------------------------------------------------------------------------------------- +namespace netlist +{ + // Forward definition so we keep nl_factory.h out of the public class netlist_factory_list_t; + class netlist_setup_t { NETLIST_PREVENT_COPYING(netlist_setup_t) @@ -151,7 +153,9 @@ public: void register_link(const pstring &sin, const pstring &sout); void register_param(const pstring ¶m, const pstring &value); void register_param(const pstring ¶m, const double value); + void register_frontier(const pstring attach, const double r_IN, const double r_OUT); + void remove_connections(const pstring attach); void register_object(netlist_device_t &dev, const pstring &name, netlist_object_t &obj); bool connect(netlist_core_terminal_t &t1, netlist_core_terminal_t &t2); @@ -216,7 +220,7 @@ private: pstring objtype_as_astr(netlist_object_t &in) const; const pstring resolve_alias(const pstring &name) const; - nld_base_proxy *get_d_a_proxy(netlist_core_terminal_t &out); + devices::nld_base_proxy *get_d_a_proxy(netlist_core_terminal_t &out); template void remove_start_with(T &hm, pstring &sw) @@ -292,5 +296,7 @@ private: pstring m_setup_func_name; }; +} + #endif /* NLSETUP_H_ */ diff --git a/src/tools/nltool.c b/src/tools/nltool.c index c11bc5d3571..8308b82b450 100644 --- a/src/tools/nltool.c +++ b/src/tools/nltool.c @@ -166,12 +166,12 @@ pstring filetobuf(pstring fname) } } -class netlist_tool_t : public netlist_base_t +class netlist_tool_t : public netlist::netlist_base_t { public: netlist_tool_t() - : netlist_base_t(), m_logs(""), m_verbose(false), m_setup(NULL) + : netlist::netlist_base_t(), m_logs(""), m_verbose(false), m_setup(NULL) { } @@ -183,7 +183,7 @@ public: void init() { - m_setup = palloc(netlist_setup_t, this); + m_setup = palloc(netlist::netlist_setup_t, this); this->init_object(*this, "netlist"); m_setup->init(); } @@ -192,7 +192,7 @@ public: { // read the netlist ... - m_setup->register_source(palloc(netlist_source_mem_t, buffer)); + m_setup->register_source(palloc(netlist::netlist_source_mem_t, buffer)); m_setup->include(name); log_setup(); @@ -244,7 +244,7 @@ protected: } private: - netlist_setup_t *m_setup; + netlist::netlist_setup_t *m_setup; }; @@ -290,9 +290,9 @@ static void listdevices() { netlist_tool_t nt; nt.init(); - const netlist_factory_list_t::list_t &list = nt.setup().factory().list(); + const netlist::netlist_factory_list_t::list_t &list = nt.setup().factory().list(); - nt.setup().register_source(palloc(netlist_source_proc_t, "dummy", &netlist_dummy)); + nt.setup().register_source(palloc(netlist::netlist_source_proc_t, "dummy", &netlist_dummy)); nt.setup().include("dummy"); nt.setup().start_devices(); @@ -304,8 +304,8 @@ static void listdevices() list[i]->name().cstr() ); pstring terms(""); - netlist_base_factory_t *f = list[i]; - netlist_device_t *d = f->Create(); + netlist::netlist_base_factory_t *f = list[i]; + netlist::netlist_device_t *d = f->Create(); d->init(nt, pstring::sprintf("dummy%d", i)); d->start_dev();