ibis: board description

This commit is contained in:
Fabien Corona 2024-06-20 16:04:39 +02:00
parent 0269851994
commit 47a8701a01
2 changed files with 115 additions and 19 deletions

View File

@ -1302,6 +1302,7 @@ bool IbisParser::changeContext( std::string& aKeyword )
case IBIS_PARSER_CONTEXT::MODEL: status &= m_currentModel->Check(); break;
case IBIS_PARSER_CONTEXT::MODELSELECTOR: status &= m_currentModelSelector->Check(); break;
case IBIS_PARSER_CONTEXT::PACKAGEMODEL: status &= m_currentPackageModel->Check(); break;
case IBIS_PARSER_CONTEXT::BOARD_DESCRIPTION: status &= m_currentBoardDescription->Check(); break;
case IBIS_PARSER_CONTEXT::END:
Report( "Cannot change context after [END]" );
status = false;
@ -1376,6 +1377,28 @@ bool IbisParser::changeContext( std::string& aKeyword )
m_continue = IBIS_PARSER_CONTINUE::NONE;
}
}
else if( compareIbisWord( aKeyword.c_str(), "Begin_Board_Description" ) )
{
IbisBoardDescription BD( m_reporter );
status &= storeString( BD.m_name, false );
m_ibisFile.m_boardDescriptions.push_back( BD );
m_currentBoardDescription = &( m_ibisFile.m_boardDescriptions.back() );
m_context = IBIS_PARSER_CONTEXT::BOARD_DESCRIPTION;
}
else if( compareIbisWord( aKeyword.c_str(), "End_Board_Description" ) )
{
if( m_currentBoardDescription != nullptr )
{
m_context = IBIS_PARSER_CONTEXT::BOARD_DESCRIPTION;
m_continue = IBIS_PARSER_CONTINUE::NONE;
}
else // .ebd file, we just go back to header, to get the [END] keyword
{ // This will cause the header to be checked twice.
m_context = IBIS_PARSER_CONTEXT::HEADER;
m_continue = IBIS_PARSER_CONTINUE::NONE;
}
}
else
{
status = false;
@ -1388,6 +1411,7 @@ bool IbisParser::changeContext( std::string& aKeyword )
case IBIS_PARSER_CONTEXT::MODELSELECTOR: context_string += "MODEL_SELECTOR"; break;
case IBIS_PARSER_CONTEXT::MODEL: context_string += "MODEL"; break;
case IBIS_PARSER_CONTEXT::PACKAGEMODEL: context_string += "PACKAGE_MODEL"; break;
case IBIS_PARSER_CONTEXT::BOARD_DESCRIPTION: context_string += "BOARD_DESCRIPTION"; break;
case IBIS_PARSER_CONTEXT::PACKAGEMODEL_MODELDATA: context_string += "PACKAGE_MODEL_MODEL_DATA"; break;
default: context_string += "???"; break;
}
@ -2233,6 +2257,43 @@ bool IbisParser::parseComponent( std::string& aKeyword )
status = false;
}
bool IbisParser::parseBoardDescription( std::string& aKeyword )
{
bool status = true;
if( compareIbisWord( aKeyword.c_str(), "Manufacturer" ) )
{
status &= storeString( m_currentBoardDescription->m_manufacturer, true );
}
else if( compareIbisWord( aKeyword.c_str(), "Number_Of_Pins" ) )
{
status &= readInt( m_currentBoardDescription->m_numberOfPins );
}
else if( compareIbisWord( aKeyword.c_str(), "Pin_List" ) )
{
Report( _( "The [Pin List] keyword is not implemented" ), RPT_SEVERITY_ERROR );
status = false;
}
else if( compareIbisWord( aKeyword.c_str(), "Path_Description" ) )
{
Report( _( "The [Path Description] keyword is not implemented" ), RPT_SEVERITY_ERROR );
status = false;
}
else if( compareIbisWord( aKeyword.c_str(), "Reference_Designator_Map" ) )
{
Report( _( "The [Path Description] keyword is not implemented" ), RPT_SEVERITY_ERROR );
status = false;
}
else if( compareIbisWord( aKeyword.c_str(), "Diff_Pin" ) )
{
status &= readDiffPin();
}
else
{
if( !changeContext( aKeyword ) )
{
status = false;
}
}
return status;
}
@ -2629,6 +2690,9 @@ bool IbisParser::onNewLine()
case IBIS_PARSER_CONTEXT::PACKAGEMODEL:
status &= parsePackageModel( keyword );
break;
case IBIS_PARSER_CONTEXT::BOARD_DESCRIPTION:
status &= parseBoardDescription( keyword );
break;
case IBIS_PARSER_CONTEXT::PACKAGEMODEL_MODELDATA:
status &= parsePackageModelModelData( keyword );
break;

View File

@ -264,6 +264,19 @@ public:
};
class IbisBoardPin : public IBIS_INPUT
{
public:
IbisBoardPin( REPORTER* aReporter ) : IBIS_INPUT( aReporter ){};
virtual ~IbisBoardPin(){};
std::string m_name;
std::string m_signalName;
bool Check() override;
};
class IbisComponentPinMapping : public IBIS_INPUT
{
public:
@ -337,6 +350,22 @@ public:
};
class IbisBoardDescription : public IBIS_INPUT
{
public:
IbisComponent( REPORTER* aReporter ) : IBIS_INPUT( aReporter ){};
virtual ~IbisBoardDescription(){};
std::string m_name = "";
std::string m_manufacturer = "";
int m_numberofPins;
std::vector<IbisBoardPin> m_pins;
bool Check() override;
};
class IbisModelSelectorEntry
{
public:
@ -705,6 +734,7 @@ enum class IBIS_PARSER_CONTEXT
MODEL,
PACKAGEMODEL,
PACKAGEMODEL_MODELDATA,
BOARD_DESCRIPTION,
END
};
@ -729,6 +759,7 @@ public:
IbisFile m_ibisFile;
IbisComponent* m_currentComponent = nullptr;
IbisBoardDescription* m_currentBoardDescription = nullptr;
IbisModelSelector* m_currentModelSelector = nullptr;
IbisModel* m_currentModel = nullptr;
IbisPackageModel* m_currentPackageModel = nullptr;
@ -774,35 +805,36 @@ private:
* @return True in case of success
*/
bool parseComponent( std::string& aKeyword );
/** @brief Parse a single keyword in the component context
*
* @param aKeyword Keyword
* @return True in case of success
*/
bool parseModelSelector( std::string& aKeyword );
/** @brief Parse a single keyword in the model selector context
*
* @param aKeyword Keyword
* @return True in case of success
*/
bool parseModel( std::string& aKeyword );
bool parseModelSelector( std::string& aKeyword );
/** @brief Parse a single keyword in the model context
*
* @param aKeyword Keyword
* @return True in case of success
*/
bool parsePackageModel( std::string& aKeyword );
bool parseModel( std::string& aKeyword );
/** @brief Parse a single keyword in the package model context
*
* @param aKeyword Keyword
* @return True in case of success
*/
bool parsePackageModel( std::string& aKeyword );
/** @brief Parse a single keyword in the package model model data context
*
* @param aKeyword Keyword
* @return True in case of success
*/
bool parsePackageModelModelData( std::string& );
/** @brief Parse a single keyword in the board description context
*
* @param aKeyword Keyword
* @return True in case of success
*/
bool parseBoardDescription( std::string& aKeyword );
/** @brief Parse a double according to the ibis standard
*
* @param aDest Where the double should be stored