Netlist code: fixed an issue with 7493 and other minor fixes

This commit is contained in:
Couriersud 2013-10-22 21:01:26 +00:00
parent fca447fa7f
commit 92fe6738fc
4 changed files with 22 additions and 21 deletions

View File

@ -83,7 +83,7 @@ NETLIB_CONSTRUCTOR(netdev_clock)
register_param("FREQ", m_freq, 7159000.0 * 5); register_param("FREQ", m_freq, 7159000.0 * 5);
m_inc = netlist_time::from_hz(m_freq.Value()*2); m_inc = netlist_time::from_hz(m_freq.Value()*2);
register_link_internal(m_feedback, m_Q); register_link_internal(m_feedback, m_Q, net_input_t::INP_STATE_ACTIVE);
} }
@ -223,7 +223,7 @@ NETLIB_CONSTRUCTOR(nicNE555N_MSTABLE)
register_param("VL", m_VL, 0.0 *5.0); register_param("VL", m_VL, 0.0 *5.0);
m_THRESHOLD_OUT.set_netdev(this); m_THRESHOLD_OUT.set_netdev(this);
register_link_internal(m_THRESHOLD, m_THRESHOLD_OUT); register_link_internal(m_THRESHOLD, m_THRESHOLD_OUT, net_input_t::INP_STATE_ACTIVE);
m_Q.initial(5.0 * 0.4); m_Q.initial(5.0 * 0.4);
m_last = false; m_last = false;
@ -471,7 +471,7 @@ NETLIB_UPDATE(nic7450)
INLINE void nic7474_newstate(const UINT8 state, ttl_output_t &Q, ttl_output_t &QQ) INLINE void nic7474_newstate(const UINT8 state, ttl_output_t &Q, ttl_output_t &QQ)
{ {
const netlist_time delay[2] = { NLTIME_FROM_NS(25), NLTIME_FROM_NS(40) }; static const netlist_time delay[2] = { NLTIME_FROM_NS(25), NLTIME_FROM_NS(40) };
//printf("%s %d %d %d\n", "7474", state, Q.Q(), QQ.Q()); //printf("%s %d %d %d\n", "7474", state, Q.Q(), QQ.Q());
Q.setTo(state, delay[state]); Q.setTo(state, delay[state]);
QQ.setTo(!state, delay[!state]); QQ.setTo(!state, delay[!state]);
@ -638,14 +638,14 @@ NETLIB_CONSTRUCTOR(nic7493)
register_output(D, "QD", D.m_Q); register_output(D, "QD", D.m_Q);
//B.register_link_internal(B.m_I, A.m_Q); //B.register_link_internal(B.m_I, A.m_Q);
register_link_internal(C, C.m_I, B.m_Q); register_link_internal(C, C.m_I, B.m_Q, net_input_t::INP_STATE_HL);
register_link_internal(D, D.m_I, C.m_Q); register_link_internal(D, D.m_I, C.m_Q, net_input_t::INP_STATE_HL);
} }
NETLIB_UPDATE(nic7493ff) NETLIB_UPDATE(nic7493ff)
{ {
//if INP_LAST(m_I) && !INP(m_I)) if (m_reset == 0)
m_Q.setTo(!m_Q.new_Q(), NLTIME_FROM_NS(18)); m_Q.setTo(!m_Q.new_Q(), NLTIME_FROM_NS(18));
} }
@ -656,10 +656,9 @@ NETLIB_UPDATE(nic7493)
if (r) if (r)
{ {
//printf("%s reset\n", name()); //printf("%s reset\n", name());
A.m_reset = B.m_reset = C.m_reset = D.m_reset = 1;
A.m_I.inactivate(); A.m_I.inactivate();
B.m_I.inactivate(); B.m_I.inactivate();
C.m_I.inactivate();
D.m_I.inactivate();
A.m_Q.setTo(0, NLTIME_FROM_NS(40)); A.m_Q.setTo(0, NLTIME_FROM_NS(40));
B.m_Q.setTo(0, NLTIME_FROM_NS(40)); B.m_Q.setTo(0, NLTIME_FROM_NS(40));
C.m_Q.setTo(0, NLTIME_FROM_NS(40)); C.m_Q.setTo(0, NLTIME_FROM_NS(40));
@ -667,10 +666,9 @@ NETLIB_UPDATE(nic7493)
} }
else else
{ {
A.m_reset = B.m_reset = C.m_reset = D.m_reset = 0;
A.m_I.activate_hl(); A.m_I.activate_hl();
B.m_I.activate_hl(); B.m_I.activate_hl();
C.m_I.activate_hl();
D.m_I.activate_hl();
//printf("%s enable\n", name()); //printf("%s enable\n", name());
} }
} }

View File

@ -387,6 +387,8 @@ public:
NETLIB_SUBDEVICE(nic7493ff, NETLIB_SUBDEVICE(nic7493ff,
ttl_input_t m_I; ttl_input_t m_I;
ttl_output_t m_Q; ttl_output_t m_Q;
UINT8 m_reset;
); );
#if !USE_OLD7493 #if !USE_OLD7493

View File

@ -489,14 +489,14 @@ ATTR_HOT ATTR_ALIGN void netlist_base_t::process_list(INT32 &atime)
m_mainclock->update(); m_mainclock->update();
mainclock_Q.update_devs(); mainclock_Q.update_devs();
} }
const queue_t::entry_t &e = m_queue.pop(); const queue_t::entry_t &e = m_queue.pop();
update_time(e.time(), atime); update_time(e.time(), atime);
e.object(). e.object().update_devs();
update_devs();
} else { } else {
update_time(mainclock_Q.time(), atime); update_time(mainclock_Q.time(), atime);
@ -853,17 +853,17 @@ void net_device_t::register_input(const char *name, net_input_t &inp, net_input_
register_input(*this, name, inp, type); register_input(*this, name, inp, type);
} }
void net_device_t::register_link_internal(net_core_device_t &dev, net_input_t &in, net_output_t &out) void net_device_t::register_link_internal(net_core_device_t &dev, net_input_t &in, net_output_t &out, net_input_t::net_input_state aState)
{ {
in.set_output(GETINPPTR(out)); in.set_output(GETINPPTR(out));
in.init(&dev); in.init(&dev, aState);
//if (in.state() != net_input_t::INP_STATE_PASSIVE) //if (in.state() != net_input_t::INP_STATE_PASSIVE)
out.register_con(in); out.register_con(in);
} }
void net_device_t::register_link_internal(net_input_t &in, net_output_t &out) void net_device_t::register_link_internal(net_input_t &in, net_output_t &out, net_input_t::net_input_state aState)
{ {
register_link_internal(*this, in, out); register_link_internal(*this, in, out, aState);
} }
void net_device_t::register_param(net_core_device_t &dev, const char *name, net_param_t &param, double initialVal) void net_device_t::register_param(net_core_device_t &dev, const char *name, net_param_t &param, double initialVal)
@ -932,6 +932,7 @@ ATTR_HOT ATTR_ALIGN inline void net_output_t::update_dev(const net_input_t &inp,
ATTR_HOT ATTR_ALIGN inline void net_output_t::update_devs() ATTR_HOT ATTR_ALIGN inline void net_output_t::update_devs()
{ {
assert(m_num_cons != 0); assert(m_num_cons != 0);
const UINT8 masks[4] = { 1, 5, 3, 1 }; const UINT8 masks[4] = { 1, 5, 3, 1 };
@ -960,6 +961,7 @@ ATTR_HOT ATTR_ALIGN inline void net_output_t::update_devs()
} }
m_last_Q = m_Q; m_last_Q = m_Q;
} }
ATTR_COLD void net_output_t::register_con(net_input_t &input) ATTR_COLD void net_output_t::register_con(net_input_t &input)

View File

@ -588,16 +588,15 @@ protected:
double m_Q_analog; double m_Q_analog;
double m_new_Q_analog; double m_new_Q_analog;
netlist_base_t *m_netlist;
int m_num_cons; int m_num_cons;
net_input_t *m_cons[48]; net_input_t *m_cons[48];
net_core_device_t *m_netdev;
double m_low_V; double m_low_V;
double m_high_V; double m_high_V;
net_core_device_t *m_netdev;
netlist_base_t *m_netlist;
}; };
class logic_output_t : public net_output_t class logic_output_t : public net_output_t
@ -723,8 +722,8 @@ public:
ATTR_COLD void register_input(const char *name, net_input_t &in, net_input_t::net_input_state state = net_input_t::INP_STATE_ACTIVE); ATTR_COLD void register_input(const char *name, net_input_t &in, net_input_t::net_input_state state = net_input_t::INP_STATE_ACTIVE);
ATTR_COLD void register_input(net_core_device_t &dev, const char *name, net_input_t &in, net_input_t::net_input_state state = net_input_t::INP_STATE_ACTIVE); ATTR_COLD void register_input(net_core_device_t &dev, const char *name, net_input_t &in, net_input_t::net_input_state state = net_input_t::INP_STATE_ACTIVE);
ATTR_COLD void register_link_internal(net_input_t &in, net_output_t &out); ATTR_COLD void register_link_internal(net_input_t &in, net_output_t &out, net_input_t::net_input_state aState);
ATTR_COLD void register_link_internal(net_core_device_t &dev, net_input_t &in, net_output_t &out); ATTR_COLD void register_link_internal(net_core_device_t &dev, net_input_t &in, net_output_t &out, net_input_t::net_input_state aState);
net_list_t<const char *, 20> m_inputs; net_list_t<const char *, 20> m_inputs;