49#define SIM_REFERENCE_FIELD wxT( "Reference" )
50#define SIM_VALUE_FIELD wxT( "Value" )
52#define SIM_DEVICE_TYPE_FIELD wxT( "Sim.Device" )
53#define SIM_TYPE_FIELD wxT( "Sim.Type" )
54#define SIM_PINS_FIELD wxT( "Sim.Pins" )
55#define SIM_PARAMS_FIELD wxT( "Sim.Params" )
58#define SIM_ENABLE_FIELD wxT( "Sim.Enable" )
59#define SIM_LIBRARY_FIELD wxT( "Sim.Library" )
60#define SIM_NAME_FIELD wxT( "Sim.Name" )
62#define SIM_LEGACY_DEVICE_TYPE_FIELD wxS( "Spice_Primitive" )
63#define SIM_LEGACY_TYPE_FIELD wxS( "Spice_Model" )
64#define SIM_LEGACY_PINS_FIELD wxS( "Spice_Node_Sequence" )
65#define SIM_LEGACY_ENABLE_FIELD wxS( "Spice_Netlist_Enabled" )
66#define SIM_LEGACY_LIBRARY_FIELD wxS( "Spice_Lib_File" )
118 std::string fieldValue;
119 std::string description;
157 NJFET_SHICHMANHODGES,
158 PJFET_SHICHMANHODGES,
160 NJFET_PARKERSKELLERN,
161 PJFET_PARKERSKELLERN,
288 std::string fieldValue;
289 std::string description;
345 INFO(
const std::string& aName =
"",
349 const std::string& aUnit =
"",
350 CATEGORY aCategory = CATEGORY::PRINCIPAL,
351 const std::string& aDefaultValue =
"",
352 const std::string& legacy_unused_value =
"",
353 const std::string& aDescription =
"",
354 bool aIsSpiceInstanceParam =
false,
355 bool aIsInstanceParam =
false,
356 const std::string& aSpiceModelName =
"",
357 const std::string& aSpiceInstanceName =
"",
358 std::vector<std::string> aEnumValues = {} ) :
374 bool Matches(
const std::string& aName )
const;
395 bool Matches(
const std::string& aName )
const
405 static DEVICE_INFO
DeviceInfo( DEVICE_T aDeviceType );
410 template <
typename T>
413 static std::unique_ptr<SIM_MODEL>
Create(
TYPE aType,
const std::vector<LIB_PIN*>& aPins,
417 const std::vector<LIB_PIN*>& aPins,
420 template <
typename T>
422 const std::vector<LIB_PIN*>& aPins,
423 const std::vector<T>& aFields,
426 template <
typename T>
427 static std::unique_ptr<SIM_MODEL>
Create(
const std::vector<T>& aFields,
428 const std::vector<LIB_PIN*>& aPins,
429 bool aResolved,
REPORTER& aReporter );
431 template <
typename T>
432 static std::string
GetFieldValue(
const std::vector<T>* aFields,
const wxString& aFieldName,
433 bool aResolve =
true );
435 template <
typename T>
436 static void SetFieldValue( std::vector<T>& aFields,
const wxString& aFieldName,
437 const std::string& aValue );
451 template <
typename T>
452 void ReadDataFields(
const std::vector<T>* aFields,
const std::vector<LIB_PIN*>& aPins );
454 template <
typename T>
459 void AddPin(
const PIN& aPin );
474 virtual std::vector<std::string>
GetPinNames()
const {
return {}; }
479 std::vector<std::reference_wrapper<const PIN>>
GetPins()
const;
483 const std::string& aSymbolPinNumber );
493 std::vector<std::reference_wrapper<const PARAM>>
GetParams()
const;
499 void SetParamValue(
int aParamIndex,
const std::string& aValue,
501 void SetParamValue(
const std::string& aParamName,
const std::string& aValue,
520 template <
class T_symbol,
class T_field>
521 static bool InferSimModel( T_symbol& aSymbol, std::vector<T_field>* aFields,
bool aResolve,
523 wxString* aModelType, wxString* aModelParams, wxString* aPinMap );
525 template <
class T_symbol,
class T_field>
529 static std::unique_ptr<SIM_MODEL>
Create(
TYPE aType );
532 SIM_MODEL(
TYPE aType, std::unique_ptr<SPICE_GENERATOR> aSpiceGenerator );
533 SIM_MODEL(
TYPE aType, std::unique_ptr<SPICE_GENERATOR> aSpiceGenerator,
534 std::unique_ptr<SIM_MODEL_SERIALIZER> aSerializer );
536 void createPins(
const std::vector<LIB_PIN*>& aSymbolPins );
538 virtual int doFindParam(
const std::string& aParamName )
const;
539 virtual void doSetParamValue(
int aParamIndex,
const std::string& aValue );
542 template <
typename T>
543 void doReadDataFields(
const std::vector<T>* aFields,
const std::vector<LIB_PIN*>& aPins );
545 template <
typename T>
Container for project specific data.
A pure virtual class used to derive REPORTER objects from.
Serializes/deserializes a SIM_MODEL for storage in LIB_FIELDs/SCH_FIELDs.
int FindModelPinIndex(const std::string &aSymbolPinNumber)
const SIM_MODEL * GetBaseModel() const
const PARAM & GetBaseParam(unsigned aParamIndex) const
void AddParam(const PARAM::INFO &aInfo)
bool IsStoredInValue() const
static bool InferSimModel(T_symbol &aSymbol, std::vector< T_field > *aFields, bool aResolve, SIM_VALUE_GRAMMAR::NOTATION aNotation, wxString *aDeviceType, wxString *aModelType, wxString *aModelParams, wxString *aPinMap)
virtual std::vector< std::string > GetPinNames() const
std::unique_ptr< SPICE_GENERATOR > m_spiceGenerator
virtual bool requiresSpiceModelLine(const SPICE_ITEM &aItem) const
std::vector< PIN > m_pins
static INFO TypeInfo(TYPE aType)
DEFINE_ENUM_CLASS_WITH_ITERATOR(TYPE, NONE, R, R_POT, R_BEHAVIORAL, C, C_BEHAVIORAL, L, L_MUTUAL, L_BEHAVIORAL, TLINE_Z0, TLINE_RLGC, SW_V, SW_I, D, NPN_VBIC, PNP_VBIC, NPN_GUMMELPOON, PNP_GUMMELPOON, NPN_HICUM2, PNP_HICUM2, NJFET_SHICHMANHODGES, PJFET_SHICHMANHODGES, NJFET_PARKERSKELLERN, PJFET_PARKERSKELLERN, NMES_STATZ, PMES_STATZ, NMES_YTTERDAL, PMES_YTTERDAL, NMES_HFET1, PMES_HFET1, NMES_HFET2, PMES_HFET2, NMOS_VDMOS, PMOS_VDMOS, NMOS_MOS1, PMOS_MOS1, NMOS_MOS2, PMOS_MOS2, NMOS_MOS3, PMOS_MOS3, NMOS_BSIM1, PMOS_BSIM1, NMOS_BSIM2, PMOS_BSIM2, NMOS_MOS6, PMOS_MOS6, NMOS_MOS9, PMOS_MOS9, NMOS_BSIM3, PMOS_BSIM3, NMOS_B4SOI, PMOS_B4SOI, NMOS_BSIM4, PMOS_BSIM4, NMOS_B3SOIFD, PMOS_B3SOIFD, NMOS_B3SOIDD, PMOS_B3SOIDD, NMOS_B3SOIPD, PMOS_B3SOIPD, NMOS_HISIM2, PMOS_HISIM2, NMOS_HISIMHV1, PMOS_HISIMHV1, NMOS_HISIMHV2, PMOS_HISIMHV2, V, V_SIN, V_PULSE, V_EXP, V_VCL, V_CCL, V_PWL, V_WHITENOISE, V_PINKNOISE, V_BURSTNOISE, V_RANDUNIFORM, V_RANDNORMAL, V_RANDEXP, V_BEHAVIORAL, I, I_SIN, I_PULSE, I_EXP, I_VCL, I_CCL, I_PWL, I_WHITENOISE, I_PINKNOISE, I_BURSTNOISE, I_RANDUNIFORM, I_RANDNORMAL, I_RANDEXP, I_BEHAVIORAL, SUBCKT, XSPICE, KIBIS_DEVICE, KIBIS_DRIVER_DC, KIBIS_DRIVER_RECT, KIBIS_DRIVER_PRBS, RAWSPICE) struct INFO
virtual const PARAM * GetTunerParam() const
std::vector< std::reference_wrapper< const PIN > > GetPins() const
static SPICE_INFO SpiceInfo(TYPE aType)
void ReadDataFields(const std::vector< T > *aFields, const std::vector< LIB_PIN * > &aPins)
const SIM_MODEL_SERIALIZER & Serializer() const
static void SetFieldValue(std::vector< T > &aFields, const wxString &aFieldName, const std::string &aValue)
const SPICE_GENERATOR & SpiceGenerator() const
static std::string GetFieldValue(const std::vector< T > *aFields, const wxString &aFieldName, bool aResolve=true)
virtual const PARAM & GetParam(unsigned aParamIndex) const
static TYPE ReadTypeFromFields(const std::vector< T > &aFields, REPORTER &aReporter)
void createPins(const std::vector< LIB_PIN * > &aSymbolPins)
static std::unique_ptr< SIM_MODEL > Create(TYPE aType, const std::vector< LIB_PIN * > &aPins, REPORTER &aReporter)
virtual void SetBaseModel(const SIM_MODEL &aBaseModel)
void doWriteFields(std::vector< T > &aFields) const
int GetParamCount() const
void SetPinSymbolPinNumber(int aPinIndex, const std::string &aSymbolPinNumber)
DEVICE_INFO GetDeviceInfo() const
DEVICE_T GetDeviceType() const
void AddPin(const PIN &aPin)
static DEVICE_INFO DeviceInfo(DEVICE_T aDeviceType)
const PIN & GetPin(unsigned aIndex) const
const PARAM * FindParam(const std::string &aParamName) const
virtual void doSetParamValue(int aParamIndex, const std::string &aValue)
std::vector< PARAM > m_params
const PARAM & GetParamOverride(unsigned aParamIndex) const
SIM_MODEL(SIM_MODEL &&aOther)=default
virtual bool HasAutofill() const
DEFINE_ENUM_CLASS_WITH_ITERATOR(DEVICE_T, NONE, R, C, L, TLINE, SW, D, NPN, PNP, NJFET, PJFET, NMES, PMES, NMOS, PMOS, V, I, E, F, G, H, SUBCKT, XSPICE, KIBIS, SPICE) struct DEVICE_INFO
void SetIsEnabled(bool aIsEnabled)
SIM_MODEL & operator=(SIM_MODEL &&aOther)=delete
static void MigrateSimModel(T_symbol &aSymbol, const PROJECT *aProject)
void SetParamValue(int aParamIndex, const std::string &aValue, SIM_VALUE::NOTATION aNotation=SIM_VALUE::NOTATION::SI)
SPICE_INFO GetSpiceInfo() const
virtual void SwitchSingleEndedDiff(bool aDiff)
std::vector< std::reference_wrapper< const PARAM > > GetParams() const
void SetIsStoredInValue(bool aIsStoredInValue)
void WriteFields(std::vector< T > &aFields) const
std::unique_ptr< SIM_MODEL_SERIALIZER > m_serializer
virtual bool HasPrimaryValue() const
virtual int doFindParam(const std::string &aParamName) const
void doReadDataFields(const std::vector< T > *aFields, const std::vector< LIB_PIN * > &aPins)
const SIM_MODEL * m_baseModel
SIM_MODEL(const SIM_MODEL &aOther)=delete
std::string spiceModelName
std::vector< std::string > enumValues
INFO(const std::string &aName="", unsigned aId=0, DIR aDir=DIR_INOUT, SIM_VALUE::TYPE aType=SIM_VALUE::TYPE_FLOAT, const std::string &aUnit="", CATEGORY aCategory=CATEGORY::PRINCIPAL, const std::string &aDefaultValue="", const std::string &legacy_unused_value="", const std::string &aDescription="", bool aIsSpiceInstanceParam=false, bool aIsInstanceParam=false, const std::string &aSpiceModelName="", const std::string &aSpiceInstanceName="", std::vector< std::string > aEnumValues={})
bool Matches(const std::string &aName) const
std::string spiceInstanceName
bool isSpiceInstanceParam
bool Matches(const std::string &aName) const
std::string symbolPinNumber
static constexpr auto NOT_CONNECTED
std::string inlineTypeString