summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/netlist
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/netlist')
-rw-r--r--src/emu/netlist/devices/net_lib.c566
-rw-r--r--src/emu/netlist/devices/net_lib.h2
-rw-r--r--src/emu/netlist/devices/nld_7400.h40
-rw-r--r--src/emu/netlist/devices/nld_7402.h6
-rw-r--r--src/emu/netlist/devices/nld_7404.c12
-rw-r--r--src/emu/netlist/devices/nld_7404.h8
-rw-r--r--src/emu/netlist/devices/nld_7410.h8
-rw-r--r--src/emu/netlist/devices/nld_7420.h10
-rw-r--r--src/emu/netlist/devices/nld_7425.h10
-rw-r--r--src/emu/netlist/devices/nld_7427.h8
-rw-r--r--src/emu/netlist/devices/nld_7430.h18
-rw-r--r--src/emu/netlist/devices/nld_7474.c76
-rw-r--r--src/emu/netlist/devices/nld_7474.h28
-rw-r--r--src/emu/netlist/devices/nld_7483.c67
-rw-r--r--src/emu/netlist/devices/nld_7483.h58
-rw-r--r--src/emu/netlist/devices/nld_7486.c13
-rw-r--r--src/emu/netlist/devices/nld_7486.h12
-rw-r--r--src/emu/netlist/devices/nld_7490.c62
-rw-r--r--src/emu/netlist/devices/nld_7490.h28
-rw-r--r--src/emu/netlist/devices/nld_7493.c74
-rw-r--r--src/emu/netlist/devices/nld_7493.h28
-rw-r--r--src/emu/netlist/devices/nld_9316.c227
-rw-r--r--src/emu/netlist/devices/nld_9316.h60
-rw-r--r--src/emu/netlist/devices/nld_legacy.c246
-rw-r--r--src/emu/netlist/devices/nld_legacy.h82
-rw-r--r--src/emu/netlist/devices/nld_log.c26
-rw-r--r--src/emu/netlist/devices/nld_log.h26
-rw-r--r--src/emu/netlist/devices/nld_ne555.c105
-rw-r--r--src/emu/netlist/devices/nld_ne555.h23
-rw-r--r--src/emu/netlist/devices/nld_signal.h4
-rw-r--r--src/emu/netlist/devices/nld_solver.c503
-rw-r--r--src/emu/netlist/devices/nld_solver.h74
-rw-r--r--src/emu/netlist/devices/nld_system.c30
-rw-r--r--src/emu/netlist/devices/nld_system.h22
-rw-r--r--src/emu/netlist/devices/nld_twoterm.c274
-rw-r--r--src/emu/netlist/devices/nld_twoterm.h376
-rw-r--r--src/emu/netlist/nl_base.c687
-rw-r--r--src/emu/netlist/nl_base.h682
-rw-r--r--src/emu/netlist/nl_config.h7
-rw-r--r--src/emu/netlist/nl_lists.h143
-rw-r--r--src/emu/netlist/nl_parser.c150
-rw-r--r--src/emu/netlist/nl_parser.h6
-rw-r--r--src/emu/netlist/nl_setup.c804
-rw-r--r--src/emu/netlist/nl_setup.h90
-rw-r--r--src/emu/netlist/nl_time.h72
-rw-r--r--src/emu/netlist/nl_util.h42
-rw-r--r--src/emu/netlist/pstate.c26
-rw-r--r--src/emu/netlist/pstate.h72
-rw-r--r--src/emu/netlist/pstring.c386
-rw-r--r--src/emu/netlist/pstring.h307
50 files changed, 3333 insertions, 3353 deletions
diff --git a/src/emu/netlist/devices/net_lib.c b/src/emu/netlist/devices/net_lib.c
index 81a375bfd27..fdb376d6340 100644
--- a/src/emu/netlist/devices/net_lib.c
+++ b/src/emu/netlist/devices/net_lib.c
@@ -53,164 +53,164 @@
NETLIB_START(nic7448)
{
- register_sub(sub, "sub");
-
- register_subalias("A0", sub.m_A0);
- register_subalias("A1", sub.m_A1);
- register_subalias("A2", sub.m_A2);
- register_subalias("A3", sub.m_A3);
- register_input("LTQ", m_LTQ);
- register_input("BIQ", m_BIQ);
- register_subalias("RBIQ",sub.m_RBIQ);
-
- register_subalias("a", sub.m_a);
- register_subalias("b", sub.m_b);
- register_subalias("c", sub.m_c);
- register_subalias("d", sub.m_d);
- register_subalias("e", sub.m_e);
- register_subalias("f", sub.m_f);
- register_subalias("g", sub.m_g);
+ register_sub(sub, "sub");
+
+ register_subalias("A0", sub.m_A0);
+ register_subalias("A1", sub.m_A1);
+ register_subalias("A2", sub.m_A2);
+ register_subalias("A3", sub.m_A3);
+ register_input("LTQ", m_LTQ);
+ register_input("BIQ", m_BIQ);
+ register_subalias("RBIQ",sub.m_RBIQ);
+
+ register_subalias("a", sub.m_a);
+ register_subalias("b", sub.m_b);
+ register_subalias("c", sub.m_c);
+ register_subalias("d", sub.m_d);
+ register_subalias("e", sub.m_e);
+ register_subalias("f", sub.m_f);
+ register_subalias("g", sub.m_g);
}
NETLIB_UPDATE(nic7448)
{
- if (INPLOGIC(m_BIQ) && !INPLOGIC(m_LTQ))
- {
- sub.update_outputs(8);
- }
- else if (!INPLOGIC(m_BIQ))
- {
- sub.update_outputs(15);
- }
-
- if (!INPLOGIC(m_BIQ) || (INPLOGIC(m_BIQ) && !INPLOGIC(m_LTQ)))
- {
- sub.m_A0.inactivate();
- sub.m_A1.inactivate();
- sub.m_A2.inactivate();
- sub.m_A3.inactivate();
- sub.m_RBIQ.inactivate();
- } else {
- sub.m_RBIQ.activate();
- sub.m_A3.activate();
- sub.m_A2.activate();
- sub.m_A1.activate();
- sub.m_A0.activate();
- sub.update();
- }
+ if (INPLOGIC(m_BIQ) && !INPLOGIC(m_LTQ))
+ {
+ sub.update_outputs(8);
+ }
+ else if (!INPLOGIC(m_BIQ))
+ {
+ sub.update_outputs(15);
+ }
+
+ if (!INPLOGIC(m_BIQ) || (INPLOGIC(m_BIQ) && !INPLOGIC(m_LTQ)))
+ {
+ sub.m_A0.inactivate();
+ sub.m_A1.inactivate();
+ sub.m_A2.inactivate();
+ sub.m_A3.inactivate();
+ sub.m_RBIQ.inactivate();
+ } else {
+ sub.m_RBIQ.activate();
+ sub.m_A3.activate();
+ sub.m_A2.activate();
+ sub.m_A1.activate();
+ sub.m_A0.activate();
+ sub.update();
+ }
}
NETLIB_START(nic7448_sub)
{
- m_state = 0;
-
- register_input("A0", m_A0);
- register_input("A1", m_A1);
- register_input("A2", m_A2);
- register_input("A3", m_A3);
- register_input("RBIQ", m_RBIQ);
-
- register_output("a", m_a);
- register_output("b", m_b);
- register_output("c", m_c);
- register_output("d", m_d);
- register_output("e", m_e);
- register_output("f", m_f);
- register_output("g", m_g);
-
- save(NAME(m_state));
+ m_state = 0;
+
+ register_input("A0", m_A0);
+ register_input("A1", m_A1);
+ register_input("A2", m_A2);
+ register_input("A3", m_A3);
+ register_input("RBIQ", m_RBIQ);
+
+ register_output("a", m_a);
+ register_output("b", m_b);
+ register_output("c", m_c);
+ register_output("d", m_d);
+ register_output("e", m_e);
+ register_output("f", m_f);
+ register_output("g", m_g);
+
+ save(NAME(m_state));
}
NETLIB_UPDATE(nic7448_sub)
{
- UINT8 v;
+ UINT8 v;
- v = (INPLOGIC(m_A0) << 0) | (INPLOGIC(m_A1) << 1) | (INPLOGIC(m_A2) << 2) | (INPLOGIC(m_A3) << 3);
- if ((!INPLOGIC(m_RBIQ) && (v==0)))
- v = 15;
- update_outputs(v);
+ v = (INPLOGIC(m_A0) << 0) | (INPLOGIC(m_A1) << 1) | (INPLOGIC(m_A2) << 2) | (INPLOGIC(m_A3) << 3);
+ if ((!INPLOGIC(m_RBIQ) && (v==0)))
+ v = 15;
+ update_outputs(v);
}
NETLIB_FUNC_VOID(nic7448_sub, update_outputs, (UINT8 v))
{
- assert(v<16);
- if (v != m_state)
- {
- OUTLOGIC(m_a, tab7448[v][0], NLTIME_FROM_NS(100));
- OUTLOGIC(m_b, tab7448[v][1], NLTIME_FROM_NS(100));
- OUTLOGIC(m_c, tab7448[v][2], NLTIME_FROM_NS(100));
- OUTLOGIC(m_d, tab7448[v][3], NLTIME_FROM_NS(100));
- OUTLOGIC(m_e, tab7448[v][4], NLTIME_FROM_NS(100));
- OUTLOGIC(m_f, tab7448[v][5], NLTIME_FROM_NS(100));
- OUTLOGIC(m_g, tab7448[v][6], NLTIME_FROM_NS(100));
- m_state = v;
- }
+ assert(v<16);
+ if (v != m_state)
+ {
+ OUTLOGIC(m_a, tab7448[v][0], NLTIME_FROM_NS(100));
+ OUTLOGIC(m_b, tab7448[v][1], NLTIME_FROM_NS(100));
+ OUTLOGIC(m_c, tab7448[v][2], NLTIME_FROM_NS(100));
+ OUTLOGIC(m_d, tab7448[v][3], NLTIME_FROM_NS(100));
+ OUTLOGIC(m_e, tab7448[v][4], NLTIME_FROM_NS(100));
+ OUTLOGIC(m_f, tab7448[v][5], NLTIME_FROM_NS(100));
+ OUTLOGIC(m_g, tab7448[v][6], NLTIME_FROM_NS(100));
+ m_state = v;
+ }
}
const UINT8 NETLIB_NAME(nic7448_sub)::tab7448[16][7] =
{
- { 1, 1, 1, 1, 1, 1, 0 }, /* 00 - not blanked ! */
- { 0, 1, 1, 0, 0, 0, 0 }, /* 01 */
- { 1, 1, 0, 1, 1, 0, 1 }, /* 02 */
- { 1, 1, 1, 1, 0, 0, 1 }, /* 03 */
- { 0, 1, 1, 0, 0, 1, 1 }, /* 04 */
- { 1, 0, 1, 1, 0, 1, 1 }, /* 05 */
- { 0, 0, 1, 1, 1, 1, 1 }, /* 06 */
- { 1, 1, 1, 0, 0, 0, 0 }, /* 07 */
- { 1, 1, 1, 1, 1, 1, 1 }, /* 08 */
- { 1, 1, 1, 0, 0, 1, 1 }, /* 09 */
- { 0, 0, 0, 1, 1, 0, 1 }, /* 10 */
- { 0, 0, 1, 1, 0, 0, 1 }, /* 11 */
- { 0, 1, 0, 0, 0, 1, 1 }, /* 12 */
- { 1, 0, 0, 1, 0, 1, 1 }, /* 13 */
- { 0, 0, 0, 1, 1, 1, 1 }, /* 14 */
- { 0, 0, 0, 0, 0, 0, 0 }, /* 15 */
+ { 1, 1, 1, 1, 1, 1, 0 }, /* 00 - not blanked ! */
+ { 0, 1, 1, 0, 0, 0, 0 }, /* 01 */
+ { 1, 1, 0, 1, 1, 0, 1 }, /* 02 */
+ { 1, 1, 1, 1, 0, 0, 1 }, /* 03 */
+ { 0, 1, 1, 0, 0, 1, 1 }, /* 04 */
+ { 1, 0, 1, 1, 0, 1, 1 }, /* 05 */
+ { 0, 0, 1, 1, 1, 1, 1 }, /* 06 */
+ { 1, 1, 1, 0, 0, 0, 0 }, /* 07 */
+ { 1, 1, 1, 1, 1, 1, 1 }, /* 08 */
+ { 1, 1, 1, 0, 0, 1, 1 }, /* 09 */
+ { 0, 0, 0, 1, 1, 0, 1 }, /* 10 */
+ { 0, 0, 1, 1, 0, 0, 1 }, /* 11 */
+ { 0, 1, 0, 0, 0, 1, 1 }, /* 12 */
+ { 1, 0, 0, 1, 0, 1, 1 }, /* 13 */
+ { 0, 0, 0, 1, 1, 1, 1 }, /* 14 */
+ { 0, 0, 0, 0, 0, 0, 0 }, /* 15 */
};
NETLIB_START(nic7450)
{
- register_input("I1", m_I0);
- register_input("I2", m_I1);
- register_input("I3", m_I2);
- register_input("I4", m_I3);
- register_output("Q", m_Q);
+ register_input("I1", m_I0);
+ register_input("I2", m_I1);
+ register_input("I3", m_I2);
+ register_input("I4", m_I3);
+ register_output("Q", m_Q);
}
NETLIB_UPDATE(nic7450)
{
- m_I0.activate();
- m_I1.activate();
- m_I2.activate();
- m_I3.activate();
- UINT8 t1 = INPLOGIC(m_I0) & INPLOGIC(m_I1);
- UINT8 t2 = INPLOGIC(m_I2) & INPLOGIC(m_I3);
+ m_I0.activate();
+ m_I1.activate();
+ m_I2.activate();
+ m_I3.activate();
+ UINT8 t1 = INPLOGIC(m_I0) & INPLOGIC(m_I1);
+ UINT8 t2 = INPLOGIC(m_I2) & INPLOGIC(m_I3);
#if 0
- UINT8 t = (t1 | t2) ^ 1;
- OUTLOGIC(m_Q, t, t ? NLTIME_FROM_NS(22) : NLTIME_FROM_NS(15));
+ UINT8 t = (t1 | t2) ^ 1;
+ OUTLOGIC(m_Q, t, t ? NLTIME_FROM_NS(22) : NLTIME_FROM_NS(15));
#else
- const netlist_time times[2] = { NLTIME_FROM_NS(22), NLTIME_FROM_NS(15) };
-
- UINT8 res = 0;
- if (t1 ^ 1)
- {
- if (t2 ^ 1)
- {
- res = 1;
- }
- else
- {
- m_I0.inactivate();
- m_I1.inactivate();
- }
- } else {
- if (t2 ^ 1)
- {
- m_I2.inactivate();
- m_I3.inactivate();
- }
- }
- OUTLOGIC(m_Q, res, times[1 - res]);// ? 22000 : 15000);
+ const netlist_time times[2] = { NLTIME_FROM_NS(22), NLTIME_FROM_NS(15) };
+
+ UINT8 res = 0;
+ if (t1 ^ 1)
+ {
+ if (t2 ^ 1)
+ {
+ res = 1;
+ }
+ else
+ {
+ m_I0.inactivate();
+ m_I1.inactivate();
+ }
+ } else {
+ if (t2 ^ 1)
+ {
+ m_I2.inactivate();
+ m_I3.inactivate();
+ }
+ }
+ OUTLOGIC(m_Q, res, times[1 - res]);// ? 22000 : 15000);
#endif
}
@@ -221,122 +221,122 @@ NETLIB_UPDATE(nic7450)
NETLIB_START(nic74107Asub)
{
- register_input("CLK", m_clk, netlist_input_t::STATE_INP_HL);
- register_output("Q", m_Q);
- register_output("QQ", m_QQ);
+ register_input("CLK", m_clk, netlist_input_t::STATE_INP_HL);
+ register_output("Q", m_Q);
+ register_output("QQ", m_QQ);
- m_Q.initial(0);
- m_QQ.initial(1);
+ m_Q.initial(0);
+ m_QQ.initial(1);
- save(NAME(m_Q1));
- save(NAME(m_Q2));
- save(NAME(m_F));
+ save(NAME(m_Q1));
+ save(NAME(m_Q2));
+ save(NAME(m_F));
}
NETLIB_START(nic74107A)
{
- register_sub(sub, "sub");
+ register_sub(sub, "sub");
- register_subalias("CLK", sub.m_clk);
- register_input("J", m_J);
- register_input("K", m_K);
- register_input("CLRQ", m_clrQ);
- register_subalias("Q", sub.m_Q);
- register_subalias("QQ", sub.m_QQ);
+ register_subalias("CLK", sub.m_clk);
+ register_input("J", m_J);
+ register_input("K", m_K);
+ register_input("CLRQ", m_clrQ);
+ register_subalias("Q", sub.m_Q);
+ register_subalias("QQ", sub.m_QQ);
- sub.m_Q.initial(0);
- sub.m_QQ.initial(1);
+ sub.m_Q.initial(0);
+ sub.m_QQ.initial(1);
}
ATTR_HOT inline void NETLIB_NAME(nic74107Asub)::newstate(const netlist_sig_t state)
{
- const netlist_time delay[2] = { NLTIME_FROM_NS(40), NLTIME_FROM_NS(25) };
+ const netlist_time delay[2] = { NLTIME_FROM_NS(40), NLTIME_FROM_NS(25) };
#if 1
- OUTLOGIC(m_Q, state, delay[state ^ 1]);
- OUTLOGIC(m_QQ, state ^ 1, delay[state]);
+ OUTLOGIC(m_Q, state, delay[state ^ 1]);
+ OUTLOGIC(m_QQ, state ^ 1, delay[state]);
#else
- if (state != Q.new_Q())
- {
- Q.setToNoCheck(state, delay[1-state]);
- QQ.setToNoCheck(1-state, delay[state]);
- }
+ if (state != Q.new_Q())
+ {
+ Q.setToNoCheck(state, delay[1-state]);
+ QQ.setToNoCheck(1-state, delay[state]);
+ }
#endif
}
NETLIB_UPDATE(nic74107Asub)
{
- {
- const netlist_sig_t t = m_Q.net().new_Q();
- newstate((!t & m_Q1) | (t & m_Q2) | m_F);
- if (!m_Q1)
- m_clk.inactivate();
- }
+ {
+ const netlist_sig_t t = m_Q.net().new_Q();
+ newstate((!t & m_Q1) | (t & m_Q2) | m_F);
+ if (!m_Q1)
+ m_clk.inactivate();
+ }
}
NETLIB_UPDATE(nic74107A)
{
- if (INPLOGIC(m_J) & INPLOGIC(m_K))
- {
- sub.m_Q1 = 1;
- sub.m_Q2 = 0;
- sub.m_F = 0;
- }
- else if (!INPLOGIC(m_J) & INPLOGIC(m_K))
- {
- sub.m_Q1 = 0;
- sub.m_Q2 = 0;
- sub.m_F = 0;
- }
- else if (INPLOGIC(m_J) & !INPLOGIC(m_K))
- {
- sub.m_Q1 = 0;
- sub.m_Q2 = 0;
- sub.m_F = 1;
- }
- else
- {
- sub.m_Q1 = 0;
- sub.m_Q2 = 1;
- sub.m_F = 0;
- sub.m_clk.inactivate();
- }
- if (!INPLOGIC(m_clrQ))
- {
- sub.m_clk.inactivate();
- sub.newstate(0);
- }
- else if (!sub.m_Q2)
- sub.m_clk.activate_hl();
- //if (!sub.m_Q2 & INPLOGIC(m_clrQ))
- // sub.m_clk.activate_hl();
+ if (INPLOGIC(m_J) & INPLOGIC(m_K))
+ {
+ sub.m_Q1 = 1;
+ sub.m_Q2 = 0;
+ sub.m_F = 0;
+ }
+ else if (!INPLOGIC(m_J) & INPLOGIC(m_K))
+ {
+ sub.m_Q1 = 0;
+ sub.m_Q2 = 0;
+ sub.m_F = 0;
+ }
+ else if (INPLOGIC(m_J) & !INPLOGIC(m_K))
+ {
+ sub.m_Q1 = 0;
+ sub.m_Q2 = 0;
+ sub.m_F = 1;
+ }
+ else
+ {
+ sub.m_Q1 = 0;
+ sub.m_Q2 = 1;
+ sub.m_F = 0;
+ sub.m_clk.inactivate();
+ }
+ if (!INPLOGIC(m_clrQ))
+ {
+ sub.m_clk.inactivate();
+ sub.newstate(0);
+ }
+ else if (!sub.m_Q2)
+ sub.m_clk.activate_hl();
+ //if (!sub.m_Q2 & INPLOGIC(m_clrQ))
+ // sub.m_clk.activate_hl();
}
NETLIB_START(nic74153)
{
- register_input("A1", m_I[0]);
- register_input("A2", m_I[1]);
- register_input("A3", m_I[2]);
- register_input("A4", m_I[3]);
- register_input("A", m_A);
- register_input("B", m_B);
- register_input("GA", m_GA);
-
- register_output("AY", m_AY);
+ register_input("A1", m_I[0]);
+ register_input("A2", m_I[1]);
+ register_input("A3", m_I[2]);
+ register_input("A4", m_I[3]);
+ register_input("A", m_A);
+ register_input("B", m_B);
+ register_input("GA", m_GA);
+
+ register_output("AY", m_AY);
}
NETLIB_UPDATE(nic74153)
{
- const netlist_time delay[2] = { NLTIME_FROM_NS(23), NLTIME_FROM_NS(18) };
- if (!INPLOGIC(m_GA))
- {
- UINT8 chan = (INPLOGIC(m_A) | (INPLOGIC(m_B)<<1));
- UINT8 t = INPLOGIC(m_I[chan]);
- OUTLOGIC(m_AY, t, delay[t] ); /* data to y only, FIXME */
- }
- else
- {
- OUTLOGIC(m_AY, 0, delay[0]);
- }
+ const netlist_time delay[2] = { NLTIME_FROM_NS(23), NLTIME_FROM_NS(18) };
+ if (!INPLOGIC(m_GA))
+ {
+ UINT8 chan = (INPLOGIC(m_A) | (INPLOGIC(m_B)<<1));
+ UINT8 t = INPLOGIC(m_I[chan]);
+ OUTLOGIC(m_AY, t, delay[t] ); /* data to y only, FIXME */
+ }
+ else
+ {
+ OUTLOGIC(m_AY, 0, delay[0]);
+ }
}
@@ -346,93 +346,91 @@ NETLIB_UPDATE(nic74153)
netlist_factory::netlist_factory()
{
-
}
netlist_factory::~netlist_factory()
{
- for (list_t::entry_t *e = m_list.first(); e != NULL; e = m_list.next(e))
- {
- net_device_t_base_factory *p = e->object();
- delete p;
- }
- m_list.reset();
+ for (list_t::entry_t *e = m_list.first(); e != NULL; e = m_list.next(e))
+ {
+ net_device_t_base_factory *p = e->object();
+ delete p;
+ }
+ m_list.reset();
}
void netlist_factory::initialize()
{
- ENTRY(R, NETDEV_R)
- ENTRY(POT, NETDEV_POT)
- ENTRY(C, NETDEV_C)
- ENTRY(D, NETDEV_D)
- ENTRY(VCVS, NETDEV_VCVS)
- ENTRY(VCCS, NETDEV_VCCS)
- ENTRY(QPNP_switch, NETDEV_QPNP)
- ENTRY(QNPN_switch, NETDEV_QNPN)
- 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(logD, NETDEV_LOGD)
- ENTRY(clock, NETDEV_CLOCK)
- ENTRY(mainclock, NETDEV_MAINCLOCK)
- ENTRY(solver, NETDEV_SOLVER)
- ENTRY(nicMultiSwitch, NETDEV_SWITCH2)
- ENTRY(nicRSFF, NETDEV_RSFF)
- ENTRY(nicMixer8, NETDEV_MIXER)
- ENTRY(7400, TTL_7400_NAND)
- ENTRY(7402, TTL_7402_NOR)
- ENTRY(nic7404, TTL_7404_INVERT)
- ENTRY(7410, TTL_7410_NAND)
- ENTRY(7420, TTL_7420_NAND)
- ENTRY(7425, TTL_7425_NOR)
- ENTRY(7427, TTL_7427_NOR)
- ENTRY(7430, TTL_7430_NAND)
- ENTRY(nic7450, TTL_7450_ANDORINVERT)
- ENTRY(7486, TTL_7486_XOR)
- ENTRY(nic7448, TTL_7448)
- ENTRY(7474, TTL_7474)
- ENTRY(7483, TTL_7483)
- ENTRY(7490, TTL_7490)
- ENTRY(7493, TTL_7493)
- ENTRY(nic74107, TTL_74107)
- ENTRY(nic74107A, TTL_74107A)
- ENTRY(nic74153, TTL_74153)
- ENTRY(9316, TTL_9316)
- ENTRY(NE555, NETDEV_NE555)
- ENTRY(nicNE555N_MSTABLE, NE555N_MSTABLE)
+ ENTRY(R, NETDEV_R)
+ ENTRY(POT, NETDEV_POT)
+ ENTRY(C, NETDEV_C)
+ ENTRY(D, NETDEV_D)
+ ENTRY(VCVS, NETDEV_VCVS)
+ ENTRY(VCCS, NETDEV_VCCS)
+ ENTRY(QPNP_switch, NETDEV_QPNP)
+ ENTRY(QNPN_switch, NETDEV_QNPN)
+ 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(logD, NETDEV_LOGD)
+ ENTRY(clock, NETDEV_CLOCK)
+ ENTRY(mainclock, NETDEV_MAINCLOCK)
+ ENTRY(solver, NETDEV_SOLVER)
+ ENTRY(nicMultiSwitch, NETDEV_SWITCH2)
+ ENTRY(nicRSFF, NETDEV_RSFF)
+ ENTRY(nicMixer8, NETDEV_MIXER)
+ ENTRY(7400, TTL_7400_NAND)
+ ENTRY(7402, TTL_7402_NOR)
+ ENTRY(nic7404, TTL_7404_INVERT)
+ ENTRY(7410, TTL_7410_NAND)
+ ENTRY(7420, TTL_7420_NAND)
+ ENTRY(7425, TTL_7425_NOR)
+ ENTRY(7427, TTL_7427_NOR)
+ ENTRY(7430, TTL_7430_NAND)
+ ENTRY(nic7450, TTL_7450_ANDORINVERT)
+ ENTRY(7486, TTL_7486_XOR)
+ ENTRY(nic7448, TTL_7448)
+ ENTRY(7474, TTL_7474)
+ ENTRY(7483, TTL_7483)
+ ENTRY(7490, TTL_7490)
+ ENTRY(7493, TTL_7493)
+ ENTRY(nic74107, TTL_74107)
+ ENTRY(nic74107A, TTL_74107A)
+ ENTRY(nic74153, TTL_74153)
+ ENTRY(9316, TTL_9316)
+ ENTRY(NE555, NETDEV_NE555)
+ ENTRY(nicNE555N_MSTABLE, NE555N_MSTABLE)
}
netlist_device_t *netlist_factory::new_device_by_classname(const pstring &classname, netlist_setup_t &setup) const
{
- for (list_t::entry_t *e = m_list.first(); e != NULL; e = m_list.next(e))
- {
- net_device_t_base_factory *p = e->object();
- if (strcmp(p->classname(), classname) == 0)
- {
- netlist_device_t *ret = p->Create();
- return ret;
- }
- p++;
- }
- setup.netlist().xfatalerror("Class %s not found!\n", classname.cstr());
- return NULL; // appease code analysis
+ for (list_t::entry_t *e = m_list.first(); e != NULL; e = m_list.next(e))
+ {
+ net_device_t_base_factory *p = e->object();
+ if (strcmp(p->classname(), classname) == 0)
+ {
+ netlist_device_t *ret = p->Create();
+ return ret;
+ }
+ p++;
+ }
+ setup.netlist().xfatalerror("Class %s not found!\n", classname.cstr());
+ return NULL; // appease code analysis
}
netlist_device_t *netlist_factory::new_device_by_name(const pstring &name, netlist_setup_t &setup) const
{
- for (list_t::entry_t *e = m_list.first(); e != NULL; e = m_list.next(e))
- {
- net_device_t_base_factory *p = e->object();
- if (strcmp(p->name(), name) == 0)
- {
- netlist_device_t *ret = p->Create();
- return ret;
- }
- p++;
- }
- setup.netlist().xfatalerror("Class %s not found!\n", name.cstr());
- return NULL; // appease code analysis
+ for (list_t::entry_t *e = m_list.first(); e != NULL; e = m_list.next(e))
+ {
+ net_device_t_base_factory *p = e->object();
+ if (strcmp(p->name(), name) == 0)
+ {
+ netlist_device_t *ret = p->Create();
+ return ret;
+ }
+ p++;
+ }
+ setup.netlist().xfatalerror("Class %s not found!\n", name.cstr());
+ return NULL; // appease code analysis
}
-
diff --git a/src/emu/netlist/devices/net_lib.h b/src/emu/netlist/devices/net_lib.h
index da225bc3f1e..2c696588f97 100644
--- a/src/emu/netlist/devices/net_lib.h
+++ b/src/emu/netlist/devices/net_lib.h
@@ -136,7 +136,7 @@ NETLIB_DEVICE(nic7450,
*/
NETLIB_SUBDEVICE(nic74107Asub,
- netlist_ttl_input_t m_clk;
+ netlist_ttl_input_t m_clk;
netlist_ttl_output_t m_Q;
netlist_ttl_output_t m_QQ;
diff --git a/src/emu/netlist/devices/nld_7400.h b/src/emu/netlist/devices/nld_7400.h
index 809ea87334e..76af3043c4b 100644
--- a/src/emu/netlist/devices/nld_7400.h
+++ b/src/emu/netlist/devices/nld_7400.h
@@ -43,34 +43,34 @@ NETLIB_SIGNAL(7400, 2, 0, 0);
NETLIB_DEVICE(7400pin,
- NETLIB_NAME(7400) m_1;
- NETLIB_NAME(7400) m_2;
- NETLIB_NAME(7400) m_3;
- NETLIB_NAME(7400) m_4;
+ NETLIB_NAME(7400) m_1;
+ NETLIB_NAME(7400) m_2;
+ NETLIB_NAME(7400) m_3;
+ NETLIB_NAME(7400) m_4;
);
inline NETLIB_START(7400pin)
{
- register_sub(m_1, "1");
- register_sub(m_2, "2");
- register_sub(m_3, "3");
- register_sub(m_4, "4");
+ register_sub(m_1, "1");
+ register_sub(m_2, "2");
+ register_sub(m_3, "3");
+ register_sub(m_4, "4");
- register_subalias("1", m_1.m_i[0]);
- register_subalias("2", m_1.m_i[1]);
- register_subalias("3", m_1.m_Q);
+ register_subalias("1", m_1.m_i[0]);
+ register_subalias("2", m_1.m_i[1]);
+ register_subalias("3", m_1.m_Q);
- register_subalias("4", m_2.m_i[0]);
- register_subalias("5", m_2.m_i[1]);
- register_subalias("6", m_2.m_Q);
+ register_subalias("4", m_2.m_i[0]);
+ register_subalias("5", m_2.m_i[1]);
+ register_subalias("6", m_2.m_Q);
- register_subalias("9", m_3.m_i[0]);
- register_subalias("10", m_3.m_i[1]);
- register_subalias("8", m_3.m_Q);
+ register_subalias("9", m_3.m_i[0]);
+ register_subalias("10", m_3.m_i[1]);
+ register_subalias("8", m_3.m_Q);
- register_subalias("12", m_4.m_i[0]);
- register_subalias("13", m_4.m_i[1]);
- register_subalias("11", m_4.m_Q);
+ register_subalias("12", m_4.m_i[0]);
+ register_subalias("13", m_4.m_i[1]);
+ register_subalias("11", m_4.m_Q);
}
#endif /* NLD_7400_H_ */
diff --git a/src/emu/netlist/devices/nld_7402.h b/src/emu/netlist/devices/nld_7402.h
index 0d5990478c0..63a91d25ce8 100644
--- a/src/emu/netlist/devices/nld_7402.h
+++ b/src/emu/netlist/devices/nld_7402.h
@@ -35,9 +35,9 @@
#include "nld_signal.h"
#define TTL_7402_NOR(_name, _I1, _I2) \
- NET_REGISTER_DEV(7402, _name) \
- NET_CONNECT(_name, A, _I1) \
- NET_CONNECT(_name, B, _I2)
+ NET_REGISTER_DEV(7402, _name) \
+ NET_CONNECT(_name, A, _I1) \
+ NET_CONNECT(_name, B, _I2)
NETLIB_SIGNAL(7402, 2, 1, 0);
diff --git a/src/emu/netlist/devices/nld_7404.c b/src/emu/netlist/devices/nld_7404.c
index e285eb54f06..42b7e341c39 100644
--- a/src/emu/netlist/devices/nld_7404.c
+++ b/src/emu/netlist/devices/nld_7404.c
@@ -7,14 +7,14 @@
NETLIB_START(nic7404)
{
- register_input("A", m_I);
- register_output("Q", m_Q);
- m_Q.initial(1);
+ register_input("A", m_I);
+ register_output("Q", m_Q);
+ m_Q.initial(1);
}
NETLIB_UPDATE(nic7404)
{
- static const netlist_time delay[2] = { NLTIME_FROM_NS(15), NLTIME_FROM_NS(22) };
- UINT8 t = (INPLOGIC(m_I)) ^ 1;
- OUTLOGIC(m_Q, t, delay[t]);
+ static const netlist_time delay[2] = { NLTIME_FROM_NS(15), NLTIME_FROM_NS(22) };
+ UINT8 t = (INPLOGIC(m_I)) ^ 1;
+ OUTLOGIC(m_Q, t, delay[t]);
}
diff --git a/src/emu/netlist/devices/nld_7404.h b/src/emu/netlist/devices/nld_7404.h
index 15c16652f75..5432a1dd9f7 100644
--- a/src/emu/netlist/devices/nld_7404.h
+++ b/src/emu/netlist/devices/nld_7404.h
@@ -33,12 +33,12 @@
#include "nld_signal.h"
NETLIB_DEVICE(nic7404,
- netlist_ttl_input_t m_I;
- netlist_ttl_output_t m_Q;
+ netlist_ttl_input_t m_I;
+ netlist_ttl_output_t m_Q;
);
#define TTL_7404_INVERT(_name, _A) \
- NET_REGISTER_DEV(nic7404, _name) \
- NET_CONNECT(_name, A, _A)
+ NET_REGISTER_DEV(nic7404, _name) \
+ NET_CONNECT(_name, A, _A)
#endif /* NLD_7404_H_ */
diff --git a/src/emu/netlist/devices/nld_7410.h b/src/emu/netlist/devices/nld_7410.h
index 860d5fcab21..b8a1c55aee6 100644
--- a/src/emu/netlist/devices/nld_7410.h
+++ b/src/emu/netlist/devices/nld_7410.h
@@ -35,10 +35,10 @@
#include "nld_signal.h"
#define TTL_7410_NAND(_name, _I1, _I2, _I3) \
- NET_REGISTER_DEV(7410, _name) \
- NET_CONNECT(_name, A, _I1) \
- NET_CONNECT(_name, B, _I2) \
- NET_CONNECT(_name, C, _I3)
+ NET_REGISTER_DEV(7410, _name) \
+ NET_CONNECT(_name, A, _I1) \
+ NET_CONNECT(_name, B, _I2) \
+ NET_CONNECT(_name, C, _I3)
NETLIB_SIGNAL(7410, 3, 0, 0);
diff --git a/src/emu/netlist/devices/nld_7420.h b/src/emu/netlist/devices/nld_7420.h
index 5ff5bd12ac5..6ac7c477743 100644
--- a/src/emu/netlist/devices/nld_7420.h
+++ b/src/emu/netlist/devices/nld_7420.h
@@ -36,11 +36,11 @@
#include "nld_signal.h"
#define TTL_7420_NAND(_name, _I1, _I2, _I3, _I4) \
- 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)
+ 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(7420, 4, 0, 0);
diff --git a/src/emu/netlist/devices/nld_7425.h b/src/emu/netlist/devices/nld_7425.h
index 5e2fff4f946..26ae9b8476c 100644
--- a/src/emu/netlist/devices/nld_7425.h
+++ b/src/emu/netlist/devices/nld_7425.h
@@ -39,11 +39,11 @@
#include "nld_signal.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)
+ 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);
diff --git a/src/emu/netlist/devices/nld_7427.h b/src/emu/netlist/devices/nld_7427.h
index c5a8ede870a..9863acc9f5d 100644
--- a/src/emu/netlist/devices/nld_7427.h
+++ b/src/emu/netlist/devices/nld_7427.h
@@ -35,10 +35,10 @@
#include "nld_signal.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)
+ 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);
diff --git a/src/emu/netlist/devices/nld_7430.h b/src/emu/netlist/devices/nld_7430.h
index 783e8bb6816..2d9ff87f385 100644
--- a/src/emu/netlist/devices/nld_7430.h
+++ b/src/emu/netlist/devices/nld_7430.h
@@ -40,15 +40,15 @@
#include "nld_signal.h"
#define TTL_7430_NAND(_name, _I1, _I2, _I3, _I4, _I5, _I6, _I7, _I8) \
- NET_REGISTER_DEV(7430, _name) \
- NET_CONNECT(_name, A, _I1) \
- NET_CONNECT(_name, B, _I2) \
- NET_CONNECT(_name, C, _I3) \
- NET_CONNECT(_name, D, _I4) \
- NET_CONNECT(_name, E, _I5) \
- NET_CONNECT(_name, F, _I6) \
- NET_CONNECT(_name, G, _I7) \
- NET_CONNECT(_name, H, _I8)
+ NET_REGISTER_DEV(7430, _name) \
+ NET_CONNECT(_name, A, _I1) \
+ NET_CONNECT(_name, B, _I2) \
+ NET_CONNECT(_name, C, _I3) \
+ NET_CONNECT(_name, D, _I4) \
+ NET_CONNECT(_name, E, _I5) \
+ NET_CONNECT(_name, F, _I6) \
+ NET_CONNECT(_name, G, _I7) \
+ NET_CONNECT(_name, H, _I8)
NETLIB_SIGNAL(7430, 8, 0, 0);
diff --git a/src/emu/netlist/devices/nld_7474.c b/src/emu/netlist/devices/nld_7474.c
index cd9e64e41af..ef23fe819c5 100644
--- a/src/emu/netlist/devices/nld_7474.c
+++ b/src/emu/netlist/devices/nld_7474.c
@@ -7,63 +7,63 @@
ATTR_HOT inline void NETLIB_NAME(7474sub)::newstate(const UINT8 state)
{
- static const netlist_time delay[2] = { NLTIME_FROM_NS(25), NLTIME_FROM_NS(40) };
- OUTLOGIC(m_Q, state, delay[state]);
- OUTLOGIC(m_QQ, !state, delay[!state]);
+ static const netlist_time delay[2] = { NLTIME_FROM_NS(25), NLTIME_FROM_NS(40) };
+ OUTLOGIC(m_Q, state, delay[state]);
+ OUTLOGIC(m_QQ, !state, delay[!state]);
}
NETLIB_UPDATE(7474sub)
{
- //if (!INP_LAST(m_clk) & INP(m_clk))
- {
- newstate(m_nextD);
- m_clk.inactivate();
- }
+ //if (!INP_LAST(m_clk) & INP(m_clk))
+ {
+ newstate(m_nextD);
+ m_clk.inactivate();
+ }
}
NETLIB_UPDATE(7474)
{
- if (!INPLOGIC(m_preQ))
- {
- sub.newstate(1);
- sub.m_clk.inactivate();
- m_D.inactivate();
- }
- else if (!INPLOGIC(m_clrQ))
- {
- sub.newstate(0);
- sub.m_clk.inactivate();
- m_D.inactivate();
- }
- else
- {
- m_D.activate();
- sub.m_nextD = INPLOGIC(m_D);
- sub.m_clk.activate_lh();
- }
+ if (!INPLOGIC(m_preQ))
+ {
+ sub.newstate(1);
+ sub.m_clk.inactivate();
+ m_D.inactivate();
+ }
+ else if (!INPLOGIC(m_clrQ))
+ {
+ sub.newstate(0);
+ sub.m_clk.inactivate();
+ m_D.inactivate();
+ }
+ else
+ {
+ m_D.activate();
+ sub.m_nextD = INPLOGIC(m_D);
+ sub.m_clk.activate_lh();
+ }
}
NETLIB_START(7474)
{
- register_sub(sub, "sub");
+ register_sub(sub, "sub");
- register_subalias("CLK", sub.m_clk);
- register_input("D", m_D);
- register_input("CLRQ", m_clrQ);
- register_input("PREQ", m_preQ);
+ register_subalias("CLK", sub.m_clk);
+ register_input("D", m_D);
+ register_input("CLRQ", m_clrQ);
+ register_input("PREQ", m_preQ);
- register_subalias("Q", sub.m_Q);
- register_subalias("QQ", sub.m_QQ);
+ register_subalias("Q", sub.m_Q);
+ register_subalias("QQ", sub.m_QQ);
}
NETLIB_START(7474sub)
{
- register_input("CLK", m_clk, netlist_input_t::STATE_INP_LH);
+ register_input("CLK", m_clk, netlist_input_t::STATE_INP_LH);
- register_output("Q", m_Q);
- register_output("QQ", m_QQ);
+ register_output("Q", m_Q);
+ register_output("QQ", m_QQ);
- m_Q.initial(1);
- m_QQ.initial(0);
+ m_Q.initial(1);
+ m_QQ.initial(0);
}
diff --git a/src/emu/netlist/devices/nld_7474.h b/src/emu/netlist/devices/nld_7474.h
index 91375f479e6..31cf80e0d6d 100644
--- a/src/emu/netlist/devices/nld_7474.h
+++ b/src/emu/netlist/devices/nld_7474.h
@@ -45,28 +45,28 @@
#include "nld_signal.h"
#define TTL_7474(_name, _CLK, _D, _CLRQ, _PREQ) \
- NET_REGISTER_DEV(7474, _name) \
- NET_CONNECT(_name, CLK, _CLK) \
- NET_CONNECT(_name, D, _D) \
- NET_CONNECT(_name, CLRQ, _CLRQ) \
- NET_CONNECT(_name, PREQ, _PREQ)
+ NET_REGISTER_DEV(7474, _name) \
+ NET_CONNECT(_name, CLK, _CLK) \
+ NET_CONNECT(_name, D, _D) \
+ NET_CONNECT(_name, CLRQ, _CLRQ) \
+ NET_CONNECT(_name, PREQ, _PREQ)
NETLIB_SUBDEVICE(7474sub,
- netlist_ttl_input_t m_clk;
+ netlist_ttl_input_t m_clk;
- UINT8 m_nextD;
- netlist_ttl_output_t m_Q;
- netlist_ttl_output_t m_QQ;
+ UINT8 m_nextD;
+ netlist_ttl_output_t m_Q;
+ netlist_ttl_output_t m_QQ;
- ATTR_HOT inline void newstate(const UINT8 state);
+ ATTR_HOT inline void newstate(const UINT8 state);
);
NETLIB_DEVICE(7474,
- NETLIB_NAME(7474sub) sub;
+ NETLIB_NAME(7474sub) sub;
- netlist_ttl_input_t m_D;
- netlist_ttl_input_t m_clrQ;
- netlist_ttl_input_t m_preQ;
+ netlist_ttl_input_t m_D;
+ netlist_ttl_input_t m_clrQ;
+ netlist_ttl_input_t m_preQ;
);
diff --git a/src/emu/netlist/devices/nld_7483.c b/src/emu/netlist/devices/nld_7483.c
index eca61846241..81624326d6e 100644
--- a/src/emu/netlist/devices/nld_7483.c
+++ b/src/emu/netlist/devices/nld_7483.c
@@ -7,42 +7,41 @@
NETLIB_START(7483)
{
- m_lastr = 0;
-
- register_input("A1", m_A1);
- register_input("A2", m_A2);
- register_input("A3", m_A3);
- register_input("A4", m_A4);
- register_input("B1", m_B1);
- register_input("B2", m_B2);
- register_input("B3", m_B3);
- register_input("B4", m_B4);
- register_input("C0", m_C0);
-
- register_output("SA", m_SA);
- register_output("SB", m_SB);
- register_output("SC", m_SC);
- register_output("SD", m_SD);
- register_output("C4", m_C4);
-
- save(NAME(m_lastr));
+ m_lastr = 0;
+
+ register_input("A1", m_A1);
+ register_input("A2", m_A2);
+ register_input("A3", m_A3);
+ register_input("A4", m_A4);
+ register_input("B1", m_B1);
+ register_input("B2", m_B2);
+ register_input("B3", m_B3);
+ register_input("B4", m_B4);
+ register_input("C0", m_C0);
+
+ register_output("SA", m_SA);
+ register_output("SB", m_SB);
+ register_output("SC", m_SC);
+ register_output("SD", m_SD);
+ register_output("C4", m_C4);
+
+ save(NAME(m_lastr));
}
NETLIB_UPDATE(7483)
{
- UINT8 a = (INPLOGIC(m_A1) << 0) | (INPLOGIC(m_A2) << 1) | (INPLOGIC(m_A3) << 2) | (INPLOGIC(m_A4) << 3);
- UINT8 b = (INPLOGIC(m_B1) << 0) | (INPLOGIC(m_B2) << 1) | (INPLOGIC(m_B3) << 2) | (INPLOGIC(m_B4) << 3);
-
- UINT8 r = a + b + INPLOGIC(m_C0);
-
- if (r != m_lastr)
- {
- m_lastr = r;
- OUTLOGIC(m_SA, (r >> 0) & 1, NLTIME_FROM_NS(23));
- OUTLOGIC(m_SB, (r >> 1) & 1, NLTIME_FROM_NS(23));
- OUTLOGIC(m_SC, (r >> 2) & 1, NLTIME_FROM_NS(23));
- OUTLOGIC(m_SD, (r >> 3) & 1, NLTIME_FROM_NS(23));
- OUTLOGIC(m_C4, (r >> 4) & 1, NLTIME_FROM_NS(23));
- }
+ UINT8 a = (INPLOGIC(m_A1) << 0) | (INPLOGIC(m_A2) << 1) | (INPLOGIC(m_A3) << 2) | (INPLOGIC(m_A4) << 3);
+ UINT8 b = (INPLOGIC(m_B1) << 0) | (INPLOGIC(m_B2) << 1) | (INPLOGIC(m_B3) << 2) | (INPLOGIC(m_B4) << 3);
+
+ UINT8 r = a + b + INPLOGIC(m_C0);
+
+ if (r != m_lastr)
+ {
+ m_lastr = r;
+ OUTLOGIC(m_SA, (r >> 0) & 1, NLTIME_FROM_NS(23));
+ OUTLOGIC(m_SB, (r >> 1) & 1, NLTIME_FROM_NS(23));
+ OUTLOGIC(m_SC, (r >> 2) & 1, NLTIME_FROM_NS(23));
+ OUTLOGIC(m_SD, (r >> 3) & 1, NLTIME_FROM_NS(23));
+ OUTLOGIC(m_C4, (r >> 4) & 1, NLTIME_FROM_NS(23));
+ }
}
-
diff --git a/src/emu/netlist/devices/nld_7483.h b/src/emu/netlist/devices/nld_7483.h
index 5900b33cc05..2f457435847 100644
--- a/src/emu/netlist/devices/nld_7483.h
+++ b/src/emu/netlist/devices/nld_7483.h
@@ -7,16 +7,16 @@
*
* +--------------+
* A4 |1 ++ 16| B4
- * Ʃ3 |2 15| Ʃ3
+ * ??3 |2 15| ??3
* A3 |3 14| C4
* B3 |4 7483 13| C0
* VCC |5 12| GND
- * Ʃ3 |6 11| B1
+ * ??3 |6 11| B1
* B2 |7 10| A1
- * A2 |8 9| Ʃ3
+ * A2 |8 9| ??3
* +--------------+
*
- * Æ© = (A + B + C) & 0x0f
+ * ?? = (A + B + C) & 0x0f
*
* C4 = (A + B + C) > 15 ? 1 : 0
*
@@ -30,35 +30,35 @@
#include "../nl_base.h"
#define TTL_7483(_name, _A1, _A2, _A3, _A4, _B1, _B2, _B3, _B4, _CI) \
- NET_REGISTER_DEV(7483, _name) \
- NET_CONNECT(_name, A1, _A1) \
- NET_CONNECT(_name, A2, _A2) \
- NET_CONNECT(_name, A3, _A3) \
- NET_CONNECT(_name, A4, _A4) \
- NET_CONNECT(_name, B1, _B1) \
- NET_CONNECT(_name, B2, _B2) \
- NET_CONNECT(_name, B3, _B3) \
- NET_CONNECT(_name, B4, _B4) \
- NET_CONNECT(_name, C0, _CI)
+ NET_REGISTER_DEV(7483, _name) \
+ NET_CONNECT(_name, A1, _A1) \
+ NET_CONNECT(_name, A2, _A2) \
+ NET_CONNECT(_name, A3, _A3) \
+ NET_CONNECT(_name, A4, _A4) \
+ NET_CONNECT(_name, B1, _B1) \
+ NET_CONNECT(_name, B2, _B2) \
+ NET_CONNECT(_name, B3, _B3) \
+ NET_CONNECT(_name, B4, _B4) \
+ NET_CONNECT(_name, C0, _CI)
NETLIB_DEVICE(7483,
- netlist_ttl_input_t m_C0;
- 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_C0;
+ 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;
- UINT8 m_lastr;
+ UINT8 m_lastr;
- 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_C4;
+ 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_C4;
);
diff --git a/src/emu/netlist/devices/nld_7486.c b/src/emu/netlist/devices/nld_7486.c
index 55fa712e9ad..fcd94c9f321 100644
--- a/src/emu/netlist/devices/nld_7486.c
+++ b/src/emu/netlist/devices/nld_7486.c
@@ -7,15 +7,14 @@
NETLIB_START(7486)
{
- register_input("A", m_A);
- register_input("B", m_B);
- register_output("Q", m_Q);
+ register_input("A", m_A);
+ register_input("B", m_B);
+ register_output("Q", m_Q);
}
NETLIB_UPDATE(7486)
{
- static const netlist_time delay[2] = { NLTIME_FROM_NS(15), NLTIME_FROM_NS(22) };
- UINT8 t = INPLOGIC(m_A) ^ INPLOGIC(m_B);
- OUTLOGIC(m_Q, t, delay[t]);
+ static const netlist_time delay[2] = { NLTIME_FROM_NS(15), NLTIME_FROM_NS(22) };
+ UINT8 t = INPLOGIC(m_A) ^ INPLOGIC(m_B);
+ OUTLOGIC(m_Q, t, delay[t]);
}
-
diff --git a/src/emu/netlist/devices/nld_7486.h b/src/emu/netlist/devices/nld_7486.h
index b00d8905ae3..d4fd3d5cda9 100644
--- a/src/emu/netlist/devices/nld_7486.h
+++ b/src/emu/netlist/devices/nld_7486.h
@@ -35,13 +35,13 @@
#include "nld_signal.h"
#define TTL_7486_XOR(_name, _A, _B) \
- NET_REGISTER_DEV(7486, _name) \
- NET_CONNECT(_name, A, _A) \
- NET_CONNECT(_name, B, _B)
+ NET_REGISTER_DEV(7486, _name) \
+ NET_CONNECT(_name, A, _A) \
+ NET_CONNECT(_name, B, _B)
NETLIB_DEVICE(7486,
- netlist_ttl_input_t m_A;
- netlist_ttl_input_t m_B;
- netlist_ttl_output_t m_Q;
+ netlist_ttl_input_t m_A;
+ netlist_ttl_input_t m_B;
+ netlist_ttl_output_t m_Q;
);
#endif /* NLD_7486_H_ */
diff --git a/src/emu/netlist/devices/nld_7490.c b/src/emu/netlist/devices/nld_7490.c
index 48b8bbc6b5c..cc84a1389c3 100644
--- a/src/emu/netlist/devices/nld_7490.c
+++ b/src/emu/netlist/devices/nld_7490.c
@@ -7,47 +7,47 @@
NETLIB_START(7490)
{
- m_cnt = 0;
+ m_cnt = 0;
- register_input("CLK", m_clk);
- register_input("R1", m_R1);
- register_input("R2", m_R2);
- register_input("R91", m_R91);
- register_input("R92", m_R92);
+ register_input("CLK", m_clk);
+ register_input("R1", m_R1);
+ register_input("R2", m_R2);
+ register_input("R91", m_R91);
+ register_input("R92", m_R92);
- register_output("QA", m_Q[0]);
- register_output("QB", m_Q[1]);
- register_output("QC", m_Q[2]);
- register_output("QD", m_Q[3]);
+ register_output("QA", m_Q[0]);
+ register_output("QB", m_Q[1]);
+ register_output("QC", m_Q[2]);
+ register_output("QD", m_Q[3]);
- save(NAME(m_cnt));
+ save(NAME(m_cnt));
}
NETLIB_UPDATE(7490)
{
- if (INPLOGIC(m_R91) & INPLOGIC(m_R92))
- {
- m_cnt = 9;
- update_outputs();
- }
- else if (INPLOGIC(m_R1) & INPLOGIC(m_R2))
- {
- m_cnt = 0;
- update_outputs();
- }
- else if (INP_HL(m_clk))
- {
- m_cnt++;
- if (m_cnt >= 10)
- m_cnt = 0;
- update_outputs();
- }
+ if (INPLOGIC(m_R91) & INPLOGIC(m_R92))
+ {
+ m_cnt = 9;
+ update_outputs();
+ }
+ else if (INPLOGIC(m_R1) & INPLOGIC(m_R2))
+ {
+ m_cnt = 0;
+ update_outputs();
+ }
+ else if (INP_HL(m_clk))
+ {
+ m_cnt++;
+ if (m_cnt >= 10)
+ m_cnt = 0;
+ update_outputs();
+ }
}
NETLIB_FUNC_VOID(7490, update_outputs, (void))
{
- const netlist_time delay[4] = { NLTIME_FROM_NS(18), NLTIME_FROM_NS(36), NLTIME_FROM_NS(54), NLTIME_FROM_NS(72) };
- for (int i=0; i<4; i++)
- OUTLOGIC(m_Q[i], (m_cnt >> i) & 1, delay[i]);
+ const netlist_time delay[4] = { NLTIME_FROM_NS(18), NLTIME_FROM_NS(36), NLTIME_FROM_NS(54), NLTIME_FROM_NS(72) };
+ for (int i=0; i<4; i++)
+ OUTLOGIC(m_Q[i], (m_cnt >> i) & 1, delay[i]);
}
diff --git a/src/emu/netlist/devices/nld_7490.h b/src/emu/netlist/devices/nld_7490.h
index a5380a21cae..288f2cc8864 100644
--- a/src/emu/netlist/devices/nld_7490.h
+++ b/src/emu/netlist/devices/nld_7490.h
@@ -58,26 +58,26 @@
#include "../nl_base.h"
#define TTL_7490(_name, _CLK, _R1, _R2, _R91, _R92) \
- NET_REGISTER_DEV(7490, _name) \
- NET_CONNECT(_name, CLK, _CLK) \
- NET_CONNECT(_name, R1, _R1) \
- NET_CONNECT(_name, R2, _R2) \
- NET_CONNECT(_name, R91, _R91) \
- NET_CONNECT(_name, R92, _R92)
+ NET_REGISTER_DEV(7490, _name) \
+ NET_CONNECT(_name, CLK, _CLK) \
+ NET_CONNECT(_name, R1, _R1) \
+ NET_CONNECT(_name, R2, _R2) \
+ NET_CONNECT(_name, R91, _R91) \
+ NET_CONNECT(_name, R92, _R92)
NETLIB_DEVICE(7490,
- ATTR_HOT void update_outputs();
+ ATTR_HOT void update_outputs();
- 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;
+ 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;
+ UINT8 m_cnt;
- netlist_ttl_output_t m_Q[4];
+ netlist_ttl_output_t m_Q[4];
);
#endif /* NLD_7490_H_ */
diff --git a/src/emu/netlist/devices/nld_7493.c b/src/emu/netlist/devices/nld_7493.c
index a8c218de5a8..ac633df081b 100644
--- a/src/emu/netlist/devices/nld_7493.c
+++ b/src/emu/netlist/devices/nld_7493.c
@@ -7,59 +7,59 @@
NETLIB_START(7493)
{
- register_sub(A, "A");
- register_sub(B, "B");
- register_sub(C, "C");
- register_sub(D, "D");
+ register_sub(A, "A");
+ register_sub(B, "B");
+ register_sub(C, "C");
+ register_sub(D, "D");
- register_subalias("CLKA", A.m_I);
- register_subalias("CLKB", B.m_I);
- register_input("R1", m_R1);
- register_input("R2", m_R2);
+ register_subalias("CLKA", A.m_I);
+ register_subalias("CLKB", B.m_I);
+ register_input("R1", m_R1);
+ register_input("R2", m_R2);
- register_subalias("QA", A.m_Q);
- register_subalias("QB", B.m_Q);
- register_subalias("QC", C.m_Q);
- register_subalias("QD", D.m_Q);
+ register_subalias("QA", A.m_Q);
+ register_subalias("QB", B.m_Q);
+ register_subalias("QC", C.m_Q);
+ register_subalias("QD", D.m_Q);
- register_link_internal(C, C.m_I, B.m_Q, netlist_input_t::STATE_INP_HL);
- register_link_internal(D, D.m_I, C.m_Q, netlist_input_t::STATE_INP_HL);
+ register_link_internal(C, C.m_I, B.m_Q, netlist_input_t::STATE_INP_HL);
+ register_link_internal(D, D.m_I, C.m_Q, netlist_input_t::STATE_INP_HL);
}
NETLIB_START(7493ff)
{
- m_reset = 0;
+ m_reset = 0;
- register_input("CLK", m_I, netlist_input_t::STATE_INP_HL);
- register_output("Q", m_Q);
+ register_input("CLK", m_I, netlist_input_t::STATE_INP_HL);
+ register_output("Q", m_Q);
- save(NAME(m_reset));
+ save(NAME(m_reset));
}
NETLIB_UPDATE(7493ff)
{
- if (m_reset == 0)
- OUTLOGIC(m_Q, !m_Q.net().new_Q(), NLTIME_FROM_NS(18));
+ if (m_reset == 0)
+ OUTLOGIC(m_Q, !m_Q.net().new_Q(), NLTIME_FROM_NS(18));
}
NETLIB_UPDATE(7493)
{
- netlist_sig_t r = INPLOGIC(m_R1) & INPLOGIC(m_R2);
+ netlist_sig_t r = INPLOGIC(m_R1) & INPLOGIC(m_R2);
- if (r)
- {
- A.m_reset = B.m_reset = C.m_reset = D.m_reset = 1;
- A.m_I.inactivate();
- B.m_I.inactivate();
- OUTLOGIC(A.m_Q, 0, NLTIME_FROM_NS(40));
- OUTLOGIC(B.m_Q, 0, NLTIME_FROM_NS(40));
- OUTLOGIC(C.m_Q, 0, NLTIME_FROM_NS(40));
- OUTLOGIC(D.m_Q, 0, NLTIME_FROM_NS(40));
- }
- else
- {
- A.m_reset = B.m_reset = C.m_reset = D.m_reset = 0;
- A.m_I.activate_hl();
- B.m_I.activate_hl();
- }
+ if (r)
+ {
+ A.m_reset = B.m_reset = C.m_reset = D.m_reset = 1;
+ A.m_I.inactivate();
+ B.m_I.inactivate();
+ OUTLOGIC(A.m_Q, 0, NLTIME_FROM_NS(40));
+ OUTLOGIC(B.m_Q, 0, NLTIME_FROM_NS(40));
+ OUTLOGIC(C.m_Q, 0, NLTIME_FROM_NS(40));
+ OUTLOGIC(D.m_Q, 0, NLTIME_FROM_NS(40));
+ }
+ else
+ {
+ A.m_reset = B.m_reset = C.m_reset = D.m_reset = 0;
+ A.m_I.activate_hl();
+ B.m_I.activate_hl();
+ }
}
diff --git a/src/emu/netlist/devices/nld_7493.h b/src/emu/netlist/devices/nld_7493.h
index 7cd6e59988b..cc961c389f1 100644
--- a/src/emu/netlist/devices/nld_7493.h
+++ b/src/emu/netlist/devices/nld_7493.h
@@ -60,27 +60,27 @@
#include "../nl_base.h"
#define TTL_7493(_name, _CLKA, _CLKB, _R1, _R2) \
- NET_REGISTER_DEV(7493, _name) \
- NET_CONNECT(_name, CLKA, _CLKA) \
- NET_CONNECT(_name, CLKB, _CLKB) \
- NET_CONNECT(_name, R1, _R1) \
- NET_CONNECT(_name, R2, _R2)
+ NET_REGISTER_DEV(7493, _name) \
+ NET_CONNECT(_name, CLKA, _CLKA) \
+ NET_CONNECT(_name, CLKB, _CLKB) \
+ NET_CONNECT(_name, R1, _R1) \
+ NET_CONNECT(_name, R2, _R2)
NETLIB_SUBDEVICE(7493ff,
- netlist_ttl_input_t m_I;
- netlist_ttl_output_t m_Q;
+ netlist_ttl_input_t m_I;
+ netlist_ttl_output_t m_Q;
- UINT8 m_reset;
+ UINT8 m_reset;
);
NETLIB_DEVICE(7493,
- netlist_ttl_input_t m_R1;
- netlist_ttl_input_t m_R2;
+ netlist_ttl_input_t m_R1;
+ netlist_ttl_input_t m_R2;
- NETLIB_NAME(7493ff) A;
- NETLIB_NAME(7493ff) B;
- NETLIB_NAME(7493ff) C;
- NETLIB_NAME(7493ff) D;
+ NETLIB_NAME(7493ff) A;
+ NETLIB_NAME(7493ff) B;
+ NETLIB_NAME(7493ff) C;
+ NETLIB_NAME(7493ff) D;
);
#endif /* NLD_7493_H_ */
diff --git a/src/emu/netlist/devices/nld_9316.c b/src/emu/netlist/devices/nld_9316.c
index ede8e0c0e68..b3b49c171b3 100644
--- a/src/emu/netlist/devices/nld_9316.c
+++ b/src/emu/netlist/devices/nld_9316.c
@@ -7,148 +7,147 @@
NETLIB_START(9316)
{
- register_sub(sub, "sub");
+ register_sub(sub, "sub");
- register_subalias("CLK", sub.m_clk);
+ register_subalias("CLK", sub.m_clk);
- register_input("ENP", m_ENP);
- register_input("ENT", m_ENT);
- register_input("CLRQ", m_CLRQ);
- register_input("LOADQ", m_LOADQ);
+ register_input("ENP", m_ENP);
+ register_input("ENT", m_ENT);
+ register_input("CLRQ", m_CLRQ);
+ register_input("LOADQ", m_LOADQ);
- register_subalias("A", sub.m_A);
- register_subalias("B", sub.m_B);
- register_subalias("C", sub.m_C);
- register_subalias("D", sub.m_D);
+ register_subalias("A", sub.m_A);
+ register_subalias("B", sub.m_B);
+ register_subalias("C", sub.m_C);
+ register_subalias("D", sub.m_D);
- register_subalias("QA", sub.m_QA);
- register_subalias("QB", sub.m_QB);
- register_subalias("QC", sub.m_QC);
- register_subalias("QD", sub.m_QD);
- register_subalias("RC", sub.m_RC);
+ register_subalias("QA", sub.m_QA);
+ register_subalias("QB", sub.m_QB);
+ register_subalias("QC", sub.m_QC);
+ register_subalias("QD", sub.m_QD);
+ register_subalias("RC", sub.m_RC);
}
NETLIB_START(9316_sub)
{
- m_cnt = 0;
- m_loadq = 1;
- m_ent = 1;
-
- register_input("CLK", m_clk, netlist_input_t::STATE_INP_LH);
-
- register_input("A", m_A, netlist_input_t::STATE_INP_PASSIVE);
- register_input("B", m_B, netlist_input_t::STATE_INP_PASSIVE);
- register_input("C", m_C, netlist_input_t::STATE_INP_PASSIVE);
- register_input("D", m_D, netlist_input_t::STATE_INP_PASSIVE);
-
- register_output("QA", m_QA);
- register_output("QB", m_QB);
- register_output("QC", m_QC);
- register_output("QD", m_QD);
- register_output("RC", m_RC);
-
- save(NAME(m_cnt));
- save(NAME(m_loadq));
- save(NAME(m_ent));
+ m_cnt = 0;
+ m_loadq = 1;
+ m_ent = 1;
+
+ register_input("CLK", m_clk, netlist_input_t::STATE_INP_LH);
+
+ register_input("A", m_A, netlist_input_t::STATE_INP_PASSIVE);
+ register_input("B", m_B, netlist_input_t::STATE_INP_PASSIVE);
+ register_input("C", m_C, netlist_input_t::STATE_INP_PASSIVE);
+ register_input("D", m_D, netlist_input_t::STATE_INP_PASSIVE);
+
+ register_output("QA", m_QA);
+ register_output("QB", m_QB);
+ register_output("QC", m_QC);
+ register_output("QD", m_QD);
+ register_output("RC", m_RC);
+
+ save(NAME(m_cnt));
+ save(NAME(m_loadq));
+ save(NAME(m_ent));
}
NETLIB_UPDATE(9316_sub)
{
- UINT8 cnt = m_cnt;
- if (m_loadq)
- {
- cnt = ( cnt + 1) & 0x0f;
- update_outputs(cnt);
- if (cnt == 0x0f)
- OUTLOGIC(m_RC, m_ent, NLTIME_FROM_NS(20));
- else if (cnt == 0)
- OUTLOGIC(m_RC, 0, NLTIME_FROM_NS(20));
- }
- else
- {
- cnt = (INPLOGIC_PASSIVE(m_D) << 3) | (INPLOGIC_PASSIVE(m_C) << 2) | (INPLOGIC_PASSIVE(m_B) << 1) | (INPLOGIC_PASSIVE(m_A) << 0);
- update_outputs_all(cnt);
- OUTLOGIC(m_RC, m_ent & (cnt == 0x0f), NLTIME_FROM_NS(20));
- }
- m_cnt = cnt;
+ UINT8 cnt = m_cnt;
+ if (m_loadq)
+ {
+ cnt = ( cnt + 1) & 0x0f;
+ update_outputs(cnt);
+ if (cnt == 0x0f)
+ OUTLOGIC(m_RC, m_ent, NLTIME_FROM_NS(20));
+ else if (cnt == 0)
+ OUTLOGIC(m_RC, 0, NLTIME_FROM_NS(20));
+ }
+ else
+ {
+ cnt = (INPLOGIC_PASSIVE(m_D) << 3) | (INPLOGIC_PASSIVE(m_C) << 2) | (INPLOGIC_PASSIVE(m_B) << 1) | (INPLOGIC_PASSIVE(m_A) << 0);
+ update_outputs_all(cnt);
+ OUTLOGIC(m_RC, m_ent & (cnt == 0x0f), NLTIME_FROM_NS(20));
+ }
+ m_cnt = cnt;
}
NETLIB_UPDATE(9316)
{
- sub.m_loadq = INPLOGIC(m_LOADQ);
- sub.m_ent = INPLOGIC(m_ENT);
- const netlist_sig_t clrq = INPLOGIC(m_CLRQ);
-
- if ((!sub.m_loadq || (sub.m_ent & INPLOGIC(m_ENP))) & clrq)
- {
- sub.m_clk.activate_lh();
- }
- else
- {
- sub.m_clk.inactivate();
- if (!clrq & (sub.m_cnt>0))
- {
- sub.m_cnt = 0;
- sub.update_outputs(sub.m_cnt);
- OUTLOGIC(sub.m_RC, 0, NLTIME_FROM_NS(20));
- return;
- }
- }
- OUTLOGIC(sub.m_RC, sub.m_ent & (sub.m_cnt == 0x0f), NLTIME_FROM_NS(20));
+ sub.m_loadq = INPLOGIC(m_LOADQ);
+ sub.m_ent = INPLOGIC(m_ENT);
+ const netlist_sig_t clrq = INPLOGIC(m_CLRQ);
+
+ if ((!sub.m_loadq || (sub.m_ent & INPLOGIC(m_ENP))) & clrq)
+ {
+ sub.m_clk.activate_lh();
+ }
+ else
+ {
+ sub.m_clk.inactivate();
+ if (!clrq & (sub.m_cnt>0))
+ {
+ sub.m_cnt = 0;
+ sub.update_outputs(sub.m_cnt);
+ OUTLOGIC(sub.m_RC, 0, NLTIME_FROM_NS(20));
+ return;
+ }
+ }
+ OUTLOGIC(sub.m_RC, sub.m_ent & (sub.m_cnt == 0x0f), NLTIME_FROM_NS(20));
}
inline NETLIB_FUNC_VOID(9316_sub, update_outputs_all, (const UINT8 cnt))
{
- const netlist_time out_delay = NLTIME_FROM_NS(20);
- OUTLOGIC(m_QA, (cnt >> 0) & 1, out_delay);
- OUTLOGIC(m_QB, (cnt >> 1) & 1, out_delay);
- OUTLOGIC(m_QC, (cnt >> 2) & 1, out_delay);
- OUTLOGIC(m_QD, (cnt >> 3) & 1, out_delay);
+ const netlist_time out_delay = NLTIME_FROM_NS(20);
+ OUTLOGIC(m_QA, (cnt >> 0) & 1, out_delay);
+ OUTLOGIC(m_QB, (cnt >> 1) & 1, out_delay);
+ OUTLOGIC(m_QC, (cnt >> 2) & 1, out_delay);
+ OUTLOGIC(m_QD, (cnt >> 3) & 1, out_delay);
}
inline NETLIB_FUNC_VOID(9316_sub, update_outputs, (const UINT8 cnt))
{
- const netlist_time out_delay = NLTIME_FROM_NS(20);
+ const netlist_time out_delay = NLTIME_FROM_NS(20);
#if 0
// for (int i=0; i<4; i++)
// OUTLOGIC(m_Q[i], (cnt >> i) & 1, delay[i]);
- OUTLOGIC(m_QA, (cnt >> 0) & 1, out_delay);
- OUTLOGIC(m_QB, (cnt >> 1) & 1, out_delay);
- OUTLOGIC(m_QC, (cnt >> 2) & 1, out_delay);
- OUTLOGIC(m_QD, (cnt >> 3) & 1, out_delay);
+ OUTLOGIC(m_QA, (cnt >> 0) & 1, out_delay);
+ OUTLOGIC(m_QB, (cnt >> 1) & 1, out_delay);
+ OUTLOGIC(m_QC, (cnt >> 2) & 1, out_delay);
+ OUTLOGIC(m_QD, (cnt >> 3) & 1, out_delay);
#else
- if ((cnt & 1) == 1)
- OUTLOGIC(m_QA, 1, out_delay);
- else
- {
- OUTLOGIC(m_QA, 0, out_delay);
- switch (cnt)
- {
- case 0x00:
- OUTLOGIC(m_QB, 0, out_delay);
- OUTLOGIC(m_QC, 0, out_delay);
- OUTLOGIC(m_QD, 0, out_delay);
- break;
- case 0x02:
- case 0x06:
- case 0x0A:
- case 0x0E:
- OUTLOGIC(m_QB, 1, out_delay);
- break;
- case 0x04:
- case 0x0C:
- OUTLOGIC(m_QB, 0, out_delay);
- OUTLOGIC(m_QC, 1, out_delay);
- break;
- case 0x08:
- OUTLOGIC(m_QB, 0, out_delay);
- OUTLOGIC(m_QC, 0, out_delay);
- OUTLOGIC(m_QD, 1, out_delay);
- break;
- }
-
- }
+ if ((cnt & 1) == 1)
+ OUTLOGIC(m_QA, 1, out_delay);
+ else
+ {
+ OUTLOGIC(m_QA, 0, out_delay);
+ switch (cnt)
+ {
+ case 0x00:
+ OUTLOGIC(m_QB, 0, out_delay);
+ OUTLOGIC(m_QC, 0, out_delay);
+ OUTLOGIC(m_QD, 0, out_delay);
+ break;
+ case 0x02:
+ case 0x06:
+ case 0x0A:
+ case 0x0E:
+ OUTLOGIC(m_QB, 1, out_delay);
+ break;
+ case 0x04:
+ case 0x0C:
+ OUTLOGIC(m_QB, 0, out_delay);
+ OUTLOGIC(m_QC, 1, out_delay);
+ break;
+ case 0x08:
+ OUTLOGIC(m_QB, 0, out_delay);
+ OUTLOGIC(m_QC, 0, out_delay);
+ OUTLOGIC(m_QD, 1, out_delay);
+ break;
+ }
+
+ }
#endif
}
-
diff --git a/src/emu/netlist/devices/nld_9316.h b/src/emu/netlist/devices/nld_9316.h
index 886ef1c956c..7aa340a76d1 100644
--- a/src/emu/netlist/devices/nld_9316.h
+++ b/src/emu/netlist/devices/nld_9316.h
@@ -52,45 +52,45 @@
#include "../nl_base.h"
#define TTL_9316(_name, _CLK, _ENP, _ENT, _CLRQ, _LOADQ, _A, _B, _C, _D) \
- NET_REGISTER_DEV(9316, _name) \
- NET_CONNECT(_name, CLK, _CLK) \
- NET_CONNECT(_name, ENP, _ENP) \
- NET_CONNECT(_name, ENT, _ENT) \
- NET_CONNECT(_name, CLRQ, _CLRQ) \
- NET_CONNECT(_name, LOADQ,_LOADQ) \
- NET_CONNECT(_name, A, _A) \
- NET_CONNECT(_name, B, _B) \
- NET_CONNECT(_name, C, _C) \
- NET_CONNECT(_name, D, _D)
+ NET_REGISTER_DEV(9316, _name) \
+ NET_CONNECT(_name, CLK, _CLK) \
+ NET_CONNECT(_name, ENP, _ENP) \
+ NET_CONNECT(_name, ENT, _ENT) \
+ NET_CONNECT(_name, CLRQ, _CLRQ) \
+ NET_CONNECT(_name, LOADQ,_LOADQ) \
+ NET_CONNECT(_name, A, _A) \
+ NET_CONNECT(_name, B, _B) \
+ NET_CONNECT(_name, C, _C) \
+ NET_CONNECT(_name, D, _D)
NETLIB_SUBDEVICE(9316_sub,
- ATTR_HOT void update_outputs_all(const UINT8 cnt);
- ATTR_HOT void update_outputs(const UINT8 cnt);
+ ATTR_HOT void update_outputs_all(const UINT8 cnt);
+ ATTR_HOT void update_outputs(const UINT8 cnt);
- netlist_ttl_input_t m_clk;
+ netlist_ttl_input_t m_clk;
- netlist_ttl_input_t m_A;
- netlist_ttl_input_t m_B;
- netlist_ttl_input_t m_C;
- netlist_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;
+ UINT8 m_cnt;
+ netlist_sig_t m_loadq;
+ netlist_sig_t m_ent;
- netlist_ttl_output_t m_QA;
- netlist_ttl_output_t m_QB;
- netlist_ttl_output_t m_QC;
- netlist_ttl_output_t m_QD;
- netlist_ttl_output_t m_RC;
+ 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(9316,
- NETLIB_NAME(9316_sub) sub;
- 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_NAME(9316_sub) sub;
+ netlist_ttl_input_t m_ENP;
+ netlist_ttl_input_t m_ENT;
+ netlist_ttl_input_t m_CLRQ;
+ netlist_ttl_input_t m_LOADQ;
);
#endif /* NLD_9316_H_ */
diff --git a/src/emu/netlist/devices/nld_legacy.c b/src/emu/netlist/devices/nld_legacy.c
index 4afe74a45d8..e23c7287ea0 100644
--- a/src/emu/netlist/devices/nld_legacy.c
+++ b/src/emu/netlist/devices/nld_legacy.c
@@ -7,141 +7,141 @@
NETLIB_START(nicMultiSwitch)
{
- static const char *sIN[8] = { "i1", "i2", "i3", "i4", "i5", "i6", "i7", "i8" };
- int i;
+ static const char *sIN[8] = { "i1", "i2", "i3", "i4", "i5", "i6", "i7", "i8" };
+ int i;
- m_position = 0;
- m_low.initial(0);
+ m_position = 0;
+ m_low.initial(0);
- for (i=0; i<8; i++)
- {
- register_input(sIN[i], m_I[i]);
- m_low.net().register_con(m_I[i]);
- //m_I[i].set_net(m_low.m_net);
- }
- register_param("POS", m_POS, 0);
- register_output("Q", m_Q);
+ for (i=0; i<8; i++)
+ {
+ register_input(sIN[i], m_I[i]);
+ m_low.net().register_con(m_I[i]);
+ //m_I[i].set_net(m_low.m_net);
+ }
+ register_param("POS", m_POS, 0);
+ register_output("Q", m_Q);
- save(NAME(m_position));
+ save(NAME(m_position));
}
NETLIB_UPDATE(nicMultiSwitch)
{
- assert(m_position<8);
- OUTANALOG(m_Q, INPANALOG(m_I[m_position]), NLTIME_FROM_NS(1));
+ assert(m_position<8);
+ OUTANALOG(m_Q, INPANALOG(m_I[m_position]), NLTIME_FROM_NS(1));
}
NETLIB_UPDATE_PARAM(nicMultiSwitch)
{
- m_position = m_POS.Value();
- //update();
+ m_position = m_POS.Value();
+ //update();
}
NETLIB_START(nicMixer8)
{
- static const char *sI[8] = { "I1", "I2", "I3", "I4", "I5", "I6", "I7", "I8" };
- static const char *sR[8] = { "R1", "R2", "R3", "R4", "R5", "R6", "R7", "R8" };
- int i;
-
- m_low.initial(0);
-
- for (i=0; i<8; i++)
- {
- register_input(sI[i], m_I[i]);
- m_low.net().register_con(m_I[i]);
- //m_I[i].set_output(m_low);
- register_param(sR[i], m_R[i], 1e12);
- }
- register_output("Q", m_Q);
+ static const char *sI[8] = { "I1", "I2", "I3", "I4", "I5", "I6", "I7", "I8" };
+ static const char *sR[8] = { "R1", "R2", "R3", "R4", "R5", "R6", "R7", "R8" };
+ int i;
+
+ m_low.initial(0);
+
+ for (i=0; i<8; i++)
+ {
+ register_input(sI[i], m_I[i]);
+ m_low.net().register_con(m_I[i]);
+ //m_I[i].set_output(m_low);
+ register_param(sR[i], m_R[i], 1e12);
+ }
+ register_output("Q", m_Q);
}
NETLIB_UPDATE(nicMixer8)
{
- int i;
- double r = 0;
-
- for (i=0; i<8; i++)
- {
- r += m_w[i] * INPANALOG(m_I[i]);
- }
- OUTANALOG(m_Q, r, NLTIME_IMMEDIATE);
+ int i;
+ double r = 0;
+
+ for (i=0; i<8; i++)
+ {
+ r += m_w[i] * INPANALOG(m_I[i]);
+ }
+ OUTANALOG(m_Q, r, NLTIME_IMMEDIATE);
}
NETLIB_UPDATE_PARAM(nicMixer8)
{
- double t = 0;
- int i;
+ double t = 0;
+ int i;
- for (i=0; i<8; i++)
- t += 1.0 / m_R[i].Value();
- t = 1.0 / t;
+ for (i=0; i<8; i++)
+ t += 1.0 / m_R[i].Value();
+ t = 1.0 / t;
- for (i=0; i<8; i++)
- m_w[i] = t / m_R[i].Value();
+ for (i=0; i<8; i++)
+ m_w[i] = t / m_R[i].Value();
}
NETLIB_START(nicRSFF)
{
- register_input("S", m_S);
- register_input("R", m_R);
- register_output("Q", m_Q);
- register_output("QQ", m_QQ);
- m_Q.initial(0);
- m_QQ.initial(1);
+ register_input("S", m_S);
+ register_input("R", m_R);
+ register_output("Q", m_Q);
+ register_output("QQ", m_QQ);
+ m_Q.initial(0);
+ m_QQ.initial(1);
}
NETLIB_UPDATE(nicRSFF)
{
- if (INPLOGIC(m_S))
- {
- OUTLOGIC(m_Q, 1, NLTIME_FROM_NS(10));
- OUTLOGIC(m_QQ, 0, NLTIME_FROM_NS(10));
- }
- else if (INPLOGIC(m_R))
- {
- OUTLOGIC(m_Q, 0, NLTIME_FROM_NS(10));
- OUTLOGIC(m_QQ, 1, NLTIME_FROM_NS(10));
- }
+ if (INPLOGIC(m_S))
+ {
+ OUTLOGIC(m_Q, 1, NLTIME_FROM_NS(10));
+ OUTLOGIC(m_QQ, 0, NLTIME_FROM_NS(10));
+ }
+ else if (INPLOGIC(m_R))
+ {
+ OUTLOGIC(m_Q, 0, NLTIME_FROM_NS(10));
+ OUTLOGIC(m_QQ, 1, NLTIME_FROM_NS(10));
+ }
}
NETLIB_START(nicNE555N_MSTABLE)
{
- register_input("TRIG", m_trigger);
- register_input("CV", m_CV);
+ register_input("TRIG", m_trigger);
+ register_input("CV", m_CV);
- register_output("Q", m_Q);
- register_param("R", m_R, 0.0);
- register_param("C", m_C, 0.0);
- register_param("VS", m_VS, 5.0);
- register_param("VL", m_VL, 0.0 *5.0);
+ register_output("Q", m_Q);
+ register_param("R", m_R, 0.0);
+ register_param("C", m_C, 0.0);
+ register_param("VS", m_VS, 5.0);
+ register_param("VL", m_VL, 0.0 *5.0);
- m_THRESHOLD_OUT.init_object(*this, name() + "THRESHOLD");
- register_link_internal(m_THRESHOLD, m_THRESHOLD_OUT, netlist_input_t::STATE_INP_ACTIVE);
+ m_THRESHOLD_OUT.init_object(*this, name() + "THRESHOLD");
+ register_link_internal(m_THRESHOLD, m_THRESHOLD_OUT, netlist_input_t::STATE_INP_ACTIVE);
- m_Q.initial(5.0 * 0.4);
- m_last = false;
+ m_Q.initial(5.0 * 0.4);
+ m_last = false;
- save(NAME(m_last));
+ save(NAME(m_last));
}
inline double NETLIB_NAME(nicNE555N_MSTABLE)::nicNE555N_cv()
{
- return (m_CV.is_highz() ? 0.67 * m_VS.Value() : INPANALOG(m_CV));
+ return (m_CV.is_highz() ? 0.67 * m_VS.Value() : INPANALOG(m_CV));
}
inline double NETLIB_NAME(nicNE555N_MSTABLE)::nicNE555N_clamp(const double v, const double a, const double b)
{
- double ret = v;
- if (ret > m_VS.Value() - a)
- ret = m_VS.Value() - a;
- if (ret < b)
- ret = b;
- return ret;
+ double ret = v;
+ if (ret > m_VS.Value() - a)
+ ret = m_VS.Value() - a;
+ if (ret < b)
+ ret = b;
+ return ret;
}
NETLIB_UPDATE_PARAM(nicNE555N_MSTABLE)
@@ -150,46 +150,46 @@ NETLIB_UPDATE_PARAM(nicNE555N_MSTABLE)
NETLIB_UPDATE(nicNE555N_MSTABLE)
{
- update_param(); // FIXME : m_CV should be on a sub device ...
-
- double vt = nicNE555N_clamp(nicNE555N_cv(), 0.7, 1.4);
- bool bthresh = (INPANALOG(m_THRESHOLD) > vt);
- bool btrig = (INPANALOG(m_trigger) > nicNE555N_clamp(nicNE555N_cv() * 0.5, 0.7, 1.4));
- bool out = m_last;
-
- if (!btrig)
- {
- out = true;
- }
- else if (bthresh)
- {
- out = false;
- }
-
- if (!m_last && out)
- {
- double vl = m_VL.Value();
- double time;
-
- // FIXME : m_CV should be on a sub device ...
-
- // TI datasheet states minimum pulse of 10 us
- if (vt<vl)
- time = 10;
- else
- {
- time = - log((m_VS.Value()-vt)/(m_VS.Value()-vl)) * m_R.Value() * m_C.Value() * 1.0e6; // in us
- if (time < 10.0)
- time = 10.0;
- }
-
- OUTANALOG(m_Q, m_VS.Value() * 0.7, NLTIME_FROM_NS(100));
- OUTANALOG(m_THRESHOLD_OUT, m_VS.Value(), NLTIME_FROM_US(time ));
- }
- else if (m_last && !out)
- {
- OUTANALOG(m_Q, 0.25, NLTIME_FROM_NS(100));
- OUTANALOG(m_THRESHOLD_OUT, 0.0, NLTIME_FROM_NS(1));
- }
- m_last = out;
+ update_param(); // FIXME : m_CV should be on a sub device ...
+
+ double vt = nicNE555N_clamp(nicNE555N_cv(), 0.7, 1.4);
+ bool bthresh = (INPANALOG(m_THRESHOLD) > vt);
+ bool btrig = (INPANALOG(m_trigger) > nicNE555N_clamp(nicNE555N_cv() * 0.5, 0.7, 1.4));
+ bool out = m_last;
+
+ if (!btrig)
+ {
+ out = true;
+ }
+ else if (bthresh)
+ {
+ out = false;
+ }
+
+ if (!m_last && out)
+ {
+ double vl = m_VL.Value();
+ double time;
+
+ // FIXME : m_CV should be on a sub device ...
+
+ // TI datasheet states minimum pulse of 10 us
+ if (vt<vl)
+ time = 10;
+ else
+ {
+ time = - log((m_VS.Value()-vt)/(m_VS.Value()-vl)) * m_R.Value() * m_C.Value() * 1.0e6; // in us
+ if (time < 10.0)
+ time = 10.0;
+ }
+
+ OUTANALOG(m_Q, m_VS.Value() * 0.7, NLTIME_FROM_NS(100));
+ OUTANALOG(m_THRESHOLD_OUT, m_VS.Value(), NLTIME_FROM_US(time ));
+ }
+ else if (m_last && !out)
+ {
+ OUTANALOG(m_Q, 0.25, NLTIME_FROM_NS(100));
+ OUTANALOG(m_THRESHOLD_OUT, 0.0, NLTIME_FROM_NS(1));
+ }
+ m_last = out;
}
diff --git a/src/emu/netlist/devices/nld_legacy.h b/src/emu/netlist/devices/nld_legacy.h
index eb94dbfaba0..43cdd5f6be3 100644
--- a/src/emu/netlist/devices/nld_legacy.h
+++ b/src/emu/netlist/devices/nld_legacy.h
@@ -20,83 +20,83 @@
// ----------------------------------------------------------------------------------------
#define NETDEV_RSFF(_name, _S, _R) \
- NET_REGISTER_DEV(nicRSFF, _name) \
- NET_CONNECT(_name, S, _S) \
- NET_CONNECT(_name, R, _R)
+ NET_REGISTER_DEV(nicRSFF, _name) \
+ NET_CONNECT(_name, S, _S) \
+ NET_CONNECT(_name, R, _R)
#define NE555N_MSTABLE(_name, _TRIG, _CV) \
- NET_REGISTER_DEV(nicNE555N_MSTABLE, _name) \
- NET_CONNECT(_name, TRIG, _TRIG) \
- NET_CONNECT(_name, CV, _CV)
+ NET_REGISTER_DEV(nicNE555N_MSTABLE, _name) \
+ NET_CONNECT(_name, TRIG, _TRIG) \
+ NET_CONNECT(_name, CV, _CV)
#define NETDEV_MIXER3(_name, _I1, _I2, _I3) \
- NET_REGISTER_DEV(nicMixer8, _name) \
- NET_CONNECT(_name, I1, _I1) \
- NET_CONNECT(_name, I2, _I2) \
- NET_CONNECT(_name, I3, _I3)
+ NET_REGISTER_DEV(nicMixer8, _name) \
+ NET_CONNECT(_name, I1, _I1) \
+ NET_CONNECT(_name, I2, _I2) \
+ NET_CONNECT(_name, I3, _I3)
#define NETDEV_SWITCH2(_name, _i1, _i2) \
- NET_REGISTER_DEV(nicMultiSwitch, _name) \
- NET_CONNECT(_name, i1, _i1) \
- NET_CONNECT(_name, i2, _i2)
+ NET_REGISTER_DEV(nicMultiSwitch, _name) \
+ NET_CONNECT(_name, i1, _i1) \
+ NET_CONNECT(_name, i2, _i2)
// ----------------------------------------------------------------------------------------
// Devices ...
// ----------------------------------------------------------------------------------------
NETLIB_DEVICE(nicRSFF,
- netlist_ttl_input_t m_S;
- netlist_ttl_input_t m_R;
+ netlist_ttl_input_t m_S;
+ netlist_ttl_input_t m_R;
- netlist_ttl_output_t m_Q;
- netlist_ttl_output_t m_QQ;
+ netlist_ttl_output_t m_Q;
+ netlist_ttl_output_t m_QQ;
);
NETLIB_DEVICE_WITH_PARAMS(nicMixer8,
- netlist_analog_input_t m_I[8];
+ netlist_analog_input_t m_I[8];
- netlist_analog_output_t m_Q;
- netlist_analog_output_t m_low;
+ netlist_analog_output_t m_Q;
+ netlist_analog_output_t m_low;
- netlist_param_double_t m_R[8];
+ netlist_param_double_t m_R[8];
- double m_w[8];
+ double m_w[8];
);
NETLIB_DEVICE_WITH_PARAMS(nicNE555N_MSTABLE,
- //ATTR_HOT void timer_cb(INT32 timer_id);
+ //ATTR_HOT void timer_cb(INT32 timer_id);
- netlist_analog_input_t m_trigger;
- netlist_analog_input_t m_CV;
- netlist_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;
+ bool m_last;
- netlist_analog_output_t m_Q;
- netlist_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;
- netlist_param_double_t m_R;
- netlist_param_double_t m_C;
- netlist_param_double_t m_VS;
- netlist_param_double_t m_VL;
+ //netlist_base_timer_t *m_timer;
+ netlist_param_double_t m_R;
+ netlist_param_double_t m_C;
+ netlist_param_double_t m_VS;
+ netlist_param_double_t m_VL;
- double nicNE555N_cv();
- double nicNE555N_clamp(const double v, const double a, const double b);
+ double nicNE555N_cv();
+ double nicNE555N_clamp(const double v, const double a, const double b);
);
NETLIB_DEVICE_WITH_PARAMS(nicMultiSwitch,
- netlist_analog_input_t m_I[8];
+ netlist_analog_input_t m_I[8];
- netlist_analog_output_t m_Q;
- netlist_analog_output_t m_low;
+ netlist_analog_output_t m_Q;
+ netlist_analog_output_t m_low;
- netlist_param_int_t m_POS;
+ netlist_param_int_t m_POS;
- int m_position;
+ int m_position;
);
diff --git a/src/emu/netlist/devices/nld_log.c b/src/emu/netlist/devices/nld_log.c
index e175c4670a8..837923154ab 100644
--- a/src/emu/netlist/devices/nld_log.c
+++ b/src/emu/netlist/devices/nld_log.c
@@ -10,31 +10,31 @@
NETLIB_START(log)
{
- register_input("I", m_I);
+ register_input("I", m_I);
- pstring filename = "netlist_" + name() + ".log";
- m_file = fopen(filename, "w");
+ pstring filename = "netlist_" + name() + ".log";
+ m_file = fopen(filename, "w");
}
NETLIB_UPDATE(log)
{
- fprintf(m_file, "%e %e\n", netlist().time().as_double(), INPANALOG(m_I));
+ fprintf(m_file, "%e %e\n", netlist().time().as_double(), INPANALOG(m_I));
}
NETLIB_NAME(log)::~NETLIB_NAME(log)()
{
- fclose(m_file);
+ fclose(m_file);
}
NETLIB_START(logD)
{
- NETLIB_NAME(log)::start();
- register_input("I2", m_I2);
+ NETLIB_NAME(log)::start();
+ register_input("I2", m_I2);
}
NETLIB_UPDATE(logD)
{
- fprintf(m_file, "%e %e\n", netlist().time().as_double(), INPANALOG(m_I) - INPANALOG(m_I2));
+ fprintf(m_file, "%e %e\n", netlist().time().as_double(), INPANALOG(m_I) - INPANALOG(m_I2));
}
// FIXME: Implement wav later, this must be clock triggered device where the input to be written
@@ -42,19 +42,19 @@ NETLIB_UPDATE(logD)
#if 0
NETLIB_START(wav)
{
- register_input("I", m_I);
+ register_input("I", m_I);
- pstring filename = "netlist_" + name() + ".wav";
- m_file = wav_open(filename, sample_rate(), active_inputs()/2)
+ pstring filename = "netlist_" + name() + ".wav";
+ m_file = wav_open(filename, sample_rate(), active_inputs()/2)
}
NETLIB_UPDATE(wav)
{
- fprintf(m_file, "%e %e\n", netlist().time().as_double(), INPANALOG(m_I));
+ fprintf(m_file, "%e %e\n", netlist().time().as_double(), INPANALOG(m_I));
}
NETLIB_NAME(log)::~NETLIB_NAME(wav)()
{
- fclose(m_file);
+ fclose(m_file);
}
#endif
diff --git a/src/emu/netlist/devices/nld_log.h b/src/emu/netlist/devices/nld_log.h
index f8910f51112..16d389263b8 100644
--- a/src/emu/netlist/devices/nld_log.h
+++ b/src/emu/netlist/devices/nld_log.h
@@ -21,32 +21,32 @@
#include "../nl_base.h"
#define NETDEV_LOG(_name, _I) \
- NET_REGISTER_DEV(log, _name) \
- NET_CONNECT(_name, I, _I)
+ NET_REGISTER_DEV(log, _name) \
+ NET_CONNECT(_name, I, _I)
NETLIB_DEVICE(log,
- ~NETLIB_NAME(log)();
- netlist_analog_input_t m_I;
+ ~NETLIB_NAME(log)();
+ netlist_analog_input_t m_I;
protected:
- FILE *m_file;
+ FILE *m_file;
);
#define NETDEV_LOGD(_name, _I, _I2) \
- NET_REGISTER_DEV(logD, _name) \
- NET_CONNECT(_name, I, _I) \
- NET_CONNECT(_name, I2, _I2)
+ NET_REGISTER_DEV(logD, _name) \
+ NET_CONNECT(_name, I, _I) \
+ NET_CONNECT(_name, I2, _I2)
NETLIB_DEVICE_DERIVED(logD, log,
- netlist_analog_input_t m_I2;
+ netlist_analog_input_t m_I2;
);
#if 0
NETLIB_DEVICE(wav,
- ~NETLIB_NAME(wav)();
- netlist_analog_input_t m_I;
+ ~NETLIB_NAME(wav)();
+ netlist_analog_input_t m_I;
private:
- // FIXME: rewrite sound/wavwrite.h to be an object ...
- void *m_file;
+ // FIXME: rewrite sound/wavwrite.h to be an object ...
+ void *m_file;
);
#endif
diff --git a/src/emu/netlist/devices/nld_ne555.c b/src/emu/netlist/devices/nld_ne555.c
index 06a616f2bb9..4eb20c75980 100644
--- a/src/emu/netlist/devices/nld_ne555.c
+++ b/src/emu/netlist/devices/nld_ne555.c
@@ -11,74 +11,73 @@
inline double NETLIB_NAME(NE555)::clamp(const double v, const double a, const double b)
{
- double ret = v;
- double vcc = TERMANALOG(m_R1.m_P);
+ double ret = v;
+ double vcc = TERMANALOG(m_R1.m_P);
- if (ret > vcc - a)
- ret = vcc - a;
- if (ret < b)
- ret = b;
- return ret;
+ if (ret > vcc - a)
+ ret = vcc - a;
+ if (ret < b)
+ ret = b;
+ return ret;
}
NETLIB_START(NE555)
{
+ register_sub(m_R1, "R1");
+ register_sub(m_R2, "R2");
+ register_sub(m_R3, "R3");
+ register_sub(m_RDIS, "RDIS");
- register_sub(m_R1, "R1");
- register_sub(m_R2, "R2");
- register_sub(m_R3, "R3");
- register_sub(m_RDIS, "RDIS");
+ register_subalias("GND", m_R3.m_N); // Pin 1
+ register_input("TRIG", m_TRIG); // Pin 2
+ register_output("OUT", m_OUT); // Pin 3
+ register_input("RESET", m_RESET); // Pin 4
+ register_subalias("CONT", m_R1.m_N); // Pin 5
+ register_input("THRESH", m_THRES); // Pin 6
+ register_subalias("DISCH", m_RDIS.m_P); // Pin 7
+ register_subalias("VCC", m_R1.m_P); // Pin 8
- register_subalias("GND", m_R3.m_N); // Pin 1
- register_input("TRIG", m_TRIG); // Pin 2
- register_output("OUT", m_OUT); // Pin 3
- register_input("RESET", m_RESET); // Pin 4
- register_subalias("CONT", m_R1.m_N); // Pin 5
- register_input("THRESH", m_THRES); // Pin 6
- register_subalias("DISCH", m_RDIS.m_P); // Pin 7
- register_subalias("VCC", m_R1.m_P); // Pin 8
+ m_R1.set_R(5000);
+ m_R2.set_R(5000);
+ m_R3.set_R(5000);
+ m_RDIS.set_R(R_OFF);
- m_R1.set_R(5000);
- m_R2.set_R(5000);
- m_R3.set_R(5000);
- m_RDIS.set_R(R_OFF);
+ setup().connect(m_R1.m_N, m_R2.m_P);
+ setup().connect(m_R2.m_N, m_R3.m_P);
+ setup().connect(m_RDIS.m_N, m_R3.m_N);
- setup().connect(m_R1.m_N, m_R2.m_P);
- setup().connect(m_R2.m_N, m_R3.m_P);
- setup().connect(m_RDIS.m_N, m_R3.m_N);
+ m_last_out = false;
- m_last_out = false;
-
- save(NAME(m_last_out));
+ save(NAME(m_last_out));
}
NETLIB_UPDATE(NE555)
{
- // FIXME: assumes GND is connected to 0V.
+ // FIXME: assumes GND is connected to 0V.
- double vt = clamp(TERMANALOG(m_R2.m_P), 0.7, 1.4);
- bool bthresh = (INPANALOG(m_THRES) > vt);
- bool btrig = (INPANALOG(m_TRIG) > clamp(TERMANALOG(m_R2.m_N), 0.7, 1.4));
- bool out = m_last_out;
+ double vt = clamp(TERMANALOG(m_R2.m_P), 0.7, 1.4);
+ bool bthresh = (INPANALOG(m_THRES) > vt);
+ bool btrig = (INPANALOG(m_TRIG) > clamp(TERMANALOG(m_R2.m_N), 0.7, 1.4));
+ bool out = m_last_out;
- if (!btrig)
- {
- out = true;
- }
- else if (bthresh)
- {
- out = false;
- }
+ if (!btrig)
+ {
+ out = true;
+ }
+ else if (bthresh)
+ {
+ out = false;
+ }
- if (!m_last_out && out)
- {
- OUTANALOG(m_OUT, TERMANALOG(m_R1.m_P), NLTIME_FROM_NS(100));
- m_RDIS.set_R(R_OFF);
- }
- else if (m_last_out && !out)
- {
- OUTANALOG(m_OUT, TERMANALOG(m_R3.m_N), NLTIME_FROM_NS(100));
- m_RDIS.set_R(R_ON);
- }
- m_last_out = out;
+ if (!m_last_out && out)
+ {
+ OUTANALOG(m_OUT, TERMANALOG(m_R1.m_P), NLTIME_FROM_NS(100));
+ m_RDIS.set_R(R_OFF);
+ }
+ else if (m_last_out && !out)
+ {
+ OUTANALOG(m_OUT, TERMANALOG(m_R3.m_N), NLTIME_FROM_NS(100));
+ m_RDIS.set_R(R_ON);
+ }
+ m_last_out = out;
}
diff --git a/src/emu/netlist/devices/nld_ne555.h b/src/emu/netlist/devices/nld_ne555.h
index a350a684c28..487e8d33789 100644
--- a/src/emu/netlist/devices/nld_ne555.h
+++ b/src/emu/netlist/devices/nld_ne555.h
@@ -23,22 +23,21 @@
#include "nld_twoterm.h"
#define NETDEV_NE555(_name) \
- NET_REGISTER_DEV(NE555, _name) \
-
+ NET_REGISTER_DEV(NE555, _name)
NETLIB_DEVICE(NE555,
- NETLIB_NAME(R) m_R1;
- NETLIB_NAME(R) m_R2;
- NETLIB_NAME(R) m_R3;
- NETLIB_NAME(R) m_RDIS;
+ NETLIB_NAME(R) m_R1;
+ NETLIB_NAME(R) m_R2;
+ NETLIB_NAME(R) m_R3;
+ NETLIB_NAME(R) m_RDIS;
- netlist_logic_input_t m_RESET;
- netlist_analog_input_t m_THRES;
- netlist_analog_input_t m_TRIG;
- netlist_analog_output_t m_OUT;
+ netlist_logic_input_t m_RESET;
+ netlist_analog_input_t m_THRES;
+ netlist_analog_input_t m_TRIG;
+ netlist_analog_output_t m_OUT;
- bool m_last_out;
+ bool m_last_out;
- double clamp(const double v, const double a, const double b);
+ double clamp(const double v, const double a, const double b);
);
diff --git a/src/emu/netlist/devices/nld_signal.h b/src/emu/netlist/devices/nld_signal.h
index a9e99ec381d..e54eaac7372 100644
--- a/src/emu/netlist/devices/nld_signal.h
+++ b/src/emu/netlist/devices/nld_signal.h
@@ -93,7 +93,7 @@ public:
{
register_input(sIN[i], m_i[i]);
}
- save(NAME(m_active));
+ save(NAME(m_active));
}
#if (USE_DEACTIVE_DEVICE)
@@ -167,7 +167,7 @@ public:
{
register_input(sIN[i], m_i[i], netlist_input_t::STATE_INP_ACTIVE);
}
- save(NAME(m_active));
+ save(NAME(m_active));
}
#if (USE_DEACTIVE_DEVICE)
diff --git a/src/emu/netlist/devices/nld_solver.c b/src/emu/netlist/devices/nld_solver.c
index b02f5e4d701..7c8ed65d0e5 100644
--- a/src/emu/netlist/devices/nld_solver.c
+++ b/src/emu/netlist/devices/nld_solver.c
@@ -15,155 +15,155 @@
ATTR_COLD void netlist_matrix_solver_t::setup(netlist_net_t::list_t &nets, NETLIB_NAME(solver) &aowner)
{
- m_owner = &aowner;
- for (netlist_net_t::list_t::entry_t *pn = nets.first(); pn != NULL; pn = nets.next(pn))
- {
- NL_VERBOSE_OUT(("setting up net\n"));
-
- m_nets.add(pn->object());
- pn->object()->m_solver = this;
-
- for (netlist_core_terminal_t *p = pn->object()->m_head; p != NULL; p = p->m_update_list_next)
- {
- switch (p->type())
- {
- case netlist_terminal_t::TERMINAL:
- switch (p->netdev().family())
- {
- case netlist_device_t::CAPACITOR:
- if (!m_steps.contains(&p->netdev()))
- m_steps.add(&p->netdev());
- break;
- case netlist_device_t::DIODE:
- //case netlist_device_t::VCVS:
- //case netlist_device_t::BJT_SWITCH:
- if (!m_dynamic.contains(&p->netdev()))
- m_dynamic.add(&p->netdev());
- break;
- default:
- break;
- }
- pn->object()->m_terms.add(static_cast<netlist_terminal_t *>(p));
- NL_VERBOSE_OUT(("Added terminal\n"));
- break;
- case netlist_terminal_t::INPUT:
- if (!m_inps.contains(&p->netdev()))
- m_inps.add(&p->netdev());
- NL_VERBOSE_OUT(("Added input\n"));
- break;
- default:
- owner().netlist().xfatalerror("unhandled element found\n");
- break;
- }
- }
- }
+ m_owner = &aowner;
+ for (netlist_net_t::list_t::entry_t *pn = nets.first(); pn != NULL; pn = nets.next(pn))
+ {
+ NL_VERBOSE_OUT(("setting up net\n"));
+
+ m_nets.add(pn->object());
+ pn->object()->m_solver = this;
+
+ for (netlist_core_terminal_t *p = pn->object()->m_head; p != NULL; p = p->m_update_list_next)
+ {
+ switch (p->type())
+ {
+ case netlist_terminal_t::TERMINAL:
+ switch (p->netdev().family())
+ {
+ case netlist_device_t::CAPACITOR:
+ if (!m_steps.contains(&p->netdev()))
+ m_steps.add(&p->netdev());
+ break;
+ case netlist_device_t::DIODE:
+ //case netlist_device_t::VCVS:
+ //case netlist_device_t::BJT_SWITCH:
+ if (!m_dynamic.contains(&p->netdev()))
+ m_dynamic.add(&p->netdev());
+ break;
+ default:
+ break;
+ }
+ pn->object()->m_terms.add(static_cast<netlist_terminal_t *>(p));
+ NL_VERBOSE_OUT(("Added terminal\n"));
+ break;
+ case netlist_terminal_t::INPUT:
+ if (!m_inps.contains(&p->netdev()))
+ m_inps.add(&p->netdev());
+ NL_VERBOSE_OUT(("Added input\n"));
+ break;
+ default:
+ owner().netlist().xfatalerror("unhandled element found\n");
+ break;
+ }
+ }
+ }
}
ATTR_HOT inline void netlist_matrix_solver_t::step(const netlist_time delta)
{
- const double dd = delta.as_double();
- for (dev_list_t::entry_t *p = m_steps.first(); p != NULL; p = m_steps.next(p))
- p->object()->step_time(dd);
+ const double dd = delta.as_double();
+ for (dev_list_t::entry_t *p = m_steps.first(); p != NULL; p = m_steps.next(p))
+ p->object()->step_time(dd);
}
ATTR_HOT inline void netlist_matrix_solver_t::update_inputs()
{
- for (dev_list_t::entry_t *p = m_inps.first(); p != NULL; p = m_inps.next(p))
- p->object()->update_dev();
+ for (dev_list_t::entry_t *p = m_inps.first(); p != NULL; p = m_inps.next(p))
+ p->object()->update_dev();
}
ATTR_HOT inline bool netlist_matrix_solver_t::solve()
{
- bool resched = false;
-
- /* update all non-linear devices */
- for (dev_list_t::entry_t *p = m_dynamic.first(); p != NULL; p = m_dynamic.next(p))
- switch (p->object()->family())
- {
- case netlist_device_t::DIODE:
- static_cast<NETLIB_NAME(D) *>(p->object())->update_terminals();
- break;
- default:
- p->object()->update_terminals();
- break;
- }
-
- for (netlist_net_t::list_t::entry_t *pn = m_nets.first(); pn != NULL; pn = m_nets.next(pn))
- {
- netlist_net_t *net = pn->object();
-
- double gtot = 0;
- double gabs = 0;
- double iIdr = 0;
- const netlist_net_t::terminal_list_t &terms = net->m_terms;
+ bool resched = false;
+
+ /* update all non-linear devices */
+ for (dev_list_t::entry_t *p = m_dynamic.first(); p != NULL; p = m_dynamic.next(p))
+ switch (p->object()->family())
+ {
+ case netlist_device_t::DIODE:
+ static_cast<NETLIB_NAME(D) *>(p->object())->update_terminals();
+ break;
+ default:
+ p->object()->update_terminals();
+ break;
+ }
+
+ for (netlist_net_t::list_t::entry_t *pn = m_nets.first(); pn != NULL; pn = m_nets.next(pn))
+ {
+ netlist_net_t *net = pn->object();
+
+ double gtot = 0;
+ double gabs = 0;
+ double iIdr = 0;
+ const netlist_net_t::terminal_list_t &terms = net->m_terms;
#if 1
- switch (terms.count())
- {
- case 1:
- {
- const netlist_terminal_t *pt = terms.first()->object();
- gtot = pt->m_gt;
- gabs = fabs(pt->m_go);
- iIdr = pt->m_Idr + pt->m_go * pt->m_otherterm->net().Q_Analog();
- }
- break;
- case 2:
- {
- const netlist_terminal_t *pt1 = terms[0];
- const netlist_terminal_t *pt2 = terms[1];
- gtot = pt1->m_gt + pt2->m_gt;
- gabs = fabs(pt1->m_go) + fabs(pt2->m_go);
- iIdr = pt1->m_Idr + pt1->m_go * pt1->m_otherterm->net().Q_Analog()
- + pt2->m_Idr + pt2->m_go * pt2->m_otherterm->net().Q_Analog();
- }
- break;
- case 3:
- {
- const netlist_terminal_t *pt1 = terms[0];
- const netlist_terminal_t *pt2 = terms[1];
- const netlist_terminal_t *pt3 = terms[2];
- gtot = pt1->m_gt + pt2->m_gt + pt3->m_gt;
- gabs = fabs(pt1->m_go) + fabs(pt2->m_go) + fabs(pt3->m_go);
- iIdr = pt1->m_Idr + pt1->m_go * pt1->m_otherterm->net().Q_Analog()
- + pt2->m_Idr + pt2->m_go * pt2->m_otherterm->net().Q_Analog()
- + pt3->m_Idr + pt3->m_go * pt3->m_otherterm->net().Q_Analog();
- }
- break;
- default:
- for (netlist_net_t::terminal_list_t::entry_t *e = terms.first(); e != NULL; e = terms.next(e))
- {
- netlist_terminal_t *pt = e->object();
- gtot += pt->m_gt;
- gabs += fabs(pt->m_go);
- iIdr += pt->m_Idr + pt->m_go * pt->m_otherterm->net().Q_Analog();
- }
- break;
- }
+ switch (terms.count())
+ {
+ case 1:
+ {
+ const netlist_terminal_t *pt = terms.first()->object();
+ gtot = pt->m_gt;
+ gabs = fabs(pt->m_go);
+ iIdr = pt->m_Idr + pt->m_go * pt->m_otherterm->net().Q_Analog();
+ }
+ break;
+ case 2:
+ {
+ const netlist_terminal_t *pt1 = terms[0];
+ const netlist_terminal_t *pt2 = terms[1];
+ gtot = pt1->m_gt + pt2->m_gt;
+ gabs = fabs(pt1->m_go) + fabs(pt2->m_go);
+ iIdr = pt1->m_Idr + pt1->m_go * pt1->m_otherterm->net().Q_Analog()
+ + pt2->m_Idr + pt2->m_go * pt2->m_otherterm->net().Q_Analog();
+ }
+ break;
+ case 3:
+ {
+ const netlist_terminal_t *pt1 = terms[0];
+ const netlist_terminal_t *pt2 = terms[1];
+ const netlist_terminal_t *pt3 = terms[2];
+ gtot = pt1->m_gt + pt2->m_gt + pt3->m_gt;
+ gabs = fabs(pt1->m_go) + fabs(pt2->m_go) + fabs(pt3->m_go);
+ iIdr = pt1->m_Idr + pt1->m_go * pt1->m_otherterm->net().Q_Analog()
+ + pt2->m_Idr + pt2->m_go * pt2->m_otherterm->net().Q_Analog()
+ + pt3->m_Idr + pt3->m_go * pt3->m_otherterm->net().Q_Analog();
+ }
+ break;
+ default:
+ for (netlist_net_t::terminal_list_t::entry_t *e = terms.first(); e != NULL; e = terms.next(e))
+ {
+ netlist_terminal_t *pt = e->object();
+ gtot += pt->m_gt;
+ gabs += fabs(pt->m_go);
+ iIdr += pt->m_Idr + pt->m_go * pt->m_otherterm->net().Q_Analog();
+ }
+ break;
+ }
#else
- for (netlist_net_t::terminal_list_t::entry_t *e = terms.first(); e != NULL; e = terms.next(e))
- {
- netlist_terminal_t *pt = e->object();
- gtot += pt->m_gt;
- gabs += fabs(pt->m_go);
- iIdr += pt->m_Idr + pt->m_go * pt->m_otherterm->net().Q_Analog();
- }
+ for (netlist_net_t::terminal_list_t::entry_t *e = terms.first(); e != NULL; e = terms.next(e))
+ {
+ netlist_terminal_t *pt = e->object();
+ gtot += pt->m_gt;
+ gabs += fabs(pt->m_go);
+ iIdr += pt->m_Idr + pt->m_go * pt->m_otherterm->net().Q_Analog();
+ }
#endif
- double new_val;
- gabs *= m_convergence_factor;
- if (gabs > gtot)
- new_val = (net->m_cur.Analog * gabs + iIdr) / (gtot + gabs);
- else
- new_val = iIdr / gtot;
-
- if (fabs(new_val - net->m_cur.Analog) > m_accuracy)
- resched = true;
- net->m_cur.Analog = net->m_new.Analog = new_val;
-
- NL_VERBOSE_OUT(("Info: %d\n", pn->object()->m_num_cons));
- //NL_VERBOSE_OUT(("New: %lld %f %f\n", netlist().time().as_raw(), netlist().time().as_double(), new_val));
- }
- return resched;
+ double new_val;
+ gabs *= m_convergence_factor;
+ if (gabs > gtot)
+ new_val = (net->m_cur.Analog * gabs + iIdr) / (gtot + gabs);
+ else
+ new_val = iIdr / gtot;
+
+ if (fabs(new_val - net->m_cur.Analog) > m_accuracy)
+ resched = true;
+ net->m_cur.Analog = net->m_new.Analog = new_val;
+
+ NL_VERBOSE_OUT(("Info: %d\n", pn->object()->m_num_cons));
+ //NL_VERBOSE_OUT(("New: %lld %f %f\n", netlist().time().as_raw(), netlist().time().as_double(), new_val));
+ }
+ return resched;
}
// ----------------------------------------------------------------------------------------
@@ -174,160 +174,159 @@ typedef netlist_net_t::list_t *net_groups_t;
static bool already_processed(net_groups_t groups, int &cur_group, netlist_net_t *net)
{
- if (net->isRailNet())
- return true;
- for (int i = 0; i <= cur_group; i++)
- {
- if (groups[i].contains(net))
- return true;
- }
- return false;
+ if (net->isRailNet())
+ return true;
+ for (int i = 0; i <= cur_group; i++)
+ {
+ if (groups[i].contains(net))
+ return true;
+ }
+ return false;
}
static void process_net(net_groups_t groups, int &cur_group, netlist_net_t *net)
{
- /* add the net */
- if (net->m_head == NULL)
- return;
- groups[cur_group].add(net);
- for (netlist_core_terminal_t *p = net->m_head; p != NULL; p = p->m_update_list_next)
- {
- if (p->isType(netlist_terminal_t::TERMINAL))
- {
- netlist_terminal_t *pt = static_cast<netlist_terminal_t *>(p);
- netlist_net_t *nnet = &pt->m_otherterm->net();
- if (!already_processed(groups, cur_group, nnet))
- process_net(groups, cur_group, nnet);
- }
- }
+ /* add the net */
+ if (net->m_head == NULL)
+ return;
+ groups[cur_group].add(net);
+ for (netlist_core_terminal_t *p = net->m_head; p != NULL; p = p->m_update_list_next)
+ {
+ if (p->isType(netlist_terminal_t::TERMINAL))
+ {
+ netlist_terminal_t *pt = static_cast<netlist_terminal_t *>(p);
+ netlist_net_t *nnet = &pt->m_otherterm->net();
+ if (!already_processed(groups, cur_group, nnet))
+ process_net(groups, cur_group, nnet);
+ }
+ }
}
NETLIB_START(solver)
{
- register_output("Q_sync", m_Q_sync);
- register_output("Q_step", m_Q_step);
- //register_input("FB", m_feedback);
+ register_output("Q_sync", m_Q_sync);
+ register_output("Q_step", m_Q_step);
+ //register_input("FB", m_feedback);
- register_param("SYNC_DELAY", m_sync_delay, NLTIME_FROM_NS(10).as_double());
- m_nt_sync_delay = m_sync_delay.Value();
+ register_param("SYNC_DELAY", m_sync_delay, NLTIME_FROM_NS(10).as_double());
+ m_nt_sync_delay = m_sync_delay.Value();
- register_param("FREQ", m_freq, 48000.0);
- m_inc = netlist_time::from_hz(m_freq.Value());
+ register_param("FREQ", m_freq, 48000.0);
+ m_inc = netlist_time::from_hz(m_freq.Value());
- register_param("ACCURACY", m_accuracy, 1e-3);
- register_param("CONVERG", m_convergence, 0.3);
+ register_param("ACCURACY", m_accuracy, 1e-3);
+ register_param("CONVERG", m_convergence, 0.3);
- // internal staff
+ // internal staff
- register_input("FB_sync", m_fb_sync, netlist_input_t::STATE_INP_ACTIVE);
- register_input("FB_step", m_fb_step, netlist_input_t::STATE_INP_ACTIVE);
+ register_input("FB_sync", m_fb_sync, netlist_input_t::STATE_INP_ACTIVE);
+ register_input("FB_step", m_fb_step, netlist_input_t::STATE_INP_ACTIVE);
- setup().connect(m_fb_sync, m_Q_sync);
- setup().connect(m_fb_step, m_Q_step);
+ setup().connect(m_fb_sync, m_Q_sync);
+ setup().connect(m_fb_step, m_Q_step);
- m_last_step = netlist_time::zero;
+ m_last_step = netlist_time::zero;
- save(NAME(m_last_step));
+ save(NAME(m_last_step));
}
NETLIB_UPDATE_PARAM(solver)
{
- m_inc = netlist_time::from_hz(m_freq.Value());
+ m_inc = netlist_time::from_hz(m_freq.Value());
}
NETLIB_NAME(solver)::~NETLIB_NAME(solver)()
{
- netlist_matrix_solver_t::list_t::entry_t *e = m_mat_solvers.first();
- while (e != NULL)
- {
- netlist_matrix_solver_t::list_t::entry_t *en = m_mat_solvers.next(e);
- delete e->object();
- e = en;
- }
+ netlist_matrix_solver_t::list_t::entry_t *e = m_mat_solvers.first();
+ while (e != NULL)
+ {
+ netlist_matrix_solver_t::list_t::entry_t *en = m_mat_solvers.next(e);
+ delete e->object();
+ e = en;
+ }
}
NETLIB_FUNC_VOID(solver, post_start, ())
{
- netlist_net_t::list_t groups[100];
- int cur_group = -1;
-
- SOLVER_VERBOSE_OUT(("Scanning net groups ...\n"));
- // determine net groups
- for (netlist_net_t::list_t::entry_t *pn = netlist().m_nets.first(); pn != NULL; pn = netlist().m_nets.next(pn))
- {
- if (!already_processed(groups, cur_group, pn->object()))
- {
- cur_group++;
- process_net(groups, cur_group, pn->object());
- }
- }
-
- // setup the solvers
- SOLVER_VERBOSE_OUT(("Found %d net groups in %d nets\n", cur_group + 1, m_nets.count()));
- for (int i = 0; i <= cur_group; i++)
- {
- netlist_matrix_solver_t *ms = new netlist_matrix_solver_t();
- ms->m_accuracy = m_accuracy.Value();
- ms->m_convergence_factor = m_convergence.Value();
- ms->setup(groups[i], *this);
- m_mat_solvers.add(ms);
- SOLVER_VERBOSE_OUT(("%d ==> %d nets %s\n", i, groups[i].count(), groups[i].first()->object()->m_head->name().cstr()));
- SOLVER_VERBOSE_OUT((" has %s elements\n", ms->is_dynamic() ? "dynamic" : "no dynamic"));
- }
+ netlist_net_t::list_t groups[100];
+ int cur_group = -1;
+
+ SOLVER_VERBOSE_OUT(("Scanning net groups ...\n"));
+ // determine net groups
+ for (netlist_net_t::list_t::entry_t *pn = netlist().m_nets.first(); pn != NULL; pn = netlist().m_nets.next(pn))
+ {
+ if (!already_processed(groups, cur_group, pn->object()))
+ {
+ cur_group++;
+ process_net(groups, cur_group, pn->object());
+ }
+ }
+
+ // setup the solvers
+ SOLVER_VERBOSE_OUT(("Found %d net groups in %d nets\n", cur_group + 1, m_nets.count()));
+ for (int i = 0; i <= cur_group; i++)
+ {
+ netlist_matrix_solver_t *ms = new netlist_matrix_solver_t();
+ ms->m_accuracy = m_accuracy.Value();
+ ms->m_convergence_factor = m_convergence.Value();
+ ms->setup(groups[i], *this);
+ m_mat_solvers.add(ms);
+ SOLVER_VERBOSE_OUT(("%d ==> %d nets %s\n", i, groups[i].count(), groups[i].first()->object()->m_head->name().cstr()));
+ SOLVER_VERBOSE_OUT((" has %s elements\n", ms->is_dynamic() ? "dynamic" : "no dynamic"));
+ }
}
NETLIB_UPDATE(solver)
{
- //m_Q.setToNoCheck(!m_Q.new_Q(), m_inc );
- //OUTLOGIC(m_Q, !m_Q.net().new_Q(), m_inc );
-
- bool resched = false;
- int resched_cnt = 0;
- netlist_time now = netlist().time();
- netlist_time delta = now - m_last_step;
-
- if (delta >= m_inc)
- {
- NL_VERBOSE_OUT(("Step!\n"));
- /* update all terminals for new time step */
- m_last_step = now;
- for (netlist_matrix_solver_t::list_t::entry_t *e = m_mat_solvers.first(); e != NULL; e = m_mat_solvers.next(e))
- {
- e->object()->step(delta);
- }
- }
- bool global_resched = false;
- for (netlist_matrix_solver_t::list_t::entry_t *e = m_mat_solvers.first(); e != NULL; e = m_mat_solvers.next(e))
- {
- resched_cnt = (e->object()->is_dynamic() ? 0 : 1);
- do {
- resched = e->object()->solve();
- resched_cnt++;
- } while ((resched && (resched_cnt < 5)) || (resched_cnt <= 1));
- global_resched = global_resched || resched;
- }
- //if (global_resched)
- // printf("rescheduled\n");
- if (global_resched)
- {
- schedule();
- }
- else
- {
- /* update all inputs connected */
- for (netlist_matrix_solver_t::list_t::entry_t *e = m_mat_solvers.first(); e != NULL; e = m_mat_solvers.next(e))
- {
- e->object()->update_inputs();
- }
-
- /* step circuit */
- if (!m_Q_step.net().is_queued())
- m_Q_step.net().push_to_queue(m_inc);
- }
+ //m_Q.setToNoCheck(!m_Q.new_Q(), m_inc );
+ //OUTLOGIC(m_Q, !m_Q.net().new_Q(), m_inc );
+
+ bool resched = false;
+ int resched_cnt = 0;
+ netlist_time now = netlist().time();
+ netlist_time delta = now - m_last_step;
+
+ if (delta >= m_inc)
+ {
+ NL_VERBOSE_OUT(("Step!\n"));
+ /* update all terminals for new time step */
+ m_last_step = now;
+ for (netlist_matrix_solver_t::list_t::entry_t *e = m_mat_solvers.first(); e != NULL; e = m_mat_solvers.next(e))
+ {
+ e->object()->step(delta);
+ }
+ }
+ bool global_resched = false;
+ for (netlist_matrix_solver_t::list_t::entry_t *e = m_mat_solvers.first(); e != NULL; e = m_mat_solvers.next(e))
+ {
+ resched_cnt = (e->object()->is_dynamic() ? 0 : 1);
+ do {
+ resched = e->object()->solve();
+ resched_cnt++;
+ } while ((resched && (resched_cnt < 5)) || (resched_cnt <= 1));
+ global_resched = global_resched || resched;
+ }
+ //if (global_resched)
+ // printf("rescheduled\n");
+ if (global_resched)
+ {
+ schedule();
+ }
+ else
+ {
+ /* update all inputs connected */
+ for (netlist_matrix_solver_t::list_t::entry_t *e = m_mat_solvers.first(); e != NULL; e = m_mat_solvers.next(e))
+ {
+ e->object()->update_inputs();
+ }
+
+ /* step circuit */
+ if (!m_Q_step.net().is_queued())
+ m_Q_step.net().push_to_queue(m_inc);
+ }
}
-
diff --git a/src/emu/netlist/devices/nld_solver.h b/src/emu/netlist/devices/nld_solver.h
index 55216f70143..0f9d0f54c28 100644
--- a/src/emu/netlist/devices/nld_solver.h
+++ b/src/emu/netlist/devices/nld_solver.h
@@ -14,7 +14,7 @@
// ----------------------------------------------------------------------------------------
#define NETDEV_SOLVER(_name) \
- NET_REGISTER_DEV(solver, _name)
+ NET_REGISTER_DEV(solver, _name)
// ----------------------------------------------------------------------------------------
// solver
@@ -25,70 +25,70 @@ class NETLIB_NAME(solver);
class netlist_matrix_solver_t
{
public:
- typedef netlist_list_t<netlist_matrix_solver_t *> list_t;
- typedef netlist_core_device_t::list_t dev_list_t;
+ typedef netlist_list_t<netlist_matrix_solver_t *> list_t;
+ typedef netlist_core_device_t::list_t dev_list_t;
- ATTR_COLD void setup(netlist_net_t::list_t &nets, NETLIB_NAME(solver) &owner);
+ ATTR_COLD void setup(netlist_net_t::list_t &nets, NETLIB_NAME(solver) &owner);
- // return true if a reschedule is needed ...
- ATTR_HOT bool solve();
- ATTR_HOT void step(const netlist_time delta);
- ATTR_HOT void update_inputs();
+ // return true if a reschedule is needed ...
+ ATTR_HOT bool solve();
+ ATTR_HOT void step(const netlist_time delta);
+ ATTR_HOT void update_inputs();
- ATTR_HOT inline bool is_dynamic() { return m_dynamic.count() > 0; }
+ ATTR_HOT inline bool is_dynamic() { return m_dynamic.count() > 0; }
- inline const NETLIB_NAME(solver) &owner() const;
+ inline const NETLIB_NAME(solver) &owner() const;
- double m_accuracy;
- double m_convergence_factor;
+ double m_accuracy;
+ double m_convergence_factor;
private:
- netlist_net_t::list_t m_nets;
- dev_list_t m_dynamic;
- dev_list_t m_inps;
- dev_list_t m_steps;
+ netlist_net_t::list_t m_nets;
+ dev_list_t m_dynamic;
+ dev_list_t m_inps;
+ dev_list_t m_steps;
- NETLIB_NAME(solver) *m_owner;
+ NETLIB_NAME(solver) *m_owner;
};
NETLIB_DEVICE_WITH_PARAMS(solver,
- typedef netlist_core_device_t::list_t dev_list_t;
+ typedef netlist_core_device_t::list_t dev_list_t;
- netlist_ttl_input_t m_fb_sync;
- netlist_ttl_output_t m_Q_sync;
+ netlist_ttl_input_t m_fb_sync;
+ netlist_ttl_output_t m_Q_sync;
- netlist_ttl_input_t m_fb_step;
- netlist_ttl_output_t m_Q_step;
+ netlist_ttl_input_t m_fb_step;
+ netlist_ttl_output_t m_Q_step;
- netlist_param_double_t m_freq;
- netlist_param_double_t m_sync_delay;
- netlist_param_double_t m_accuracy;
- netlist_param_double_t m_convergence;
+ netlist_param_double_t m_freq;
+ netlist_param_double_t m_sync_delay;
+ netlist_param_double_t m_accuracy;
+ netlist_param_double_t m_convergence;
- netlist_time m_inc;
- netlist_time m_last_step;
- netlist_time m_nt_sync_delay;
+ netlist_time m_inc;
+ netlist_time m_last_step;
+ netlist_time m_nt_sync_delay;
- netlist_matrix_solver_t::list_t m_mat_solvers;
+ netlist_matrix_solver_t::list_t m_mat_solvers;
public:
- ~NETLIB_NAME(solver)();
+ ~NETLIB_NAME(solver)();
- ATTR_HOT inline void schedule();
+ ATTR_HOT inline void schedule();
- ATTR_COLD void post_start();
+ ATTR_COLD void post_start();
);
inline void NETLIB_NAME(solver)::schedule()
{
- // FIXME: time should be parameter;
- if (!m_Q_sync.net().is_queued())
- m_Q_sync.net().push_to_queue(m_nt_sync_delay);
+ // FIXME: time should be parameter;
+ if (!m_Q_sync.net().is_queued())
+ m_Q_sync.net().push_to_queue(m_nt_sync_delay);
}
inline const NETLIB_NAME(solver) &netlist_matrix_solver_t::owner() const
{
- return *m_owner;
+ return *m_owner;
}
diff --git a/src/emu/netlist/devices/nld_system.c b/src/emu/netlist/devices/nld_system.c
index f1ab75e9f8e..33bef136082 100644
--- a/src/emu/netlist/devices/nld_system.c
+++ b/src/emu/netlist/devices/nld_system.c
@@ -12,8 +12,8 @@
NETLIB_START(ttl_const)
{
- register_output("Q", m_Q);
- register_param("CONST", m_const, 0);
+ register_output("Q", m_Q);
+ register_param("CONST", m_const, 0);
}
NETLIB_UPDATE(ttl_const)
@@ -22,13 +22,13 @@ NETLIB_UPDATE(ttl_const)
NETLIB_UPDATE_PARAM(ttl_const)
{
- OUTLOGIC(m_Q, m_const.Value(), NLTIME_IMMEDIATE);
+ OUTLOGIC(m_Q, m_const.Value(), NLTIME_IMMEDIATE);
}
NETLIB_START(analog_const)
{
- register_output("Q", m_Q);
- register_param("CONST", m_const, 0.0);
+ register_output("Q", m_Q);
+ register_param("CONST", m_const, 0.0);
}
NETLIB_UPDATE(analog_const)
@@ -37,7 +37,7 @@ NETLIB_UPDATE(analog_const)
NETLIB_UPDATE_PARAM(analog_const)
{
- m_Q.initial(m_const.Value());
+ m_Q.initial(m_const.Value());
}
// ----------------------------------------------------------------------------------------
@@ -46,24 +46,24 @@ NETLIB_UPDATE_PARAM(analog_const)
NETLIB_START(clock)
{
- register_output("Q", m_Q);
- //register_input("FB", m_feedback);
+ register_output("Q", m_Q);
+ //register_input("FB", m_feedback);
- register_param("FREQ", m_freq, 7159000.0 * 5.0);
- m_inc = netlist_time::from_hz(m_freq.Value()*2);
+ register_param("FREQ", m_freq, 7159000.0 * 5.0);
+ m_inc = netlist_time::from_hz(m_freq.Value()*2);
- register_link_internal(m_feedback, m_Q, netlist_input_t::STATE_INP_ACTIVE);
+ register_link_internal(m_feedback, m_Q, netlist_input_t::STATE_INP_ACTIVE);
}
NETLIB_UPDATE_PARAM(clock)
{
- m_inc = netlist_time::from_hz(m_freq.Value()*2);
+ m_inc = netlist_time::from_hz(m_freq.Value()*2);
}
NETLIB_UPDATE(clock)
{
- OUTLOGIC(m_Q, !m_Q.net().new_Q(), m_inc );
+ OUTLOGIC(m_Q, !m_Q.net().new_Q(), m_inc );
}
// ----------------------------------------------------------------------------------------
@@ -72,7 +72,7 @@ NETLIB_UPDATE(clock)
NETLIB_START(logic_input)
{
- register_output("Q", m_Q);
+ register_output("Q", m_Q);
}
NETLIB_UPDATE(logic_input)
@@ -85,7 +85,7 @@ NETLIB_UPDATE(logic_input)
NETLIB_START(analog_input)
{
- register_output("Q", m_Q);
+ register_output("Q", m_Q);
}
NETLIB_UPDATE(analog_input)
diff --git a/src/emu/netlist/devices/nld_system.h b/src/emu/netlist/devices/nld_system.h
index 0859d9cddef..323a10b4196 100644
--- a/src/emu/netlist/devices/nld_system.h
+++ b/src/emu/netlist/devices/nld_system.h
@@ -25,16 +25,16 @@
NETDEV_PARAM(_name.CONST, _v)
#define NETDEV_MAINCLOCK(_name) \
- NET_REGISTER_DEV(mainclock, _name)
+ NET_REGISTER_DEV(mainclock, _name)
#define NETDEV_CLOCK(_name) \
- NET_REGISTER_DEV(clock, _name)
+ NET_REGISTER_DEV(clock, _name)
#define NETDEV_LOGIC_INPUT(_name) \
- NET_REGISTER_DEV(logic_input, _name)
+ NET_REGISTER_DEV(logic_input, _name)
#define NETDEV_ANALOG_INPUT(_name) \
- NET_REGISTER_DEV(analog_input, _name)
+ NET_REGISTER_DEV(analog_input, _name)
// ----------------------------------------------------------------------------------------
// netdev_*_const
@@ -56,7 +56,7 @@ NETLIB_DEVICE_WITH_PARAMS(analog_const,
NETLIB_DEVICE_WITH_PARAMS(mainclock,
public:
- netlist_ttl_output_t m_Q;
+ netlist_ttl_output_t m_Q;
netlist_param_double_t m_freq;
netlist_time m_inc;
@@ -69,11 +69,11 @@ public:
// ----------------------------------------------------------------------------------------
NETLIB_DEVICE_WITH_PARAMS(clock,
- netlist_ttl_input_t m_feedback;
- netlist_ttl_output_t m_Q;
+ netlist_ttl_input_t m_feedback;
+ netlist_ttl_output_t m_Q;
- netlist_param_double_t m_freq;
- netlist_time m_inc;
+ netlist_param_double_t m_freq;
+ netlist_time m_inc;
);
@@ -82,11 +82,11 @@ NETLIB_DEVICE_WITH_PARAMS(clock,
// ----------------------------------------------------------------------------------------
NETLIB_DEVICE(logic_input,
- netlist_ttl_output_t m_Q;
+ netlist_ttl_output_t m_Q;
);
NETLIB_DEVICE(analog_input,
- netlist_analog_output_t m_Q;
+ netlist_analog_output_t m_Q;
);
diff --git a/src/emu/netlist/devices/nld_twoterm.c b/src/emu/netlist/devices/nld_twoterm.c
index ddf7fc128cd..67262ea0cdd 100644
--- a/src/emu/netlist/devices/nld_twoterm.c
+++ b/src/emu/netlist/devices/nld_twoterm.c
@@ -12,10 +12,10 @@
// ----------------------------------------------------------------------------------------
ATTR_COLD NETLIB_NAME(twoterm)::NETLIB_NAME(twoterm)(const family_t afamily) :
- netlist_device_t(afamily)
+ netlist_device_t(afamily)
{
- m_P.m_otherterm = &m_N;
- m_N.m_otherterm = &m_P;
+ m_P.m_otherterm = &m_N;
+ m_N.m_otherterm = &m_P;
}
NETLIB_START(twoterm)
@@ -24,8 +24,8 @@ NETLIB_START(twoterm)
NETLIB_UPDATE(twoterm)
{
- /* only called if connected to a rail net ==> notify the solver to recalculate */
- netlist().solver()->schedule();
+ /* only called if connected to a rail net ==> notify the solver to recalculate */
+ netlist().solver()->schedule();
}
// ----------------------------------------------------------------------------------------
@@ -34,29 +34,29 @@ NETLIB_UPDATE(twoterm)
NETLIB_START(R_base)
{
- register_terminal("1", m_P);
- register_terminal("2", m_N);
+ register_terminal("1", m_P);
+ register_terminal("2", m_N);
}
NETLIB_UPDATE(R_base)
{
- NETLIB_NAME(twoterm)::update();
+ NETLIB_NAME(twoterm)::update();
}
NETLIB_START(R)
{
- NETLIB_NAME(R_base)::start();
- register_param("R", m_R, 1.0 / NETLIST_GMIN);
+ NETLIB_NAME(R_base)::start();
+ register_param("R", m_R, 1.0 / NETLIST_GMIN);
}
NETLIB_UPDATE(R)
{
- NETLIB_NAME(twoterm)::update();
+ NETLIB_NAME(twoterm)::update();
}
NETLIB_UPDATE_PARAM(R)
{
- set_R(m_R.Value());
+ set_R(m_R.Value());
}
// ----------------------------------------------------------------------------------------
@@ -65,30 +65,30 @@ NETLIB_UPDATE_PARAM(R)
NETLIB_START(POT)
{
- register_sub(m_R1, "R1");
- register_sub(m_R2, "R2");
+ register_sub(m_R1, "R1");
+ register_sub(m_R2, "R2");
- register_subalias("1", m_R1.m_P);
- register_subalias("2", m_R1.m_N);
- register_subalias("3", m_R2.m_N);
+ register_subalias("1", m_R1.m_P);
+ register_subalias("2", m_R1.m_N);
+ register_subalias("3", m_R2.m_N);
- setup().connect(m_R2.m_P, m_R1.m_N);
+ setup().connect(m_R2.m_P, m_R1.m_N);
- register_param("R", m_R, 1.0 / NETLIST_GMIN);
- register_param("DIAL", m_Dial, 0.5);
+ register_param("R", m_R, 1.0 / NETLIST_GMIN);
+ register_param("DIAL", m_Dial, 0.5);
}
NETLIB_UPDATE(POT)
{
- m_R1.update_dev();
- m_R2.update_dev();
+ m_R1.update_dev();
+ m_R2.update_dev();
}
NETLIB_UPDATE_PARAM(POT)
{
- m_R1.set_R(MAX(m_R.Value() * m_Dial.Value(), NETLIST_GMIN));
- m_R2.set_R(MAX(m_R.Value() * (1.0 - m_Dial.Value()), NETLIST_GMIN));
+ m_R1.set_R(MAX(m_R.Value() * m_Dial.Value(), NETLIST_GMIN));
+ m_R2.set_R(MAX(m_R.Value() * (1.0 - m_Dial.Value()), NETLIST_GMIN));
}
// ----------------------------------------------------------------------------------------
// nld_C
@@ -96,21 +96,21 @@ NETLIB_UPDATE_PARAM(POT)
NETLIB_START(C)
{
- register_terminal("1", m_P);
- register_terminal("2", m_N);
+ register_terminal("1", m_P);
+ register_terminal("2", m_N);
- register_param("C", m_C, 1e-6);
+ register_param("C", m_C, 1e-6);
}
NETLIB_UPDATE_PARAM(C)
{
- // set to some very small step time for now
- step_time(1e-9);
+ // set to some very small step time for now
+ step_time(1e-9);
}
NETLIB_UPDATE(C)
{
- NETLIB_NAME(twoterm)::update();
+ NETLIB_NAME(twoterm)::update();
}
// ----------------------------------------------------------------------------------------
@@ -119,59 +119,59 @@ NETLIB_UPDATE(C)
NETLIB_START(D)
{
- register_terminal("A", m_P);
- register_terminal("K", m_N);
- register_param("model", m_model, "");
+ register_terminal("A", m_P);
+ register_terminal("K", m_N);
+ register_param("model", m_model, "");
- m_Vd = 0.7;
+ m_Vd = 0.7;
- save(NAME(m_Vd));
+ save(NAME(m_Vd));
}
NETLIB_UPDATE_PARAM(D)
{
- m_Is = m_model.dValue("Is", 1e-15);
- m_n = m_model.dValue("N", 1);
+ m_Is = m_model.dValue("Is", 1e-15);
+ m_n = m_model.dValue("N", 1);
- m_Vt = 0.0258 * m_n;
+ m_Vt = 0.0258 * m_n;
- m_Vcrit = m_Vt * log(m_Vt / m_Is / sqrt(2.0));
- m_VtInv = 1.0 / m_Vt;
- NL_VERBOSE_OUT(("VCutoff: %f\n", m_Vcrit));
+ m_Vcrit = m_Vt * log(m_Vt / m_Is / sqrt(2.0));
+ m_VtInv = 1.0 / m_Vt;
+ NL_VERBOSE_OUT(("VCutoff: %f\n", m_Vcrit));
}
NETLIB_UPDATE(D)
{
- NETLIB_NAME(twoterm)::update();
+ NETLIB_NAME(twoterm)::update();
}
class diode
{
public:
- diode() : m_Is(1e-15), m_VT(0.0258), m_VT_inv(1.0 / m_VT) {}
- diode(const double Is, const double n)
- {
- m_Is = Is;
- m_VT = 0.0258 * n;
- m_VT_inv = 1.0 / m_VT;
- }
- void set(const double Is, const double n)
- {
- m_Is = Is;
- m_VT = 0.0258 * n;
- m_VT_inv = 1.0 / m_VT;
- }
- double I(const double V) const { return m_Is * exp(V * m_VT_inv) - m_Is; }
- double g(const double V) const { return m_Is * m_VT_inv * exp(V * m_VT_inv); }
- double V(const double I) const { return log(1.0 + I / m_Is) * m_VT; }
- double gI(const double I) const { return m_VT_inv * (I + m_Is); }
+ diode() : m_Is(1e-15), m_VT(0.0258), m_VT_inv(1.0 / m_VT) {}
+ diode(const double Is, const double n)
+ {
+ m_Is = Is;
+ m_VT = 0.0258 * n;
+ m_VT_inv = 1.0 / m_VT;
+ }
+ void set(const double Is, const double n)
+ {
+ m_Is = Is;
+ m_VT = 0.0258 * n;
+ m_VT_inv = 1.0 / m_VT;
+ }
+ double I(const double V) const { return m_Is * exp(V * m_VT_inv) - m_Is; }
+ double g(const double V) const { return m_Is * m_VT_inv * exp(V * m_VT_inv); }
+ double V(const double I) const { return log(1.0 + I / m_Is) * m_VT; }
+ double gI(const double I) const { return m_VT_inv * (I + m_Is); }
private:
- double m_Is;
- double m_VT;
- double m_VT_inv;
+ double m_Is;
+ double m_VT;
+ double m_VT_inv;
};
// ----------------------------------------------------------------------------------------
@@ -180,61 +180,61 @@ private:
NETLIB_START(Q)
{
- register_param("model", m_model, "");
+ register_param("model", m_model, "");
}
template <NETLIB_NAME(Q)::q_type _type>
NETLIB_START(QBJT_switch<_type>)
{
- NETLIB_NAME(Q)::start();
+ NETLIB_NAME(Q)::start();
- register_sub(m_RB, "RB");
- register_sub(m_RC, "RC");
- register_input("BV", m_BV);
- register_input("EV", m_EV);
+ register_sub(m_RB, "RB");
+ register_sub(m_RC, "RC");
+ register_input("BV", m_BV);
+ register_input("EV", m_EV);
- register_subalias("B", m_RB.m_P);
- register_subalias("E", m_RB.m_N);
- register_subalias("C", m_RC.m_P);
+ register_subalias("B", m_RB.m_P);
+ register_subalias("E", m_RB.m_N);
+ register_subalias("C", m_RC.m_P);
- setup().connect(m_RB.m_N, m_RC.m_N);
- setup().connect(m_RB.m_P, m_BV);
- setup().connect(m_RB.m_N, m_EV);
+ setup().connect(m_RB.m_N, m_RC.m_N);
+ setup().connect(m_RB.m_P, m_BV);
+ setup().connect(m_RB.m_N, m_EV);
- save(NAME(m_state_on));
+ save(NAME(m_state_on));
}
NETLIB_UPDATE(Q)
{
- netlist().solver()->schedule();
+ netlist().solver()->schedule();
}
template <NETLIB_NAME(Q)::q_type _type>
NETLIB_UPDATE_PARAM(QBJT_switch<_type>)
{
- double IS = m_model.dValue("IS", 1e-15);
- double BF = m_model.dValue("BF", 100);
- double NF = m_model.dValue("NF", 1);
- //double VJE = m_model.dValue("VJE", 0.75);
+ double IS = m_model.dValue("IS", 1e-15);
+ double BF = m_model.dValue("BF", 100);
+ double NF = m_model.dValue("NF", 1);
+ //double VJE = m_model.dValue("VJE", 0.75);
- double alpha = BF / (1.0 + BF);
+ double alpha = BF / (1.0 + BF);
- diode d(IS, NF);
+ diode d(IS, NF);
- // Assume 5mA Collector current for switch operation
+ // Assume 5mA Collector current for switch operation
- if (_type == BJT_NPN)
- m_V = d.V(0.005 / alpha);
- else
- m_V = - d.V(0.005 / alpha);
+ if (_type == BJT_NPN)
+ m_V = d.V(0.005 / alpha);
+ else
+ m_V = - d.V(0.005 / alpha);
- m_gB = d.gI(0.005 / alpha);
- if (m_gB < NETLIST_GMIN)
- m_gB = NETLIST_GMIN;
- m_gC = BF * m_gB; // very rough estimate
- //printf("%f %f \n", m_V, m_gB);
- m_RB.set(NETLIST_GMIN, 0.0, 0.0);
- m_RC.set(NETLIST_GMIN, 0.0, 0.0);
+ m_gB = d.gI(0.005 / alpha);
+ if (m_gB < NETLIST_GMIN)
+ m_gB = NETLIST_GMIN;
+ m_gC = BF * m_gB; // very rough estimate
+ //printf("%f %f \n", m_V, m_gB);
+ m_RB.set(NETLIST_GMIN, 0.0, 0.0);
+ m_RC.set(NETLIST_GMIN, 0.0, 0.0);
}
template NETLIB_START(QBJT_switch<NETLIB_NAME(Q)::BJT_NPN>);
@@ -248,40 +248,39 @@ template NETLIB_UPDATE_PARAM(QBJT_switch<NETLIB_NAME(Q)::BJT_PNP>);
NETLIB_START(VCCS)
{
- configure(1.0, NETLIST_GMIN);
+ configure(1.0, NETLIST_GMIN);
}
ATTR_COLD void NETLIB_NAME(VCCS)::configure(const double Gfac, const double GI)
{
-
- register_param("G", m_G, 1.0);
-
- register_terminal("IP", m_IP);
- register_terminal("IN", m_IN);
- register_terminal("OP", m_OP);
- register_terminal("ON", m_ON);
-
- m_OP1.init_object(*this, name() + ".OP1", netlist_core_terminal_t::STATE_INP_ACTIVE);
- m_ON1.init_object(*this, name() + ".ON1", netlist_core_terminal_t::STATE_INP_ACTIVE);
-
- const double m_mult = m_G.Value() * Gfac; // 1.0 ==> 1V ==> 1A
- m_IP.set(GI);
- m_IP.m_otherterm = &m_IN; // <= this should be NULL and terminal be filtered out prior to solving...
- m_IN.set(GI);
- m_IN.m_otherterm = &m_IP; // <= this should be NULL and terminal be filtered out prior to solving...
-
- m_OP.set(m_mult, 0.0);
- m_OP.m_otherterm = &m_IP;
- m_OP1.set(-m_mult, 0.0);
- m_OP1.m_otherterm = &m_IN;
-
- m_ON.set(-m_mult, 0.0);
- m_ON.m_otherterm = &m_IP;
- m_ON1.set(m_mult, 0.0);
- m_ON1.m_otherterm = &m_IN;
-
- setup().connect(m_OP, m_OP1);
- setup().connect(m_ON, m_ON1);
+ register_param("G", m_G, 1.0);
+
+ register_terminal("IP", m_IP);
+ register_terminal("IN", m_IN);
+ register_terminal("OP", m_OP);
+ register_terminal("ON", m_ON);
+
+ m_OP1.init_object(*this, name() + ".OP1", netlist_core_terminal_t::STATE_INP_ACTIVE);
+ m_ON1.init_object(*this, name() + ".ON1", netlist_core_terminal_t::STATE_INP_ACTIVE);
+
+ const double m_mult = m_G.Value() * Gfac; // 1.0 ==> 1V ==> 1A
+ m_IP.set(GI);
+ m_IP.m_otherterm = &m_IN; // <= this should be NULL and terminal be filtered out prior to solving...
+ m_IN.set(GI);
+ m_IN.m_otherterm = &m_IP; // <= this should be NULL and terminal be filtered out prior to solving...
+
+ m_OP.set(m_mult, 0.0);
+ m_OP.m_otherterm = &m_IP;
+ m_OP1.set(-m_mult, 0.0);
+ m_OP1.m_otherterm = &m_IN;
+
+ m_ON.set(-m_mult, 0.0);
+ m_ON.m_otherterm = &m_IP;
+ m_ON1.set(m_mult, 0.0);
+ m_ON1.m_otherterm = &m_IN;
+
+ setup().connect(m_OP, m_OP1);
+ setup().connect(m_ON, m_ON1);
}
NETLIB_UPDATE_PARAM(VCCS)
@@ -290,8 +289,8 @@ NETLIB_UPDATE_PARAM(VCCS)
NETLIB_UPDATE(VCCS)
{
- /* only called if connected to a rail net ==> notify the solver to recalculate */
- netlist().solver()->schedule();
+ /* only called if connected to a rail net ==> notify the solver to recalculate */
+ netlist().solver()->schedule();
}
// ----------------------------------------------------------------------------------------
@@ -300,25 +299,24 @@ NETLIB_UPDATE(VCCS)
NETLIB_START(VCVS)
{
- register_param("RO", m_RO, 1.0);
+ register_param("RO", m_RO, 1.0);
- const double gRO = 1.0 / m_RO.Value();
+ const double gRO = 1.0 / m_RO.Value();
- configure(gRO, NETLIST_GMIN);
+ configure(gRO, NETLIST_GMIN);
- m_OP2.init_object(*this, "OP2", netlist_core_terminal_t::STATE_INP_ACTIVE);
- m_ON2.init_object(*this, "ON2", netlist_core_terminal_t::STATE_INP_ACTIVE);
+ m_OP2.init_object(*this, "OP2", netlist_core_terminal_t::STATE_INP_ACTIVE);
+ m_ON2.init_object(*this, "ON2", netlist_core_terminal_t::STATE_INP_ACTIVE);
- m_OP2.set(gRO);
- m_ON2.set(gRO);
- m_OP2.m_otherterm = &m_ON2;
- m_ON2.m_otherterm = &m_OP2;
+ m_OP2.set(gRO);
+ m_ON2.set(gRO);
+ m_OP2.m_otherterm = &m_ON2;
+ m_ON2.m_otherterm = &m_OP2;
- setup().connect(m_OP2, m_OP1);
- setup().connect(m_ON2, m_ON1);
+ setup().connect(m_OP2, m_OP1);
+ setup().connect(m_ON2, m_ON1);
}
NETLIB_UPDATE_PARAM(VCVS)
{
}
-
diff --git a/src/emu/netlist/devices/nld_twoterm.h b/src/emu/netlist/devices/nld_twoterm.h
index 49b6ca3c629..6ebebf36903 100644
--- a/src/emu/netlist/devices/nld_twoterm.h
+++ b/src/emu/netlist/devices/nld_twoterm.h
@@ -40,30 +40,30 @@
// ----------------------------------------------------------------------------------------
#define NETDEV_R(_name, _R) \
- NET_REGISTER_DEV(R, _name) \
- NETDEV_PARAMI(_name, R, _R)
+ NET_REGISTER_DEV(R, _name) \
+ NETDEV_PARAMI(_name, R, _R)
#define NETDEV_POT(_name, _R) \
- NET_REGISTER_DEV(POT, _name) \
- NETDEV_PARAMI(_name, R, _R)
+ NET_REGISTER_DEV(POT, _name) \
+ NETDEV_PARAMI(_name, R, _R)
#define NETDEV_C(_name, _C) \
- NET_REGISTER_DEV(C, _name) \
- NETDEV_PARAMI(_name, C, _C)
+ NET_REGISTER_DEV(C, _name) \
+ NETDEV_PARAMI(_name, C, _C)
/* Generic Diode */
#define NETDEV_D(_name, _model) \
- NET_REGISTER_DEV(D, _name) \
- NETDEV_PARAMI(_name, model, # _model)
+ NET_REGISTER_DEV(D, _name) \
+ NETDEV_PARAMI(_name, model, # _model)
#define NETDEV_QPNP(_name, _model) \
- NET_REGISTER_DEV(QPNP_switch, _name) \
- NETDEV_PARAMI(_name, model, # _model)
+ NET_REGISTER_DEV(QPNP_switch, _name) \
+ NETDEV_PARAMI(_name, model, # _model)
#define NETDEV_QNPN(_name, _model) \
- NET_REGISTER_DEV(QNPN_switch, _name) \
- NETDEV_PARAMI(_name, model, # _model)
+ NET_REGISTER_DEV(QNPN_switch, _name) \
+ NETDEV_PARAMI(_name, model, # _model)
// ----------------------------------------------------------------------------------------
// Implementation
@@ -76,24 +76,24 @@
class NETLIB_NAME(twoterm) : public netlist_device_t
{
public:
- ATTR_COLD NETLIB_NAME(twoterm)(const family_t afamily);
+ ATTR_COLD NETLIB_NAME(twoterm)(const family_t afamily);
- netlist_terminal_t m_P;
- netlist_terminal_t m_N;
+ netlist_terminal_t m_P;
+ netlist_terminal_t m_N;
- virtual NETLIB_UPDATE_TERMINALS()
- {
- }
+ virtual NETLIB_UPDATE_TERMINALS()
+ {
+ }
- ATTR_HOT inline void set(const double G, const double V, const double I)
- {
- m_P.m_go = m_N.m_go = m_P.m_gt = m_N.m_gt = G;
- m_N.m_Idr = ( -V) * G + I;
- m_P.m_Idr = ( V) * G - I;
- }
+ ATTR_HOT inline void set(const double G, const double V, const double I)
+ {
+ m_P.m_go = m_N.m_go = m_P.m_gt = m_N.m_gt = G;
+ m_N.m_Idr = ( -V) * G + I;
+ m_P.m_Idr = ( V) * G - I;
+ }
protected:
- ATTR_COLD virtual void start();
- ATTR_HOT ATTR_ALIGN void update();
+ ATTR_COLD virtual void start();
+ ATTR_HOT ATTR_ALIGN void update();
private:
};
@@ -105,17 +105,17 @@ private:
class NETLIB_NAME(R_base) : public NETLIB_NAME(twoterm)
{
public:
- ATTR_COLD NETLIB_NAME(R_base)() : NETLIB_NAME(twoterm)(RESISTOR) { }
+ ATTR_COLD NETLIB_NAME(R_base)() : NETLIB_NAME(twoterm)(RESISTOR) { }
- inline void set_R(const double R) { set(1.0 / R, 0.0, 0.0); }
+ inline void set_R(const double R) { set(1.0 / R, 0.0, 0.0); }
protected:
- ATTR_COLD virtual void start();
- ATTR_HOT ATTR_ALIGN void update();
+ ATTR_COLD virtual void start();
+ ATTR_HOT ATTR_ALIGN void update();
};
NETLIB_DEVICE_WITH_PARAMS_DERIVED(R, R_base,
- netlist_param_double_t m_R;
+ netlist_param_double_t m_R;
);
// ----------------------------------------------------------------------------------------
@@ -123,11 +123,11 @@ NETLIB_DEVICE_WITH_PARAMS_DERIVED(R, R_base,
// ----------------------------------------------------------------------------------------
NETLIB_DEVICE_WITH_PARAMS(POT,
- NETLIB_NAME(R_base) m_R1;
- NETLIB_NAME(R_base) m_R2;
+ NETLIB_NAME(R_base) m_R1;
+ NETLIB_NAME(R_base) m_R2;
- netlist_param_double_t m_R;
- netlist_param_double_t m_Dial;
+ netlist_param_double_t m_R;
+ netlist_param_double_t m_Dial;
);
@@ -138,21 +138,21 @@ NETLIB_DEVICE_WITH_PARAMS(POT,
class NETLIB_NAME(C) : public NETLIB_NAME(twoterm)
{
public:
- ATTR_COLD NETLIB_NAME(C)() : NETLIB_NAME(twoterm)(CAPACITOR) { }
+ ATTR_COLD NETLIB_NAME(C)() : NETLIB_NAME(twoterm)(CAPACITOR) { }
- ATTR_HOT void step_time(const double st)
- {
- double G = m_C.Value() / st;
- double I = -G * (m_P.net().Q_Analog()- m_N.net().Q_Analog());
- set(G, 0.0, I);
- }
+ ATTR_HOT void step_time(const double st)
+ {
+ double G = m_C.Value() / st;
+ double I = -G * (m_P.net().Q_Analog()- m_N.net().Q_Analog());
+ set(G, 0.0, I);
+ }
protected:
- ATTR_COLD virtual void start();
- ATTR_COLD virtual void update_param();
- ATTR_HOT ATTR_ALIGN void update();
+ ATTR_COLD virtual void start();
+ ATTR_COLD virtual void update_param();
+ ATTR_HOT ATTR_ALIGN void update();
- netlist_param_double_t m_C;
+ netlist_param_double_t m_C;
};
@@ -167,87 +167,87 @@ protected:
#if 0
inline double fastexp_h(const double x)
{
- static const double ln2r = 1.442695040888963387;
- static const double ln2 = 0.693147180559945286;
- //static const double c3 = 0.166666666666666667;
+ static const double ln2r = 1.442695040888963387;
+ static const double ln2 = 0.693147180559945286;
+ //static const double c3 = 0.166666666666666667;
- const double y = x * ln2r;
- const unsigned int t = y;
- const double z = (x - ln2 * (double) t);
- const double zz = z * z;
- //const double zzz = zz * z;
+ const double y = x * ln2r;
+ const unsigned int t = y;
+ const double z = (x - ln2 * (double) t);
+ const double zz = z * z;
+ //const double zzz = zz * z;
- return (double)(1 << t)*(1.0 + z + 0.5 * zz); // + c3*zzz;
+ return (double)(1 << t)*(1.0 + z + 0.5 * zz); // + c3*zzz;
}
inline double fastexp(const double x)
{
- if (x<0)
- return 1.0 / fastexp_h(-x);
- else
- return fastexp_h(x);
+ if (x<0)
+ return 1.0 / fastexp_h(-x);
+ else
+ return fastexp_h(x);
}
#endif
class NETLIB_NAME(D) : public NETLIB_NAME(twoterm)
{
public:
- ATTR_COLD NETLIB_NAME(D)() : NETLIB_NAME(twoterm)(DIODE) { }
-
- NETLIB_UPDATE_TERMINALS()
- {
- const double nVd = m_P.net().Q_Analog()- m_N.net().Q_Analog();
-
- //FIXME: Optimize cutoff case
-
- double Id;
- double G;
-
- if (nVd < -5.0 * m_Vt)
- {
- m_Vd = nVd;
- G = NETLIST_GMIN;
- Id = - m_Is;
- }
- else if (nVd < m_Vcrit)
- {
- m_Vd = nVd;
-
- const double eVDVt = exp(m_Vd * m_VtInv);
- Id = m_Is * (eVDVt - 1.0);
- G = m_Is * m_VtInv * eVDVt;
- }
- else
- {
+ ATTR_COLD NETLIB_NAME(D)() : NETLIB_NAME(twoterm)(DIODE) { }
+
+ NETLIB_UPDATE_TERMINALS()
+ {
+ const double nVd = m_P.net().Q_Analog()- m_N.net().Q_Analog();
+
+ //FIXME: Optimize cutoff case
+
+ double Id;
+ double G;
+
+ if (nVd < -5.0 * m_Vt)
+ {
+ m_Vd = nVd;
+ G = NETLIST_GMIN;
+ Id = - m_Is;
+ }
+ else if (nVd < m_Vcrit)
+ {
+ m_Vd = nVd;
+
+ const double eVDVt = exp(m_Vd * m_VtInv);
+ Id = m_Is * (eVDVt - 1.0);
+ G = m_Is * m_VtInv * eVDVt;
+ }
+ else
+ {
#if defined(_MSC_VER) && _MSC_VER < 1800
- m_Vd = m_Vd + log((nVd - m_Vd) * m_VtInv + 1.0) * m_Vt;
+ m_Vd = m_Vd + log((nVd - m_Vd) * m_VtInv + 1.0) * m_Vt;
#else
- m_Vd = m_Vd + log1p((nVd - m_Vd) * m_VtInv) * m_Vt;
+ m_Vd = m_Vd + log1p((nVd - m_Vd) * m_VtInv) * m_Vt;
#endif
- const double eVDVt = exp(m_Vd * m_VtInv);
- Id = m_Is * (eVDVt - 1.0);
+ const double eVDVt = exp(m_Vd * m_VtInv);
+ Id = m_Is * (eVDVt - 1.0);
- G = m_Is * m_VtInv * eVDVt;
- }
+ G = m_Is * m_VtInv * eVDVt;
+ }
- double I = (Id - m_Vd * G);
- set(G, 0.0, I);
- }
+ double I = (Id - m_Vd * G);
+ set(G, 0.0, I);
+ }
protected:
- ATTR_COLD virtual void start();
- ATTR_COLD virtual void update_param();
- ATTR_HOT ATTR_ALIGN void update();
+ ATTR_COLD virtual void start();
+ ATTR_COLD virtual void update_param();
+ ATTR_HOT ATTR_ALIGN void update();
- netlist_param_model_t m_model;
+ netlist_param_model_t m_model;
- double m_Vt;
- double m_Is;
- double m_n;
+ double m_Vt;
+ double m_Is;
+ double m_n;
- double m_VtInv;
- double m_Vcrit;
- double m_Vd;
+ double m_VtInv;
+ double m_Vcrit;
+ double m_Vd;
};
@@ -269,32 +269,32 @@ protected:
class NETLIB_NAME(Q) : public netlist_device_t
{
public:
- enum q_type {
- BJT_NPN,
- BJT_PNP
- };
+ enum q_type {
+ BJT_NPN,
+ BJT_PNP
+ };
- ATTR_COLD NETLIB_NAME(Q)(const q_type atype, const family_t afamily)
- : netlist_device_t(afamily)
- , m_qtype(atype) { }
+ ATTR_COLD NETLIB_NAME(Q)(const q_type atype, const family_t afamily)
+ : netlist_device_t(afamily)
+ , m_qtype(atype) { }
- inline q_type qtype() const { return m_qtype; }
- inline bool is_qtype(q_type atype) const { return m_qtype == atype; }
+ inline q_type qtype() const { return m_qtype; }
+ inline bool is_qtype(q_type atype) const { return m_qtype == atype; }
protected:
- ATTR_COLD virtual void start();
- ATTR_HOT ATTR_ALIGN void update();
+ ATTR_COLD virtual void start();
+ ATTR_HOT ATTR_ALIGN void update();
- netlist_param_model_t m_model;
+ netlist_param_model_t m_model;
private:
- q_type m_qtype;
+ q_type m_qtype;
};
class NETLIB_NAME(QBJT) : public NETLIB_NAME(Q)
{
public:
- ATTR_COLD NETLIB_NAME(QBJT)(const q_type atype, const family_t afamily)
- : NETLIB_NAME(Q)(atype, afamily) { }
+ ATTR_COLD NETLIB_NAME(QBJT)(const q_type atype, const family_t afamily)
+ : NETLIB_NAME(Q)(atype, afamily) { }
protected:
@@ -306,51 +306,51 @@ template <NETLIB_NAME(Q)::q_type _type>
class NETLIB_NAME(QBJT_switch) : public NETLIB_NAME(QBJT)
{
public:
- ATTR_COLD NETLIB_NAME(QBJT_switch)()
- : NETLIB_NAME(QBJT)(_type, BJT_SWITCH), m_gB(NETLIST_GMIN), m_gC(NETLIST_GMIN), m_V(0.0), m_state_on(0) { }
-
- NETLIB_UPDATEI()
- {
- double vE = INPANALOG(m_EV);
- double vB = INPANALOG(m_BV);
-
- int new_state = (vB - vE > m_V ) ? 1 : 0;
- if (m_state_on ^ new_state)
- {
- double gb = m_gB;
- double gc = m_gC;
- double v = m_V;
- if (!new_state )
- {
- // not conducting
- gb = NETLIST_GMIN;
- v = 0;
- gc = NETLIST_GMIN;
- }
- m_RB.set(gb, v, 0.0);
- m_RC.set(gc, 0.0, 0.0);
- m_state_on = new_state;
- m_RB.update_dev();
- m_RC.update_dev();
- }
-
- }
-
- NETLIB_NAME(R) m_RB;
- NETLIB_NAME(R) m_RC;
-
- netlist_analog_input_t m_BV;
- netlist_analog_input_t m_EV;
+ ATTR_COLD NETLIB_NAME(QBJT_switch)()
+ : NETLIB_NAME(QBJT)(_type, BJT_SWITCH), m_gB(NETLIST_GMIN), m_gC(NETLIST_GMIN), m_V(0.0), m_state_on(0) { }
+
+ NETLIB_UPDATEI()
+ {
+ double vE = INPANALOG(m_EV);
+ double vB = INPANALOG(m_BV);
+
+ int new_state = (vB - vE > m_V ) ? 1 : 0;
+ if (m_state_on ^ new_state)
+ {
+ double gb = m_gB;
+ double gc = m_gC;
+ double v = m_V;
+ if (!new_state )
+ {
+ // not conducting
+ gb = NETLIST_GMIN;
+ v = 0;
+ gc = NETLIST_GMIN;
+ }
+ m_RB.set(gb, v, 0.0);
+ m_RC.set(gc, 0.0, 0.0);
+ m_state_on = new_state;
+ m_RB.update_dev();
+ m_RC.update_dev();
+ }
+
+ }
+
+ NETLIB_NAME(R) m_RB;
+ NETLIB_NAME(R) m_RC;
+
+ netlist_analog_input_t m_BV;
+ netlist_analog_input_t m_EV;
protected:
- ATTR_COLD virtual void start();
- ATTR_COLD void update_param();
+ ATTR_COLD virtual void start();
+ ATTR_COLD void update_param();
- double m_gB; // base conductance / switch on
- double m_gC; // collector conductance / switch on
- double m_V; // internal voltage source
- UINT8 m_state_on;
+ double m_gB; // base conductance / switch on
+ double m_gC; // collector conductance / switch on
+ double m_V; // internal voltage source
+ UINT8 m_state_on;
private:
};
@@ -380,35 +380,34 @@ typedef NETLIB_NAME(QBJT_switch)<NETLIB_NAME(Q)::BJT_NPN> NETLIB_NAME(QNPN_switc
*/
#define NETDEV_VCCS(_name) \
- NET_REGISTER_DEV(VCCS, _name) \
-
+ NET_REGISTER_DEV(VCCS, _name)
//NETDEV_PARAMI(_name, model, _model)
class NETLIB_NAME(VCCS) : public netlist_device_t
{
public:
- ATTR_COLD NETLIB_NAME(VCCS)()
- : netlist_device_t(VCCS) { }
- ATTR_COLD NETLIB_NAME(VCCS)(const family_t afamily)
- : netlist_device_t(afamily) { }
+ ATTR_COLD NETLIB_NAME(VCCS)()
+ : netlist_device_t(VCCS) { }
+ ATTR_COLD NETLIB_NAME(VCCS)(const family_t afamily)
+ : netlist_device_t(afamily) { }
protected:
- ATTR_COLD virtual void start();
- ATTR_COLD virtual void update_param();
- ATTR_HOT ATTR_ALIGN void update();
+ ATTR_COLD virtual void start();
+ ATTR_COLD virtual void update_param();
+ ATTR_HOT ATTR_ALIGN void update();
- ATTR_COLD void configure(const double Gfac, const double GI);
+ ATTR_COLD void configure(const double Gfac, const double GI);
- netlist_terminal_t m_OP;
- netlist_terminal_t m_ON;
+ netlist_terminal_t m_OP;
+ netlist_terminal_t m_ON;
- netlist_terminal_t m_IP;
- netlist_terminal_t m_IN;
+ netlist_terminal_t m_IP;
+ netlist_terminal_t m_IN;
- netlist_terminal_t m_OP1;
- netlist_terminal_t m_ON1;
+ netlist_terminal_t m_OP1;
+ netlist_terminal_t m_ON1;
- netlist_param_double_t m_G;
+ netlist_param_double_t m_G;
};
// ----------------------------------------------------------------------------------------
@@ -439,28 +438,27 @@ protected:
*/
#define NETDEV_VCVS(_name) \
- NET_REGISTER_DEV(VCVS, _name) \
-
+ NET_REGISTER_DEV(VCVS, _name)
//NETDEV_PARAMI(_name, model, _model)
class NETLIB_NAME(VCVS) : public NETLIB_NAME(VCCS)
{
public:
- ATTR_COLD NETLIB_NAME(VCVS)()
- : NETLIB_NAME(VCCS)(VCVS) { }
+ ATTR_COLD NETLIB_NAME(VCVS)()
+ : NETLIB_NAME(VCCS)(VCVS) { }
protected:
- ATTR_COLD virtual void start();
- ATTR_COLD virtual void update_param();
- //ATTR_HOT ATTR_ALIGN void update();
+ ATTR_COLD virtual void start();
+ ATTR_COLD virtual void update_param();
+ //ATTR_HOT ATTR_ALIGN void update();
- netlist_terminal_t m_OP2;
- netlist_terminal_t m_ON2;
+ netlist_terminal_t m_OP2;
+ netlist_terminal_t m_ON2;
- double m_mult;
+ double m_mult;
- netlist_param_double_t m_RO;
+ netlist_param_double_t m_RO;
};
diff --git a/src/emu/netlist/nl_base.c b/src/emu/netlist/nl_base.c
index cf7f4b28e3b..0e1e11db908 100644
--- a/src/emu/netlist/nl_base.c
+++ b/src/emu/netlist/nl_base.c
@@ -22,21 +22,21 @@ ATTR_COLD netlist_object_t::netlist_object_t(const type_t atype, const family_t
ATTR_COLD netlist_object_t::~netlist_object_t()
{
- //delete m_name;
+ //delete m_name;
}
ATTR_COLD void netlist_object_t::init_object(netlist_base_t &nl, const pstring &aname)
{
- m_netlist = &nl;
- m_name = aname;
- save_register();
+ m_netlist = &nl;
+ m_name = aname;
+ save_register();
}
ATTR_COLD const pstring &netlist_object_t::name() const
{
- if (m_name == "")
- netlist().xfatalerror("object not initialized");
- return m_name;
+ if (m_name == "")
+ netlist().xfatalerror("object not initialized");
+ return m_name;
}
// ----------------------------------------------------------------------------------------
@@ -44,17 +44,17 @@ ATTR_COLD const pstring &netlist_object_t::name() const
// ----------------------------------------------------------------------------------------
ATTR_COLD netlist_owned_object_t::netlist_owned_object_t(const type_t atype,
- const family_t afamily)
+ const family_t afamily)
: netlist_object_t(atype, afamily)
, m_netdev(NULL)
{
}
ATTR_COLD void netlist_owned_object_t::init_object(netlist_core_device_t &dev,
- const pstring &aname)
+ const pstring &aname)
{
- netlist_object_t::init_object(dev.netlist(), aname);
- m_netdev = &dev;
+ netlist_object_t::init_object(dev.netlist(), aname);
+ m_netdev = &dev;
}
// ----------------------------------------------------------------------------------------
@@ -62,186 +62,186 @@ ATTR_COLD void netlist_owned_object_t::init_object(netlist_core_device_t &dev,
// ----------------------------------------------------------------------------------------
netlist_base_t::netlist_base_t()
- : netlist_object_t(NETLIST, GENERIC),
- m_time_ps(netlist_time::zero),
- m_rem(0),
- m_div(NETLIST_DIV),
- m_mainclock(NULL),
- m_solver(NULL)
+ : netlist_object_t(NETLIST, GENERIC),
+ m_time_ps(netlist_time::zero),
+ m_rem(0),
+ m_div(NETLIST_DIV),
+ m_mainclock(NULL),
+ m_solver(NULL)
{
}
template <class T>
static void tagmap_free_entries(T &tm)
{
- for (typename T::entry_t *entry = tm.first(); entry != NULL; entry = tm.next(entry))
- {
- delete entry->object();
- }
- tm.reset();
+ for (typename T::entry_t *entry = tm.first(); entry != NULL; entry = tm.next(entry))
+ {
+ delete entry->object();
+ }
+ tm.reset();
}
netlist_base_t::~netlist_base_t()
{
- tagmap_free_entries<tagmap_devices_t>(m_devices);
+ tagmap_free_entries<tagmap_devices_t>(m_devices);
- netlist_net_t::list_t::entry_t *p = m_nets.first();
- while (p != NULL)
- {
- netlist_net_t::list_t::entry_t *pn = m_nets.next(p);
- if (!p->object()->isRailNet())
- delete p->object();
- p = pn;
- }
+ netlist_net_t::list_t::entry_t *p = m_nets.first();
+ while (p != NULL)
+ {
+ netlist_net_t::list_t::entry_t *pn = m_nets.next(p);
+ if (!p->object()->isRailNet())
+ delete p->object();
+ p = pn;
+ }
- m_nets.reset();
- pstring::resetmem();
+ m_nets.reset();
+ pstring::resetmem();
}
ATTR_COLD netlist_net_t *netlist_base_t::find_net(const pstring &name)
{
- for (netlist_net_t::list_t::entry_t *p = m_nets.first(); p != NULL; p = m_nets.next(p))
- {
- if (p->object()->name() == name)
- return p->object();
- }
- return NULL;
+ for (netlist_net_t::list_t::entry_t *p = m_nets.first(); p != NULL; p = m_nets.next(p))
+ {
+ if (p->object()->name() == name)
+ return p->object();
+ }
+ return NULL;
}
ATTR_COLD void netlist_base_t::set_mainclock_dev(NETLIB_NAME(mainclock) *dev)
{
- m_mainclock = dev;
+ m_mainclock = dev;
}
ATTR_COLD void netlist_base_t::set_solver_dev(NETLIB_NAME(solver) *dev)
{
- m_solver = dev;
+ m_solver = dev;
}
ATTR_COLD void netlist_base_t::reset()
{
- m_time_ps = netlist_time::zero;
- m_rem = 0;
- m_queue.clear();
- if (m_mainclock != NULL)
- m_mainclock->m_Q.net().set_time(netlist_time::zero);
+ m_time_ps = netlist_time::zero;
+ m_rem = 0;
+ m_queue.clear();
+ if (m_mainclock != NULL)
+ m_mainclock->m_Q.net().set_time(netlist_time::zero);
- // FIXME: some const devices rely on this
- /* make sure params are set now .. */
- for (tagmap_devices_t::entry_t *entry = m_devices.first(); entry != NULL; entry = m_devices.next(entry))
- {
- entry->object()->update_param();
- }
+ // FIXME: some const devices rely on this
+ /* make sure params are set now .. */
+ for (tagmap_devices_t::entry_t *entry = m_devices.first(); entry != NULL; entry = m_devices.next(entry))
+ {
+ entry->object()->update_param();
+ }
- // Step all devices once !
- for (tagmap_devices_t::entry_t *entry = m_devices.first(); entry != NULL; entry = m_devices.next(entry))
- {
- netlist_device_t *dev = entry->object();
- dev->update_dev();
- }
+ // Step all devices once !
+ for (tagmap_devices_t::entry_t *entry = m_devices.first(); entry != NULL; entry = m_devices.next(entry))
+ {
+ netlist_device_t *dev = entry->object();
+ dev->update_dev();
+ }
}
void netlist_base_t::set_clock_freq(UINT64 clockfreq)
{
- m_div = netlist_time::from_hz(clockfreq).as_raw();
- m_rem = 0;
- assert_always(m_div == NETLIST_DIV, "netlist: illegal clock!");
- NL_VERBOSE_OUT(("Setting clock %" I64FMT "d and divisor %d\n", clockfreq, m_div));
+ m_div = netlist_time::from_hz(clockfreq).as_raw();
+ m_rem = 0;
+ assert_always(m_div == NETLIST_DIV, "netlist: illegal clock!");
+ NL_VERBOSE_OUT(("Setting clock %" I64FMT "d and divisor %d\n", clockfreq, m_div));
}
ATTR_HOT ATTR_ALIGN inline void netlist_base_t::update_time(const netlist_time t, INT32 &atime)
{
- if (NETLIST_DIV_BITS == 0)
- {
- const netlist_time delta = t - m_time_ps;
- m_time_ps = t;
- atime -= delta.as_raw();
- } else {
- const netlist_time delta = t - m_time_ps + netlist_time::from_raw(m_rem);
- m_time_ps = t;
- m_rem = delta.as_raw() & NETLIST_MASK;
- atime -= (delta.as_raw() >> NETLIST_DIV_BITS);
+ if (NETLIST_DIV_BITS == 0)
+ {
+ const netlist_time delta = t - m_time_ps;
+ m_time_ps = t;
+ atime -= delta.as_raw();
+ } else {
+ const netlist_time delta = t - m_time_ps + netlist_time::from_raw(m_rem);
+ m_time_ps = t;
+ m_rem = delta.as_raw() & NETLIST_MASK;
+ atime -= (delta.as_raw() >> NETLIST_DIV_BITS);
- // The folling is suitable for non-power of 2 m_divs ...
- // atime -= divu_64x32_rem(delta.as_raw(), m_div, &m_rem);
- }
+ // The folling is suitable for non-power of 2 m_divs ...
+ // atime -= divu_64x32_rem(delta.as_raw(), m_div, &m_rem);
+ }
}
ATTR_HOT ATTR_ALIGN void netlist_base_t::process_queue(INT32 &atime)
{
- if (m_mainclock == NULL)
- {
- while ( (atime > 0) && (m_queue.is_not_empty()))
- {
- const queue_t::entry_t &e = m_queue.pop();
- update_time(e.time(), atime);
+ if (m_mainclock == NULL)
+ {
+ while ( (atime > 0) && (m_queue.is_not_empty()))
+ {
+ const queue_t::entry_t &e = m_queue.pop();
+ update_time(e.time(), atime);
- //if (FATAL_ERROR_AFTER_NS)
- // NL_VERBOSE_OUT(("%s\n", e.object().netdev()->name().cstr());
+ //if (FATAL_ERROR_AFTER_NS)
+ // NL_VERBOSE_OUT(("%s\n", e.object().netdev()->name().cstr());
- e.object().update_devs();
+ e.object().update_devs();
- add_to_stat(m_perf_out_processed, 1);
+ add_to_stat(m_perf_out_processed, 1);
- if (FATAL_ERROR_AFTER_NS)
- if (time() > NLTIME_FROM_NS(FATAL_ERROR_AFTER_NS))
- xfatalerror("Stopped");
- }
+ if (FATAL_ERROR_AFTER_NS)
+ if (time() > NLTIME_FROM_NS(FATAL_ERROR_AFTER_NS))
+ xfatalerror("Stopped");
+ }
- if (atime > 0)
- {
- m_time_ps += netlist_time::from_raw(atime * m_div);
- atime = 0;
- }
- } else {
- netlist_net_t &mcQ = m_mainclock->m_Q.net();
- const netlist_time inc = m_mainclock->m_inc;
+ if (atime > 0)
+ {
+ m_time_ps += netlist_time::from_raw(atime * m_div);
+ atime = 0;
+ }
+ } else {
+ netlist_net_t &mcQ = m_mainclock->m_Q.net();
+ const netlist_time inc = m_mainclock->m_inc;
- while (atime > 0)
- {
- if (m_queue.is_not_empty())
- {
- while (m_queue.peek().time() > mcQ.time())
- {
- update_time(mcQ.time(), atime);
+ while (atime > 0)
+ {
+ if (m_queue.is_not_empty())
+ {
+ while (m_queue.peek().time() > mcQ.time())
+ {
+ update_time(mcQ.time(), atime);
- NETLIB_NAME(mainclock)::mc_update(mcQ, time() + inc);
+ NETLIB_NAME(mainclock)::mc_update(mcQ, time() + inc);
- }
- const queue_t::entry_t &e = m_queue.pop();
+ }
+ const queue_t::entry_t &e = m_queue.pop();
- update_time(e.time(), atime);
+ update_time(e.time(), atime);
- e.object().update_devs();
+ e.object().update_devs();
- } else {
- update_time(mcQ.time(), atime);
+ } else {
+ update_time(mcQ.time(), atime);
- NETLIB_NAME(mainclock)::mc_update(mcQ, time() + inc);
- }
- if (FATAL_ERROR_AFTER_NS)
- if (time() > NLTIME_FROM_NS(FATAL_ERROR_AFTER_NS))
- xfatalerror("Stopped");
+ NETLIB_NAME(mainclock)::mc_update(mcQ, time() + inc);
+ }
+ if (FATAL_ERROR_AFTER_NS)
+ if (time() > NLTIME_FROM_NS(FATAL_ERROR_AFTER_NS))
+ xfatalerror("Stopped");
- add_to_stat(m_perf_out_processed, 1);
- }
+ add_to_stat(m_perf_out_processed, 1);
+ }
- if (atime > 0)
- {
- m_time_ps += netlist_time::from_raw(atime * m_div);
- atime = 0;
- }
- }
+ if (atime > 0)
+ {
+ m_time_ps += netlist_time::from_raw(atime * m_div);
+ atime = 0;
+ }
+ }
}
ATTR_COLD void netlist_base_t::xfatalerror(const char *format, ...) const
{
- va_list ap;
- va_start(ap, format);
- //emu_fatalerror error(format, ap);
- vfatalerror(format, ap);
- va_end(ap);
- //throw error;
+ va_list ap;
+ va_start(ap, format);
+ //emu_fatalerror error(format, ap);
+ vfatalerror(format, ap);
+ va_end(ap);
+ //throw error;
}
@@ -267,15 +267,15 @@ ATTR_COLD netlist_core_device_t::netlist_core_device_t(const family_t afamily)
ATTR_COLD void netlist_core_device_t::init(netlist_base_t &anetlist, const pstring &name)
{
- init_object(anetlist, name);
+ init_object(anetlist, name);
#if USE_DELEGATES
#if USE_PMFDELEGATES
- void (netlist_core_device_t::* pFunc)() = &netlist_core_device_t::update;
- static_update = reinterpret_cast<net_update_delegate>((this->*pFunc));
+ void (netlist_core_device_t::* pFunc)() = &netlist_core_device_t::update;
+ static_update = reinterpret_cast<net_update_delegate>((this->*pFunc));
#else
- static_update = net_update_delegate(&netlist_core_device_t::update, "update", this);
- // get the pointer to the member function
+ static_update = net_update_delegate(&netlist_core_device_t::update, "update", this);
+ // get the pointer to the member function
#endif
#endif
@@ -287,15 +287,15 @@ ATTR_COLD netlist_core_device_t::~netlist_core_device_t()
ATTR_HOT ATTR_ALIGN const netlist_sig_t netlist_core_device_t::INPLOGIC_PASSIVE(netlist_logic_input_t &inp)
{
- if (inp.state() == netlist_input_t::STATE_INP_PASSIVE)
- {
- inp.activate();
- const netlist_sig_t ret = inp.Q();
- inp.inactivate();
- return ret;
- }
- else
- return inp.Q();
+ if (inp.state() == netlist_input_t::STATE_INP_PASSIVE)
+ {
+ inp.activate();
+ const netlist_sig_t ret = inp.Q();
+ inp.inactivate();
+ return ret;
+ }
+ else
+ return inp.Q();
}
@@ -304,109 +304,109 @@ ATTR_HOT ATTR_ALIGN const netlist_sig_t netlist_core_device_t::INPLOGIC_PASSIVE(
// ----------------------------------------------------------------------------------------
netlist_device_t::netlist_device_t()
- : netlist_core_device_t(),
- m_terminals(20)
+ : netlist_core_device_t(),
+ m_terminals(20)
{
}
netlist_device_t::netlist_device_t(const family_t afamily)
- : netlist_core_device_t(afamily),
- m_terminals(20){
+ : netlist_core_device_t(afamily),
+ m_terminals(20){
}
netlist_device_t::~netlist_device_t()
{
- //NL_VERBOSE_OUT(("~net_device_t\n");
+ //NL_VERBOSE_OUT(("~net_device_t\n");
}
ATTR_COLD netlist_setup_t &netlist_device_t::setup()
{
- return netlist().setup();
+ return netlist().setup();
}
ATTR_COLD void netlist_device_t::init(netlist_base_t &anetlist, const pstring &name)
{
- netlist_core_device_t::init(anetlist, name);
- start();
+ netlist_core_device_t::init(anetlist, name);
+ start();
}
ATTR_COLD void netlist_device_t::register_sub(netlist_device_t &dev, const pstring &name)
{
- dev.init(netlist(), this->name() + "." + name);
+ dev.init(netlist(), this->name() + "." + name);
}
ATTR_COLD void netlist_device_t::register_subalias(const pstring &name, const netlist_core_terminal_t &term)
{
- pstring alias = this->name() + "." + name;
+ pstring alias = this->name() + "." + name;
- setup().register_alias(alias, term.name());
+ setup().register_alias(alias, term.name());
- if (term.isType(netlist_terminal_t::INPUT))
- m_terminals.add(name);
+ if (term.isType(netlist_terminal_t::INPUT))
+ m_terminals.add(name);
}
ATTR_COLD void netlist_device_t::register_terminal(const pstring &name, netlist_terminal_t &port)
{
- setup().register_object(*this,*this,name, port, netlist_terminal_t::STATE_INP_ACTIVE);
+ setup().register_object(*this,*this,name, port, netlist_terminal_t::STATE_INP_ACTIVE);
}
ATTR_COLD void netlist_device_t::register_output(const pstring &name, netlist_output_t &port)
{
- setup().register_object(*this,*this,name, port, netlist_terminal_t::STATE_OUT);
+ setup().register_object(*this,*this,name, port, netlist_terminal_t::STATE_OUT);
}
ATTR_COLD void netlist_device_t::register_input(const pstring &name, netlist_input_t &inp, netlist_input_t::state_e type)
{
- m_terminals.add(name);
- setup().register_object(*this, *this, name, inp, type);
+ m_terminals.add(name);
+ setup().register_object(*this, *this, name, inp, type);
}
//FIXME: Get rid of this
static void init_term(netlist_core_device_t &dev, netlist_core_terminal_t &term, netlist_input_t::state_e aState)
{
- if (!term.isInitalized())
- {
- switch (term.type())
- {
- case netlist_terminal_t::OUTPUT:
- dynamic_cast<netlist_output_t &>(term).init_object(dev, dev.name() + ".INTOUT");
- break;
- case netlist_terminal_t::INPUT:
- dynamic_cast<netlist_input_t &>(term).init_object(dev, dev.name() + ".INTINP", aState);
- break;
- case netlist_terminal_t::TERMINAL:
- dynamic_cast<netlist_terminal_t &>(term).init_object(dev, dev.name() + ".INTTERM", aState);
- break;
- default:
- dev.netlist().xfatalerror("Unknown terminal type");
- break;
- }
- }
+ if (!term.isInitalized())
+ {
+ switch (term.type())
+ {
+ case netlist_terminal_t::OUTPUT:
+ dynamic_cast<netlist_output_t &>(term).init_object(dev, dev.name() + ".INTOUT");
+ break;
+ case netlist_terminal_t::INPUT:
+ dynamic_cast<netlist_input_t &>(term).init_object(dev, dev.name() + ".INTINP", aState);
+ break;
+ case netlist_terminal_t::TERMINAL:
+ dynamic_cast<netlist_terminal_t &>(term).init_object(dev, dev.name() + ".INTTERM", aState);
+ break;
+ default:
+ dev.netlist().xfatalerror("Unknown terminal type");
+ break;
+ }
+ }
}
// FIXME: Revise internal links ...
//FIXME: Get rid of this
ATTR_COLD void netlist_device_t::register_link_internal(netlist_core_device_t &dev, netlist_input_t &in, netlist_output_t &out, const netlist_input_t::state_e aState)
{
- init_term(dev, in, aState);
- init_term(dev, out, aState);
- setup().connect(in, out);
+ init_term(dev, in, aState);
+ init_term(dev, out, aState);
+ setup().connect(in, out);
}
ATTR_COLD void netlist_device_t::register_link_internal(netlist_input_t &in, netlist_output_t &out, const netlist_input_t::state_e aState)
{
- register_link_internal(*this, in, out, aState);
+ register_link_internal(*this, in, out, aState);
}
template <class C, class T>
ATTR_COLD void netlist_device_t::register_param(netlist_core_device_t &dev, const pstring &sname, C &param, const T initialVal)
{
- pstring fullname = dev.name() + "." + sname;
- param.init_object(dev, fullname);
- param.initial(initialVal);
- //FIXME: pass fullname from above
- setup().register_object(*this, *this, fullname, param, netlist_terminal_t::STATE_NONEX);
+ pstring fullname = dev.name() + "." + sname;
+ param.init_object(dev, fullname);
+ param.initial(initialVal);
+ //FIXME: pass fullname from above
+ setup().register_object(*this, *this, fullname, param, netlist_terminal_t::STATE_NONEX);
}
template ATTR_COLD void netlist_device_t::register_param(netlist_core_device_t &dev, const pstring &sname, netlist_param_double_t &param, const double initialVal);
@@ -422,112 +422,111 @@ template ATTR_COLD void netlist_device_t::register_param(netlist_core_device_t &
// ----------------------------------------------------------------------------------------
ATTR_COLD netlist_net_t::netlist_net_t(const type_t atype, const family_t afamily)
- : netlist_object_t(atype, afamily)
- , m_head(NULL)
- , m_num_cons(0)
- , m_time(netlist_time::zero)
- , m_active(0)
- , m_in_queue(2)
- , m_railterminal(NULL)
+ : netlist_object_t(atype, afamily)
+ , m_head(NULL)
+ , m_num_cons(0)
+ , m_time(netlist_time::zero)
+ , m_active(0)
+ , m_in_queue(2)
+ , m_railterminal(NULL)
{
};
ATTR_COLD void netlist_net_t::init_object(netlist_base_t &nl, const pstring &aname)
{
- netlist_object_t::init_object(nl, aname);
- nl.m_nets.add(this);
+ netlist_object_t::init_object(nl, aname);
+ nl.m_nets.add(this);
}
ATTR_COLD void netlist_net_t::register_railterminal(netlist_output_t &mr)
{
- assert(m_railterminal == NULL);
- m_railterminal = &mr;
+ assert(m_railterminal == NULL);
+ m_railterminal = &mr;
}
ATTR_COLD void netlist_net_t::merge_net(netlist_net_t *othernet)
{
- NL_VERBOSE_OUT(("merging nets ...\n"));
- if (othernet == NULL)
- return; // Nothing to do
+ NL_VERBOSE_OUT(("merging nets ...\n"));
+ if (othernet == NULL)
+ return; // Nothing to do
- if (this->isRailNet() && othernet->isRailNet())
- netlist().xfatalerror("Trying to merge to rail nets\n");
+ if (this->isRailNet() && othernet->isRailNet())
+ netlist().xfatalerror("Trying to merge to rail nets\n");
- if (othernet->isRailNet())
- {
- NL_VERBOSE_OUT(("othernet is railnet\n"));
- othernet->merge_net(this);
- }
- else
- {
- netlist_core_terminal_t *p = othernet->m_head;
- while (p != NULL)
- {
- netlist_core_terminal_t *pn = p->m_update_list_next;
- register_con(*p);
- p = pn;
- }
+ if (othernet->isRailNet())
+ {
+ NL_VERBOSE_OUT(("othernet is railnet\n"));
+ othernet->merge_net(this);
+ }
+ else
+ {
+ netlist_core_terminal_t *p = othernet->m_head;
+ while (p != NULL)
+ {
+ netlist_core_terminal_t *pn = p->m_update_list_next;
+ register_con(*p);
+ p = pn;
+ }
- othernet->m_head = NULL; // FIXME: othernet needs to be free'd from memory
- }
+ othernet->m_head = NULL; // FIXME: othernet needs to be free'd from memory
+ }
}
ATTR_COLD void netlist_net_t::register_con(netlist_core_terminal_t &terminal)
{
- terminal.set_net(*this);
+ terminal.set_net(*this);
- terminal.m_update_list_next = m_head;
- m_head = &terminal;
- m_num_cons++;
+ terminal.m_update_list_next = m_head;
+ m_head = &terminal;
+ m_num_cons++;
- if (terminal.state() != netlist_input_t::STATE_INP_PASSIVE)
- m_active++;
+ if (terminal.state() != netlist_input_t::STATE_INP_PASSIVE)
+ m_active++;
}
ATTR_HOT inline void netlist_net_t::update_dev(const netlist_core_terminal_t *inp, const UINT32 mask) const
{
- if ((inp->state() & mask) != 0)
- {
- 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);
- }
+ if ((inp->state() & mask) != 0)
+ {
+ 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 netlist_net_t::update_devs()
{
- assert(m_num_cons != 0);
-
- assert(this->isRailNet());
- {
-
- const UINT32 masks[4] = { 1, 5, 3, 1 };
- m_cur = m_new;
- m_in_queue = 2; /* mark as taken ... */
-
- const UINT32 mask = masks[ (m_last.Q << 1) | m_cur.Q ];
-
- netlist_core_terminal_t *p = m_head;
- switch (m_num_cons)
- {
- case 2:
- update_dev(p, mask);
- p = p->m_update_list_next;
- case 1:
- update_dev(p, mask);
- break;
- default:
- do
- {
- update_dev(p, mask);
- p = p->m_update_list_next;
- } while (p != NULL);
- break;
- }
- m_last = m_cur;
- }
+ assert(m_num_cons != 0);
+
+ assert(this->isRailNet());
+ {
+ const UINT32 masks[4] = { 1, 5, 3, 1 };
+ m_cur = m_new;
+ m_in_queue = 2; /* mark as taken ... */
+
+ const UINT32 mask = masks[ (m_last.Q << 1) | m_cur.Q ];
+
+ netlist_core_terminal_t *p = m_head;
+ switch (m_num_cons)
+ {
+ case 2:
+ update_dev(p, mask);
+ p = p->m_update_list_next;
+ case 1:
+ update_dev(p, mask);
+ break;
+ default:
+ do
+ {
+ update_dev(p, mask);
+ p = p->m_update_list_next;
+ } while (p != NULL);
+ break;
+ }
+ m_last = m_cur;
+ }
}
// ----------------------------------------------------------------------------------------
@@ -540,7 +539,6 @@ ATTR_COLD netlist_core_terminal_t::netlist_core_terminal_t(const type_t atype, c
, m_net(NULL)
, m_state(STATE_NONEX)
{
-
}
ATTR_COLD netlist_terminal_t::netlist_terminal_t()
@@ -549,18 +547,17 @@ ATTR_COLD netlist_terminal_t::netlist_terminal_t()
, m_go(NETLIST_GMIN)
, m_gt(NETLIST_GMIN)
{
-
}
ATTR_COLD void netlist_core_terminal_t::init_object(netlist_core_device_t &dev, const pstring &aname, const state_e astate)
{
- set_state(astate);
- netlist_owned_object_t::init_object(dev, aname);
+ set_state(astate);
+ netlist_owned_object_t::init_object(dev, aname);
}
ATTR_COLD void netlist_core_terminal_t::set_net(netlist_net_t &anet)
{
- m_net = &anet;
+ m_net = &anet;
}
// ----------------------------------------------------------------------------------------
@@ -572,41 +569,41 @@ ATTR_COLD void netlist_core_terminal_t::set_net(netlist_net_t &anet)
// ----------------------------------------------------------------------------------------
netlist_output_t::netlist_output_t(const type_t atype, const family_t afamily)
- : netlist_core_terminal_t(atype, afamily)
- , m_low_V(0.0)
- , m_high_V(0.0)
- , m_my_net(NET, afamily)
+ : netlist_core_terminal_t(atype, afamily)
+ , m_low_V(0.0)
+ , m_high_V(0.0)
+ , m_my_net(NET, afamily)
{
- //m_net = new net_net_t(NET_DIGITAL);
- this->set_net(m_my_net);
+ //m_net = new net_net_t(NET_DIGITAL);
+ this->set_net(m_my_net);
}
ATTR_COLD void netlist_output_t::init_object(netlist_core_device_t &dev, const pstring &aname)
{
- netlist_core_terminal_t::init_object(dev, aname, STATE_OUT);
- net().init_object(dev.netlist(), aname + ".net");
- net().register_railterminal(*this);
+ netlist_core_terminal_t::init_object(dev, aname, STATE_OUT);
+ net().init_object(dev.netlist(), aname + ".net");
+ net().register_railterminal(*this);
}
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;
+ net().m_cur.Q = val;
+ net().m_new.Q = val;
+ net().m_last.Q = !val;
}
ATTR_COLD netlist_logic_output_t::netlist_logic_output_t()
- : netlist_output_t(OUTPUT, LOGIC)
+ : 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;
+ // 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 netlist_logic_output_t::set_levels(const double low, const double high)
{
- m_low_V = low;
- m_high_V = high;
+ m_low_V = low;
+ m_high_V = high;
}
// ----------------------------------------------------------------------------------------
@@ -614,9 +611,9 @@ ATTR_COLD void netlist_logic_output_t::set_levels(const double low, const double
// ----------------------------------------------------------------------------------------
ATTR_COLD netlist_ttl_output_t::netlist_ttl_output_t()
- : netlist_logic_output_t()
+ : netlist_logic_output_t()
{
- set_levels(0.3, 3.4);
+ set_levels(0.3, 3.4);
}
// ----------------------------------------------------------------------------------------
@@ -624,16 +621,16 @@ ATTR_COLD netlist_ttl_output_t::netlist_ttl_output_t()
// ----------------------------------------------------------------------------------------
ATTR_COLD netlist_analog_output_t::netlist_analog_output_t()
- : netlist_output_t(OUTPUT, ANALOG)
+ : netlist_output_t(OUTPUT, ANALOG)
{
- net().m_cur.Analog = 0.0;
- net().m_new.Analog = 99.0;
+ net().m_cur.Analog = 0.0;
+ net().m_new.Analog = 99.0;
}
ATTR_COLD void netlist_analog_output_t::initial(const double val)
{
- net().m_cur.Analog = val;
- net().m_new.Analog = 99.0;
+ net().m_cur.Analog = val;
+ net().m_new.Analog = 99.0;
}
// ----------------------------------------------------------------------------------------
@@ -641,71 +638,71 @@ ATTR_COLD void netlist_analog_output_t::initial(const double val)
// ----------------------------------------------------------------------------------------
ATTR_COLD netlist_param_t::netlist_param_t(const param_type_t atype)
- : netlist_owned_object_t(PARAM, ANALOG)
- , m_param_type(atype)
+ : netlist_owned_object_t(PARAM, ANALOG)
+ , m_param_type(atype)
{
}
ATTR_COLD netlist_param_double_t::netlist_param_double_t()
- : netlist_param_t(DOUBLE)
- , m_param(0.0)
+ : netlist_param_t(DOUBLE)
+ , m_param(0.0)
{
}
ATTR_COLD netlist_param_int_t::netlist_param_int_t()
- : netlist_param_t(INTEGER)
- , m_param(0)
+ : netlist_param_t(INTEGER)
+ , m_param(0)
{
}
ATTR_COLD netlist_param_logic_t::netlist_param_logic_t()
- : netlist_param_int_t()
+ : netlist_param_int_t()
{
}
ATTR_COLD netlist_param_str_t::netlist_param_str_t()
- : netlist_param_t(STRING)
- , m_param("")
+ : netlist_param_t(STRING)
+ , m_param("")
{
}
ATTR_COLD netlist_param_model_t::netlist_param_model_t()
- : netlist_param_t(MODEL)
- , m_param("")
+ : netlist_param_t(MODEL)
+ , m_param("")
{
}
ATTR_COLD double netlist_param_model_t::dValue(const pstring &entity, const double defval) const
{
- pstring tmp = this->Value();
- // .model 1N914 D(Is=2.52n Rs=.568 N=1.752 Cjo=4p M=.4 tt=20n Iave=200m Vpk=75 mfg=OnSemi type=silicon)
- int p = tmp.ucase().find(entity.ucase() + "=");
- if (p>=0)
- {
- int pblank = tmp.find(" ", p);
- if (pblank < 0) pblank = tmp.len() + 1;
- tmp = tmp.substr(p, pblank - p);
- int pequal = tmp.find("=", 0);
- if (pequal < 0)
- netlist().xfatalerror("parameter %s misformat in model %s temp %s\n", entity.cstr(), Value().cstr(), tmp.cstr());
- tmp = tmp.substr(pequal+1);
- double factor = 1.0;
- switch (*(tmp.right(1).cstr()))
- {
- case 'm': factor = 1e-3; break;
- case 'u': factor = 1e-6; break;
- case 'n': factor = 1e-9; break;
- case 'p': factor = 1e-12; break;
- case 'f': factor = 1e-15; break;
- case 'a': factor = 1e-18; break;
-
- }
- if (factor != 1.0)
- tmp = tmp.left(tmp.len() - 1);
- return atof(tmp.cstr()) * factor;
- }
- else
- return defval;
+ pstring tmp = this->Value();
+ // .model 1N914 D(Is=2.52n Rs=.568 N=1.752 Cjo=4p M=.4 tt=20n Iave=200m Vpk=75 mfg=OnSemi type=silicon)
+ int p = tmp.ucase().find(entity.ucase() + "=");
+ if (p>=0)
+ {
+ int pblank = tmp.find(" ", p);
+ if (pblank < 0) pblank = tmp.len() + 1;
+ tmp = tmp.substr(p, pblank - p);
+ int pequal = tmp.find("=", 0);
+ if (pequal < 0)
+ netlist().xfatalerror("parameter %s misformat in model %s temp %s\n", entity.cstr(), Value().cstr(), tmp.cstr());
+ tmp = tmp.substr(pequal+1);
+ double factor = 1.0;
+ switch (*(tmp.right(1).cstr()))
+ {
+ case 'm': factor = 1e-3; break;
+ case 'u': factor = 1e-6; break;
+ case 'n': factor = 1e-9; break;
+ case 'p': factor = 1e-12; break;
+ case 'f': factor = 1e-15; break;
+ case 'a': factor = 1e-18; break;
+
+ }
+ if (factor != 1.0)
+ tmp = tmp.left(tmp.len() - 1);
+ return atof(tmp.cstr()) * factor;
+ }
+ else
+ return defval;
}
@@ -715,28 +712,28 @@ ATTR_COLD double netlist_param_model_t::dValue(const pstring &entity, const doub
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();
+ net.m_new.Q = !net.m_new.Q;
+ net.set_time(curtime);
+ net.update_devs();
}
NETLIB_START(mainclock)
{
- register_output("Q", m_Q);
+ register_output("Q", m_Q);
- register_param("FREQ", m_freq, 7159000.0 * 5);
- m_inc = netlist_time::from_hz(m_freq.Value()*2);
+ register_param("FREQ", m_freq, 7159000.0 * 5);
+ m_inc = netlist_time::from_hz(m_freq.Value()*2);
}
NETLIB_UPDATE_PARAM(mainclock)
{
- m_inc = netlist_time::from_hz(m_freq.Value()*2);
+ m_inc = netlist_time::from_hz(m_freq.Value()*2);
}
NETLIB_UPDATE(mainclock)
{
- 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);
+ 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);
}
diff --git a/src/emu/netlist/nl_base.h b/src/emu/netlist/nl_base.h
index 60b0df807d2..9bea1e4579e 100644
--- a/src/emu/netlist/nl_base.h
+++ b/src/emu/netlist/nl_base.h
@@ -192,17 +192,17 @@ typedef delegate<void ()> net_update_delegate;
#define NETLIB_UPDATEI() ATTR_HOT ATTR_ALIGN inline void update(void)
#define NETLIB_DEVICE_BASE(_name, _pclass, _extra, _priv) \
- class _name : public _pclass \
- { \
- public: \
- _name() \
- : _pclass() { } \
- protected: \
- _extra \
- ATTR_HOT void update(); \
- ATTR_HOT void start(); \
- _priv \
- }
+ class _name : public _pclass \
+ { \
+ public: \
+ _name() \
+ : _pclass() { } \
+ protected: \
+ _extra \
+ ATTR_HOT void update(); \
+ ATTR_HOT void start(); \
+ _priv \
+ }
#define NETLIB_DEVICE_DERIVED(_name, _pclass, _priv) \
NETLIB_DEVICE_BASE(NETLIB_NAME(_name), NETLIB_NAME(_pclass), , _priv)
@@ -211,28 +211,28 @@ typedef delegate<void ()> net_update_delegate;
NETLIB_DEVICE_BASE(NETLIB_NAME(_name), netlist_device_t, , _priv)
#define NETLIB_SUBDEVICE(_name, _priv) \
- class NETLIB_NAME(_name) : public netlist_device_t \
- { \
- public: \
- NETLIB_NAME(_name) () \
- : netlist_device_t() \
- { } \
- /*protected:*/ \
- ATTR_HOT void update(); \
- ATTR_HOT void start(); \
- public: \
- _priv \
- }
+ class NETLIB_NAME(_name) : public netlist_device_t \
+ { \
+ public: \
+ NETLIB_NAME(_name) () \
+ : netlist_device_t() \
+ { } \
+ /*protected:*/ \
+ ATTR_HOT void update(); \
+ ATTR_HOT void start(); \
+ public: \
+ _priv \
+ }
#define NETLIB_DEVICE_WITH_PARAMS(_name, _priv) \
- NETLIB_DEVICE_BASE(NETLIB_NAME(_name), netlist_device_t, \
- ATTR_HOT void update_param(); \
- , _priv)
+ NETLIB_DEVICE_BASE(NETLIB_NAME(_name), netlist_device_t, \
+ ATTR_HOT void update_param(); \
+ , _priv)
#define NETLIB_DEVICE_WITH_PARAMS_DERIVED(_name, _pclass, _priv) \
- NETLIB_DEVICE_BASE(NETLIB_NAME(_name), NETLIB_NAME(_pclass), \
- ATTR_HOT void update_param(); \
- , _priv)
+ NETLIB_DEVICE_BASE(NETLIB_NAME(_name), NETLIB_NAME(_pclass), \
+ ATTR_HOT void update_param(); \
+ , _priv)
// ----------------------------------------------------------------------------------------
// forward definitions
@@ -253,73 +253,73 @@ class NETLIB_NAME(mainclock);
class netlist_object_t
{
- NETLIST_PREVENT_COPYING(netlist_object_t)
+ NETLIST_PREVENT_COPYING(netlist_object_t)
public:
enum type_t {
- TERMINAL = 0,
+ TERMINAL = 0,
INPUT = 1,
OUTPUT = 2,
PARAM = 3,
NET = 4,
- DEVICE = 5,
- NETLIST = 6,
+ DEVICE = 5,
+ NETLIST = 6,
+ };
+ enum family_t {
+ // Terminal families
+ LOGIC = 1,
+ ANALOG = 2,
+ // Device families
+ GENERIC = 3, // <== devices usually fall into this category
+ RESISTOR = 4, // Resistor
+ CAPACITOR = 5, // Capacitor
+ DIODE = 6, // Diode
+ BJT_SWITCH = 7, // BJT(Switch)
+ VCVS = 8, // Voltage controlled voltage source
+ VCCS = 9, // Voltage controlled voltage source
};
- enum family_t {
- // Terminal families
- LOGIC = 1,
- ANALOG = 2,
- // Device families
- GENERIC = 3, // <== devices usually fall into this category
- RESISTOR = 4, // Resistor
- CAPACITOR = 5, // Capacitor
- DIODE = 6, // Diode
- BJT_SWITCH = 7, // BJT(Switch)
- VCVS = 8, // Voltage controlled voltage source
- VCCS = 9, // Voltage controlled voltage source
- };
ATTR_COLD netlist_object_t(const type_t atype, const family_t afamily);
virtual ~netlist_object_t();
ATTR_COLD void init_object(netlist_base_t &nl, const pstring &aname);
- ATTR_COLD bool isInitalized() { return (m_netlist != NULL); }
+ ATTR_COLD bool isInitalized() { return (m_netlist != NULL); }
- ATTR_COLD const pstring &name() const;
+ ATTR_COLD const pstring &name() const;
- PSTATE_INTERFACE(*m_netlist, name())
+ PSTATE_INTERFACE(*m_netlist, name())
#if 0
- template<class C> ATTR_COLD void save(C &state, const pstring &stname)
- {
- save_state_ptr(stname, nl_datatype<C>::type, sizeof(C), &state);
- }
+ template<class C> ATTR_COLD void save(C &state, const pstring &stname)
+ {
+ save_state_ptr(stname, nl_datatype<C>::type, sizeof(C), &state);
+ }
#endif
ATTR_HOT inline const type_t type() const { return m_objtype; }
- ATTR_HOT inline const family_t family() const { return m_family; }
+ ATTR_HOT inline const family_t family() const { return m_family; }
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 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; }
+ ATTR_HOT inline netlist_base_t & RESTRICT netlist() { return *m_netlist; }
+ ATTR_HOT inline const netlist_base_t & RESTRICT netlist() const { return *m_netlist; }
protected:
#if 0
- // pstate_interface virtual
- ATTR_COLD virtual void save_state_ptr(const pstring &stname, const netlist_data_type_e, const int size, const int count, void *ptr);
+ // pstate_interface virtual
+ ATTR_COLD virtual void save_state_ptr(const pstring &stname, const netlist_data_type_e, const int size, const int count, void *ptr);
#endif
- // must call parent save_register !
- ATTR_COLD virtual void save_register() { };
+ // must call parent save_register !
+ ATTR_COLD virtual void save_register() { };
private:
- pstring m_name;
+ pstring m_name;
const type_t m_objtype;
- const family_t m_family;
- netlist_base_t * RESTRICT m_netlist;
+ const family_t m_family;
+ netlist_base_t * RESTRICT m_netlist;
};
// ----------------------------------------------------------------------------------------
@@ -328,15 +328,15 @@ private:
class netlist_owned_object_t : public netlist_object_t
{
- NETLIST_PREVENT_COPYING(netlist_owned_object_t)
+ NETLIST_PREVENT_COPYING(netlist_owned_object_t)
public:
- ATTR_COLD netlist_owned_object_t(const type_t atype, const family_t afamily);
+ ATTR_COLD netlist_owned_object_t(const type_t atype, const family_t afamily);
- ATTR_COLD void init_object(netlist_core_device_t &dev, const pstring &aname);
+ ATTR_COLD void init_object(netlist_core_device_t &dev, const pstring &aname);
- ATTR_HOT inline netlist_core_device_t & RESTRICT netdev() const { return *m_netdev; }
+ ATTR_HOT inline netlist_core_device_t & RESTRICT netdev() const { return *m_netdev; }
private:
- netlist_core_device_t * RESTRICT m_netdev;
+ netlist_core_device_t * RESTRICT m_netdev;
};
// ----------------------------------------------------------------------------------------
@@ -345,46 +345,46 @@ private:
class netlist_core_terminal_t : public netlist_owned_object_t
{
- NETLIST_PREVENT_COPYING(netlist_core_terminal_t)
+ NETLIST_PREVENT_COPYING(netlist_core_terminal_t)
public:
- /* needed here ... */
+ /* needed here ... */
- enum state_e {
- STATE_INP_PASSIVE = 0,
- STATE_INP_ACTIVE = 1,
- STATE_INP_HL = 2,
- STATE_INP_LH = 4,
- STATE_OUT = 128,
- STATE_NONEX = 256
- };
+ enum state_e {
+ STATE_INP_PASSIVE = 0,
+ STATE_INP_ACTIVE = 1,
+ STATE_INP_HL = 2,
+ STATE_INP_LH = 4,
+ STATE_OUT = 128,
+ STATE_NONEX = 256
+ };
ATTR_COLD netlist_core_terminal_t(const type_t atype, const family_t afamily);
ATTR_COLD void init_object(netlist_core_device_t &dev, const pstring &aname, const state_e astate);
- ATTR_COLD void set_net(netlist_net_t &anet);
- ATTR_COLD inline bool has_net() const { return (m_net != NULL); }
- 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_COLD void set_net(netlist_net_t &anet);
+ ATTR_COLD inline bool has_net() const { return (m_net != NULL); }
+ 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 const bool is_state(const state_e astate) const { return (m_state == astate); }
- ATTR_HOT inline const state_e state() const { return m_state; }
- ATTR_HOT inline void set_state(const state_e astate)
- {
- assert(astate != STATE_NONEX);
- m_state = astate;
- }
+ ATTR_HOT inline const bool is_state(const state_e astate) const { return (m_state == astate); }
+ ATTR_HOT inline const state_e state() const { return m_state; }
+ ATTR_HOT inline void set_state(const state_e astate)
+ {
+ assert(astate != STATE_NONEX);
+ m_state = astate;
+ }
- netlist_core_terminal_t *m_update_list_next;
+ netlist_core_terminal_t *m_update_list_next;
protected:
- ATTR_COLD virtual void save_register() { save(NAME(m_state)); netlist_owned_object_t::save_register(); }
+ ATTR_COLD virtual void save_register() { save(NAME(m_state)); netlist_owned_object_t::save_register(); }
private:
- netlist_net_t * RESTRICT m_net;
- state_e m_state;
+ netlist_net_t * RESTRICT m_net;
+ state_e m_state;
};
NETLIST_SAVE_TYPE(netlist_core_terminal_t::state_e, DT_INT);
@@ -392,45 +392,45 @@ NETLIST_SAVE_TYPE(netlist_core_terminal_t::state_e, DT_INT);
class netlist_terminal_t : public netlist_core_terminal_t
{
- NETLIST_PREVENT_COPYING(netlist_terminal_t)
+ NETLIST_PREVENT_COPYING(netlist_terminal_t)
public:
- ATTR_COLD netlist_terminal_t();
+ ATTR_COLD netlist_terminal_t();
- double m_Idr; // drive current
- double m_go; // conductance for Voltage from other term
- double m_gt; // conductance for total conductance
+ double m_Idr; // drive current
+ double m_go; // conductance for Voltage from other term
+ double m_gt; // conductance for total conductance
- ATTR_HOT inline void set(const double G)
- {
- m_Idr = 0;
- m_go = m_gt = G;
- }
+ ATTR_HOT inline void set(const double G)
+ {
+ m_Idr = 0;
+ m_go = m_gt = G;
+ }
- ATTR_HOT inline void set(const double GO, const double GT)
- {
- m_Idr = 0;
- m_go = GO;
- m_gt = GT;
- }
+ ATTR_HOT inline void set(const double GO, const double GT)
+ {
+ m_Idr = 0;
+ m_go = GO;
+ m_gt = GT;
+ }
- ATTR_HOT inline void set(const double GO, const double GT, const double I)
- {
- m_Idr = I;
- m_go = GO;
- m_gt = GT;
- }
+ ATTR_HOT inline void set(const double GO, const double GT, const double I)
+ {
+ m_Idr = I;
+ m_go = GO;
+ m_gt = GT;
+ }
- netlist_terminal_t *m_otherterm;
+ netlist_terminal_t *m_otherterm;
protected:
- ATTR_COLD virtual void save_register()
- {
- save(NAME(m_Idr));
- save(NAME(m_go));
- save(NAME(m_gt));
- netlist_core_terminal_t::save_register();
- }
+ ATTR_COLD virtual void save_register()
+ {
+ save(NAME(m_Idr));
+ save(NAME(m_go));
+ save(NAME(m_gt));
+ netlist_core_terminal_t::save_register();
+ }
};
@@ -446,10 +446,10 @@ public:
ATTR_COLD netlist_input_t(const type_t atype, const family_t afamily)
: netlist_core_terminal_t(atype, afamily)
- , m_low_thresh_V(0)
- , m_high_thresh_V(0)
+ , m_low_thresh_V(0)
+ , m_high_thresh_V(0)
{
- set_state(STATE_INP_ACTIVE);
+ set_state(STATE_INP_ACTIVE);
}
ATTR_HOT inline void inactivate();
@@ -521,115 +521,115 @@ public:
class netlist_net_t : public netlist_object_t
{
- NETLIST_PREVENT_COPYING(netlist_net_t)
+ NETLIST_PREVENT_COPYING(netlist_net_t)
public:
- typedef netlist_list_t<netlist_net_t *> list_t;
+ typedef netlist_list_t<netlist_net_t *> list_t;
- friend class NETLIB_NAME(mainclock);
- friend class netlist_matrix_solver_t;
- friend class netlist_logic_output_t;
- friend class netlist_analog_output_t;
+ friend class NETLIB_NAME(mainclock);
+ friend class netlist_matrix_solver_t;
+ friend class netlist_logic_output_t;
+ friend class netlist_analog_output_t;
- // FIXME: union does not work
- struct hybrid_t
- {
- inline hybrid_t() : Q(0), Analog(0.0) {}
- netlist_sig_t Q;
- double Analog;
- };
+ // FIXME: union does not work
+ struct hybrid_t
+ {
+ inline hybrid_t() : Q(0), Analog(0.0) {}
+ netlist_sig_t Q;
+ double Analog;
+ };
- ATTR_COLD netlist_net_t(const type_t atype, const family_t afamily);
- ATTR_COLD void init_object(netlist_base_t &nl, const pstring &aname);
+ ATTR_COLD netlist_net_t(const type_t atype, const family_t afamily);
+ ATTR_COLD void init_object(netlist_base_t &nl, const pstring &aname);
- ATTR_COLD void register_con(netlist_core_terminal_t &terminal);
- ATTR_COLD void merge_net(netlist_net_t *othernet);
- ATTR_COLD void register_railterminal(netlist_output_t &mr);
+ ATTR_COLD void register_con(netlist_core_terminal_t &terminal);
+ ATTR_COLD void merge_net(netlist_net_t *othernet);
+ ATTR_COLD void register_railterminal(netlist_output_t &mr);
- /* inline not always works out */
- ATTR_HOT inline void update_devs();
+ /* inline not always works out */
+ 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 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() const { return !(m_railterminal == NULL); }
- ATTR_HOT inline const netlist_core_terminal_t & RESTRICT railterminal() const { return *m_railterminal; }
+ ATTR_HOT inline bool isRailNet() const { return !(m_railterminal == NULL); }
+ ATTR_HOT inline const netlist_core_terminal_t & RESTRICT railterminal() const { return *m_railterminal; }
- /* Everything below is used by the logic subsystem */
+ /* Everything below is used by the logic subsystem */
- ATTR_HOT inline void inc_active();
- ATTR_HOT inline void dec_active();
+ ATTR_HOT inline void inc_active();
+ ATTR_HOT inline void dec_active();
- ATTR_HOT inline const int active_count() const { return m_active; }
+ ATTR_HOT inline const int active_count() const { return m_active; }
- ATTR_HOT inline const netlist_sig_t Q() const
- {
- assert(family() == LOGIC);
- return m_cur.Q;
- }
+ ATTR_HOT inline const netlist_sig_t Q() const
+ {
+ assert(family() == LOGIC);
+ return m_cur.Q;
+ }
- ATTR_HOT inline const netlist_sig_t last_Q() const
- {
- assert(family() == LOGIC);
- return m_last.Q;
- }
+ ATTR_HOT inline const netlist_sig_t last_Q() const
+ {
+ assert(family() == LOGIC);
+ return m_last.Q;
+ }
- ATTR_HOT inline const netlist_sig_t new_Q() const
- {
- assert(family() == LOGIC);
- return m_new.Q;
- }
+ ATTR_HOT inline const netlist_sig_t new_Q() const
+ {
+ assert(family() == LOGIC);
+ return m_new.Q;
+ }
- ATTR_HOT inline const double Q_Analog() const
- {
- //assert(object_type(SIGNAL_MASK) == SIGNAL_ANALOG);
- assert(family() == ANALOG);
- return m_cur.Analog;
- }
+ ATTR_HOT inline const double Q_Analog() const
+ {
+ //assert(object_type(SIGNAL_MASK) == SIGNAL_ANALOG);
+ assert(family() == ANALOG);
+ return m_cur.Analog;
+ }
- ATTR_HOT inline void push_to_queue(const netlist_time &delay);
- ATTR_HOT bool is_queued() { return m_in_queue == 1; }
+ ATTR_HOT inline void push_to_queue(const netlist_time &delay);
+ ATTR_HOT bool is_queued() { return m_in_queue == 1; }
- // m_terms is only used by analog subsystem
- typedef netlist_list_t<netlist_terminal_t *> terminal_list_t;
+ // m_terms is only used by analog subsystem
+ typedef netlist_list_t<netlist_terminal_t *> terminal_list_t;
- terminal_list_t m_terms;
- netlist_matrix_solver_t *m_solver;
+ terminal_list_t m_terms;
+ netlist_matrix_solver_t *m_solver;
- netlist_core_terminal_t *m_head;
+ netlist_core_terminal_t *m_head;
protected:
- hybrid_t m_last;
- hybrid_t m_cur;
- hybrid_t m_new;
+ hybrid_t m_last;
+ hybrid_t m_cur;
+ hybrid_t m_new;
- UINT32 m_num_cons;
+ UINT32 m_num_cons;
protected:
- ATTR_COLD virtual void save_register()
- {
- save(NAME(m_last.Analog));
- save(NAME(m_cur.Analog));
- save(NAME(m_new.Analog));
- save(NAME(m_last.Q));
- save(NAME(m_cur.Q));
- save(NAME(m_new.Q));
- save(NAME(m_time));
- save(NAME(m_active));
- save(NAME(m_in_queue));
- netlist_object_t::save_register();
- }
+ ATTR_COLD virtual void save_register()
+ {
+ save(NAME(m_last.Analog));
+ save(NAME(m_cur.Analog));
+ save(NAME(m_new.Analog));
+ save(NAME(m_last.Q));
+ save(NAME(m_cur.Q));
+ save(NAME(m_new.Q));
+ save(NAME(m_time));
+ save(NAME(m_active));
+ save(NAME(m_in_queue));
+ netlist_object_t::save_register();
+ }
private:
- ATTR_HOT void update_dev(const netlist_core_terminal_t *inp, const UINT32 mask) const;
+ ATTR_HOT void update_dev(const netlist_core_terminal_t *inp, const UINT32 mask) const;
- netlist_time m_time;
- INT32 m_active;
- UINT32 m_in_queue; /* 0: not in queue, 1: in queue, 2: last was taken */
+ netlist_time m_time;
+ INT32 m_active;
+ UINT32 m_in_queue; /* 0: not in queue, 1: in queue, 2: last was taken */
- netlist_core_terminal_t * RESTRICT m_railterminal;
+ netlist_core_terminal_t * RESTRICT m_railterminal;
};
@@ -639,12 +639,12 @@ private:
class netlist_output_t : public netlist_core_terminal_t
{
- NETLIST_PREVENT_COPYING(netlist_output_t)
+ NETLIST_PREVENT_COPYING(netlist_output_t)
public:
ATTR_COLD netlist_output_t(const type_t atype, const family_t afamily);
- ATTR_COLD void init_object(netlist_core_device_t &dev, const pstring &aname);
+ ATTR_COLD void init_object(netlist_core_device_t &dev, const pstring &aname);
double m_low_V;
double m_high_V;
@@ -658,23 +658,23 @@ private:
class netlist_logic_output_t : public netlist_output_t
{
- NETLIST_PREVENT_COPYING(netlist_logic_output_t)
+ NETLIST_PREVENT_COPYING(netlist_logic_output_t)
public:
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_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)
{
- netlist_net_t &anet = net();
+ netlist_net_t &anet = net();
if (EXPECTED(newQ != anet.m_new.Q))
{
- anet.m_new.Q = newQ;
+ anet.m_new.Q = newQ;
if (anet.m_num_cons)
- anet.push_to_queue(delay);
+ anet.push_to_queue(delay);
}
}
};
@@ -689,19 +689,19 @@ public:
class netlist_analog_output_t : public netlist_output_t
{
- NETLIST_PREVENT_COPYING(netlist_analog_output_t)
+ NETLIST_PREVENT_COPYING(netlist_analog_output_t)
public:
ATTR_COLD netlist_analog_output_t();
- ATTR_COLD void initial(const double val);
+ ATTR_COLD void initial(const double val);
- ATTR_HOT inline void set_Q(const double newQ, const netlist_time &delay)
+ ATTR_HOT inline void set_Q(const double newQ, const netlist_time &delay)
{
if (newQ != net().m_new.Analog)
{
- net().m_new.Analog = newQ;
- net().push_to_queue(delay);
+ net().m_new.Analog = newQ;
+ net().push_to_queue(delay);
}
}
@@ -713,105 +713,105 @@ public:
class netlist_param_t : public netlist_owned_object_t
{
- NETLIST_PREVENT_COPYING(netlist_param_t)
+ NETLIST_PREVENT_COPYING(netlist_param_t)
public:
- enum param_type_t {
- MODEL,
- STRING,
- DOUBLE,
- INTEGER,
- LOGIC
- };
+ enum param_type_t {
+ MODEL,
+ STRING,
+ DOUBLE,
+ INTEGER,
+ LOGIC
+ };
- ATTR_COLD netlist_param_t(const param_type_t atype);
+ ATTR_COLD netlist_param_t(const param_type_t atype);
- ATTR_HOT inline const param_type_t param_type() const { return m_param_type; }
+ ATTR_HOT inline const param_type_t param_type() const { return m_param_type; }
private:
- const param_type_t m_param_type;
+ const param_type_t m_param_type;
};
class netlist_param_double_t : public netlist_param_t
{
- NETLIST_PREVENT_COPYING(netlist_param_double_t)
+ NETLIST_PREVENT_COPYING(netlist_param_double_t)
public:
- ATTR_COLD netlist_param_double_t();
+ ATTR_COLD netlist_param_double_t();
- ATTR_HOT inline void setTo(const double param);
- ATTR_COLD inline void initial(const double val) { m_param = val; }
- ATTR_HOT inline const double Value() const { return m_param; }
+ ATTR_HOT inline void setTo(const double param);
+ ATTR_COLD inline void initial(const double val) { m_param = val; }
+ ATTR_HOT inline const double Value() const { return m_param; }
protected:
- ATTR_COLD virtual void save_register()
- {
- save(NAME(m_param));
- netlist_param_t::save_register();
- }
+ ATTR_COLD virtual void save_register()
+ {
+ save(NAME(m_param));
+ netlist_param_t::save_register();
+ }
private:
- double m_param;
+ double m_param;
};
class netlist_param_int_t : public netlist_param_t
{
- NETLIST_PREVENT_COPYING(netlist_param_int_t)
+ NETLIST_PREVENT_COPYING(netlist_param_int_t)
public:
- ATTR_COLD netlist_param_int_t();
+ ATTR_COLD netlist_param_int_t();
- ATTR_HOT inline void setTo(const int param);
- ATTR_COLD inline void initial(const int val) { m_param = val; }
+ ATTR_HOT inline void setTo(const int param);
+ ATTR_COLD inline void initial(const int val) { m_param = val; }
- ATTR_HOT inline const int Value() const { return m_param; }
+ ATTR_HOT inline const int Value() const { return m_param; }
protected:
- ATTR_COLD virtual void save_register()
- {
- save(NAME(m_param));
- netlist_param_t::save_register();
- }
+ ATTR_COLD virtual void save_register()
+ {
+ save(NAME(m_param));
+ netlist_param_t::save_register();
+ }
private:
- int m_param;
+ int m_param;
};
class netlist_param_logic_t : public netlist_param_int_t
{
- NETLIST_PREVENT_COPYING(netlist_param_logic_t)
+ NETLIST_PREVENT_COPYING(netlist_param_logic_t)
public:
- ATTR_COLD netlist_param_logic_t();
+ ATTR_COLD netlist_param_logic_t();
};
class netlist_param_str_t : public netlist_param_t
{
- NETLIST_PREVENT_COPYING(netlist_param_str_t)
+ NETLIST_PREVENT_COPYING(netlist_param_str_t)
public:
- ATTR_COLD netlist_param_str_t();
+ ATTR_COLD netlist_param_str_t();
- ATTR_HOT inline void setTo(const pstring &param);
- ATTR_COLD inline void initial(const pstring &val) { m_param = val; }
+ ATTR_HOT inline void setTo(const pstring &param);
+ ATTR_COLD inline void initial(const pstring &val) { m_param = val; }
- ATTR_HOT inline const pstring &Value() const { return m_param; }
+ ATTR_HOT inline const pstring &Value() const { return m_param; }
private:
- pstring m_param;
+ pstring m_param;
};
class netlist_param_model_t : public netlist_param_t
{
- NETLIST_PREVENT_COPYING(netlist_param_model_t)
+ NETLIST_PREVENT_COPYING(netlist_param_model_t)
public:
- ATTR_COLD netlist_param_model_t();
+ ATTR_COLD netlist_param_model_t();
- ATTR_COLD inline void initial(const pstring &val) { m_param = val; }
+ ATTR_COLD inline void initial(const pstring &val) { m_param = val; }
- ATTR_HOT inline const pstring &Value() const { return m_param; }
+ ATTR_HOT inline const pstring &Value() const { return m_param; }
- /* these should be cached! */
- ATTR_COLD double dValue(const pstring &entity, const double defval = 0.0) const;
+ /* these should be cached! */
+ ATTR_COLD double dValue(const pstring &entity, const double defval = 0.0) const;
private:
- pstring m_param;
+ pstring m_param;
};
// ----------------------------------------------------------------------------------------
@@ -820,15 +820,15 @@ private:
class netlist_core_device_t : public netlist_object_t
{
- NETLIST_PREVENT_COPYING(netlist_core_device_t)
+ NETLIST_PREVENT_COPYING(netlist_core_device_t)
public:
- typedef netlist_list_t<netlist_core_device_t *> list_t;
+ typedef netlist_list_t<netlist_core_device_t *> list_t;
- ATTR_COLD netlist_core_device_t();
- ATTR_COLD netlist_core_device_t(const family_t afamily);
+ ATTR_COLD netlist_core_device_t();
+ ATTR_COLD netlist_core_device_t(const family_t afamily);
- ATTR_COLD virtual ~netlist_core_device_t();
+ ATTR_COLD virtual ~netlist_core_device_t();
ATTR_COLD virtual void init(netlist_base_t &anetlist, const pstring &name);
@@ -848,7 +848,7 @@ public:
#endif
}
- ATTR_HOT const netlist_sig_t INPLOGIC_PASSIVE(netlist_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 netlist_logic_input_t &inp) const
{
@@ -885,10 +885,10 @@ public:
ATTR_HOT virtual void dec_active() { }
ATTR_HOT virtual void step_time(const double st) { }
- ATTR_HOT virtual void update_terminals() { }
+ ATTR_HOT virtual void update_terminals() { }
#if (NL_KEEP_STATISTICS)
- /* stats */
+ /* stats */
osd_ticks_t total_time;
INT32 stat_count;
#endif
@@ -908,11 +908,11 @@ private:
class netlist_device_t : public netlist_core_device_t
{
- NETLIST_PREVENT_COPYING(netlist_device_t)
+ NETLIST_PREVENT_COPYING(netlist_device_t)
public:
ATTR_COLD netlist_device_t();
- ATTR_COLD netlist_device_t(const family_t afamily);
+ ATTR_COLD netlist_device_t(const family_t afamily);
ATTR_COLD virtual ~netlist_device_t();
@@ -921,9 +921,9 @@ public:
ATTR_COLD netlist_setup_t &setup();
ATTR_COLD void register_sub(netlist_device_t &dev, const pstring &name);
- ATTR_COLD void register_subalias(const pstring &name, const netlist_core_terminal_t &term);
+ ATTR_COLD void register_subalias(const pstring &name, const netlist_core_terminal_t &term);
- ATTR_COLD void register_terminal(const pstring &name, netlist_terminal_t &port);
+ ATTR_COLD void register_terminal(const pstring &name, netlist_terminal_t &port);
ATTR_COLD void register_output(const pstring &name, netlist_output_t &out);
@@ -932,23 +932,23 @@ public:
ATTR_COLD void register_link_internal(netlist_input_t &in, netlist_output_t &out, const netlist_input_t::state_e aState);
ATTR_COLD void register_link_internal(netlist_core_device_t &dev, netlist_input_t &in, netlist_output_t &out, const netlist_input_t::state_e aState);
- /* driving logic outputs don't count in here */
+ /* driving logic outputs don't count in here */
netlist_list_t<pstring, 20> m_terminals;
protected:
ATTR_HOT virtual void update() { }
ATTR_HOT virtual void start() { }
- ATTR_HOT virtual void update_terminals() { }
+ ATTR_HOT virtual void update_terminals() { }
- template <class C, class T>
+ template <class C, class T>
ATTR_COLD void register_param(const pstring &sname, C &param, const T initialVal)
{
- register_param(*this, sname, param, initialVal);
+ register_param(*this, sname, param, initialVal);
}
template <class C, class T>
- ATTR_COLD void register_param(netlist_core_device_t &dev, const pstring &sname, C &param, const T initialVal);
+ ATTR_COLD void register_param(netlist_core_device_t &dev, const pstring &sname, C &param, const T initialVal);
private:
};
@@ -962,7 +962,7 @@ typedef tagmap_t<netlist_device_t *, 393> tagmap_devices_t;
class netlist_base_t : public netlist_object_t, public pstate_manager_t
{
- NETLIST_PREVENT_COPYING(netlist_base_t)
+ NETLIST_PREVENT_COPYING(netlist_base_t)
public:
typedef netlist_timed_queue<netlist_net_t, netlist_time, 512> queue_t;
@@ -970,8 +970,8 @@ public:
netlist_base_t();
virtual ~netlist_base_t();
- ATTR_HOT inline const queue_t &queue() const { return m_queue; }
- ATTR_HOT inline queue_t &queue() { return m_queue; }
+ ATTR_HOT inline const queue_t &queue() const { return m_queue; }
+ ATTR_HOT inline queue_t &queue() { return m_queue; }
ATTR_HOT inline void push_to_queue(netlist_net_t &out, const netlist_time &attime)
{
@@ -984,21 +984,21 @@ public:
ATTR_HOT inline const netlist_time &time() const { return m_time_ps; }
- ATTR_COLD void set_mainclock_dev(NETLIB_NAME(mainclock) *dev);
- ATTR_COLD void set_solver_dev(NETLIB_NAME(solver) *dev);
- ATTR_COLD void set_setup(netlist_setup_t *asetup) { m_setup = asetup; }
+ ATTR_COLD void set_mainclock_dev(NETLIB_NAME(mainclock) *dev);
+ ATTR_COLD void set_solver_dev(NETLIB_NAME(solver) *dev);
+ ATTR_COLD void set_setup(netlist_setup_t *asetup) { m_setup = asetup; }
- ATTR_COLD netlist_net_t *find_net(const pstring &name);
+ ATTR_COLD netlist_net_t *find_net(const pstring &name);
- ATTR_COLD void set_clock_freq(UINT64 clockfreq);
+ ATTR_COLD void set_clock_freq(UINT64 clockfreq);
- ATTR_COLD netlist_setup_t &setup() { return *m_setup; }
+ ATTR_COLD netlist_setup_t &setup() { return *m_setup; }
ATTR_COLD void reset();
ATTR_COLD void xfatalerror(const char *format, ...) const;
- tagmap_devices_t m_devices;
- netlist_net_t::list_t m_nets;
+ tagmap_devices_t m_devices;
+ netlist_net_t::list_t m_nets;
protected:
@@ -1006,14 +1006,14 @@ protected:
virtual void vfatalerror(const char *format, va_list ap) const = 0;
protected:
- ATTR_COLD virtual void save_register()
- {
- //queue_t m_queue;
- save(NAME(m_time_ps));
- save(NAME(m_rem));
- save(NAME(m_div));
- netlist_object_t::save_register();
- }
+ ATTR_COLD virtual void save_register()
+ {
+ //queue_t m_queue;
+ save(NAME(m_time_ps));
+ save(NAME(m_rem));
+ save(NAME(m_div));
+ netlist_object_t::save_register();
+ }
#if (NL_KEEP_STATISTICS)
// performance
@@ -1023,17 +1023,17 @@ protected:
#endif
private:
- ATTR_HOT void update_time(const netlist_time t, INT32 &atime);
+ ATTR_HOT void update_time(const netlist_time t, INT32 &atime);
- netlist_time m_time_ps;
- queue_t m_queue;
+ netlist_time m_time_ps;
+ queue_t m_queue;
UINT32 m_rem;
UINT32 m_div;
NETLIB_NAME(mainclock) * m_mainclock;
- NETLIB_NAME(solver) * m_solver;
+ NETLIB_NAME(solver) * m_solver;
- netlist_setup_t *m_setup;
+ netlist_setup_t *m_setup;
};
// ----------------------------------------------------------------------------------------
@@ -1060,8 +1060,8 @@ public:
protected:
ATTR_COLD void start()
{
- register_input("I", m_I, netlist_terminal_t::STATE_INP_ACTIVE);
- register_output("Q", m_Q);
+ register_input("I", m_I, netlist_terminal_t::STATE_INP_ACTIVE);
+ register_output("Q", m_Q);
m_Q.initial(1);
}
@@ -1072,7 +1072,7 @@ protected:
else if (m_I.Q_Analog() < m_I.m_low_thresh_V)
OUTLOGIC(m_Q, 0, NLTIME_FROM_NS(1));
else
- OUTLOGIC(m_Q, m_Q.net().last_Q(), NLTIME_FROM_NS(1));
+ OUTLOGIC(m_Q, m_Q.net().last_Q(), NLTIME_FROM_NS(1));
}
};
@@ -1084,7 +1084,7 @@ protected:
class nld_d_to_a_proxy : public netlist_device_t
{
public:
- ATTR_COLD nld_d_to_a_proxy(netlist_output_t &out_proxied)
+ ATTR_COLD nld_d_to_a_proxy(netlist_output_t &out_proxied)
: netlist_device_t()
{
//assert(out_proxied.object_type(SIGNAL_MASK) == SIGNAL_DIGITAL);
@@ -1093,7 +1093,7 @@ public:
m_high_V = out_proxied.m_high_V;
}
- ATTR_COLD virtual ~nld_d_to_a_proxy() {}
+ ATTR_COLD virtual ~nld_d_to_a_proxy() {}
netlist_ttl_input_t m_I;
netlist_analog_output_t m_Q;
@@ -1101,8 +1101,8 @@ public:
protected:
ATTR_COLD void start()
{
- register_input("I", m_I, netlist_terminal_t::STATE_INP_ACTIVE);
- register_output("Q", m_Q);
+ register_input("I", m_I, netlist_terminal_t::STATE_INP_ACTIVE);
+ register_output("Q", m_Q);
m_Q.initial(0);
}
@@ -1122,20 +1122,20 @@ private:
ATTR_HOT inline void netlist_param_str_t::setTo(const pstring &param)
{
- m_param = param;
- netdev().update_param();
+ m_param = param;
+ netdev().update_param();
}
ATTR_HOT inline void netlist_param_int_t::setTo(const int param)
{
- m_param = param;
- netdev().update_param();
+ m_param = param;
+ netdev().update_param();
}
ATTR_HOT inline void netlist_param_double_t::setTo(const double param)
{
- m_param = param;
- netdev().update_param();
+ m_param = param;
+ netdev().update_param();
}
@@ -1193,12 +1193,12 @@ 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;
- railterminal().netdev().inc_active();
- m_cur = m_new;
- }
+ 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))
{
@@ -1219,8 +1219,8 @@ ATTR_HOT inline void netlist_net_t::dec_active()
{
m_active--;
if (USE_DEACTIVE_DEVICE)
- if (m_active == 0)
- railterminal().netdev().dec_active();
+ if (m_active == 0)
+ railterminal().netdev().dec_active();
}
@@ -1251,7 +1251,7 @@ ATTR_HOT inline const bool netlist_analog_input_t::is_highz() const
class net_device_t_base_factory
{
- NETLIST_PREVENT_COPYING(net_device_t_base_factory)
+ NETLIST_PREVENT_COPYING(net_device_t_base_factory)
public:
net_device_t_base_factory(const pstring &name, const pstring &classname)
: m_name(name), m_classname(classname)
@@ -1271,7 +1271,7 @@ protected:
template <class C>
class net_device_t_factory : public net_device_t_base_factory
{
- NETLIST_PREVENT_COPYING(net_device_t_factory)
+ NETLIST_PREVENT_COPYING(net_device_t_factory)
public:
net_device_t_factory(const pstring &name, const pstring &classname)
: net_device_t_base_factory(name, classname) { }
@@ -1288,23 +1288,23 @@ class netlist_factory
{
public:
- netlist_factory();
- ~netlist_factory();
+ netlist_factory();
+ ~netlist_factory();
- void initialize();
+ void initialize();
- template<class _C>
- void register_device(const pstring &name, const pstring &classname)
- {
- m_list.add(new net_device_t_factory< _C >(name, classname) );
- }
+ template<class _C>
+ void register_device(const pstring &name, const pstring &classname)
+ {
+ m_list.add(new net_device_t_factory< _C >(name, classname) );
+ }
- netlist_device_t *new_device_by_classname(const pstring &classname, netlist_setup_t &setup) const;
- netlist_device_t *new_device_by_name(const pstring &name, netlist_setup_t &setup) const;
+ netlist_device_t *new_device_by_classname(const pstring &classname, netlist_setup_t &setup) const;
+ netlist_device_t *new_device_by_name(const pstring &name, netlist_setup_t &setup) const;
private:
- typedef netlist_list_t<net_device_t_base_factory *> list_t;
- list_t m_list;
+ typedef netlist_list_t<net_device_t_base_factory *> list_t;
+ list_t m_list;
};
diff --git a/src/emu/netlist/nl_config.h b/src/emu/netlist/nl_config.h
index 63f8e8c8c6c..0f73d57b78c 100644
--- a/src/emu/netlist/nl_config.h
+++ b/src/emu/netlist/nl_config.h
@@ -65,10 +65,9 @@ typedef UINT8 netlist_sig_t;
// prevent implicit copying
#define NETLIST_PREVENT_COPYING(_name) \
- private: \
- _name(const _name &); \
- _name &operator=(const _name &); \
-
+ private: \
+ _name(const _name &); \
+ _name &operator=(const _name &);
#if NL_KEEP_STATISTICS
#define add_to_stat(v,x) do { v += (x); } while (0)
#define inc_stat(v) add_to_stat(v, 1)
diff --git a/src/emu/netlist/nl_lists.h b/src/emu/netlist/nl_lists.h
index 3d4d70c0231..ef32fb03c1f 100644
--- a/src/emu/netlist/nl_lists.h
+++ b/src/emu/netlist/nl_lists.h
@@ -20,13 +20,12 @@ struct netlist_list_t
{
public:
- struct entry_t {
+ struct entry_t {
+ // keep compatibility with tagmap
+ _ListClass object() { return m_obj; }
- // keep compatibility with tagmap
- _ListClass object() { return m_obj; }
-
- _ListClass m_obj;
- };
+ _ListClass m_obj;
+ };
ATTR_COLD netlist_list_t(int numElements = _NumElem)
{
@@ -36,25 +35,25 @@ public:
m_ptr--;
}
- ATTR_COLD netlist_list_t(const netlist_list_t &rhs)
- {
- m_list = new entry_t[m_num_elements];
- m_ptr = m_list;
- m_ptr--;
- for (int i=0; i<rhs.count(); i++)
- {
- this->add(rhs[i]);
- }
- }
-
- ATTR_COLD netlist_list_t &operator=(const netlist_list_t &rhs)
- {
- for (int i=0; i<rhs.count(); i++)
- {
- this->add(rhs[i]);
- }
- return *this;
- }
+ ATTR_COLD netlist_list_t(const netlist_list_t &rhs)
+ {
+ m_list = new entry_t[m_num_elements];
+ m_ptr = m_list;
+ m_ptr--;
+ for (int i=0; i<rhs.count(); i++)
+ {
+ this->add(rhs[i]);
+ }
+ }
+
+ ATTR_COLD netlist_list_t &operator=(const netlist_list_t &rhs)
+ {
+ for (int i=0; i<rhs.count(); i++)
+ {
+ this->add(rhs[i]);
+ }
+ return *this;
+ }
ATTR_COLD ~netlist_list_t()
@@ -64,50 +63,50 @@ public:
ATTR_HOT inline void add(const _ListClass elem)
{
if (m_ptr-m_list >= m_num_elements - 1)
- resize(m_num_elements * 2);
+ resize(m_num_elements * 2);
(++m_ptr)->m_obj = elem;
}
ATTR_HOT inline void resize(const int new_size)
{
- int cnt = count();
- entry_t *m_new = new entry_t[new_size];
- entry_t *pd = m_new;
-
- for (entry_t *ps = m_list; ps <= m_ptr; ps++, pd++)
- *pd = *ps;
- delete[] m_list;
- m_list = m_new;
- m_ptr = m_list + cnt - 1;
- m_num_elements = new_size;
+ int cnt = count();
+ entry_t *m_new = new entry_t[new_size];
+ entry_t *pd = m_new;
+
+ for (entry_t *ps = m_list; ps <= m_ptr; ps++, pd++)
+ *pd = *ps;
+ delete[] m_list;
+ m_list = m_new;
+ m_ptr = m_list + cnt - 1;
+ m_num_elements = new_size;
+ }
+ ATTR_HOT inline void remove(const _ListClass elem)
+ {
+ for (entry_t *i = m_list; i <= m_ptr; i++)
+ {
+ if (i->object() == elem)
+ {
+ while (i < m_ptr)
+ {
+ *i = *(i+1);
+ i++;
+ }
+ m_ptr--;
+ return;
+ }
+ }
+ }
+ ATTR_HOT inline bool contains(const _ListClass elem) const
+ {
+ for (entry_t *i = m_list; i <= m_ptr; i++)
+ {
+ if (i->object() == elem)
+ return true;
+ }
+ return false;
}
- ATTR_HOT inline void remove(const _ListClass elem)
- {
- for (entry_t *i = m_list; i <= m_ptr; i++)
- {
- if (i->object() == elem)
- {
- while (i < m_ptr)
- {
- *i = *(i+1);
- i++;
- }
- m_ptr--;
- return;
- }
- }
- }
- ATTR_HOT inline bool contains(const _ListClass elem) const
- {
- for (entry_t *i = m_list; i <= m_ptr; i++)
- {
- if (i->object() == elem)
- return true;
- }
- return false;
- }
ATTR_HOT inline entry_t *first() const { return (m_ptr >= m_list ? &m_list[0] : NULL ); }
- ATTR_HOT inline entry_t *next(entry_t *lc) const { return (lc < last() ? lc + 1 : NULL ); }
+ ATTR_HOT inline entry_t *next(entry_t *lc) const { return (lc < last() ? lc + 1 : NULL ); }
ATTR_HOT inline entry_t *last() const { return m_ptr; }
ATTR_HOT inline int count() const { return m_ptr - m_list + 1; }
ATTR_HOT inline bool empty() const { return (m_ptr < m_list); }
@@ -115,16 +114,16 @@ public:
ATTR_COLD void reset_and_free()
{
- for (entry_t *i = m_list; i <= m_ptr; i++)
- {
- delete i->object();
- }
- reset();
+ for (entry_t *i = m_list; i <= m_ptr; i++)
+ {
+ delete i->object();
+ }
+ reset();
}
- //ATTR_HOT inline entry_t *item(int i) const { return &m_list[i]; }
+ //ATTR_HOT inline entry_t *item(int i) const { return &m_list[i]; }
ATTR_HOT inline _ListClass& operator[](const int & index) { return m_list[index].m_obj; }
- ATTR_HOT inline const _ListClass& operator[](const int & index) const { return m_list[index].m_obj; }
+ ATTR_HOT inline const _ListClass& operator[](const int & index) const { return m_list[index].m_obj; }
private:
entry_t * m_ptr;
@@ -140,7 +139,7 @@ private:
template <class _Element, class _Time, int _Size>
class netlist_timed_queue
{
- NETLIST_PREVENT_COPYING(netlist_timed_queue)
+ NETLIST_PREVENT_COPYING(netlist_timed_queue)
public:
struct entry_t
@@ -153,7 +152,7 @@ public:
ATTR_HOT inline _Element & object() const { return *m_object; }
ATTR_HOT inline const _Time *time_ptr() const { return &m_time; }
- ATTR_HOT inline _Element *object_ptr() const { return m_object; }
+ ATTR_HOT inline _Element *object_ptr() const { return m_object; }
private:
_Time m_time;
_Element *m_object;
@@ -165,7 +164,7 @@ public:
clear();
}
- ATTR_HOT inline int capacity() const { return _Size; }
+ ATTR_HOT inline int capacity() const { return _Size; }
ATTR_HOT inline bool is_empty() const { return (m_end == &m_list[0]); }
ATTR_HOT inline bool is_not_empty() const { return (m_end > &m_list[0]); }
diff --git a/src/emu/netlist/nl_parser.c b/src/emu/netlist/nl_parser.c
index 42ccbda80b2..3766cba3117 100644
--- a/src/emu/netlist/nl_parser.c
+++ b/src/emu/netlist/nl_parser.c
@@ -27,18 +27,18 @@ void netlist_parser::parse(const char *buf)
NL_VERBOSE_OUT(("Parser: Device: %s\n", n.cstr()));
if (n == "NET_ALIAS")
net_alias();
- else if (n == "NET_C")
- net_c();
+ else if (n == "NET_C")
+ net_c();
else if (n == "NETDEV_PARAM")
netdev_param();
- else if (n == "NETDEV_R")
- netdev_device(n, "R");
- else if (n == "NETDEV_C")
- netdev_device(n, "C");
- else if (n == "NETDEV_POT")
- netdev_device(n, "R");
- else if (n == "NETDEV_D")
- netdev_device(n, "model", true);
+ else if (n == "NETDEV_R")
+ netdev_device(n, "R");
+ else if (n == "NETDEV_C")
+ netdev_device(n, "C");
+ else if (n == "NETDEV_POT")
+ netdev_device(n, "R");
+ else if (n == "NETDEV_D")
+ netdev_device(n, "model", true);
else if ((n == "NETDEV_TTL_CONST") || (n == "NETDEV_ANALOG_CONST"))
netdev_const(n);
else
@@ -60,14 +60,14 @@ void netlist_parser::net_alias()
void netlist_parser::net_c()
{
- pstring t1;
- pstring t2;
- skipws();
- t1 = getname(',');
- skipws();
- t2 = getname(')');
- NL_VERBOSE_OUT(("Parser: Connect: %s %s\n", t1.cstr(), t2.cstr()));
- m_setup.register_link(t1 , t2);
+ pstring t1;
+ pstring t2;
+ skipws();
+ t1 = getname(',');
+ skipws();
+ t2 = getname(')');
+ NL_VERBOSE_OUT(("Parser: Connect: %s %s\n", t1.cstr(), t2.cstr()));
+ m_setup.register_link(t1 , t2);
}
void netlist_parser::netdev_param()
@@ -98,7 +98,7 @@ void netlist_parser::netdev_const(const pstring &dev_name)
val = eval_param();
paramfq = name + ".CONST";
NL_VERBOSE_OUT(("Parser: Const: %s %f\n", name.cstr(), val));
- check_char(')');
+ check_char(')');
m_setup.register_param(paramfq, val);
}
@@ -126,43 +126,43 @@ void netlist_parser::netdev_device(const pstring &dev_type)
}
/*
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));
- }
- */
+ 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));
+ }
+ */
}
void netlist_parser::netdev_device(const pstring &dev_type, const pstring &default_param, bool isString)
{
- netlist_device_t *dev;
+ netlist_device_t *dev;
- skipws();
- pstring devname = getname2(',', ')');
- pstring defparam = devname + "." + default_param;
- dev = m_setup.factory().new_device_by_name(dev_type, m_setup);
- m_setup.register_dev(dev, devname);
- NL_VERBOSE_OUT(("Parser: IC: %s\n", devname.cstr()));
- if (getc() != ')')
- {
- // have a default param
- skipws();
- if (isString)
- {
- pstring val = getname(')');
- ungetc();
- NL_VERBOSE_OUT(("Parser: Default param: %s %s\n", defparam.cstr(), val.cstr()));
- m_setup.register_param(defparam, val);
- }
- else
- {
- double val = eval_param();
- NL_VERBOSE_OUT(("Parser: Default param: %s %f\n", defparam.cstr(), val));
- m_setup.register_param(defparam, val);
- }
- }
- check_char(')');
+ skipws();
+ pstring devname = getname2(',', ')');
+ pstring defparam = devname + "." + default_param;
+ dev = m_setup.factory().new_device_by_name(dev_type, m_setup);
+ m_setup.register_dev(dev, devname);
+ NL_VERBOSE_OUT(("Parser: IC: %s\n", devname.cstr()));
+ if (getc() != ')')
+ {
+ // have a default param
+ skipws();
+ if (isString)
+ {
+ pstring val = getname(')');
+ ungetc();
+ NL_VERBOSE_OUT(("Parser: Default param: %s %s\n", defparam.cstr(), val.cstr()));
+ m_setup.register_param(defparam, val);
+ }
+ else
+ {
+ double val = eval_param();
+ NL_VERBOSE_OUT(("Parser: Default param: %s %f\n", defparam.cstr(), val));
+ m_setup.register_param(defparam, val);
+ }
+ }
+ check_char(')');
}
// ----------------------------------------------------------------------------------------
@@ -171,7 +171,7 @@ void netlist_parser::netdev_device(const pstring &dev_type, const pstring &defau
void netlist_parser::skipeol()
{
- char c = getc();
+ char c = getc();
while (c)
{
if (c == 10)
@@ -197,27 +197,27 @@ void netlist_parser::skipws()
case 13:
break;
case '/':
- c = getc();
+ c = getc();
if (c == '/')
{
- skipeol();
+ skipeol();
}
else if (c == '*')
{
- int f=0;
- while ((c = getc()) != 0 )
- {
- if (f == 0 && c == '*')
- f=1;
- else if (f == 1 && c== '/' )
- break;
- else
- f=0;
- }
+ int f=0;
+ while ((c = getc()) != 0 )
+ {
+ if (f == 0 && c == '*')
+ f=1;
+ else if (f == 1 && c== '/' )
+ break;
+ else
+ f=0;
+ }
}
break;
default:
- ungetc();
+ ungetc();
return;
}
}
@@ -243,8 +243,8 @@ pstring netlist_parser::getname2(char sep1, char sep2)
while ((c != sep1) && (c != sep2))
{
- *p1++ = c;
- c = getc();
+ *p1++ = c;
+ c = getc();
}
*p1 = 0;
ungetc();
@@ -278,21 +278,21 @@ double netlist_parser::eval_param()
f = i;
ret = s.substr(strlen(macs[f])).as_double(&e);
if ((f>0) && e)
- m_setup.netlist().xfatalerror("Parser: Error with parameter ...\n");
- if (f>0)
- check_char(')');
+ m_setup.netlist().xfatalerror("Parser: Error with parameter ...\n");
+ if (f>0)
+ check_char(')');
return ret * facs[f];
}
unsigned char netlist_parser::getc()
{
- if (*m_px)
- return *(m_px++);
- else
- return *m_px;
+ if (*m_px)
+ return *(m_px++);
+ else
+ return *m_px;
}
void netlist_parser::ungetc()
{
- m_px--;
+ m_px--;
}
diff --git a/src/emu/netlist/nl_parser.h b/src/emu/netlist/nl_parser.h
index 4f673f18572..e985e05167f 100644
--- a/src/emu/netlist/nl_parser.h
+++ b/src/emu/netlist/nl_parser.h
@@ -12,7 +12,7 @@
class netlist_parser
{
- NETLIST_PREVENT_COPYING(netlist_parser)
+ NETLIST_PREVENT_COPYING(netlist_parser)
public:
netlist_parser(netlist_setup_t &setup)
: m_setup(setup) {}
@@ -20,10 +20,10 @@ public:
void parse(const char *buf);
void net_alias();
void netdev_param();
- void net_c();
+ void net_c();
void netdev_const(const pstring &dev_name);
void netdev_device(const pstring &dev_type);
- void netdev_device(const pstring &dev_type, const pstring &default_param, bool isString = false);
+ void netdev_device(const pstring &dev_type, const pstring &default_param, bool isString = false);
private:
diff --git a/src/emu/netlist/nl_setup.c b/src/emu/netlist/nl_setup.c
index 21072b4ba45..e78b7299a16 100644
--- a/src/emu/netlist/nl_setup.c
+++ b/src/emu/netlist/nl_setup.c
@@ -17,9 +17,9 @@ static NETLIST_START(base)
NETDEV_TTL_CONST(ttllow, 0)
NETDEV_ANALOG_CONST(NC, NETLIST_HIGHIMP_V)
- NET_MODEL(".model 1N914 D(Is=2.52n Rs=.568 N=1.752 Cjo=4p M=.4 tt=20n Iave=200m Vpk=75 mfg=OnSemi type=silicon)")
- NET_MODEL(".model 1N4148 D(Is=2.52n Rs=.568 N=1.752 Cjo=4p M=.4 tt=20n Iave=200m Vpk=75 mfg=OnSemi type=silicon)")
- NET_MODEL(".MODEL BC237B NPN(IS=1.8E-14 ISE=5.0E-14 ISC=1.72E-13 XTI=3 BF=400 BR=35.5 IKF=0.14 IKR=0.03 XTB=1.5 VAF=80 VAR=12.5 VJE=0.58 VJC=0.54 RE=0.6 RC=0.25 RB=0.56 CJE=13E-12 CJC=4E-12 XCJC=0.75 FC=0.5 NF=0.9955 NR=1.005 NE=1.46 NC=1.27 MJE=0.33 MJC=0.33 TF=0.64E-9 TR=50.72E-9 EG=1.11 KF=0 AF=1 VCEO=45V ICRATING=100M MFG=ZETEX)")
+ NET_MODEL(".model 1N914 D(Is=2.52n Rs=.568 N=1.752 Cjo=4p M=.4 tt=20n Iave=200m Vpk=75 mfg=OnSemi type=silicon)")
+ NET_MODEL(".model 1N4148 D(Is=2.52n Rs=.568 N=1.752 Cjo=4p M=.4 tt=20n Iave=200m Vpk=75 mfg=OnSemi type=silicon)")
+ NET_MODEL(".MODEL BC237B NPN(IS=1.8E-14 ISE=5.0E-14 ISC=1.72E-13 XTI=3 BF=400 BR=35.5 IKF=0.14 IKR=0.03 XTB=1.5 VAF=80 VAR=12.5 VJE=0.58 VJC=0.54 RE=0.6 RC=0.25 RB=0.56 CJE=13E-12 CJC=4E-12 XCJC=0.75 FC=0.5 NF=0.9955 NR=1.005 NE=1.46 NC=1.27 MJE=0.33 MJC=0.33 TF=0.64E-9 TR=50.72E-9 EG=1.11 KF=0 AF=1 VCEO=45V ICRATING=100M MFG=ZETEX)")
NETLIST_END
@@ -30,15 +30,15 @@ NETLIST_END
netlist_setup_t::netlist_setup_t(netlist_base_t &netlist)
: m_netlist(netlist)
- , m_proxy_cnt(0)
+ , m_proxy_cnt(0)
{
- netlist.set_setup(this);
+ netlist.set_setup(this);
}
void netlist_setup_t::init()
{
- m_factory.initialize();
- NETLIST_NAME(base)(*this);
+ m_factory.initialize();
+ NETLIST_NAME(base)(*this);
}
@@ -59,7 +59,7 @@ netlist_setup_t::~netlist_setup_t()
netlist_device_t *netlist_setup_t::register_dev(netlist_device_t *dev, const pstring &name)
{
if (!(netlist().m_devices.add(name, dev, false)==TMERR_NONE))
- netlist().xfatalerror("Error adding %s to device list\n", name.cstr());
+ netlist().xfatalerror("Error adding %s to device list\n", name.cstr());
return dev;
}
@@ -85,7 +85,7 @@ void netlist_setup_t::remove_dev(const pstring &name)
netlist_device_t *dev = netlist().m_devices.find(name);
pstring temp = name + ".";
if (dev == NULL)
- netlist().xfatalerror("Device %s does not exist\n", name.cstr());
+ netlist().xfatalerror("Device %s does not exist\n", name.cstr());
//remove_start_with<tagmap_input_t>(m_inputs, temp);
remove_start_with<tagmap_terminal_t>(m_terminals, temp);
@@ -94,193 +94,193 @@ void netlist_setup_t::remove_dev(const pstring &name)
tagmap_link_t::entry_t *p = m_links.first();
while (p != NULL)
{
- tagmap_link_t::entry_t *n = m_links.next(p);
- if (temp.equals(p->object().e1.substr(0,temp.len())) || temp.equals(p->object().e2.substr(0,temp.len())))
- m_links.remove(p->object());
- p = n;
+ tagmap_link_t::entry_t *n = m_links.next(p);
+ if (temp.equals(p->object().e1.substr(0,temp.len())) || temp.equals(p->object().e2.substr(0,temp.len())))
+ m_links.remove(p->object());
+ p = n;
}
netlist().m_devices.remove(name);
}
void netlist_setup_t::register_model(const pstring &model)
{
- m_models.add(model);
+ m_models.add(model);
}
void netlist_setup_t::register_alias(const pstring &alias, const pstring &out)
{
- //if (!(m_alias.add(alias, new nstring(out), false)==TMERR_NONE))
+ //if (!(m_alias.add(alias, new nstring(out), false)==TMERR_NONE))
if (!(m_alias.add(alias, out, false)==TMERR_NONE))
- netlist().xfatalerror("Error adding alias %s to alias list\n", alias.cstr());
+ netlist().xfatalerror("Error adding alias %s to alias list\n", alias.cstr());
}
pstring netlist_setup_t::objtype_as_astr(netlist_object_t &in)
{
- switch (in.type())
- {
- case netlist_terminal_t::TERMINAL:
- return "TERMINAL";
- break;
- case netlist_terminal_t::INPUT:
- return "INPUT";
- break;
- case netlist_terminal_t::OUTPUT:
- return "OUTPUT";
- break;
- case netlist_terminal_t::NET:
- return "NET";
- break;
- case netlist_terminal_t::PARAM:
- return "PARAM";
- break;
- case netlist_terminal_t::DEVICE:
- return "DEVICE";
- break;
- case netlist_terminal_t::NETLIST:
- return "NETLIST";
- break;
- }
- // FIXME: noreturn
- netlist().xfatalerror("Unknown object type %d\n", in.type());
- return "Error";
+ switch (in.type())
+ {
+ case netlist_terminal_t::TERMINAL:
+ return "TERMINAL";
+ break;
+ case netlist_terminal_t::INPUT:
+ return "INPUT";
+ break;
+ case netlist_terminal_t::OUTPUT:
+ return "OUTPUT";
+ break;
+ case netlist_terminal_t::NET:
+ return "NET";
+ break;
+ case netlist_terminal_t::PARAM:
+ return "PARAM";
+ break;
+ case netlist_terminal_t::DEVICE:
+ return "DEVICE";
+ break;
+ case netlist_terminal_t::NETLIST:
+ return "NETLIST";
+ break;
+ }
+ // FIXME: noreturn
+ netlist().xfatalerror("Unknown object type %d\n", in.type());
+ return "Error";
}
void netlist_setup_t::register_object(netlist_device_t &dev, netlist_core_device_t &upd_dev, const pstring &name, netlist_object_t &obj, const netlist_input_t::state_e state)
{
- switch (obj.type())
- {
- case netlist_terminal_t::TERMINAL:
- case netlist_terminal_t::INPUT:
- case netlist_terminal_t::OUTPUT:
- {
- netlist_core_terminal_t &term = dynamic_cast<netlist_core_terminal_t &>(obj);
- if (obj.isType(netlist_terminal_t::OUTPUT))
- dynamic_cast<netlist_output_t &>(term).init_object(upd_dev, dev.name() + "." + name);
- else
- term.init_object(upd_dev, dev.name() + "." + name, state);
-
- if (!(m_terminals.add(term.name(), &term, false)==TMERR_NONE))
- netlist().xfatalerror("Error adding %s %s to terminal list\n", objtype_as_astr(term).cstr(), term.name().cstr());
- NL_VERBOSE_OUT(("%s %s\n", objtype_as_astr(term).cstr(), name.cstr()));
- }
- break;
- case netlist_terminal_t::NET:
- break;
- case netlist_terminal_t::PARAM:
- {
- netlist_param_t &param = dynamic_cast<netlist_param_t &>(obj);
- const pstring val = m_params_temp.find(name);
- if (val != "")
- {
- switch (param.param_type())
- {
- case netlist_param_t::DOUBLE:
- {
- NL_VERBOSE_OUT(("Found parameter ... %s : %s\n", temp.cstr(), val->cstr()));
- double vald = 0;
- if (sscanf(val.cstr(), "%lf", &vald) != 1)
- netlist().xfatalerror("Invalid number conversion %s : %s\n", name.cstr(), val.cstr());
- dynamic_cast<netlist_param_double_t &>(param).initial(vald);
- }
- break;
- case netlist_param_t::INTEGER:
- case netlist_param_t::LOGIC:
- {
- NL_VERBOSE_OUT(("Found parameter ... %s : %s\n", name.cstr(), val->cstr()));
- int vald = 0;
- if (sscanf(val.cstr(), "%d", &vald) != 1)
- netlist().xfatalerror("Invalid number conversion %s : %s\n", name.cstr(), val.cstr());
- dynamic_cast<netlist_param_int_t &>(param).initial(vald);
- }
- break;
- case netlist_param_t::STRING:
- {
- dynamic_cast<netlist_param_str_t &>(param).initial(val);
- }
- break;
- case netlist_param_t::MODEL:
- {
- pstring search = (".model " + val + " ").ucase();
- bool found = false;
- for (int i=0; i < m_models.count(); i++)
- {
- if (m_models[i].ucase().startsWith(search))
- {
- int pl=m_models[i].find("(");
- int pr=m_models[i].find("(");
- dynamic_cast<netlist_param_model_t &>(param).initial(m_models[i].substr(pl+1,pr-pl-1));
- found = true;
- break;
- }
- }
- if (!found)
- netlist().xfatalerror("Model %s not found\n", val.cstr());
- }
- break;
- default:
- netlist().xfatalerror("Parameter is not supported %s : %s\n", name.cstr(), val.cstr());
- }
- }
- if (!(m_params.add(name, &param, false)==TMERR_NONE))
- netlist().xfatalerror("Error adding parameter %s to parameter list\n", name.cstr());
- }
- break;
- case netlist_terminal_t::DEVICE:
- netlist().xfatalerror("Device registration not yet supported - \n", name.cstr());
- break;
- case netlist_terminal_t::NETLIST:
- netlist().xfatalerror("Netlist registration not yet supported - \n", name.cstr());
- break;
- }
+ switch (obj.type())
+ {
+ case netlist_terminal_t::TERMINAL:
+ case netlist_terminal_t::INPUT:
+ case netlist_terminal_t::OUTPUT:
+ {
+ netlist_core_terminal_t &term = dynamic_cast<netlist_core_terminal_t &>(obj);
+ if (obj.isType(netlist_terminal_t::OUTPUT))
+ dynamic_cast<netlist_output_t &>(term).init_object(upd_dev, dev.name() + "." + name);
+ else
+ term.init_object(upd_dev, dev.name() + "." + name, state);
+
+ if (!(m_terminals.add(term.name(), &term, false)==TMERR_NONE))
+ netlist().xfatalerror("Error adding %s %s to terminal list\n", objtype_as_astr(term).cstr(), term.name().cstr());
+ NL_VERBOSE_OUT(("%s %s\n", objtype_as_astr(term).cstr(), name.cstr()));
+ }
+ break;
+ case netlist_terminal_t::NET:
+ break;
+ case netlist_terminal_t::PARAM:
+ {
+ netlist_param_t &param = dynamic_cast<netlist_param_t &>(obj);
+ const pstring val = m_params_temp.find(name);
+ if (val != "")
+ {
+ switch (param.param_type())
+ {
+ case netlist_param_t::DOUBLE:
+ {
+ NL_VERBOSE_OUT(("Found parameter ... %s : %s\n", temp.cstr(), val->cstr()));
+ double vald = 0;
+ if (sscanf(val.cstr(), "%lf", &vald) != 1)
+ netlist().xfatalerror("Invalid number conversion %s : %s\n", name.cstr(), val.cstr());
+ dynamic_cast<netlist_param_double_t &>(param).initial(vald);
+ }
+ break;
+ case netlist_param_t::INTEGER:
+ case netlist_param_t::LOGIC:
+ {
+ NL_VERBOSE_OUT(("Found parameter ... %s : %s\n", name.cstr(), val->cstr()));
+ int vald = 0;
+ if (sscanf(val.cstr(), "%d", &vald) != 1)
+ netlist().xfatalerror("Invalid number conversion %s : %s\n", name.cstr(), val.cstr());
+ dynamic_cast<netlist_param_int_t &>(param).initial(vald);
+ }
+ break;
+ case netlist_param_t::STRING:
+ {
+ dynamic_cast<netlist_param_str_t &>(param).initial(val);
+ }
+ break;
+ case netlist_param_t::MODEL:
+ {
+ pstring search = (".model " + val + " ").ucase();
+ bool found = false;
+ for (int i=0; i < m_models.count(); i++)
+ {
+ if (m_models[i].ucase().startsWith(search))
+ {
+ int pl=m_models[i].find("(");
+ int pr=m_models[i].find("(");
+ dynamic_cast<netlist_param_model_t &>(param).initial(m_models[i].substr(pl+1,pr-pl-1));
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ netlist().xfatalerror("Model %s not found\n", val.cstr());
+ }
+ break;
+ default:
+ netlist().xfatalerror("Parameter is not supported %s : %s\n", name.cstr(), val.cstr());
+ }
+ }
+ if (!(m_params.add(name, &param, false)==TMERR_NONE))
+ netlist().xfatalerror("Error adding parameter %s to parameter list\n", name.cstr());
+ }
+ break;
+ case netlist_terminal_t::DEVICE:
+ netlist().xfatalerror("Device registration not yet supported - \n", name.cstr());
+ break;
+ case netlist_terminal_t::NETLIST:
+ netlist().xfatalerror("Netlist registration not yet supported - \n", name.cstr());
+ break;
+ }
}
void netlist_setup_t::register_link(const pstring &sin, const pstring &sout)
{
link_t temp = link_t(sin, sout);
NL_VERBOSE_OUT(("link %s <== %s\n", sin.cstr(), sout.cstr()));
- m_links.add(temp);
+ m_links.add(temp);
//if (!(m_links.add(sin + "." + sout, temp, false)==TMERR_NONE))
- // fatalerror("Error adding link %s<==%s to link list\n", sin.cstr(), sout.cstr());
+ // fatalerror("Error adding link %s<==%s to link list\n", sin.cstr(), sout.cstr());
}
void netlist_setup_t::register_param(const pstring &param, const double value)
{
- // FIXME: there should be a better way
- register_param(param, pstring::sprintf("%.9e", value));
+ // FIXME: there should be a better way
+ register_param(param, pstring::sprintf("%.9e", value));
}
void netlist_setup_t::register_param(const pstring &param, const pstring &value)
{
- //if (!(m_params_temp.add(param, new nstring(value), false)==TMERR_NONE))
- if (!(m_params_temp.add(param, value, false)==TMERR_NONE))
- netlist().xfatalerror("Error adding parameter %s to parameter list\n", param.cstr());
+ //if (!(m_params_temp.add(param, new nstring(value), false)==TMERR_NONE))
+ if (!(m_params_temp.add(param, value, false)==TMERR_NONE))
+ netlist().xfatalerror("Error adding parameter %s to parameter list\n", param.cstr());
}
const pstring netlist_setup_t::resolve_alias(const pstring &name) const
{
- pstring temp = name;
- pstring ret;
+ pstring temp = name;
+ pstring ret;
- /* FIXME: Detect endless loop */
- do {
- ret = temp;
- temp = m_alias.find(ret);
- } while (temp != "");
+ /* FIXME: Detect endless loop */
+ do {
+ ret = temp;
+ temp = m_alias.find(ret);
+ } while (temp != "");
- int p = ret.find(".[");
+ int p = ret.find(".[");
if (p > 0)
{
- pstring dname = ret;
- netlist_device_t *dev = netlist().m_devices.find(dname.substr(0,p));
- if (dev == NULL)
- netlist().xfatalerror("Device for %s not found\n", name.cstr());
- int c = atoi(ret.substr(p+2,ret.len()-p-3));
- temp = dev->name() + "." + dev->m_terminals[c];
- // reresolve ....
- do {
- ret = temp;
- temp = m_alias.find(ret);
- } while (temp != "");
+ pstring dname = ret;
+ netlist_device_t *dev = netlist().m_devices.find(dname.substr(0,p));
+ if (dev == NULL)
+ netlist().xfatalerror("Device for %s not found\n", name.cstr());
+ int c = atoi(ret.substr(p+2,ret.len()-p-3));
+ temp = dev->name() + "." + dev->m_terminals[c];
+ // reresolve ....
+ do {
+ ret = temp;
+ temp = m_alias.find(ret);
+ } while (temp != "");
}
NL_VERBOSE_OUT(("%s==>%s\n", name.cstr(), ret.cstr()));
@@ -289,22 +289,22 @@ const pstring netlist_setup_t::resolve_alias(const pstring &name) const
netlist_core_terminal_t *netlist_setup_t::find_terminal(const pstring &terminal_in, bool required)
{
- const pstring &tname = resolve_alias(terminal_in);
- netlist_core_terminal_t *ret;
-
- ret = m_terminals.find(tname);
- /* look for default */
- if (ret == NULL)
- {
- /* look for ".Q" std output */
- pstring s = tname + ".Q";
- ret = m_terminals.find(s);
- }
- if (ret == NULL && required)
- netlist().xfatalerror("terminal %s(%s) not found!\n", terminal_in.cstr(), tname.cstr());
- if (ret != NULL)
- NL_VERBOSE_OUT(("Found input %s\n", tname.cstr()));
- return ret;
+ const pstring &tname = resolve_alias(terminal_in);
+ netlist_core_terminal_t *ret;
+
+ ret = m_terminals.find(tname);
+ /* look for default */
+ if (ret == NULL)
+ {
+ /* look for ".Q" std output */
+ pstring s = tname + ".Q";
+ ret = m_terminals.find(s);
+ }
+ if (ret == NULL && required)
+ netlist().xfatalerror("terminal %s(%s) not found!\n", terminal_in.cstr(), tname.cstr());
+ if (ret != NULL)
+ NL_VERBOSE_OUT(("Found input %s\n", tname.cstr()));
+ return ret;
}
netlist_core_terminal_t *netlist_setup_t::find_terminal(const pstring &terminal_in, netlist_object_t::type_t atype, bool required)
@@ -322,15 +322,15 @@ netlist_core_terminal_t *netlist_setup_t::find_terminal(const pstring &terminal_
}
if (ret == NULL && required)
netlist().xfatalerror("terminal %s(%s) not found!\n", terminal_in.cstr(), tname.cstr());
- if (ret != NULL && ret->type() != atype)
- {
- if (required)
- netlist().xfatalerror("object %s(%s) found but wrong type\n", terminal_in.cstr(), tname.cstr());
- else
- ret = NULL;
- }
- if (ret != NULL)
- NL_VERBOSE_OUT(("Found input %s\n", tname.cstr()));
+ if (ret != NULL && ret->type() != atype)
+ {
+ if (required)
+ netlist().xfatalerror("object %s(%s) found but wrong type\n", terminal_in.cstr(), tname.cstr());
+ else
+ ret = NULL;
+ }
+ if (ret != NULL)
+ NL_VERBOSE_OUT(("Found input %s\n", tname.cstr()));
return ret;
}
@@ -341,269 +341,267 @@ netlist_param_t *netlist_setup_t::find_param(const pstring &param_in, bool requi
ret = m_params.find(outname);
if (ret == NULL && required)
- netlist().xfatalerror("parameter %s(%s) not found!\n", param_in.cstr(), outname.cstr());
+ netlist().xfatalerror("parameter %s(%s) not found!\n", param_in.cstr(), outname.cstr());
if (ret != NULL)
- NL_VERBOSE_OUT(("Found parameter %s\n", outname.cstr()));
+ NL_VERBOSE_OUT(("Found parameter %s\n", outname.cstr()));
return ret;
}
void netlist_setup_t::connect_input_output(netlist_input_t &in, netlist_output_t &out)
{
- if (out.isFamily(netlist_terminal_t::ANALOG) && in.isFamily(netlist_terminal_t::LOGIC))
- {
- nld_a_to_d_proxy *proxy = new nld_a_to_d_proxy(in);
- pstring x = pstring::sprintf("proxy_ad_%d", m_proxy_cnt);
- m_proxy_cnt++;
-
- proxy->init(netlist(), x);
- register_dev(proxy, x);
-
- proxy->m_Q.net().register_con(in);
- out.net().register_con(proxy->m_I);
-
- }
- else if (out.isFamily(netlist_terminal_t::LOGIC) && in.isFamily(netlist_terminal_t::ANALOG))
- {
- nld_d_to_a_proxy *proxy = new nld_d_to_a_proxy(out);
- pstring x = pstring::sprintf("proxy_da_%d", m_proxy_cnt);
- m_proxy_cnt++;
-
- proxy->init(netlist(), x);
- register_dev(proxy, x);
-
- proxy->m_Q.net().register_con(in);
- out.net().register_con(proxy->m_I);
- }
- else
- {
- out.net().register_con(in);
- }
+ if (out.isFamily(netlist_terminal_t::ANALOG) && in.isFamily(netlist_terminal_t::LOGIC))
+ {
+ nld_a_to_d_proxy *proxy = new nld_a_to_d_proxy(in);
+ pstring x = pstring::sprintf("proxy_ad_%d", m_proxy_cnt);
+ m_proxy_cnt++;
+
+ proxy->init(netlist(), x);
+ register_dev(proxy, x);
+
+ proxy->m_Q.net().register_con(in);
+ out.net().register_con(proxy->m_I);
+
+ }
+ else if (out.isFamily(netlist_terminal_t::LOGIC) && in.isFamily(netlist_terminal_t::ANALOG))
+ {
+ nld_d_to_a_proxy *proxy = new nld_d_to_a_proxy(out);
+ pstring x = pstring::sprintf("proxy_da_%d", m_proxy_cnt);
+ m_proxy_cnt++;
+
+ proxy->init(netlist(), x);
+ register_dev(proxy, x);
+
+ proxy->m_Q.net().register_con(in);
+ out.net().register_con(proxy->m_I);
+ }
+ else
+ {
+ out.net().register_con(in);
+ }
}
void netlist_setup_t::connect_terminal_input(netlist_terminal_t &term, netlist_input_t &inp)
{
- if (inp.isFamily(netlist_terminal_t::ANALOG))
- {
- connect_terminals(inp, term);
- }
- else if (inp.isFamily(netlist_terminal_t::LOGIC))
- {
- NL_VERBOSE_OUT(("connect_terminal_input: connecting proxy\n"));
- nld_a_to_d_proxy *proxy = new nld_a_to_d_proxy(inp);
- pstring x = pstring::sprintf("proxy_da_%d", m_proxy_cnt);
- m_proxy_cnt++;
-
- proxy->init(netlist(), x);
- register_dev(proxy, x);
-
- connect_terminals(term, proxy->m_I);
-
- if (inp.has_net())
- //fatalerror("logic inputs can only belong to one net!\n");
- proxy->m_Q.net().merge_net(&inp.net());
- else
- proxy->m_Q.net().register_con(inp);
- }
- else
- {
- netlist().xfatalerror("Netlist: Severe Error");
- }
+ if (inp.isFamily(netlist_terminal_t::ANALOG))
+ {
+ connect_terminals(inp, term);
+ }
+ else if (inp.isFamily(netlist_terminal_t::LOGIC))
+ {
+ NL_VERBOSE_OUT(("connect_terminal_input: connecting proxy\n"));
+ nld_a_to_d_proxy *proxy = new nld_a_to_d_proxy(inp);
+ pstring x = pstring::sprintf("proxy_da_%d", m_proxy_cnt);
+ m_proxy_cnt++;
+
+ proxy->init(netlist(), x);
+ register_dev(proxy, x);
+
+ connect_terminals(term, proxy->m_I);
+
+ if (inp.has_net())
+ //fatalerror("logic inputs can only belong to one net!\n");
+ proxy->m_Q.net().merge_net(&inp.net());
+ else
+ proxy->m_Q.net().register_con(inp);
+ }
+ else
+ {
+ netlist().xfatalerror("Netlist: Severe Error");
+ }
}
// FIXME: optimize code ...
void netlist_setup_t::connect_terminal_output(netlist_terminal_t &in, netlist_output_t &out)
{
- if (out.isFamily(netlist_terminal_t::ANALOG))
- {
- /* no proxy needed, just merge existing terminal net */
- if (in.has_net())
- out.net().merge_net(&in.net());
- else
- out.net().register_con(in);
-
- }
- else if (out.isFamily(netlist_terminal_t::LOGIC))
- {
- NL_VERBOSE_OUT(("connect_terminal_output: connecting proxy\n"));
- nld_d_to_a_proxy *proxy = new nld_d_to_a_proxy(out);
- pstring x = pstring::sprintf("proxy_da_%d", m_proxy_cnt);
- m_proxy_cnt++;
-
- proxy->init(netlist(), x);
- register_dev(proxy, x);
-
- out.net().register_con(proxy->m_I);
-
- if (in.has_net())
- proxy->m_Q.net().merge_net(&in.net());
- else
- proxy->m_Q.net().register_con(in);
- }
- else
- {
- netlist().xfatalerror("Netlist: Severe Error");
- }
+ if (out.isFamily(netlist_terminal_t::ANALOG))
+ {
+ /* no proxy needed, just merge existing terminal net */
+ if (in.has_net())
+ out.net().merge_net(&in.net());
+ else
+ out.net().register_con(in);
+
+ }
+ else if (out.isFamily(netlist_terminal_t::LOGIC))
+ {
+ NL_VERBOSE_OUT(("connect_terminal_output: connecting proxy\n"));
+ nld_d_to_a_proxy *proxy = new nld_d_to_a_proxy(out);
+ pstring x = pstring::sprintf("proxy_da_%d", m_proxy_cnt);
+ m_proxy_cnt++;
+
+ proxy->init(netlist(), x);
+ register_dev(proxy, x);
+
+ out.net().register_con(proxy->m_I);
+
+ if (in.has_net())
+ proxy->m_Q.net().merge_net(&in.net());
+ else
+ proxy->m_Q.net().register_con(in);
+ }
+ else
+ {
+ netlist().xfatalerror("Netlist: Severe Error");
+ }
}
void netlist_setup_t::connect_terminals(netlist_core_terminal_t &t1, netlist_core_terminal_t &t2)
{
- //assert(in.isType(netlist_terminal_t::TERMINAL));
- //assert(out.isType(netlist_terminal_t::TERMINAL));
-
- if (t1.has_net() && t2.has_net())
- {
- NL_VERBOSE_OUT(("T2 and T1 have net\n"));
- t1.net().merge_net(&t2.net());
- }
- else if (t2.has_net())
- {
- NL_VERBOSE_OUT(("T2 has net\n"));
- t2.net().register_con(t1);
- }
- else if (t1.has_net())
- {
- NL_VERBOSE_OUT(("T1 has net\n"));
- t1.net().register_con(t2);
- }
- else
- {
- NL_VERBOSE_OUT(("adding net ...\n"));
- netlist_net_t *anet = new netlist_net_t(netlist_object_t::NET, netlist_object_t::ANALOG);
- t1.set_net(*anet);
- //m_netlist.solver()->m_nets.add(anet);
- // FIXME: Nets should have a unique name
- t1.net().init_object(netlist(),"net." + t1.name() );
- t1.net().register_con(t2);
- t1.net().register_con(t1);
- }
+ //assert(in.isType(netlist_terminal_t::TERMINAL));
+ //assert(out.isType(netlist_terminal_t::TERMINAL));
+
+ if (t1.has_net() && t2.has_net())
+ {
+ NL_VERBOSE_OUT(("T2 and T1 have net\n"));
+ t1.net().merge_net(&t2.net());
+ }
+ else if (t2.has_net())
+ {
+ NL_VERBOSE_OUT(("T2 has net\n"));
+ t2.net().register_con(t1);
+ }
+ else if (t1.has_net())
+ {
+ NL_VERBOSE_OUT(("T1 has net\n"));
+ t1.net().register_con(t2);
+ }
+ else
+ {
+ NL_VERBOSE_OUT(("adding net ...\n"));
+ netlist_net_t *anet = new netlist_net_t(netlist_object_t::NET, netlist_object_t::ANALOG);
+ t1.set_net(*anet);
+ //m_netlist.solver()->m_nets.add(anet);
+ // FIXME: Nets should have a unique name
+ t1.net().init_object(netlist(),"net." + t1.name() );
+ t1.net().register_con(t2);
+ t1.net().register_con(t1);
+ }
}
void netlist_setup_t::connect(netlist_core_terminal_t &t1, netlist_core_terminal_t &t2)
{
- NL_VERBOSE_OUT(("Connecting %s to %s\n", t1.name().cstr(), t2.name().cstr()));
- // FIXME: amend device design so that warnings can be turned into errors
- // Only variable inputs have this issue
- if (t1.isType(netlist_core_terminal_t::OUTPUT) && t2.isType(netlist_core_terminal_t::INPUT))
- {
- if (t2.has_net())
- NL_VERBOSE_OUT(("Input %s already connected\n", t2.name().cstr()));
- connect_input_output(dynamic_cast<netlist_input_t &>(t2), dynamic_cast<netlist_output_t &>(t1));
- }
- else if (t1.isType(netlist_core_terminal_t::INPUT) && t2.isType(netlist_core_terminal_t::OUTPUT))
- {
- if (t1.has_net())
- NL_VERBOSE_OUT(("Input %s already connected\n", t1.name().cstr()));
- connect_input_output(dynamic_cast<netlist_input_t &>(t1), dynamic_cast<netlist_output_t &>(t2));
- }
- else if (t1.isType(netlist_core_terminal_t::OUTPUT) && t2.isType(netlist_core_terminal_t::TERMINAL))
- {
- connect_terminal_output(dynamic_cast<netlist_terminal_t &>(t2), dynamic_cast<netlist_output_t &>(t1));
- }
- else if (t1.isType(netlist_core_terminal_t::TERMINAL) && t2.isType(netlist_core_terminal_t::OUTPUT))
- {
- connect_terminal_output(dynamic_cast<netlist_terminal_t &>(t1), dynamic_cast<netlist_output_t &>(t2));
- }
- else if (t1.isType(netlist_core_terminal_t::INPUT) && t2.isType(netlist_core_terminal_t::TERMINAL))
- {
- connect_terminal_input(dynamic_cast<netlist_terminal_t &>(t2), dynamic_cast<netlist_input_t &>(t1));
- }
- else if (t1.isType(netlist_core_terminal_t::TERMINAL) && t2.isType(netlist_core_terminal_t::INPUT))
- {
- connect_terminal_input(dynamic_cast<netlist_terminal_t &>(t1), dynamic_cast<netlist_input_t &>(t2));
- }
- else if (t1.isType(netlist_core_terminal_t::TERMINAL) && t2.isType(netlist_core_terminal_t::TERMINAL))
- {
- connect_terminals(dynamic_cast<netlist_terminal_t &>(t1), dynamic_cast<netlist_terminal_t &>(t2));
- }
- else
- netlist().xfatalerror("Connecting %s to %s not supported!\n", t1.name().cstr(), t2.name().cstr());
+ NL_VERBOSE_OUT(("Connecting %s to %s\n", t1.name().cstr(), t2.name().cstr()));
+ // FIXME: amend device design so that warnings can be turned into errors
+ // Only variable inputs have this issue
+ if (t1.isType(netlist_core_terminal_t::OUTPUT) && t2.isType(netlist_core_terminal_t::INPUT))
+ {
+ if (t2.has_net())
+ NL_VERBOSE_OUT(("Input %s already connected\n", t2.name().cstr()));
+ connect_input_output(dynamic_cast<netlist_input_t &>(t2), dynamic_cast<netlist_output_t &>(t1));
+ }
+ else if (t1.isType(netlist_core_terminal_t::INPUT) && t2.isType(netlist_core_terminal_t::OUTPUT))
+ {
+ if (t1.has_net())
+ NL_VERBOSE_OUT(("Input %s already connected\n", t1.name().cstr()));
+ connect_input_output(dynamic_cast<netlist_input_t &>(t1), dynamic_cast<netlist_output_t &>(t2));
+ }
+ else if (t1.isType(netlist_core_terminal_t::OUTPUT) && t2.isType(netlist_core_terminal_t::TERMINAL))
+ {
+ connect_terminal_output(dynamic_cast<netlist_terminal_t &>(t2), dynamic_cast<netlist_output_t &>(t1));
+ }
+ else if (t1.isType(netlist_core_terminal_t::TERMINAL) && t2.isType(netlist_core_terminal_t::OUTPUT))
+ {
+ connect_terminal_output(dynamic_cast<netlist_terminal_t &>(t1), dynamic_cast<netlist_output_t &>(t2));
+ }
+ else if (t1.isType(netlist_core_terminal_t::INPUT) && t2.isType(netlist_core_terminal_t::TERMINAL))
+ {
+ connect_terminal_input(dynamic_cast<netlist_terminal_t &>(t2), dynamic_cast<netlist_input_t &>(t1));
+ }
+ else if (t1.isType(netlist_core_terminal_t::TERMINAL) && t2.isType(netlist_core_terminal_t::INPUT))
+ {
+ connect_terminal_input(dynamic_cast<netlist_terminal_t &>(t1), dynamic_cast<netlist_input_t &>(t2));
+ }
+ else if (t1.isType(netlist_core_terminal_t::TERMINAL) && t2.isType(netlist_core_terminal_t::TERMINAL))
+ {
+ connect_terminals(dynamic_cast<netlist_terminal_t &>(t1), dynamic_cast<netlist_terminal_t &>(t2));
+ }
+ else
+ netlist().xfatalerror("Connecting %s to %s not supported!\n", t1.name().cstr(), t2.name().cstr());
}
void netlist_setup_t::resolve_inputs()
{
+ NL_VERBOSE_OUT(("Resolving ...\n"));
+ for (tagmap_link_t::entry_t *entry = m_links.first(); entry != NULL; entry = m_links.next(entry))
+ {
+ const pstring t1s = entry->object().e1;
+ const pstring t2s = entry->object().e2;
+ netlist_core_terminal_t *t1 = find_terminal(t1s);
+ netlist_core_terminal_t *t2 = find_terminal(t2s);
+
+ connect(*t1, *t2);
+ }
- NL_VERBOSE_OUT(("Resolving ...\n"));
- for (tagmap_link_t::entry_t *entry = m_links.first(); entry != NULL; entry = m_links.next(entry))
- {
- const pstring t1s = entry->object().e1;
- const pstring t2s = entry->object().e2;
- netlist_core_terminal_t *t1 = find_terminal(t1s);
- netlist_core_terminal_t *t2 = find_terminal(t2s);
-
- connect(*t1, *t2);
- }
-
- /* print all outputs */
- for (tagmap_terminal_t::entry_t *entry = m_terminals.first(); entry != NULL; entry = m_terminals.next(entry))
- {
- 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()));
- }
+ /* print all outputs */
+ for (tagmap_terminal_t::entry_t *entry = m_terminals.first(); entry != NULL; entry = m_terminals.next(entry))
+ {
+ 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()));
+ }
#if 0
- NL_VERBOSE_OUT(("deleting empty nets ...\n"));
-
- // delete empty nets ...
- for (netlist_net_t::list_t::entry_t *pn = netlist().m_nets.first(); pn != NULL; pn = netlist().m_nets.next(pn))
- {
- if (pn->object()->m_head == NULL)
- {
- NL_VERBOSE_OUT(("Deleting net ...\n"));
- netlist_net_t *to_delete = pn->object();
- netlist().m_nets.remove(to_delete);
- if (!to_delete->isRailNet())
- delete to_delete;
- pn--;
- }
- }
+ NL_VERBOSE_OUT(("deleting empty nets ...\n"));
+
+ // delete empty nets ...
+ for (netlist_net_t::list_t::entry_t *pn = netlist().m_nets.first(); pn != NULL; pn = netlist().m_nets.next(pn))
+ {
+ if (pn->object()->m_head == NULL)
+ {
+ NL_VERBOSE_OUT(("Deleting net ...\n"));
+ netlist_net_t *to_delete = pn->object();
+ netlist().m_nets.remove(to_delete);
+ if (!to_delete->isRailNet())
+ delete to_delete;
+ pn--;
+ }
+ }
#endif
- if (m_netlist.solver() != NULL)
- m_netlist.solver()->post_start();
+ if (m_netlist.solver() != NULL)
+ m_netlist.solver()->post_start();
}
void netlist_setup_t::start_devices()
{
+ if (getenv("NL_LOGS"))
+ {
+ NL_VERBOSE_OUT(("Creating dynamic logs ...\n"));
+ nl_util::pstring_list ll = nl_util::split(getenv("NL_LOGS"), ":");
+ for (int i=0; i < ll.count(); i++)
+ {
+ NL_VERBOSE_OUT(("%d: <%s>\n",i, ll[i].cstr()));
+ netlist_device_t *nc = factory().new_device_by_classname("nld_log", *this);
+ pstring name = "log_" + ll[i];
+ register_dev(nc, name);
+ register_link(name + ".I", ll[i]);
+ }
+ }
+
+
+ NL_VERBOSE_OUT(("Searching for mainclock and solver ...\n"));
+ /* find the main clock ... */
+ for (tagmap_devices_t::entry_t *entry = netlist().m_devices.first(); entry != NULL; entry = netlist().m_devices.next(entry))
+ {
+ netlist_device_t *dev = entry->object();
+ if (dynamic_cast<NETLIB_NAME(mainclock)*>(dev) != NULL)
+ {
+ m_netlist.set_mainclock_dev(dynamic_cast<NETLIB_NAME(mainclock)*>(dev));
+ }
+ if (dynamic_cast<NETLIB_NAME(solver)*>(dev) != NULL)
+ {
+ m_netlist.set_solver_dev(dynamic_cast<NETLIB_NAME(solver)*>(dev));
+ }
+ }
- if (getenv("NL_LOGS"))
- {
- NL_VERBOSE_OUT(("Creating dynamic logs ...\n"));
- nl_util::pstring_list ll = nl_util::split(getenv("NL_LOGS"), ":");
- for (int i=0; i < ll.count(); i++)
- {
- NL_VERBOSE_OUT(("%d: <%s>\n",i, ll[i].cstr()));
- netlist_device_t *nc = factory().new_device_by_classname("nld_log", *this);
- pstring name = "log_" + ll[i];
- register_dev(nc, name);
- register_link(name + ".I", ll[i]);
- }
- }
-
-
- NL_VERBOSE_OUT(("Searching for mainclock and solver ...\n"));
- /* find the main clock ... */
- for (tagmap_devices_t::entry_t *entry = netlist().m_devices.first(); entry != NULL; entry = netlist().m_devices.next(entry))
- {
- netlist_device_t *dev = entry->object();
- if (dynamic_cast<NETLIB_NAME(mainclock)*>(dev) != NULL)
- {
- m_netlist.set_mainclock_dev(dynamic_cast<NETLIB_NAME(mainclock)*>(dev));
- }
- if (dynamic_cast<NETLIB_NAME(solver)*>(dev) != NULL)
- {
- m_netlist.set_solver_dev(dynamic_cast<NETLIB_NAME(solver)*>(dev));
- }
- }
-
- NL_VERBOSE_OUT(("Initializing devices ...\n"));
- for (tagmap_devices_t::entry_t *entry = netlist().m_devices.first(); entry != NULL; entry = netlist().m_devices.next(entry))
- {
- netlist_device_t *dev = entry->object();
- dev->init(netlist(), entry->tag().cstr());
- }
+ NL_VERBOSE_OUT(("Initializing devices ...\n"));
+ for (tagmap_devices_t::entry_t *entry = netlist().m_devices.first(); entry != NULL; entry = netlist().m_devices.next(entry))
+ {
+ netlist_device_t *dev = entry->object();
+ dev->init(netlist(), entry->tag().cstr());
+ }
}
diff --git a/src/emu/netlist/nl_setup.h b/src/emu/netlist/nl_setup.h
index 627a539dce7..13d456b76e2 100644
--- a/src/emu/netlist/nl_setup.h
+++ b/src/emu/netlist/nl_setup.h
@@ -19,7 +19,7 @@
#define NET_STR(_x) # _x
#define NET_MODEL(_model) \
- netlist.register_model(_model);
+ netlist.register_model(_model);
#define NET_ALIAS(_alias, _name) \
netlist.register_alias(# _alias, # _name);
@@ -39,13 +39,13 @@
netlist.register_link(# _name "." # _input, # _output);
#define NET_C(_input, _output) \
- netlist.register_link(NET_STR(_input) , NET_STR(_output));
+ netlist.register_link(NET_STR(_input) , NET_STR(_output));
#define NETDEV_PARAM(_name, _val) \
netlist.register_param(# _name, _val);
#define NETDEV_PARAMI(_name, _param, _val) \
- netlist.register_param(# _name "." # _param, _val);
+ netlist.register_param(# _name "." # _param, _val);
#define NETLIST_NAME(_name) netlist ## _ ## _name
@@ -69,30 +69,30 @@ ATTR_COLD void NETLIST_NAME(_name)(netlist_setup_t &netlist) \
class netlist_setup_t
{
- NETLIST_PREVENT_COPYING(netlist_setup_t)
+ NETLIST_PREVENT_COPYING(netlist_setup_t)
public:
- struct link_t
- {
- link_t() { }
- // Copy constructor
- link_t(const link_t &from)
- {
- e1 = from.e1;
- e2 = from.e2;
- }
-
- link_t(const pstring &ae1, const pstring &ae2)
- {
- e1 = ae1;
- e2 = ae2;
- }
- pstring e1;
- pstring e2;
-
- bool operator==(const link_t &rhs) const { return (e1 == rhs.e1) && (e2 == rhs.e2); }
- link_t &operator=(const link_t &rhs) { e1 = rhs.e1; e2 = rhs.e2; return *this; }
- };
+ struct link_t
+ {
+ link_t() { }
+ // Copy constructor
+ link_t(const link_t &from)
+ {
+ e1 = from.e1;
+ e2 = from.e2;
+ }
+
+ link_t(const pstring &ae1, const pstring &ae2)
+ {
+ e1 = ae1;
+ e2 = ae2;
+ }
+ pstring e1;
+ pstring e2;
+
+ bool operator==(const link_t &rhs) const { return (e1 == rhs.e1) && (e2 == rhs.e2); }
+ link_t &operator=(const link_t &rhs) { e1 = rhs.e1; e2 = rhs.e2; return *this; }
+ };
typedef tagmap_t<pstring, 393> tagmap_nstring_t;
typedef tagmap_t<netlist_param_t *, 393> tagmap_param_t;
@@ -105,29 +105,29 @@ public:
void init();
netlist_base_t &netlist() { return m_netlist; }
- const netlist_base_t &netlist() const { return m_netlist; }
+ const netlist_base_t &netlist() const { return m_netlist; }
netlist_factory &factory() { return m_factory; }
netlist_device_t *register_dev(netlist_device_t *dev, const pstring &name);
void remove_dev(const pstring &name);
- void register_model(const pstring &model);
- void register_alias(const pstring &alias, const pstring &out);
- void register_link(const pstring &sin, const pstring &sout);
- void register_param(const pstring &param, const pstring &value);
- void register_param(const pstring &param, const double value);
+ void register_model(const pstring &model);
+ void register_alias(const pstring &alias, const pstring &out);
+ void register_link(const pstring &sin, const pstring &sout);
+ void register_param(const pstring &param, const pstring &value);
+ void register_param(const pstring &param, const double value);
- void register_object(netlist_device_t &dev, netlist_core_device_t &upd_dev, const pstring &name, netlist_object_t &obj, netlist_input_t::state_e state);
- void connect(netlist_core_terminal_t &t1, netlist_core_terminal_t &t2);
+ void register_object(netlist_device_t &dev, netlist_core_device_t &upd_dev, const pstring &name, netlist_object_t &obj, netlist_input_t::state_e state);
+ void connect(netlist_core_terminal_t &t1, netlist_core_terminal_t &t2);
- netlist_core_terminal_t *find_terminal(const pstring &outname_in, bool required = true);
- netlist_core_terminal_t *find_terminal(const pstring &outname_in, netlist_object_t::type_t atype, bool required = true);
+ netlist_core_terminal_t *find_terminal(const pstring &outname_in, bool required = true);
+ netlist_core_terminal_t *find_terminal(const pstring &outname_in, netlist_object_t::type_t atype, bool required = true);
- netlist_param_t *find_param(const pstring &param_in, bool required = true);
+ netlist_param_t *find_param(const pstring &param_in, bool required = true);
- void parse(const char *buf);
+ void parse(const char *buf);
- void start_devices();
+ void start_devices();
void resolve_inputs();
/* not ideal, but needed for save_state */
@@ -144,21 +144,21 @@ private:
tagmap_nstring_t m_alias;
tagmap_param_t m_params;
tagmap_link_t m_links;
- tagmap_nstring_t m_params_temp;
+ tagmap_nstring_t m_params_temp;
- netlist_factory m_factory;
+ netlist_factory m_factory;
- netlist_list_t<pstring> m_models;
+ netlist_list_t<pstring> m_models;
int m_proxy_cnt;
void connect_terminals(netlist_core_terminal_t &in, netlist_core_terminal_t &out);
void connect_input_output(netlist_input_t &in, netlist_output_t &out);
- void connect_terminal_output(netlist_terminal_t &in, netlist_output_t &out);
- void connect_terminal_input(netlist_terminal_t &term, netlist_input_t &inp);
+ void connect_terminal_output(netlist_terminal_t &in, netlist_output_t &out);
+ void connect_terminal_input(netlist_terminal_t &term, netlist_input_t &inp);
- // helpers
- pstring objtype_as_astr(netlist_object_t &in);
+ // helpers
+ pstring objtype_as_astr(netlist_object_t &in);
const pstring resolve_alias(const pstring &name) const;
};
diff --git a/src/emu/netlist/nl_time.h b/src/emu/netlist/nl_time.h
index bfdeda38c32..33729fb38d9 100644
--- a/src/emu/netlist/nl_time.h
+++ b/src/emu/netlist/nl_time.h
@@ -26,87 +26,87 @@ struct netlist_time
{
public:
- typedef UINT64 INTERNALTYPE;
+ typedef UINT64 INTERNALTYPE;
- static const INTERNALTYPE RESOLUTION = NETLIST_INTERNAL_RES;
+ static const INTERNALTYPE RESOLUTION = NETLIST_INTERNAL_RES;
- ATTR_HOT inline netlist_time() : m_time(0) {}
+ ATTR_HOT inline netlist_time() : m_time(0) {}
- ATTR_HOT friend inline const netlist_time operator-(const netlist_time &left, const netlist_time &right);
- ATTR_HOT friend inline const netlist_time operator+(const netlist_time &left, const netlist_time &right);
- ATTR_HOT friend inline const netlist_time operator*(const netlist_time &left, const UINT32 factor);
- ATTR_HOT friend inline const UINT32 operator/(const netlist_time &left, const netlist_time &right);
- ATTR_HOT friend inline bool operator>(const netlist_time &left, const netlist_time &right);
- ATTR_HOT friend inline bool operator<(const netlist_time &left, const netlist_time &right);
- ATTR_HOT friend inline bool operator>=(const netlist_time &left, const netlist_time &right);
- ATTR_HOT friend inline bool operator<=(const netlist_time &left, const netlist_time &right);
+ ATTR_HOT friend inline const netlist_time operator-(const netlist_time &left, const netlist_time &right);
+ ATTR_HOT friend inline const netlist_time operator+(const netlist_time &left, const netlist_time &right);
+ ATTR_HOT friend inline const netlist_time operator*(const netlist_time &left, const UINT32 factor);
+ ATTR_HOT friend inline const UINT32 operator/(const netlist_time &left, const netlist_time &right);
+ ATTR_HOT friend inline bool operator>(const netlist_time &left, const netlist_time &right);
+ ATTR_HOT friend inline bool operator<(const netlist_time &left, const netlist_time &right);
+ ATTR_HOT friend inline bool operator>=(const netlist_time &left, const netlist_time &right);
+ ATTR_HOT friend inline bool operator<=(const netlist_time &left, const netlist_time &right);
- ATTR_HOT inline const netlist_time &operator=(const netlist_time &right) { m_time = right.m_time; return *this; }
- ATTR_HOT inline const netlist_time &operator=(const double &right) { m_time = (INTERNALTYPE) ( right * (double) RESOLUTION); return *this; }
- ATTR_HOT inline operator double() const { return as_double(); }
+ ATTR_HOT inline const netlist_time &operator=(const netlist_time &right) { m_time = right.m_time; return *this; }
+ ATTR_HOT inline const netlist_time &operator=(const double &right) { m_time = (INTERNALTYPE) ( right * (double) RESOLUTION); return *this; }
+ ATTR_HOT inline operator double() const { return as_double(); }
- ATTR_HOT inline const netlist_time &operator+=(const netlist_time &right) { m_time += right.m_time; return *this; }
+ ATTR_HOT inline const netlist_time &operator+=(const netlist_time &right) { m_time += right.m_time; return *this; }
- ATTR_HOT inline const INTERNALTYPE as_raw() const { return m_time; }
- ATTR_HOT inline const double as_double() const { return (double) m_time / (double) RESOLUTION; }
+ ATTR_HOT inline const INTERNALTYPE as_raw() const { return m_time; }
+ ATTR_HOT inline const double as_double() const { return (double) m_time / (double) RESOLUTION; }
- // for save states ....
- ATTR_HOT inline INTERNALTYPE *get_internaltype_ptr() { return &m_time; }
+ // for save states ....
+ ATTR_HOT inline INTERNALTYPE *get_internaltype_ptr() { return &m_time; }
- ATTR_HOT static inline const netlist_time from_nsec(const int ns) { return netlist_time((UINT64) ns * (RESOLUTION / U64(1000000000))); }
- ATTR_HOT static inline const netlist_time from_usec(const int us) { return netlist_time((UINT64) us * (RESOLUTION / U64(1000000))); }
- ATTR_HOT static inline const netlist_time from_msec(const int ms) { return netlist_time((UINT64) ms * (RESOLUTION / U64(1000))); }
- ATTR_HOT static inline const netlist_time from_hz(const UINT64 hz) { return netlist_time(RESOLUTION / hz); }
- ATTR_HOT static inline const netlist_time from_double(const double t) { return netlist_time((INTERNALTYPE) ( t * (double) RESOLUTION)); }
- ATTR_HOT static inline const netlist_time from_raw(const INTERNALTYPE raw) { return netlist_time(raw); }
+ ATTR_HOT static inline const netlist_time from_nsec(const int ns) { return netlist_time((UINT64) ns * (RESOLUTION / U64(1000000000))); }
+ ATTR_HOT static inline const netlist_time from_usec(const int us) { return netlist_time((UINT64) us * (RESOLUTION / U64(1000000))); }
+ ATTR_HOT static inline const netlist_time from_msec(const int ms) { return netlist_time((UINT64) ms * (RESOLUTION / U64(1000))); }
+ ATTR_HOT static inline const netlist_time from_hz(const UINT64 hz) { return netlist_time(RESOLUTION / hz); }
+ ATTR_HOT static inline const netlist_time from_double(const double t) { return netlist_time((INTERNALTYPE) ( t * (double) RESOLUTION)); }
+ ATTR_HOT static inline const netlist_time from_raw(const INTERNALTYPE raw) { return netlist_time(raw); }
- static const netlist_time zero;
+ static const netlist_time zero;
protected:
- ATTR_HOT inline netlist_time(const INTERNALTYPE val) : m_time(val) {}
+ ATTR_HOT inline netlist_time(const INTERNALTYPE val) : m_time(val) {}
- INTERNALTYPE m_time;
+ INTERNALTYPE m_time;
};
ATTR_HOT inline const netlist_time operator-(const netlist_time &left, const netlist_time &right)
{
- return netlist_time::from_raw(left.m_time - right.m_time);
+ return netlist_time::from_raw(left.m_time - right.m_time);
}
ATTR_HOT inline const netlist_time operator*(const netlist_time &left, const UINT32 factor)
{
- return netlist_time::from_raw(left.m_time * factor);
+ return netlist_time::from_raw(left.m_time * factor);
}
ATTR_HOT inline const UINT32 operator/(const netlist_time &left, const netlist_time &right)
{
- return left.m_time / right.m_time;
+ return left.m_time / right.m_time;
}
ATTR_HOT inline const netlist_time operator+(const netlist_time &left, const netlist_time &right)
{
- return netlist_time::from_raw(left.m_time + right.m_time);
+ return netlist_time::from_raw(left.m_time + right.m_time);
}
ATTR_HOT inline bool operator<(const netlist_time &left, const netlist_time &right)
{
- return (left.m_time < right.m_time);
+ return (left.m_time < right.m_time);
}
ATTR_HOT inline bool operator>(const netlist_time &left, const netlist_time &right)
{
- return (left.m_time > right.m_time);
+ return (left.m_time > right.m_time);
}
ATTR_HOT inline bool operator<=(const netlist_time &left, const netlist_time &right)
{
- return (left.m_time <= right.m_time);
+ return (left.m_time <= right.m_time);
}
ATTR_HOT inline bool operator>=(const netlist_time &left, const netlist_time &right)
{
- return (left.m_time >= right.m_time);
+ return (left.m_time >= right.m_time);
}
diff --git a/src/emu/netlist/nl_util.h b/src/emu/netlist/nl_util.h
index 5016befe098..17c467752a3 100644
--- a/src/emu/netlist/nl_util.h
+++ b/src/emu/netlist/nl_util.h
@@ -13,29 +13,29 @@ class nl_util
{
// this is purely static
private:
- nl_util() {};
+ nl_util() {};
public:
- typedef netlist_list_t<pstring, 10> pstring_list;
-
- static pstring_list split(const pstring &str, const pstring &onstr)
- {
- pstring_list temp;
-
- int p = 0;
- int pn;
-
- pn = str.find(onstr, p);
- while (pn>=0)
- {
- temp.add(str.substr(p, pn - p));
- p = pn + onstr.len();
- pn = str.find(onstr, p);
- }
- if (p<str.len())
- temp.add(str.substr(p));
- return temp;
- }
+ typedef netlist_list_t<pstring, 10> pstring_list;
+
+ static pstring_list split(const pstring &str, const pstring &onstr)
+ {
+ pstring_list temp;
+
+ int p = 0;
+ int pn;
+
+ pn = str.find(onstr, p);
+ while (pn>=0)
+ {
+ temp.add(str.substr(p, pn - p));
+ p = pn + onstr.len();
+ pn = str.find(onstr, p);
+ }
+ if (p<str.len())
+ temp.add(str.substr(p));
+ return temp;
+ }
};
#endif /* NL_UTIL_H_ */
diff --git a/src/emu/netlist/pstate.c b/src/emu/netlist/pstate.c
index 25543afced5..770f2581b77 100644
--- a/src/emu/netlist/pstate.c
+++ b/src/emu/netlist/pstate.c
@@ -7,24 +7,24 @@
ATTR_COLD pstate_manager_t::~pstate_manager_t()
{
- m_save.reset_and_free();
+ m_save.reset_and_free();
}
ATTR_COLD void pstate_manager_t::save_state_ptr(const pstring &stname, const netlist_data_type_e dt, const int size, const int count, void *ptr)
{
- pstring fullname = stname;
- ATTR_UNUSED pstring ts[] = {
- "NOT_SUPPORTED",
- "DT_DOUBLE",
- "DT_INT64",
- "DT_INT8",
- "DT_INT",
- "DT_BOOLEAN"
- };
+ pstring fullname = stname;
+ ATTR_UNUSED pstring ts[] = {
+ "NOT_SUPPORTED",
+ "DT_DOUBLE",
+ "DT_INT64",
+ "DT_INT8",
+ "DT_INT",
+ "DT_BOOLEAN"
+ };
- NL_VERBOSE_OUT(("SAVE: <%s> %s(%d) %p\n", fullname.cstr(), ts[dt].cstr(), size, ptr));
- pstate_entry_t *p = new pstate_entry_t(stname, dt, size, count, ptr);
- m_save.add(p);
+ NL_VERBOSE_OUT(("SAVE: <%s> %s(%d) %p\n", fullname.cstr(), ts[dt].cstr(), size, ptr));
+ pstate_entry_t *p = new pstate_entry_t(stname, dt, size, count, ptr);
+ m_save.add(p);
}
diff --git a/src/emu/netlist/pstate.h b/src/emu/netlist/pstate.h
index e5432f523b2..3c0b1eeaeb6 100644
--- a/src/emu/netlist/pstate.h
+++ b/src/emu/netlist/pstate.h
@@ -16,18 +16,18 @@
// ----------------------------------------------------------------------------------------
#define PSTATE_INTERFACE(manager, module) \
- template<class C> ATTR_COLD void save(C &state, const pstring &stname) \
- { \
- dynamic_cast<pstate_manager_t &>(manager).save_manager(state, module + "." + stname); \
- }
+ template<class C> ATTR_COLD void save(C &state, const pstring &stname) \
+ { \
+ dynamic_cast<pstate_manager_t &>(manager).save_manager(state, module + "." + stname); \
+ }
enum netlist_data_type_e {
- NOT_SUPPORTED,
- DT_DOUBLE,
- DT_INT64,
- DT_INT8,
- DT_INT,
- DT_BOOLEAN
+ NOT_SUPPORTED,
+ DT_DOUBLE,
+ DT_INT64,
+ DT_INT8,
+ DT_INT,
+ DT_BOOLEAN
};
template<typename _ItemType> struct nl_datatype { static const netlist_data_type_e type = netlist_data_type_e(NOT_SUPPORTED); };
@@ -46,50 +46,50 @@ NETLIST_SAVE_TYPE(INT32, DT_INT);
struct pstate_entry_t
{
- typedef netlist_list_t<pstate_entry_t *> list_t;
-
- pstate_entry_t(const pstring &stname, const netlist_data_type_e dt, const int size, const int count, void *ptr) :
- m_name(stname), m_dt(dt), m_size(size), m_count(count), m_ptr(ptr) { }
- pstring m_name;
- netlist_data_type_e m_dt;
- int m_size;
- int m_count;
- void *m_ptr;
+ typedef netlist_list_t<pstate_entry_t *> list_t;
+
+ pstate_entry_t(const pstring &stname, const netlist_data_type_e dt, const int size, const int count, void *ptr) :
+ m_name(stname), m_dt(dt), m_size(size), m_count(count), m_ptr(ptr) { }
+ pstring m_name;
+ netlist_data_type_e m_dt;
+ int m_size;
+ int m_count;
+ void *m_ptr;
};
class pstate_manager_t
{
public:
- ATTR_COLD ~pstate_manager_t();
+ ATTR_COLD ~pstate_manager_t();
- template<class C> ATTR_COLD void save_manager(C &state, const pstring &stname)
- {
- save_state_ptr(stname, nl_datatype<C>::type, sizeof(C), 1, &state);
- }
+ template<class C> ATTR_COLD void save_manager(C &state, const pstring &stname)
+ {
+ save_state_ptr(stname, nl_datatype<C>::type, sizeof(C), 1, &state);
+ }
- template<class C> ATTR_COLD void save_manager(C *state, const pstring &stname, const int count)
- {
- save_state_ptr(stname, nl_datatype<C>::type, sizeof(C), count, state);
- }
+ template<class C> ATTR_COLD void save_manager(C *state, const pstring &stname, const int count)
+ {
+ save_state_ptr(stname, nl_datatype<C>::type, sizeof(C), count, state);
+ }
- template<class C, std::size_t N> ATTR_COLD void save_manager(C (&state)[N], const pstring &stname)
- {
- save_state_ptr(stname, nl_datatype<C>::type, sizeof(C), N, &(state[0]));
- }
+ template<class C, std::size_t N> ATTR_COLD void save_manager(C (&state)[N], const pstring &stname)
+ {
+ save_state_ptr(stname, nl_datatype<C>::type, sizeof(C), N, &(state[0]));
+ }
- inline const pstate_entry_t::list_t &save_list() const { return m_save; }
+ inline const pstate_entry_t::list_t &save_list() const { return m_save; }
protected:
- ATTR_COLD void save_state_ptr(const pstring &stname, const netlist_data_type_e, const int size, const int count, void *ptr);
+ ATTR_COLD void save_state_ptr(const pstring &stname, const netlist_data_type_e, const int size, const int count, void *ptr);
private:
- pstate_entry_t::list_t m_save;
+ pstate_entry_t::list_t m_save;
};
template<> ATTR_COLD inline void pstate_manager_t::save_manager(netlist_time &nlt, const pstring &stname)
{
- save_state_ptr(stname, DT_INT64, sizeof(netlist_time::INTERNALTYPE), 1, nlt.get_internaltype_ptr());
+ save_state_ptr(stname, DT_INT64, sizeof(netlist_time::INTERNALTYPE), 1, nlt.get_internaltype_ptr());
}
diff --git a/src/emu/netlist/pstring.c b/src/emu/netlist/pstring.c
index 7d5a55ff166..6287fac8109 100644
--- a/src/emu/netlist/pstring.c
+++ b/src/emu/netlist/pstring.c
@@ -24,68 +24,68 @@ pstring::str_t *pstring::m_zero = NULL;
//#define DEBUG_MODE (0)
#ifdef MAME_DEBUG
- #ifndef IMMEDIATE_MODE
- #define IMMEDIATE_MODE (0)
- #endif
- #ifndef DEBUG_MODE
- #define DEBUG_MODE (1)
- #endif
+ #ifndef IMMEDIATE_MODE
+ #define IMMEDIATE_MODE (0)
+ #endif
+ #ifndef DEBUG_MODE
+ #define DEBUG_MODE (1)
+ #endif
#else
- #ifndef IMMEDIATE_MODE
- #define IMMEDIATE_MODE (1)
- #endif
- #ifndef DEBUG_MODE
- #define DEBUG_MODE (0)
- #endif
+ #ifndef IMMEDIATE_MODE
+ #define IMMEDIATE_MODE (1)
+ #endif
+ #ifndef DEBUG_MODE
+ #define DEBUG_MODE (0)
+ #endif
#endif
pstring::~pstring()
{
- sfree(m_ptr);
+ sfree(m_ptr);
}
void pstring::pcat(const char *s)
{
- int slen = strlen(s);
- str_t *n = salloc(m_ptr->len() + slen);
- if (m_ptr->len() > 0)
- memcpy(n->str(), m_ptr->str(), m_ptr->len());
- if (slen > 0)
- memcpy(n->str() + m_ptr->len(), s, slen);
- *(n->str() + n->len()) = 0;
- sfree(m_ptr);
- m_ptr = n;
+ int slen = strlen(s);
+ str_t *n = salloc(m_ptr->len() + slen);
+ if (m_ptr->len() > 0)
+ memcpy(n->str(), m_ptr->str(), m_ptr->len());
+ if (slen > 0)
+ memcpy(n->str() + m_ptr->len(), s, slen);
+ *(n->str() + n->len()) = 0;
+ sfree(m_ptr);
+ m_ptr = n;
}
void pstring::pcopy(const char *from, int size)
{
- str_t *n = salloc(size);
- if (size > 0)
- memcpy(n->str(), from, size);
- *(n->str() + size) = 0;
- sfree(m_ptr);
- m_ptr = n;
+ str_t *n = salloc(size);
+ if (size > 0)
+ memcpy(n->str(), from, size);
+ *(n->str() + size) = 0;
+ sfree(m_ptr);
+ m_ptr = n;
}
pstring pstring::substr(unsigned int start, int count) const
{
- int alen = len();
- if (start >= alen)
- return pstring();
- if (count <0 || start + count > alen)
- count = alen - start;
- pstring ret;
- ret.pcopy(cstr() + start, count);
- return ret;
+ int alen = len();
+ if (start >= alen)
+ return pstring();
+ if (count <0 || start + count > alen)
+ count = alen - start;
+ pstring ret;
+ ret.pcopy(cstr() + start, count);
+ return ret;
}
pstring pstring::ucase() const
{
- pstring ret = *this;
- ret.pcopy(cstr(), len());
- for (int i=0; i<ret.len(); i++)
- ret.m_ptr->m_str[i] = toupper((unsigned) ret.m_ptr->m_str[i]);
- return ret;
+ pstring ret = *this;
+ ret.pcopy(cstr(), len());
+ for (int i=0; i<ret.len(); i++)
+ ret.m_ptr->m_str[i] = toupper((unsigned) ret.m_ptr->m_str[i]);
+ return ret;
}
//-------------------------------------------------
@@ -94,58 +94,58 @@ pstring pstring::ucase() const
int pstring::pcmpi(const char *lhs, const char *rhs, int count) const
{
- // loop while equal until we hit the end of strings
- int index;
- for (index = 0; index < count; index++)
- if (lhs[index] == 0 || tolower(lhs[index]) != tolower(rhs[index]))
- break;
-
- // determine the final result
- if (index < count)
- return tolower(lhs[index]) - tolower(rhs[index]);
- if (lhs[index] == 0)
- return 0;
- return 1;
+ // loop while equal until we hit the end of strings
+ int index;
+ for (index = 0; index < count; index++)
+ if (lhs[index] == 0 || tolower(lhs[index]) != tolower(rhs[index]))
+ break;
+
+ // determine the final result
+ if (index < count)
+ return tolower(lhs[index]) - tolower(rhs[index]);
+ if (lhs[index] == 0)
+ return 0;
+ return 1;
}
double pstring::as_double(bool *error) const
{
- double ret;
- char *e = NULL;
-
- if (error != NULL)
- *error = false;
- ret = strtod(cstr(), &e);
- if (*e != 0)
- if (error != NULL)
- *error = true;
- return ret;
+ double ret;
+ char *e = NULL;
+
+ if (error != NULL)
+ *error = false;
+ ret = strtod(cstr(), &e);
+ if (*e != 0)
+ if (error != NULL)
+ *error = true;
+ return ret;
}
long pstring::as_long(bool *error) const
{
- double ret;
- char *e = NULL;
-
- if (error != NULL)
- *error = false;
- if (startsWith("0x"))
- ret = strtol(&(cstr()[2]), &e, 16);
- else
- ret = strtol(cstr(), &e, 10);
- if (*e != 0)
- if (error != NULL)
- *error = true;
- return ret;
+ double ret;
+ char *e = NULL;
+
+ if (error != NULL)
+ *error = false;
+ if (startsWith("0x"))
+ ret = strtol(&(cstr()[2]), &e, 16);
+ else
+ ret = strtol(cstr(), &e, 10);
+ if (*e != 0)
+ if (error != NULL)
+ *error = true;
+ return ret;
}
pstring pstring::vprintf(va_list args) const
{
- // sprintf into the temporary buffer
- char tempbuf[4096];
- vsprintf(tempbuf, cstr(), args);
+ // sprintf into the temporary buffer
+ char tempbuf[4096];
+ vsprintf(tempbuf, cstr(), args);
- return pstring(tempbuf);
+ return pstring(tempbuf);
}
// ----------------------------------------------------------------------------------------
@@ -154,35 +154,35 @@ pstring pstring::vprintf(va_list args) const
void pstring::sfree(str_t *s)
{
- s->m_ref_count--;
- if (s->m_ref_count == 0)
- m_pool.dealloc(s);
+ s->m_ref_count--;
+ if (s->m_ref_count == 0)
+ m_pool.dealloc(s);
}
pstring::str_t *pstring::salloc(int n)
{
- str_t *ret = new(m_pool, n+1) str_t(n);
- return ret;
+ str_t *ret = new(m_pool, n+1) str_t(n);
+ return ret;
}
pstring pstring::sprintf(const char *format, ...)
{
- va_list ap;
- va_start(ap, format);
- pstring ret = pstring(format).vprintf(ap);
- va_end(ap);
- return ret;
+ va_list ap;
+ va_start(ap, format);
+ pstring ret = pstring(format).vprintf(ap);
+ va_end(ap);
+ return ret;
}
void pstring::resetmem()
{
- // Release the 0 string
- if (m_zero != NULL)
- sfree(m_zero);
- m_zero = NULL;
- m_pool.m_shutdown = true;
- m_pool.resetmem();
+ // Release the 0 string
+ if (m_zero != NULL)
+ sfree(m_zero);
+ m_zero = NULL;
+ m_pool.m_shutdown = true;
+ m_pool.resetmem();
}
// ----------------------------------------------------------------------------------------
@@ -191,10 +191,10 @@ void pstring::resetmem()
pblockpool::pblockpool()
- : m_shutdown(false)
- , m_first(NULL)
- , m_blocksize((DEBUG_MODE) ? 16384 : 16384)
- , m_align(8)
+ : m_shutdown(false)
+ , m_first(NULL)
+ , m_blocksize((DEBUG_MODE) ? 16384 : 16384)
+ , m_align(8)
{
}
@@ -205,105 +205,105 @@ pblockpool::~pblockpool()
void *pblockpool::alloc(const std::size_t n)
{
- if (IMMEDIATE_MODE)
- return (char *) malloc(n);
- else
- {
- int memsize = ((n + m_align - 1) / m_align) * m_align;
- int min_alloc = MAX(m_blocksize, memsize+sizeof(memblock)-MINDATASIZE);
- char *ret = NULL;
- //std::printf("m_first %p\n", m_first);
- for (memblock *p = m_first; p != NULL && ret == NULL; p = p->next)
- {
- if (p->remaining > memsize)
- {
- ret = p->cur;
- p->cur += memsize;
- p->allocated += 1;
- p->remaining -= memsize;
- }
- }
-
- if (ret == NULL)
- {
- // need to allocate a new block
- memblock *p = (memblock *) malloc(min_alloc); //new char[min_alloc];
- p->allocated = 0;
- p->cur = &p->data[0];
- p->size = p->remaining = min_alloc - (sizeof(memblock)-MINDATASIZE);
- p->next = m_first;
- //std::printf("allocated block size %d\n", sizeof(p->data));
-
- ret = p->cur;
- p->cur += memsize;
- p->allocated += 1;
- p->remaining -= memsize;
-
- m_first = p;
- }
-
- return ret;
- }
+ if (IMMEDIATE_MODE)
+ return (char *) malloc(n);
+ else
+ {
+ int memsize = ((n + m_align - 1) / m_align) * m_align;
+ int min_alloc = MAX(m_blocksize, memsize+sizeof(memblock)-MINDATASIZE);
+ char *ret = NULL;
+ //std::printf("m_first %p\n", m_first);
+ for (memblock *p = m_first; p != NULL && ret == NULL; p = p->next)
+ {
+ if (p->remaining > memsize)
+ {
+ ret = p->cur;
+ p->cur += memsize;
+ p->allocated += 1;
+ p->remaining -= memsize;
+ }
+ }
+
+ if (ret == NULL)
+ {
+ // need to allocate a new block
+ memblock *p = (memblock *) malloc(min_alloc); //new char[min_alloc];
+ p->allocated = 0;
+ p->cur = &p->data[0];
+ p->size = p->remaining = min_alloc - (sizeof(memblock)-MINDATASIZE);
+ p->next = m_first;
+ //std::printf("allocated block size %d\n", sizeof(p->data));
+
+ ret = p->cur;
+ p->cur += memsize;
+ p->allocated += 1;
+ p->remaining -= memsize;
+
+ m_first = p;
+ }
+
+ return ret;
+ }
}
void pblockpool::dealloc(void *ptr)
{
- if (IMMEDIATE_MODE)
- free(ptr);
- else
- {
- for (memblock *p = m_first; p != NULL; p = p->next)
- {
- if (ptr >= &p->data[0] && ptr < &p->data[p->size])
- {
- p->allocated -= 1;
- if (p->allocated < 0)
- std::fprintf(stderr, "nstring: memory corruption - crash likely\n");
- if (p->allocated == 0)
- {
- //std::printf("Block entirely freed\n");
- p->remaining = p->size;
- p->cur = &p->data[0];
- }
- // shutting down ?
- if (m_shutdown)
- resetmem(); // try to free blocks
- return;
- }
- }
- std::fprintf(stderr, "nstring: string <%p> not found on free\n", ptr);
- }
+ if (IMMEDIATE_MODE)
+ free(ptr);
+ else
+ {
+ for (memblock *p = m_first; p != NULL; p = p->next)
+ {
+ if (ptr >= &p->data[0] && ptr < &p->data[p->size])
+ {
+ p->allocated -= 1;
+ if (p->allocated < 0)
+ std::fprintf(stderr, "nstring: memory corruption - crash likely\n");
+ if (p->allocated == 0)
+ {
+ //std::printf("Block entirely freed\n");
+ p->remaining = p->size;
+ p->cur = &p->data[0];
+ }
+ // shutting down ?
+ if (m_shutdown)
+ resetmem(); // try to free blocks
+ return;
+ }
+ }
+ std::fprintf(stderr, "nstring: string <%p> not found on free\n", ptr);
+ }
}
void pblockpool::resetmem()
{
- if (!IMMEDIATE_MODE)
- {
- memblock **p = &m_first;
- int totalblocks = 0;
- int freedblocks = 0;
-
- while (*p != NULL)
- {
- totalblocks++;
- memblock **next = &((*p)->next);
- if ((*p)->allocated == 0)
- {
- //std::printf("freeing block %p\n", *p);
- memblock *freeme = *p;
- *p = *next;
- free(freeme); //delete[] *p;
- freedblocks++;
- }
- else
- {
- //if (DEBUG_MODE)
- // std::printf("Allocated: <%s>\n", ((str_t *)(&(*p)->data[0]))->str());
-
- p = next;
- }
- }
- if (DEBUG_MODE)
- std::printf("Freed %d out of total %d blocks\n", freedblocks, totalblocks);
- }
+ if (!IMMEDIATE_MODE)
+ {
+ memblock **p = &m_first;
+ int totalblocks = 0;
+ int freedblocks = 0;
+
+ while (*p != NULL)
+ {
+ totalblocks++;
+ memblock **next = &((*p)->next);
+ if ((*p)->allocated == 0)
+ {
+ //std::printf("freeing block %p\n", *p);
+ memblock *freeme = *p;
+ *p = *next;
+ free(freeme); //delete[] *p;
+ freedblocks++;
+ }
+ else
+ {
+ //if (DEBUG_MODE)
+ // std::printf("Allocated: <%s>\n", ((str_t *)(&(*p)->data[0]))->str());
+
+ p = next;
+ }
+ }
+ if (DEBUG_MODE)
+ std::printf("Freed %d out of total %d blocks\n", freedblocks, totalblocks);
+ }
}
diff --git a/src/emu/netlist/pstring.h b/src/emu/netlist/pstring.h
index 892ade87ef5..f4b1dd5078e 100644
--- a/src/emu/netlist/pstring.h
+++ b/src/emu/netlist/pstring.h
@@ -15,56 +15,56 @@
// ----------------------------------------------------------------------------------------
struct pblockpool {
- NETLIST_PREVENT_COPYING(pblockpool)
+ NETLIST_PREVENT_COPYING(pblockpool)
public:
- static const int MINDATASIZE = 8;
+ static const int MINDATASIZE = 8;
- pblockpool();
- ~pblockpool();
+ pblockpool();
+ ~pblockpool();
- void resetmem();
+ void resetmem();
- void *alloc(std::size_t n);
- void dealloc(void *ptr);
+ void *alloc(std::size_t n);
+ void dealloc(void *ptr);
- template<class T>
- void destroy(T* object)
- {
- object->~T();
- dealloc(object);
- }
- bool m_shutdown;
+ template<class T>
+ void destroy(T* object)
+ {
+ object->~T();
+ dealloc(object);
+ }
+ bool m_shutdown;
private:
- struct memblock
- {
- memblock *next;
- int size;
- int allocated;
- int remaining;
- char *cur;
- char data[MINDATASIZE];
- };
-
- memblock *m_first;
- int m_blocksize;
- int m_align;
+ struct memblock
+ {
+ memblock *next;
+ int size;
+ int allocated;
+ int remaining;
+ char *cur;
+ char data[MINDATASIZE];
+ };
+
+ memblock *m_first;
+ int m_blocksize;
+ int m_align;
};
/* objects must be destroyed using destroy above */
inline void *operator new(std::size_t size, pblockpool &pool, int extra = 0) throw (std::bad_alloc)
{
- void *result = pool.alloc(size + extra);
- //std::printf("allocating %ld + %d\n", size, extra);
- if (result == NULL)
- throw std::bad_alloc();
- return result;
+ void *result = pool.alloc(size + extra);
+ //std::printf("allocating %ld + %d\n", size, extra);
+ if (result == NULL)
+ throw std::bad_alloc();
+ return result;
}
inline void operator delete(void *pMem, pblockpool &pool, int extra)
{
- pool.dealloc(pMem);
+ pool.dealloc(pMem);
}
// ----------------------------------------------------------------------------------------
@@ -77,158 +77,157 @@ inline void operator delete(void *pMem, pblockpool &pool, int extra)
struct pstring
{
public:
- // simple construction/destruction
- pstring()
- {
- init();
- }
- ~pstring();
+ // simple construction/destruction
+ pstring()
+ {
+ init();
+ }
+ ~pstring();
- // construction with copy
- pstring(const char *string) {init(); if (string != NULL && *string != 0) pcopy(string); }
- pstring(const pstring &string) {init(); pcopy(string); }
+ // construction with copy
+ pstring(const char *string) {init(); if (string != NULL && *string != 0) pcopy(string); }
+ pstring(const pstring &string) {init(); pcopy(string); }
- // assignment operators
- pstring &operator=(const char *string) { pcopy(string); return *this; }
- pstring &operator=(const pstring &string) { pcopy(string); return *this; }
+ // assignment operators
+ pstring &operator=(const char *string) { pcopy(string); return *this; }
+ pstring &operator=(const pstring &string) { pcopy(string); return *this; }
- // C string conversion operators and helpers
- operator const char *() const { return m_ptr->str(); }
- inline const char *cstr() const { return m_ptr->str(); }
+ // C string conversion operators and helpers
+ operator const char *() const { return m_ptr->str(); }
+ inline const char *cstr() const { return m_ptr->str(); }
- // concatenation operators
- pstring& operator+=(const pstring &string) { pcat(string.cstr()); return *this; }
- friend pstring operator+(const pstring &lhs, const pstring &rhs) { return pstring(lhs) += rhs; }
- friend pstring operator+(const pstring &lhs, const char *rhs) { return pstring(lhs) += rhs; }
- friend pstring operator+(const char *lhs, const pstring &rhs) { return pstring(lhs) += rhs; }
+ // concatenation operators
+ pstring& operator+=(const pstring &string) { pcat(string.cstr()); return *this; }
+ friend pstring operator+(const pstring &lhs, const pstring &rhs) { return pstring(lhs) += rhs; }
+ friend pstring operator+(const pstring &lhs, const char *rhs) { return pstring(lhs) += rhs; }
+ friend pstring operator+(const char *lhs, const pstring &rhs) { return pstring(lhs) += rhs; }
- // comparison operators
- bool operator==(const char *string) const { return (pcmp(string) == 0); }
- bool operator==(const pstring &string) const { return (pcmp(string.cstr()) == 0); }
- bool operator!=(const char *string) const { return (pcmp(string) != 0); }
- bool operator!=(const pstring &string) const { return (pcmp(string.cstr()) != 0); }
- bool operator<(const char *string) const { return (pcmp(string) < 0); }
- bool operator<(const pstring &string) const { return (pcmp(string.cstr()) < 0); }
- bool operator<=(const char *string) const { return (pcmp(string) <= 0); }
- bool operator<=(const pstring &string) const { return (pcmp(string.cstr()) <= 0); }
- bool operator>(const char *string) const { return (pcmp(string) > 0); }
- bool operator>(const pstring &string) const { return (pcmp(string.cstr()) > 0); }
- bool operator>=(const char *string) const { return (pcmp(string) >= 0); }
- bool operator>=(const pstring &string) const { return (pcmp(string.cstr()) >= 0); }
+ // comparison operators
+ bool operator==(const char *string) const { return (pcmp(string) == 0); }
+ bool operator==(const pstring &string) const { return (pcmp(string.cstr()) == 0); }
+ bool operator!=(const char *string) const { return (pcmp(string) != 0); }
+ bool operator!=(const pstring &string) const { return (pcmp(string.cstr()) != 0); }
+ bool operator<(const char *string) const { return (pcmp(string) < 0); }
+ bool operator<(const pstring &string) const { return (pcmp(string.cstr()) < 0); }
+ bool operator<=(const char *string) const { return (pcmp(string) <= 0); }
+ bool operator<=(const pstring &string) const { return (pcmp(string.cstr()) <= 0); }
+ bool operator>(const char *string) const { return (pcmp(string) > 0); }
+ bool operator>(const pstring &string) const { return (pcmp(string.cstr()) > 0); }
+ bool operator>=(const char *string) const { return (pcmp(string) >= 0); }
+ bool operator>=(const pstring &string) const { return (pcmp(string.cstr()) >= 0); }
- //
- inline int len() const { return m_ptr->len(); }
+ //
+ inline int len() const { return m_ptr->len(); }
- inline bool equals(const pstring &string) { return (pcmp(string.cstr(), m_ptr->str()) == 0); }
- inline bool iequals(const pstring &string) { return (pcmpi(string.cstr(), m_ptr->str()) == 0); }
+ inline bool equals(const pstring &string) { return (pcmp(string.cstr(), m_ptr->str()) == 0); }
+ inline bool iequals(const pstring &string) { return (pcmpi(string.cstr(), m_ptr->str()) == 0); }
- inline int cmp(const pstring &string) const { return pcmp(string.cstr()); }
- inline int cmpi(const pstring &string) const { return pcmpi(cstr(), string.cstr()); }
+ inline int cmp(const pstring &string) const { return pcmp(string.cstr()); }
+ inline int cmpi(const pstring &string) const { return pcmpi(cstr(), string.cstr()); }
- inline int find(const char *search, int start = 0) const
- {
- int alen = len();
- const char *result = strstr(cstr() + MIN(start, alen), search);
- return (result != NULL) ? (result - cstr()) : -1;
- }
+ inline int find(const char *search, int start = 0) const
+ {
+ int alen = len();
+ const char *result = strstr(cstr() + MIN(start, alen), search);
+ return (result != NULL) ? (result - cstr()) : -1;
+ }
- // various
+ // various
- inline bool startsWith(const pstring &arg) const { return (pcmp(cstr(), arg.cstr(), arg.len()) == 0); }
- inline bool startsWith(const char *arg) const { return (pcmp(cstr(), arg, strlen(arg)) == 0); }
+ inline bool startsWith(const pstring &arg) const { return (pcmp(cstr(), arg.cstr(), arg.len()) == 0); }
+ inline bool startsWith(const char *arg) const { return (pcmp(cstr(), arg, strlen(arg)) == 0); }
- // these return nstring ...
- inline pstring cat(const pstring &s) const { return *this + s; }
- inline pstring cat(const char *s) const { return *this + s; }
+ // these return nstring ...
+ inline pstring cat(const pstring &s) const { return *this + s; }
+ inline pstring cat(const char *s) const { return *this + s; }
- pstring substr(unsigned int start, int count = -1) const ;
+ pstring substr(unsigned int start, int count = -1) const ;
- inline pstring left(unsigned int count) const { return substr(0, count); }
- inline pstring right(unsigned int count) const { return substr(len() - count, count); }
+ inline pstring left(unsigned int count) const { return substr(0, count); }
+ inline pstring right(unsigned int count) const { return substr(len() - count, count); }
- pstring ucase() const;
+ pstring ucase() const;
- // conversions
+ // conversions
- double as_double(bool *error = NULL) const;
+ double as_double(bool *error = NULL) const;
- long as_long(bool *error = NULL) const;
+ long as_long(bool *error = NULL) const;
- // printf using string as format ...
+ // printf using string as format ...
- pstring vprintf(va_list args) const;
+ pstring vprintf(va_list args) const;
- // static
- static pstring sprintf(const char *format, ...);
- static void resetmem();
+ // static
+ static pstring sprintf(const char *format, ...);
+ static void resetmem();
protected:
- struct str_t
- {
- str_t(int alen) : m_ref_count(1), m_len(alen) { m_str[0] = 0; }
+ struct str_t
+ {
+ str_t(int alen) : m_ref_count(1), m_len(alen) { m_str[0] = 0; }
- char *str() { return &m_str[0]; }
- int len() { return m_len; }
- //private:
- int m_ref_count;
- int m_len;
- char m_str[1];
- };
+ char *str() { return &m_str[0]; }
+ int len() { return m_len; }
+ //private:
+ int m_ref_count;
+ int m_len;
+ char m_str[1];
+ };
- str_t *m_ptr;
+ str_t *m_ptr;
- static pblockpool m_pool;
+ static pblockpool m_pool;
private:
- inline void init()
- {
- if (m_zero == NULL)
- {
- m_zero = new(pstring::m_pool, 0) pstring::str_t(0);
- }
- m_ptr = m_zero;
- m_ptr->m_ref_count++;
- }
-
- inline int pcmp(const char *right) const
- {
- return pcmp(m_ptr->str(), right);
- }
-
- inline int pcmp(const char *left, const char *right, int count = -1) const
- {
- if (count < 0)
- return strcmp(left, right);
- else
- return strncmp(left, right, count);
- }
-
- int pcmpi(const char *lhs, const char *rhs, int count = -1) const;
-
- void pcopy(const char *from, int size);
-
- inline void pcopy(const char *from)
- {
- pcopy(from, strlen(from));
- }
-
- inline void pcopy(const pstring &from)
- {
- sfree(m_ptr);
- m_ptr = from.m_ptr;
- m_ptr->m_ref_count++;
- }
-
- void pcat(const char *s);
-
- static str_t *salloc(int n);
- static void sfree(str_t *s);
-
- static str_t *m_zero;
+ inline void init()
+ {
+ if (m_zero == NULL)
+ {
+ m_zero = new(pstring::m_pool, 0) pstring::str_t(0);
+ }
+ m_ptr = m_zero;
+ m_ptr->m_ref_count++;
+ }
+
+ inline int pcmp(const char *right) const
+ {
+ return pcmp(m_ptr->str(), right);
+ }
+
+ inline int pcmp(const char *left, const char *right, int count = -1) const
+ {
+ if (count < 0)
+ return strcmp(left, right);
+ else
+ return strncmp(left, right, count);
+ }
+
+ int pcmpi(const char *lhs, const char *rhs, int count = -1) const;
+
+ void pcopy(const char *from, int size);
+
+ inline void pcopy(const char *from)
+ {
+ pcopy(from, strlen(from));
+ }
+
+ inline void pcopy(const pstring &from)
+ {
+ sfree(m_ptr);
+ m_ptr = from.m_ptr;
+ m_ptr->m_ref_count++;
+ }
+
+ void pcat(const char *s);
+
+ static str_t *salloc(int n);
+ static void sfree(str_t *s);
+
+ static str_t *m_zero;
};
#endif /* _PSTRING_H_ */
-