Compare commits

...

11 Commits

Author SHA1 Message Date
Fabien Corona
8e55942a2e Merge branch 'ibisUpdate2024' into 'master'
Ibis version update

See merge request kicad/code/kicad!2177
2025-09-11 18:04:17 +00:00
Jeff Young
18b56539a6 Keep Board Setup in front when called from DRC dialog. 2025-09-11 15:47:13 +01:00
Jeff Young
9b006c4f3b Formatting. 2025-09-11 15:47:13 +01:00
Jeff Young
8035a66152 Flag non-compiling rule conditions when running DRC.
Also, clear custom rules after an error before
trying to reload just implicit rules.
2025-09-11 15:47:13 +01:00
Fabien Corona
cec87c4096 resolve some merge conflicts 2025-02-28 18:20:11 +01:00
Fabien Corona
9778ca739b correct some merge errors 2025-02-28 18:19:50 +01:00
Fabien Corona
8cffe509fa minor changes 2025-02-28 16:27:23 +01:00
Fabien Corona
47a8701a01 ibis: board description 2025-02-28 16:27:21 +01:00
Fabien Corona
0269851994 ignore [Driver Schedule] for now 2025-02-28 16:18:58 +01:00
Fabien Corona
2757067986 check if models and submodels are compatbile 2025-02-28 16:18:55 +01:00
Fabien Corona
62d8cfbf9f ibis parser: implement [Add Submodel] 2025-02-28 16:18:11 +01:00
10 changed files with 274 additions and 57 deletions

View File

@ -624,6 +624,38 @@ bool IbisModel::Check()
Report( _( "Invalid Ramp" ), RPT_SEVERITY_ERROR );
}
for( IbisSubmodel sm : this->m_submodels )
{
if( this->m_type == IBIS_MODEL_TYPE::SERIES
|| this->m_type == IBIS_MODEL_TYPE::SERIES_SWITCH )
{
Report( _( "'Switch' and 'Series switch' model types cannot have submodels" ),
RPT_SEVERITY_ERROR );
status = false;
break;
}
if( ( this->m_type == IBIS_MODEL_TYPE::OUTPUT
|| this->m_type == IBIS_MODEL_TYPE::OUTPUT_ECL )
&& sm.m_mode == IBIS_SUBMODEL_MODE::NON_DRIVING )
{
Report( _( "Model and submodel are incompatible" ), RPT_SEVERITY_ERROR );
status = false;
break;
}
if( ( this->m_type == IBIS_MODEL_TYPE::INPUT_STD
|| this->m_type == IBIS_MODEL_TYPE::INPUT_ECL )
&& sm.m_mode == IBIS_SUBMODEL_MODE::DRIVING )
{
Report( _( "Model and submodel are incompatible" ), RPT_SEVERITY_ERROR );
status = false;
break;
}
// IBIS_SUBMODEL_MODE::ALL is valid for all model types, except series and series_switch
}
return status;
}
@ -1269,6 +1301,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;
@ -1343,6 +1376,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;
@ -1355,7 +1410,8 @@ 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::PACKAGEMODEL_MODELDATA: context_string += "PACKAGE_MODEL_MODEL_DATA"; 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;
}
@ -1488,6 +1544,13 @@ bool IbisParser::parseModel( std::string& aKeyword )
status = readTypMinMaxValue( m_currentModel->m_Rpower );
else if( compareIbisWord( aKeyword.c_str(), "Rgnd" ) )
status = readTypMinMaxValue( m_currentModel->m_Rgnd );
else if( compareIbisWord( aKeyword.c_str(), "Add_Submodel" ) )
status = readAddSubmodel();
else if( compareIbisWord( aKeyword.c_str(), "Driver_Schedule" ) )
{
Report( _( "The [Driver Schedule] keyword is not implemented" ), RPT_SEVERITY_ERROR );
status = false;
}
else
status = changeContext( aKeyword );
@ -2053,6 +2116,58 @@ bool IbisParser::readModel()
}
bool IbisParser::readAddSubmodel()
{
bool status = true;
std::string name;
IBIS_SUBMODEL_MODE mode;
std::string subparam;
m_continue = IBIS_PARSER_CONTINUE::ADDSUBMODEL;
if( readWord( subparam ) )
{
name = subparam;
}
else
{
return true; // empty line
}
if( status && readWord( subparam ) )
{
if( compareIbisWord( subparam.c_str(), "All" ) )
mode = IBIS_SUBMODEL_MODE::ALL;
else if( compareIbisWord( subparam.c_str(), "Driving" ) )
mode = IBIS_SUBMODEL_MODE::DRIVING;
else if( compareIbisWord( subparam.c_str(), "Non-driving" ) )
mode = IBIS_SUBMODEL_MODE::NON_DRIVING;
else
{
std::stringstream message;
message << _( "Unknown mode for submodel: " ) << subparam;
Report( message.str(), RPT_SEVERITY_ERROR );
status = false;
}
}
else
{
Report( _( "Missing mode for submodel" ), RPT_SEVERITY_ERROR );
status = false;
}
if( status )
{
IbisSubmodel submodel( m_Reporter );
submodel.m_name = name;
submodel.m_mode = mode;
m_currentModel->m_submodels.push_back( submodel );
}
return status;
}
bool IbisParser::parseHeader( std::string& aKeyword )
{
bool status = true;
@ -2144,6 +2259,46 @@ bool IbisParser::parseComponent( std::string& aKeyword )
return status;
}
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;
}
bool IbisParser::readTableLine( std::vector<std::string>& aDest )
{
aDest.clear();
@ -2536,6 +2691,9 @@ bool IbisParser::onNewLine()
break;
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 );
@ -2601,6 +2759,9 @@ bool IbisParser::onNewLine()
case IBIS_PARSER_CONTINUE::MATRIX:
status &= readMatrix( m_currentMatrix );
break;
case IBIS_PARSER_CONTINUE::ADDSUBMODEL:
status &= readAddSubmodel();
break;
case IBIS_PARSER_CONTINUE::NONE:
default:
Report( _( "Missing keyword." ), RPT_SEVERITY_ERROR );

View File

@ -264,6 +264,18 @@ public:
};
class IbisBoardPin : public IBIS_INPUT
{
public:
IbisBoardPin( REPORTER* aReporter ) : IBIS_INPUT( aReporter ){};
virtual ~IbisBoardPin(){};
std::string m_name;
std::string m_signalName;
};
class IbisComponentPinMapping : public IBIS_INPUT
{
public:
@ -337,6 +349,20 @@ public:
};
class IbisBoardDescription : public IBIS_INPUT
{
public:
IbisBoardDescription( REPORTER* aReporter ) : IBIS_INPUT( aReporter ){};
virtual ~IbisBoardDescription(){};
std::string m_name = "";
std::string m_manufacturer = "";
int m_numberOfPins;
std::vector<IbisBoardPin> m_pins;
};
class IbisModelSelectorEntry
{
public:
@ -551,6 +577,23 @@ enum class IBIS_MODEL_POLARITY
NON_INVERTING
};
enum class IBIS_SUBMODEL_MODE
{
DRIVING,
NON_DRIVING,
ALL
};
class IbisSubmodel : IBIS_INPUT
{
public:
IbisSubmodel( REPORTER* aReporter ):
IBIS_INPUT( aReporter )
{};
std::string m_name;
IBIS_SUBMODEL_MODE m_mode;
};
class IbisModel : IBIS_INPUT
{
@ -610,7 +653,7 @@ public:
std::vector<IbisWaveform*> m_risingWaveforms;
std::vector<IbisWaveform*> m_fallingWaveforms;
IbisRamp m_ramp;
std::vector<IbisSubmodel> m_submodels;
bool Check() override;
};
@ -651,11 +694,12 @@ public:
virtual ~IbisFile()
{};
IbisHeader m_header;
std::vector<IbisComponent> m_components;
std::vector<IbisModelSelector> m_modelSelectors;
std::vector<IbisModel> m_models;
std::vector<IbisPackageModel> m_packageModels;
IbisHeader m_header;
std::vector<IbisComponent> m_components;
std::vector<IbisModelSelector> m_modelSelectors;
std::vector<IbisModel> m_models;
std::vector<IbisPackageModel> m_packageModels;
std::vector<IbisBoardDescription> m_boardDescriptions;
};
@ -676,7 +720,8 @@ enum class IBIS_PARSER_CONTINUE
VT_TABLE,
RAMP,
WAVEFORM,
PACKAGEMODEL_PINS
PACKAGEMODEL_PINS,
ADDSUBMODEL
};
enum class IBIS_PARSER_CONTEXT
@ -687,6 +732,7 @@ enum class IBIS_PARSER_CONTEXT
MODEL,
PACKAGEMODEL,
PACKAGEMODEL_MODELDATA,
BOARD_DESCRIPTION,
END
};
@ -709,11 +755,12 @@ public:
int m_lineIndex = 0;
int m_lineLength = 0;
IbisFile m_ibisFile;
IbisComponent* m_currentComponent = nullptr;
IbisModelSelector* m_currentModelSelector = nullptr;
IbisModel* m_currentModel = nullptr;
IbisPackageModel* m_currentPackageModel = nullptr;
IbisFile m_ibisFile;
IbisComponent* m_currentComponent = nullptr;
IbisBoardDescription* m_currentBoardDescription = nullptr;
IbisModelSelector* m_currentModelSelector = nullptr;
IbisModel* m_currentModel = nullptr;
IbisPackageModel* m_currentPackageModel = nullptr;
std::shared_ptr<IBIS_MATRIX> m_currentMatrix = nullptr;
int m_currentMatrixRow = 0;
int m_currentMatrixRowIndex = 0;
@ -756,35 +803,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
@ -844,6 +892,7 @@ private:
bool readModelSelector();
bool readModel();
bool readPackageModelPins();
bool readAddSubmodel();
/** @brief Ibis can change the character used for comments */
bool changeCommentChar();

View File

@ -327,7 +327,9 @@ class INFOBAR_REPORTER : public REPORTER
{
public:
INFOBAR_REPORTER( WX_INFOBAR* aInfoBar ) :
REPORTER(), m_messageSet( false ), m_infoBar( aInfoBar ),
REPORTER(),
m_messageSet( false ),
m_infoBar( aInfoBar ),
m_severity( RPT_SEVERITY_UNDEFINED )
{
}

View File

@ -55,8 +55,8 @@
#define RESOLVE_PAGE( T, pageIndex ) static_cast<T*>( m_treebook->ResolvePage( pageIndex ) )
DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame ) :
PAGED_DIALOG( aFrame, _( "Board Setup" ), false, false,
DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame, wxWindow* aParent ) :
PAGED_DIALOG( aParent ? aParent : aFrame, _( "Board Setup" ), false, false,
_( "Import Settings from Another Board..." ), wxSize( 980, 600 ) ),
m_frame( aFrame ),
m_layers( nullptr ),

View File

@ -42,7 +42,7 @@ class PANEL_TEXT_VARIABLES;
class DIALOG_BOARD_SETUP : public PAGED_DIALOG
{
public:
DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame );
DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame, wxWindow* aWindow = nullptr );
~DIALOG_BOARD_SETUP();
protected:

View File

@ -303,7 +303,7 @@ void DIALOG_DRC::OnMenu( wxCommandEvent& event )
void DIALOG_DRC::OnErrorLinkClicked( wxHtmlLinkEvent& event )
{
m_frame->ShowBoardSetupDialog( _( "Custom Rules" ) );
m_frame->ShowBoardSetupDialog( _( "Custom Rules" ), this );
}
@ -993,7 +993,7 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
}
case ID_EDIT_SEVERITIES:
m_frame->ShowBoardSetupDialog( _( "Violation Severity" ) );
m_frame->ShowBoardSetupDialog( _( "Violation Severity" ), this );
break;
}
@ -1035,7 +1035,7 @@ void DIALOG_DRC::OnIgnoredItemRClick( wxListEvent& event )
void DIALOG_DRC::OnEditViolationSeverities( wxHyperlinkEvent& aEvent )
{
m_frame->ShowBoardSetupDialog( _( "Violation Severity" ) );
m_frame->ShowBoardSetupDialog( _( "Violation Severity" ), this );
}

View File

@ -527,10 +527,9 @@ void DRC_ENGINE::loadRules( const wxFileName& aPath )
void DRC_ENGINE::compileRules()
{
if( m_logReporter )
{
m_logReporter->Report( ( wxString::Format( wxT( "Compiling Rules (%d rules): " ),
(int) m_rules.size() ) ) );
}
m_logReporter->Report( wxT( "Compiling Rules" ) );
REPORTER error_semaphore;
for( std::shared_ptr<DRC_RULE>& rule : m_rules )
{
@ -539,9 +538,12 @@ void DRC_ENGINE::compileRules()
if( rule->m_Condition && !rule->m_Condition->GetExpression().IsEmpty() )
{
condition = rule->m_Condition;
condition->Compile( nullptr );
condition->Compile( &error_semaphore );
}
if( error_semaphore.HasMessageOfSeverity( RPT_SEVERITY_ERROR ) )
THROW_PARSE_ERROR( wxT( "Parse error" ), rule->m_Name, rule->m_Condition->GetExpression(), 0, 0 );
for( const DRC_CONSTRAINT& constraint : rule->m_Constraints )
{
if( !m_constraintMap.count( constraint.m_Type ) )
@ -594,6 +596,8 @@ void DRC_ENGINE::InitEngine( const wxFileName& aRulePath )
}
catch( PARSE_ERROR& original_parse_error )
{
m_rules.clear();
try // try again with just our implicit rules
{
loadImplicitRules();

View File

@ -109,6 +109,7 @@
#include <widgets/pcb_net_inspector_panel.h>
#include <widgets/wx_aui_utils.h>
#include <kiplatform/app.h>
#include <kiplatform/ui.h>
#include <core/profile.h>
#include <math/box2_minmax.h>
#include <view/wx_view_controls.h>
@ -1466,7 +1467,7 @@ void PCB_EDIT_FRAME::ActivateGalCanvas()
}
void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage )
void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage, wxWindow* aParent )
{
static std::mutex dialogMutex; // Local static mutex
@ -1486,7 +1487,7 @@ void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage )
// Make sure everything's up-to-date
GetBoard()->BuildListOfNets();
DIALOG_BOARD_SETUP dlg( this );
DIALOG_BOARD_SETUP dlg( this, aParent );
if( !aInitialPage.IsEmpty() )
dlg.SetInitialPage( aInitialPage, wxEmptyString );

View File

@ -301,7 +301,7 @@ public:
///< @copydoc EDA_DRAW_FRAME::UseGalCanvas()
void ActivateGalCanvas() override;
void ShowBoardSetupDialog( const wxString& aInitialPage = wxEmptyString );
void ShowBoardSetupDialog( const wxString& aInitialPage = wxEmptyString, wxWindow* aParent = nullptr );
void PrepareLayerIndicator( bool aForceRebuild = false );

View File

@ -61,16 +61,16 @@ C_pkg 1m 0.8m 2m
4 5 150mV -1ns 0ns -2ns
6 7 150mV -1ns 0ns -2ns
[Series Pin Mapping] pin_2 model_name function_table_group
|
4 5 PinSeries 1
6 7 PinSeries 2
#[Series Pin Mapping] pin_2 model_name function_table_group
#
# 4 5 PinSeries 1
# 6 7 PinSeries 2
[Series Switch Groups]
On 4 5 /
Off 4 5 /
On 4 5 6 7 /
Off 4 5 6 7 /
#[Series Switch Groups]
#On 4 5 /
#Off 4 5 /
#On 4 5 6 7 /
#Off 4 5 6 7 /
[Model] Input
@ -87,7 +87,7 @@ Vref = 0
C_comp 10.0pF 8.0pF 15.0pF
[Model Spec]
| Subparameter typ min max
# Subparameter typ min max
Vinh 3.5 3.15 3.85
Vinl 1.5 1.35 1.65
Vinh+ 2.0 NA NA | Overrides the
@ -105,19 +105,19 @@ Pulse_time 3n NA NA | Pulse_time
Vmeas 3.68 3.18 4.68 | A 5 volt PECL
[Add Submodel]
| Submodel_name Mode
# Submodel_name Mode
Bus_Hold_1 Non-Driving
Dynamic_clamp_1 All
[Driver Schedule]
| Model_name Rise_on_dly Rise_off_dly Fall_on_dly Fall_off_dly
# Model_name Rise_on_dly Rise_off_dly Fall_on_dly Fall_off_dly
MODEL_OUT 0.0ns NA 0.0ns NA
M_O_SOURCE1 0.5ns NA 0.5ns NA
| low (high-Z) to high high to low (high-Z)
# low (high-Z) to high high to low (high-Z)
M_O_SOURCE2 0.5n 1.5n NA NA
| low to high to low low (high-Z)
# low to high to low low (high-Z)
M_O_DRAIN1 1.0n NA 1.5n NA
| low to high (high-Z) high (high-Z) to low
# low to high (high-Z) high (high-Z) to low
M_O_DRAIN2 NA NA 1.5n 2.0n
| high (high-Z) high to low to high