diff --git a/.gitattributes b/.gitattributes index 54a0d8d8138..7d6c113a2d3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2121,6 +2121,8 @@ src/emu/netlist/devices/nld_7400.h svneol=native#text/plain src/emu/netlist/devices/nld_7402.h svneol=native#text/plain src/emu/netlist/devices/nld_7410.h svneol=native#text/plain src/emu/netlist/devices/nld_7420.h svneol=native#text/plain +src/emu/netlist/devices/nld_7425.h svneol=native#text/plain +src/emu/netlist/devices/nld_7427.h svneol=native#text/plain src/emu/netlist/devices/nld_signal.h svneol=native#text/plain src/emu/netlist/devices/nld_system.h svneol=native#text/plain src/emu/netlist/netlist.mak svneol=native#text/plain diff --git a/src/emu/machine/netlist.h b/src/emu/machine/netlist.h index dde09639b5f..1b15bbf8856 100644 --- a/src/emu/machine/netlist.h +++ b/src/emu/machine/netlist.h @@ -95,7 +95,8 @@ private: // ======================> netlist_mame_device class netlist_mame_device : public device_t, - public device_execute_interface + public device_execute_interface + //, public device_memory_interface { public: diff --git a/src/emu/netlist/devices/net_lib.c b/src/emu/netlist/devices/net_lib.c index 948cbbc060a..6df4acacb4e 100644 --- a/src/emu/netlist/devices/net_lib.c +++ b/src/emu/netlist/devices/net_lib.c @@ -986,9 +986,9 @@ static const net_device_t_base_factory *netregistry[] = ENTRY(7402, TTL_7402_NOR) ENTRY(nic7404, TTL_7404_INVERT) ENTRY(7410, TTL_7410_NAND) - ENTRY(nic7420, TTL_7420_NAND) - ENTRY(nic7425, TTL_7425_NOR) - ENTRY(nic7427, TTL_7427_NOR) + ENTRY(7420, TTL_7420_NAND) + ENTRY(7425, TTL_7425_NOR) + ENTRY(7427, TTL_7427_NOR) ENTRY(nic7430, TTL_7430_NAND) ENTRY(nic7450, TTL_7450_ANDORINVERT) ENTRY(nic7486, TTL_7486_XOR) diff --git a/src/emu/netlist/devices/net_lib.h b/src/emu/netlist/devices/net_lib.h index 03a43f52939..5bf8e016dbc 100644 --- a/src/emu/netlist/devices/net_lib.h +++ b/src/emu/netlist/devices/net_lib.h @@ -58,6 +58,8 @@ #include "nld_7402.h" #include "nld_7410.h" #include "nld_7420.h" +#include "nld_7425.h" +#include "nld_7427.h" // this is a bad hack #define USE_OLD7493 (0) @@ -105,18 +107,7 @@ NET_REGISTER_DEV(nic7404, _name) \ NET_CONNECT(_name, I1, _I1) -#define TTL_7425_NOR(_name, _I1, _I2, _I3, _I4) \ - NET_REGISTER_DEV(nic7425, _name) \ - NET_CONNECT(_name, A, _I1) \ - NET_CONNECT(_name, B, _I2) \ - NET_CONNECT(_name, C, _I3) \ - NET_CONNECT(_name, D, _I4) -#define TTL_7427_NOR(_name, _I1, _I2, _I3) \ - NET_REGISTER_DEV(nic7427, _name) \ - NET_CONNECT(_name, A, _I1) \ - NET_CONNECT(_name, B, _I2) \ - NET_CONNECT(_name, C, _I3) #define TTL_7430_NAND(_name, _I1, _I2, _I3, _I4, _I5, _I6, _I7, _I8) \ NET_REGISTER_DEV(nic7430, _name) \ @@ -312,8 +303,6 @@ NETLIB_DEVICE_WITH_PARAMS(nicNE555N_MSTABLE, net_param_t m_VL; ); -NETLIB_SIGNAL(nic7425, 4, 1, 0); -NETLIB_SIGNAL(nic7427, 3, 1, 0); NETLIB_SIGNAL(nic7430, 8, 0, 0); NETLIB_DEVICE(nic7404, diff --git a/src/emu/netlist/devices/nld_7420.h b/src/emu/netlist/devices/nld_7420.h index a771fed9276..8e21d1cdd1b 100644 --- a/src/emu/netlist/devices/nld_7420.h +++ b/src/emu/netlist/devices/nld_7420.h @@ -37,13 +37,13 @@ #define NLD_7420_H_ #define TTL_7420_NAND(_name, _I1, _I2, _I3, _I4) \ - NET_REGISTER_DEV(nic7420, _name) \ + NET_REGISTER_DEV(7420, _name) \ NET_CONNECT(_name, A, _I1) \ NET_CONNECT(_name, B, _I2) \ NET_CONNECT(_name, C, _I3) \ NET_CONNECT(_name, D, _I4) -NETLIB_SIGNAL(nic7420, 4, 0, 0); +NETLIB_SIGNAL(7420, 4, 0, 0); #endif /* NLD_7420_H_ */ diff --git a/src/emu/netlist/devices/nld_7425.h b/src/emu/netlist/devices/nld_7425.h new file mode 100644 index 00000000000..16fc1cadbb6 --- /dev/null +++ b/src/emu/netlist/devices/nld_7425.h @@ -0,0 +1,52 @@ +// license:GPL-2.0+ +// copyright-holders:Couriersud +/* + * nld_7425.h + * + * DM7425: Dual 4-Input NOR Gates + * + * +--------------+ + * A1 |1 ++ 14| VCC + * B1 |2 13| D2 + * X1 |3 12| C2 + * C1 |4 7425 11| X2 + * D1 |5 10| B2 + * Y! |6 9| A2 + * GND |7 8| Y2 + * +--------------+ + * _______ + * Y = A+B+C+D + * +---+---+---+---+---++---+ + * | A | B | C | D | X || Y | + * +===+===+===+===+===++===+ + * | X | X | X | X | 0 || Z | + * | 0 | 0 | 0 | 0 | 1 || 1 | + * | X | X | X | 1 | 1 || 0 | + * | X | X | 1 | X | 1 || 0 | + * | X | 1 | X | X | 1 || 0 | + * | 1 | X | X | X | 1 || 0 | + * +---+---+---+---+---++---+ + * + * TODO: The "X" input and high impedance output are currently not simulated. + * + * Naming conventions follow National Semiconductor datasheet + * + */ + + +#include "nld_signal.h" + +#ifndef NLD_7425_H_ +#define NLD_7425_H_ + +#define TTL_7425_NOR(_name, _I1, _I2, _I3, _I4) \ + NET_REGISTER_DEV(7425, _name) \ + NET_CONNECT(_name, A, _I1) \ + NET_CONNECT(_name, B, _I2) \ + NET_CONNECT(_name, C, _I3) \ + NET_CONNECT(_name, D, _I4) + + +NETLIB_SIGNAL(7425, 4, 1, 0); + +#endif /* NLD_7425_H_ */ diff --git a/src/emu/netlist/devices/nld_7427.h b/src/emu/netlist/devices/nld_7427.h new file mode 100644 index 00000000000..00a8c0eec1c --- /dev/null +++ b/src/emu/netlist/devices/nld_7427.h @@ -0,0 +1,46 @@ +// license:GPL-2.0+ +// copyright-holders:Couriersud +/* + * nld_7427.h + * + * DM7427: Triple 3-Input NOR Gates + * + * +--------------+ + * A1 |1 ++ 14| VCC + * B1 |2 13| C1 + * A2 |3 12| Y1 + * B2 |4 7427 11| C3 + * C2 |5 10| B3 + * Y2 |6 9| A3 + * GND |7 8| Y3 + * +--------------+ + * _____ + * Y = A+B+C + * +---+---+---++---+ + * | A | B | C || Y | + * +===+===+===++===+ + * | X | X | 1 || 0 | + * | X | 1 | X || 0 | + * | 1 | X | X || 0 | + * | 0 | 0 | 0 || 1 | + * +---+---+---++---+ + * + * Naming conventions follow National Semiconductor datasheet + * + */ + + +#include "nld_signal.h" + +#ifndef NLD_7427_H_ +#define NLD_7427_H_ + +#define TTL_7427_NOR(_name, _I1, _I2, _I3) \ + NET_REGISTER_DEV(7427, _name) \ + NET_CONNECT(_name, A, _I1) \ + NET_CONNECT(_name, B, _I2) \ + NET_CONNECT(_name, C, _I3) + +NETLIB_SIGNAL(7427, 3, 1, 0); + +#endif /* NLD_7427_H_ */ diff --git a/src/emu/netlist/devices/nld_signal.h b/src/emu/netlist/devices/nld_signal.h index 4265343f624..ab0a9faa362 100644 --- a/src/emu/netlist/devices/nld_signal.h +++ b/src/emu/netlist/devices/nld_signal.h @@ -191,7 +191,7 @@ public: ATTR_HOT ATTR_ALIGN void update() { - const netlist_time times[2] = { NLTIME_FROM_NS(22), NLTIME_FROM_NS(15) }; + static const netlist_time times[2] = { NLTIME_FROM_NS(22), NLTIME_FROM_NS(15) }; int res = _invert ^ 1 ^_check; m_i[0].activate(); diff --git a/src/emu/netlist/nl_base.c b/src/emu/netlist/nl_base.c index c3e4539142c..6b66e7649bf 100644 --- a/src/emu/netlist/nl_base.c +++ b/src/emu/netlist/nl_base.c @@ -289,7 +289,10 @@ net_output_t::net_output_t(int atype) //, m_new_Q(0) //, m_Q_analog(0.0) //, m_new_Q_analog(0.0) - , m_num_cons(0) +#if USE_LINKED_LIST + , m_head(NULL) +#endif + , m_num_cons(0) , m_time(netlist_time::zero) , m_active(0) , m_in_queue(2) @@ -322,6 +325,26 @@ ATTR_HOT inline void net_output_t::update_devs() const UINT32 mask = masks[ (m_last.Q << 1) | m_cur.Q ]; +#if USE_LINKED_LIST + net_input_t *p = m_head; + switch (m_num_cons) + { + case 2: + update_dev(p, mask); + p = p->m_next; + case 1: + update_dev(p, mask); + break; + default: + do + { + update_dev(p, mask); + p = p->m_next; + } while (p != NULL); + break; + } + +#else switch (m_num_cons) { case 2: @@ -336,16 +359,26 @@ ATTR_HOT inline void net_output_t::update_devs() } break; } - +#endif m_last = m_cur; } ATTR_COLD void net_output_t::register_con(net_input_t &input) { - int i; +#if USE_LINKED_LIST + if (m_head == NULL) + m_head = &input; + else + { + input.m_next = m_head; + m_head = &input; + } +#else if (m_num_cons >= OUTPUT_MAX_CONNECTIONS) fatalerror("Connections exceeded for %s\n", netdev()->name().cstr()); +#if 0 + int i; /* keep similar devices together */ for (i = 0; i < m_num_cons; i++) if (m_cons[i]->netdev() == input.netdev()) @@ -355,9 +388,13 @@ ATTR_COLD void net_output_t::register_con(net_input_t &input) m_cons[j] = m_cons[j - 1]; m_cons[i] = &input; - m_num_cons++; - if (input.state() != net_input_t::INP_STATE_PASSIVE) - m_active++; +#else + m_cons[m_num_cons] = &input; +#endif +#endif + m_num_cons++; + if (input.state() != net_input_t::INP_STATE_PASSIVE) + m_active++; } // ---------------------------------------------------------------------------------------- diff --git a/src/emu/netlist/nl_base.h b/src/emu/netlist/nl_base.h index 29ee006d8c8..710beb6f106 100644 --- a/src/emu/netlist/nl_base.h +++ b/src/emu/netlist/nl_base.h @@ -164,8 +164,11 @@ public: ATTR_COLD net_input_t(const int atype) : net_terminal_t(atype) - , m_low_thresh_V(0) - , m_high_thresh_V(0) + , m_low_thresh_V(0) + , m_high_thresh_V(0) +#if USE_LINKED_LIST + , m_next(NULL) +#endif , m_state(INP_STATE_ACTIVE) , m_output(NULL) {} @@ -185,6 +188,10 @@ public: double m_low_thresh_V; double m_high_thresh_V; +#if USE_LINKED_LIST + net_input_t *m_next; +#endif + private: net_input_state m_state; net_output_t * RESTRICT m_output; @@ -248,9 +255,11 @@ class net_output_t : public net_terminal_t { public: - typedef struct { - double Analog; + // FIXME: union does not work + typedef struct + { netlist_sig_t Q; + double Analog; } hybrid_t; net_output_t(int atype); @@ -300,6 +309,9 @@ protected: hybrid_t m_cur; hybrid_t m_new; +#if USE_LINKED_LIST + net_input_t *m_head; +#endif UINT32 m_num_cons; private: @@ -311,7 +323,9 @@ private: UINT32 m_in_queue; /* 0: not in queue, 1: in queue, 2: last was taken */ +#if !USE_LINKED_LIST net_input_t * RESTRICT m_cons[OUTPUT_MAX_CONNECTIONS]; +#endif }; @@ -333,7 +347,7 @@ public: { if (EXPECTED(newQ != m_new.Q)) { - m_new.Q = newQ; + m_new.Q = newQ; if (m_num_cons) push_to_queue(delay); } @@ -352,7 +366,9 @@ public: ttl_output_t() : logic_output_t() - { set_levels(0.3, 3.4); } + { + set_levels(0.3, 3.4); + } }; @@ -361,9 +377,17 @@ class analog_output_t : public net_output_t public: analog_output_t() - : net_output_t(OUTPUT | SIGNAL_ANALOG) { } + : net_output_t(OUTPUT | SIGNAL_ANALOG) + { + m_cur.Analog = 0.0; + m_new.Analog = 0.0; + } - ATTR_COLD void initial(const double val) { m_cur.Analog = val; m_new.Analog = val; } + ATTR_COLD void initial(const double val) + { + m_cur.Analog = val; + m_new.Analog = val; + } ATTR_HOT inline void set_Q(const double newQ, const netlist_time &delay) { diff --git a/src/emu/netlist/nl_config.h b/src/emu/netlist/nl_config.h index fd729d5c217..efe7875a443 100644 --- a/src/emu/netlist/nl_config.h +++ b/src/emu/netlist/nl_config.h @@ -16,6 +16,8 @@ // SETUP //============================================================ +#define USE_LINKED_LIST (1) + #define USE_DELEGATES (0) /* * The next options needs -Wno-pmf-conversions to compile and gcc