52 return std::equal( stra.begin(), stra.end(),
53 strb.begin(), strb.end(),
56 return std::tolower(a) == std::tolower(b);
137 double NA = nan(
NAN_NA );
138 return std::memcmp( &aNumber, &NA,
sizeof NA ) == 0;
184 std::stringstream message;
233 std::stringstream message;
234 message <<
_(
"Checking component " ) <<
m_name;
257 status &=
pin.Check();
272 std::ostringstream ss;
273 ss.setf( std::ios_base::scientific, std::ios_base::floatfield );
279std::string
IVtable::Spice(
int aN, std::string aPort1, std::string aPort2, std::string aModelName,
282 std::string result =
"";
287 result += std::to_string( aN );
297 result += aModelName;
301 result += aModelName;
302 result +=
" pwl(\n+ x_array=[";
309 result +=
"]\n+ y_array=[";
316 result +=
"]\n+ input_domain=0.05 fraction=TRUE)\n\n";
329 return m_entries.back().I.value[aCorner];
334 return m_entries.at( 0 ).I.value[aCorner];
337 for(
size_t i = 1; i <
m_entries.size(); i++ )
341 return m_entries.at( i - 1 ).I.value[aCorner]
343 -
m_entries.at( i - 1 ).I.value[aCorner] )
364 if( isnan( entry.V ) )
371 if( !entry.I.Check() )
444 std::stringstream message;
445 message <<
_(
"Checking model " ) <<
m_name;
584 if( !( !strcmp( ext.c_str(),
".ibs" ) || !strcmp( ext.c_str(),
".pkg" )
585 || !strcmp( ext.c_str(),
".ebd" ) || !strcmp( ext.c_str(),
".ims" ) ) )
605 std::stringstream message;
606 message <<
_(
"Checking package model " ) <<
m_name;
633 for(
size_t i = 0; i <
m_pins.size(); i++ )
635 if(
m_pins.at( i ).empty() )
694 std::stringstream err_msg;
696 std::ifstream ibisFile;
697 ibisFile.open( aFileName );
699 if( !ibisFile.is_open() )
701 err_msg <<
_(
"Cannot open file " ) << aFileName;
707 err_msg <<
_(
"Reading file " ) << aFileName << wxT(
"..." );
710 std::ostringstream ss;
711 ss << ibisFile.rdbuf();
712 const std::string& s = ss.str();
713 m_buffer = std::vector<char>( s.begin(), s.end() );
741 err_msg <<
_(
"Error on line " ) << std::to_string(
m_lineCounter );
792 if( aString ==
"NA" )
802 for( i = 1; i < (int)aString.length(); i++ )
804 if( aString.at( i ) ==
'/' )
810 if( aString.at( i ) ==
'/' )
812 std::string str1 = aString.substr( 0, i );
813 std::string str2 = aString.substr( i + 1, aString.size() - i - 1 );
832 bool converted =
false;
834 std::string str = aStr;
848 result = std::stod( str, &size );
858 if( converted && ( size < str.length() ) )
860 switch(
static_cast<char>( str.at( size ) ) )
862 case 'T': result *= 1e12;
break;
863 case 'G': result *= 1e9;
break;
864 case 'M': result *= 1e6;
break;
865 case 'k': result *= 1e3;
break;
866 case 'm': result *= 1e-3;
break;
867 case 'u': result *= 1e-6;
break;
868 case 'n': result *= 1e-9;
break;
869 case 'p': result *= 1e-12;
break;
870 case 'f': result *= 1e-15;
break;
914 while( c != 0 && c !=
'\n' )
936 std::cout << std::endl;
973 result = std::stoi( str, &size );
988 if( size != str.size() )
1018 aDest = std::string( start, end );
1020 return ( aDest.size() > 0 );
1031 int len = aDest.length();
1039 char c = aDest[len - 1];
1042 while( isspace( c ) && ( i < len ) )
1044 c = aDest[len - 1 - i];
1047 aDest = aDest.substr( 0, len - i + 1 );
1072 std::string strChar =
"";
1080 if( !( c ==
'!' || c ==
'"' || c ==
'#' || c ==
'$' || c ==
'%' || c ==
'&' || c ==
'\''
1081 || c ==
'(' || c ==
')' || c ==
'*' || c ==
',' || c ==
':' || c ==
';' || c ==
'<'
1082 || c ==
'>' || c ==
'?' || c ==
'@' || c ==
'\\' || c ==
'^' || c ==
'`' || c ==
'{'
1083 || c ==
'|' || c ==
'}' || c ==
'~' || c ==
')' ) )
1090 while( ( !isspace( c ) ) && c != 0 && c !=
'\n' )
1096 if( strChar !=
"_char" )
1102 while( isspace( c ) && c != 0 && c !=
'\n' && c != d )
1107 if( ( !isspace( c ) ) && c != d )
1123 std::string keyword =
"";
1169 Report(
"Cannot change context after [END]" );
1173 default:
Report(
"Changing context from an undefined context" );
1208 else if(
compareIbisWord( aKeyword.c_str(),
"Define_Package_Model" ) )
1245 std::string context_string;
1255 context_string +=
"PACKAGE_MODEL_MODEL_DATA";
1257 default: context_string +=
"???";
break;
1260 std::stringstream message;
1261 message <<
_(
"Unknown keyword in " ) << context_string <<
_(
" context: " ) << aKeyword;
1317 if( !strcmp( str.c_str(),
"dV/dt_r" ) )
1321 else if( !strcmp( str.c_str(),
"dV/dt_f" ) )
1338 bool status =
false;
1362 else if(
compareIbisWord( aKeyword.c_str(),
"POWER_Clamp_Reference" ) )
1449 std::vector<std::string> values;
1453 for( i = 0; i < (int)values.size(); i++ )
1524 if( aDest !=
nullptr )
1538 Report(
"Matrix pointer is null." );
1553 aDest =
static_cast<std::shared_ptr<IBIS_MATRIX>
>( matrix );
1561 aDest =
static_cast<std::shared_ptr<IBIS_MATRIX>
>( matrix );
1570 aDest =
static_cast<std::shared_ptr<IBIS_MATRIX>
>( matrix );
1593 Report(
_(
" Matrix is already init. But m_continue was not set ( internal error )" ) );
1598 if( aDest !=
nullptr )
1601 switch( aDest->m_type )
1619 Report(
_(
"Tried to read a row from an undefined matrix" ) );
1625 Report(
_(
"matrix pointer is null" ) );
1721 std::string paramName;
1734 for(
size_t i = 0; i < aSubparam.size(); i++ )
1739 if( strcmp( paramName.c_str(), aSubparam.c_str() ) )
1786 std::string paramName;
1793 for(
size_t i = 0; i < aSubparam.size(); i++ )
1798 if( !strcmp( paramName.c_str(), aSubparam.c_str() ) )
1819 std::string subparam;
1826 if( !strcmp( subparam.substr( 0, 10 ).c_str(),
"Model_type" ) )
1830 if( !strcmp( subparam.c_str(),
"Input" ) )
1832 else if( !strcmp( subparam.c_str(),
"Output" ) )
1834 else if( !strcmp( subparam.c_str(),
"I/O" ) )
1836 else if( !strcmp( subparam.c_str(),
"3-state" ) )
1838 else if( !strcmp( subparam.c_str(),
"Open_drain" ) )
1840 else if( !strcmp( subparam.c_str(),
"I/O_Open_drain" ) )
1842 else if( !strcmp( subparam.c_str(),
"Open_sink" ) )
1844 else if( !strcmp( subparam.c_str(),
"I/O_open_sink" ) )
1846 else if( !strcmp( subparam.c_str(),
"Open_source" ) )
1848 else if( !strcmp( subparam.c_str(),
"I/O_open_source" ) )
1850 else if( !strcmp( subparam.c_str(),
"Input_ECL" ) )
1852 else if( !strcmp( subparam.c_str(),
"Output_ECL" ) )
1854 else if( !strcmp( subparam.c_str(),
"I/O_ECL" ) )
1856 else if( !strcmp( subparam.c_str(),
"3-state_ECL" ) )
1858 else if( !strcmp( subparam.c_str(),
"Terminator" ) )
1860 else if( !strcmp( subparam.c_str(),
"Series" ) )
1862 else if( !strcmp( subparam.c_str(),
"Series_switch" ) )
1866 std::stringstream message;
1867 message <<
_(
"Unknown Model_type " ) << subparam;
1878 else if( !strcmp( subparam.substr( 0, 7 ).c_str(),
"Enable" ) )
1882 if( !strcmp( subparam.c_str(),
"Active-High" ) )
1884 else if( !strcmp( subparam.c_str(),
"Active-Low" ) )
1888 std::stringstream message;
1889 message <<
_(
"Unknown Enable: " ) << subparam;
1900 else if( subparam.substr( 0, 9 ) ==
"Polarity" )
1904 if( subparam ==
"Inverting" )
1906 else if( subparam ==
"Non-Inverting" )
1910 std::stringstream message;
1911 message <<
_(
"Unknown polarity " ) << subparam;
1948 Report(
_(
"Continued reading a model that did not begin. ( internal error )" ),
2065 if( str.size() > 0 )
2067 aDest.push_back( str );
2081 std::vector<std::string> fields;
2091 if( (
int)fields.size() == ( 4 + extraArg ) )
2095 if( fields.at( 0 ) ==
"R_pkg" )
2097 else if( fields.at( 0 ) ==
"L_pkg" )
2099 else if( fields.at( 0 ) ==
"C_pkg" )
2103 Report(
"Invalid field in [Package]" );
2113 if( fields.size() != 0 )
2129 std::vector<std::string> fields;
2136 if( ( fields.size() == 3 ) )
2140 pin.m_pinName = fields.at( 0 );
2141 pin.m_signalName = fields.at( 1 );
2142 pin.m_modelName = fields.at( 2 );
2158 pin.m_pinName = fields.at( 0 );
2159 pin.m_signalName = fields.at( 1 );
2160 pin.m_modelName = fields.at( 2 );
2166 if(
pin.m_Rcol == 0 ||
pin.m_Lcol == 0 ||
pin.m_Ccol == 0 )
2168 Report(
_(
"Invalid pin entry: 6 values from a table with only 3." ),
2185 for(
int i = 3; i < 6; i++ )
2187 if( fields.at( i ) ==
"R_pin" )
2191 else if( fields.at( i ) ==
"L_pin" )
2195 else if( fields.at( i ) ==
"C_pin" )
2206 if(
pin.m_Rcol == 0 ||
pin.m_Lcol == 0 ||
pin.m_Ccol == 0 )
2227 std::vector<std::string> fields;
2239 if( fields.size() != 0 )
2241 if( fields.size() > 6 || fields.size() < 3 )
2249 pinMapping.
m_PDref = fields.at( 1 );
2250 pinMapping.
m_PUref = fields.at( 2 );
2252 if( fields.size() > 3 )
2255 if( fields.size() > 4 )
2258 if( fields.size() > 5 )
2259 pinMapping.
m_extRef = fields.at( 5 );
2373 if( aDest !=
nullptr )
2424 if( keyword.size() > 0 )
2488 while( ( c !=
'\n' ) && ( c != 0 ) )
std::string doubleToString(double aNumber)
Convert a double to string using scientific notation.
void Report(std::string aMsg, SEVERITY aSeverity=RPT_SEVERITY_INFO)
Print a message.
IBIS_REPORTER * m_reporter
std::vector< double > m_data
bool Check() override
Check if the data held by the object is valid.
bool Check() override
Check if the data held by the object is valid.
std::vector< double > m_data
bool Check() override
Check if the data held by the object is valid.
std::vector< double > m_data
bool Check() override
Check if the data held by the object is valid.
double InterpolatedI(double aV, IBIS_CORNER aCorner)
Interpolate the IV table.
std::vector< IVtableEntry > m_entries
std::string Spice(int aN, std::string aPort1, std::string aPort2, std::string aModelName, IBIS_CORNER aCorner)
Interpolate the IV table.
bool Check() override
Check if the data held by the object is valid.
std::string m_GNDClampRef
std::string m_POWERClampRef
bool Check() override
Check if the data held by the object is valid.
std::string m_manufacturer
std::string m_packageModel
std::vector< IbisComponentPinMapping > m_pinMappings
IbisComponentPackage m_package
bool Check() override
Check if the data held by the object is valid.
std::vector< IbisComponentPin > m_pins
std::vector< IbisDiffPinEntry > m_entries
std::vector< IbisComponent > m_components
std::vector< IbisPackageModel > m_packageModels
std::vector< IbisModel > m_models
std::vector< IbisModelSelector > m_modelSelectors
std::string m_modelDescription
bool Check() override
Check if the data held by the object is valid.
std::vector< IbisModelSelectorEntry > m_models
TypMinMaxValue m_pullupReference
bool Check() override
Check if the data held by the object is valid.
std::vector< IbisWaveform * > m_risingWaveforms
TypMinMaxValue m_POWERClampReference
IBIS_MODEL_ENABLE m_enable
TypMinMaxValue m_temperatureRange
std::vector< IbisWaveform * > m_fallingWaveforms
TypMinMaxValue m_pulldownReference
TypMinMaxValue m_GNDClampReference
TypMinMaxValue m_voltageRange
std::vector< std::string > m_pins
std::shared_ptr< IBIS_MATRIX > m_resistanceMatrix
std::shared_ptr< IBIS_MATRIX > m_inductanceMatrix
bool Check() override
Check if the data held by the object is valid.
std::string m_description
std::shared_ptr< IBIS_MATRIX > m_capacitanceMatrix
std::string m_manufacturer
std::vector< char > m_buffer
IBIS_PARSER_CONTINUE m_continue
bool changeCommentChar()
Ibis can change the character used for comments.
bool getNextLine()
Load the next line.
bool parseComponent(std::string &aKeyword)
Parse a single keyword in the component context.
bool parseModel(std::string &aKeyword)
Parse a single keyword in the model selector context.
bool readMatrixFull(std::string, IBIS_MATRIX_FULL &aDest)
VTtable * m_currentVTtable
bool isLineEmptyFromCursor()
void printLine()
Print the current line.
bool changeContext(std::string &aKeyword)
int m_currentMatrixRowIndex
bool parseDouble(double &aDest, std::string &aStr, bool aAllowModifiers=false)
Parse a double according to the ibis standard.
bool onNewLine()
Parse the current line.
bool readWord(std::string &aDest)
bool readTypMinMaxValue(TypMinMaxValue &aDest)
bool compareIbisWord(const std::string &a, const std::string &b)
compare two strings without being case sensitive
IbisComponent * m_currentComponent
std::shared_ptr< IBIS_MATRIX > m_currentMatrix
bool readDvdt(std::string &aString, dvdt &aDest)
std::string * m_continuingString
IbisModel * m_currentModel
bool readNumericSubparam(std::string aSubparam, double &aDest)
bool parsePackageModelModelData(std::string &)
Parse a single keyword in the package model context.
IbisPackageModel * m_currentPackageModel
bool readDouble(double &aDest)
IbisModelSelector * m_currentModelSelector
bool parsePackageModel(std::string &aKeyword)
Parse a single keyword in the model context.
bool readString(std::string &aDest)
bool readMatrixBanded(std::string, IBIS_MATRIX_BANDED &aDest)
bool readMatrix(std::shared_ptr< IBIS_MATRIX > aDest)
bool readTypMinMaxValueSubparam(std::string aSubparam, TypMinMaxValue &aDest)
IBIS_PARSER_CONTEXT m_context
IVtable * m_currentIVtable
bool readIVtableEntry(IVtable &aTable)
bool readVTtableEntry(VTtable &aTable)
bool ParseFile(std::string &aFileName)
Parse a file.
bool parseModelSelector(std::string &aKeyword)
Parse a single keyword in the component context.
bool storeString(std::string &aDest, bool aMultiline)
bool readPackageModelPins()
bool readRampdvdt(dvdtTypMinMax &aDest)
bool readTableLine(std::vector< std::string > &aDest)
bool readMatrixSparse(std::string, IBIS_MATRIX_SPARSE &aDest)
bool parseHeader(std::string &aKeyword)
Parse a single keyword in the header context.
bool readWaveform(IbisWaveform *aDest, IBIS_WAVEFORM_TYPE aType)
IbisWaveform * m_currentWaveform
bool Check() override
Check if the data held by the object is valid.
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
bool Check() override
Check if the data held by the object is valid.
std::vector< VTtableEntry > m_entries
bool Check() override
Check if the data held by the object is valid.
static std::string strValue(double aValue)
bool isNumberNA(double aNumber)
#define IBIS_MAX_LINE_LENGTH