mirror of
https://github.com/holub/mame
synced 2025-10-04 00:23:43 +03:00
netlist: Minor optimizations. (nw)
This commit is contained in:
parent
6c517ab98e
commit
a970ef42f1
@ -1342,8 +1342,8 @@ offs_t netlist_disassembler::disassemble(std::ostream &stream, offs_t pc, const
|
||||
if (relpc >= 0 && relpc < m_dev->netlist().queue().size())
|
||||
{
|
||||
int dpc = m_dev->netlist().queue().size() - relpc - 1;
|
||||
util::stream_format(stream, "%c %s @%10.7f", (relpc == 0) ? '*' : ' ', m_dev->netlist().queue()[dpc].m_object->name().c_str(),
|
||||
m_dev->netlist().queue()[dpc].m_exec_time.as_double());
|
||||
util::stream_format(stream, "%c %s @%10.7f", (relpc == 0) ? '*' : ' ', m_dev->netlist().queue()[dpc].object()->name().c_str(),
|
||||
m_dev->netlist().queue()[dpc].exec_time().as_double());
|
||||
}
|
||||
|
||||
pc+=1;
|
||||
|
@ -89,20 +89,20 @@ namespace analog
|
||||
|
||||
void solve_later(netlist_time delay = netlist_time::quantum());
|
||||
|
||||
void set_G_V_I(const nl_fptype G, const nl_fptype V, const nl_fptype I)
|
||||
void set_G_V_I(nl_fptype G, nl_fptype V, nl_fptype I) const noexcept
|
||||
{
|
||||
/* GO, GT, I */
|
||||
m_P.set_go_gt_I( -G, G, ( V) * G - I);
|
||||
m_N.set_go_gt_I( -G, G, ( -V) * G + I);
|
||||
}
|
||||
|
||||
nl_fptype deltaV() const
|
||||
nl_fptype deltaV() const noexcept
|
||||
{
|
||||
return m_P.net().Q_Analog() - m_N.net().Q_Analog();
|
||||
}
|
||||
|
||||
void set_mat(const nl_fptype a11, const nl_fptype a12, const nl_fptype rhs1,
|
||||
const nl_fptype a21, const nl_fptype a22, const nl_fptype rhs2)
|
||||
void set_mat(nl_fptype a11, nl_fptype a12, nl_fptype rhs1,
|
||||
nl_fptype a21, nl_fptype a22, nl_fptype rhs2) const noexcept
|
||||
{
|
||||
/* GO, GT, I */
|
||||
m_P.set_go_gt_I(a12, a11, rhs1);
|
||||
|
@ -127,8 +127,8 @@ namespace netlist
|
||||
m_qsize = this->size();
|
||||
for (std::size_t i = 0; i < m_qsize; i++ )
|
||||
{
|
||||
m_times[i] = this->listptr()[i].m_exec_time.as_raw();
|
||||
m_net_ids[i] = state().find_net_id(this->listptr()[i].m_object);
|
||||
m_times[i] = this->listptr()[i].exec_time().as_raw();
|
||||
m_net_ids[i] = state().find_net_id(this->listptr()[i].object());
|
||||
}
|
||||
}
|
||||
|
||||
@ -663,7 +663,7 @@ namespace netlist
|
||||
}
|
||||
|
||||
|
||||
void detail::net_t::reset()
|
||||
void detail::net_t::reset() noexcept
|
||||
{
|
||||
m_next_scheduled_time = netlist_time::zero();
|
||||
m_in_queue = queue_status::DELIVERED;
|
||||
@ -796,7 +796,7 @@ namespace netlist
|
||||
net().solver()->update_forced();
|
||||
}
|
||||
|
||||
void terminal_t::schedule_solve_after(const netlist_time after)
|
||||
void terminal_t::schedule_solve_after(netlist_time after)
|
||||
{
|
||||
// Nets may belong to railnets which do not have a solver attached
|
||||
if (this->has_net())
|
||||
@ -826,7 +826,7 @@ namespace netlist
|
||||
state().setup().register_term(*this);
|
||||
}
|
||||
|
||||
void logic_output_t::initial(const netlist_sig_t val)
|
||||
void logic_output_t::initial(const netlist_sig_t val) noexcept
|
||||
{
|
||||
if (has_net())
|
||||
net().initial(val);
|
||||
@ -858,7 +858,7 @@ namespace netlist
|
||||
state().setup().register_term(*this);
|
||||
}
|
||||
|
||||
void analog_output_t::initial(const nl_fptype val)
|
||||
void analog_output_t::initial(const nl_fptype val) noexcept
|
||||
{
|
||||
net().set_Q_Analog(val);
|
||||
}
|
||||
@ -928,7 +928,7 @@ namespace netlist
|
||||
m_param = device.state().setup().get_initial_param_val(this->name(),val);
|
||||
}
|
||||
|
||||
void param_str_t::changed()
|
||||
void param_str_t::changed() noexcept
|
||||
{
|
||||
}
|
||||
|
||||
@ -939,10 +939,8 @@ namespace netlist
|
||||
//netlist().save(*this, m_param, "m_param");
|
||||
}
|
||||
|
||||
void param_model_t::changed()
|
||||
void param_model_t::changed() noexcept
|
||||
{
|
||||
// FIXME: should we really throw here ?
|
||||
plib::pthrow<nl_exception>(MF_MODEL_1_CAN_NOT_BE_CHANGED_AT_RUNTIME(name()));
|
||||
}
|
||||
|
||||
const pstring param_model_t::value_str(const pstring &entity)
|
||||
|
@ -284,8 +284,8 @@ namespace netlist
|
||||
logic_family_t() : m_logic_family(nullptr) {}
|
||||
COPYASSIGNMOVE(logic_family_t, delete)
|
||||
|
||||
const logic_family_desc_t *logic_family() const { return m_logic_family; }
|
||||
void set_logic_family(const logic_family_desc_t *fam) { m_logic_family = fam; }
|
||||
const logic_family_desc_t *logic_family() const noexcept { return m_logic_family; }
|
||||
void set_logic_family(const logic_family_desc_t *fam) noexcept { m_logic_family = fam; }
|
||||
|
||||
protected:
|
||||
~logic_family_t() noexcept = default; // prohibit polymorphic destruction
|
||||
@ -629,7 +629,7 @@ namespace netlist
|
||||
|
||||
virtual ~net_t() noexcept = default;
|
||||
|
||||
void reset();
|
||||
void reset() noexcept;
|
||||
|
||||
void toggle_new_Q() noexcept { m_new_Q = (m_cur_Q ^ 1); }
|
||||
|
||||
@ -763,28 +763,29 @@ namespace netlist
|
||||
|
||||
nl_fptype operator ()() const noexcept;
|
||||
|
||||
void set_conductivity(const nl_fptype G) const noexcept
|
||||
void set_conductivity(nl_fptype G) const noexcept
|
||||
{
|
||||
set_go_gt_I(-G, G, nlconst::zero());
|
||||
}
|
||||
|
||||
void set_go_gt(const nl_fptype GO, const nl_fptype GT) const noexcept
|
||||
void set_go_gt(nl_fptype GO, nl_fptype GT) const noexcept
|
||||
{
|
||||
set_go_gt_I(GO, GT, nlconst::zero());
|
||||
}
|
||||
|
||||
void set_go_gt_I(const nl_fptype GO, const nl_fptype GT, const nl_fptype I) const noexcept
|
||||
void set_go_gt_I(nl_fptype GO, nl_fptype GT, nl_fptype I) const noexcept
|
||||
{
|
||||
// FIXME: is this check still needed?
|
||||
if (m_go1 != nullptr)
|
||||
{
|
||||
if (*m_Idr1 != I) *m_Idr1 = I;
|
||||
if (*m_go1 != GO) *m_go1 = GO;
|
||||
if (*m_gt1 != GT) *m_gt1 = GT;
|
||||
*m_Idr1 = I;
|
||||
*m_go1 = GO;
|
||||
*m_gt1 = GT;
|
||||
}
|
||||
}
|
||||
|
||||
void solve_now();
|
||||
void schedule_solve_after(const netlist_time after);
|
||||
void schedule_solve_after(netlist_time after);
|
||||
|
||||
void set_ptrs(nl_fptype *gt, nl_fptype *go, nl_fptype *Idr) noexcept(false);
|
||||
|
||||
@ -924,7 +925,7 @@ namespace netlist
|
||||
|
||||
logic_output_t(core_device_t &dev, const pstring &aname);
|
||||
|
||||
void initial(netlist_sig_t val);
|
||||
void initial(netlist_sig_t val) noexcept;
|
||||
|
||||
void push(netlist_sig_t newQ, netlist_time delay) noexcept
|
||||
{
|
||||
@ -946,7 +947,7 @@ namespace netlist
|
||||
analog_output_t(core_device_t &dev, const pstring &aname);
|
||||
|
||||
void push(const nl_fptype val) noexcept { set_Q(val); }
|
||||
void initial(const nl_fptype val);
|
||||
void initial(const nl_fptype val) noexcept;
|
||||
|
||||
private:
|
||||
void set_Q(const nl_fptype newQ) noexcept;
|
||||
@ -1064,7 +1065,7 @@ namespace netlist
|
||||
}
|
||||
}
|
||||
protected:
|
||||
virtual void changed();
|
||||
virtual void changed() noexcept;
|
||||
const pstring &str() const noexcept { return m_param; }
|
||||
private:
|
||||
PALIGNAS_CACHELINE()
|
||||
@ -1107,7 +1108,7 @@ namespace netlist
|
||||
/* hide this */
|
||||
void setTo(const pstring ¶m) = delete;
|
||||
protected:
|
||||
void changed() override;
|
||||
void changed() noexcept override;
|
||||
private:
|
||||
};
|
||||
|
||||
@ -1125,7 +1126,7 @@ namespace netlist
|
||||
|
||||
plib::unique_ptr<std::istream> stream();
|
||||
protected:
|
||||
void changed() override { }
|
||||
void changed() noexcept override { }
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -1141,7 +1142,7 @@ namespace netlist
|
||||
|
||||
ST operator[] (std::size_t n) const noexcept { return m_data[n]; }
|
||||
protected:
|
||||
void changed() override
|
||||
void changed() noexcept override
|
||||
{
|
||||
stream()->read(reinterpret_cast<std::istream::char_type *>(&m_data[0]),1<<AW);
|
||||
}
|
||||
@ -1987,14 +1988,14 @@ namespace netlist
|
||||
if (m_mainclock == nullptr)
|
||||
{
|
||||
detail::queue_t::entry_t e(m_queue.pop());
|
||||
m_time = e.m_exec_time;
|
||||
while (e.m_object != nullptr)
|
||||
m_time = e.exec_time();
|
||||
while (e.object() != nullptr)
|
||||
{
|
||||
e.m_object->template update_devs<KEEP_STATS>();
|
||||
e.object()->template update_devs<KEEP_STATS>();
|
||||
if (KEEP_STATS)
|
||||
m_perf_out_processed.inc();
|
||||
e = m_queue.pop();
|
||||
m_time = e.m_exec_time;
|
||||
m_time = e.exec_time();
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -2005,7 +2006,7 @@ namespace netlist
|
||||
|
||||
do
|
||||
{
|
||||
while (m_queue.top().m_exec_time > mc_time)
|
||||
while (m_queue.top().exec_time() > mc_time)
|
||||
{
|
||||
m_time = mc_time;
|
||||
mc_net.toggle_new_Q();
|
||||
@ -2014,10 +2015,10 @@ namespace netlist
|
||||
}
|
||||
|
||||
detail::queue_t::entry_t e(m_queue.pop());
|
||||
m_time = e.m_exec_time;
|
||||
if (e.m_object != nullptr)
|
||||
m_time = e.exec_time();
|
||||
if (e.object() != nullptr)
|
||||
{
|
||||
e.m_object->template update_devs<KEEP_STATS>();
|
||||
e.object()->template update_devs<KEEP_STATS>();
|
||||
if (KEEP_STATS)
|
||||
m_perf_out_processed.inc();
|
||||
}
|
||||
|
@ -285,6 +285,9 @@ namespace plib {
|
||||
|
||||
inline static constexpr pqentry_t never() noexcept { return pqentry_t(Time::never(), nullptr); }
|
||||
|
||||
Time exec_time() const noexcept { return m_exec_time; }
|
||||
Element object() const noexcept { return m_object; }
|
||||
private:
|
||||
Time m_exec_time;
|
||||
Element m_object;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user