mirror of
https://github.com/holub/mame
synced 2025-04-20 23:42:22 +03:00
netlist: Add NETLIB_DELEGATE_NOOP()
* This should be used for inputs which do not need a handler. * Examples are data inputs which are only accessed on a clock change.
This commit is contained in:
parent
9e401f0b3e
commit
b0e0ac2b24
@ -78,6 +78,10 @@ namespace netlist
|
||||
|
||||
log_type & log();
|
||||
|
||||
void handler_noop()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void timestep(timestep_type ts_type, nl_fptype st) noexcept { plib::unused_var(ts_type, st); }
|
||||
virtual void update_terminals() noexcept { }
|
||||
|
@ -152,6 +152,7 @@ class NETLIB_NAME(name) : public delegator_t<base_device_t>
|
||||
void NETLIB_NAME(cname) :: timestep(timestep_type ts_type, nl_fptype step) noexcept
|
||||
|
||||
#define NETLIB_DELEGATE(name) nldelegate(&this_type :: name, this)
|
||||
#define NETLIB_DELEGATE_NOOP() nldelegate(&core_device_t::handler_noop, static_cast<core_device_t *>(this))
|
||||
|
||||
#define NETLIB_UPDATE_TERMINALSI() virtual void update_terminals() noexcept override
|
||||
#define NETLIB_HANDLERI(name) void name() noexcept
|
||||
|
@ -138,7 +138,7 @@ namespace netlist
|
||||
{
|
||||
public:
|
||||
NETLIB_CONSTRUCTOR(nc_pin)
|
||||
, m_I(*this, "I", NETLIB_DELEGATE(noop))
|
||||
, m_I(*this, "I", NETLIB_DELEGATE_NOOP())
|
||||
{
|
||||
}
|
||||
|
||||
@ -146,10 +146,6 @@ namespace netlist
|
||||
//NETLIB_RESETI() {}
|
||||
|
||||
private:
|
||||
NETLIB_HANDLERI(noop)
|
||||
{
|
||||
}
|
||||
|
||||
analog_input_t m_I;
|
||||
|
||||
};
|
||||
|
@ -36,7 +36,7 @@ namespace netlist
|
||||
{
|
||||
NETLIB_CONSTRUCTOR(74165)
|
||||
, m_DATA(*this, { "H", "G", "F", "E", "D", "C", "B", "A" }, NETLIB_DELEGATE(inputs))
|
||||
, m_SER(*this, "SER", NETLIB_DELEGATE(noop))
|
||||
, m_SER(*this, "SER", NETLIB_DELEGATE_NOOP())
|
||||
, m_SH_LDQ(*this, "SH_LDQ", NETLIB_DELEGATE(inputs))
|
||||
, m_CLK(*this, "CLK", NETLIB_DELEGATE(clk))
|
||||
, m_CLKINH(*this, "CLKINH", NETLIB_DELEGATE(inputs))
|
||||
@ -53,10 +53,6 @@ namespace netlist
|
||||
m_shifter = 0;
|
||||
}
|
||||
|
||||
NETLIB_HANDLERI(noop)
|
||||
{
|
||||
}
|
||||
|
||||
NETLIB_HANDLERI(clk)
|
||||
{
|
||||
unsigned high_bit = m_SER() ? 0x80 : 0;
|
||||
|
@ -48,6 +48,8 @@ namespace netlist
|
||||
static constexpr const std::array<netlist_time, 2> out_delay_CLK_Y = { NLTIME_FROM_NS(20), NLTIME_FROM_NS(26) }; // tPHL, tPLH
|
||||
static constexpr const std::array<netlist_time, 2> out_delay_CLK_Z = { NLTIME_FROM_NS(17), NLTIME_FROM_NS(12) };
|
||||
|
||||
// FIXME: room for improvement -> clock handling
|
||||
|
||||
NETLIB_OBJECT(7497)
|
||||
{
|
||||
NETLIB_CONSTRUCTOR(7497)
|
||||
@ -76,8 +78,6 @@ namespace netlist
|
||||
m_lastclock = 0;
|
||||
}
|
||||
|
||||
NETLIB_HANDLERI(noop) { }
|
||||
|
||||
NETLIB_HANDLERI(unity)
|
||||
{
|
||||
newstate (m_state);
|
||||
|
@ -332,9 +332,10 @@ namespace netlist
|
||||
std::vector<const nldelegate *> t;
|
||||
log().verbose("Using default startup strategy");
|
||||
for (auto &n : m_nets)
|
||||
{
|
||||
n->update_inputs(); // only used if USE_COPY_INSTEAD_OF_REFERENCE == 1
|
||||
for (auto & term : n->core_terms())
|
||||
{
|
||||
n->update_inputs(); // only used if USE_COPY_INSTEAD_OF_REFERENCE == 1
|
||||
if (!plib::container::contains(t, &term->delegate()))
|
||||
{
|
||||
t.push_back(&term->delegate());
|
||||
@ -345,6 +346,7 @@ namespace netlist
|
||||
if (!plib::container::contains(devices_called, dev))
|
||||
devices_called.push_back(dev);
|
||||
}
|
||||
}
|
||||
log().verbose("Devices not yet updated:");
|
||||
for (auto &dev : m_devices)
|
||||
if (!plib::container::contains(devices_called, dev.second.get()))
|
||||
@ -747,8 +749,6 @@ namespace netlist
|
||||
nldelegate delegate)
|
||||
: logic_t(dev, aname, STATE_INP_ACTIVE, delegate)
|
||||
{
|
||||
if (!delegate.is_set())
|
||||
throw nl_exception("delegate not set for {1}", this->name());
|
||||
state().setup().register_term(*this);
|
||||
}
|
||||
|
||||
|
@ -1688,12 +1688,15 @@ void setup_t::prepare_to_run()
|
||||
}
|
||||
|
||||
for (auto &n : m_nlstate.nets())
|
||||
{
|
||||
for (auto & term : n->core_terms())
|
||||
if (!term->delegate().is_set())
|
||||
if (!term->delegate())
|
||||
{
|
||||
log().fatal(MF_DELEGATE_NOT_SET_1(term->name()));
|
||||
throw nl_exception(MF_DELEGATE_NOT_SET_1(term->name()));
|
||||
}
|
||||
n->rebuild_list();
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
@ -368,8 +368,6 @@ namespace plib {
|
||||
bind<const_specific_member_function<O>>(object, &mftp);
|
||||
}
|
||||
|
||||
bool is_set() const noexcept { return m_resolved != nullptr; }
|
||||
|
||||
generic_class *object() const noexcept { return m_obj; }
|
||||
bool has_object() const noexcept { return m_obj != nullptr; }
|
||||
|
||||
@ -384,6 +382,7 @@ namespace plib {
|
||||
return this->call(std::forward<Targs>(args)...);
|
||||
}
|
||||
|
||||
operator bool() const noexcept { return m_resolved != nullptr; }
|
||||
private:
|
||||
template<typename SPC, typename O, typename MF>
|
||||
void bind(O * object, MF *fraw)
|
||||
|
Loading…
Reference in New Issue
Block a user