mirror of
https://github.com/holub/mame
synced 2025-05-09 15:51:48 +03:00
Netlist: remove hardcoded maximum net size. Separated and documented a couple more devices out of net_lib.c
This commit is contained in:
parent
753667d2ac
commit
d0ad17590e
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -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
|
||||
|
@ -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:
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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,
|
||||
|
@ -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_ */
|
||||
|
52
src/emu/netlist/devices/nld_7425.h
Normal file
52
src/emu/netlist/devices/nld_7425.h
Normal file
@ -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_ */
|
46
src/emu/netlist/devices/nld_7427.h
Normal file
46
src/emu/netlist/devices/nld_7427.h
Normal file
@ -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_ */
|
@ -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();
|
||||
|
@ -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++;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user