From 27570679862c7d216ea8bc01a6fe7c0e9220452c Mon Sep 17 00:00:00 2001 From: Fabien Corona Date: Thu, 20 Jun 2024 14:39:57 +0200 Subject: [PATCH] check if models and submodels are compatbile --- eeschema/sim/kibis/ibis_parser.cpp | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/eeschema/sim/kibis/ibis_parser.cpp b/eeschema/sim/kibis/ibis_parser.cpp index c8a1dfe43b..40b4a78c60 100644 --- a/eeschema/sim/kibis/ibis_parser.cpp +++ b/eeschema/sim/kibis/ibis_parser.cpp @@ -622,6 +622,39 @@ bool IbisModel::Check() { if( !m_ramp.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;