Add macro library for opamp models. (nw)

This commit is contained in:
couriersud 2015-07-14 00:57:45 +02:00
parent 821be22983
commit aa5785832c
8 changed files with 115 additions and 52 deletions

View File

@ -9,9 +9,6 @@
#ifndef __PLIB_PREPROCESSOR__
#define MB3614_DIP(_name) \
NET_REGISTER_DEV_X(MB3614_DIP, _name)
#define LM358_DIP(_name) \
NET_REGISTER_DEV_X(LM358_DIP, _name)
@ -78,6 +75,12 @@ NETLIST_START(dummy)
INCLUDE(CongoBongo_schematics)
/* The opamp actually has an FPF of about 500k. This doesn't work here and causes oscillations.
* FPF here therefore about half the Solver clock.
*/
PARAM(XU16.B.model, "MB3614_SLOW")
PARAM(XU17.C.model, "MB3614_SLOW")
OPTIMIZE_FRONTIER(C51.1, RES_K(20), 50)
OPTIMIZE_FRONTIER(R77.2, RES_K(20), 50)
@ -226,6 +229,7 @@ NETLIST_START(CongoBongo_schematics)
CD4538_DIP(XU19)
MM5837_DIP(XU20)
TTL_7416_DIP(XU6)
NET_C(D1.A, C21.2, R23.1)
NET_C(D1.K, C20.1, R22.1)
NET_C(XU13.1, C37.2, C36.1, R48.1)
@ -410,47 +414,6 @@ NETLIST_START(opamp_mod)
NETLIST_END()
NETLIST_START(MB3614_DIP)
#if 0
SUBMODEL(opamp_mod, op1)
SUBMODEL(opamp_mod, op2)
SUBMODEL(opamp_mod, op3)
SUBMODEL(opamp_mod, op4)
#else
/* The opamp actually has an FPF of about 500k. This doesn't work here and causes oscillations.
* FPF here therefore about half the Solver clock.
*/
OPAMP(op1, ".model MB3614 OPAMP(TYPE=3 VLH=2.0 VLL=0.2 FPF=5 UGF=110k SLEW=0.6M RI=1000k RO=50 DAB=0.002)")
OPAMP(op2, ".model MB3614 OPAMP(TYPE=3 VLH=2.0 VLL=0.2 FPF=5 UGF=11k SLEW=0.6M RI=1000k RO=50 DAB=0.002)")
OPAMP(op3, ".model MB3614 OPAMP(TYPE=3 VLH=2.0 VLL=0.2 FPF=5 UGF=11k SLEW=0.6M RI=1000k RO=50 DAB=0.002)")
OPAMP(op4, ".model MB3614 OPAMP(TYPE=3 VLH=2.0 VLL=0.2 FPF=5 UGF=110k SLEW=0.6M RI=1000k RO=50 DAB=0.002)")
#endif
ALIAS( 1, op1.OUT)
ALIAS( 2, op1.MINUS)
ALIAS( 3, op1.PLUS)
ALIAS( 4, op1.VCC)
ALIAS( 5, op2.PLUS)
ALIAS( 6, op2.MINUS)
ALIAS( 7, op2.OUT)
ALIAS( 8, op3.OUT)
ALIAS( 9, op3.MINUS)
ALIAS(10, op3.PLUS)
ALIAS(11, op1.GND)
ALIAS(12, op4.PLUS)
ALIAS(13, op4.MINUS)
ALIAS(14, op4.OUT)
NET_C(op1.GND, op2.GND, op3.GND, op4.GND)
NET_C(op1.VCC, op2.VCC, op3.VCC, op4.VCC)
NETLIST_END()
NETLIST_START(G501534_DIP)
AFUNC(f, 2, "A0 A1 0.2 * *")
@ -482,9 +445,6 @@ NETLIST_END()
NETLIST_START(congob_lib)
//LOCAL_LIB_ENTRY(LM324_DIP)
//LOCAL_LIB_ENTRY(LM358_DIP)
LOCAL_LIB_ENTRY(MB3614_DIP)
LOCAL_LIB_ENTRY(G501534_DIP)
NETLIST_END()

View File

@ -156,4 +156,6 @@ project "netlist"
MAME_DIR .. "src/emu/netlist/macro/nlm_ttl74xx.h",
MAME_DIR .. "src/emu/netlist/macro/nlm_cd4xxx.c",
MAME_DIR .. "src/emu/netlist/macro/nlm_cd4xxx.h",
MAME_DIR .. "src/emu/netlist/macro/nlm_opamp.c",
MAME_DIR .. "src/emu/netlist/macro/nlm_opamp.h",
}

View File

@ -56,13 +56,15 @@
#include "nld_log.h"
#include "../macro/nlm_cd4xxx.h"
#include "../macro/nlm_ttl74xx.h"
#include "../macro/nlm_opamp.h"
#include "../analog/nld_bjt.h"
#include "../analog/nld_fourterm.h"
#include "../analog/nld_switches.h"
#include "../analog/nld_twoterm.h"
#include "../analog/nld_opamps.h"
#include "../macro/nlm_cd4xxx.h"
#include "../macro/nlm_ttl74xx.h"
#include "../solver/nld_solver.h"
#include "nld_legacy.h"

View File

@ -3,6 +3,17 @@
#include "../nl_setup.h"
/*
* Devices:
*
* CD4001_NOR : single gate
* CD4001_DIP : dip package
* CD4020_DIP : dip package (device model in core)
* CD4016_DIP : dip package (device model in core)
* CD4066_DIP : dip package (device model in core)
*
*/
#ifndef __PLIB_PREPROCESSOR__
/* ----------------------------------------------------------------------------

View File

@ -0,0 +1,47 @@
#include "nlm_opamp.h"
#include "analog/nld_opamps.h"
#include "devices/nld_system.h"
/*
* Generic layout with 4 opamps, VCC on pint 4 and GND on pin 11
*/
NETLIST_START(opamp_layout_4_4_11)
DIPPINS( /* +--------------+ */
A.OUT, /* |1 ++ 14| */ D.OUT,
A.MINUS, /* |2 13| */ D.MINUS,
A.PLUS, /* |3 12| */ D.PLUS,
A.VCC, /* |4 11| */ A.GND,
B.PLUS, /* |5 10| */ C.PLUS,
B.MINUS, /* |6 9| */ C.MINUS,
B.OUT, /* |7 8| */ C.OUT
/* +--------------+ */
)
NET_C(A.GND, B.GND, C.GND, D.GND)
NET_C(A.VCC, B.VCC, C.VCC, D.VCC)
NETLIST_END()
NETLIST_START(MB3614_DIP)
/* The opamp actually has an FPF of about 500k. This doesn't work here and causes oscillations.
* FPF here therefore about half the Solver clock.
*/
OPAMP(A, "MB3614")
OPAMP(B, "MB3614")
OPAMP(C, "MB3614")
OPAMP(D, "MB3614")
INCLUDE(opamp_layout_4_4_11)
NETLIST_END()
NETLIST_START(OPAMP_lib)
LOCAL_LIB_ENTRY(opamp_layout_4_4_11)
NET_MODEL(".model MB3614 OPAMP(TYPE=3 VLH=2.0 VLL=0.2 FPF=5 UGF=500k SLEW=0.6M RI=1000k RO=50 DAB=0.002)")
NET_MODEL(".model MB3614_SLOW OPAMP(TYPE=3 VLH=2.0 VLL=0.2 FPF=5 UGF=11k SLEW=0.6M RI=1000k RO=50 DAB=0.002)")
LOCAL_LIB_ENTRY(MB3614_DIP)
NETLIST_END()

View File

@ -0,0 +1,23 @@
#ifndef NLM_OPAMP_H_
#define NLM_OPAMP_H_
#include "../nl_setup.h"
#ifndef __PLIB_PREPROCESSOR__
/* ----------------------------------------------------------------------------
* Netlist Macros
* ---------------------------------------------------------------------------*/
#define MB3614_DIP(_name) \
NET_REGISTER_DEV_X(MB3614_DIP, _name)
/* ----------------------------------------------------------------------------
* External declarations
* ---------------------------------------------------------------------------*/
NETLIST_EXTERNAL(OPAMP_lib)
#endif
#endif

View File

@ -29,13 +29,14 @@ static NETLIST_START(base)
LOCAL_SOURCE(family_models)
LOCAL_SOURCE(TTL74XX_lib)
LOCAL_SOURCE(CD4XXX_lib)
LOCAL_SOURCE(OPAMP_lib)
INCLUDE(diode_models);
INCLUDE(bjt_models);
INCLUDE(family_models);
INCLUDE(TTL74XX_lib);
INCLUDE(CD4XXX_lib);
INCLUDE(OPAMP_lib);
NETLIST_END()
@ -399,8 +400,17 @@ void setup_t::register_param(const pstring &param, const pstring &value)
{
pstring fqn = build_fqn(param);
if (!(m_params_temp.add(link_t(fqn, value), false)==true))
netlist().error("Error adding parameter %s to parameter list\n", param.cstr());
int idx = m_params_temp.index_by_name(fqn);
if (idx < 0)
{
if (!(m_params_temp.add(link_t(fqn, value), false)==true))
netlist().error("Unexpected error adding parameter %s to parameter list\n", param.cstr());
}
else
{
netlist().warning("Overwriting %s old <%s> new <%s>\n", fqn.cstr(), m_params_temp[idx].e2.cstr(), value.cstr());
m_params_temp[idx].e2 = value;
}
}
const pstring setup_t::resolve_alias(const pstring &name) const

View File

@ -364,6 +364,14 @@ public:
return _ListClass(NULL);
}
int index_by_name(const pstring &name) const
{
for (std::size_t i=0; i < this->size(); i++)
if (get_name((*this)[i]) == name)
return (int) i;
return -1;
}
void remove_by_name(const pstring &name)
{
plist_t<_ListClass>::remove(find_by_name(name));