Netlist maintenance:

- netlist construction now is relying on fully qualified names, i.e. the name of
  a netlist object now starts with the netlist name. 
  This is a first step towards supporting netlist models, i.e. netlists which can be 
  used as a macro model. Very handy for opamps ...
- Changed log file filename format.
- Support analog net groups of up to 256 nets (i.e. Voltages).
This commit is contained in:
Couriersud 2014-02-11 21:35:26 +00:00
parent 37210e307f
commit 0d9d439b9b
7 changed files with 64 additions and 29 deletions

View File

@ -118,7 +118,7 @@ void netlist_matrix_solver_t::schedule()
}
else
{
m_owner->netlist().warning("Matrix solver reschedule .. Consider increasing RESCHED_LOOPS");
//m_owner->netlist().warning("Matrix solver reschedule .. Consider increasing RESCHED_LOOPS");
if (m_owner != NULL)
this->m_owner->schedule();
}
@ -750,7 +750,7 @@ NETLIB_UPDATE(solver)
if (global_resched)
{
netlist().warning("Gobal reschedule .. Consider increasing RESCHED_LOOPS");
//netlist().warning("Gobal reschedule .. Consider increasing RESCHED_LOOPS");
schedule();
}
else
@ -784,8 +784,9 @@ ATTR_COLD void NETLIB_NAME(solver)::post_start()
for (int i = 0; i <= cur_group; i++)
{
netlist_matrix_solver_t *ms;
int net_count = groups[i].count();
switch (groups[i].count())
switch (net_count)
{
case 1:
ms = new netlist_matrix_solver_direct1_t();
@ -803,17 +804,31 @@ ATTR_COLD void NETLIB_NAME(solver)::post_start()
break;
#if 0
case 5:
ms = new netlist_matrix_solver_direct_t<5,5>();
//ms = new netlist_matrix_solver_gauss_seidel_t<4,4>();
//ms = new netlist_matrix_solver_direct_t<5,5>();
ms = new netlist_matrix_solver_gauss_seidel_t<5,5>();
break;
case 6:
ms = new netlist_matrix_solver_direct_t<6,6>();
//ms = new netlist_matrix_solver_gauss_seidel_t<4,4>();
//ms = new netlist_matrix_solver_direct_t<6,6>();
ms = new netlist_matrix_solver_gauss_seidel_t<6,6>();
break;
#endif
default:
//ms = new netlist_matrix_solver_direct_t<0,16>();
ms = new netlist_matrix_solver_gauss_seidel_t<0,16>();
if (net_count <= 16)
{
//ms = new netlist_matrix_solver_direct_t<0,16>();
ms = new netlist_matrix_solver_gauss_seidel_t<0,16>();
}
else if (net_count <= 32)
{
//ms = new netlist_matrix_solver_direct_t<0,16>();
ms = new netlist_matrix_solver_gauss_seidel_t<0,32>();
}
else if (net_count <= 64)
{
//ms = new netlist_matrix_solver_direct_t<0,16>();
ms = new netlist_matrix_solver_gauss_seidel_t<0,64>();
}
break;
}

View File

@ -12,7 +12,7 @@ NETLIB_START(log)
{
register_input("I", m_I);
pstring filename = "netlist_" + name() + ".log";
pstring filename = pstring::sprintf("%s.log", name().cstr());
m_file = fopen(filename, "w");
}

View File

@ -21,7 +21,7 @@
#include "../nl_base.h"
#define LOG(_name, _I) \
NET_REGISTER_DEV(log, _name) \
NET_REGISTER_DEV(log, _name) \
NET_CONNECT(_name, I, _I)
NETLIB_DEVICE(log,
@ -32,8 +32,8 @@ protected:
);
#define LOGD(_name, _I, _I2) \
NET_REGISTER_DEV(logD, _name) \
NET_CONNECT(_name, I, _I) \
NET_REGISTER_DEV(logD, _name) \
NET_CONNECT(_name, I, _I) \
NET_CONNECT(_name, I2, _I2)
NETLIB_DEVICE_DERIVED(logD, log,

View File

@ -90,11 +90,11 @@ ATTR_COLD void netlist_object_t::init_object(netlist_base_t &nl, const pstring &
save_register();
}
ATTR_COLD const pstring &netlist_object_t::name() const
ATTR_COLD const pstring netlist_object_t::name() const
{
if (m_name == "")
netlist().error("object not initialized");
return m_name;
return m_name;
}
// ----------------------------------------------------------------------------------------
@ -386,7 +386,8 @@ ATTR_COLD void netlist_device_t::register_subalias(const pstring &name, netlist_
{
pstring alias = this->name() + "." + name;
setup().register_alias(alias, term.name());
// everything already fully qualified
setup().register_alias_nofqn(alias, term.name());
if (term.isType(netlist_terminal_t::INPUT) || term.isType(netlist_terminal_t::TERMINAL))
m_terminals.add(alias);

View File

@ -312,7 +312,7 @@ public:
ATTR_COLD void init_object(netlist_base_t &nl, const pstring &aname);
ATTR_COLD bool isInitalized() { return (m_netlist != NULL); }
ATTR_COLD const pstring &name() const;
ATTR_COLD const pstring name() const;
PSTATE_INTERFACE_DECL()
@ -1121,7 +1121,7 @@ protected:
};
// any derived netlist must override this ...
virtual void vfatalerror(const loglevel_e level,
ATTR_COLD ATTR_NORETURN virtual void vfatalerror(const loglevel_e level,
const char *format, va_list ap) const = 0;
/* from netlist_object */

View File

@ -56,11 +56,18 @@ netlist_setup_t::~netlist_setup_t()
pstring::resetmem();
}
// FIXME: Move to netlist ...
ATTR_COLD pstring netlist_setup_t::build_fqn(const pstring &obj_name) const
{
return netlist().name() + "." + obj_name;
}
netlist_device_t *netlist_setup_t::register_dev(netlist_device_t *dev, const pstring &name)
{
dev->init(netlist(), name);
if (!(netlist().m_devices.add(name, dev, false)==TMERR_NONE))
pstring fqn = build_fqn(name);
dev->init(netlist(), fqn);
if (!(netlist().m_devices.add(fqn, dev, false)==TMERR_NONE))
netlist().error("Error adding %s to device list\n", name.cstr());
return dev;
}
@ -109,11 +116,17 @@ void netlist_setup_t::register_model(const pstring &model)
m_models.add(model);
}
void netlist_setup_t::register_alias_nofqn(const pstring &alias, const pstring &out)
{
if (!(m_alias.add(alias, out, false)==TMERR_NONE))
netlist().error("Error adding alias %s to alias list\n", alias.cstr());
}
void netlist_setup_t::register_alias(const pstring &alias, const pstring &out)
{
//if (!(m_alias.add(alias, new nstring(out), false)==TMERR_NONE))
if (!(m_alias.add(alias, out, false)==TMERR_NONE))
netlist().error("Error adding alias %s to alias list\n", alias.cstr());
pstring alias_fqn = build_fqn(alias);
pstring out_fqn = build_fqn(out);
register_alias_nofqn(alias_fqn, out_fqn);
}
pstring netlist_setup_t::objtype_as_astr(netlist_object_t &in) const
@ -239,7 +252,7 @@ void netlist_setup_t::register_object(netlist_device_t &dev, const pstring &name
void netlist_setup_t::register_link(const pstring &sin, const pstring &sout)
{
link_t temp = link_t(sin, sout);
link_t temp = link_t(build_fqn(sin), build_fqn(sout));
NL_VERBOSE_OUT(("link %s <== %s\n", sin.cstr(), sout.cstr()));
m_links.add(temp);
//if (!(m_links.add(sin + "." + sout, temp, false)==TMERR_NONE))
@ -254,8 +267,9 @@ void netlist_setup_t::register_param(const pstring &param, const double value)
void netlist_setup_t::register_param(const pstring &param, const pstring &value)
{
//if (!(m_params_temp.add(param, new nstring(value), false)==TMERR_NONE))
if (!(m_params_temp.add(param, value, false)==TMERR_NONE))
pstring fqn = build_fqn(param);
if (!(m_params_temp.add(fqn, value, false)==TMERR_NONE))
netlist().error("Error adding parameter %s to parameter list\n", param.cstr());
}
@ -323,12 +337,14 @@ netlist_core_terminal_t *netlist_setup_t::find_terminal(const pstring &terminal_
netlist_param_t *netlist_setup_t::find_param(const pstring &param_in, bool required)
{
const pstring &outname = resolve_alias(param_in);
const pstring param_in_fqn = build_fqn(param_in);
const pstring &outname = resolve_alias(param_in_fqn);
netlist_param_t *ret;
ret = m_params.find(outname);
if (ret == NULL && required)
netlist().error("parameter %s(%s) not found!\n", param_in.cstr(), outname.cstr());
netlist().error("parameter %s(%s) not found!\n", param_in_fqn.cstr(), outname.cstr());
if (ret != NULL)
NL_VERBOSE_OUT(("Found parameter %s\n", outname.cstr()));
return ret;

View File

@ -110,11 +110,14 @@ public:
netlist_factory_t &factory() { return m_factory; }
const netlist_factory_t &factory() const { return m_factory; }
pstring build_fqn(const pstring &obj_name) const;
netlist_device_t *register_dev(netlist_device_t *dev, const pstring &name);
void remove_dev(const pstring &name);
void register_model(const pstring &model);
void register_alias(const pstring &alias, const pstring &out);
void register_alias_nofqn(const pstring &alias, const pstring &out);
void register_link(const pstring &sin, const pstring &sout);
void register_param(const pstring &param, const pstring &value);
void register_param(const pstring &param, const double value);