mirror of
https://github.com/holub/mame
synced 2025-10-04 08:28:39 +03:00
Removed some dead code and ambiguous functions in the netlist code. [Couriersud]
This commit is contained in:
parent
791249f277
commit
a122e599ee
@ -20,10 +20,8 @@ NETLIST_START(msx)
|
||||
NETDEV_ANALOG_INPUT(V5, 5)
|
||||
NETDEV_ANALOG_INPUT(V12, 12)
|
||||
|
||||
NETDEV_ANALOG_INPUT(SOUND)
|
||||
NETDEV_PARAM(SOUND.OUT, 5)
|
||||
NETDEV_ANALOG_INPUT(SND)
|
||||
NETDEV_PARAM(SND.OUT, 5)
|
||||
NETDEV_ANALOG_INPUT(SOUND, 5)
|
||||
NETDEV_ANALOG_INPUT(SND, 5)
|
||||
|
||||
NET_MODEL(".model ss9014 NPN(is=2.87599e-14 bf=377.5 vaf=123 ikf=1.1841 ise=4.7863e-15 ne=1.5 br=4.79 var=11.29 ikr=0.275423 isc=1.44544e-14 nc=1.5 rb=200 irb=1e-5 rbm=10 re=0.56 rc=5 cje=1.7205e-11 vje=0.6905907 mje=0.3193434 tf=5.89463e-10 cjc=6.2956p vjc=0.4164212 mjc=0.2559546 xcjc=0.451391 xtb=1.8881 eg=1.2415 xti=3 fc=0.5 Vceo=45 Icrating=0.1 mfg=Fairchild)")
|
||||
|
||||
|
@ -66,9 +66,9 @@ NETLIB_START(QBJT_switch)
|
||||
register_subalias("E", m_RB.m_N);
|
||||
register_subalias("C", m_RC.m_P);
|
||||
|
||||
setup().connect(m_RB.m_N, m_RC.m_N);
|
||||
setup().connect(m_RB.m_P, m_BV);
|
||||
setup().connect(m_RB.m_N, m_EV);
|
||||
connect(m_RB.m_N, m_RC.m_N);
|
||||
connect(m_RB.m_P, m_BV);
|
||||
connect(m_RB.m_N, m_EV);
|
||||
|
||||
save(NAME(m_state_on));
|
||||
|
||||
@ -135,12 +135,12 @@ NETLIB_START(QBJT_EB)
|
||||
register_terminal("_B3", m_I_BC.m_P);
|
||||
register_terminal("_C1", m_I_BC.m_N);
|
||||
|
||||
setup().connect(m_D_BE.m_P, m_D_BC.m_P);
|
||||
setup().connect(m_D_BE.m_P, m_I_BE.m_P);
|
||||
setup().connect(m_D_BE.m_P, m_I_BC.m_P);
|
||||
connect(m_D_BE.m_P, m_D_BC.m_P);
|
||||
connect(m_D_BE.m_P, m_I_BE.m_P);
|
||||
connect(m_D_BE.m_P, m_I_BC.m_P);
|
||||
|
||||
setup().connect(m_D_BE.m_N, m_I_BE.m_N);
|
||||
setup().connect(m_D_BC.m_N, m_I_BC.m_N);
|
||||
connect(m_D_BE.m_N, m_I_BE.m_N);
|
||||
connect(m_D_BC.m_N, m_I_BC.m_N);
|
||||
|
||||
m_gD_BE.save("m_D_BE", *this);
|
||||
m_gD_BC.save("m_D_BC", *this);
|
||||
|
@ -29,8 +29,8 @@ ATTR_COLD void NETLIB_NAME(VCCS)::configure(const double Gfac, const double GI)
|
||||
register_terminal("OP", m_OP);
|
||||
register_terminal("ON", m_ON);
|
||||
|
||||
m_OP1.init_object(*this, name() + ".OP1", netlist_core_terminal_t::STATE_INP_ACTIVE);
|
||||
m_ON1.init_object(*this, name() + ".ON1", netlist_core_terminal_t::STATE_INP_ACTIVE);
|
||||
m_OP1.init_object(*this, name() + ".OP1");
|
||||
m_ON1.init_object(*this, name() + ".ON1");
|
||||
|
||||
const double m_mult = m_G.Value() * Gfac; // 1.0 ==> 1V ==> 1A
|
||||
m_IP.set(GI);
|
||||
@ -48,8 +48,8 @@ ATTR_COLD void NETLIB_NAME(VCCS)::configure(const double Gfac, const double GI)
|
||||
m_ON1.set(m_mult, 0.0);
|
||||
m_ON1.m_otherterm = &m_IN;
|
||||
|
||||
setup().connect(m_OP, m_OP1);
|
||||
setup().connect(m_ON, m_ON1);
|
||||
connect(m_OP, m_OP1);
|
||||
connect(m_ON, m_ON1);
|
||||
}
|
||||
|
||||
NETLIB_UPDATE_PARAM(VCCS)
|
||||
@ -81,16 +81,16 @@ NETLIB_START(VCVS)
|
||||
|
||||
configure(gRO, NETLIST_GMIN);
|
||||
|
||||
m_OP2.init_object(*this, "OP2", netlist_core_terminal_t::STATE_INP_ACTIVE);
|
||||
m_ON2.init_object(*this, "ON2", netlist_core_terminal_t::STATE_INP_ACTIVE);
|
||||
m_OP2.init_object(*this, "OP2");
|
||||
m_ON2.init_object(*this, "ON2");
|
||||
|
||||
m_OP2.set(gRO);
|
||||
m_ON2.set(gRO);
|
||||
m_OP2.m_otherterm = &m_ON2;
|
||||
m_ON2.m_otherterm = &m_OP2;
|
||||
|
||||
setup().connect(m_OP2, m_OP1);
|
||||
setup().connect(m_ON2, m_ON1);
|
||||
connect(m_OP2, m_OP1);
|
||||
connect(m_ON2, m_ON1);
|
||||
}
|
||||
|
||||
NETLIB_UPDATE_PARAM(VCVS)
|
||||
|
@ -259,13 +259,11 @@ NETLIB_START(solver)
|
||||
|
||||
// internal staff
|
||||
|
||||
register_input("FB_sync", m_fb_sync, netlist_input_t::STATE_INP_ACTIVE);
|
||||
register_input("FB_step", m_fb_step, netlist_input_t::STATE_INP_ACTIVE);
|
||||
register_input("FB_sync", m_fb_sync);
|
||||
register_input("FB_step", m_fb_step);
|
||||
|
||||
setup().connect(m_fb_sync, m_Q_sync);
|
||||
setup().connect(m_fb_step, m_Q_step);
|
||||
|
||||
m_last_step = netlist_time::zero;
|
||||
connect(m_fb_sync, m_Q_sync);
|
||||
connect(m_fb_step, m_Q_step);
|
||||
|
||||
save(NAME(m_last_step));
|
||||
|
||||
|
@ -16,7 +16,7 @@ NETLIB_START(switch2)
|
||||
|
||||
register_param("POS", m_POS, 0);
|
||||
|
||||
setup().connect(m_R[0].m_N, m_R[1].m_N);
|
||||
connect(m_R[0].m_N, m_R[1].m_N);
|
||||
|
||||
register_subalias("i1", m_R[0].m_P);
|
||||
register_subalias("i2", m_R[1].m_P);
|
||||
|
@ -96,7 +96,7 @@ NETLIB_START(POT)
|
||||
register_subalias("2", m_R1.m_N);
|
||||
register_subalias("3", m_R2.m_N);
|
||||
|
||||
setup().connect(m_R2.m_P, m_R1.m_N);
|
||||
connect(m_R2.m_P, m_R1.m_N);
|
||||
|
||||
register_param("R", m_R, 1.0 / NETLIST_GMIN);
|
||||
register_param("DIAL", m_Dial, 0.5);
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
NETLIB_START(nic74107Asub)
|
||||
{
|
||||
register_input("CLK", m_clk, netlist_input_t::STATE_INP_HL);
|
||||
register_input("CLK", m_clk);
|
||||
register_output("Q", m_Q);
|
||||
register_output("QQ", m_QQ);
|
||||
|
||||
@ -18,6 +18,7 @@ NETLIB_START(nic74107Asub)
|
||||
|
||||
NETLIB_RESET(nic74107Asub)
|
||||
{
|
||||
m_clk.set_state(netlist_input_t::STATE_INP_HL);
|
||||
m_Q.initial(0);
|
||||
m_QQ.initial(1);
|
||||
|
||||
|
@ -64,7 +64,7 @@ NETLIB_RESET(7474)
|
||||
|
||||
NETLIB_START(7474sub)
|
||||
{
|
||||
register_input("CLK", m_clk, netlist_input_t::STATE_INP_LH);
|
||||
register_input("CLK", m_clk);
|
||||
|
||||
register_output("Q", m_Q);
|
||||
register_output("QQ", m_QQ);
|
||||
@ -74,6 +74,8 @@ NETLIB_START(7474sub)
|
||||
|
||||
NETLIB_RESET(7474sub)
|
||||
{
|
||||
m_clk.set_state(netlist_input_t::STATE_INP_LH);
|
||||
|
||||
m_nextD = 0;
|
||||
m_Q.initial(1);
|
||||
m_QQ.initial(0);
|
||||
|
@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
#include "nld_7493.h"
|
||||
#include "../nl_setup.h"
|
||||
|
||||
NETLIB_START(7493)
|
||||
{
|
||||
@ -22,8 +23,8 @@ NETLIB_START(7493)
|
||||
register_subalias("QC", C.m_Q);
|
||||
register_subalias("QD", D.m_Q);
|
||||
|
||||
register_link_internal(C, C.m_I, B.m_Q, netlist_input_t::STATE_INP_HL);
|
||||
register_link_internal(D, D.m_I, C.m_Q, netlist_input_t::STATE_INP_HL);
|
||||
connect(C.m_I, B.m_Q);
|
||||
connect(D.m_I, C.m_Q);
|
||||
}
|
||||
|
||||
NETLIB_RESET(7493)
|
||||
@ -36,7 +37,7 @@ NETLIB_RESET(7493)
|
||||
|
||||
NETLIB_START(7493ff)
|
||||
{
|
||||
register_input("CLK", m_I, netlist_input_t::STATE_INP_HL);
|
||||
register_input("CLK", m_I);
|
||||
register_output("Q", m_Q);
|
||||
|
||||
save(NAME(m_reset));
|
||||
@ -45,6 +46,7 @@ NETLIB_START(7493ff)
|
||||
NETLIB_RESET(7493ff)
|
||||
{
|
||||
m_reset = 0;
|
||||
m_I.set_state(netlist_input_t::STATE_INP_HL);
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(7493ff)
|
||||
|
@ -36,12 +36,12 @@ NETLIB_RESET(9316)
|
||||
|
||||
NETLIB_START(9316_sub)
|
||||
{
|
||||
register_input("CLK", m_clk, netlist_input_t::STATE_INP_LH);
|
||||
register_input("CLK", m_clk);
|
||||
|
||||
register_input("A", m_A, netlist_input_t::STATE_INP_PASSIVE);
|
||||
register_input("B", m_B, netlist_input_t::STATE_INP_PASSIVE);
|
||||
register_input("C", m_C, netlist_input_t::STATE_INP_PASSIVE);
|
||||
register_input("D", m_D, netlist_input_t::STATE_INP_PASSIVE);
|
||||
register_input("A", m_A);
|
||||
register_input("B", m_B);
|
||||
register_input("C", m_C);
|
||||
register_input("D", m_D);
|
||||
|
||||
register_output("QA", m_QA);
|
||||
register_output("QB", m_QB);
|
||||
@ -56,6 +56,12 @@ NETLIB_START(9316_sub)
|
||||
|
||||
NETLIB_RESET(9316_sub)
|
||||
{
|
||||
m_clk.set_state(netlist_input_t::STATE_INP_LH);
|
||||
m_A.set_state(netlist_input_t::STATE_INP_PASSIVE);
|
||||
m_B.set_state(netlist_input_t::STATE_INP_PASSIVE);
|
||||
m_C.set_state(netlist_input_t::STATE_INP_PASSIVE);
|
||||
m_D.set_state(netlist_input_t::STATE_INP_PASSIVE);
|
||||
|
||||
m_cnt = 0;
|
||||
m_loadq = 1;
|
||||
m_ent = 1;
|
||||
|
@ -37,9 +37,9 @@ NETLIB_START(NE555)
|
||||
register_subalias("DISCH", m_RDIS.m_P); // Pin 7
|
||||
register_subalias("VCC", m_R1.m_P); // Pin 8
|
||||
|
||||
setup().connect(m_R1.m_N, m_R2.m_P);
|
||||
setup().connect(m_R2.m_N, m_R3.m_P);
|
||||
setup().connect(m_RDIS.m_N, m_R3.m_N);
|
||||
connect(m_R1.m_N, m_R2.m_P);
|
||||
connect(m_R2.m_N, m_R3.m_P);
|
||||
connect(m_RDIS.m_N, m_R3.m_N);
|
||||
|
||||
save(NAME(m_last_out));
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ public:
|
||||
register_output("Q", m_Q);
|
||||
for (int i=0; i < 2; i++)
|
||||
{
|
||||
register_input(sIN[i], m_i[i], netlist_input_t::STATE_INP_ACTIVE);
|
||||
register_input(sIN[i], m_i[i]);
|
||||
}
|
||||
save(NAME(m_active));
|
||||
}
|
||||
|
@ -12,12 +12,12 @@
|
||||
NETLIB_START(clock)
|
||||
{
|
||||
register_output("Q", m_Q);
|
||||
//register_input("FB", m_feedback);
|
||||
register_input("FB", m_feedback);
|
||||
|
||||
register_param("FREQ", m_freq, 7159000.0 * 5.0);
|
||||
m_inc = netlist_time::from_hz(m_freq.Value()*2);
|
||||
|
||||
register_link_internal(m_feedback, m_Q, netlist_input_t::STATE_INP_ACTIVE);
|
||||
connect(m_feedback, m_Q);
|
||||
|
||||
}
|
||||
|
||||
|
@ -73,6 +73,90 @@ NETLIB_DEVICE_WITH_PARAMS(analog_input,
|
||||
netlist_param_double_t m_IN;
|
||||
);
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// netdev_a_to_d
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
class nld_a_to_d_proxy : public netlist_device_t
|
||||
{
|
||||
public:
|
||||
ATTR_COLD nld_a_to_d_proxy(netlist_input_t &in_proxied)
|
||||
: netlist_device_t()
|
||||
{
|
||||
assert(in_proxied.family() == LOGIC);
|
||||
m_I.m_high_thresh_V = in_proxied.m_high_thresh_V;
|
||||
m_I.m_low_thresh_V = in_proxied.m_low_thresh_V;
|
||||
}
|
||||
|
||||
ATTR_COLD virtual ~nld_a_to_d_proxy() {}
|
||||
|
||||
netlist_analog_input_t m_I;
|
||||
netlist_ttl_output_t m_Q;
|
||||
|
||||
protected:
|
||||
ATTR_COLD void start()
|
||||
{
|
||||
register_input("I", m_I);
|
||||
register_output("Q", m_Q);
|
||||
}
|
||||
|
||||
ATTR_COLD void reset()
|
||||
{
|
||||
m_Q.initial(1);
|
||||
}
|
||||
|
||||
ATTR_HOT ATTR_ALIGN void update()
|
||||
{
|
||||
if (m_I.Q_Analog() > m_I.m_high_thresh_V)
|
||||
OUTLOGIC(m_Q, 1, NLTIME_FROM_NS(1));
|
||||
else if (m_I.Q_Analog() < m_I.m_low_thresh_V)
|
||||
OUTLOGIC(m_Q, 0, NLTIME_FROM_NS(1));
|
||||
//else
|
||||
// OUTLOGIC(m_Q, m_Q.net().last_Q(), NLTIME_FROM_NS(1));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// netdev_d_to_a
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
class nld_d_to_a_proxy : public netlist_device_t
|
||||
{
|
||||
public:
|
||||
ATTR_COLD nld_d_to_a_proxy(netlist_output_t &out_proxied)
|
||||
: netlist_device_t()
|
||||
{
|
||||
assert(out_proxied.family() == LOGIC);
|
||||
m_low_V = out_proxied.m_low_V;
|
||||
m_high_V = out_proxied.m_high_V;
|
||||
}
|
||||
|
||||
ATTR_COLD virtual ~nld_d_to_a_proxy() {}
|
||||
|
||||
netlist_ttl_input_t m_I;
|
||||
netlist_analog_output_t m_Q;
|
||||
|
||||
protected:
|
||||
ATTR_COLD void start()
|
||||
{
|
||||
register_input("I", m_I);
|
||||
register_output("Q", m_Q);
|
||||
}
|
||||
|
||||
ATTR_COLD void reset()
|
||||
{
|
||||
m_Q.initial(0);
|
||||
}
|
||||
|
||||
ATTR_HOT ATTR_ALIGN void update()
|
||||
{
|
||||
OUTANALOG(m_Q, INPLOGIC(m_I) ? m_high_V : m_low_V, NLTIME_FROM_NS(1));
|
||||
}
|
||||
|
||||
private:
|
||||
double m_low_V;
|
||||
double m_high_V;
|
||||
};
|
||||
|
||||
#endif /* NLD_SYSTEM_H_ */
|
||||
|
@ -167,7 +167,6 @@ ATTR_COLD void netlist_base_t::set_solver_dev(NETLIB_NAME(solver) *dev)
|
||||
|
||||
ATTR_COLD void netlist_base_t::reset()
|
||||
{
|
||||
printf("in reset\n");
|
||||
m_time_ps = netlist_time::zero;
|
||||
m_queue.clear();
|
||||
if (m_mainclock != NULL)
|
||||
@ -177,7 +176,7 @@ ATTR_COLD void netlist_base_t::reset()
|
||||
|
||||
// Reset all nets once !
|
||||
for (int i = 0; i < m_nets.count(); i++)
|
||||
m_nets[i]->reset();
|
||||
m_nets[i]->do_reset();
|
||||
|
||||
// Reset all devices once !
|
||||
for (tagmap_devices_t::entry_t *entry = m_devices.first(); entry != NULL; entry = m_devices.next(entry))
|
||||
@ -362,58 +361,28 @@ ATTR_COLD void netlist_device_t::register_subalias(const pstring &name, netlist_
|
||||
|
||||
ATTR_COLD void netlist_device_t::register_terminal(const pstring &name, netlist_terminal_t &port)
|
||||
{
|
||||
setup().register_object(*this, name, port, netlist_terminal_t::STATE_INP_ACTIVE);
|
||||
setup().register_object(*this, name, port);
|
||||
if (port.isType(netlist_terminal_t::INPUT) || port.isType(netlist_terminal_t::TERMINAL))
|
||||
m_terminals.add(port.name());
|
||||
}
|
||||
|
||||
ATTR_COLD void netlist_device_t::register_output(const pstring &name, netlist_output_t &port)
|
||||
{
|
||||
setup().register_object(*this, name, port, netlist_terminal_t::STATE_OUT);
|
||||
setup().register_object(*this, name, port);
|
||||
}
|
||||
|
||||
ATTR_COLD void netlist_device_t::register_input(const pstring &name, netlist_input_t &inp, netlist_input_t::state_e type)
|
||||
ATTR_COLD void netlist_device_t::register_input(const pstring &name, netlist_input_t &inp)
|
||||
{
|
||||
setup().register_object(*this, name, inp, type);
|
||||
// FIXME: change register_object as well
|
||||
setup().register_object(*this, name, inp);
|
||||
m_terminals.add(inp.name());
|
||||
}
|
||||
|
||||
//FIXME: Get rid of this
|
||||
static void init_term(netlist_core_device_t &dev, netlist_core_terminal_t &term, netlist_input_t::state_e aState)
|
||||
ATTR_COLD void netlist_device_t::connect(netlist_core_terminal_t &t1, netlist_core_terminal_t &t2)
|
||||
{
|
||||
if (!term.isInitalized())
|
||||
{
|
||||
switch (term.type())
|
||||
{
|
||||
case netlist_terminal_t::OUTPUT:
|
||||
dynamic_cast<netlist_output_t &>(term).init_object(dev, dev.name() + ".INTOUT");
|
||||
break;
|
||||
case netlist_terminal_t::INPUT:
|
||||
dynamic_cast<netlist_input_t &>(term).init_object(dev, dev.name() + ".INTINP", aState);
|
||||
break;
|
||||
case netlist_terminal_t::TERMINAL:
|
||||
dynamic_cast<netlist_terminal_t &>(term).init_object(dev, dev.name() + ".INTTERM", aState);
|
||||
break;
|
||||
default:
|
||||
dev.netlist().error("Unknown terminal type");
|
||||
break;
|
||||
}
|
||||
}
|
||||
setup().connect(t1, t2);
|
||||
}
|
||||
|
||||
// FIXME: Revise internal links ...
|
||||
//FIXME: Get rid of this
|
||||
ATTR_COLD void netlist_device_t::register_link_internal(netlist_core_device_t &dev, netlist_input_t &in, netlist_output_t &out, const netlist_input_t::state_e aState)
|
||||
{
|
||||
init_term(dev, in, aState);
|
||||
init_term(dev, out, aState);
|
||||
setup().connect(in, out);
|
||||
}
|
||||
|
||||
ATTR_COLD void netlist_device_t::register_link_internal(netlist_input_t &in, netlist_output_t &out, const netlist_input_t::state_e aState)
|
||||
{
|
||||
register_link_internal(*this, in, out, aState);
|
||||
}
|
||||
|
||||
template <class C, class T>
|
||||
ATTR_COLD void netlist_device_t::register_param(const pstring &sname, C ¶m, const T initialVal)
|
||||
@ -422,7 +391,7 @@ ATTR_COLD void netlist_device_t::register_param(const pstring &sname, C ¶m,
|
||||
param.init_object(*this, fullname);
|
||||
param.initial(initialVal);
|
||||
//FIXME: pass fullname from above
|
||||
setup().register_object(*this, fullname, param, netlist_terminal_t::STATE_NONEX);
|
||||
setup().register_object(*this, fullname, param);
|
||||
}
|
||||
|
||||
template ATTR_COLD void netlist_device_t::register_param(const pstring &sname, netlist_param_double_t ¶m, const double initialVal);
|
||||
@ -461,8 +430,15 @@ ATTR_COLD void netlist_net_t::reset()
|
||||
m_new.Q = 0;
|
||||
m_cur.Q = 0;
|
||||
m_time = netlist_time::zero;
|
||||
//m_active = 0; // FIXME
|
||||
m_active = 0;
|
||||
m_in_queue = 2;
|
||||
|
||||
for (netlist_core_terminal_t *t = m_head; t != NULL; t = t->m_update_list_next)
|
||||
{
|
||||
t->do_reset();
|
||||
if (t->state() != netlist_input_t::STATE_INP_PASSIVE)
|
||||
m_active++;
|
||||
}
|
||||
}
|
||||
|
||||
ATTR_COLD void netlist_net_t::init_object(netlist_base_t &nl, const pstring &aname)
|
||||
@ -587,12 +563,6 @@ ATTR_COLD netlist_terminal_t::netlist_terminal_t()
|
||||
{
|
||||
}
|
||||
|
||||
ATTR_COLD void netlist_core_terminal_t::init_object(netlist_core_device_t &dev, const pstring &aname, const state_e astate)
|
||||
{
|
||||
set_state(astate);
|
||||
netlist_owned_object_t::init_object(dev, aname);
|
||||
}
|
||||
|
||||
ATTR_COLD void netlist_core_terminal_t::set_net(netlist_net_t &anet)
|
||||
{
|
||||
m_net = &anet;
|
||||
@ -618,7 +588,7 @@ netlist_output_t::netlist_output_t(const type_t atype, const family_t afamily)
|
||||
|
||||
ATTR_COLD void netlist_output_t::init_object(netlist_core_device_t &dev, const pstring &aname)
|
||||
{
|
||||
netlist_core_terminal_t::init_object(dev, aname, STATE_OUT);
|
||||
netlist_core_terminal_t::init_object(dev, aname);
|
||||
net().init_object(dev.netlist(), aname + ".net");
|
||||
net().register_railterminal(*this);
|
||||
}
|
||||
@ -795,3 +765,23 @@ NETLIB_UPDATE(mainclock)
|
||||
net.m_new.Q = !net.m_new.Q;
|
||||
net.set_time(netlist().time() + m_inc);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// net_device_t_base_factory
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
ATTR_COLD const nl_util::pstring_list net_device_t_base_factory::term_param_list()
|
||||
{
|
||||
if (m_def_param.startsWith("+"))
|
||||
return nl_util::split(m_def_param.substr(1), ",");
|
||||
else
|
||||
return nl_util::pstring_list();
|
||||
}
|
||||
|
||||
ATTR_COLD const pstring net_device_t_base_factory::def_param()
|
||||
{
|
||||
if (m_def_param.startsWith("+") || m_def_param.equals("-"))
|
||||
return "";
|
||||
else
|
||||
return m_def_param;
|
||||
}
|
||||
|
@ -300,8 +300,14 @@ public:
|
||||
ATTR_HOT inline netlist_base_t & RESTRICT netlist() { return *m_netlist; }
|
||||
ATTR_HOT inline const netlist_base_t & RESTRICT netlist() const { return *m_netlist; }
|
||||
|
||||
ATTR_COLD void inline do_reset()
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
ATTR_COLD virtual void reset() = 0;
|
||||
// must call parent save_register !
|
||||
ATTR_COLD virtual void save_register() { };
|
||||
|
||||
@ -354,7 +360,7 @@ public:
|
||||
|
||||
ATTR_COLD netlist_core_terminal_t(const type_t atype, const family_t afamily);
|
||||
|
||||
ATTR_COLD void init_object(netlist_core_device_t &dev, const pstring &aname, const state_e astate);
|
||||
//ATTR_COLD void init_object(netlist_core_device_t &dev, const pstring &aname);
|
||||
|
||||
ATTR_COLD void set_net(netlist_net_t &anet);
|
||||
ATTR_COLD inline bool has_net() const { return (m_net != NULL); }
|
||||
@ -428,6 +434,12 @@ protected:
|
||||
netlist_core_terminal_t::save_register();
|
||||
}
|
||||
|
||||
ATTR_COLD virtual void reset()
|
||||
{
|
||||
set_state(STATE_INP_ACTIVE);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -456,6 +468,12 @@ public:
|
||||
double m_low_thresh_V;
|
||||
double m_high_thresh_V;
|
||||
|
||||
protected:
|
||||
ATTR_COLD virtual void reset()
|
||||
{
|
||||
set_state(STATE_INP_ACTIVE);
|
||||
}
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
@ -536,7 +554,6 @@ public:
|
||||
|
||||
ATTR_COLD netlist_net_t(const type_t atype, const family_t afamily);
|
||||
ATTR_COLD void init_object(netlist_base_t &nl, const pstring &aname);
|
||||
ATTR_COLD void reset();
|
||||
|
||||
ATTR_COLD void register_con(netlist_core_terminal_t &terminal);
|
||||
ATTR_COLD void merge_net(netlist_net_t *othernet);
|
||||
@ -644,6 +661,7 @@ protected:
|
||||
{
|
||||
//assert_always(false, "trying too early to register state in netlist_net_t");
|
||||
}
|
||||
ATTR_COLD virtual void reset();
|
||||
|
||||
|
||||
private:
|
||||
@ -673,7 +691,10 @@ public:
|
||||
double m_low_V;
|
||||
double m_high_V;
|
||||
|
||||
protected:
|
||||
ATTR_COLD virtual void reset()
|
||||
{
|
||||
set_state(STATE_OUT);
|
||||
}
|
||||
|
||||
private:
|
||||
netlist_net_t m_my_net;
|
||||
@ -749,6 +770,10 @@ public:
|
||||
|
||||
ATTR_HOT inline const param_type_t param_type() const { return m_param_type; }
|
||||
|
||||
protected:
|
||||
|
||||
ATTR_COLD virtual void reset() { }
|
||||
|
||||
private:
|
||||
const param_type_t m_param_type;
|
||||
};
|
||||
@ -915,16 +940,10 @@ public:
|
||||
net_update_delegate static_update;
|
||||
#endif
|
||||
|
||||
ATTR_COLD void inline do_reset()
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
ATTR_HOT virtual void update() { }
|
||||
ATTR_COLD virtual void start() { }
|
||||
ATTR_COLD virtual void reset() = 0;
|
||||
|
||||
private:
|
||||
};
|
||||
@ -946,17 +965,12 @@ public:
|
||||
|
||||
ATTR_COLD void register_sub(netlist_device_t &dev, const pstring &name);
|
||||
ATTR_COLD void register_subalias(const pstring &name, netlist_core_terminal_t &term);
|
||||
|
||||
ATTR_COLD void register_terminal(const pstring &name, netlist_terminal_t &port);
|
||||
|
||||
ATTR_COLD void register_output(const pstring &name, netlist_output_t &out);
|
||||
ATTR_COLD void register_input(const pstring &name, netlist_input_t &in);
|
||||
|
||||
ATTR_COLD void register_input(const pstring &name, netlist_input_t &in, const netlist_input_t::state_e state = netlist_input_t::STATE_INP_ACTIVE);
|
||||
ATTR_COLD void connect(netlist_core_terminal_t &t1, netlist_core_terminal_t &t2);
|
||||
|
||||
ATTR_COLD void register_link_internal(netlist_input_t &in, netlist_output_t &out, const netlist_input_t::state_e aState);
|
||||
ATTR_COLD void register_link_internal(netlist_core_device_t &dev, netlist_input_t &in, netlist_output_t &out, const netlist_input_t::state_e aState);
|
||||
|
||||
/* FIXME: driving logic outputs don't count in here */
|
||||
netlist_list_t<pstring, 20> m_terminals;
|
||||
|
||||
protected:
|
||||
@ -1071,92 +1085,6 @@ private:
|
||||
netlist_setup_t *m_setup;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// netdev_a_to_d
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
class nld_a_to_d_proxy : public netlist_device_t
|
||||
{
|
||||
public:
|
||||
ATTR_COLD nld_a_to_d_proxy(netlist_input_t &in_proxied)
|
||||
: netlist_device_t()
|
||||
{
|
||||
assert(in_proxied.family() == LOGIC);
|
||||
m_I.m_high_thresh_V = in_proxied.m_high_thresh_V;
|
||||
m_I.m_low_thresh_V = in_proxied.m_low_thresh_V;
|
||||
}
|
||||
|
||||
ATTR_COLD virtual ~nld_a_to_d_proxy() {}
|
||||
|
||||
netlist_analog_input_t m_I;
|
||||
netlist_ttl_output_t m_Q;
|
||||
|
||||
protected:
|
||||
ATTR_COLD void start()
|
||||
{
|
||||
register_input("I", m_I, netlist_terminal_t::STATE_INP_ACTIVE);
|
||||
register_output("Q", m_Q);
|
||||
}
|
||||
|
||||
ATTR_COLD void reset()
|
||||
{
|
||||
m_Q.initial(1);
|
||||
}
|
||||
|
||||
ATTR_HOT ATTR_ALIGN void update()
|
||||
{
|
||||
if (m_I.Q_Analog() > m_I.m_high_thresh_V)
|
||||
OUTLOGIC(m_Q, 1, NLTIME_FROM_NS(1));
|
||||
else if (m_I.Q_Analog() < m_I.m_low_thresh_V)
|
||||
OUTLOGIC(m_Q, 0, NLTIME_FROM_NS(1));
|
||||
//else
|
||||
// OUTLOGIC(m_Q, m_Q.net().last_Q(), NLTIME_FROM_NS(1));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// netdev_d_to_a
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
class nld_d_to_a_proxy : public netlist_device_t
|
||||
{
|
||||
public:
|
||||
ATTR_COLD nld_d_to_a_proxy(netlist_output_t &out_proxied)
|
||||
: netlist_device_t()
|
||||
{
|
||||
assert(out_proxied.family() == LOGIC);
|
||||
m_low_V = out_proxied.m_low_V;
|
||||
m_high_V = out_proxied.m_high_V;
|
||||
}
|
||||
|
||||
ATTR_COLD virtual ~nld_d_to_a_proxy() {}
|
||||
|
||||
netlist_ttl_input_t m_I;
|
||||
netlist_analog_output_t m_Q;
|
||||
|
||||
protected:
|
||||
ATTR_COLD void start()
|
||||
{
|
||||
register_input("I", m_I, netlist_terminal_t::STATE_INP_ACTIVE);
|
||||
register_output("Q", m_Q);
|
||||
}
|
||||
|
||||
ATTR_COLD void reset()
|
||||
{
|
||||
m_Q.initial(0);
|
||||
}
|
||||
|
||||
ATTR_HOT ATTR_ALIGN void update()
|
||||
{
|
||||
OUTANALOG(m_Q, INPLOGIC(m_I) ? m_high_V : m_low_V, NLTIME_FROM_NS(1));
|
||||
}
|
||||
|
||||
private:
|
||||
double m_low_V;
|
||||
double m_high_V;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// Inline implementations
|
||||
// ----------------------------------------------------------------------------------------
|
||||
@ -1300,22 +1228,8 @@ public:
|
||||
ATTR_COLD const pstring &name() const { return m_name; }
|
||||
ATTR_COLD const pstring &classname() const { return m_classname; }
|
||||
ATTR_COLD const pstring ¶m_desc() const { return m_def_param; }
|
||||
|
||||
ATTR_COLD const nl_util::pstring_list term_param_list()
|
||||
{
|
||||
if (m_def_param.startsWith("+"))
|
||||
return nl_util::split(m_def_param.substr(1), ",");
|
||||
else
|
||||
return nl_util::pstring_list();
|
||||
}
|
||||
|
||||
ATTR_COLD const pstring def_param()
|
||||
{
|
||||
if (m_def_param.startsWith("+") || m_def_param.equals("-"))
|
||||
return "";
|
||||
else
|
||||
return m_def_param;
|
||||
}
|
||||
ATTR_COLD const nl_util::pstring_list term_param_list();
|
||||
ATTR_COLD const pstring def_param();
|
||||
|
||||
protected:
|
||||
pstring m_name; /* device name */
|
||||
|
@ -146,7 +146,7 @@ pstring netlist_setup_t::objtype_as_astr(netlist_object_t &in)
|
||||
return "Error";
|
||||
}
|
||||
|
||||
void netlist_setup_t::register_object(netlist_device_t &dev, const pstring &name, netlist_object_t &obj, const netlist_input_t::state_e state)
|
||||
void netlist_setup_t::register_object(netlist_device_t &dev, const pstring &name, netlist_object_t &obj)
|
||||
{
|
||||
switch (obj.type())
|
||||
{
|
||||
@ -158,7 +158,7 @@ void netlist_setup_t::register_object(netlist_device_t &dev, const pstring &name
|
||||
if (obj.isType(netlist_terminal_t::OUTPUT))
|
||||
dynamic_cast<netlist_output_t &>(term).init_object(dev, dev.name() + "." + name);
|
||||
else
|
||||
term.init_object(dev, dev.name() + "." + name, state);
|
||||
term.init_object(dev, dev.name() + "." + name);
|
||||
|
||||
if (!(m_terminals.add(term.name(), &term, false)==TMERR_NONE))
|
||||
netlist().error("Error adding %s %s to terminal list\n", objtype_as_astr(term).cstr(), term.name().cstr());
|
||||
|
@ -118,7 +118,7 @@ public:
|
||||
void register_param(const pstring ¶m, const pstring &value);
|
||||
void register_param(const pstring ¶m, const double value);
|
||||
|
||||
void register_object(netlist_device_t &dev, const pstring &name, netlist_object_t &obj, netlist_input_t::state_e state);
|
||||
void register_object(netlist_device_t &dev, const pstring &name, netlist_object_t &obj);
|
||||
void connect(netlist_core_terminal_t &t1, netlist_core_terminal_t &t2);
|
||||
|
||||
netlist_core_terminal_t *find_terminal(const pstring &outname_in, bool required = true);
|
||||
|
Loading…
Reference in New Issue
Block a user