mirror of
https://github.com/holub/mame
synced 2025-10-05 08:41:31 +03:00
Netlist: Added some documentation to nl_base.h. Cleared namespace - all classes now have prefix netlist_.
This commit is contained in:
parent
d4e9528575
commit
cb5e376229
@ -50,35 +50,35 @@
|
||||
#include "net_lib.h"
|
||||
#include "nld_system.h"
|
||||
|
||||
NETLIB_START(netdev_logic_input)
|
||||
NETLIB_START(logic_input)
|
||||
{
|
||||
register_output("Q", m_Q);
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(netdev_logic_input)
|
||||
NETLIB_UPDATE(logic_input)
|
||||
{
|
||||
}
|
||||
|
||||
NETLIB_START(netdev_analog_input)
|
||||
NETLIB_START(analog_input)
|
||||
{
|
||||
register_output("Q", m_Q);
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(netdev_analog_input)
|
||||
NETLIB_UPDATE(analog_input)
|
||||
{
|
||||
}
|
||||
|
||||
NETLIB_START(netdev_log)
|
||||
NETLIB_START(log)
|
||||
{
|
||||
register_input("I", m_I);
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(netdev_log)
|
||||
NETLIB_UPDATE(log)
|
||||
{
|
||||
printf("%s: %d %d\n", name().cstr(), (UINT32) (netlist()->time().as_raw() / 1000000), INPLOGIC(m_I));
|
||||
printf("%s: %d %d\n", name().cstr(), (UINT32) (netlist().time().as_raw() / 1000000), INPLOGIC(m_I));
|
||||
}
|
||||
|
||||
NETLIB_START(netdev_clock)
|
||||
NETLIB_START(clock)
|
||||
{
|
||||
register_output("Q", m_Q);
|
||||
//register_input("FB", m_feedback);
|
||||
@ -86,16 +86,16 @@ NETLIB_START(netdev_clock)
|
||||
register_param("FREQ", m_freq, 7159000.0 * 5);
|
||||
m_inc = netlist_time::from_hz(m_freq.Value()*2);
|
||||
|
||||
register_link_internal(m_feedback, m_Q, net_input_t::INP_STATE_ACTIVE);
|
||||
register_link_internal(m_feedback, m_Q, netlist_input_t::INP_STATE_ACTIVE);
|
||||
|
||||
}
|
||||
|
||||
NETLIB_UPDATE_PARAM(netdev_clock)
|
||||
NETLIB_UPDATE_PARAM(clock)
|
||||
{
|
||||
m_inc = netlist_time::from_hz(m_freq.Value()*2);
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(netdev_clock)
|
||||
NETLIB_UPDATE(clock)
|
||||
{
|
||||
//m_Q.setToNoCheck(!m_Q.new_Q(), m_inc );
|
||||
OUTLOGIC(m_Q, !m_Q.net().new_Q(), m_inc );
|
||||
@ -217,7 +217,7 @@ NETLIB_START(nicNE555N_MSTABLE)
|
||||
register_param("VL", m_VL, 0.0 *5.0);
|
||||
|
||||
m_THRESHOLD_OUT.init_terminal(*this);
|
||||
register_link_internal(m_THRESHOLD, m_THRESHOLD_OUT, net_input_t::INP_STATE_ACTIVE);
|
||||
register_link_internal(m_THRESHOLD, m_THRESHOLD_OUT, netlist_input_t::INP_STATE_ACTIVE);
|
||||
|
||||
m_Q.initial(5.0 * 0.4);
|
||||
m_last = false;
|
||||
@ -503,7 +503,7 @@ NETLIB_UPDATE(nic7474)
|
||||
NETLIB_START(nic7474)
|
||||
{
|
||||
register_sub(sub, "sub");
|
||||
register_input(sub, "CLK", sub.m_clk, net_input_t::INP_STATE_LH);
|
||||
register_input(sub, "CLK", sub.m_clk, netlist_input_t::INP_STATE_LH);
|
||||
register_input("D", m_D);
|
||||
register_input("CLRQ", m_clrQ);
|
||||
register_input("PREQ", m_preQ);
|
||||
@ -614,8 +614,8 @@ NETLIB_START(nic7493)
|
||||
register_sub(C, "C");
|
||||
register_sub(D, "D");
|
||||
|
||||
register_input(A, "CLKA", A.m_I, net_input_t::INP_STATE_HL);
|
||||
register_input(B, "CLKB", B.m_I, net_input_t::INP_STATE_HL);
|
||||
register_input(A, "CLKA", A.m_I, netlist_input_t::INP_STATE_HL);
|
||||
register_input(B, "CLKB", B.m_I, netlist_input_t::INP_STATE_HL);
|
||||
register_input("R1", m_R1);
|
||||
register_input("R2", m_R2);
|
||||
|
||||
@ -625,8 +625,8 @@ NETLIB_START(nic7493)
|
||||
register_output(D, "QD", D.m_Q);
|
||||
|
||||
//B.register_link_internal(B.m_I, A.m_Q);
|
||||
register_link_internal(C, C.m_I, B.m_Q, net_input_t::INP_STATE_HL);
|
||||
register_link_internal(D, D.m_I, C.m_Q, net_input_t::INP_STATE_HL);
|
||||
register_link_internal(C, C.m_I, B.m_Q, netlist_input_t::INP_STATE_HL);
|
||||
register_link_internal(D, D.m_I, C.m_Q, netlist_input_t::INP_STATE_HL);
|
||||
|
||||
}
|
||||
|
||||
@ -665,8 +665,8 @@ NETLIB_START(nic7493)
|
||||
{
|
||||
m_cnt = 0;
|
||||
|
||||
register_input("CLKA", m_CLK, net_input_t::INP_STATE_HL);
|
||||
register_input("CLKB", m_CLKB, net_input_t::INP_STATE_HL);
|
||||
register_input("CLKA", m_CLK, netlist_input_t::INP_STATE_HL);
|
||||
register_input("CLKB", m_CLKB, netlist_input_t::INP_STATE_HL);
|
||||
register_input("R1", m_R1);
|
||||
register_input("R2", m_R2);
|
||||
|
||||
@ -745,7 +745,7 @@ NETLIB_START(nic74107A)
|
||||
{
|
||||
register_sub(sub, "sub");
|
||||
|
||||
register_input(sub, "CLK", sub.m_clk, net_input_t::INP_STATE_HL);
|
||||
register_input(sub, "CLK", sub.m_clk, netlist_input_t::INP_STATE_HL);
|
||||
register_input("J", m_J);
|
||||
register_input("K", m_K);
|
||||
register_input("CLRQ", m_clrQ);
|
||||
@ -855,17 +855,17 @@ NETLIB_START(nic9316)
|
||||
sub.m_loadq = 1;
|
||||
sub.m_ent = 1;
|
||||
|
||||
register_input(sub, "CLK", sub.m_clk, net_input_t::INP_STATE_LH);
|
||||
register_input(sub, "CLK", sub.m_clk, netlist_input_t::INP_STATE_LH);
|
||||
|
||||
register_input("ENP", m_ENP);
|
||||
register_input("ENT", m_ENT);
|
||||
register_input("CLRQ", m_CLRQ);
|
||||
register_input("LOADQ", m_LOADQ);
|
||||
|
||||
register_input(sub, "A", sub.m_A, net_input_t::INP_STATE_PASSIVE);
|
||||
register_input(sub, "B", sub.m_B, net_input_t::INP_STATE_PASSIVE);
|
||||
register_input(sub, "C", sub.m_C, net_input_t::INP_STATE_PASSIVE);
|
||||
register_input(sub, "D", sub.m_D, net_input_t::INP_STATE_PASSIVE);
|
||||
register_input(sub, "A", sub.m_A, netlist_input_t::INP_STATE_PASSIVE);
|
||||
register_input(sub, "B", sub.m_B, netlist_input_t::INP_STATE_PASSIVE);
|
||||
register_input(sub, "C", sub.m_C, netlist_input_t::INP_STATE_PASSIVE);
|
||||
register_input(sub, "D", sub.m_D, netlist_input_t::INP_STATE_PASSIVE);
|
||||
|
||||
register_output(sub, "QA", sub.m_QA);
|
||||
register_output(sub, "QB", sub.m_QB);
|
||||
@ -972,14 +972,14 @@ NETLIB_FUNC_VOID(nic9316_sub, update_outputs, (void))
|
||||
|
||||
static const net_device_t_base_factory *netregistry[] =
|
||||
{
|
||||
ENTRY(netdev_ttl_const, NETDEV_TTL_CONST)
|
||||
ENTRY(netdev_analog_const, NETDEV_ANALOG_CONST)
|
||||
ENTRY(netdev_logic_input, NETDEV_LOGIC_INPUT)
|
||||
ENTRY(netdev_analog_input, NETDEV_ANALOG_INPUT)
|
||||
ENTRY(netdev_log, NETDEV_LOG)
|
||||
ENTRY(netdev_clock, NETDEV_CLOCK)
|
||||
ENTRY(netdev_mainclock, NETDEV_MAINCLOCK)
|
||||
ENTRY(netdev_analog_callback,NETDEV_CALLBACK)
|
||||
ENTRY(ttl_const, NETDEV_TTL_CONST)
|
||||
ENTRY(analog_const, NETDEV_ANALOG_CONST)
|
||||
ENTRY(logic_input, NETDEV_LOGIC_INPUT)
|
||||
ENTRY(analog_input, NETDEV_ANALOG_INPUT)
|
||||
ENTRY(log, NETDEV_LOG)
|
||||
ENTRY(clock, NETDEV_CLOCK)
|
||||
ENTRY(mainclock, NETDEV_MAINCLOCK)
|
||||
ENTRY(analog_callback, NETDEV_CALLBACK)
|
||||
ENTRY(nicMultiSwitch, NETDEV_SWITCH2)
|
||||
ENTRY(nicRSFF, NETDEV_RSFF)
|
||||
ENTRY(nicMixer8, NETDEV_MIXER)
|
||||
@ -1006,14 +1006,14 @@ static const net_device_t_base_factory *netregistry[] =
|
||||
NULL
|
||||
};
|
||||
|
||||
net_device_t *net_create_device_by_classname(const astring &classname, netlist_setup_t &setup, const astring &icname)
|
||||
netlist_device_t *net_create_device_by_classname(const astring &classname, netlist_setup_t &setup, const astring &icname)
|
||||
{
|
||||
const net_device_t_base_factory **p = &netregistry[0];
|
||||
while (*p != NULL)
|
||||
{
|
||||
if (strcmp((*p)->classname(), classname) == 0)
|
||||
{
|
||||
net_device_t *ret = (*p)->Create();
|
||||
netlist_device_t *ret = (*p)->Create();
|
||||
ret->init(setup, icname);
|
||||
return ret;
|
||||
}
|
||||
@ -1023,14 +1023,14 @@ net_device_t *net_create_device_by_classname(const astring &classname, netlist_s
|
||||
return NULL; // appease code analysis
|
||||
}
|
||||
|
||||
net_device_t *net_create_device_by_name(const astring &name, netlist_setup_t &setup, const astring &icname)
|
||||
netlist_device_t *net_create_device_by_name(const astring &name, netlist_setup_t &setup, const astring &icname)
|
||||
{
|
||||
const net_device_t_base_factory **p = &netregistry[0];
|
||||
while (*p != NULL)
|
||||
{
|
||||
if (strcmp((*p)->name(), name) == 0)
|
||||
{
|
||||
net_device_t *ret = (*p)->Create();
|
||||
netlist_device_t *ret = (*p)->Create();
|
||||
ret->init(setup, icname);
|
||||
return ret;
|
||||
}
|
||||
|
@ -69,22 +69,22 @@
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
#define NETDEV_MAINCLOCK(_name) \
|
||||
NET_REGISTER_DEV(netdev_mainclock, _name)
|
||||
NET_REGISTER_DEV(mainclock, _name)
|
||||
#define NETDEV_CLOCK(_name) \
|
||||
NET_REGISTER_DEV(netdev_clock, _name)
|
||||
NET_REGISTER_DEV(clock, _name)
|
||||
#define NETDEV_LOGIC_INPUT(_name) \
|
||||
NET_REGISTER_DEV(netdev_logic_input, _name)
|
||||
NET_REGISTER_DEV(logic_input, _name)
|
||||
#define NETDEV_ANALOG_INPUT(_name) \
|
||||
NET_REGISTER_DEV(netdev_analog_input, _name)
|
||||
NET_REGISTER_DEV(analog_input, _name)
|
||||
#define NETDEV_CALLBACK(_name, _IN) \
|
||||
NET_REGISTER_DEV(netdev_analog_callback, _name) \
|
||||
NET_REGISTER_DEV(analog_callback, _name) \
|
||||
NET_CONNECT(_name, IN, _IN)
|
||||
#define NETDEV_SWITCH2(_name, _i1, _i2) \
|
||||
NET_REGISTER_DEV(nicMultiSwitch, _name) \
|
||||
NET_CONNECT(_name, i1, _i1) \
|
||||
NET_CONNECT(_name, i2, _i2)
|
||||
#define NETDEV_DELAY_RISE(_name, _CLK, _D) \
|
||||
NET_REGISTER_DEV(netdev_delay_lh, _name) \
|
||||
NET_REGISTER_DEV(delay_lh, _name) \
|
||||
NET_CONNECT(_name, CLK, _CLK) \
|
||||
NET_CONNECT(_name, D, _D)
|
||||
#define NETDEV_RSFF(_name, _S, _R) \
|
||||
@ -93,7 +93,7 @@
|
||||
NET_CONNECT(_name, R, _R)
|
||||
|
||||
#define NETDEV_LOG(_name, _I) \
|
||||
NET_REGISTER_DEV(netdev_log, _name) \
|
||||
NET_REGISTER_DEV(log, _name) \
|
||||
NET_CONNECT(_name, I, _I)
|
||||
|
||||
|
||||
@ -223,16 +223,16 @@
|
||||
// Special support devices ...
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
NETLIB_DEVICE(netdev_logic_input,
|
||||
ttl_output_t m_Q;
|
||||
NETLIB_DEVICE(logic_input,
|
||||
netlist_ttl_output_t m_Q;
|
||||
);
|
||||
|
||||
NETLIB_DEVICE(netdev_analog_input,
|
||||
analog_output_t m_Q;
|
||||
NETLIB_DEVICE(analog_input,
|
||||
netlist_analog_output_t m_Q;
|
||||
);
|
||||
|
||||
NETLIB_DEVICE(netdev_log,
|
||||
ttl_input_t m_I;
|
||||
NETLIB_DEVICE(log,
|
||||
netlist_ttl_input_t m_I;
|
||||
);
|
||||
|
||||
|
||||
@ -241,40 +241,40 @@ NETLIB_DEVICE(netdev_log,
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
NETLIB_DEVICE_WITH_PARAMS(netdev_clock,
|
||||
ttl_input_t m_feedback;
|
||||
ttl_output_t m_Q;
|
||||
NETLIB_DEVICE_WITH_PARAMS(clock,
|
||||
netlist_ttl_input_t m_feedback;
|
||||
netlist_ttl_output_t m_Q;
|
||||
|
||||
net_param_t m_freq;
|
||||
netlist_param_t m_freq;
|
||||
netlist_time m_inc;
|
||||
);
|
||||
|
||||
NETLIB_DEVICE_WITH_PARAMS(nicMultiSwitch,
|
||||
analog_input_t m_I[8];
|
||||
netlist_analog_input_t m_I[8];
|
||||
|
||||
analog_output_t m_Q;
|
||||
analog_output_t m_low;
|
||||
netlist_analog_output_t m_Q;
|
||||
netlist_analog_output_t m_low;
|
||||
|
||||
net_param_t m_POS;
|
||||
netlist_param_t m_POS;
|
||||
|
||||
int m_position;
|
||||
);
|
||||
|
||||
NETLIB_DEVICE(nicRSFF,
|
||||
ttl_input_t m_S;
|
||||
ttl_input_t m_R;
|
||||
netlist_ttl_input_t m_S;
|
||||
netlist_ttl_input_t m_R;
|
||||
|
||||
ttl_output_t m_Q;
|
||||
ttl_output_t m_QQ;
|
||||
netlist_ttl_output_t m_Q;
|
||||
netlist_ttl_output_t m_QQ;
|
||||
);
|
||||
|
||||
NETLIB_DEVICE_WITH_PARAMS(nicMixer8,
|
||||
analog_input_t m_I[8];
|
||||
netlist_analog_input_t m_I[8];
|
||||
|
||||
analog_output_t m_Q;
|
||||
analog_output_t m_low;
|
||||
netlist_analog_output_t m_Q;
|
||||
netlist_analog_output_t m_low;
|
||||
|
||||
net_param_t m_R[8];
|
||||
netlist_param_t m_R[8];
|
||||
|
||||
double m_w[8];
|
||||
);
|
||||
@ -287,43 +287,43 @@ NETLIB_DEVICE_WITH_PARAMS(nicNE555N_MSTABLE,
|
||||
|
||||
//ATTR_HOT void timer_cb(INT32 timer_id);
|
||||
|
||||
analog_input_t m_trigger;
|
||||
analog_input_t m_CV;
|
||||
analog_input_t m_THRESHOLD; /* internal */
|
||||
netlist_analog_input_t m_trigger;
|
||||
netlist_analog_input_t m_CV;
|
||||
netlist_analog_input_t m_THRESHOLD; /* internal */
|
||||
|
||||
bool m_last;
|
||||
|
||||
analog_output_t m_Q;
|
||||
analog_output_t m_THRESHOLD_OUT; /* internal */
|
||||
netlist_analog_output_t m_Q;
|
||||
netlist_analog_output_t m_THRESHOLD_OUT; /* internal */
|
||||
|
||||
//netlist_base_timer_t *m_timer;
|
||||
net_param_t m_R;
|
||||
net_param_t m_C;
|
||||
net_param_t m_VS;
|
||||
net_param_t m_VL;
|
||||
netlist_param_t m_R;
|
||||
netlist_param_t m_C;
|
||||
netlist_param_t m_VS;
|
||||
netlist_param_t m_VL;
|
||||
);
|
||||
|
||||
NETLIB_SIGNAL(nic7430, 8, 0, 0);
|
||||
|
||||
NETLIB_DEVICE(nic7404,
|
||||
ttl_input_t m_I;
|
||||
ttl_output_t m_Q;
|
||||
netlist_ttl_input_t m_I;
|
||||
netlist_ttl_output_t m_Q;
|
||||
);
|
||||
|
||||
NETLIB_DEVICE(nic7450,
|
||||
ttl_input_t m_I0;
|
||||
ttl_input_t m_I1;
|
||||
ttl_input_t m_I2;
|
||||
ttl_input_t m_I3;
|
||||
ttl_output_t m_Q;
|
||||
netlist_ttl_input_t m_I0;
|
||||
netlist_ttl_input_t m_I1;
|
||||
netlist_ttl_input_t m_I2;
|
||||
netlist_ttl_input_t m_I3;
|
||||
netlist_ttl_output_t m_Q;
|
||||
);
|
||||
|
||||
NETLIB_SUBDEVICE(nic7474sub,
|
||||
ttl_input_t m_clk;
|
||||
netlist_ttl_input_t m_clk;
|
||||
|
||||
UINT8 m_nextD;
|
||||
ttl_output_t m_Q;
|
||||
ttl_output_t m_QQ;
|
||||
netlist_ttl_output_t m_Q;
|
||||
netlist_ttl_output_t m_QQ;
|
||||
|
||||
ATTR_HOT inline void newstate(const UINT8 state);
|
||||
);
|
||||
@ -331,15 +331,15 @@ NETLIB_SUBDEVICE(nic7474sub,
|
||||
NETLIB_DEVICE(nic7474,
|
||||
NETLIB_NAME(nic7474sub) sub;
|
||||
|
||||
ttl_input_t m_D;
|
||||
ttl_input_t m_clrQ;
|
||||
ttl_input_t m_preQ;
|
||||
netlist_ttl_input_t m_D;
|
||||
netlist_ttl_input_t m_clrQ;
|
||||
netlist_ttl_input_t m_preQ;
|
||||
);
|
||||
|
||||
NETLIB_DEVICE(nic7486,
|
||||
ttl_input_t m_I0;
|
||||
ttl_input_t m_I1;
|
||||
ttl_output_t m_Q;
|
||||
netlist_ttl_input_t m_I0;
|
||||
netlist_ttl_input_t m_I1;
|
||||
netlist_ttl_output_t m_Q;
|
||||
);
|
||||
|
||||
/* 74107 does latch data during high !
|
||||
@ -348,10 +348,10 @@ NETLIB_DEVICE(nic7486,
|
||||
|
||||
|
||||
NETLIB_SUBDEVICE(nic74107Asub,
|
||||
ttl_input_t m_clk;
|
||||
netlist_ttl_input_t m_clk;
|
||||
|
||||
ttl_output_t m_Q;
|
||||
ttl_output_t m_QQ;
|
||||
netlist_ttl_output_t m_Q;
|
||||
netlist_ttl_output_t m_QQ;
|
||||
|
||||
netlist_sig_t m_Q1;
|
||||
netlist_sig_t m_Q2;
|
||||
@ -364,9 +364,9 @@ NETLIB_SUBDEVICE(nic74107Asub,
|
||||
NETLIB_DEVICE(nic74107A,
|
||||
NETLIB_NAME(nic74107Asub) sub;
|
||||
|
||||
ttl_input_t m_J;
|
||||
ttl_input_t m_K;
|
||||
ttl_input_t m_clrQ;
|
||||
netlist_ttl_input_t m_J;
|
||||
netlist_ttl_input_t m_K;
|
||||
netlist_ttl_input_t m_clrQ;
|
||||
|
||||
);
|
||||
|
||||
@ -380,16 +380,16 @@ public:
|
||||
|
||||
|
||||
NETLIB_SUBDEVICE(nic7493ff,
|
||||
ttl_input_t m_I;
|
||||
ttl_output_t m_Q;
|
||||
netlist_ttl_input_t m_I;
|
||||
netlist_ttl_output_t m_Q;
|
||||
|
||||
UINT8 m_reset;
|
||||
);
|
||||
|
||||
#if !USE_OLD7493
|
||||
NETLIB_DEVICE(nic7493,
|
||||
ttl_input_t m_R1;
|
||||
ttl_input_t m_R2;
|
||||
netlist_ttl_input_t m_R1;
|
||||
netlist_ttl_input_t m_R2;
|
||||
|
||||
NETLIB_NAME(nic7493ff) A;
|
||||
NETLIB_NAME(nic7493ff) B;
|
||||
@ -399,15 +399,15 @@ NETLIB_DEVICE(nic7493,
|
||||
|
||||
#else
|
||||
NETLIB_DEVICE(nic7493,
|
||||
ttl_input_t m_CLK;
|
||||
ttl_input_t m_CLKB; /* dummy ! */
|
||||
ttl_input_t m_R1;
|
||||
ttl_input_t m_R2;
|
||||
netlist_ttl_input_t m_CLK;
|
||||
netlist_ttl_input_t m_CLKB; /* dummy ! */
|
||||
netlist_ttl_input_t m_R1;
|
||||
netlist_ttl_input_t m_R2;
|
||||
|
||||
ttl_output_t m_QA;
|
||||
ttl_output_t m_QB;
|
||||
ttl_output_t m_QC;
|
||||
ttl_output_t m_QD;
|
||||
netlist_ttl_output_t m_QA;
|
||||
netlist_ttl_output_t m_QB;
|
||||
netlist_ttl_output_t m_QC;
|
||||
netlist_ttl_output_t m_QD;
|
||||
|
||||
UINT8 m_cnt;
|
||||
ATTR_HOT void update_outputs();
|
||||
@ -417,15 +417,15 @@ NETLIB_DEVICE(nic7493,
|
||||
NETLIB_DEVICE(nic7490,
|
||||
ATTR_HOT void update_outputs();
|
||||
|
||||
ttl_input_t m_R1;
|
||||
ttl_input_t m_R2;
|
||||
ttl_input_t m_R91;
|
||||
ttl_input_t m_R92;
|
||||
ttl_input_t m_clk;
|
||||
netlist_ttl_input_t m_R1;
|
||||
netlist_ttl_input_t m_R2;
|
||||
netlist_ttl_input_t m_R91;
|
||||
netlist_ttl_input_t m_R92;
|
||||
netlist_ttl_input_t m_clk;
|
||||
|
||||
UINT8 m_cnt;
|
||||
|
||||
ttl_output_t m_Q[4];
|
||||
netlist_ttl_output_t m_Q[4];
|
||||
);
|
||||
|
||||
/* ripple-carry counter on low-high clock transition */
|
||||
@ -434,92 +434,92 @@ NETLIB_SUBDEVICE(nic9316_sub,
|
||||
ATTR_HOT void update_outputs_all();
|
||||
ATTR_HOT void update_outputs();
|
||||
|
||||
ttl_input_t m_clk;
|
||||
netlist_ttl_input_t m_clk;
|
||||
|
||||
ttl_input_t m_A;
|
||||
ttl_input_t m_B;
|
||||
ttl_input_t m_C;
|
||||
ttl_input_t m_D;
|
||||
netlist_ttl_input_t m_A;
|
||||
netlist_ttl_input_t m_B;
|
||||
netlist_ttl_input_t m_C;
|
||||
netlist_ttl_input_t m_D;
|
||||
|
||||
UINT8 m_cnt;
|
||||
netlist_sig_t m_loadq;
|
||||
netlist_sig_t m_ent;
|
||||
|
||||
ttl_output_t m_QA;
|
||||
ttl_output_t m_QB;
|
||||
ttl_output_t m_QC;
|
||||
ttl_output_t m_QD;
|
||||
ttl_output_t m_RC;
|
||||
netlist_ttl_output_t m_QA;
|
||||
netlist_ttl_output_t m_QB;
|
||||
netlist_ttl_output_t m_QC;
|
||||
netlist_ttl_output_t m_QD;
|
||||
netlist_ttl_output_t m_RC;
|
||||
);
|
||||
|
||||
NETLIB_DEVICE(nic9316,
|
||||
NETLIB_NAME(nic9316_sub) sub;
|
||||
ttl_input_t m_ENP;
|
||||
ttl_input_t m_ENT;
|
||||
ttl_input_t m_CLRQ;
|
||||
ttl_input_t m_LOADQ;
|
||||
netlist_ttl_input_t m_ENP;
|
||||
netlist_ttl_input_t m_ENT;
|
||||
netlist_ttl_input_t m_CLRQ;
|
||||
netlist_ttl_input_t m_LOADQ;
|
||||
);
|
||||
|
||||
NETLIB_DEVICE(nic7483,
|
||||
ttl_input_t m_CI;
|
||||
ttl_input_t m_A1;
|
||||
ttl_input_t m_A2;
|
||||
ttl_input_t m_A3;
|
||||
ttl_input_t m_A4;
|
||||
ttl_input_t m_B1;
|
||||
ttl_input_t m_B2;
|
||||
ttl_input_t m_B3;
|
||||
ttl_input_t m_B4;
|
||||
ttl_input_t m_clk;
|
||||
netlist_ttl_input_t m_CI;
|
||||
netlist_ttl_input_t m_A1;
|
||||
netlist_ttl_input_t m_A2;
|
||||
netlist_ttl_input_t m_A3;
|
||||
netlist_ttl_input_t m_A4;
|
||||
netlist_ttl_input_t m_B1;
|
||||
netlist_ttl_input_t m_B2;
|
||||
netlist_ttl_input_t m_B3;
|
||||
netlist_ttl_input_t m_B4;
|
||||
netlist_ttl_input_t m_clk;
|
||||
|
||||
UINT8 m_lastr;
|
||||
|
||||
ttl_output_t m_SA;
|
||||
ttl_output_t m_SB;
|
||||
ttl_output_t m_SC;
|
||||
ttl_output_t m_SD;
|
||||
ttl_output_t m_CO;
|
||||
netlist_ttl_output_t m_SA;
|
||||
netlist_ttl_output_t m_SB;
|
||||
netlist_ttl_output_t m_SC;
|
||||
netlist_ttl_output_t m_SD;
|
||||
netlist_ttl_output_t m_CO;
|
||||
|
||||
);
|
||||
|
||||
/* one half of a nic74153 */
|
||||
|
||||
NETLIB_DEVICE(nic74153,
|
||||
ttl_input_t m_I[4];
|
||||
ttl_input_t m_A;
|
||||
ttl_input_t m_B;
|
||||
ttl_input_t m_GA;
|
||||
netlist_ttl_input_t m_I[4];
|
||||
netlist_ttl_input_t m_A;
|
||||
netlist_ttl_input_t m_B;
|
||||
netlist_ttl_input_t m_GA;
|
||||
|
||||
ttl_output_t m_AY;
|
||||
netlist_ttl_output_t m_AY;
|
||||
);
|
||||
|
||||
NETLIB_SUBDEVICE(nic7448_sub,
|
||||
ATTR_HOT void update_outputs(UINT8 v);
|
||||
static const UINT8 tab7448[16][7];
|
||||
|
||||
ttl_input_t m_A0;
|
||||
ttl_input_t m_A1;
|
||||
ttl_input_t m_A2;
|
||||
ttl_input_t m_A3;
|
||||
ttl_input_t m_RBIQ;
|
||||
netlist_ttl_input_t m_A0;
|
||||
netlist_ttl_input_t m_A1;
|
||||
netlist_ttl_input_t m_A2;
|
||||
netlist_ttl_input_t m_A3;
|
||||
netlist_ttl_input_t m_RBIQ;
|
||||
|
||||
UINT8 m_state;
|
||||
|
||||
ttl_output_t m_a;
|
||||
ttl_output_t m_b;
|
||||
ttl_output_t m_c;
|
||||
ttl_output_t m_d;
|
||||
ttl_output_t m_e;
|
||||
ttl_output_t m_f;
|
||||
ttl_output_t m_g;
|
||||
netlist_ttl_output_t m_a;
|
||||
netlist_ttl_output_t m_b;
|
||||
netlist_ttl_output_t m_c;
|
||||
netlist_ttl_output_t m_d;
|
||||
netlist_ttl_output_t m_e;
|
||||
netlist_ttl_output_t m_f;
|
||||
netlist_ttl_output_t m_g;
|
||||
);
|
||||
|
||||
NETLIB_DEVICE(nic7448,
|
||||
|
||||
NETLIB_NAME(nic7448_sub) sub;
|
||||
|
||||
ttl_input_t m_LTQ;
|
||||
ttl_input_t m_BIQ;
|
||||
netlist_ttl_input_t m_LTQ;
|
||||
netlist_ttl_input_t m_BIQ;
|
||||
);
|
||||
|
||||
#endif
|
||||
|
@ -27,11 +27,11 @@
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
template <int _numdev>
|
||||
class net_signal_base_t : public net_device_t
|
||||
class net_signal_base_t : public netlist_device_t
|
||||
{
|
||||
public:
|
||||
net_signal_base_t()
|
||||
: net_device_t(), m_active(1) { }
|
||||
: netlist_device_t(), m_active(1) { }
|
||||
|
||||
ATTR_COLD void start()
|
||||
{
|
||||
@ -40,7 +40,7 @@ public:
|
||||
register_output("Q", m_Q);
|
||||
for (int i=0; i < _numdev; i++)
|
||||
{
|
||||
register_input(sIN[i], m_i[i], net_input_t::INP_STATE_ACTIVE);
|
||||
register_input(sIN[i], m_i[i], netlist_input_t::INP_STATE_ACTIVE);
|
||||
}
|
||||
m_Q.initial(1);
|
||||
}
|
||||
@ -67,18 +67,18 @@ public:
|
||||
#endif
|
||||
|
||||
public:
|
||||
ttl_input_t m_i[_numdev];
|
||||
ttl_output_t m_Q;
|
||||
netlist_ttl_input_t m_i[_numdev];
|
||||
netlist_ttl_output_t m_Q;
|
||||
INT8 m_active;
|
||||
};
|
||||
|
||||
|
||||
template <int _numdev, int _check, int _invert>
|
||||
class net_signal_t : public net_device_t
|
||||
class net_signal_t : public netlist_device_t
|
||||
{
|
||||
public:
|
||||
net_signal_t()
|
||||
: net_device_t(), m_active(1)
|
||||
: netlist_device_t(), m_active(1)
|
||||
{
|
||||
m_Q.initial(1);
|
||||
}
|
||||
@ -90,7 +90,7 @@ public:
|
||||
register_output("Q", m_Q);
|
||||
for (int i=0; i < _numdev; i++)
|
||||
{
|
||||
register_input(sIN[i], m_i[i], net_input_t::INP_STATE_ACTIVE);
|
||||
register_input(sIN[i], m_i[i], netlist_input_t::INP_STATE_ACTIVE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,18 +140,18 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
ttl_input_t m_i[_numdev];
|
||||
ttl_output_t m_Q;
|
||||
netlist_ttl_input_t m_i[_numdev];
|
||||
netlist_ttl_output_t m_Q;
|
||||
INT8 m_active;
|
||||
};
|
||||
|
||||
#if 1
|
||||
template <int _check, int _invert>
|
||||
class xx_net_signal_t: public net_device_t
|
||||
class xx_net_signal_t: public netlist_device_t
|
||||
{
|
||||
public:
|
||||
xx_net_signal_t()
|
||||
: net_device_t(), m_active(1)
|
||||
: netlist_device_t(), m_active(1)
|
||||
{
|
||||
m_Q.initial(1);
|
||||
}
|
||||
@ -163,7 +163,7 @@ public:
|
||||
register_output("Q", m_Q);
|
||||
for (int i=0; i < 2; i++)
|
||||
{
|
||||
register_input(sIN[i], m_i[i], net_input_t::INP_STATE_ACTIVE);
|
||||
register_input(sIN[i], m_i[i], netlist_input_t::INP_STATE_ACTIVE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -212,8 +212,8 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
ttl_input_t m_i[2];
|
||||
ttl_output_t m_Q;
|
||||
netlist_ttl_input_t m_i[2];
|
||||
netlist_ttl_output_t m_Q;
|
||||
INT8 m_active;
|
||||
|
||||
};
|
||||
@ -223,10 +223,10 @@ public:
|
||||
#if 0
|
||||
|
||||
template <UINT8 _check, UINT8 _invert>
|
||||
class net_signal_t<3, _check, _invert> : public net_device_t
|
||||
class net_signal_t<3, _check, _invert> : public netlist_device_t
|
||||
{
|
||||
public:
|
||||
net_signal_t() : net_device_t(), m_active(1) { }
|
||||
net_signal_t() : netlist_device_t(), m_active(1) { }
|
||||
|
||||
ATTR_COLD void start()
|
||||
{
|
||||
@ -235,7 +235,7 @@ public:
|
||||
register_output("Q", m_Q);
|
||||
for (int i=0; i < 3; i++)
|
||||
{
|
||||
register_input(sIN[i], m_i[i], net_input_t::INP_STATE_ACTIVE);
|
||||
register_input(sIN[i], m_i[i], netlist_input_t::INP_STATE_ACTIVE);
|
||||
}
|
||||
m_Q.initial(1);
|
||||
}
|
||||
@ -275,8 +275,8 @@ public:
|
||||
OUTLOGIC(m_Q, res, times[1 - res]);// ? 22000 : 15000);
|
||||
}
|
||||
public:
|
||||
ttl_input_t m_i[3];
|
||||
ttl_output_t m_Q;
|
||||
netlist_ttl_input_t m_i[3];
|
||||
netlist_ttl_output_t m_Q;
|
||||
INT8 m_active;
|
||||
|
||||
};
|
||||
|
@ -9,37 +9,37 @@
|
||||
// netdev_const
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
NETLIB_START(netdev_ttl_const)
|
||||
NETLIB_START(ttl_const)
|
||||
{
|
||||
register_output("Q", m_Q);
|
||||
register_param("CONST", m_const, 0.0);
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(netdev_ttl_const)
|
||||
NETLIB_UPDATE(ttl_const)
|
||||
{
|
||||
}
|
||||
|
||||
NETLIB_UPDATE_PARAM(netdev_ttl_const)
|
||||
NETLIB_UPDATE_PARAM(ttl_const)
|
||||
{
|
||||
OUTLOGIC(m_Q, m_const.ValueInt(), NLTIME_IMMEDIATE);
|
||||
}
|
||||
|
||||
NETLIB_START(netdev_analog_const)
|
||||
NETLIB_START(analog_const)
|
||||
{
|
||||
register_output("Q", m_Q);
|
||||
register_param("CONST", m_const, 0.0);
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(netdev_analog_const)
|
||||
NETLIB_UPDATE(analog_const)
|
||||
{
|
||||
}
|
||||
|
||||
NETLIB_UPDATE_PARAM(netdev_analog_const)
|
||||
NETLIB_UPDATE_PARAM(analog_const)
|
||||
{
|
||||
m_Q.initial(m_const.Value());
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(netdev_analog_callback)
|
||||
NETLIB_UPDATE(analog_callback)
|
||||
{
|
||||
// FIXME: Remove after device cleanup
|
||||
if (!m_callback.isnull())
|
||||
|
@ -17,49 +17,49 @@
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
#define NETDEV_TTL_CONST(_name, _v) \
|
||||
NET_REGISTER_DEV(netdev_ttl_const, _name) \
|
||||
NET_REGISTER_DEV(ttl_const, _name) \
|
||||
NETDEV_PARAM(_name.CONST, _v)
|
||||
|
||||
#define NETDEV_ANALOG_CONST(_name, _v) \
|
||||
NET_REGISTER_DEV(netdev_analog_const, _name) \
|
||||
NET_REGISTER_DEV(analog_const, _name) \
|
||||
NETDEV_PARAM(_name.CONST, _v)
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// netdev_*_const
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
NETLIB_DEVICE_WITH_PARAMS(netdev_ttl_const,
|
||||
ttl_output_t m_Q;
|
||||
net_param_t m_const;
|
||||
NETLIB_DEVICE_WITH_PARAMS(ttl_const,
|
||||
netlist_ttl_output_t m_Q;
|
||||
netlist_param_t m_const;
|
||||
);
|
||||
|
||||
NETLIB_DEVICE_WITH_PARAMS(netdev_analog_const,
|
||||
analog_output_t m_Q;
|
||||
net_param_t m_const;
|
||||
NETLIB_DEVICE_WITH_PARAMS(analog_const,
|
||||
netlist_analog_output_t m_Q;
|
||||
netlist_param_t m_const;
|
||||
);
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// netdev_mainclock
|
||||
// mainclock
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
NETLIB_DEVICE_WITH_PARAMS(netdev_mainclock,
|
||||
ttl_output_t m_Q;
|
||||
NETLIB_DEVICE_WITH_PARAMS(mainclock,
|
||||
netlist_ttl_output_t m_Q;
|
||||
|
||||
net_param_t m_freq;
|
||||
netlist_param_t m_freq;
|
||||
netlist_time m_inc;
|
||||
|
||||
ATTR_HOT inline static void mc_update(net_net_t &net, const netlist_time curtime);
|
||||
ATTR_HOT inline static void mc_update(netlist_net_t &net, const netlist_time curtime);
|
||||
);
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// netdev_callback
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
class NETLIB_NAME(netdev_analog_callback) : public net_device_t
|
||||
class NETLIB_NAME(analog_callback) : public netlist_device_t
|
||||
{
|
||||
public:
|
||||
NETLIB_NAME(netdev_analog_callback)()
|
||||
: net_device_t() { }
|
||||
NETLIB_NAME(analog_callback)()
|
||||
: netlist_device_t() { }
|
||||
|
||||
ATTR_COLD void start()
|
||||
{
|
||||
@ -75,7 +75,7 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
analog_input_t m_in;
|
||||
netlist_analog_input_t m_in;
|
||||
netlist_output_delegate m_callback;
|
||||
};
|
||||
|
||||
|
@ -23,7 +23,7 @@ netlist_base_t::~netlist_base_t()
|
||||
{
|
||||
}
|
||||
|
||||
ATTR_COLD void netlist_base_t::set_mainclock_dev(NETLIB_NAME(netdev_mainclock) *dev)
|
||||
ATTR_COLD void netlist_base_t::set_mainclock_dev(NETLIB_NAME(mainclock) *dev)
|
||||
{
|
||||
m_mainclock = dev;
|
||||
}
|
||||
@ -91,7 +91,7 @@ ATTR_HOT ATTR_ALIGN void netlist_base_t::process_queue(INT32 &atime)
|
||||
atime = 0;
|
||||
}
|
||||
} else {
|
||||
net_net_t &mcQ = m_mainclock->m_Q.net();
|
||||
netlist_net_t &mcQ = m_mainclock->m_Q.net();
|
||||
const netlist_time inc = m_mainclock->m_inc;
|
||||
|
||||
while (atime > 0)
|
||||
@ -102,7 +102,7 @@ ATTR_HOT ATTR_ALIGN void netlist_base_t::process_queue(INT32 &atime)
|
||||
{
|
||||
update_time(mcQ.time(), atime);
|
||||
|
||||
NETLIB_NAME(netdev_mainclock)::mc_update(mcQ, time() + inc);
|
||||
NETLIB_NAME(mainclock)::mc_update(mcQ, time() + inc);
|
||||
|
||||
}
|
||||
const queue_t::entry_t e = m_queue.pop();
|
||||
@ -114,7 +114,7 @@ ATTR_HOT ATTR_ALIGN void netlist_base_t::process_queue(INT32 &atime)
|
||||
} else {
|
||||
update_time(mcQ.time(), atime);
|
||||
|
||||
NETLIB_NAME(netdev_mainclock)::mc_update(mcQ, time() + inc);
|
||||
NETLIB_NAME(mainclock)::mc_update(mcQ, time() + inc);
|
||||
}
|
||||
if (FATAL_ERROR_AFTER_NS)
|
||||
if (time() > NLTIME_FROM_NS(FATAL_ERROR_AFTER_NS))
|
||||
@ -142,7 +142,7 @@ ATTR_HOT ATTR_ALIGN void netlist_base_t::process_queue(INT32 &atime)
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
netlist_core_device_t::netlist_core_device_t()
|
||||
: net_object_t(DEVICE)
|
||||
: netlist_object_t(DEVICE, ALL)
|
||||
{
|
||||
}
|
||||
|
||||
@ -171,9 +171,9 @@ netlist_core_device_t::~netlist_core_device_t()
|
||||
// net_device_t
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
ATTR_HOT ATTR_ALIGN const netlist_sig_t netlist_core_device_t::INPLOGIC_PASSIVE(logic_input_t &inp)
|
||||
ATTR_HOT ATTR_ALIGN const netlist_sig_t netlist_core_device_t::INPLOGIC_PASSIVE(netlist_logic_input_t &inp)
|
||||
{
|
||||
if (inp.state() == net_input_t::INP_STATE_PASSIVE)
|
||||
if (inp.state() == netlist_input_t::INP_STATE_PASSIVE)
|
||||
{
|
||||
inp.activate();
|
||||
const netlist_sig_t ret = inp.Q();
|
||||
@ -185,20 +185,20 @@ ATTR_HOT ATTR_ALIGN const netlist_sig_t netlist_core_device_t::INPLOGIC_PASSIVE(
|
||||
|
||||
}
|
||||
|
||||
net_device_t::net_device_t()
|
||||
netlist_device_t::netlist_device_t()
|
||||
: netlist_core_device_t(),
|
||||
m_inputs(20),
|
||||
m_terminals(20),
|
||||
m_setup(NULL),
|
||||
m_variable_input_count(false)
|
||||
{
|
||||
}
|
||||
|
||||
net_device_t::~net_device_t()
|
||||
netlist_device_t::~netlist_device_t()
|
||||
{
|
||||
//printf("~net_device_t\n");
|
||||
}
|
||||
|
||||
ATTR_COLD void net_device_t::init(netlist_setup_t &setup, const astring &name)
|
||||
ATTR_COLD void netlist_device_t::init(netlist_setup_t &setup, const astring &name)
|
||||
{
|
||||
netlist_core_device_t::init(setup, name);
|
||||
m_setup = &setup;
|
||||
@ -206,32 +206,32 @@ ATTR_COLD void net_device_t::init(netlist_setup_t &setup, const astring &name)
|
||||
}
|
||||
|
||||
|
||||
ATTR_COLD void net_device_t::register_sub(netlist_core_device_t &dev, const astring &name)
|
||||
ATTR_COLD void netlist_device_t::register_sub(netlist_core_device_t &dev, const astring &name)
|
||||
{
|
||||
dev.init(*m_setup, name);
|
||||
}
|
||||
|
||||
void net_device_t::register_output(netlist_core_device_t &dev, const astring &name, net_output_t &port)
|
||||
void netlist_device_t::register_output(netlist_core_device_t &dev, const astring &name, netlist_output_t &port)
|
||||
{
|
||||
m_setup->register_output(*this, dev, name, port);
|
||||
}
|
||||
|
||||
void net_device_t::register_output(const astring &name, net_output_t &port)
|
||||
void netlist_device_t::register_output(const astring &name, netlist_output_t &port)
|
||||
{
|
||||
m_setup->register_output(*this,*this,name, port);
|
||||
}
|
||||
|
||||
void net_device_t::register_input(netlist_core_device_t &dev, const astring &name, net_input_t &inp, net_input_t::net_input_state type)
|
||||
void netlist_device_t::register_input(netlist_core_device_t &dev, const astring &name, netlist_input_t &inp, netlist_input_t::net_input_state type)
|
||||
{
|
||||
m_setup->register_input(*this, dev, name, inp, type);
|
||||
}
|
||||
|
||||
void net_device_t::register_input(const astring &name, net_input_t &inp, net_input_t::net_input_state type)
|
||||
void netlist_device_t::register_input(const astring &name, netlist_input_t &inp, netlist_input_t::net_input_state type)
|
||||
{
|
||||
register_input(*this, name, inp, type);
|
||||
}
|
||||
|
||||
void net_device_t::register_link_internal(netlist_core_device_t &dev, net_input_t &in, net_output_t &out, net_input_t::net_input_state aState)
|
||||
void netlist_device_t::register_link_internal(netlist_core_device_t &dev, netlist_input_t &in, netlist_output_t &out, netlist_input_t::net_input_state aState)
|
||||
{
|
||||
in.init_input(dev, aState);
|
||||
out.init_terminal(dev);
|
||||
@ -239,19 +239,19 @@ void net_device_t::register_link_internal(netlist_core_device_t &dev, net_input_
|
||||
out.net().register_con(in);
|
||||
}
|
||||
|
||||
void net_device_t::register_link_internal(net_input_t &in, net_output_t &out, net_input_t::net_input_state aState)
|
||||
void netlist_device_t::register_link_internal(netlist_input_t &in, netlist_output_t &out, netlist_input_t::net_input_state aState)
|
||||
{
|
||||
register_link_internal(*this, in, out, aState);
|
||||
}
|
||||
|
||||
void net_device_t::register_param(netlist_core_device_t &dev, const astring &name, net_param_t ¶m, double initialVal)
|
||||
void netlist_device_t::register_param(netlist_core_device_t &dev, const astring &name, netlist_param_t ¶m, double initialVal)
|
||||
{
|
||||
param.set_netdev(dev);
|
||||
param.initial(initialVal);
|
||||
m_setup->register_param(name, ¶m);
|
||||
}
|
||||
|
||||
void net_device_t::register_param(const astring &name, net_param_t ¶m, double initialVal)
|
||||
void netlist_device_t::register_param(const astring &name, netlist_param_t ¶m, double initialVal)
|
||||
{
|
||||
register_param(*this,name, param, initialVal);
|
||||
}
|
||||
@ -260,70 +260,49 @@ void net_device_t::register_param(const astring &name, net_param_t ¶m, doubl
|
||||
// net_net_t
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
ATTR_COLD net_net_t::net_net_t(const int atype)
|
||||
: net_object_t(atype)
|
||||
#if USE_LINKED_LIST
|
||||
ATTR_COLD netlist_net_t::netlist_net_t(const type_t atype, const family_t afamily)
|
||||
: netlist_object_t(atype, afamily)
|
||||
, m_head(NULL)
|
||||
#endif
|
||||
, m_num_cons(0)
|
||||
, m_time(netlist_time::zero)
|
||||
, m_active(0)
|
||||
, m_in_queue(2)
|
||||
, m_raildev(NULL)
|
||||
, m_railterminal(NULL)
|
||||
{
|
||||
m_cur.Q = 0;
|
||||
m_new.Q = 0;
|
||||
m_last.Q = 0;
|
||||
};
|
||||
|
||||
ATTR_COLD void net_net_t::register_con(net_input_t &input)
|
||||
ATTR_COLD void netlist_net_t::register_con(netlist_terminal_t &terminal)
|
||||
{
|
||||
input.set_net(*this);
|
||||
#if USE_LINKED_LIST
|
||||
terminal.set_net(*this);
|
||||
if (m_head == NULL)
|
||||
m_head = &input;
|
||||
m_head = &terminal;
|
||||
else
|
||||
{
|
||||
input.m_next = m_head;
|
||||
m_head = &input;
|
||||
terminal.m_update_list_next = m_head;
|
||||
m_head = &terminal;
|
||||
}
|
||||
#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())
|
||||
break;
|
||||
|
||||
for (int j = m_num_cons; j > i; j--)
|
||||
m_cons[j] = m_cons[j - 1];
|
||||
|
||||
m_cons[i] = &input;
|
||||
#else
|
||||
m_cons[m_num_cons] = &input;
|
||||
#endif
|
||||
#endif
|
||||
m_num_cons++;
|
||||
if (input.state() != net_input_t::INP_STATE_PASSIVE)
|
||||
|
||||
if (terminal.state() != netlist_input_t::INP_STATE_PASSIVE)
|
||||
m_active++;
|
||||
}
|
||||
|
||||
ATTR_HOT inline void net_net_t::update_dev(const net_input_t *inp, const UINT32 mask)
|
||||
ATTR_HOT inline void netlist_net_t::update_dev(const netlist_terminal_t *inp, const UINT32 mask)
|
||||
{
|
||||
if ((inp->state() & mask) != 0)
|
||||
{
|
||||
ATTR_UNUSED netlist_core_device_t *netdev = inp->netdev();
|
||||
begin_timing(netdev->total_time);
|
||||
inc_stat(netdev->stat_count);
|
||||
netdev->update_dev();
|
||||
end_timing(netdev()->total_time);
|
||||
netlist_core_device_t &netdev = inp->netdev();
|
||||
begin_timing(netdev.total_time);
|
||||
inc_stat(netdev.stat_count);
|
||||
netdev.update_dev();
|
||||
end_timing(netdev().total_time);
|
||||
}
|
||||
}
|
||||
|
||||
ATTR_HOT inline void net_net_t::update_devs()
|
||||
ATTR_HOT inline void netlist_net_t::update_devs()
|
||||
{
|
||||
assert(m_num_cons != 0);
|
||||
|
||||
@ -333,13 +312,12 @@ ATTR_HOT inline void net_net_t::update_devs()
|
||||
|
||||
const UINT32 mask = masks[ (m_last.Q << 1) | m_cur.Q ];
|
||||
|
||||
#if USE_LINKED_LIST
|
||||
net_input_t *p = m_head;
|
||||
netlist_terminal_t *p = m_head;
|
||||
switch (m_num_cons)
|
||||
{
|
||||
case 2:
|
||||
update_dev(p, mask);
|
||||
p = p->m_next;
|
||||
p = p->m_update_list_next;
|
||||
case 1:
|
||||
update_dev(p, mask);
|
||||
break;
|
||||
@ -347,87 +325,70 @@ ATTR_HOT inline void net_net_t::update_devs()
|
||||
do
|
||||
{
|
||||
update_dev(p, mask);
|
||||
p = p->m_next;
|
||||
p = p->m_update_list_next;
|
||||
} while (p != NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
#else
|
||||
switch (m_num_cons)
|
||||
{
|
||||
case 2:
|
||||
update_dev(m_cons[1], mask);
|
||||
case 1:
|
||||
update_dev(m_cons[0], mask);
|
||||
break;
|
||||
default:
|
||||
{
|
||||
for (int i=0; i < m_num_cons; i++)
|
||||
update_dev(m_cons[i], mask);
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
m_last = m_cur;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// net_terminal_t
|
||||
// netlist_terminal_t
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
ATTR_COLD void net_terminal_t::init_terminal(netlist_core_device_t &dev)
|
||||
ATTR_COLD void netlist_terminal_t::init_terminal(netlist_core_device_t &dev)
|
||||
{
|
||||
m_netdev = &dev;
|
||||
init_object(*dev.netlist());
|
||||
init_object(dev.netlist());
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// net_input_t
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
ATTR_COLD void net_input_t::init_input(netlist_core_device_t &dev, net_input_state astate)
|
||||
ATTR_COLD void netlist_input_t::init_input(netlist_core_device_t &dev, net_input_state astate)
|
||||
{
|
||||
init_terminal(dev);
|
||||
m_state = astate;
|
||||
set_state(astate);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// net_output_t
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
net_output_t::net_output_t(int atype)
|
||||
: net_terminal_t(atype)
|
||||
netlist_output_t::netlist_output_t(const type_t atype, const family_t afamily)
|
||||
: netlist_terminal_t(atype, afamily)
|
||||
, m_low_V(0.0)
|
||||
, m_high_V(0.0)
|
||||
, m_my_net(NET_DIGITAL)
|
||||
, m_my_net(NET, afamily)
|
||||
{
|
||||
//m_net = new net_net_t(NET_DIGITAL);
|
||||
this->set_net(m_my_net);
|
||||
}
|
||||
|
||||
ATTR_COLD void net_output_t::init_terminal(netlist_core_device_t &dev)
|
||||
ATTR_COLD void netlist_output_t::init_terminal(netlist_core_device_t &dev)
|
||||
{
|
||||
net_terminal_t::init_terminal(dev);
|
||||
net().init_object(*dev.netlist());
|
||||
net().register_raildev(dev);
|
||||
netlist_terminal_t::init_terminal(dev);
|
||||
net().init_object(dev.netlist());
|
||||
net().register_railterminal(*this);
|
||||
}
|
||||
|
||||
ATTR_COLD void logic_output_t::initial(const netlist_sig_t val)
|
||||
ATTR_COLD void netlist_logic_output_t::initial(const netlist_sig_t val)
|
||||
{
|
||||
net().m_cur.Q = val;
|
||||
net().m_new.Q = val;
|
||||
net().m_last.Q = !val;
|
||||
}
|
||||
|
||||
ATTR_COLD logic_output_t::logic_output_t()
|
||||
: net_output_t(OUTPUT | SIGNAL_DIGITAL)
|
||||
ATTR_COLD netlist_logic_output_t::netlist_logic_output_t()
|
||||
: netlist_output_t(OUTPUT, LOGIC)
|
||||
{
|
||||
// Default to TTL
|
||||
m_low_V = 0.1; // these depend on sinked/sourced current. Values should be suitable for typical applications.
|
||||
m_high_V = 4.8;
|
||||
}
|
||||
|
||||
ATTR_COLD void logic_output_t::set_levels(const double low, const double high)
|
||||
ATTR_COLD void netlist_logic_output_t::set_levels(const double low, const double high)
|
||||
{
|
||||
m_low_V = low;
|
||||
m_high_V = high;
|
||||
@ -435,17 +396,17 @@ ATTR_COLD void logic_output_t::set_levels(const double low, const double high)
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// netdev_mainclock
|
||||
// mainclock
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
ATTR_HOT inline void NETLIB_NAME(netdev_mainclock)::mc_update(net_net_t &net, const netlist_time curtime)
|
||||
ATTR_HOT inline void NETLIB_NAME(mainclock)::mc_update(netlist_net_t &net, const netlist_time curtime)
|
||||
{
|
||||
net.m_new.Q = !net.m_new.Q;
|
||||
net.set_time(curtime);
|
||||
net.update_devs();
|
||||
}
|
||||
|
||||
ATTR_COLD NETLIB_START(netdev_mainclock)
|
||||
ATTR_COLD NETLIB_START(mainclock)
|
||||
{
|
||||
register_output("Q", m_Q);
|
||||
|
||||
@ -454,15 +415,15 @@ ATTR_COLD NETLIB_START(netdev_mainclock)
|
||||
|
||||
}
|
||||
|
||||
ATTR_HOT NETLIB_UPDATE_PARAM(netdev_mainclock)
|
||||
ATTR_HOT NETLIB_UPDATE_PARAM(mainclock)
|
||||
{
|
||||
m_inc = netlist_time::from_hz(m_freq.Value()*2);
|
||||
}
|
||||
|
||||
ATTR_HOT NETLIB_UPDATE(netdev_mainclock)
|
||||
ATTR_HOT NETLIB_UPDATE(mainclock)
|
||||
{
|
||||
net_net_t &net = m_Q.net();
|
||||
netlist_net_t &net = m_Q.net();
|
||||
// this is only called during setup ...
|
||||
net.m_new.Q = !net.m_new.Q;
|
||||
net.set_time(netlist()->time() + m_inc);
|
||||
net.set_time(netlist().time() + m_inc);
|
||||
}
|
||||
|
@ -3,6 +3,133 @@
|
||||
/*
|
||||
* nlbase.h
|
||||
*
|
||||
* A mixed signal circuit simulation
|
||||
*
|
||||
* D: Device
|
||||
* O: Rail output (output)
|
||||
* I: Infinite impedance input (input)
|
||||
* T: Terminal (finite impedance)
|
||||
*
|
||||
* +---+ +---+ +---+ +---+ +---+
|
||||
* | | | | | | | | | |
|
||||
* | D | | D | | D | | D | | D |
|
||||
* | | | | | | | | | |
|
||||
* +-O-+ +-I-+ +-I-+ +-T-+ +-T-+
|
||||
* | | | | |
|
||||
* +-+---------+---------+---------+---------+-+
|
||||
* | rail net |
|
||||
* +-------------------------------------------+
|
||||
*
|
||||
* A rail net is a net which is driven by exactly one output with an (idealized) internal resistance
|
||||
* of zero. Ideally, it can deliver infinite current.
|
||||
*
|
||||
* A infinite resistance input does not source or sink current.
|
||||
*
|
||||
* Terminals source or sink finite (but never zero) current.
|
||||
*
|
||||
* The system differentiates between analog and logic input and outputs and analog terminals.
|
||||
* Analog and logic devices can not be connected to the same net. Instead, proxy devices
|
||||
* are inserted automatically:
|
||||
*
|
||||
* +---+ +---+
|
||||
* | | | |
|
||||
* | D1| | D2|
|
||||
* | A | | L |
|
||||
* +-O-+ +-I-+
|
||||
* | |
|
||||
* +-+---------+---+
|
||||
* | rail net |
|
||||
* +---------------+
|
||||
*
|
||||
* is converted into
|
||||
* +----------+
|
||||
* | |
|
||||
* +---+ +-+-+ | +---+
|
||||
* | | | L | A-L | | |
|
||||
* | D1| | D | Proxy | | D2|
|
||||
* | A | | A | | | |
|
||||
* +-O-+ +-I-+ | +-I-+
|
||||
* | | | |
|
||||
* +-+---------+--+ +-+-----+-------+
|
||||
* | rail net (A) | | rail net (L) |
|
||||
* +--------------| +---------------+
|
||||
*
|
||||
* This works both analog to logic as well as logic to analog.
|
||||
*
|
||||
* The above is an advanced implementation of the existing discrete
|
||||
* subsystem in MAME. Instead of relying on a fixed time-step, analog devices could
|
||||
* either connect to fixed time-step clock or use an internal clock to update them.
|
||||
* This would however introduce macro devices for RC, diodes and transistors again.
|
||||
*
|
||||
* ====================================================================================
|
||||
* FIXME: Terminals are not yet implemented.
|
||||
*
|
||||
* Instead, the following approach in case of a pure terminal/input network is taken:
|
||||
*
|
||||
* +---+ +---+ +---+ +---+ +---+
|
||||
* | | | | | | | | | |
|
||||
* | D | | D | | D | | D | | D |
|
||||
* | | | | | | | | | |
|
||||
* +-T-+ +-I-+ +-I-+ +-T-+ +-T-+
|
||||
* | | | | |
|
||||
* '+' | | '-' '-'
|
||||
* +-+---------+---------+---------+---------+-+
|
||||
* | Calculated net |
|
||||
* +-------------------------------------------+
|
||||
*
|
||||
* SPICE uses the following basic two terminal device:
|
||||
*
|
||||
* (k)
|
||||
* +-----T-----+
|
||||
* | | |
|
||||
* | +--+--+ |
|
||||
* | | | |
|
||||
* | R | |
|
||||
* | R | |
|
||||
* | R I |
|
||||
* | | I | Device n
|
||||
* | V+ I |
|
||||
* | V | |
|
||||
* | V- | |
|
||||
* | | | |
|
||||
* | +--+--+ |
|
||||
* | | |
|
||||
* +-----T-----+
|
||||
* (l)
|
||||
*
|
||||
* This is a resistance in series to a voltage source and paralleled by a current source.
|
||||
* This is suitable to model voltage sources, current sources, resistors, capacitors,
|
||||
* inductances and diodes.
|
||||
*
|
||||
* I(n,l) = - I(n,k) = ( V(k) - V - V(l) ) * (1/R(n)) + I(n)
|
||||
*
|
||||
* Now, the sum of all currents for a given net must be 0:
|
||||
*
|
||||
* Sum(n,I(n,l)) = 0 = sum(n, ( V(k) - V(n) - V(l) ) * (1/R(n)) + I(n) )
|
||||
*
|
||||
* With G(n) = 1 / R(n) and sum(n, G(n)) = Gtot and k=k(n)
|
||||
*
|
||||
* 0 = - V(l) * Gtot + sum(n, (V(k(n)) - V(n)) * G(n) + I(n))
|
||||
*
|
||||
* and with l=l(n) and fixed k
|
||||
*
|
||||
* 0 = -V(k) * Gtot + sum(n, ( V(l(n) + V(n) ) * G(n) - I(n))
|
||||
*
|
||||
* These equations represent a linear Matrix equation (with more math).
|
||||
*
|
||||
* In the context of this exercise, in a first step, we will not solve it. Instead,
|
||||
* we calculate the net voltage V(l) by using a mirror of the above device on each terminal.
|
||||
*
|
||||
* Each terminal thus has three properties:
|
||||
*
|
||||
* a) Resistance
|
||||
* b) Voltage source
|
||||
* c) Current source/sink
|
||||
*
|
||||
* Going forward, approach can be extended to use a linear equation solver.
|
||||
*
|
||||
* The formal representation of the circuit will stay the same, thus scales.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef NLBASE_H_
|
||||
@ -44,11 +171,11 @@ typedef delegate<void ()> net_update_delegate;
|
||||
#define NETLIB_FUNC_VOID(_chip, _name, _params) ATTR_HOT ATTR_ALIGN inline void NETLIB_NAME(_chip) :: _name _params
|
||||
|
||||
#define NETLIB_DEVICE(_name, _priv) \
|
||||
class NETLIB_NAME(_name) : public net_device_t \
|
||||
class NETLIB_NAME(_name) : public netlist_device_t \
|
||||
{ \
|
||||
public: \
|
||||
NETLIB_NAME(_name) () \
|
||||
: net_device_t() { } \
|
||||
: netlist_device_t() { } \
|
||||
protected: \
|
||||
ATTR_HOT void update(); \
|
||||
ATTR_HOT void start(); \
|
||||
@ -68,11 +195,11 @@ typedef delegate<void ()> net_update_delegate;
|
||||
}
|
||||
|
||||
#define NETLIB_DEVICE_WITH_PARAMS(_name, _priv) \
|
||||
class NETLIB_NAME(_name) : public net_device_t \
|
||||
class NETLIB_NAME(_name) : public netlist_device_t \
|
||||
{ \
|
||||
public: \
|
||||
NETLIB_NAME(_name) () \
|
||||
: net_device_t() { } \
|
||||
: netlist_device_t() { } \
|
||||
ATTR_HOT void update_param(); \
|
||||
ATTR_HOT void update(); \
|
||||
ATTR_HOT void start(); \
|
||||
@ -84,9 +211,9 @@ typedef delegate<void ()> net_update_delegate;
|
||||
// forward definitions
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
class net_net_t;
|
||||
class net_output_t;
|
||||
class net_param_t;
|
||||
class netlist_net_t;
|
||||
class netlist_output_t;
|
||||
class netlist_param_t;
|
||||
class netlist_setup_t;
|
||||
class netlist_base_t;
|
||||
|
||||
@ -95,41 +222,49 @@ class netlist_base_t;
|
||||
// net_object_t
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
class net_object_t
|
||||
class netlist_object_t
|
||||
{
|
||||
public:
|
||||
enum type_t {
|
||||
INPUT = 0,
|
||||
OUTPUT = 1,
|
||||
DEVICE = 2,
|
||||
PARAM = 3,
|
||||
TERMINAL = 4,
|
||||
NET_ANALOG = 5,
|
||||
NET_DIGITAL = 6,
|
||||
TYPE_MASK = 0x0f,
|
||||
SIGNAL_DIGITAL = 0x00,
|
||||
SIGNAL_ANALOG = 0x10,
|
||||
SIGNAL_MASK = 0x10,
|
||||
TERMINAL = 0,
|
||||
INPUT = 1,
|
||||
OUTPUT = 2,
|
||||
DEVICE = 3,
|
||||
PARAM = 4,
|
||||
NET = 5
|
||||
};
|
||||
enum family_t {
|
||||
LOGIC = 1,
|
||||
ANALOG = 2,
|
||||
CURRENT = 3,
|
||||
ALL = 4 // <== devices usually fall into this category
|
||||
};
|
||||
|
||||
net_object_t(const int atype)
|
||||
: m_objtype(atype) {}
|
||||
ATTR_COLD netlist_object_t(const type_t atype, const family_t afamily)
|
||||
: m_objtype(atype)
|
||||
, m_family(afamily)
|
||||
, m_netlist(NULL)
|
||||
{}
|
||||
|
||||
virtual ~net_object_t() {}
|
||||
virtual ~netlist_object_t() {}
|
||||
|
||||
ATTR_COLD void init_object(netlist_base_t &nl)
|
||||
{
|
||||
m_netlist = &nl;
|
||||
}
|
||||
|
||||
ATTR_HOT inline int object_type() const { return m_objtype; }
|
||||
ATTR_HOT inline int object_type(const UINT32 mask) const { return m_objtype & mask; }
|
||||
ATTR_HOT inline const type_t object_type() const { return m_objtype; }
|
||||
ATTR_HOT inline const family_t family() const { return m_family; }
|
||||
|
||||
ATTR_HOT inline netlist_base_t * RESTRICT netlist() { return m_netlist; }
|
||||
ATTR_HOT inline const netlist_base_t * RESTRICT netlist() const { return m_netlist; }
|
||||
ATTR_HOT inline const bool isType(const type_t atype) const { return (m_objtype == atype); }
|
||||
ATTR_HOT inline const bool isFamily(const family_t afamily) const { return (m_family == afamily); }
|
||||
|
||||
ATTR_HOT inline netlist_base_t & RESTRICT netlist() { return *m_netlist; }
|
||||
ATTR_HOT inline const netlist_base_t & RESTRICT netlist() const { return *m_netlist; }
|
||||
|
||||
private:
|
||||
const int m_objtype;
|
||||
const type_t m_objtype;
|
||||
const family_t m_family;
|
||||
netlist_base_t * RESTRICT m_netlist;
|
||||
};
|
||||
|
||||
@ -137,61 +272,66 @@ private:
|
||||
// net_terminal_t
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
class net_terminal_t : public net_object_t
|
||||
class netlist_terminal_t : public netlist_object_t
|
||||
{
|
||||
public:
|
||||
|
||||
net_terminal_t(const int atype)
|
||||
: net_object_t(atype)
|
||||
/* needed here ... */
|
||||
|
||||
enum net_input_state {
|
||||
INP_STATE_PASSIVE = 0,
|
||||
INP_STATE_ACTIVE = 1,
|
||||
INP_STATE_HL = 2,
|
||||
INP_STATE_LH = 4,
|
||||
};
|
||||
|
||||
ATTR_COLD netlist_terminal_t(const type_t atype, const family_t afamily)
|
||||
: netlist_object_t(atype, afamily)
|
||||
, m_update_list_next(NULL)
|
||||
, m_netdev(NULL)
|
||||
, m_net(NULL)
|
||||
, m_state(INP_STATE_ACTIVE)
|
||||
{}
|
||||
|
||||
ATTR_COLD virtual void init_terminal(netlist_core_device_t &dev);
|
||||
|
||||
ATTR_COLD void set_net(net_net_t &anet) { m_net = &anet; }
|
||||
ATTR_COLD void set_net(netlist_net_t &anet) { m_net = &anet; }
|
||||
|
||||
ATTR_HOT inline const net_net_t & RESTRICT net() const { return *m_net;}
|
||||
ATTR_HOT inline net_net_t & RESTRICT net() { return *m_net;}
|
||||
ATTR_HOT inline const netlist_net_t & RESTRICT net() const { return *m_net;}
|
||||
ATTR_HOT inline netlist_net_t & RESTRICT net() { return *m_net;}
|
||||
|
||||
ATTR_HOT inline netlist_core_device_t * RESTRICT netdev() const { return m_netdev; }
|
||||
ATTR_HOT inline const bool is_state(const net_input_state astate) const { return (m_state == astate); }
|
||||
ATTR_HOT inline const net_input_state state() const { return m_state; }
|
||||
ATTR_HOT inline void set_state(const net_input_state astate) { m_state = astate; }
|
||||
|
||||
ATTR_HOT inline netlist_core_device_t & RESTRICT netdev() const { return *m_netdev; }
|
||||
|
||||
netlist_terminal_t *m_update_list_next;
|
||||
|
||||
private:
|
||||
netlist_core_device_t * RESTRICT m_netdev;
|
||||
net_net_t * RESTRICT m_net;
|
||||
netlist_net_t * RESTRICT m_net;
|
||||
net_input_state m_state;
|
||||
};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// net_input_t
|
||||
// netlist_input_t
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
class net_input_t : public net_terminal_t
|
||||
class netlist_input_t : public netlist_terminal_t
|
||||
{
|
||||
public:
|
||||
|
||||
enum net_input_state {
|
||||
INP_STATE_PASSIVE = 0,
|
||||
INP_STATE_ACTIVE = 1,
|
||||
INP_STATE_HL = 2,
|
||||
INP_STATE_LH = 4,
|
||||
};
|
||||
|
||||
ATTR_COLD net_input_t(const int atype)
|
||||
: net_terminal_t(atype)
|
||||
ATTR_COLD netlist_input_t(const type_t atype, const family_t afamily)
|
||||
: netlist_terminal_t(atype, afamily)
|
||||
, m_low_thresh_V(0)
|
||||
, m_high_thresh_V(0)
|
||||
#if USE_LINKED_LIST
|
||||
, m_next(NULL)
|
||||
#endif
|
||||
, m_state(INP_STATE_ACTIVE)
|
||||
{}
|
||||
|
||||
ATTR_COLD void init_input(netlist_core_device_t &dev, net_input_state astate = INP_STATE_ACTIVE);
|
||||
|
||||
ATTR_HOT inline const bool is_state(const net_input_state astate) const { return (m_state == astate); }
|
||||
ATTR_HOT inline const net_input_state state() const { return m_state; }
|
||||
|
||||
ATTR_HOT inline void inactivate();
|
||||
ATTR_HOT inline void activate();
|
||||
ATTR_HOT inline void activate_hl();
|
||||
@ -200,23 +340,18 @@ 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;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// logic_input_t
|
||||
// netlist_logic_input_t
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
class logic_input_t : public net_input_t
|
||||
class netlist_logic_input_t : public netlist_input_t
|
||||
{
|
||||
public:
|
||||
logic_input_t()
|
||||
: net_input_t(INPUT | SIGNAL_DIGITAL)
|
||||
netlist_logic_input_t()
|
||||
: netlist_input_t(INPUT, LOGIC)
|
||||
{
|
||||
// default to TTL
|
||||
m_low_thresh_V = 0.8;
|
||||
@ -234,21 +369,25 @@ public:
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// ttl_input_t
|
||||
// netlist_ttl_input_t
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
class ttl_input_t : public logic_input_t
|
||||
class netlist_ttl_input_t : public netlist_logic_input_t
|
||||
{
|
||||
public:
|
||||
ttl_input_t()
|
||||
: logic_input_t() { set_thresholds(0.8 , 2.0); }
|
||||
netlist_ttl_input_t()
|
||||
: netlist_logic_input_t() { set_thresholds(0.8 , 2.0); }
|
||||
};
|
||||
|
||||
class analog_input_t : public net_input_t
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// netlist_analog_input_t
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
class netlist_analog_input_t : public netlist_input_t
|
||||
{
|
||||
public:
|
||||
analog_input_t()
|
||||
: net_input_t(INPUT | SIGNAL_ANALOG) { }
|
||||
netlist_analog_input_t()
|
||||
: netlist_input_t(INPUT, ANALOG) { }
|
||||
|
||||
ATTR_HOT inline const bool is_highz() const;
|
||||
ATTR_HOT inline const double Q_Analog() const;
|
||||
@ -260,17 +399,17 @@ public:
|
||||
// net_net_t
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
class net_net_t : public net_object_t
|
||||
class netlist_net_t : public netlist_object_t
|
||||
{
|
||||
public:
|
||||
|
||||
friend class NETLIB_NAME(netdev_mainclock);
|
||||
friend class net_output_t;
|
||||
friend class net_input_t;
|
||||
friend class logic_output_t;
|
||||
friend class analog_output_t;
|
||||
friend class logic_input_t;
|
||||
friend class analog_input_t;
|
||||
friend class NETLIB_NAME(mainclock);
|
||||
friend class netlist_output_t;
|
||||
friend class netlist_input_t;
|
||||
friend class netlist_logic_output_t;
|
||||
friend class netlist_analog_output_t;
|
||||
friend class netlist_logic_input_t;
|
||||
friend class netlist_analog_input_t;
|
||||
|
||||
// FIXME: union does not work
|
||||
typedef struct
|
||||
@ -279,19 +418,24 @@ public:
|
||||
double Analog;
|
||||
} hybrid_t;
|
||||
|
||||
ATTR_COLD net_net_t(const int atype);
|
||||
ATTR_COLD netlist_net_t(const type_t atype, const family_t afamily);
|
||||
|
||||
ATTR_COLD void register_con(net_input_t &inp);
|
||||
ATTR_COLD void register_raildev(netlist_core_device_t &mr)
|
||||
ATTR_COLD void register_con(netlist_terminal_t &terminal);
|
||||
ATTR_COLD void register_railterminal(netlist_terminal_t &mr)
|
||||
{
|
||||
assert(m_raildev == NULL);
|
||||
m_raildev = &mr;
|
||||
assert(m_railterminal == NULL);
|
||||
m_railterminal = &mr;
|
||||
}
|
||||
|
||||
ATTR_HOT inline bool isRailNet() { return m_raildev == NULL; }
|
||||
|
||||
/* inline not always works out */
|
||||
ATTR_HOT /*inline*/ void update_devs();
|
||||
ATTR_HOT inline void update_devs();
|
||||
|
||||
ATTR_HOT inline const netlist_time time() const { return m_time; }
|
||||
ATTR_HOT inline void set_time(const netlist_time ntime) { m_time = ntime; }
|
||||
|
||||
ATTR_HOT inline bool isRailNet() { return !(m_railterminal == NULL); }
|
||||
ATTR_HOT inline const netlist_terminal_t & RESTRICT railterminal() const { return *m_railterminal; }
|
||||
ATTR_HOT inline netlist_terminal_t & RESTRICT railterminal() { return *m_railterminal; }
|
||||
|
||||
/* Everything below is used by the logic subsystem */
|
||||
|
||||
@ -299,15 +443,10 @@ public:
|
||||
ATTR_HOT inline void dec_active();
|
||||
|
||||
ATTR_HOT inline const int active_count() const { return m_active; }
|
||||
ATTR_HOT inline const netlist_time time() const { return m_time; }
|
||||
ATTR_HOT inline void set_time(const netlist_time ntime) { m_time = ntime; }
|
||||
|
||||
ATTR_HOT inline const netlist_sig_t last_Q() const { return m_last.Q; }
|
||||
ATTR_HOT inline const netlist_sig_t new_Q() const { return m_new.Q; }
|
||||
|
||||
ATTR_HOT inline const netlist_core_device_t * RESTRICT raildev() const { return m_raildev; }
|
||||
ATTR_HOT inline netlist_core_device_t * RESTRICT raildev() { return m_raildev; }
|
||||
|
||||
protected:
|
||||
|
||||
/* prohibit use in device functions
|
||||
@ -324,29 +463,23 @@ protected:
|
||||
return m_cur.Analog;
|
||||
}
|
||||
|
||||
|
||||
ATTR_HOT inline void push_to_queue(const netlist_time &delay);
|
||||
|
||||
hybrid_t m_last;
|
||||
hybrid_t m_cur;
|
||||
hybrid_t m_new;
|
||||
|
||||
#if USE_LINKED_LIST
|
||||
net_input_t *m_head;
|
||||
#endif
|
||||
netlist_terminal_t *m_head;
|
||||
UINT32 m_num_cons;
|
||||
|
||||
private:
|
||||
ATTR_HOT void update_dev(const net_input_t *inp, const UINT32 mask);
|
||||
ATTR_HOT void update_dev(const netlist_terminal_t *inp, const UINT32 mask);
|
||||
|
||||
netlist_time m_time;
|
||||
INT32 m_active;
|
||||
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
|
||||
netlist_core_device_t * RESTRICT m_raildev;
|
||||
netlist_terminal_t * RESTRICT m_railterminal;
|
||||
};
|
||||
|
||||
|
||||
@ -354,13 +487,13 @@ private:
|
||||
// net_output_t
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
class NETLIB_NAME(netdev_mainclock);
|
||||
class NETLIB_NAME(mainclock);
|
||||
|
||||
class net_output_t : public net_terminal_t
|
||||
class netlist_output_t : public netlist_terminal_t
|
||||
{
|
||||
public:
|
||||
|
||||
net_output_t(int atype);
|
||||
netlist_output_t(const type_t atype, const family_t afamily);
|
||||
|
||||
ATTR_COLD virtual void init_terminal(netlist_core_device_t &dev);
|
||||
|
||||
@ -370,22 +503,22 @@ public:
|
||||
protected:
|
||||
|
||||
private:
|
||||
net_net_t m_my_net;
|
||||
netlist_net_t m_my_net;
|
||||
};
|
||||
|
||||
|
||||
class logic_output_t : public net_output_t
|
||||
class netlist_logic_output_t : public netlist_output_t
|
||||
{
|
||||
public:
|
||||
|
||||
ATTR_COLD logic_output_t();
|
||||
ATTR_COLD netlist_logic_output_t();
|
||||
|
||||
ATTR_COLD void initial(const netlist_sig_t val);
|
||||
ATTR_COLD void set_levels(const double low, const double high);
|
||||
|
||||
ATTR_HOT inline void set_Q(const netlist_sig_t newQ, const netlist_time &delay)
|
||||
{
|
||||
net_net_t &anet = net();
|
||||
netlist_net_t &anet = net();
|
||||
|
||||
if (EXPECTED(newQ != anet.m_new.Q))
|
||||
{
|
||||
@ -396,24 +529,24 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class ttl_output_t : public logic_output_t
|
||||
class netlist_ttl_output_t : public netlist_logic_output_t
|
||||
{
|
||||
public:
|
||||
|
||||
ttl_output_t()
|
||||
: logic_output_t()
|
||||
netlist_ttl_output_t()
|
||||
: netlist_logic_output_t()
|
||||
{
|
||||
set_levels(0.3, 3.4);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class analog_output_t : public net_output_t
|
||||
class netlist_analog_output_t : public netlist_output_t
|
||||
{
|
||||
public:
|
||||
|
||||
ATTR_COLD analog_output_t()
|
||||
: net_output_t(OUTPUT | SIGNAL_ANALOG)
|
||||
ATTR_COLD netlist_analog_output_t()
|
||||
: netlist_output_t(OUTPUT, ANALOG)
|
||||
{
|
||||
net().m_cur.Analog = 0.0;
|
||||
net().m_new.Analog = 0.0;
|
||||
@ -440,7 +573,7 @@ public:
|
||||
// net_device_t
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
class netlist_core_device_t : public net_object_t
|
||||
class netlist_core_device_t : public netlist_object_t
|
||||
{
|
||||
public:
|
||||
|
||||
@ -467,32 +600,32 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
ATTR_HOT const netlist_sig_t INPLOGIC_PASSIVE(logic_input_t &inp);
|
||||
ATTR_HOT const netlist_sig_t INPLOGIC_PASSIVE(netlist_logic_input_t &inp);
|
||||
|
||||
ATTR_HOT inline const netlist_sig_t INPLOGIC(const logic_input_t &inp) const
|
||||
ATTR_HOT inline const netlist_sig_t INPLOGIC(const netlist_logic_input_t &inp) const
|
||||
{
|
||||
assert(inp.state() != net_input_t::INP_STATE_PASSIVE);
|
||||
assert(inp.state() != netlist_input_t::INP_STATE_PASSIVE);
|
||||
return inp.Q();
|
||||
}
|
||||
|
||||
ATTR_HOT inline void OUTLOGIC(logic_output_t &out, const netlist_sig_t val, const netlist_time &delay)
|
||||
ATTR_HOT inline void OUTLOGIC(netlist_logic_output_t &out, const netlist_sig_t val, const netlist_time &delay)
|
||||
{
|
||||
out.set_Q(val, delay);
|
||||
}
|
||||
|
||||
ATTR_HOT inline bool INP_HL(const logic_input_t &inp) const
|
||||
ATTR_HOT inline bool INP_HL(const netlist_logic_input_t &inp) const
|
||||
{
|
||||
return ((inp.last_Q() & !inp.Q()) == 1);
|
||||
}
|
||||
|
||||
ATTR_HOT inline bool INP_LH(const logic_input_t &inp) const
|
||||
ATTR_HOT inline bool INP_LH(const netlist_logic_input_t &inp) const
|
||||
{
|
||||
return ((!inp.last_Q() & inp.Q()) == 1);
|
||||
}
|
||||
|
||||
ATTR_HOT inline const double INPANALOG(const analog_input_t &inp) const { return inp.Q_Analog(); }
|
||||
ATTR_HOT inline const double INPANALOG(const netlist_analog_input_t &inp) const { return inp.Q_Analog(); }
|
||||
|
||||
ATTR_HOT inline void OUTANALOG(analog_output_t &out, const double val, const netlist_time &delay)
|
||||
ATTR_HOT inline void OUTANALOG(netlist_analog_output_t &out, const double val, const netlist_time &delay)
|
||||
{
|
||||
out.set_Q(val, delay);
|
||||
}
|
||||
@ -519,13 +652,13 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class net_device_t : public netlist_core_device_t
|
||||
class netlist_device_t : public netlist_core_device_t
|
||||
{
|
||||
public:
|
||||
|
||||
ATTR_COLD net_device_t();
|
||||
ATTR_COLD netlist_device_t();
|
||||
|
||||
virtual ~net_device_t();
|
||||
virtual ~netlist_device_t();
|
||||
|
||||
ATTR_COLD virtual void init(netlist_setup_t &setup, const astring &name);
|
||||
|
||||
@ -535,24 +668,25 @@ public:
|
||||
|
||||
ATTR_COLD void register_sub(netlist_core_device_t &dev, const astring &name);
|
||||
|
||||
ATTR_COLD void register_output(const astring &name, net_output_t &out);
|
||||
ATTR_COLD void register_output(netlist_core_device_t &dev, const astring &name, net_output_t &out);
|
||||
ATTR_COLD void register_output(const astring &name, netlist_output_t &out);
|
||||
ATTR_COLD void register_output(netlist_core_device_t &dev, const astring &name, netlist_output_t &out);
|
||||
|
||||
ATTR_COLD void register_input(const astring &name, net_input_t &in, net_input_t::net_input_state state = net_input_t::INP_STATE_ACTIVE);
|
||||
ATTR_COLD void register_input(netlist_core_device_t &dev, const astring &name, net_input_t &in, net_input_t::net_input_state state = net_input_t::INP_STATE_ACTIVE);
|
||||
ATTR_COLD void register_input(const astring &name, netlist_input_t &in, netlist_input_t::net_input_state state = netlist_input_t::INP_STATE_ACTIVE);
|
||||
ATTR_COLD void register_input(netlist_core_device_t &dev, const astring &name, netlist_input_t &in, netlist_input_t::net_input_state state = netlist_input_t::INP_STATE_ACTIVE);
|
||||
|
||||
ATTR_COLD void register_link_internal(net_input_t &in, net_output_t &out, net_input_t::net_input_state aState);
|
||||
ATTR_COLD void register_link_internal(netlist_core_device_t &dev, net_input_t &in, net_output_t &out, net_input_t::net_input_state aState);
|
||||
ATTR_COLD void register_link_internal(netlist_input_t &in, netlist_output_t &out, netlist_input_t::net_input_state aState);
|
||||
ATTR_COLD void register_link_internal(netlist_core_device_t &dev, netlist_input_t &in, netlist_output_t &out, netlist_input_t::net_input_state aState);
|
||||
|
||||
netlist_list_t<astring> m_inputs;
|
||||
/* driving logic outputs don't count in here */
|
||||
netlist_list_t<astring> m_terminals;
|
||||
|
||||
protected:
|
||||
|
||||
virtual void update() { }
|
||||
virtual void start() { }
|
||||
|
||||
ATTR_COLD void register_param(const astring &sname, net_param_t ¶m, const double initialVal = 0.0);
|
||||
ATTR_COLD void register_param(netlist_core_device_t &dev, const astring &sname, net_param_t ¶m, const double initialVal = 0.0);
|
||||
ATTR_COLD void register_param(const astring &sname, netlist_param_t ¶m, const double initialVal = 0.0);
|
||||
ATTR_COLD void register_param(netlist_core_device_t &dev, const astring &sname, netlist_param_t ¶m, const double initialVal = 0.0);
|
||||
|
||||
netlist_setup_t *m_setup;
|
||||
bool m_variable_input_count;
|
||||
@ -560,11 +694,12 @@ protected:
|
||||
private:
|
||||
};
|
||||
|
||||
class net_param_t
|
||||
class netlist_param_t : public netlist_object_t
|
||||
{
|
||||
public:
|
||||
net_param_t()
|
||||
: m_param(0.0)
|
||||
netlist_param_t()
|
||||
: netlist_object_t(PARAM, ANALOG)
|
||||
, m_param(0.0)
|
||||
, m_netdev(NULL)
|
||||
{ }
|
||||
|
||||
@ -586,9 +721,6 @@ private:
|
||||
};
|
||||
|
||||
|
||||
|
||||
class netdev_mainclock;
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// netlist_base_t
|
||||
// ----------------------------------------------------------------------------------------
|
||||
@ -597,14 +729,14 @@ class netlist_base_t
|
||||
{
|
||||
public:
|
||||
|
||||
typedef netlist_timed_queue1<net_net_t, netlist_time, 512> queue_t;
|
||||
typedef netlist_timed_queue1<netlist_net_t, netlist_time, 512> queue_t;
|
||||
|
||||
netlist_base_t();
|
||||
virtual ~netlist_base_t();
|
||||
|
||||
void set_clock_freq(UINT64 clockfreq);
|
||||
|
||||
ATTR_HOT inline void push_to_queue(net_net_t &out, const netlist_time &attime)
|
||||
ATTR_HOT inline void push_to_queue(netlist_net_t &out, const netlist_time &attime)
|
||||
{
|
||||
m_queue.push(queue_t::entry_t(attime, out));
|
||||
}
|
||||
@ -613,7 +745,7 @@ public:
|
||||
|
||||
ATTR_HOT inline const netlist_time &time() const { return m_time_ps; }
|
||||
|
||||
ATTR_COLD void set_mainclock_dev(NETLIB_NAME(netdev_mainclock) *dev);
|
||||
ATTR_COLD void set_mainclock_dev(NETLIB_NAME(mainclock) *dev);
|
||||
|
||||
ATTR_COLD void reset();
|
||||
|
||||
@ -627,7 +759,7 @@ protected:
|
||||
int m_perf_inp_active;
|
||||
|
||||
private:
|
||||
NETLIB_NAME(netdev_mainclock) *m_mainclock;
|
||||
NETLIB_NAME(mainclock) *m_mainclock;
|
||||
netlist_time m_time_ps;
|
||||
UINT32 m_rem;
|
||||
UINT32 m_div;
|
||||
@ -641,21 +773,21 @@ private:
|
||||
// netdev_a_to_d
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
class netdev_a_to_d_proxy : public net_device_t
|
||||
class nld_a_to_d_proxy : public netlist_device_t
|
||||
{
|
||||
public:
|
||||
netdev_a_to_d_proxy(net_input_t &in_proxied)
|
||||
: net_device_t()
|
||||
nld_a_to_d_proxy(netlist_input_t &in_proxied)
|
||||
: netlist_device_t()
|
||||
{
|
||||
assert(in_proxied.object_type(SIGNAL_MASK) == SIGNAL_DIGITAL);
|
||||
m_I.m_high_thresh_V = in_proxied.m_high_thresh_V;
|
||||
m_I.m_low_thresh_V = in_proxied.m_low_thresh_V;
|
||||
}
|
||||
|
||||
virtual ~netdev_a_to_d_proxy() {}
|
||||
virtual ~nld_a_to_d_proxy() {}
|
||||
|
||||
analog_input_t m_I;
|
||||
ttl_output_t m_Q;
|
||||
netlist_analog_input_t m_I;
|
||||
netlist_ttl_output_t m_Q;
|
||||
|
||||
protected:
|
||||
void start()
|
||||
@ -680,21 +812,21 @@ protected:
|
||||
// netdev_d_to_a
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
class netdev_d_to_a_proxy : public net_device_t
|
||||
class nld_d_to_a_proxy : public netlist_device_t
|
||||
{
|
||||
public:
|
||||
netdev_d_to_a_proxy(net_output_t &out_proxied)
|
||||
: net_device_t()
|
||||
nld_d_to_a_proxy(netlist_output_t &out_proxied)
|
||||
: netlist_device_t()
|
||||
{
|
||||
assert(out_proxied.object_type(SIGNAL_MASK) == SIGNAL_DIGITAL);
|
||||
m_low_V = out_proxied.m_low_V;
|
||||
m_high_V = out_proxied.m_high_V;
|
||||
}
|
||||
|
||||
virtual ~netdev_d_to_a_proxy() {}
|
||||
virtual ~nld_d_to_a_proxy() {}
|
||||
|
||||
ttl_input_t m_I;
|
||||
analog_output_t m_Q;
|
||||
netlist_ttl_input_t m_I;
|
||||
netlist_analog_output_t m_Q;
|
||||
|
||||
protected:
|
||||
void start()
|
||||
@ -719,74 +851,73 @@ private:
|
||||
// Inline implementations
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
ATTR_HOT inline void net_input_t::inactivate()
|
||||
ATTR_HOT inline void netlist_input_t::inactivate()
|
||||
{
|
||||
if (m_state != INP_STATE_PASSIVE)
|
||||
if (!is_state(INP_STATE_PASSIVE))
|
||||
{
|
||||
m_state = INP_STATE_PASSIVE;
|
||||
set_state(INP_STATE_PASSIVE);
|
||||
net().dec_active();
|
||||
}
|
||||
}
|
||||
|
||||
ATTR_HOT inline void net_input_t::activate()
|
||||
ATTR_HOT inline void netlist_input_t::activate()
|
||||
{
|
||||
if (m_state == INP_STATE_PASSIVE)
|
||||
if (is_state(INP_STATE_PASSIVE))
|
||||
{
|
||||
net().inc_active();
|
||||
m_state = INP_STATE_ACTIVE;
|
||||
set_state(INP_STATE_ACTIVE);
|
||||
}
|
||||
}
|
||||
|
||||
ATTR_HOT inline void net_input_t::activate_hl()
|
||||
ATTR_HOT inline void netlist_input_t::activate_hl()
|
||||
{
|
||||
if (m_state == INP_STATE_PASSIVE)
|
||||
if (is_state(INP_STATE_PASSIVE))
|
||||
{
|
||||
net().inc_active();
|
||||
m_state = INP_STATE_HL;
|
||||
set_state(INP_STATE_HL);
|
||||
}
|
||||
}
|
||||
|
||||
ATTR_HOT inline void net_input_t::activate_lh()
|
||||
ATTR_HOT inline void netlist_input_t::activate_lh()
|
||||
{
|
||||
if (m_state == INP_STATE_PASSIVE)
|
||||
if (is_state(INP_STATE_PASSIVE))
|
||||
{
|
||||
net().inc_active();
|
||||
m_state = INP_STATE_LH;
|
||||
set_state(INP_STATE_LH);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ATTR_HOT inline void net_net_t::push_to_queue(const netlist_time &delay)
|
||||
ATTR_HOT inline void netlist_net_t::push_to_queue(const netlist_time &delay)
|
||||
{
|
||||
// if (m_in_queue == 1) return; FIXME: check this at some time
|
||||
m_time = netlist()->time() + delay;
|
||||
m_time = netlist().time() + delay;
|
||||
m_in_queue = (m_active > 0) ? 1 : 0; /* queued ? */
|
||||
if (m_in_queue)
|
||||
{
|
||||
//m_in_queue = 1; /* pending */
|
||||
netlist()->push_to_queue(*this, m_time);
|
||||
netlist().push_to_queue(*this, m_time);
|
||||
}
|
||||
}
|
||||
|
||||
ATTR_HOT inline void net_net_t::inc_active()
|
||||
ATTR_HOT inline void netlist_net_t::inc_active()
|
||||
{
|
||||
m_active++;
|
||||
|
||||
#if USE_DEACTIVE_DEVICE
|
||||
if (m_active == 1 && m_in_queue > 0)
|
||||
{
|
||||
m_last = m_cur;
|
||||
raildev()->inc_active();
|
||||
m_cur = m_new;
|
||||
}
|
||||
#endif
|
||||
if (USE_DEACTIVE_DEVICE)
|
||||
if (m_active == 1 && m_in_queue > 0)
|
||||
{
|
||||
m_last = m_cur;
|
||||
railterminal().netdev().inc_active();
|
||||
m_cur = m_new;
|
||||
}
|
||||
|
||||
if (EXPECTED(m_active == 1 && m_in_queue == 0))
|
||||
{
|
||||
if (EXPECTED(m_time > netlist()->time()))
|
||||
if (EXPECTED(m_time > netlist().time()))
|
||||
{
|
||||
m_in_queue = 1; /* pending */
|
||||
netlist()->push_to_queue(*this, m_time);
|
||||
netlist().push_to_queue(*this, m_time);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -796,31 +927,31 @@ ATTR_HOT inline void net_net_t::inc_active()
|
||||
}
|
||||
}
|
||||
|
||||
ATTR_HOT inline void net_net_t::dec_active()
|
||||
ATTR_HOT inline void netlist_net_t::dec_active()
|
||||
{
|
||||
m_active--;
|
||||
#if (USE_DEACTIVE_DEVICE)
|
||||
if (m_active == 0)
|
||||
raildev()->dec_active();
|
||||
#endif
|
||||
if (USE_DEACTIVE_DEVICE)
|
||||
if (m_active == 0)
|
||||
railterminal().netdev().dec_active();
|
||||
|
||||
}
|
||||
|
||||
ATTR_HOT inline const netlist_sig_t logic_input_t::Q() const
|
||||
ATTR_HOT inline const netlist_sig_t netlist_logic_input_t::Q() const
|
||||
{
|
||||
return net().Q();
|
||||
}
|
||||
|
||||
ATTR_HOT inline const netlist_sig_t logic_input_t::last_Q() const
|
||||
ATTR_HOT inline const netlist_sig_t netlist_logic_input_t::last_Q() const
|
||||
{
|
||||
return net().last_Q();
|
||||
}
|
||||
|
||||
ATTR_HOT inline const double analog_input_t::Q_Analog() const
|
||||
ATTR_HOT inline const double netlist_analog_input_t::Q_Analog() const
|
||||
{
|
||||
return net().Q_Analog();
|
||||
}
|
||||
|
||||
ATTR_HOT inline const bool analog_input_t::is_highz() const
|
||||
ATTR_HOT inline const bool netlist_analog_input_t::is_highz() const
|
||||
{
|
||||
return (net().Q_Analog() == NETLIST_HIGHIMP_V);
|
||||
}
|
||||
@ -838,7 +969,7 @@ public:
|
||||
|
||||
virtual ~net_device_t_base_factory() {}
|
||||
|
||||
virtual net_device_t *Create() const = 0;
|
||||
virtual netlist_device_t *Create() const = 0;
|
||||
|
||||
const astring &name() const { return m_name; }
|
||||
const astring &classname() const { return m_classname; }
|
||||
@ -854,16 +985,16 @@ public:
|
||||
net_device_t_factory(const astring &name, const astring &classname)
|
||||
: net_device_t_base_factory(name, classname) { }
|
||||
|
||||
net_device_t *Create() const
|
||||
netlist_device_t *Create() const
|
||||
{
|
||||
net_device_t *r = new C();
|
||||
netlist_device_t *r = new C();
|
||||
//r->init(setup, name);
|
||||
return r;
|
||||
}
|
||||
};
|
||||
|
||||
net_device_t *net_create_device_by_classname(const astring &classname, netlist_setup_t &setup, const astring &icname);
|
||||
net_device_t *net_create_device_by_name(const astring &name, netlist_setup_t &setup, const astring &icname);
|
||||
netlist_device_t *net_create_device_by_classname(const astring &classname, netlist_setup_t &setup, const astring &icname);
|
||||
netlist_device_t *net_create_device_by_name(const astring &name, netlist_setup_t &setup, const astring &icname);
|
||||
|
||||
|
||||
#endif /* NLBASE_H_ */
|
||||
|
@ -16,8 +16,6 @@
|
||||
// SETUP
|
||||
//============================================================
|
||||
|
||||
#define USE_LINKED_LIST (1)
|
||||
|
||||
#define USE_DELEGATES (0)
|
||||
/*
|
||||
* The next options needs -Wno-pmf-conversions to compile and gcc
|
||||
@ -29,8 +27,6 @@
|
||||
// Next if enabled adds 20% performance ... but is not guaranteed to be absolutely timing correct.
|
||||
#define USE_DEACTIVE_DEVICE (0)
|
||||
|
||||
#define OUTPUT_MAX_CONNECTIONS (48)
|
||||
|
||||
// Use nano-second resolution - Sufficient for now
|
||||
#define NETLIST_INTERNAL_RES (U64(1000000000))
|
||||
#define NETLIST_DIV_BITS (0)
|
||||
|
@ -60,7 +60,7 @@ void netlist_parser::netdev_param()
|
||||
void netlist_parser::netdev_const(const astring &dev_name)
|
||||
{
|
||||
astring name;
|
||||
net_device_t *dev;
|
||||
netlist_device_t *dev;
|
||||
astring paramfq;
|
||||
double val;
|
||||
|
||||
@ -80,7 +80,7 @@ void netlist_parser::netdev_const(const astring &dev_name)
|
||||
void netlist_parser::netdev_device(const astring &dev_type)
|
||||
{
|
||||
astring devname;
|
||||
net_device_t *dev;
|
||||
netlist_device_t *dev;
|
||||
int cnt;
|
||||
|
||||
skipws();
|
||||
@ -96,12 +96,12 @@ void netlist_parser::netdev_device(const astring &dev_type)
|
||||
skipws();
|
||||
astring output_name = getname2(',', ')');
|
||||
NL_VERBOSE_OUT(("Parser: ID: %s %s\n", output_name.cstr(), dev->m_inputs.item(cnt)->cstr()));
|
||||
m_setup.register_link(*dev->m_inputs.item(cnt), output_name);
|
||||
m_setup.register_link(*dev->m_terminals.item(cnt), output_name);
|
||||
skipws();
|
||||
cnt++;
|
||||
}
|
||||
if (cnt != dev->m_inputs.count() && !dev->variable_input_count())
|
||||
fatalerror("netlist: input count mismatch for %s - expected %d found %d\n", devname.cstr(), dev->m_inputs.count(), cnt);
|
||||
if (cnt != dev->m_terminals.count() && !dev->variable_input_count())
|
||||
fatalerror("netlist: input count mismatch for %s - expected %d found %d\n", devname.cstr(), dev->m_terminals.count(), cnt);
|
||||
if (dev->variable_input_count())
|
||||
{
|
||||
NL_VERBOSE_OUT(("variable inputs %s: %d\n", dev->name().cstr(), cnt));
|
||||
|
@ -46,7 +46,7 @@ netlist_setup_t::~netlist_setup_t()
|
||||
m_terminals.reset();
|
||||
}
|
||||
|
||||
net_device_t *netlist_setup_t::register_dev(net_device_t *dev)
|
||||
netlist_device_t *netlist_setup_t::register_dev(netlist_device_t *dev)
|
||||
{
|
||||
if (!(m_devices.add(dev->name(), dev, false)==TMERR_NONE))
|
||||
fatalerror("Error adding %s to device list\n", dev->name().cstr());
|
||||
@ -71,7 +71,7 @@ static void remove_start_with(T &hm, astring &sw)
|
||||
|
||||
void netlist_setup_t::remove_dev(const astring &name)
|
||||
{
|
||||
net_device_t *dev = m_devices.find(name);
|
||||
netlist_device_t *dev = m_devices.find(name);
|
||||
astring temp = name;
|
||||
if (dev == NULL)
|
||||
fatalerror("Device %s does not exist\n", name.cstr());
|
||||
@ -87,7 +87,7 @@ void netlist_setup_t::remove_dev(const astring &name)
|
||||
|
||||
void netlist_setup_t::register_callback(const astring &devname, netlist_output_delegate delegate)
|
||||
{
|
||||
NETLIB_NAME(netdev_analog_callback) *dev = (NETLIB_NAME(netdev_analog_callback) *) m_devices.find(devname);
|
||||
NETLIB_NAME(analog_callback) *dev = (NETLIB_NAME(analog_callback) *) m_devices.find(devname);
|
||||
if (dev == NULL)
|
||||
fatalerror("did not find device %s\n", devname.cstr());
|
||||
dev->register_callback(delegate);
|
||||
@ -99,27 +99,28 @@ void netlist_setup_t::register_alias(const astring &alias, const astring &out)
|
||||
fatalerror("Error adding alias %s to alias list\n", alias.cstr());
|
||||
}
|
||||
|
||||
void netlist_setup_t::register_output(netlist_core_device_t &dev, netlist_core_device_t &upd_dev, const astring &name, net_output_t &out)
|
||||
void netlist_setup_t::register_output(netlist_core_device_t &dev, netlist_core_device_t &upd_dev, const astring &name, netlist_output_t &out)
|
||||
{
|
||||
NL_VERBOSE_OUT(("out %s\n", name.cstr()));
|
||||
NL_VERBOSE_OUT(("output %s\n", name.cstr()));
|
||||
astring temp = dev.name();
|
||||
temp.cat(".");
|
||||
temp.cat(name);
|
||||
out.init_terminal(upd_dev);
|
||||
if (!(m_terminals.add(temp, &out, false)==TMERR_NONE))
|
||||
fatalerror("Error adding output %s to output list\n", name.cstr());
|
||||
fatalerror("Error adding output %s to terminal list\n", name.cstr());
|
||||
}
|
||||
|
||||
void netlist_setup_t::register_input(net_device_t &dev, netlist_core_device_t &upd_dev, const astring &name, net_input_t &inp, net_input_t::net_input_state type)
|
||||
void netlist_setup_t::register_input(netlist_device_t &dev, netlist_core_device_t &upd_dev, const astring &name, netlist_input_t &inp, netlist_input_t::net_input_state type)
|
||||
{
|
||||
NL_VERBOSE_OUT(("input %s\n", name.cstr()));
|
||||
astring temp = dev.name();
|
||||
temp.cat(".");
|
||||
temp.cat(name);
|
||||
inp.init_input(upd_dev, type);
|
||||
dev.m_inputs.add(temp);
|
||||
/* add to list of terminals so logic devices are supported in parser */
|
||||
dev.m_terminals.add(temp);
|
||||
if (!(m_terminals.add(temp, &inp, false) == TMERR_NONE))
|
||||
fatalerror("Error adding input %s to input list\n", name.cstr());
|
||||
fatalerror("Error adding input %s to terminal list\n", name.cstr());
|
||||
}
|
||||
|
||||
void netlist_setup_t::register_link(const astring &sin, const astring &sout)
|
||||
@ -131,7 +132,7 @@ void netlist_setup_t::register_link(const astring &sin, const astring &sout)
|
||||
}
|
||||
|
||||
|
||||
void netlist_setup_t::register_param(const astring &name, net_param_t *param)
|
||||
void netlist_setup_t::register_param(const astring &name, netlist_param_t *param)
|
||||
{
|
||||
astring temp = param->netdev().name();
|
||||
temp.cat(".");
|
||||
@ -149,16 +150,16 @@ const astring &netlist_setup_t::resolve_alias(const astring &name) const
|
||||
return name;
|
||||
}
|
||||
|
||||
net_output_t *netlist_setup_t::find_output_exact(const astring &outname_in)
|
||||
netlist_output_t *netlist_setup_t::find_output_exact(const astring &outname_in)
|
||||
{
|
||||
net_terminal_t *term = m_terminals.find(outname_in);
|
||||
return dynamic_cast<net_output_t *>(term);
|
||||
netlist_terminal_t *term = m_terminals.find(outname_in);
|
||||
return dynamic_cast<netlist_output_t *>(term);
|
||||
}
|
||||
|
||||
net_output_t &netlist_setup_t::find_output(const astring &outname_in)
|
||||
netlist_output_t &netlist_setup_t::find_output(const astring &outname_in)
|
||||
{
|
||||
const astring &outname = resolve_alias(outname_in);
|
||||
net_output_t *ret;
|
||||
netlist_output_t *ret;
|
||||
|
||||
ret = find_output_exact(outname);
|
||||
/* look for default */
|
||||
@ -175,10 +176,10 @@ net_output_t &netlist_setup_t::find_output(const astring &outname_in)
|
||||
return *ret;
|
||||
}
|
||||
|
||||
net_param_t &netlist_setup_t::find_param(const astring ¶m_in)
|
||||
netlist_param_t &netlist_setup_t::find_param(const astring ¶m_in)
|
||||
{
|
||||
const astring &outname = resolve_alias(param_in);
|
||||
net_param_t *ret;
|
||||
netlist_param_t *ret;
|
||||
|
||||
ret = m_params.find(outname);
|
||||
if (ret == NULL)
|
||||
@ -195,16 +196,15 @@ void netlist_setup_t::resolve_inputs(void)
|
||||
{
|
||||
const astring *sout = entry->object();
|
||||
astring sin = entry->tag();
|
||||
net_input_t *in = dynamic_cast<net_input_t *>(m_terminals.find(sin));
|
||||
netlist_input_t *in = dynamic_cast<netlist_input_t *>(m_terminals.find(sin));
|
||||
|
||||
if (in == NULL)
|
||||
fatalerror("Unable to find %s\n", sin.cstr());
|
||||
|
||||
net_output_t &out = find_output(sout->cstr());
|
||||
if (out.object_type(net_output_t::SIGNAL_MASK) == net_output_t::SIGNAL_ANALOG
|
||||
&& in->object_type(net_output_t::SIGNAL_MASK) == net_output_t::SIGNAL_DIGITAL)
|
||||
netlist_output_t &out = find_output(sout->cstr());
|
||||
if (out.isFamily(netlist_terminal_t::ANALOG) && in->isFamily(netlist_terminal_t::LOGIC))
|
||||
{
|
||||
netdev_a_to_d_proxy *proxy = new netdev_a_to_d_proxy(*in);
|
||||
nld_a_to_d_proxy *proxy = new nld_a_to_d_proxy(*in);
|
||||
astring x = "";
|
||||
x.printf("proxy_ad_%d", proxy_cnt++);
|
||||
|
||||
@ -215,11 +215,10 @@ void netlist_setup_t::resolve_inputs(void)
|
||||
out.net().register_con(proxy->m_I);
|
||||
|
||||
}
|
||||
else if (out.object_type(net_output_t::SIGNAL_MASK) == net_output_t::SIGNAL_DIGITAL
|
||||
&& in->object_type(net_output_t::SIGNAL_MASK) == net_output_t::SIGNAL_ANALOG)
|
||||
else if (out.isFamily(netlist_terminal_t::LOGIC) && in->isFamily(netlist_terminal_t::ANALOG))
|
||||
{
|
||||
//printf("here 1\n");
|
||||
netdev_d_to_a_proxy *proxy = new netdev_d_to_a_proxy(out);
|
||||
nld_d_to_a_proxy *proxy = new nld_d_to_a_proxy(out);
|
||||
astring x = "";
|
||||
x.printf("proxy_da_%d", proxy_cnt++);
|
||||
proxy->init(*this, x.cstr());
|
||||
@ -237,17 +236,17 @@ void netlist_setup_t::resolve_inputs(void)
|
||||
/* find the main clock ... */
|
||||
for (tagmap_devices_t::entry_t *entry = m_devices.first(); entry != NULL; entry = m_devices.next(entry))
|
||||
{
|
||||
net_device_t *dev = entry->object();
|
||||
if (dynamic_cast<NETLIB_NAME(netdev_mainclock)*>(dev) != NULL)
|
||||
netlist_device_t *dev = entry->object();
|
||||
if (dynamic_cast<NETLIB_NAME(mainclock)*>(dev) != NULL)
|
||||
{
|
||||
m_netlist.set_mainclock_dev(dynamic_cast<NETLIB_NAME(netdev_mainclock)*>(dev));
|
||||
m_netlist.set_mainclock_dev(dynamic_cast<NETLIB_NAME(mainclock)*>(dev));
|
||||
}
|
||||
}
|
||||
|
||||
/* print all outputs */
|
||||
for (tagmap_terminal_t::entry_t *entry = m_terminals.first(); entry != NULL; entry = m_terminals.next(entry))
|
||||
{
|
||||
ATTR_UNUSED net_output_t *out = dynamic_cast<net_output_t *>(entry->object());
|
||||
ATTR_UNUSED netlist_output_t *out = dynamic_cast<netlist_output_t *>(entry->object());
|
||||
//if (out != NULL)
|
||||
//VERBOSE_OUT(("%s %d\n", out->netdev()->name(), *out->Q_ptr()));
|
||||
}
|
||||
@ -265,7 +264,7 @@ void netlist_setup_t::step_devices_once(void)
|
||||
|
||||
for (tagmap_devices_t::entry_t *entry = m_devices.first(); entry != NULL; entry = m_devices.next(entry))
|
||||
{
|
||||
net_device_t *dev = entry->object();
|
||||
netlist_device_t *dev = entry->object();
|
||||
dev->update_dev();
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ ATTR_COLD void NETLIST_NAME(_name)(netlist_setup_t &netlist) \
|
||||
// FIXME: Clean this up
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
class NETLIB_NAME(netdev_analog_callback);
|
||||
//class NETLIB_NAME(analog_callback);
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// netlist_setup_t
|
||||
@ -58,28 +58,28 @@ class netlist_setup_t
|
||||
{
|
||||
public:
|
||||
|
||||
typedef tagmap_t<net_device_t *, 393> tagmap_devices_t;
|
||||
typedef tagmap_t<netlist_device_t *, 393> tagmap_devices_t;
|
||||
typedef tagmap_t<const astring *, 393> tagmap_astring_t;
|
||||
typedef tagmap_t<net_param_t *, 393> tagmap_param_t;
|
||||
typedef tagmap_t<net_terminal_t *, 393> tagmap_terminal_t;
|
||||
typedef tagmap_t<netlist_param_t *, 393> tagmap_param_t;
|
||||
typedef tagmap_t<netlist_terminal_t *, 393> tagmap_terminal_t;
|
||||
|
||||
netlist_setup_t(netlist_base_t &netlist);
|
||||
~netlist_setup_t();
|
||||
|
||||
netlist_base_t &netlist() { return m_netlist; }
|
||||
|
||||
net_device_t *register_dev(net_device_t *dev);
|
||||
netlist_device_t *register_dev(netlist_device_t *dev);
|
||||
void remove_dev(const astring &name);
|
||||
|
||||
void register_output(netlist_core_device_t &dev, netlist_core_device_t &upd_dev, const astring &name, net_output_t &out);
|
||||
void register_input(net_device_t &dev, netlist_core_device_t &upd_dev, const astring &name, net_input_t &inp, net_input_t::net_input_state type);
|
||||
void register_output(netlist_core_device_t &dev, netlist_core_device_t &upd_dev, const astring &name, netlist_output_t &out);
|
||||
void register_input(netlist_device_t &dev, netlist_core_device_t &upd_dev, const astring &name, netlist_input_t &inp, netlist_input_t::net_input_state type);
|
||||
void register_alias(const astring &alias, const astring &out);
|
||||
void register_param(const astring &sname, net_param_t *param);
|
||||
void register_param(const astring &sname, netlist_param_t *param);
|
||||
|
||||
void register_link(const astring &sin, const astring &sout);
|
||||
|
||||
net_output_t &find_output(const astring &outname_in);
|
||||
net_param_t &find_param(const astring ¶m_in);
|
||||
netlist_output_t &find_output(const astring &outname_in);
|
||||
netlist_param_t &find_param(const astring ¶m_in);
|
||||
|
||||
void register_callback(const astring &devname, netlist_output_delegate delegate);
|
||||
|
||||
@ -105,7 +105,7 @@ private:
|
||||
tagmap_param_t m_params;
|
||||
tagmap_astring_t m_links;
|
||||
|
||||
net_output_t *find_output_exact(const astring &outname_in);
|
||||
netlist_output_t *find_output_exact(const astring &outname_in);
|
||||
const astring &resolve_alias(const astring &name) const;
|
||||
};
|
||||
|
||||
|
@ -515,9 +515,9 @@ public:
|
||||
required_device<dac_device> m_dac; /* just to have a sound device */
|
||||
|
||||
// sub devices
|
||||
netlist_mame_device::required_output<logic_output_t> m_srst;
|
||||
netlist_mame_device::required_output<analog_output_t> m_p_V0;
|
||||
netlist_mame_device::required_output<analog_output_t> m_p_V1;
|
||||
netlist_mame_device::required_output<netlist_logic_output_t> m_srst;
|
||||
netlist_mame_device::required_output<netlist_analog_output_t> m_p_V0;
|
||||
netlist_mame_device::required_output<netlist_analog_output_t> m_p_V1;
|
||||
netlist_mame_device::required_param m_sw1a;
|
||||
netlist_mame_device::required_param m_sw1b;
|
||||
netlist_mame_device::required_param m_p_R0;
|
||||
|
Loading…
Reference in New Issue
Block a user