Clean up net_t interface and increase readability. (nw)
This commit is contained in:
parent
f222e7731d
commit
5c4b7cfef8
@ -960,7 +960,8 @@ netlist_mame_cpu_device_t::netlist_mame_cpu_device_t(const machine_config &mconf
|
|||||||
device_state_interface(mconfig, *this),
|
device_state_interface(mconfig, *this),
|
||||||
device_disasm_interface(mconfig, *this),
|
device_disasm_interface(mconfig, *this),
|
||||||
device_memory_interface(mconfig, *this),
|
device_memory_interface(mconfig, *this),
|
||||||
m_program_config("program", ENDIANNESS_LITTLE, 8, 12) // Interface is needed to keep debugger happy
|
m_program_config("program", ENDIANNESS_LITTLE, 8, 12), // Interface is needed to keep debugger happy
|
||||||
|
m_genPC(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1055,7 +1056,12 @@ ATTR_HOT void netlist_mame_cpu_device_t::execute_run()
|
|||||||
|
|
||||||
netlist_mame_sound_device_t::netlist_mame_sound_device_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
netlist_mame_sound_device_t::netlist_mame_sound_device_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||||
: netlist_mame_device_t(mconfig, NETLIST_CPU, "Netlist Sound Device", tag, owner, clock, "netlist_sound", __FILE__),
|
: netlist_mame_device_t(mconfig, NETLIST_CPU, "Netlist Sound Device", tag, owner, clock, "netlist_sound", __FILE__),
|
||||||
device_sound_interface(mconfig, *this)
|
device_sound_interface(mconfig, *this),
|
||||||
|
m_out{nullptr},
|
||||||
|
m_in(nullptr),
|
||||||
|
m_stream(nullptr),
|
||||||
|
m_num_inputs(0),
|
||||||
|
m_num_outputs(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,11 +309,11 @@ NETLIB_RESET(QBJT_switch)
|
|||||||
NETLIB_UPDATE(QBJT_switch)
|
NETLIB_UPDATE(QBJT_switch)
|
||||||
{
|
{
|
||||||
if (!m_RB.m_P.net().isRailNet())
|
if (!m_RB.m_P.net().isRailNet())
|
||||||
m_RB.m_P.schedule_solve(); // Basis
|
m_RB.m_P.solve_now(); // Basis
|
||||||
else if (!m_RB.m_N.net().isRailNet())
|
else if (!m_RB.m_N.net().isRailNet())
|
||||||
m_RB.m_N.schedule_solve(); // Emitter
|
m_RB.m_N.solve_now(); // Emitter
|
||||||
else if (!m_RC.m_P.net().isRailNet())
|
else if (!m_RC.m_P.net().isRailNet())
|
||||||
m_RC.m_P.schedule_solve(); // Collector
|
m_RC.m_P.solve_now(); // Collector
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -372,11 +372,11 @@ NETLIB_UPDATE_TERMINALS(QBJT_switch)
|
|||||||
NETLIB_UPDATE(QBJT_EB)
|
NETLIB_UPDATE(QBJT_EB)
|
||||||
{
|
{
|
||||||
if (!m_D_EB.m_P.net().isRailNet())
|
if (!m_D_EB.m_P.net().isRailNet())
|
||||||
m_D_EB.m_P.schedule_solve(); // Basis
|
m_D_EB.m_P.solve_now(); // Basis
|
||||||
else if (!m_D_EB.m_N.net().isRailNet())
|
else if (!m_D_EB.m_N.net().isRailNet())
|
||||||
m_D_EB.m_N.schedule_solve(); // Emitter
|
m_D_EB.m_N.solve_now(); // Emitter
|
||||||
else
|
else
|
||||||
m_D_CB.m_N.schedule_solve(); // Collector
|
m_D_CB.m_N.solve_now(); // Collector
|
||||||
}
|
}
|
||||||
|
|
||||||
NETLIB_RESET(QBJT_EB)
|
NETLIB_RESET(QBJT_EB)
|
||||||
|
@ -49,10 +49,8 @@
|
|||||||
// Generic macros
|
// Generic macros
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
#ifdef RES_R
|
#ifdef RES_R
|
||||||
// FIXME: avoid compile fails
|
#warning "Do not include rescap.h in a netlist environment"
|
||||||
// #warning "Do not include rescap.h in a netlist environment"
|
|
||||||
#endif
|
#endif
|
||||||
#ifndef RES_R
|
#ifndef RES_R
|
||||||
#define RES_R(res) (static_cast<double>(res))
|
#define RES_R(res) (static_cast<double>(res))
|
||||||
|
@ -40,13 +40,13 @@ NETLIB_UPDATE(VCCS)
|
|||||||
{
|
{
|
||||||
/* only called if connected to a rail net ==> notify the solver to recalculate */
|
/* only called if connected to a rail net ==> notify the solver to recalculate */
|
||||||
if (!m_IP.net().isRailNet())
|
if (!m_IP.net().isRailNet())
|
||||||
m_IP.schedule_solve();
|
m_IP.solve_now();
|
||||||
else if (!m_IN.net().isRailNet())
|
else if (!m_IN.net().isRailNet())
|
||||||
m_IN.schedule_solve();
|
m_IN.solve_now();
|
||||||
else if (!m_OP.net().isRailNet())
|
else if (!m_OP.net().isRailNet())
|
||||||
m_OP.schedule_solve();
|
m_OP.solve_now();
|
||||||
else if (!m_ON.net().isRailNet())
|
else if (!m_ON.net().isRailNet())
|
||||||
m_ON.schedule_solve();
|
m_ON.solve_now();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------
|
||||||
|
@ -88,9 +88,9 @@ NETLIB_UPDATE(twoterm)
|
|||||||
/* only called if connected to a rail net ==> notify the solver to recalculate */
|
/* only called if connected to a rail net ==> notify the solver to recalculate */
|
||||||
/* we only need to call the non-rail terminal */
|
/* we only need to call the non-rail terminal */
|
||||||
if (m_P.has_net() && !m_P.net().isRailNet())
|
if (m_P.has_net() && !m_P.net().isRailNet())
|
||||||
m_P.schedule_solve();
|
m_P.solve_now();
|
||||||
else if (m_N.has_net() && !m_N.net().isRailNet())
|
else if (m_N.has_net() && !m_N.net().isRailNet())
|
||||||
m_N.schedule_solve();
|
m_N.solve_now();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------
|
||||||
|
@ -67,7 +67,7 @@ namespace netlist
|
|||||||
{
|
{
|
||||||
m_R.update_dev();
|
m_R.update_dev();
|
||||||
m_R.set_R(R);
|
m_R.set_R(R);
|
||||||
m_R.m_P.schedule_after(NLTIME_FROM_NS(1));
|
m_R.m_P.schedule_solve_after(NLTIME_FROM_NS(1));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -47,7 +47,7 @@ namespace netlist { namespace devices {
|
|||||||
m_R.set_R(m_base_r());
|
m_R.set_R(m_base_r());
|
||||||
else
|
else
|
||||||
m_R.set_R(NL_FCONST(1.0) / netlist().gmin());
|
m_R.set_R(NL_FCONST(1.0) / netlist().gmin());
|
||||||
m_R.m_P.schedule_after(NLTIME_FROM_NS(1));
|
m_R.m_P.schedule_solve_after(NLTIME_FROM_NS(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
NETLIB_DEVICE_IMPL(CD4316_GATE)
|
NETLIB_DEVICE_IMPL(CD4316_GATE)
|
||||||
|
@ -109,7 +109,7 @@ namespace netlist
|
|||||||
if (m_is_timestep)
|
if (m_is_timestep)
|
||||||
m_RV.update_dev();
|
m_RV.update_dev();
|
||||||
m_RV.set(NL_FCONST(1.0) / R, V, 0.0);
|
m_RV.set(NL_FCONST(1.0) / R, V, 0.0);
|
||||||
m_RV.m_P.schedule_after(NLTIME_FROM_NS(1));
|
m_RV.m_P.schedule_solve_after(NLTIME_FROM_NS(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -110,12 +110,12 @@ namespace netlist
|
|||||||
{
|
{
|
||||||
m_R.update_dev();
|
m_R.update_dev();
|
||||||
m_R.set_R(R);
|
m_R.set_R(R);
|
||||||
m_R.m_P.schedule_after(NLTIME_FROM_NS(1));
|
m_R.m_P.schedule_solve_after(NLTIME_FROM_NS(1));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_R.set_R(R);
|
m_R.set_R(R);
|
||||||
m_R.m_P.schedule_after(NLTIME_FROM_NS(1));
|
m_R.m_P.schedule_solve_after(NLTIME_FROM_NS(1));
|
||||||
//m_R->update_dev();
|
//m_R->update_dev();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,7 @@ namespace netlist
|
|||||||
m_RV.update_dev();
|
m_RV.update_dev();
|
||||||
}
|
}
|
||||||
m_RV.set(NL_FCONST(1.0) / R, V, 0.0);
|
m_RV.set(NL_FCONST(1.0) / R, V, 0.0);
|
||||||
m_RV.m_P.schedule_after(NLTIME_FROM_NS(1));
|
m_RV.m_P.schedule_solve_after(NLTIME_FROM_NS(1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -476,7 +476,7 @@ NETLIST_END()
|
|||||||
*
|
*
|
||||||
* Naming conventions follow National Semiconductor datasheet
|
* Naming conventions follow National Semiconductor datasheet
|
||||||
*
|
*
|
||||||
* FIXME: Same as 7400, but drains higher output currents.
|
* NOTE: Same as 7400, but drains higher output currents.
|
||||||
* Netlist currently does not model over currents (should it ever?)
|
* Netlist currently does not model over currents (should it ever?)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -845,7 +845,7 @@ void detail::net_t::update_devs() NL_NOEXCEPT
|
|||||||
{
|
{
|
||||||
nl_assert(this->isRailNet());
|
nl_assert(this->isRailNet());
|
||||||
|
|
||||||
const unsigned masks[4] =
|
const uint8_t masks[4] =
|
||||||
{
|
{
|
||||||
0,
|
0,
|
||||||
core_terminal_t::STATE_INP_LH | core_terminal_t::STATE_INP_ACTIVE,
|
core_terminal_t::STATE_INP_LH | core_terminal_t::STATE_INP_ACTIVE,
|
||||||
@ -853,7 +853,7 @@ void detail::net_t::update_devs() NL_NOEXCEPT
|
|||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
const unsigned mask = masks[ (m_cur_Q << 1) | m_new_Q ];
|
const auto mask = masks[ (m_cur_Q << 1) | m_new_Q ];
|
||||||
|
|
||||||
m_cur_Q = m_new_Q;
|
m_cur_Q = m_new_Q;
|
||||||
m_in_queue = 2; /* mark as taken ... */
|
m_in_queue = 2; /* mark as taken ... */
|
||||||
@ -1029,19 +1029,17 @@ terminal_t::~terminal_t()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void terminal_t::schedule_solve()
|
void terminal_t::solve_now()
|
||||||
{
|
{
|
||||||
// Nets may belong to railnets which do not have a solver attached
|
// Nets may belong to railnets which do not have a solver attached
|
||||||
// FIXME: Enforce that all terminals get connected?
|
|
||||||
if (this->has_net())
|
if (this->has_net())
|
||||||
if (net().solver() != nullptr)
|
if (net().solver() != nullptr)
|
||||||
net().solver()->update_forced();
|
net().solver()->update_forced();
|
||||||
}
|
}
|
||||||
|
|
||||||
void terminal_t::schedule_after(const netlist_time &after)
|
void terminal_t::schedule_solve_after(const netlist_time &after)
|
||||||
{
|
{
|
||||||
// Nets may belong to railnets which do not have a solver attached
|
// Nets may belong to railnets which do not have a solver attached
|
||||||
// FIXME: Enforce that all terminals get connected?
|
|
||||||
if (this->has_net())
|
if (this->has_net())
|
||||||
if (net().solver() != nullptr)
|
if (net().solver() != nullptr)
|
||||||
net().solver()->update_after(after);
|
net().solver()->update_after(after);
|
||||||
|
@ -573,8 +573,8 @@ namespace netlist
|
|||||||
set_ptr(m_gt1, GT);
|
set_ptr(m_gt1, GT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void schedule_solve();
|
void solve_now();
|
||||||
void schedule_after(const netlist_time &after);
|
void schedule_solve_after(const netlist_time &after);
|
||||||
|
|
||||||
void set_ptrs(nl_double *gt, nl_double *go, nl_double *Idr)
|
void set_ptrs(nl_double *gt, nl_double *go, nl_double *Idr)
|
||||||
{
|
{
|
||||||
@ -698,11 +698,15 @@ namespace netlist
|
|||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
void toggle_new_Q() NL_NOEXCEPT { m_new_Q ^= 1; }
|
void toggle_new_Q() NL_NOEXCEPT { m_new_Q = (m_cur_Q ^ 1); }
|
||||||
void force_queue_execution() NL_NOEXCEPT { m_new_Q = (m_cur_Q ^ 1); }
|
|
||||||
|
void toggle_and_push_to_queue(const netlist_time delay) NL_NOEXCEPT
|
||||||
|
{
|
||||||
|
toggle_new_Q();
|
||||||
|
push_to_queue(delay);
|
||||||
|
}
|
||||||
|
|
||||||
void push_to_queue(const netlist_time delay) NL_NOEXCEPT;
|
void push_to_queue(const netlist_time delay) NL_NOEXCEPT;
|
||||||
void reschedule_in_queue(const netlist_time delay) NL_NOEXCEPT;
|
|
||||||
bool is_queued() const NL_NOEXCEPT { return m_in_queue == 1; }
|
bool is_queued() const NL_NOEXCEPT { return m_in_queue == 1; }
|
||||||
|
|
||||||
void update_devs() NL_NOEXCEPT;
|
void update_devs() NL_NOEXCEPT;
|
||||||
@ -1403,18 +1407,6 @@ namespace netlist
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: this could be removed after testing
|
|
||||||
inline void detail::net_t::reschedule_in_queue(const netlist_time delay) NL_NOEXCEPT
|
|
||||||
{
|
|
||||||
if (is_queued())
|
|
||||||
netlist().queue().remove(this);
|
|
||||||
|
|
||||||
m_time = netlist().time() + delay;
|
|
||||||
m_in_queue = (m_active > 0); /* queued ? */
|
|
||||||
if (m_in_queue)
|
|
||||||
netlist().queue().push(queue_t::entry_t(m_time, this));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const analog_net_t & analog_t::net() const NL_NOEXCEPT
|
inline const analog_net_t & analog_t::net() const NL_NOEXCEPT
|
||||||
{
|
{
|
||||||
return static_cast<const analog_net_t &>(core_terminal_t::net());
|
return static_cast<const analog_net_t &>(core_terminal_t::net());
|
||||||
@ -1452,8 +1444,7 @@ namespace netlist
|
|||||||
if (newQ != m_my_net.Q_Analog())
|
if (newQ != m_my_net.Q_Analog())
|
||||||
{
|
{
|
||||||
m_my_net.set_Q_Analog(newQ);
|
m_my_net.set_Q_Analog(newQ);
|
||||||
m_my_net.toggle_new_Q();
|
m_my_net.toggle_and_push_to_queue(NLTIME_FROM_NS(1));
|
||||||
m_my_net.push_to_queue(NLTIME_FROM_NS(1));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -380,8 +380,7 @@ void matrix_solver_t::update() NL_NOEXCEPT
|
|||||||
|
|
||||||
if (m_params.m_dynamic_ts && has_timestep_devices() && new_timestep > netlist_time::zero())
|
if (m_params.m_dynamic_ts && has_timestep_devices() && new_timestep > netlist_time::zero())
|
||||||
{
|
{
|
||||||
m_Q_sync.net().force_queue_execution();
|
m_Q_sync.net().toggle_and_push_to_queue(new_timestep);
|
||||||
m_Q_sync.net().reschedule_in_queue(new_timestep);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,8 +391,7 @@ void matrix_solver_t::update_forced()
|
|||||||
|
|
||||||
if (m_params.m_dynamic_ts && has_timestep_devices())
|
if (m_params.m_dynamic_ts && has_timestep_devices())
|
||||||
{
|
{
|
||||||
m_Q_sync.net().force_queue_execution();
|
m_Q_sync.net().toggle_and_push_to_queue(netlist_time::from_double(m_params.m_min_timestep));
|
||||||
m_Q_sync.net().reschedule_in_queue(netlist_time::from_double(m_params.m_min_timestep));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -424,8 +422,7 @@ void matrix_solver_t::solve_base()
|
|||||||
if (this_resched > 1 && !m_Q_sync.net().is_queued())
|
if (this_resched > 1 && !m_Q_sync.net().is_queued())
|
||||||
{
|
{
|
||||||
log().warning(MW_1_NEWTON_LOOPS_EXCEEDED_ON_NET_1, this->name());
|
log().warning(MW_1_NEWTON_LOOPS_EXCEEDED_ON_NET_1, this->name());
|
||||||
m_Q_sync.net().toggle_new_Q();
|
m_Q_sync.net().toggle_and_push_to_queue(m_params.m_nr_recalc_delay);
|
||||||
m_Q_sync.net().reschedule_in_queue(m_params.m_nr_recalc_delay);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -125,8 +125,7 @@ public:
|
|||||||
void update_forced();
|
void update_forced();
|
||||||
void update_after(const netlist_time &after)
|
void update_after(const netlist_time &after)
|
||||||
{
|
{
|
||||||
m_Q_sync.net().force_queue_execution();
|
m_Q_sync.net().toggle_and_push_to_queue(after);
|
||||||
m_Q_sync.net().reschedule_in_queue(after);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* netdevice functions */
|
/* netdevice functions */
|
||||||
|
@ -136,8 +136,7 @@ NETLIB_UPDATE(solver)
|
|||||||
/* step circuit */
|
/* step circuit */
|
||||||
if (!m_Q_step.net().is_queued())
|
if (!m_Q_step.net().is_queued())
|
||||||
{
|
{
|
||||||
m_Q_step.net().toggle_new_Q();
|
m_Q_step.net().toggle_and_push_to_queue(netlist_time::from_double(m_params.m_max_timestep));
|
||||||
m_Q_step.net().push_to_queue(netlist_time::from_double(m_params.m_max_timestep));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ nl_convert_base_t::unit_t nl_convert_base_t::m_units[] = {
|
|||||||
{"M", "CAP_M({1})", 1.0e-3 },
|
{"M", "CAP_M({1})", 1.0e-3 },
|
||||||
{"u", "CAP_U({1})", 1.0e-6 }, /* eagle */
|
{"u", "CAP_U({1})", 1.0e-6 }, /* eagle */
|
||||||
{"U", "CAP_U({1})", 1.0e-6 },
|
{"U", "CAP_U({1})", 1.0e-6 },
|
||||||
{"??", "CAP_U({1})", 1.0e-6 }, /* FIXME */
|
{"μ", "CAP_U({1})", 1.0e-6 },
|
||||||
{"N", "CAP_N({1})", 1.0e-9 },
|
{"N", "CAP_N({1})", 1.0e-9 },
|
||||||
{"pF", "CAP_P({1})", 1.0e-12},
|
{"pF", "CAP_P({1})", 1.0e-12},
|
||||||
{"P", "CAP_P({1})", 1.0e-12},
|
{"P", "CAP_P({1})", 1.0e-12},
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
#include "cpu/m6800/m6800.h"
|
#include "cpu/m6800/m6800.h"
|
||||||
#include "sound/discrete.h"
|
#include "sound/discrete.h"
|
||||||
#include "audio/irem.h"
|
#include "audio/irem.h"
|
||||||
#include "netlist/devices/net_lib.h"
|
|
||||||
|
|
||||||
const device_type IREM_M62_AUDIO = &device_creator<m62_audio_device>;
|
const device_type IREM_M62_AUDIO = &device_creator<m62_audio_device>;
|
||||||
const device_type IREM_M52_SOUNDC_AUDIO = &device_creator<m52_soundc_audio_device>;
|
const device_type IREM_M52_SOUNDC_AUDIO = &device_creator<m52_soundc_audio_device>;
|
||||||
|
Loading…
Reference in New Issue
Block a user