28#include <wx/filename.h> 
   46    std::vector<std::string> currentNames;
 
   49        currentNames.push_back( fmt::format( 
"I({}:{})", 
ItemName( aItem ), 
pin.modelPinName ) );
 
 
   56                                              const wxString& aCacheDir, 
REPORTER& aReporter )
 const 
   67    std::vector<EMBEDDED_FILES*> embeddedFilesStack;
 
   76    KIBIS kibis( std::string( 
path.c_str() ) );
 
   77    kibis.
m_cacheDir = std::string( aCacheDir.c_str() );
 
   81        THROW_IO_ERROR( wxString::Format( 
_( 
"Invalid IBIS file '%s'" ), ibisLibFilename ) );
 
   86        THROW_IO_ERROR( wxString::Format( 
_( 
"Could not find IBIS component '%s'" ), ibisCompName ) );
 
   92        THROW_IO_ERROR( wxString::Format( 
_( 
"Invalid IBIS component '%s'" ), ibisCompName ) );
 
   96        THROW_IO_ERROR( wxString::Format( 
_( 
"Could not find IBIS pin '%s' in component '%s'" ),
 
  103        THROW_IO_ERROR( wxString::Format( 
_( 
"Invalid IBIS pin '%s' in component '%s'" ),
 
  111        THROW_IO_ERROR( wxString::Format( 
_( 
"Could not find IBIS model '%s'" ), ibisModelName ) );
 
  114        THROW_IO_ERROR( wxString::Format( 
_( 
"Invalid IBIS model '%s'" ), ibisModelName ) );
 
  136    case SIM_MODEL::TYPE::KIBIS_DEVICE:
 
  143    case SIM_MODEL::TYPE::KIBIS_DRIVER_DC:
 
  145        std::string paramValue = 
"";
 
  148            paramValue = dc->value;
 
  150        if( paramValue == 
"hi-Z" )
 
  154        else if( paramValue == 
"low" )
 
  158        else if( paramValue == 
"high" )
 
  170    case SIM_MODEL::TYPE::KIBIS_DRIVER_RECT:
 
  195    case SIM_MODEL::TYPE::KIBIS_DRIVER_PRBS:
 
  218        wxFAIL_MSG( 
"Unknown IBIS model type" );
 
 
  231    static std::vector<PARAM::INFO> device = 
makeParamInfos( TYPE::KIBIS_DEVICE );
 
  232    static std::vector<PARAM::INFO> dcDriver = 
makeParamInfos( TYPE::KIBIS_DRIVER_DC );
 
  233    static std::vector<PARAM::INFO> rectDriver = 
makeParamInfos( TYPE::KIBIS_DRIVER_RECT );
 
  234    static std::vector<PARAM::INFO> prbsDriver = 
makeParamInfos( TYPE::KIBIS_DRIVER_PRBS );
 
  236    std::vector<PARAM::INFO>* paramInfos = 
nullptr;
 
  240    case SIM_MODEL::TYPE::KIBIS_DEVICE:      paramInfos = &device;     
break;
 
  241    case SIM_MODEL::TYPE::KIBIS_DRIVER_DC:   paramInfos = &dcDriver;   
break;
 
  242    case SIM_MODEL::TYPE::KIBIS_DRIVER_RECT: paramInfos = &rectDriver; 
break;
 
  243    case SIM_MODEL::TYPE::KIBIS_DRIVER_PRBS: paramInfos = &prbsDriver; 
break;
 
  250    for( 
const PARAM::INFO& paramInfo : *paramInfos )
 
 
  270        AddPin( { 
"IN/OUT", 
"2" } );
 
 
  283            if( param1.info.name == param2.
info.
name )
 
 
  330    std::vector<PARAM::INFO> paramInfos;
 
  331    PARAM::INFO              paramInfo;
 
  333    paramInfo.name = 
"vcc";
 
  336    paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
 
  337    paramInfo.defaultValue = 
"typ";
 
  338    paramInfo.description = 
_( 
"Power supply" );
 
  339    paramInfo.spiceModelName = 
"";
 
  340    paramInfo.enumValues = { 
"typ", 
"min", 
"max" };
 
  341    paramInfos.push_back( paramInfo );
 
  343    paramInfo.name = 
"rpin";
 
  346    paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
 
  347    paramInfo.defaultValue = 
"typ";
 
  348    paramInfo.description = 
_( 
"Parasitic pin resistance" );
 
  349    paramInfo.spiceModelName = 
"";
 
  350    paramInfo.enumValues = { 
"typ", 
"min", 
"max" };
 
  351    paramInfos.push_back( paramInfo );
 
  353    paramInfo.name = 
"lpin";
 
  356    paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
 
  357    paramInfo.defaultValue = 
"typ";
 
  358    paramInfo.description = 
_( 
"Parasitic pin inductance" );
 
  359    paramInfo.spiceModelName = 
"";
 
  360    paramInfo.enumValues = { 
"typ", 
"min", 
"max" };
 
  361    paramInfos.push_back( paramInfo );
 
  363    paramInfo.name = 
"cpin";
 
  366    paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
 
  367    paramInfo.defaultValue = 
"typ";
 
  368    paramInfo.description = 
_( 
"Parasitic pin capacitance" );
 
  369    paramInfo.spiceModelName = 
"";
 
  370    paramInfo.enumValues = { 
"typ", 
"min", 
"max" };
 
  371    paramInfos.push_back( paramInfo );
 
  379    case TYPE::KIBIS_DRIVER_DC:
 
  381            paramInfos.push_back( param );
 
  384    case TYPE::KIBIS_DRIVER_RECT:
 
  386            paramInfos.push_back( param );
 
  389    case TYPE::KIBIS_DRIVER_PRBS:
 
  391            paramInfos.push_back( param );
 
 
  404    std::vector<PARAM::INFO> paramInfos;
 
  405    PARAM::INFO              paramInfo;
 
  407    paramInfo.name = 
"dc";
 
  410    paramInfo.category = PARAM::CATEGORY::WAVEFORM;
 
  411    paramInfo.defaultValue = 
"hi-Z";
 
  412    paramInfo.description = 
_( 
"DC Value" );
 
  413    paramInfo.enumValues = { 
"hi-Z", 
"low", 
"high" };
 
  414    paramInfos.push_back( paramInfo );
 
 
  422    std::vector<PARAM::INFO> paramInfos;
 
  423    PARAM::INFO              paramInfo;
 
  425    paramInfo.name = 
"ton";
 
  427    paramInfo.unit = 
"s";
 
  428    paramInfo.category = PARAM::CATEGORY::WAVEFORM;
 
  429    paramInfo.defaultValue = 
"";
 
  430    paramInfo.description = 
_( 
"ON time" );
 
  431    paramInfos.push_back( paramInfo );
 
  433    paramInfo.name = 
"toff";
 
  435    paramInfo.unit = 
"s";
 
  436    paramInfo.category = PARAM::CATEGORY::WAVEFORM;
 
  437    paramInfo.defaultValue = 
"";
 
  438    paramInfo.description = 
_( 
"OFF time" );
 
  439    paramInfos.push_back( paramInfo );
 
  441    paramInfo.name = 
"td";
 
  443    paramInfo.unit = 
"s";
 
  444    paramInfo.category = PARAM::CATEGORY::WAVEFORM;
 
  445    paramInfo.defaultValue = 
"0";
 
  446    paramInfo.description = 
_( 
"Delay" );
 
  447    paramInfos.push_back( paramInfo );
 
  449    paramInfo.name = 
"n";
 
  452    paramInfo.category = PARAM::CATEGORY::WAVEFORM;
 
  453    paramInfo.defaultValue = 
"1";
 
  454    paramInfo.description = 
_( 
"Number of cycles" );
 
  455    paramInfos.push_back( paramInfo );
 
 
  463    std::vector<PARAM::INFO> paramInfos;
 
  464    PARAM::INFO              paramInfo;
 
  466    paramInfo.name = 
"f0";
 
  468    paramInfo.unit = 
"Hz";
 
  469    paramInfo.category = PARAM::CATEGORY::WAVEFORM;
 
  470    paramInfo.defaultValue = 
"";
 
  471    paramInfo.description = 
_( 
"Bitrate" );
 
  472    paramInfos.push_back( paramInfo );
 
  474    paramInfo.name = 
"td";
 
  476    paramInfo.unit = 
"s";
 
  477    paramInfo.category = PARAM::CATEGORY::WAVEFORM;
 
  478    paramInfo.defaultValue = 
"";
 
  479    paramInfo.description = 
_( 
"Delay" );
 
  480    paramInfos.push_back( paramInfo );
 
  482    paramInfo.name = 
"n";
 
  485    paramInfo.category = PARAM::CATEGORY::WAVEFORM;
 
  486    paramInfo.defaultValue = 
"";
 
  487    paramInfo.description = 
_( 
"Number of bits" );
 
  488    paramInfos.push_back( paramInfo );
 
 
KIBIS_PIN * GetPin(const std::string &aPinNumber)
Get a pin by its number ( 1, 2, A1, A2, ... )
 
void SetCornerFromString(IBIS_CORNER &aCorner, const std::string &aString)
 
KIBIS_WAVEFORM * m_waveform
 
bool writeSpiceDiffDriver(std::string &aDest, const std::string &aName, KIBIS_MODEL &aModel, const KIBIS_PARAMETER &aParam)
 
bool writeSpiceDevice(std::string &aDest, const std::string &aName, KIBIS_MODEL &aModel, const KIBIS_PARAMETER &aParam)
 
std::vector< KIBIS_MODEL * > m_models
 
bool writeSpiceDiffDevice(std::string &aDest, const std::string &aName, KIBIS_MODEL &aModel, const KIBIS_PARAMETER &aParam)
 
bool writeSpiceDriver(std::string &aDest, const std::string &aName, KIBIS_MODEL &aModel, const KIBIS_PARAMETER &aParam)
 
KIBIS_MODEL * GetModel(const std::string &aName)
Return the model with name aName .
 
KIBIS_COMPONENT * GetComponent(const std::string &aName)
Return the component with name aName .
 
std::string m_cacheDir
Absolute path of the directory that will be used for caching.
 
A pure virtual class used to derive REPORTER objects from.
 
virtual bool HasMessage() const
Returns true if any messages were reported.
 
Holds all the data relating to one schematic.
 
PROJECT & Project() const
Return a reference to the project this schematic is part of.
 
EMBEDDED_FILES * GetEmbeddedFiles() override
 
static constexpr auto MODEL_FIELD
 
static constexpr auto PIN_FIELD
 
static constexpr auto DIFF_FIELD
 
static constexpr auto LIBRARY_FIELD
 
static constexpr auto NAME_FIELD
 
wxString ResolveLibraryPath(const wxString &aLibraryPath, REPORTER &aReporter)
 
void SetFilesStack(std::vector< EMBEDDED_FILES * > aFilesStack)
 
SIM_MODEL_IBIS(TYPE aType)
 
static std::vector< PARAM::INFO > makeDcWaveformParamInfos()
 
std::vector< std::pair< std::string, std::string > > m_ibisPins
 
friend class SIM_LIBRARY_IBIS
 
std::vector< std::string > m_ibisModels
 
static std::vector< PARAM::INFO > makeRectWaveformParamInfos()
 
const PARAM & GetParam(unsigned aParamIndex) const override
 
static std::vector< PARAM::INFO > makePrbsWaveformParamInfos()
 
std::vector< std::pair< std::string, std::string > > GetIbisPins() const
 
void SwitchSingleEndedDiff(bool aDiff) override
 
const SIM_MODEL_IBIS * m_sourceModel
 
bool CanDifferential() const
 
std::vector< std::string > GetIbisModels() const
 
std::string m_componentName
 
void SetBaseModel(const SIM_MODEL &aBaseModel) override
 
bool ChangePin(const SIM_LIBRARY_IBIS &aLib, const std::string &aPinNumber)
update the list of available models based on the pin number.
 
static std::vector< PARAM::INFO > makeParamInfos(TYPE aType)
 
std::string GetComponentName() const
 
void AddParam(const PARAM::INFO &aInfo)
 
void AddPin(const SIM_MODEL_PIN &aPin)
 
int GetParamCount() const
 
std::vector< PARAM > m_params
 
static double ToDouble(const std::string &aString, double aDefault=NAN)
 
static int ToInt(const std::string &aString, int aDefault=-1)
 
std::string IbisDevice(const SPICE_ITEM &aItem, SCHEMATIC *aSchematic, const wxString &aCacheDir, REPORTER &aReporter) const
 
std::vector< std::string > CurrentNames(const SPICE_ITEM &aItem) const override
 
std::string ModelLine(const SPICE_ITEM &aItem) const override
 
std::string ModelName(const SPICE_ITEM &aItem) const override
 
virtual std::string ItemName(const SPICE_ITEM &aItem) const
 
virtual std::vector< std::reference_wrapper< const SIM_MODEL_PIN > > GetPins() const
 
const SIM_MODEL & m_model
 
A wrapper for reporting to a wxString object.
 
const wxString & GetMessages() const
 
#define THROW_IO_ERROR(msg)
macro which captures the "call site" values of FILE_, __FUNCTION & LINE
 
wxString GetFieldValue(const std::vector< SCH_FIELD > *aFields, FIELD_T aFieldType)
 
std::vector< SCH_FIELD > fields
 
std::string baseModelName
 
wxString result
Test unit parsing edge cases and error handling.