Fixed recursive call in nl_math. Straightened some code. (nw)

This commit is contained in:
couriersud 2015-05-10 19:28:45 +02:00
parent f2317dd119
commit fb9bf71e40
4 changed files with 22 additions and 13 deletions

View File

@ -27,7 +27,7 @@ public:
}
nl_double I(const nl_double V) const { return m_Is * nl_math::exp(V * m_VT_inv) - m_Is; }
nl_double g(const nl_double V) const { return m_Is * m_VT_inv * nl_math::exp(V * m_VT_inv); }
nl_double V(const nl_double I) const { return nl_math::log1p(I / m_Is) * m_VT; } // log1p(x)=log(1.0 + x)
nl_double V(const nl_double I) const { return nl_math::e_log1p(I / m_Is) * m_VT; } // log1p(x)=log(1.0 + x)
nl_double gI(const nl_double I) const { return m_VT_inv * (I + m_Is); }
private:

View File

@ -610,16 +610,12 @@ ATTR_COLD void netlist_net_t::save_register()
netlist_object_t::save_register();
}
ATTR_HOT /*ATTR_ALIGN*/ static inline void update_dev(const netlist_core_terminal_t *inp, const UINT32 mask)
ATTR_HOT inline void netlist_core_terminal_t::update_dev(const UINT32 mask)
{
netlist_core_device_t &netdev = inp->netdev();
inc_stat(netdev.stat_call_count);
if ((inp->state() & mask) != 0)
inc_stat(netdev().stat_call_count);
if ((state() & mask) != 0)
{
begin_timing(netdev.stat_total_time);
inc_stat(netdev.stat_update_count);
netdev.update_dev();
end_timing(netdev.stat_total_time);
netdev().update_dev();
}
}
@ -635,9 +631,9 @@ ATTR_HOT /*ATTR_ALIGN*/ inline void netlist_net_t::update_devs()
m_in_queue = 2; /* mark as taken ... */
m_cur_Q = m_new_Q;
#if 0
switch (m_active)
{
#if 0
case 2:
update_dev(p, mask);
p = m_list_active.next(p);
@ -645,7 +641,6 @@ ATTR_HOT /*ATTR_ALIGN*/ inline void netlist_net_t::update_devs()
case 1:
update_dev(p, mask);
break;
#endif
default:
while (p != NULL)
{
@ -654,6 +649,14 @@ ATTR_HOT /*ATTR_ALIGN*/ inline void netlist_net_t::update_devs()
}
break;
}
#else
while (p != NULL)
{
//update_dev(p, mask);
p->update_dev(mask);
p = m_list_active.next(p);
}
#endif
}

View File

@ -449,6 +449,9 @@ public:
m_state = astate;
}
/* inline, only intended to be called from nl_base.c */
ATTR_HOT inline void update_dev(const UINT32 mask);
protected:
ATTR_COLD virtual void save_register()
{
@ -955,11 +958,14 @@ public:
ATTR_HOT inline void update_dev()
{
begin_timing(stat_total_time);
inc_stat(stat_update_count);
#if USE_PMFDELEGATES
static_update(this);
#else
update();
#endif
end_timing(stat_total_time);
}
ATTR_COLD void start_dev();

View File

@ -57,8 +57,8 @@ public:
ATTR_HOT inline static double log1p(const double x) { return nl_math::log(1.0 + x); }
ATTR_HOT inline static float log1p(const float x) { return nl_math::log(1.0 + x); }
#else
ATTR_HOT inline static double log1p(const double x) { return log1p(x); }
ATTR_HOT inline static float log1p(const float x) { return log1pf(x); }
ATTR_HOT inline static double e_log1p(const double x) { return log1p(x); }
ATTR_HOT inline static float e_log1p(const float x) { return log1pf(x); }
#endif
ATTR_HOT inline static double sqrt(const double x) { return std::sqrt(x); }
ATTR_HOT inline static float sqrt(const float x) { return std::sqrt(x); }