mirror of
https://github.com/holub/mame
synced 2025-04-22 08:22:15 +03:00
Some class structure cleanup. (nw)
This commit is contained in:
parent
7e88b96660
commit
0bb61ddc43
@ -234,7 +234,7 @@ public:
|
||||
: netlist_device_t()
|
||||
{
|
||||
nl_assert(in_proxied.family() == LOGIC);
|
||||
m_I.m_logic_family = in_proxied.m_logic_family;
|
||||
m_I.set_logic_family(in_proxied.logic_family());
|
||||
}
|
||||
|
||||
ATTR_COLD virtual ~nld_a_to_d_proxy() {}
|
||||
@ -255,9 +255,9 @@ protected:
|
||||
|
||||
ATTR_HOT ATTR_ALIGN void update()
|
||||
{
|
||||
if (m_I.Q_Analog() > m_I.m_logic_family->m_high_thresh_V)
|
||||
if (m_I.Q_Analog() > m_I.logic_family()->m_high_thresh_V)
|
||||
OUTLOGIC(m_Q, 1, NLTIME_FROM_NS(1));
|
||||
else if (m_I.Q_Analog() < m_I.m_logic_family->m_low_thresh_V)
|
||||
else if (m_I.Q_Analog() < m_I.logic_family()->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));
|
||||
@ -276,7 +276,7 @@ public:
|
||||
: netlist_device_t()
|
||||
{
|
||||
nl_assert(out_proxied.family() == LOGIC);
|
||||
m_logic_family = out_proxied.m_logic_family;
|
||||
m_logic_family = out_proxied.logic_family();
|
||||
}
|
||||
|
||||
ATTR_COLD virtual ~nld_base_d_to_a_proxy() {}
|
||||
|
@ -13,27 +13,48 @@
|
||||
|
||||
const netlist_time netlist_time::zero = netlist_time::from_raw(0);
|
||||
|
||||
netlist_logic_family_desc_t netlist_family_TTL =
|
||||
class netlist_logic_family_ttl_t : public netlist_logic_family_desc_t
|
||||
{
|
||||
0.8, // m_low_thresh_V
|
||||
2.0, // m_high_thresh_V
|
||||
0.3, // m_low_V - these depend on sinked/sourced current. Values should be suitable for typical applications.
|
||||
3.7, // m_high_V
|
||||
1.0, // m_R_low;
|
||||
130.0, // m_R_high;
|
||||
public:
|
||||
netlist_logic_family_ttl_t()
|
||||
{
|
||||
m_low_thresh_V = 0.8;
|
||||
m_high_thresh_V = 2.0;
|
||||
// m_low_V - these depend on sinked/sourced current. Values should be suitable for typical applications.
|
||||
m_low_V = 0.3;
|
||||
m_high_V = 3.7;
|
||||
m_R_low = 1.0;
|
||||
m_R_high = 130.0;
|
||||
}
|
||||
virtual nld_base_d_to_a_proxy *create_d_a_proxy(netlist_logic_output_t &proxied) const
|
||||
{
|
||||
return nl_alloc(nld_d_to_a_proxy , proxied);
|
||||
}
|
||||
};
|
||||
|
||||
//FIXME: set to proper values
|
||||
netlist_logic_family_desc_t netlist_family_CD4000 =
|
||||
class netlist_logic_family_cd4000_t : public netlist_logic_family_desc_t
|
||||
{
|
||||
0.8, // m_low_thresh_V
|
||||
2.0, // m_high_thresh_V
|
||||
0.3, // m_low_V - these depend on sinked/sourced current. Values should be suitable for typical applications.
|
||||
3.7, // m_high_V
|
||||
1.0, // m_R_low;
|
||||
130.0, // m_R_high;
|
||||
public:
|
||||
netlist_logic_family_cd4000_t()
|
||||
{
|
||||
m_low_thresh_V = 0.8;
|
||||
m_high_thresh_V = 2.0;
|
||||
// m_low_V - these depend on sinked/sourced current. Values should be suitable for typical applications.
|
||||
m_low_V = 0.3;
|
||||
m_high_V = 3.7;
|
||||
m_R_low = 1.0;
|
||||
m_R_high = 130.0;
|
||||
}
|
||||
virtual nld_base_d_to_a_proxy *create_d_a_proxy(netlist_logic_output_t &proxied) const
|
||||
{
|
||||
return nl_alloc(nld_d_to_a_proxy , proxied);
|
||||
}
|
||||
};
|
||||
|
||||
const netlist_logic_family_desc_t &netlist_family_TTL = netlist_logic_family_ttl_t();
|
||||
const netlist_logic_family_desc_t &netlist_family_CD4000 = netlist_logic_family_cd4000_t();
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// netlist_queue_t
|
||||
// ----------------------------------------------------------------------------------------
|
||||
@ -434,13 +455,13 @@ ATTR_COLD void netlist_device_t::register_terminal(const pstring &name, netlist_
|
||||
|
||||
ATTR_COLD void netlist_device_t::register_output(const pstring &name, netlist_output_t &port)
|
||||
{
|
||||
port.m_logic_family = this->logic_family();
|
||||
port.set_logic_family(this->logic_family());
|
||||
setup().register_object(*this, name, port);
|
||||
}
|
||||
|
||||
ATTR_COLD void netlist_device_t::register_input(const pstring &name, netlist_input_t &inp)
|
||||
{
|
||||
inp.m_logic_family = this->logic_family();
|
||||
inp.set_logic_family(this->logic_family());
|
||||
setup().register_object(*this, name, inp);
|
||||
m_terminals.add(inp.name());
|
||||
}
|
||||
@ -765,9 +786,9 @@ ATTR_COLD void netlist_analog_net_t::process_net(list_t *groups, int &cur_group)
|
||||
ATTR_COLD netlist_core_terminal_t::netlist_core_terminal_t(const type_t atype, const family_t afamily)
|
||||
: netlist_owned_object_t(atype, afamily)
|
||||
, plinkedlist_element_t<netlist_core_terminal_t>()
|
||||
, m_logic_family(NULL)
|
||||
, m_net(NULL)
|
||||
, m_state(STATE_NONEX)
|
||||
, m_logic_family(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -259,6 +259,7 @@ class netlist_net_t;
|
||||
class netlist_analog_net_t;
|
||||
class netlist_logic_net_t;
|
||||
class netlist_output_t;
|
||||
class netlist_logic_output_t;
|
||||
class netlist_param_t;
|
||||
class netlist_setup_t;
|
||||
class netlist_base_t;
|
||||
@ -272,8 +273,14 @@ class NETLIB_NAME(base_d_to_a_proxy);
|
||||
// netlist_output_family_t
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
struct netlist_logic_family_desc_t
|
||||
class nld_base_d_to_a_proxy;
|
||||
|
||||
class netlist_logic_family_desc_t
|
||||
{
|
||||
public:
|
||||
virtual ~netlist_logic_family_desc_t() {}
|
||||
virtual nld_base_d_to_a_proxy *create_d_a_proxy(netlist_logic_output_t &proxied) const = 0;
|
||||
|
||||
nl_double m_low_thresh_V;
|
||||
nl_double m_high_thresh_V;
|
||||
nl_double m_low_V;
|
||||
@ -289,8 +296,8 @@ struct netlist_logic_family_desc_t
|
||||
* Only devices of type GENERIC should have a family description entry
|
||||
*/
|
||||
|
||||
extern netlist_logic_family_desc_t netlist_family_TTL;
|
||||
extern netlist_logic_family_desc_t netlist_family_CD4000;
|
||||
extern const netlist_logic_family_desc_t &netlist_family_TTL;
|
||||
extern const netlist_logic_family_desc_t &netlist_family_CD4000;
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -450,7 +457,8 @@ public:
|
||||
m_state = astate;
|
||||
}
|
||||
|
||||
const netlist_logic_family_desc_t *m_logic_family;
|
||||
ATTR_HOT inline const netlist_logic_family_desc_t *logic_family() { return m_logic_family; }
|
||||
ATTR_COLD void set_logic_family(const netlist_logic_family_desc_t *fam) { m_logic_family = fam; }
|
||||
|
||||
protected:
|
||||
ATTR_COLD virtual void save_register()
|
||||
@ -462,6 +470,7 @@ protected:
|
||||
private:
|
||||
netlist_net_t * RESTRICT m_net;
|
||||
state_e m_state;
|
||||
const netlist_logic_family_desc_t *m_logic_family;
|
||||
};
|
||||
|
||||
NETLIST_SAVE_TYPE(netlist_core_terminal_t::state_e, DT_INT);
|
||||
|
@ -399,7 +399,7 @@ nld_base_d_to_a_proxy *netlist_setup_t::get_d_a_proxy(netlist_output_t &out)
|
||||
if (proxy == NULL)
|
||||
{
|
||||
// create a new one ...
|
||||
proxy = nl_alloc(nld_d_to_a_proxy ,out);
|
||||
proxy = out.logic_family()->create_d_a_proxy(out_cast);
|
||||
pstring x = pstring::sprintf("proxy_da_%s_%d", out.name().cstr(), m_proxy_cnt);
|
||||
m_proxy_cnt++;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user