summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Couriersud <couriersud@users.noreply.github.com>2014-02-28 20:33:21 +0000
committer Couriersud <couriersud@users.noreply.github.com>2014-02-28 20:33:21 +0000
commitf31120c7aae2c7f7ac611872bf42d67e72df0009 (patch)
tree819df2d6f438fb9f56c0cbffa260b0bb7e23e2e6
parent2030917315e858e29646ecb92aa99345d0394f15 (diff)
Some minor performance changes. It looks like the code is limited by memory bandwidth.
-rw-r--r--src/emu/machine/netlist.c2
-rw-r--r--src/emu/netlist/devices/nld_7493.c13
-rw-r--r--src/emu/netlist/devices/nld_9316.c19
-rw-r--r--src/emu/netlist/devices/nld_signal.h6
-rw-r--r--src/emu/netlist/nl_base.c65
-rw-r--r--src/emu/netlist/nl_base.h6
-rw-r--r--src/emu/netlist/nl_lists.h23
7 files changed, 72 insertions, 62 deletions
diff --git a/src/emu/machine/netlist.c b/src/emu/machine/netlist.c
index 0fa20b57c06..2adba55d6a9 100644
--- a/src/emu/machine/netlist.c
+++ b/src/emu/machine/netlist.c
@@ -534,7 +534,7 @@ ATTR_COLD offs_t netlist_mame_cpu_device_t::disasm_disassemble(char *buffer, off
// sprintf(buffer, "%04x %02d %s", pc, relpc, netlist().queue()[netlist().queue().count() - relpc - 1].object().name().cstr());
int dpc = netlist().queue().count() - relpc - 1;
sprintf(buffer, "%c %s @%10.7f", (relpc == 0) ? '*' : ' ', netlist().queue()[dpc].object()->name().cstr(),
- netlist().queue()[dpc].time().as_double());
+ netlist().queue()[dpc].exec_time().as_double());
}
else
sprintf(buffer, "%s", "");
diff --git a/src/emu/netlist/devices/nld_7493.c b/src/emu/netlist/devices/nld_7493.c
index d3d4c2345ab..dcc08776cff 100644
--- a/src/emu/netlist/devices/nld_7493.c
+++ b/src/emu/netlist/devices/nld_7493.c
@@ -45,35 +45,36 @@ NETLIB_START(7493ff)
NETLIB_RESET(7493ff)
{
- m_reset = 0;
+ m_reset = 1;
m_I.set_state(netlist_input_t::STATE_INP_HL);
}
NETLIB_UPDATE(7493ff)
{
- if (m_reset == 0)
- OUTLOGIC(m_Q, !m_Q.net().new_Q(), NLTIME_FROM_NS(18));
+ const netlist_time out_delay = NLTIME_FROM_NS(18);
+ //if (m_reset == 0)
+ OUTLOGIC(m_Q, (!m_Q.net().new_Q()) & m_reset, out_delay);
}
NETLIB_UPDATE(7493)
{
- netlist_sig_t r = INPLOGIC(m_R1) & INPLOGIC(m_R2);
+ const 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));
+ A.m_reset = B.m_reset = C.m_reset = D.m_reset = 0;
}
else
{
- A.m_reset = B.m_reset = C.m_reset = D.m_reset = 0;
A.m_I.activate_hl();
B.m_I.activate_hl();
+ A.m_reset = B.m_reset = C.m_reset = D.m_reset = 1;
}
}
diff --git a/src/emu/netlist/devices/nld_9316.c b/src/emu/netlist/devices/nld_9316.c
index 5f6752b0ab9..88f0caf53d3 100644
--- a/src/emu/netlist/devices/nld_9316.c
+++ b/src/emu/netlist/devices/nld_9316.c
@@ -74,10 +74,13 @@ NETLIB_UPDATE(9316_sub)
{
cnt = ( cnt + 1) & 0x0f;
update_outputs(cnt);
+ OUTLOGIC(m_RC, m_ent & (cnt == 0x0f), NLTIME_FROM_NS(20));
+#if 0
if (cnt == 0x0f)
OUTLOGIC(m_RC, m_ent, NLTIME_FROM_NS(20));
else if (cnt == 0)
OUTLOGIC(m_RC, 0, NLTIME_FROM_NS(20));
+#endif
}
else
{
@@ -94,25 +97,27 @@ NETLIB_UPDATE(9316)
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)
+ if ((!sub.m_loadq | (sub.m_ent & INPLOGIC(m_ENP))) & clrq)
{
sub.m_CLK.activate_lh();
}
else
{
+ UINT8 cnt = sub.m_cnt;
sub.m_CLK.inactivate();
- if (!clrq & (sub.m_cnt>0))
+ if (!clrq & (cnt>0))
{
- sub.m_cnt = 0;
- sub.update_outputs(sub.m_cnt);
+ cnt = 0;
+ sub.update_outputs(cnt);
OUTLOGIC(sub.m_RC, 0, NLTIME_FROM_NS(20));
+ sub.m_cnt = cnt;
return;
}
}
OUTLOGIC(sub.m_RC, sub.m_ent & (sub.m_cnt == 0x0f), NLTIME_FROM_NS(20));
}
-NETLIB_FUNC_VOID(9316_sub, update_outputs_all, (const UINT8 cnt))
+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);
@@ -121,10 +126,10 @@ NETLIB_FUNC_VOID(9316_sub, update_outputs_all, (const UINT8 cnt))
OUTLOGIC(m_QD, (cnt >> 3) & 1, out_delay);
}
-NETLIB_FUNC_VOID(9316_sub, update_outputs, (const UINT8 cnt))
+inline NETLIB_FUNC_VOID(9316_sub, update_outputs, (const UINT8 cnt))
{
const netlist_time out_delay = NLTIME_FROM_NS(20);
-#if 0
+#if 1
// for (int i=0; i<4; i++)
// OUTLOGIC(m_Q[i], (cnt >> i) & 1, delay[i]);
OUTLOGIC(m_QA, (cnt >> 0) & 1, out_delay);
diff --git a/src/emu/netlist/devices/nld_signal.h b/src/emu/netlist/devices/nld_signal.h
index 866cdd1cd17..835a2c85969 100644
--- a/src/emu/netlist/devices/nld_signal.h
+++ b/src/emu/netlist/devices/nld_signal.h
@@ -125,7 +125,7 @@ public:
virtual void update()
{
- static const netlist_time times[2] = { NLTIME_FROM_NS(22), NLTIME_FROM_NS(15) };
+ const netlist_time times[2] = { NLTIME_FROM_NS(22), NLTIME_FROM_NS(15) };
for (int i = 0; i< _numdev; i++)
{
@@ -195,7 +195,7 @@ public:
ATTR_HOT ATTR_ALIGN void update()
{
- static const netlist_time times[2] = { NLTIME_FROM_NS(15), NLTIME_FROM_NS(22)};
+ const netlist_time times[2] = { NLTIME_FROM_NS(15), NLTIME_FROM_NS(22)};
m_i[0].activate();
m_i[1].activate();
@@ -215,7 +215,7 @@ public:
}
OUTLOGIC(m_Q, res, times[res & 1]);// ? 22000 : 15000);
#else
- UINT8 val = (INPLOGIC(m_i[0]) ^ _check) | ((INPLOGIC(m_i[1]) ^ _check) << 1);
+ const UINT8 val = (INPLOGIC(m_i[0]) ^ _check) | ((INPLOGIC(m_i[1]) ^ _check) << 1);
UINT8 res = _invert ^ 1 ^_check;
switch (val)
{
diff --git a/src/emu/netlist/nl_base.c b/src/emu/netlist/nl_base.c
index e3053ca8ff5..7ccb0218c96 100644
--- a/src/emu/netlist/nl_base.c
+++ b/src/emu/netlist/nl_base.c
@@ -46,7 +46,7 @@ void netlist_queue_t::on_pre_save()
NL_VERBOSE_OUT(("current time %f qsize %d\n", m_netlist.time().as_double(), m_qsize));
for (int i = 0; i < m_qsize; i++ )
{
- m_times[i] = this->listptr()[i].time().as_raw();
+ m_times[i] = this->listptr()[i].exec_time().as_raw();
const char *p = this->listptr()[i].object()->name().cstr();
int n = MIN(63, strlen(p));
strncpy(&(m_name[i][0]), p, n);
@@ -226,9 +226,9 @@ ATTR_HOT ATTR_ALIGN void netlist_base_t::process_queue(const netlist_time delta)
{
while ( (m_time < m_stop) && (m_queue.is_not_empty()))
{
- const netlist_queue_t::entry_t &e = m_queue.pop();
- m_time = e.time();
- e.object()->update_devs();
+ const netlist_queue_t::entry_t *e = m_queue.pop();
+ m_time = e->exec_time();
+ e->object()->update_devs();
add_to_stat(m_perf_out_processed, 1);
if (FATAL_ERROR_AFTER_NS)
@@ -242,24 +242,27 @@ ATTR_HOT ATTR_ALIGN void netlist_base_t::process_queue(const netlist_time delta)
#if 0
netlist_net_t &mc_net = m_mainclock->m_Q.net();
const netlist_time inc = m_mainclock->m_inc;
+ netlist_time mc_time = mc_net.time();
while (m_time < m_stop)
{
if (m_queue.is_not_empty())
{
- while (m_queue.peek().time() > mc_net.time())
+ while (m_queue.peek()->exec_time() > mc_time)
{
- m_time = mc_net.time();
- NETLIB_NAME(mainclock)::mc_update(mc_net, m_time + inc);
+ m_time = mc_time;
+ mc_time += inc;
+ NETLIB_NAME(mainclock)::mc_update(mc_net);
}
- const netlist_queue_t::entry_t &e = m_queue.pop();
- m_time = e.time();
- e.object()->update_devs();
+ const netlist_queue_t::entry_t *e = m_queue.pop();
+ m_time = e->exec_time();
+ e->object()->update_devs();
} else {
- m_time = mc_net.time();
- NETLIB_NAME(mainclock)::mc_update(mc_net, m_time + inc);
+ m_time = mc_time;
+ mc_time += inc;
+ NETLIB_NAME(mainclock)::mc_update(mc_net);
}
if (FATAL_ERROR_AFTER_NS)
if (time() > NLTIME_FROM_NS(FATAL_ERROR_AFTER_NS))
@@ -267,6 +270,7 @@ ATTR_HOT ATTR_ALIGN void netlist_base_t::process_queue(const netlist_time delta)
add_to_stat(m_perf_out_processed, 1);
}
+ mc_net.set_time(mc_time);
#else
netlist_net_t &mc_net = m_mainclock->m_Q.net();
const netlist_time inc = m_mainclock->m_inc;
@@ -277,7 +281,7 @@ ATTR_HOT ATTR_ALIGN void netlist_base_t::process_queue(const netlist_time delta)
{
if (m_queue.is_not_empty())
{
- while (m_queue.peek().time() > mc_time)
+ while (m_queue.peek()->exec_time() > mc_time)
{
cur_time = mc_time;
mc_time += inc;
@@ -285,10 +289,10 @@ ATTR_HOT ATTR_ALIGN void netlist_base_t::process_queue(const netlist_time delta)
NETLIB_NAME(mainclock)::mc_update(mc_net);
}
- const netlist_queue_t::entry_t &e = m_queue.pop();
- cur_time = e.time();
+ const netlist_queue_t::entry_t *e = m_queue.pop();
+ cur_time = e->exec_time();
m_time = cur_time;
- e.object()->update_devs();
+ e->object()->update_devs();
} else {
cur_time = mc_time;
mc_time += inc;
@@ -369,16 +373,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;
- }
+ if (inp.state() != netlist_input_t::STATE_INP_PASSIVE)
+ return inp.Q();
else
- return inp.Q();
-
+ {
+ inp.activate();
+ const netlist_sig_t ret = inp.Q();
+ inp.inactivate();
+ return ret;
+ }
}
@@ -571,7 +574,7 @@ ATTR_COLD void netlist_net_t::register_con(netlist_core_terminal_t &terminal)
m_active++;
}
-ATTR_HOT inline static void update_dev(const netlist_core_terminal_t *inp, const UINT32 mask)
+ATTR_HOT ATTR_ALIGN static void update_dev(const netlist_core_terminal_t *inp, const UINT32 mask)
{
if ((inp->state() & mask) != 0)
{
@@ -583,7 +586,7 @@ ATTR_HOT inline static void update_dev(const netlist_core_terminal_t *inp, const
}
}
-ATTR_HOT inline void netlist_net_t::update_devs()
+ATTR_HOT ATTR_ALIGN void netlist_net_t::update_devs()
{
assert(m_num_cons != 0);
assert(this->isRailNet());
@@ -591,8 +594,8 @@ ATTR_HOT inline void netlist_net_t::update_devs()
static const UINT32 masks[4] = { 1, 5, 3, 1 };
const UINT32 mask = masks[ (m_last.Q << 1) | m_new.Q ];
- m_cur = m_new;
m_in_queue = 2; /* mark as taken ... */
+ m_cur = m_new;
netlist_core_terminal_t *p = m_head;
@@ -612,15 +615,15 @@ ATTR_HOT inline void netlist_net_t::update_devs()
p = p->m_update_list_next;
} while (p != NULL);
break;
+ }
#else
- while (p != NULL)
+ do
{
update_dev(p, mask);
p = p->m_update_list_next;
- }
+ } while (p != NULL);
#endif
- }
m_last = m_cur;
}
diff --git a/src/emu/netlist/nl_base.h b/src/emu/netlist/nl_base.h
index 78468bbe613..5498a78ab22 100644
--- a/src/emu/netlist/nl_base.h
+++ b/src/emu/netlist/nl_base.h
@@ -389,7 +389,7 @@ public:
ATTR_COLD void set_net(netlist_net_t &anet);
ATTR_COLD inline void clear_net() { m_net = NULL; }
- ATTR_COLD inline bool has_net() const { return (m_net != NULL); }
+ ATTR_HOT 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;}
@@ -575,8 +575,8 @@ public:
/* 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; }
diff --git a/src/emu/netlist/nl_lists.h b/src/emu/netlist/nl_lists.h
index 57842dd7883..862b5210839 100644
--- a/src/emu/netlist/nl_lists.h
+++ b/src/emu/netlist/nl_lists.h
@@ -161,17 +161,17 @@ class netlist_timed_queue
NETLIST_PREVENT_COPYING(netlist_timed_queue)
public:
- struct entry_t
+ class entry_t
{
public:
ATTR_HOT inline entry_t()
- : m_time(), m_object() {}
- ATTR_HOT inline entry_t(const _Time atime, const _Element elem) : m_time(atime), m_object(elem) {}
- ATTR_HOT inline const _Time time() const { return m_time; }
+ : m_exec_time(), m_object() {}
+ ATTR_HOT inline entry_t(const _Time atime, const _Element elem) : m_exec_time(atime), m_object(elem) {}
+ ATTR_HOT inline const _Time exec_time() const { return m_exec_time; }
ATTR_HOT inline const _Element object() const { return m_object; }
private:
- _Time m_time;
+ _Time m_exec_time;
_Element m_object;
};
@@ -188,10 +188,11 @@ public:
ATTR_HOT ATTR_ALIGN inline void push(const entry_t &e)
{
entry_t * RESTRICT i = m_end++;
- while ((i > &m_list[0]) && (e.time() > (i - 1)->time()) )
+ const _Time e_time = e.exec_time();
+ while ((i > &m_list[0]) && (e_time > (i - 1)->exec_time()) )
{
+ *(i) = *(i-1);
i--;
- *(i+1) = *i;
inc_stat(m_prof_sortmove);
}
*i = e;
@@ -199,14 +200,14 @@ public:
assert(m_end - m_list < _Size);
}
- ATTR_HOT inline const entry_t &pop()
+ ATTR_HOT inline const entry_t *pop()
{
- return *--m_end;
+ return --m_end;
}
- ATTR_HOT inline const entry_t &peek() const
+ ATTR_HOT inline const entry_t *peek() const
{
- return *(m_end-1);
+ return (m_end-1);
}
ATTR_COLD void clear()