netlist: srcclean (nw)

This commit is contained in:
couriersud 2019-04-18 01:24:36 +02:00
parent 6392b345e6
commit e812e77567
4 changed files with 71 additions and 71 deletions

View File

@ -24,7 +24,7 @@
#include <cmath>
#define BODY_CONNECTED_TO_SOURCE (1)
#define BODY_CONNECTED_TO_SOURCE (1)
namespace netlist
{
@ -70,13 +70,13 @@ namespace analog
* | |Cj | Zero-bias bulk junction bottom capacitance per square meter of junction area|F/m²|0|0.0002|*
* | |Mj | Bulk junction bottom grading coefficient |-|0.5|0.5|*
* | |Cjsw | Zero-bias bulk junction sidewall capacitance per meter of junction perimeter|F/m|0|1p|*
* | |Mjsw | Bulk junction sidewall grading coefficient |-|.50 level 1 .33 level 2,3||
* | |Mjsw | Bulk junction sidewall grading coefficient |-|.50 level 1 .33 level 2,3||
* | |Js | Bulk junction saturation current per square-meter of junction area|A/m|0|0.00000001|
* | Y |Tox | Oxide thickness |m|0.0000001|0.0000001|
* | Y |Nsub | Substrate doping |1/cm³|0|4000000000000000|
* | |Nss | Surface state density |1/cm²|0|10000000000|
* | |Nfs | Fast surface state |1/cm²|0|10000000000|*
* | |TPG | Type of gate material: +1 opp. to substrate -1 same as substrate 0 Al gate|-|1|
* | |TPG | Type of gate material: +1 opp. to substrate -1 same as substrate 0 Al gate|-|1|
* | |Xj | Metallurgical junction depth |m|0|1µ|*
* | Y |Ld | Lateral diffusion |m|0|0.8µ|
* | Y |Uo | Surface mobility |cm²/V/s|600|700|
@ -124,25 +124,25 @@ namespace analog
, m_CAPMOD(*this, "CAPMOD")
{}
value_t m_VTO; //!< Threshold voltage [V]
value_t m_N; //!< Bulk diode emission coefficient
value_t m_ISS; //!< Body diode saturation current
value_t m_ISD; //!< Body diode saturation current
value_t m_LD; //!< Lateral diffusion [m]
value_t m_L; //!< Length scaling
value_t m_W; //!< Width scaling
value_t m_TOX; //!< Oxide thickness
value_t m_KP; //!< Transconductance parameter [A/V²]
value_t m_UO; //!< Surface mobility [cm²/V/s]
value_t m_PHI; //!< Surface inversion potential [V]
value_t m_NSUB; //!< Substrate doping [1/cm³]
value_t m_GAMMA; //!< Bulk threshold parameter [V^½]
value_t m_LAMBDA; //!< Channel-length modulation [1/V]
value_t m_RD; //!< Drain ohmic resistance
value_t m_RS; //!< Source ohmic resistance
value_t m_CGSO; //!< Gate-source overlap capacitance per meter channel width
value_t m_CGDO; //!< Gate-drain overlap capacitance per meter channel width
value_t m_CGBO; //!< Gate-bulk overlap capacitance per meter channel width
value_t m_VTO; //!< Threshold voltage [V]
value_t m_N; //!< Bulk diode emission coefficient
value_t m_ISS; //!< Body diode saturation current
value_t m_ISD; //!< Body diode saturation current
value_t m_LD; //!< Lateral diffusion [m]
value_t m_L; //!< Length scaling
value_t m_W; //!< Width scaling
value_t m_TOX; //!< Oxide thickness
value_t m_KP; //!< Transconductance parameter [A/V²]
value_t m_UO; //!< Surface mobility [cm²/V/s]
value_t m_PHI; //!< Surface inversion potential [V]
value_t m_NSUB; //!< Substrate doping [1/cm³]
value_t m_GAMMA; //!< Bulk threshold parameter [V^½]
value_t m_LAMBDA; //!< Channel-length modulation [1/V]
value_t m_RD; //!< Drain ohmic resistance
value_t m_RS; //!< Source ohmic resistance
value_t m_CGSO; //!< Gate-source overlap capacitance per meter channel width
value_t m_CGDO; //!< Gate-drain overlap capacitance per meter channel width
value_t m_CGBO; //!< Gate-bulk overlap capacitance per meter channel width
value_base_t<int> m_CAPMOD; //!< Capacitance model (0=no model 2=Meyer)
};
@ -229,11 +229,11 @@ namespace analog
/*
* From http://ltwiki.org/LTspiceHelp/LTspiceHelp/M_MOSFET.htm :
*
* VTO, KP, LAMBDA, PHI and GAMMA. These parameters are computed
* if the process parameters(NSUB, TOX,...) are given, but
* user-specified values always override.
* VTO, KP, LAMBDA, PHI and GAMMA. These parameters are computed
* if the process parameters(NSUB, TOX,...) are given, but
* user-specified values always override.
*
* But couldn't find a formula for lambda anywhere
* But couldn't find a formula for lambda anywhere
*
*/
@ -403,7 +403,7 @@ namespace analog
else
{
const nl_double Vdsat = Vctrl;
const nl_double Vds = Vgs - Vgd;
const nl_double Vds = Vgs - Vgd;
// saturation
if (Vdsat <= Vds)
{
@ -481,32 +481,32 @@ namespace analog
if (Vctrl <= 0.0)
{
// cutoff region
Ids = 0.0;
gm = 0.0;
gds = 0.0;
gmb = 0.0;
Ids = 0.0;
gm = 0.0;
gds = 0.0;
gmb = 0.0;
}
else
{
const nl_double beta = m_beta * (1.0 + m_lambda * absVds);
if (Vctrl <= absVds)
{
// saturation region
Ids = beta * Vctrl * Vctrl / 2.0;
gm = beta * Vctrl;
gds = m_lambda * m_beta * Vctrl * Vctrl / 2.0;
}
else
{
// linear region
Ids = beta * absVds * (Vctrl - absVds / 2);
gm = beta * absVds;
gds = beta * (Vctrl - absVds) + m_lambda * m_beta * absVds * (Vctrl - absVds / 2.0);
}
const nl_double beta = m_beta * (1.0 + m_lambda * absVds);
if (Vctrl <= absVds)
{
// saturation region
Ids = beta * Vctrl * Vctrl / 2.0;
gm = beta * Vctrl;
gds = m_lambda * m_beta * Vctrl * Vctrl / 2.0;
}
else
{
// linear region
Ids = beta * absVds * (Vctrl - absVds / 2);
gm = beta * absVds;
gds = beta * (Vctrl - absVds) + m_lambda * m_beta * absVds * (Vctrl - absVds / 2.0);
}
// backgate transconductance
const nl_double bgtc = (phi_m_Vbulk != 0.0) ? (m_gamma / phi_m_Vbulk / 2.0) : 0.0;
gmb = gm * bgtc;
gmb = gm * bgtc;
}
// FIXME: these are needed to compute capacitance
@ -581,7 +581,7 @@ namespace analog
gGS + gGB, gGG, IG ); // G
// D G
m_DG.set_mat( gDD, gDG, +ID, // D
gGD, 0.0, 0.0 ); // G
gGD, 0.0, 0.0 ); // G
// S D
m_SD.set_mat( 0.0, gSD + gBD, 0.0, // S
gDS + gDB, 0.0, 0.0); // D

View File

@ -157,7 +157,7 @@ namespace netlist
create_and_register_subdevice("DN", m_DN, "D(IS=1e-15 N=1)");
create_and_register_subdevice("DP", m_DP, "D(IS=1e-15 N=1)");
connect("DP.K", "VH");
connect("VL", "DN.A");
connect("DP.A", "DN.K");

View File

@ -12,13 +12,13 @@
#include "plib/pfmtlog.h"
#define PERRMSG(name, str) \
struct name \
struct name \
{ \
operator pstring() const { return str; } \
};
#define PERRMSGV(name, narg, str) \
struct name \
struct name \
{ \
template<typename... Args> name(Args&&... args) \
: m_m(plib::pfmt(str)(std::forward<Args>(args)...)) \
@ -29,30 +29,30 @@
// nl_base.cpp
PERRMSGV(MF_DUPLICATE_NAME_DEVICE_LIST, 1, "Error adding {1} to device list. Duplicate name.")
PERRMSGV(MF_UNKNOWN_TYPE_FOR_OBJECT, 1, "Unknown type for object {1},")
PERRMSGV(MF_NET_1_DUPLICATE_TERMINAL_2, 2, "net {1}: duplicate terminal {2}")
PERRMSGV(MF_REMOVE_TERMINAL_1_FROM_NET_2, 2, "Can not remove terminal {1} from net {2}.")
PERRMSGV(MF_UNKNOWN_PARAM_TYPE, 1, "Can not determine param_type for {1}")
PERRMSGV(MF_ERROR_CONNECTING_1_TO_2, 2, "Error connecting {1} to {2}")
PERRMSGV(MF_NO_SOLVER, 0, "No solver found for this netlist although analog elements are present")
PERRMSGV(MF_HND_VAL_NOT_SUPPORTED, 1, "HINT_NO_DEACTIVATE value not supported: <{1}>")
PERRMSGV(MF_DUPLICATE_NAME_DEVICE_LIST, 1, "Error adding {1} to device list. Duplicate name.")
PERRMSGV(MF_UNKNOWN_TYPE_FOR_OBJECT, 1, "Unknown type for object {1},")
PERRMSGV(MF_NET_1_DUPLICATE_TERMINAL_2, 2, "net {1}: duplicate terminal {2}")
PERRMSGV(MF_REMOVE_TERMINAL_1_FROM_NET_2, 2, "Can not remove terminal {1} from net {2}.")
PERRMSGV(MF_UNKNOWN_PARAM_TYPE, 1, "Can not determine param_type for {1}")
PERRMSGV(MF_ERROR_CONNECTING_1_TO_2, 2, "Error connecting {1} to {2}")
PERRMSGV(MF_NO_SOLVER, 0, "No solver found for this netlist although analog elements are present")
PERRMSGV(MF_HND_VAL_NOT_SUPPORTED, 1, "HINT_NO_DEACTIVATE value not supported: <{1}>")
// nl_factory.cpp
PERRMSGV(MF_FACTORY_ALREADY_CONTAINS_1, 1, "factory already contains {1}")
PERRMSGV(MF_CLASS_1_NOT_FOUND, 1, "Class <{1}> not found!")
PERRMSGV(MF_FACTORY_ALREADY_CONTAINS_1, 1, "factory already contains {1}")
PERRMSGV(MF_CLASS_1_NOT_FOUND, 1, "Class <{1}> not found!")
// nld_opamps.cpp
PERRMSGV(MF_UNKNOWN_OPAMP_TYPE, 1, "Unknown opamp type: {1}")
PERRMSGV(MF_UNKNOWN_OPAMP_TYPE, 1, "Unknown opamp type: {1}")
// nld_matrix_solver.cpp
PERRMSGV(MF_UNHANDLED_ELEMENT_1_FOUND, 1, "setup_base:unhandled element <{1}> found")
PERRMSGV(MF_FOUND_TERM_WITH_MISSING_OTHERNET, 1, "found term with missing othernet {1}")
PERRMSGV(MF_UNHANDLED_ELEMENT_1_FOUND, 1, "setup_base:unhandled element <{1}> found")
PERRMSGV(MF_FOUND_TERM_WITH_MISSING_OTHERNET, 1, "found term with missing othernet {1}")
PERRMSGV(MW_NEWTON_LOOPS_EXCEEDED_ON_NET_1, 1, "NEWTON_LOOPS exceeded on net {1}... reschedule")
PERRMSGV(MW_NEWTON_LOOPS_EXCEEDED_ON_NET_1, 1, "NEWTON_LOOPS exceeded on net {1}... reschedule")
// nld_solver.cpp
@ -116,11 +116,11 @@ PERRMSGV(MW_DATA_1_NOT_FOUND, 1, "unable to find data {1} in s
// nld_mm5837.cpp
PERRMSGV(MW_FREQUENCY_OUTSIDE_OF_SPECS_1, 1, "MM5837: Frequency outside of specs: {1}")
PERRMSGV(MW_FREQUENCY_OUTSIDE_OF_SPECS_1, 1, "MM5837: Frequency outside of specs: {1}")
// nlid_proxy.cpp
PERRMSGV(MI_NO_POWER_TERMINALS_ON_DEVICE_1, 1, "D/A Proxy: Found no valid combination of power terminals on device {1}")
PERRMSGV(MI_NO_POWER_TERMINALS_ON_DEVICE_1, 1, "D/A Proxy: Found no valid combination of power terminals on device {1}")
#endif /* NL_ERRSTR_H_ */

View File

@ -62,11 +62,11 @@ namespace plib
template <typename T>
struct constants
{
static constexpr T zero() noexcept { return static_cast<T>(0); }
static constexpr T one() noexcept { return static_cast<T>(1); }
static constexpr T two() noexcept { return static_cast<T>(2); }
static constexpr T zero() noexcept { return static_cast<T>(0); }
static constexpr T one() noexcept { return static_cast<T>(1); }
static constexpr T two() noexcept { return static_cast<T>(2); }
static constexpr T sqrt2() noexcept { return static_cast<T>(1.414213562373095048801688724209); }
static constexpr T pi() noexcept { return static_cast<T>(3.14159265358979323846264338327950); }
static constexpr T pi() noexcept { return static_cast<T>(3.14159265358979323846264338327950); }
/*!
* \brief Electric constant of vacuum