mirror of
https://github.com/holub/mame
synced 2025-04-20 23:42:22 +03:00
Netlist:
- Hopefully fixed "red lines" - Improved 9316 code - General code maintenance - Started work on netlist audio device support
This commit is contained in:
parent
309af6d61f
commit
29213a99dc
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -2153,6 +2153,8 @@ src/emu/netlist/devices/nld_legacy.c svneol=native#text/plain
|
||||
src/emu/netlist/devices/nld_legacy.h svneol=native#text/plain
|
||||
src/emu/netlist/devices/nld_log.c svneol=native#text/plain
|
||||
src/emu/netlist/devices/nld_log.h svneol=native#text/plain
|
||||
src/emu/netlist/devices/nld_ne555.c svneol=native#text/plain
|
||||
src/emu/netlist/devices/nld_ne555.h svneol=native#text/plain
|
||||
src/emu/netlist/devices/nld_signal.h svneol=native#text/plain
|
||||
src/emu/netlist/devices/nld_solver.c svneol=native#text/plain
|
||||
src/emu/netlist/devices/nld_solver.h svneol=native#text/plain
|
||||
|
@ -219,6 +219,50 @@ private:
|
||||
netlist_analog_output_delegate m_callback;
|
||||
};
|
||||
|
||||
class NETLIB_NAME(sound) : public netlist_device_t
|
||||
{
|
||||
public:
|
||||
NETLIB_NAME(sound)()
|
||||
: netlist_device_t() { }
|
||||
|
||||
static const int BUFSIZE = 2048;
|
||||
|
||||
ATTR_COLD void start()
|
||||
{
|
||||
register_input("IN", m_in);
|
||||
m_cur = 0;
|
||||
m_last_pos = 0;
|
||||
m_last_buffer = netlist_time::zero;
|
||||
m_sample = netlist_time::zero; // FIXME: divide by zero
|
||||
}
|
||||
|
||||
ATTR_HOT void sound_update()
|
||||
{
|
||||
netlist_time current = netlist().time();
|
||||
int pos = (current - m_last_buffer) / m_sample;
|
||||
if (pos >= BUFSIZE)
|
||||
netlist().xfatalerror("sound %s: exceeded BUFSIZE\n", name().cstr());
|
||||
while (m_last_pos < pos )
|
||||
{
|
||||
m_buffer[m_last_pos++] = m_cur;
|
||||
}
|
||||
}
|
||||
|
||||
ATTR_HOT void update()
|
||||
{
|
||||
double val = INPANALOG(m_in);
|
||||
sound_update();
|
||||
m_cur = val;
|
||||
}
|
||||
|
||||
private:
|
||||
netlist_analog_input_t m_in;
|
||||
netlist_time m_sample;
|
||||
double m_cur;
|
||||
int m_last_pos;
|
||||
netlist_time m_last_buffer;
|
||||
stream_sample_t m_buffer[BUFSIZE];
|
||||
};
|
||||
|
||||
|
||||
// ======================> netlist_output_finder
|
||||
|
@ -70,7 +70,7 @@
|
||||
#include "nld_7493.h"
|
||||
#include "nld_9316.h"
|
||||
|
||||
#include "nld_NE555.h"
|
||||
#include "nld_ne555.h"
|
||||
|
||||
#include "nld_log.h"
|
||||
|
||||
|
@ -41,19 +41,10 @@ NETLIB_UPDATE(7490)
|
||||
update_outputs();
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
NETLIB_FUNC_VOID(7490, update_outputs)
|
||||
{
|
||||
OUTLOGIC(m_QA, (m_cnt >> 0) & 1, NLTIME_FROM_NS(18));
|
||||
OUTLOGIC(m_QB, (m_cnt >> 1) & 1, NLTIME_FROM_NS(36));
|
||||
OUTLOGIC(m_QC, (m_cnt >> 2) & 1, NLTIME_FROM_NS(54));
|
||||
OUTLOGIC(m_QD, (m_cnt >> 3) & 1, NLTIME_FROM_NS(72));
|
||||
}
|
||||
#else
|
||||
|
||||
NETLIB_FUNC_VOID(7490, update_outputs, (void))
|
||||
{
|
||||
const netlist_time delay[4] = { NLTIME_FROM_NS(18), NLTIME_FROM_NS(36), NLTIME_FROM_NS(54), NLTIME_FROM_NS(72) };
|
||||
for (int i=0; i<4; i++)
|
||||
OUTLOGIC(m_Q[i], (m_cnt >> i) & 1, delay[i]);
|
||||
}
|
||||
#endif
|
||||
|
@ -52,17 +52,23 @@ NETLIB_START(9316_sub)
|
||||
|
||||
NETLIB_UPDATE(9316_sub)
|
||||
{
|
||||
UINT8 cnt = m_cnt;
|
||||
if (m_loadq)
|
||||
{
|
||||
m_cnt = ( m_cnt + 1) & 0x0f;
|
||||
update_outputs();
|
||||
cnt = ( cnt + 1) & 0x0f;
|
||||
update_outputs(cnt);
|
||||
if (cnt == 0x0f)
|
||||
OUTLOGIC(m_RC, m_ent, NLTIME_FROM_NS(20));
|
||||
else if (cnt == 0)
|
||||
OUTLOGIC(m_RC, 0, NLTIME_FROM_NS(20));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_cnt = (INPLOGIC_PASSIVE(m_D) << 3) | (INPLOGIC_PASSIVE(m_C) << 2) | (INPLOGIC_PASSIVE(m_B) << 1) | (INPLOGIC_PASSIVE(m_A) << 0);
|
||||
update_outputs_all();
|
||||
cnt = (INPLOGIC_PASSIVE(m_D) << 3) | (INPLOGIC_PASSIVE(m_C) << 2) | (INPLOGIC_PASSIVE(m_B) << 1) | (INPLOGIC_PASSIVE(m_A) << 0);
|
||||
update_outputs_all(cnt);
|
||||
OUTLOGIC(m_RC, m_ent & (cnt == 0x0f), NLTIME_FROM_NS(20));
|
||||
}
|
||||
OUTLOGIC(m_RC, m_ent & (m_cnt == 0x0f), NLTIME_FROM_NS(20));
|
||||
m_cnt = cnt;
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(9316)
|
||||
@ -81,7 +87,7 @@ NETLIB_UPDATE(9316)
|
||||
if (!clrq & (sub.m_cnt>0))
|
||||
{
|
||||
sub.m_cnt = 0;
|
||||
sub.update_outputs();
|
||||
sub.update_outputs(sub.m_cnt);
|
||||
OUTLOGIC(sub.m_RC, 0, NLTIME_FROM_NS(20));
|
||||
return;
|
||||
}
|
||||
@ -89,30 +95,32 @@ NETLIB_UPDATE(9316)
|
||||
OUTLOGIC(sub.m_RC, sub.m_ent & (sub.m_cnt == 0x0f), NLTIME_FROM_NS(20));
|
||||
}
|
||||
|
||||
NETLIB_FUNC_VOID(9316_sub, update_outputs_all, (void))
|
||||
inline NETLIB_FUNC_VOID(9316_sub, update_outputs_all, (const UINT8 cnt))
|
||||
{
|
||||
const netlist_time out_delay = NLTIME_FROM_NS(20);
|
||||
OUTLOGIC(m_QA, (m_cnt >> 0) & 1, out_delay);
|
||||
OUTLOGIC(m_QB, (m_cnt >> 1) & 1, out_delay);
|
||||
OUTLOGIC(m_QC, (m_cnt >> 2) & 1, out_delay);
|
||||
OUTLOGIC(m_QD, (m_cnt >> 3) & 1, out_delay);
|
||||
OUTLOGIC(m_QA, (cnt >> 0) & 1, out_delay);
|
||||
OUTLOGIC(m_QB, (cnt >> 1) & 1, out_delay);
|
||||
OUTLOGIC(m_QC, (cnt >> 2) & 1, out_delay);
|
||||
OUTLOGIC(m_QD, (cnt >> 3) & 1, out_delay);
|
||||
}
|
||||
|
||||
NETLIB_FUNC_VOID(9316_sub, update_outputs, (void))
|
||||
inline NETLIB_FUNC_VOID(9316_sub, update_outputs, (const UINT8 cnt))
|
||||
{
|
||||
const netlist_time out_delay = NLTIME_FROM_NS(20);
|
||||
#if 0
|
||||
OUTLOGIC(m_QA, (m_cnt >> 0) & 1, out_delay);
|
||||
OUTLOGIC(m_QB, (m_cnt >> 1) & 1, out_delay);
|
||||
OUTLOGIC(m_QC, (m_cnt >> 2) & 1, out_delay);
|
||||
OUTLOGIC(m_QD, (m_cnt >> 3) & 1, out_delay);
|
||||
// for (int i=0; i<4; i++)
|
||||
// OUTLOGIC(m_Q[i], (cnt >> i) & 1, delay[i]);
|
||||
OUTLOGIC(m_QA, (cnt >> 0) & 1, out_delay);
|
||||
OUTLOGIC(m_QB, (cnt >> 1) & 1, out_delay);
|
||||
OUTLOGIC(m_QC, (cnt >> 2) & 1, out_delay);
|
||||
OUTLOGIC(m_QD, (cnt >> 3) & 1, out_delay);
|
||||
#else
|
||||
if ((m_cnt & 1) == 1)
|
||||
if ((cnt & 1) == 1)
|
||||
OUTLOGIC(m_QA, 1, out_delay);
|
||||
else
|
||||
{
|
||||
OUTLOGIC(m_QA, 0, out_delay);
|
||||
switch (m_cnt)
|
||||
switch (cnt)
|
||||
{
|
||||
case 0x00:
|
||||
OUTLOGIC(m_QB, 0, out_delay);
|
||||
|
@ -64,8 +64,8 @@
|
||||
NET_CONNECT(_name, D, _D)
|
||||
|
||||
NETLIB_SUBDEVICE(9316_sub,
|
||||
ATTR_HOT void update_outputs_all();
|
||||
ATTR_HOT void update_outputs();
|
||||
ATTR_HOT void update_outputs_all(const UINT8 cnt);
|
||||
ATTR_HOT void update_outputs(const UINT8 cnt);
|
||||
|
||||
netlist_ttl_input_t m_clk;
|
||||
|
||||
|
@ -21,8 +21,6 @@ NETLIB_START(nicMultiSwitch)
|
||||
}
|
||||
register_param("POS", m_POS, 0);
|
||||
register_output("Q", m_Q);
|
||||
|
||||
m_variable_input_count = true;
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(nicMultiSwitch)
|
||||
@ -53,8 +51,6 @@ NETLIB_START(nicMixer8)
|
||||
register_param(sR[i], m_R[i], 1e12);
|
||||
}
|
||||
register_output("Q", m_Q);
|
||||
|
||||
m_variable_input_count = true;
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(nicMixer8)
|
||||
|
@ -18,13 +18,6 @@
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// Macros
|
||||
// ----------------------------------------------------------------------------------------
|
||||
#if 0
|
||||
|
||||
#define NETDEV_DELAY_RISE(_name, _CLK, _D) \
|
||||
NET_REGISTER_DEV(delay_lh, _name) \
|
||||
NET_CONNECT(_name, CLK, _CLK) \
|
||||
NET_CONNECT(_name, D, _D)
|
||||
#endif
|
||||
|
||||
#define NETDEV_RSFF(_name, _S, _R) \
|
||||
NET_REGISTER_DEV(nicRSFF, _name) \
|
||||
|
82
src/emu/netlist/devices/nld_ne555.c
Normal file
82
src/emu/netlist/devices/nld_ne555.c
Normal file
@ -0,0 +1,82 @@
|
||||
/*
|
||||
* nld_NE555.c
|
||||
*
|
||||
*/
|
||||
|
||||
#include "nld_ne555.h"
|
||||
#include "../nl_setup.h"
|
||||
|
||||
#define R_OFF (1E20)
|
||||
#define R_ON (1)
|
||||
|
||||
inline double NETLIB_NAME(NE555)::clamp(const double v, const double a, const double b)
|
||||
{
|
||||
double ret = v;
|
||||
double vcc = TERMANALOG(m_R1.m_P);
|
||||
|
||||
if (ret > vcc - a)
|
||||
ret = vcc - a;
|
||||
if (ret < b)
|
||||
ret = b;
|
||||
return ret;
|
||||
}
|
||||
|
||||
NETLIB_START(NE555)
|
||||
{
|
||||
|
||||
register_sub(m_R1, "R1");
|
||||
register_sub(m_R2, "R2");
|
||||
register_sub(m_R3, "R3");
|
||||
register_sub(m_RDIS, "RDIS");
|
||||
|
||||
register_subalias("GND", m_R3.m_N); // Pin 1
|
||||
register_input("TRIG", m_TRIG); // Pin 2
|
||||
register_output("OUT", m_OUT); // Pin 3
|
||||
register_input("RESET", m_RESET); // Pin 4
|
||||
register_subalias("CONT", m_R1.m_N); // Pin 5
|
||||
register_input("THRESH", m_THRES); // Pin 6
|
||||
register_subalias("DISCH", m_RDIS.m_P); // Pin 7
|
||||
register_subalias("VCC", m_R1.m_P); // Pin 8
|
||||
|
||||
m_R1.set_R(5000);
|
||||
m_R2.set_R(5000);
|
||||
m_R3.set_R(5000);
|
||||
m_RDIS.set_R(R_OFF);
|
||||
|
||||
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);
|
||||
|
||||
m_last_out = false;
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(NE555)
|
||||
{
|
||||
// FIXME: assumes GND is connected to 0V.
|
||||
|
||||
double vt = clamp(TERMANALOG(m_R2.m_P), 0.7, 1.4);
|
||||
bool bthresh = (INPANALOG(m_THRES) > vt);
|
||||
bool btrig = (INPANALOG(m_TRIG) > clamp(TERMANALOG(m_R2.m_N), 0.7, 1.4));
|
||||
bool out = m_last_out;
|
||||
|
||||
if (!btrig)
|
||||
{
|
||||
out = true;
|
||||
}
|
||||
else if (bthresh)
|
||||
{
|
||||
out = false;
|
||||
}
|
||||
|
||||
if (!m_last_out && out)
|
||||
{
|
||||
OUTANALOG(m_OUT, TERMANALOG(m_R1.m_P), NLTIME_FROM_NS(100));
|
||||
m_RDIS.set_R(R_OFF);
|
||||
}
|
||||
else if (m_last_out && !out)
|
||||
{
|
||||
OUTANALOG(m_OUT, TERMANALOG(m_R3.m_N), NLTIME_FROM_NS(100));
|
||||
m_RDIS.set_R(R_ON);
|
||||
}
|
||||
m_last_out = out;
|
||||
}
|
47
src/emu/netlist/devices/nld_ne555.h
Normal file
47
src/emu/netlist/devices/nld_ne555.h
Normal file
@ -0,0 +1,47 @@
|
||||
// license:GPL-2.0+
|
||||
// copyright-holders:Couriersud
|
||||
/*
|
||||
* nld_NE555.h
|
||||
*
|
||||
* NE555: PRECISION TIMERS
|
||||
*
|
||||
* +--------+
|
||||
* GND |1 ++ 8| VCC
|
||||
* TRIG |2 7| DISCH
|
||||
* OUT |3 6| THRES
|
||||
* RESET |4 5| CONT
|
||||
* +--------+
|
||||
*
|
||||
* Naming conventions follow Texas Instruments datasheet
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef NLD_NE555_H_
|
||||
#define NLD_NE555_H_
|
||||
|
||||
#include "../nl_base.h"
|
||||
#include "nld_twoterm.h"
|
||||
|
||||
#define NETDEV_NE555(_name) \
|
||||
NET_REGISTER_DEV(NE555, _name) \
|
||||
|
||||
NETLIB_DEVICE(NE555,
|
||||
NETLIB_NAME(R) m_R1;
|
||||
NETLIB_NAME(R) m_R2;
|
||||
NETLIB_NAME(R) m_R3;
|
||||
NETLIB_NAME(R) m_RDIS;
|
||||
|
||||
netlist_logic_input_t m_RESET;
|
||||
netlist_analog_input_t m_THRES;
|
||||
netlist_analog_input_t m_TRIG;
|
||||
netlist_analog_output_t m_OUT;
|
||||
|
||||
bool m_last_out;
|
||||
|
||||
double clamp(const double v, const double a, const double b);
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
#endif /* NLD_NE555_H_ */
|
@ -72,7 +72,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);
|
||||
setup().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);
|
||||
@ -194,9 +194,9 @@ NETLIB_START(QBJT_switch<_type>)
|
||||
register_subalias("E", m_RB.m_N);
|
||||
register_subalias("C", m_RC.m_P);
|
||||
|
||||
m_setup->connect(m_RB.m_N, m_RC.m_N);
|
||||
m_setup->connect(m_RB.m_P, m_BV);
|
||||
m_setup->connect(m_RB.m_N, m_EV);
|
||||
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);
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(Q)
|
||||
@ -275,8 +275,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;
|
||||
|
||||
m_setup->connect(m_OP, m_OP1);
|
||||
m_setup->connect(m_ON, m_ON1);
|
||||
setup().connect(m_OP, m_OP1);
|
||||
setup().connect(m_ON, m_ON1);
|
||||
}
|
||||
|
||||
NETLIB_UPDATE_PARAM(VCCS)
|
||||
@ -309,8 +309,8 @@ NETLIB_START(VCVS)
|
||||
m_OP2.m_otherterm = &m_ON2;
|
||||
m_ON2.m_otherterm = &m_OP2;
|
||||
|
||||
setup()->connect(m_OP2, m_OP1);
|
||||
setup()->connect(m_ON2, m_ON1);
|
||||
setup().connect(m_OP2, m_OP1);
|
||||
setup().connect(m_ON2, m_ON1);
|
||||
}
|
||||
|
||||
NETLIB_UPDATE_PARAM(VCVS)
|
||||
|
@ -164,6 +164,7 @@ protected:
|
||||
// this one has an accuracy of better than 5%. That's enough for our purpose
|
||||
// add c3 and it'll be better than 1%
|
||||
|
||||
#if 0
|
||||
inline double fastexp_h(const double x)
|
||||
{
|
||||
static const double ln2r = 1.442695040888963387;
|
||||
@ -186,6 +187,7 @@ inline double fastexp(const double x)
|
||||
else
|
||||
return fastexp_h(x);
|
||||
}
|
||||
#endif
|
||||
|
||||
class NETLIB_NAME(D) : public NETLIB_NAME(twoterm)
|
||||
{
|
||||
@ -211,7 +213,7 @@ public:
|
||||
{
|
||||
m_Vd = nVd;
|
||||
|
||||
const double eVDVt = fastexp(m_Vd * m_VtInv);
|
||||
const double eVDVt = exp(m_Vd * m_VtInv);
|
||||
Id = m_Is * (eVDVt - 1.0);
|
||||
G = m_Is * m_VtInv * eVDVt;
|
||||
}
|
||||
@ -220,7 +222,7 @@ public:
|
||||
//m_Vd = m_Vd + log((nVd - m_Vd) * m_VtInv + 1.0) * m_Vt;
|
||||
m_Vd = m_Vd + log1p((nVd - m_Vd) * m_VtInv) * m_Vt;
|
||||
|
||||
const double eVDVt = fastexp(m_Vd * m_VtInv);
|
||||
const double eVDVt = exp(m_Vd * m_VtInv);
|
||||
Id = m_Is * (eVDVt - 1.0);
|
||||
|
||||
G = m_Is * m_VtInv * eVDVt;
|
||||
|
@ -29,7 +29,7 @@ NETLISTOBJS+= \
|
||||
$(NETLISTOBJ)/devices/nld_7490.o \
|
||||
$(NETLISTOBJ)/devices/nld_7493.o \
|
||||
$(NETLISTOBJ)/devices/nld_9316.o \
|
||||
$(NETLISTOBJ)/devices/nld_NE555.o \
|
||||
$(NETLISTOBJ)/devices/nld_ne555.o \
|
||||
$(NETLISTOBJ)/devices/nld_legacy.o \
|
||||
$(NETLISTOBJ)/devices/net_lib.o \
|
||||
$(NETLISTOBJ)/devices/nld_log.o \
|
||||
|
@ -219,9 +219,9 @@ ATTR_COLD netlist_core_device_t::netlist_core_device_t(const family_t afamily)
|
||||
{
|
||||
}
|
||||
|
||||
ATTR_COLD void netlist_core_device_t::init(netlist_setup_t &setup, const pstring &name)
|
||||
ATTR_COLD void netlist_core_device_t::init(netlist_base_t &anetlist, const pstring &name)
|
||||
{
|
||||
init_object(setup.netlist(), name);
|
||||
init_object(anetlist, name);
|
||||
|
||||
#if USE_DELEGATES
|
||||
#if USE_PMFDELEGATES
|
||||
@ -239,32 +239,6 @@ ATTR_COLD netlist_core_device_t::~netlist_core_device_t()
|
||||
{
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// net_device_t
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
netlist_device_t::netlist_device_t()
|
||||
: netlist_core_device_t(),
|
||||
m_terminals(20),
|
||||
m_setup(NULL),
|
||||
m_variable_input_count(false)
|
||||
{
|
||||
}
|
||||
|
||||
netlist_device_t::netlist_device_t(const family_t afamily)
|
||||
: netlist_core_device_t(afamily),
|
||||
m_terminals(20),
|
||||
m_setup(NULL),
|
||||
m_variable_input_count(false)
|
||||
{
|
||||
}
|
||||
|
||||
netlist_device_t::~netlist_device_t()
|
||||
{
|
||||
//NL_VERBOSE_OUT(("~net_device_t\n");
|
||||
}
|
||||
|
||||
|
||||
ATTR_HOT ATTR_ALIGN const netlist_sig_t netlist_core_device_t::INPLOGIC_PASSIVE(netlist_logic_input_t &inp)
|
||||
{
|
||||
if (inp.state() == netlist_input_t::STATE_INP_PASSIVE)
|
||||
@ -279,17 +253,41 @@ ATTR_HOT ATTR_ALIGN const netlist_sig_t netlist_core_device_t::INPLOGIC_PASSIVE(
|
||||
|
||||
}
|
||||
|
||||
ATTR_COLD void netlist_device_t::init(netlist_setup_t &setup, const pstring &name)
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// net_device_t
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
netlist_device_t::netlist_device_t()
|
||||
: netlist_core_device_t(),
|
||||
m_terminals(20)
|
||||
{
|
||||
netlist_core_device_t::init(setup, name);
|
||||
m_setup = &setup;
|
||||
}
|
||||
|
||||
netlist_device_t::netlist_device_t(const family_t afamily)
|
||||
: netlist_core_device_t(afamily),
|
||||
m_terminals(20){
|
||||
}
|
||||
|
||||
netlist_device_t::~netlist_device_t()
|
||||
{
|
||||
//NL_VERBOSE_OUT(("~net_device_t\n");
|
||||
}
|
||||
|
||||
ATTR_COLD netlist_setup_t &netlist_device_t::setup()
|
||||
{
|
||||
return netlist().setup();
|
||||
}
|
||||
|
||||
ATTR_COLD void netlist_device_t::init(netlist_base_t &anetlist, const pstring &name)
|
||||
{
|
||||
netlist_core_device_t::init(anetlist, name);
|
||||
start();
|
||||
}
|
||||
|
||||
|
||||
ATTR_COLD void netlist_device_t::register_sub(netlist_device_t &dev, const pstring &name)
|
||||
{
|
||||
dev.init(*m_setup, this->name() + "." + name);
|
||||
dev.init(netlist(), this->name() + "." + name);
|
||||
}
|
||||
|
||||
ATTR_COLD void netlist_device_t::register_subalias(const pstring &name, const netlist_core_terminal_t &term)
|
||||
@ -298,7 +296,7 @@ ATTR_COLD void netlist_device_t::register_subalias(const pstring &name, const ne
|
||||
|
||||
//printf("alias: %s\n", alias.cstr());
|
||||
|
||||
m_setup->register_alias(alias, term.name());
|
||||
setup().register_alias(alias, term.name());
|
||||
|
||||
if (term.isType(netlist_terminal_t::INPUT))
|
||||
m_terminals.add(name);
|
||||
@ -306,18 +304,18 @@ ATTR_COLD void netlist_device_t::register_subalias(const pstring &name, const ne
|
||||
|
||||
ATTR_COLD void netlist_device_t::register_terminal(const pstring &name, netlist_terminal_t &port)
|
||||
{
|
||||
m_setup->register_object(*this,*this,name, port, netlist_terminal_t::STATE_INP_ACTIVE);
|
||||
setup().register_object(*this,*this,name, port, netlist_terminal_t::STATE_INP_ACTIVE);
|
||||
}
|
||||
|
||||
ATTR_COLD void netlist_device_t::register_output(const pstring &name, netlist_output_t &port)
|
||||
{
|
||||
m_setup->register_object(*this,*this,name, port, netlist_terminal_t::STATE_OUT);
|
||||
setup().register_object(*this,*this,name, port, netlist_terminal_t::STATE_OUT);
|
||||
}
|
||||
|
||||
ATTR_COLD void netlist_device_t::register_input(const pstring &name, netlist_input_t &inp, netlist_input_t::state_e type)
|
||||
{
|
||||
m_terminals.add(name);
|
||||
m_setup->register_object(*this, *this, name, inp, type);
|
||||
setup().register_object(*this, *this, name, inp, type);
|
||||
}
|
||||
|
||||
static void init_term(netlist_core_device_t &dev, netlist_core_terminal_t &term, netlist_input_t::state_e aState)
|
||||
@ -347,7 +345,7 @@ ATTR_COLD void netlist_device_t::register_link_internal(netlist_core_device_t &d
|
||||
{
|
||||
init_term(dev, in, aState);
|
||||
init_term(dev, out, aState);
|
||||
m_setup->connect(in, out);
|
||||
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)
|
||||
@ -360,7 +358,7 @@ ATTR_COLD void netlist_device_t::register_param(netlist_core_device_t &dev, cons
|
||||
{
|
||||
param.init_object(dev, sname);
|
||||
param.initial(initialVal);
|
||||
m_setup->register_object(*this, *this, sname, param, netlist_terminal_t::STATE_NONEX);
|
||||
setup().register_object(*this, *this, sname, param, netlist_terminal_t::STATE_NONEX);
|
||||
}
|
||||
|
||||
template ATTR_COLD void netlist_device_t::register_param(netlist_core_device_t &dev, const pstring &sname, netlist_param_double_t ¶m, const double initialVal);
|
||||
@ -557,10 +555,72 @@ ATTR_COLD void netlist_logic_output_t::set_levels(const double low, const double
|
||||
m_high_V = high;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// netlist_ttl_output_t
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
ATTR_COLD netlist_ttl_output_t::netlist_ttl_output_t()
|
||||
: netlist_logic_output_t()
|
||||
{
|
||||
set_levels(0.3, 3.4);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// netlist_analog_output_t
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
ATTR_COLD netlist_analog_output_t::netlist_analog_output_t()
|
||||
: netlist_output_t(OUTPUT, ANALOG)
|
||||
{
|
||||
net().m_cur.Analog = 0.0;
|
||||
net().m_new.Analog = 99.0;
|
||||
}
|
||||
|
||||
ATTR_COLD void netlist_analog_output_t::initial(const double val)
|
||||
{
|
||||
net().m_cur.Analog = val;
|
||||
net().m_new.Analog = 99.0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// netlist_param_t & friends
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
ATTR_COLD netlist_param_t::netlist_param_t(const param_type_t atype)
|
||||
: netlist_owned_object_t(PARAM, ANALOG)
|
||||
, m_param_type(atype)
|
||||
{
|
||||
}
|
||||
|
||||
ATTR_COLD netlist_param_double_t::netlist_param_double_t()
|
||||
: netlist_param_t(DOUBLE)
|
||||
, m_param(0.0)
|
||||
{
|
||||
}
|
||||
|
||||
ATTR_COLD netlist_param_int_t::netlist_param_int_t()
|
||||
: netlist_param_t(INTEGER)
|
||||
, m_param(0)
|
||||
{
|
||||
}
|
||||
|
||||
ATTR_COLD netlist_param_logic_t::netlist_param_logic_t()
|
||||
: netlist_param_int_t()
|
||||
{
|
||||
}
|
||||
|
||||
ATTR_COLD netlist_param_str_t::netlist_param_str_t()
|
||||
: netlist_param_t(STRING)
|
||||
, m_param("")
|
||||
{
|
||||
}
|
||||
|
||||
ATTR_COLD netlist_param_model_t::netlist_param_model_t()
|
||||
: netlist_param_t(MODEL)
|
||||
, m_param("")
|
||||
{
|
||||
}
|
||||
|
||||
ATTR_COLD double netlist_param_model_t::dValue(const pstring &entity, const double defval) const
|
||||
{
|
||||
pstring tmp = this->Value();
|
||||
|
@ -252,6 +252,7 @@ class NETLIB_NAME(mainclock);
|
||||
|
||||
class netlist_object_t
|
||||
{
|
||||
NETLIST_PREVENT_COPYING(netlist_object_t)
|
||||
public:
|
||||
enum type_t {
|
||||
TERMINAL = 0,
|
||||
@ -306,6 +307,7 @@ private:
|
||||
|
||||
class netlist_owned_object_t : public netlist_object_t
|
||||
{
|
||||
NETLIST_PREVENT_COPYING(netlist_owned_object_t)
|
||||
public:
|
||||
ATTR_COLD netlist_owned_object_t(const type_t atype, const family_t afamily);
|
||||
|
||||
@ -322,6 +324,7 @@ private:
|
||||
|
||||
class netlist_core_terminal_t : public netlist_owned_object_t
|
||||
{
|
||||
NETLIST_PREVENT_COPYING(netlist_core_terminal_t)
|
||||
public:
|
||||
|
||||
/* needed here ... */
|
||||
@ -361,6 +364,7 @@ private:
|
||||
|
||||
class netlist_terminal_t : public netlist_core_terminal_t
|
||||
{
|
||||
NETLIST_PREVENT_COPYING(netlist_terminal_t)
|
||||
public:
|
||||
ATTR_COLD netlist_terminal_t();
|
||||
|
||||
@ -479,6 +483,7 @@ public:
|
||||
|
||||
class netlist_net_t : public netlist_object_t
|
||||
{
|
||||
NETLIST_PREVENT_COPYING(netlist_net_t)
|
||||
public:
|
||||
|
||||
typedef netlist_list_t<netlist_net_t *> list_t;
|
||||
@ -548,6 +553,7 @@ public:
|
||||
|
||||
// m_terms is only used by analog subsystem
|
||||
typedef netlist_list_t<netlist_terminal_t *> terminal_list_t;
|
||||
|
||||
terminal_list_t m_terms;
|
||||
netlist_matrix_solver_t *m_solver;
|
||||
|
||||
@ -579,6 +585,7 @@ private:
|
||||
|
||||
class netlist_output_t : public netlist_core_terminal_t
|
||||
{
|
||||
NETLIST_PREVENT_COPYING(netlist_output_t)
|
||||
public:
|
||||
|
||||
ATTR_COLD netlist_output_t(const type_t atype, const family_t afamily);
|
||||
@ -597,6 +604,7 @@ private:
|
||||
|
||||
class netlist_logic_output_t : public netlist_output_t
|
||||
{
|
||||
NETLIST_PREVENT_COPYING(netlist_logic_output_t)
|
||||
public:
|
||||
|
||||
ATTR_COLD netlist_logic_output_t();
|
||||
@ -621,32 +629,20 @@ class netlist_ttl_output_t : public netlist_logic_output_t
|
||||
{
|
||||
public:
|
||||
|
||||
netlist_ttl_output_t()
|
||||
: netlist_logic_output_t()
|
||||
{
|
||||
set_levels(0.3, 3.4);
|
||||
}
|
||||
ATTR_COLD netlist_ttl_output_t();
|
||||
|
||||
};
|
||||
|
||||
class netlist_analog_output_t : public netlist_output_t
|
||||
{
|
||||
NETLIST_PREVENT_COPYING(netlist_analog_output_t)
|
||||
public:
|
||||
|
||||
ATTR_COLD netlist_analog_output_t()
|
||||
: netlist_output_t(OUTPUT, ANALOG)
|
||||
{
|
||||
net().m_cur.Analog = 0.0;
|
||||
net().m_new.Analog = 99.0;
|
||||
}
|
||||
ATTR_COLD netlist_analog_output_t();
|
||||
|
||||
ATTR_COLD void initial(const double val)
|
||||
{
|
||||
net().m_cur.Analog = val;
|
||||
net().m_new.Analog = 99.0;
|
||||
}
|
||||
ATTR_COLD void initial(const double val);
|
||||
|
||||
ATTR_HOT inline void set_Q(const double newQ, const netlist_time &delay)
|
||||
ATTR_HOT inline void set_Q(const double newQ, const netlist_time &delay)
|
||||
{
|
||||
if (newQ != net().m_new.Analog)
|
||||
{
|
||||
@ -663,6 +659,7 @@ public:
|
||||
|
||||
class netlist_param_t : public netlist_owned_object_t
|
||||
{
|
||||
NETLIST_PREVENT_COPYING(netlist_param_t)
|
||||
public:
|
||||
|
||||
enum param_type_t {
|
||||
@ -673,11 +670,7 @@ public:
|
||||
LOGIC
|
||||
};
|
||||
|
||||
netlist_param_t(const param_type_t atype)
|
||||
: netlist_owned_object_t(PARAM, ANALOG)
|
||||
, m_param_type(atype)
|
||||
{ }
|
||||
|
||||
ATTR_COLD netlist_param_t(const param_type_t atype);
|
||||
|
||||
ATTR_HOT inline const param_type_t param_type() const { return m_param_type; }
|
||||
|
||||
@ -687,11 +680,9 @@ private:
|
||||
|
||||
class netlist_param_double_t : public netlist_param_t
|
||||
{
|
||||
NETLIST_PREVENT_COPYING(netlist_param_double_t)
|
||||
public:
|
||||
netlist_param_double_t()
|
||||
: netlist_param_t(DOUBLE)
|
||||
, m_param(0.0)
|
||||
{ }
|
||||
ATTR_COLD netlist_param_double_t();
|
||||
|
||||
ATTR_HOT inline void setTo(const double param);
|
||||
ATTR_COLD inline void initial(const double val) { m_param = val; }
|
||||
@ -703,11 +694,9 @@ private:
|
||||
|
||||
class netlist_param_int_t : public netlist_param_t
|
||||
{
|
||||
NETLIST_PREVENT_COPYING(netlist_param_int_t)
|
||||
public:
|
||||
netlist_param_int_t()
|
||||
: netlist_param_t(INTEGER)
|
||||
, m_param(0)
|
||||
{ }
|
||||
ATTR_COLD netlist_param_int_t();
|
||||
|
||||
ATTR_HOT inline void setTo(const int param);
|
||||
ATTR_COLD inline void initial(const int val) { m_param = val; }
|
||||
@ -720,19 +709,16 @@ private:
|
||||
|
||||
class netlist_param_logic_t : public netlist_param_int_t
|
||||
{
|
||||
NETLIST_PREVENT_COPYING(netlist_param_logic_t)
|
||||
public:
|
||||
netlist_param_logic_t()
|
||||
: netlist_param_int_t()
|
||||
{ }
|
||||
ATTR_COLD netlist_param_logic_t();
|
||||
};
|
||||
|
||||
class netlist_param_str_t : public netlist_param_t
|
||||
{
|
||||
NETLIST_PREVENT_COPYING(netlist_param_str_t)
|
||||
public:
|
||||
netlist_param_str_t()
|
||||
: netlist_param_t(STRING)
|
||||
, m_param("")
|
||||
{ }
|
||||
ATTR_COLD netlist_param_str_t();
|
||||
|
||||
ATTR_HOT inline void setTo(const pstring ¶m);
|
||||
ATTR_COLD inline void initial(const pstring &val) { m_param = val; }
|
||||
@ -745,11 +731,9 @@ private:
|
||||
|
||||
class netlist_param_model_t : public netlist_param_t
|
||||
{
|
||||
NETLIST_PREVENT_COPYING(netlist_param_model_t)
|
||||
public:
|
||||
netlist_param_model_t()
|
||||
: netlist_param_t(MODEL)
|
||||
, m_param("")
|
||||
{ }
|
||||
ATTR_COLD netlist_param_model_t();
|
||||
|
||||
ATTR_COLD inline void initial(const pstring &val) { m_param = val; }
|
||||
|
||||
@ -768,6 +752,7 @@ private:
|
||||
|
||||
class netlist_core_device_t : public netlist_object_t
|
||||
{
|
||||
NETLIST_PREVENT_COPYING(netlist_core_device_t)
|
||||
public:
|
||||
|
||||
typedef netlist_list_t<netlist_core_device_t *> list_t;
|
||||
@ -777,7 +762,7 @@ public:
|
||||
|
||||
ATTR_COLD virtual ~netlist_core_device_t();
|
||||
|
||||
ATTR_COLD virtual void init(netlist_setup_t &setup, const pstring &name);
|
||||
ATTR_COLD virtual void init(netlist_base_t &anetlist, const pstring &name);
|
||||
|
||||
|
||||
ATTR_HOT virtual void update_param() {}
|
||||
@ -855,6 +840,7 @@ private:
|
||||
|
||||
class netlist_device_t : public netlist_core_device_t
|
||||
{
|
||||
NETLIST_PREVENT_COPYING(netlist_device_t)
|
||||
public:
|
||||
|
||||
ATTR_COLD netlist_device_t();
|
||||
@ -862,12 +848,9 @@ public:
|
||||
|
||||
ATTR_COLD virtual ~netlist_device_t();
|
||||
|
||||
ATTR_COLD virtual void init(netlist_setup_t &setup, const pstring &name);
|
||||
ATTR_COLD virtual void init(netlist_base_t &anetlist, const pstring &name);
|
||||
|
||||
ATTR_COLD netlist_setup_t *setup() const { return m_setup; }
|
||||
|
||||
// FIXME: Legacy ... this needs to disappear
|
||||
ATTR_COLD bool variable_input_count() const { return m_variable_input_count; }
|
||||
ATTR_COLD netlist_setup_t &setup();
|
||||
|
||||
ATTR_COLD void register_sub(netlist_device_t &dev, const pstring &name);
|
||||
ATTR_COLD void register_subalias(const pstring &name, const netlist_core_terminal_t &term);
|
||||
@ -899,9 +882,6 @@ protected:
|
||||
template <class C, class T>
|
||||
ATTR_COLD void register_param(netlist_core_device_t &dev, const pstring &sname, C ¶m, const T initialVal);
|
||||
|
||||
netlist_setup_t *m_setup;
|
||||
bool m_variable_input_count;
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
@ -912,6 +892,7 @@ private:
|
||||
|
||||
class netlist_base_t
|
||||
{
|
||||
NETLIST_PREVENT_COPYING(netlist_base_t)
|
||||
public:
|
||||
|
||||
typedef netlist_timed_queue<netlist_net_t, netlist_time, 512> queue_t;
|
||||
@ -919,8 +900,6 @@ public:
|
||||
netlist_base_t();
|
||||
virtual ~netlist_base_t();
|
||||
|
||||
ATTR_COLD void set_clock_freq(UINT64 clockfreq);
|
||||
|
||||
ATTR_HOT inline const queue_t &queue() const { return m_queue; }
|
||||
ATTR_HOT inline queue_t &queue() { return m_queue; }
|
||||
|
||||
@ -938,6 +917,14 @@ public:
|
||||
ATTR_COLD void set_mainclock_dev(NETLIB_NAME(mainclock) *dev);
|
||||
ATTR_COLD void set_solver_dev(NETLIB_NAME(solver) *dev);
|
||||
|
||||
ATTR_COLD void set_clock_freq(UINT64 clockfreq);
|
||||
|
||||
ATTR_COLD netlist_setup_t &setup() { return *m_setup; }
|
||||
ATTR_COLD void set_setup(netlist_setup_t *asetup)
|
||||
{
|
||||
m_setup = asetup;
|
||||
}
|
||||
|
||||
ATTR_COLD void reset();
|
||||
|
||||
ATTR_COLD void xfatalerror(const char *format, ...) const;
|
||||
@ -954,6 +941,8 @@ protected:
|
||||
#endif
|
||||
|
||||
private:
|
||||
ATTR_HOT void update_time(const netlist_time t, INT32 &atime);
|
||||
|
||||
netlist_time m_time_ps;
|
||||
queue_t m_queue;
|
||||
UINT32 m_rem;
|
||||
@ -962,8 +951,7 @@ private:
|
||||
NETLIB_NAME(mainclock) * m_mainclock;
|
||||
NETLIB_NAME(solver) * m_solver;
|
||||
|
||||
ATTR_HOT void update_time(const netlist_time t, INT32 &atime);
|
||||
|
||||
netlist_setup_t *m_setup;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
@ -1182,6 +1170,7 @@ ATTR_HOT inline const bool netlist_analog_input_t::is_highz() const
|
||||
|
||||
class net_device_t_base_factory
|
||||
{
|
||||
NETLIST_PREVENT_COPYING(net_device_t_base_factory)
|
||||
public:
|
||||
net_device_t_base_factory(const pstring &name, const pstring &classname)
|
||||
: m_name(name), m_classname(classname)
|
||||
@ -1201,6 +1190,7 @@ protected:
|
||||
template <class C>
|
||||
class net_device_t_factory : public net_device_t_base_factory
|
||||
{
|
||||
NETLIST_PREVENT_COPYING(net_device_t_factory)
|
||||
public:
|
||||
net_device_t_factory(const pstring &name, const pstring &classname)
|
||||
: net_device_t_base_factory(name, classname) { }
|
||||
|
@ -131,6 +131,7 @@ private:
|
||||
template <class _Element, class _Time, int _Size>
|
||||
class netlist_timed_queue
|
||||
{
|
||||
NETLIST_PREVENT_COPYING(netlist_timed_queue)
|
||||
public:
|
||||
|
||||
struct entry_t
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
class netlist_parser
|
||||
{
|
||||
NETLIST_PREVENT_COPYING(netlist_parser)
|
||||
public:
|
||||
netlist_parser(netlist_setup_t &setup)
|
||||
: m_setup(setup) {}
|
||||
|
@ -32,6 +32,7 @@ netlist_setup_t::netlist_setup_t(netlist_base_t &netlist)
|
||||
: m_netlist(netlist)
|
||||
, m_proxy_cnt(0)
|
||||
{
|
||||
netlist.set_setup(this);
|
||||
m_factory.initialize();
|
||||
NETLIST_NAME(base)(*this);
|
||||
}
|
||||
@ -56,6 +57,9 @@ netlist_setup_t::~netlist_setup_t()
|
||||
m_params.reset();
|
||||
m_terminals.reset();
|
||||
m_params_temp.reset();
|
||||
|
||||
netlist().set_setup(NULL);
|
||||
|
||||
pstring::resetmem();
|
||||
}
|
||||
|
||||
@ -105,16 +109,6 @@ void netlist_setup_t::remove_dev(const pstring &name)
|
||||
m_devices.remove(name);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void netlist_setup_t::register_callback(const pstring &devname, netlist_output_delegate delegate)
|
||||
{
|
||||
NETLIB_NAME(analog_callback) *dev = (NETLIB_NAME(analog_callback) *) m_devices.find(devname);
|
||||
if (dev == NULL)
|
||||
fatalerror("did not find device %s\n", devname.cstr());
|
||||
dev->register_callback(delegate);
|
||||
}
|
||||
#endif
|
||||
|
||||
void netlist_setup_t::register_model(const pstring &model)
|
||||
{
|
||||
m_models.add(model);
|
||||
@ -364,7 +358,7 @@ void netlist_setup_t::connect_input_output(netlist_input_t &in, netlist_output_t
|
||||
pstring x = pstring::sprintf("proxy_ad_%d", m_proxy_cnt);
|
||||
m_proxy_cnt++;
|
||||
|
||||
proxy->init(*this, x);
|
||||
proxy->init(netlist(), x);
|
||||
register_dev(proxy, x);
|
||||
|
||||
proxy->m_Q.net().register_con(in);
|
||||
@ -378,7 +372,7 @@ void netlist_setup_t::connect_input_output(netlist_input_t &in, netlist_output_t
|
||||
pstring x = pstring::sprintf("proxy_da_%d", m_proxy_cnt);
|
||||
m_proxy_cnt++;
|
||||
|
||||
proxy->init(*this, x);
|
||||
proxy->init(netlist(), x);
|
||||
register_dev(proxy, x);
|
||||
|
||||
proxy->m_Q.net().register_con(in);
|
||||
@ -403,7 +397,7 @@ void netlist_setup_t::connect_terminal_input(netlist_terminal_t &term, netlist_i
|
||||
pstring x = pstring::sprintf("proxy_da_%d", m_proxy_cnt);
|
||||
m_proxy_cnt++;
|
||||
|
||||
proxy->init(*this, x);
|
||||
proxy->init(netlist(), x);
|
||||
register_dev(proxy, x);
|
||||
|
||||
connect_terminals(term, proxy->m_I);
|
||||
@ -439,7 +433,7 @@ void netlist_setup_t::connect_terminal_output(netlist_terminal_t &in, netlist_ou
|
||||
pstring x = pstring::sprintf("proxy_da_%d", m_proxy_cnt);
|
||||
m_proxy_cnt++;
|
||||
|
||||
proxy->init(*this, x);
|
||||
proxy->init(netlist(), x);
|
||||
register_dev(proxy, x);
|
||||
|
||||
out.net().register_con(proxy->m_I);
|
||||
@ -594,7 +588,7 @@ void netlist_setup_t::start_devices(void)
|
||||
for (tagmap_devices_t::entry_t *entry = m_devices.first(); entry != NULL; entry = m_devices.next(entry))
|
||||
{
|
||||
netlist_device_t *dev = entry->object();
|
||||
dev->init(*this, entry->tag().cstr());
|
||||
dev->init(netlist(), entry->tag().cstr());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,6 +69,7 @@ ATTR_COLD void NETLIST_NAME(_name)(netlist_setup_t &netlist) \
|
||||
|
||||
class netlist_setup_t
|
||||
{
|
||||
NETLIST_PREVENT_COPYING(netlist_setup_t)
|
||||
public:
|
||||
|
||||
struct link_t
|
||||
@ -122,10 +123,8 @@ public:
|
||||
netlist_core_terminal_t *find_terminal(const pstring &outname_in, netlist_object_t::type_t atype, bool required = true);
|
||||
|
||||
netlist_param_t *find_param(const pstring ¶m_in, bool required = true);
|
||||
#if 0
|
||||
void register_callback(const pstring &devname, netlist_output_delegate delegate);
|
||||
#endif
|
||||
void parse(char *buf);
|
||||
|
||||
void parse(char *buf);
|
||||
|
||||
void start_devices(void);
|
||||
void resolve_inputs(void);
|
||||
|
@ -16,8 +16,28 @@ pblockpool pstring::m_pool;
|
||||
|
||||
pstring::str_t *pstring::m_zero = NULL;
|
||||
|
||||
#define IMMEDIATE_MODE (1)
|
||||
#define DEBUG_MODE (0)
|
||||
/*
|
||||
* Uncomment the following to override defaults
|
||||
*/
|
||||
|
||||
//#define IMMEDIATE_MODE (1)
|
||||
//#define DEBUG_MODE (0)
|
||||
|
||||
#ifdef MAME_DEBUG
|
||||
#ifndef IMMEDIATE_MODE
|
||||
#define IMMEDIATE_MODE (0)
|
||||
#endif
|
||||
#ifndef DEBUG_MODE
|
||||
#define DEBUG_MODE (1)
|
||||
#endif
|
||||
#else
|
||||
#ifndef IMMEDIATE_MODE
|
||||
#define IMMEDIATE_MODE (1)
|
||||
#endif
|
||||
#ifndef DEBUG_MODE
|
||||
#define DEBUG_MODE (0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
pstring::~pstring()
|
||||
{
|
||||
@ -142,11 +162,15 @@ void pstring::resetmem()
|
||||
pblockpool::pblockpool()
|
||||
: m_shutdown(false)
|
||||
, m_first(NULL)
|
||||
, m_blocksize((DEBUG_MODE) ? 0 : 16384)
|
||||
, m_blocksize((DEBUG_MODE) ? 16384 : 16384)
|
||||
, m_align(8)
|
||||
{
|
||||
}
|
||||
|
||||
pblockpool::~pblockpool()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void *pblockpool::alloc(const std::size_t n)
|
||||
{
|
||||
|
@ -15,20 +15,12 @@
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
struct pblockpool {
|
||||
|
||||
NETLIST_PREVENT_COPYING(pblockpool)
|
||||
public:
|
||||
static const int MINDATASIZE = 8;
|
||||
|
||||
struct memblock
|
||||
{
|
||||
memblock *next;
|
||||
int size;
|
||||
int allocated;
|
||||
int remaining;
|
||||
char *cur;
|
||||
char data[MINDATASIZE];
|
||||
};
|
||||
|
||||
pblockpool();
|
||||
~pblockpool();
|
||||
|
||||
void resetmem();
|
||||
|
||||
@ -41,8 +33,19 @@ struct pblockpool {
|
||||
object->~T();
|
||||
dealloc(object);
|
||||
}
|
||||
|
||||
bool m_shutdown;
|
||||
|
||||
private:
|
||||
struct memblock
|
||||
{
|
||||
memblock *next;
|
||||
int size;
|
||||
int allocated;
|
||||
int remaining;
|
||||
char *cur;
|
||||
char data[MINDATASIZE];
|
||||
};
|
||||
|
||||
memblock *m_first;
|
||||
int m_blocksize;
|
||||
int m_align;
|
||||
|
Loading…
Reference in New Issue
Block a user