Found some cycles by removing static declarations in some functions.

(nw)
This commit is contained in:
couriersud 2015-06-03 19:56:13 +02:00
parent 49168ace92
commit ca8338d5a5
13 changed files with 56 additions and 29 deletions

View File

@ -22,7 +22,7 @@ ATTR_COLD netlist_generic_diode::netlist_generic_diode()
ATTR_COLD void netlist_generic_diode::set_param(const nl_double Is, const nl_double n, nl_double gmin)
{
static const int csqrt2 = nl_math::sqrt(2.0);
static const double csqrt2 = nl_math::sqrt(2.0);
m_Is = Is;
m_n = n;
m_gmin = gmin;

View File

@ -76,7 +76,7 @@ NETLIB_UPDATE(4020)
{
sub.m_cnt = 0;
sub.m_IP.inactivate();
static const netlist_time reset_time = netlist_time::from_nsec(140);
/* static */ const netlist_time reset_time = netlist_time::from_nsec(140);
OUTLOGIC(sub.m_Q[0], 0, reset_time);
for (int i=3; i<14; i++)
OUTLOGIC(sub.m_Q[i], 0, reset_time);
@ -87,7 +87,7 @@ NETLIB_UPDATE(4020)
inline NETLIB_FUNC_VOID(4020_sub, update_outputs, (const UINT16 cnt))
{
static const netlist_time out_delayQn[14] = {
/* static */ const netlist_time out_delayQn[14] = {
NLTIME_FROM_NS(180), NLTIME_FROM_NS(280),
NLTIME_FROM_NS(380), NLTIME_FROM_NS(480),
NLTIME_FROM_NS(580), NLTIME_FROM_NS(680),

View File

@ -19,7 +19,7 @@ NETLIB_RESET(7404)
NETLIB_UPDATE(7404)
{
static const netlist_time delay[2] = { NLTIME_FROM_NS(15), NLTIME_FROM_NS(22) };
/* 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]);
}

View File

@ -42,7 +42,7 @@ NETLIB_RESET(74192)
}
// FIXME: Timing
static const netlist_time delay[4] =
/* static */ const netlist_time delay[4] =
{
NLTIME_FROM_NS(40),
NLTIME_FROM_NS(40),

View File

@ -7,8 +7,6 @@
#include "nld_82S16.h"
//static const netlist_time delay[2] = { NLTIME_FROM_NS(40), NLTIME_FROM_NS(25) };
// FIXME: timing!
// FIXME: optimize device (separate address decoder!)
NETLIB_UPDATE(82S16)

View File

@ -156,7 +156,7 @@ inline NETLIB_FUNC_VOID(9310_sub, update_outputs_all, (const UINT8 cnt, const ne
inline NETLIB_FUNC_VOID(9310_sub, update_outputs, (const UINT8 cnt))
{
static const netlist_time out_delay = NLTIME_FROM_NS(20);
/* static */ 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]);

View File

@ -59,7 +59,7 @@ NETLIB_UPDATE(9312)
const UINT8 G = INPLOGIC(m_G);
if (G)
{
static const netlist_time delay[2] = { NLTIME_FROM_NS(33), NLTIME_FROM_NS(19) };
/* static */ const netlist_time delay[2] = { NLTIME_FROM_NS(33), NLTIME_FROM_NS(19) };
OUTLOGIC(m_Y, 0, delay[0]);
OUTLOGIC(m_YQ, 1, delay[1]);
@ -77,7 +77,7 @@ NETLIB_UPDATE(9312)
m_B.activate();
m_C.activate();
}
static const netlist_time delay[2] = { NLTIME_FROM_NS(33), NLTIME_FROM_NS(28) };
/* static */ const netlist_time delay[2] = { NLTIME_FROM_NS(33), NLTIME_FROM_NS(28) };
const UINT8 chan = INPLOGIC(m_A) | (INPLOGIC(m_B)<<1) | (INPLOGIC(m_C)<<2);
if (m_last_chan != chan)
{

View File

@ -151,7 +151,7 @@ inline NETLIB_FUNC_VOID(9316_sub, update_outputs_all, (const UINT8 cnt, const ne
inline NETLIB_FUNC_VOID(9316_sub, update_outputs, (const UINT8 cnt))
{
static const netlist_time out_delay = NLTIME_FROM_NS(20);
/* static */ 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]);

View File

@ -422,12 +422,12 @@ ATTR_COLD void netlist_core_device_t::init(netlist_base_t &anetlist, const pstri
#if (NL_PMF_TYPE == NL_PMF_TYPE_GNUC_PMF)
void (netlist_core_device_t::* pFunc)() = &netlist_core_device_t::update;
static_update = pFunc;
m_static_update = pFunc;
#elif (NL_PMF_TYPE == NL_PMF_TYPE_GNUC_PMF_CONV)
void (netlist_core_device_t::* pFunc)() = &netlist_core_device_t::update;
static_update = reinterpret_cast<net_update_delegate>((this->*pFunc));
m_static_update = reinterpret_cast<net_update_delegate>((this->*pFunc));
#elif (NL_PMF_TYPE == NL_PMF_TYPE_INTERNAL)
static_update = pmfp::get_mfp<net_update_delegate>(&netlist_core_device_t::update, this);
m_static_update = pmfp::get_mfp<net_update_delegate>(&netlist_core_device_t::update, this);
#endif
}
@ -685,7 +685,19 @@ ATTR_HOT /* inline */ void netlist_net_t::update_devs()
m_in_queue = 2; /* mark as taken ... */
m_cur_Q = m_new_Q;
#if 0
netlist_core_terminal_t * t[256];
netlist_core_terminal_t *p = m_list_active.first();
int cnt = 0;
while (p != NULL)
{
if ((p->state() & mask) != 0)
t[cnt++] = p;
p = m_list_active.next(p);
}
for (int i=0; i<cnt; i++)
t[i]->netdev().update_dev();
netlist_core_terminal_t *p = m_list_active.first();
while (p != NULL)
@ -693,6 +705,16 @@ ATTR_HOT /* inline */ void netlist_net_t::update_devs()
p->update_dev(mask);
p = m_list_active.next(p);
}
#else
netlist_core_terminal_t *p = m_list_active.first();
while (p != NULL)
{
p->update_dev(mask);
p = p->m_next;
}
#endif
}
ATTR_COLD void netlist_net_t::reset()

View File

@ -1016,9 +1016,9 @@ public:
inc_stat(stat_update_count);
#if (NL_PMF_TYPE == NL_PMF_TYPE_GNUC_PMF)
(this->*static_update)();
(this->*m_static_update)();
#elif ((NL_PMF_TYPE == NL_PMF_TYPE_GNUC_PMF_CONV) || (NL_PMF_TYPE == NL_PMF_TYPE_INTERNAL))
static_update(this);
m_static_update(this);
#else
update();
#endif
@ -1075,7 +1075,7 @@ protected:
private:
#if (NL_PMF_TYPE > NL_PMF_TYPE_VIRTUAL)
net_update_delegate static_update;
net_update_delegate m_static_update;
#endif
};

View File

@ -23,14 +23,14 @@
// net_list_time
// ----------------------------------------------------------------------------------------
#define RESOLUTION NETLIST_INTERNAL_RES
struct netlist_time
{
public:
typedef UINT64 INTERNALTYPE;
static const INTERNALTYPE RESOLUTION = NETLIST_INTERNAL_RES;
ATTR_HOT /* inline */ netlist_time() : m_time(0) {}
ATTR_HOT friend /* inline */ const netlist_time operator-(const netlist_time &left, const netlist_time &right);
@ -74,6 +74,8 @@ private:
INTERNALTYPE m_time;
};
#undef RESOLUTION
template<> ATTR_COLD inline void pstate_manager_t::save_item(netlist_time &nlt, const void *owner, const pstring &stname)
{
save_state_ptr(stname, DT_INT64, owner, sizeof(netlist_time::INTERNALTYPE), 1, nlt.get_internaltype_ptr(), false);

View File

@ -61,17 +61,22 @@ public:
#if 0
inline static 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;
/* static */ const double c4 = 1.0 / 24.0;
/* static */ const double c5 = 1.0 / 120.0;
const double y = x * ln2r;
const unsigned int t = y;
const UINT32 t = y;
const double z = (x - ln2 * (double) t);
const double zz = z * z;
const double zzz = zz * z;
const double e = (1.0 + z * (1.0 + z * (0.5 + z * (c3 + z * (c4 + c5*z)))));
return (double)(1 << t)*(1.0 + z + 0.5 * zz + c3 * zzz);
if (t < 63)
//return (double)((UINT64) 1 << t)*(1.0 + z + 0.5 * zz + c3 * zzz+c4*zzzz+c5*zzzzz);
return (double)((UINT64) 1 << t) * e;
else
return pow(2.0, t)*e;
}
ATTR_HOT inline static double exp(const double x)

View File

@ -366,9 +366,9 @@ public:
}
private:
template <typename T> static const pstring &get_name(const T *elem) { return elem->name(); }
template <typename T> static const pstring &get_name(T *elem) { return elem->name(); }
template <typename T> static const pstring &get_name(const T &elem) { return elem.name(); }
template <typename T> const pstring &get_name(const T *elem) const { return elem->name(); }
template <typename T> const pstring &get_name(T *elem) const { return elem->name(); }
template <typename T> const pstring &get_name(const T &elem) const { return elem.name(); }
};