Sim Model Editor: Initialize all IBIS models as IBIS devices
This commit is contained in:
parent
01a835a4cb
commit
21ae2dd1c0
|
@ -336,18 +336,15 @@ void DIALOG_SIM_MODEL<T>::updateIbisWidgets()
|
|||
template <typename T>
|
||||
void DIALOG_SIM_MODEL<T>::updateInstanceWidgets()
|
||||
{
|
||||
SIM_MODEL::DEVICE_TYPE_ deviceType = SIM_MODEL::TypeInfo( curModel().GetType() ).deviceType;
|
||||
|
||||
// Change the Type choice to match the current device type.
|
||||
if( !m_prevModel || deviceType != m_prevModel->GetDeviceType() )
|
||||
if( !m_prevModel || m_prevModel != &curModel() )
|
||||
{
|
||||
m_deviceTypeChoice->SetSelection( static_cast<int>( deviceType ) );
|
||||
|
||||
m_deviceTypeChoice->SetSelection( static_cast<int>( curModel().GetDeviceType() ) );
|
||||
m_typeChoice->Clear();
|
||||
|
||||
for( SIM_MODEL::TYPE type : SIM_MODEL::TYPE_ITERATOR() )
|
||||
{
|
||||
if( SIM_MODEL::TypeInfo( type ).deviceType == deviceType )
|
||||
if( SIM_MODEL::TypeInfo( type ).deviceType == curModel().GetDeviceType() )
|
||||
{
|
||||
m_typeChoice->Append( SIM_MODEL::TypeInfo( type ).description );
|
||||
|
||||
|
@ -598,32 +595,7 @@ void DIALOG_SIM_MODEL<T>::loadLibrary( const wxString& aFilePath )
|
|||
|
||||
try
|
||||
{
|
||||
if( isIbisLoaded() )
|
||||
{
|
||||
wxString ibisTypeString = SIM_MODEL::GetFieldValue( &m_fields, SIM_MODEL::TYPE_FIELD );
|
||||
|
||||
SIM_MODEL::TYPE ibisType = SIM_MODEL::TYPE::KIBIS_DEVICE;
|
||||
|
||||
if( ibisTypeString == "IBISDRIVERDC" )
|
||||
ibisType = SIM_MODEL::TYPE::KIBIS_DRIVER_DC;
|
||||
else if( ibisTypeString == "IBISDRIVERRECT" )
|
||||
ibisType = SIM_MODEL::TYPE::KIBIS_DRIVER_RECT;
|
||||
else if( ibisTypeString == "IBISDRIVRPRBS" )
|
||||
ibisType = SIM_MODEL::TYPE::KIBIS_DRIVER_PRBS;
|
||||
|
||||
std::dynamic_pointer_cast<SIM_LIBRARY_KIBIS>( m_library )
|
||||
->ReadFile( std::string( absolutePath.ToUTF8() ), ibisType );
|
||||
|
||||
wxArrayString emptyArray;
|
||||
m_ibisModelCombobox->Set( emptyArray );
|
||||
m_ibisPinCombobox->Set( emptyArray );
|
||||
m_ibisModelCombobox->SetSelection( -1 );
|
||||
m_ibisPinCombobox->SetSelection( -1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_library->ReadFile( std::string( absolutePath.ToUTF8() ) );
|
||||
}
|
||||
m_library->ReadFile( std::string( absolutePath.ToUTF8() ) );
|
||||
}
|
||||
catch( const IO_ERROR& e )
|
||||
{
|
||||
|
@ -642,7 +614,7 @@ void DIALOG_SIM_MODEL<T>::loadLibrary( const wxString& aFilePath )
|
|||
for( auto& [baseModelName, baseModel] : m_library->GetModels() )
|
||||
{
|
||||
wxString expectedModelName =
|
||||
SIM_MODEL::GetFieldValue( &m_fields, SIM_LIBRARY_KIBIS::NAME_FIELD );
|
||||
SIM_MODEL::GetFieldValue( &m_fields, SIM_LIBRARY::NAME_FIELD );
|
||||
|
||||
// Only the current model is initialized from fields. Others have default
|
||||
// initialization.
|
||||
|
@ -676,6 +648,15 @@ void DIALOG_SIM_MODEL<T>::loadLibrary( const wxString& aFilePath )
|
|||
|
||||
m_modelNameCombobox->Set( modelNames );
|
||||
m_useLibraryModelRadioButton->SetValue( true );
|
||||
|
||||
if( isIbisLoaded() )
|
||||
{
|
||||
wxArrayString emptyArray;
|
||||
m_ibisModelCombobox->Set( emptyArray );
|
||||
m_ibisPinCombobox->Set( emptyArray );
|
||||
m_ibisModelCombobox->SetSelection( -1 );
|
||||
m_ibisPinCombobox->SetSelection( -1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <pegtl/contrib/parse_tree.hpp>
|
||||
|
||||
|
||||
void SIM_LIBRARY_KIBIS::ReadFile( const std::string& aFilePath, SIM_MODEL::TYPE aType )
|
||||
void SIM_LIBRARY_KIBIS::ReadFile( const std::string& aFilePath )
|
||||
{
|
||||
SIM_LIBRARY::ReadFile( aFilePath );
|
||||
m_kibis = KIBIS( aFilePath );
|
||||
|
@ -45,7 +45,7 @@ void SIM_LIBRARY_KIBIS::ReadFile( const std::string& aFilePath, SIM_MODEL::TYPE
|
|||
|
||||
for( KIBIS_COMPONENT& kcomp : m_kibis.m_components )
|
||||
{
|
||||
m_models.push_back( SIM_MODEL::Create( aType, pinNumber ) );
|
||||
m_models.push_back( SIM_MODEL::Create( SIM_MODEL::TYPE::KIBIS_DEVICE, pinNumber ) );
|
||||
m_modelNames.emplace_back( kcomp.m_name );
|
||||
|
||||
SIM_MODEL_KIBIS* libcomp = dynamic_cast<SIM_MODEL_KIBIS*>( m_models.back().get() );
|
||||
|
@ -87,4 +87,4 @@ bool SIM_LIBRARY_KIBIS::isPinDiff( const std::string& aComp, const std::string&
|
|||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,11 +38,7 @@ public:
|
|||
static constexpr auto DIFF_FIELD = "Ibis_Diff";
|
||||
|
||||
// @copydoc SIM_LIBRARY::ReadFile()
|
||||
void ReadFile( const std::string& aFilePath, SIM_MODEL::TYPE aType );
|
||||
void ReadFile( const std::string& aFilePath ) override
|
||||
{
|
||||
ReadFile( aFilePath, SIM_MODEL::TYPE::KIBIS_DEVICE );
|
||||
}
|
||||
void ReadFile( const std::string& aFilePath ) override;
|
||||
|
||||
// @copydoc SIM_LIBRARY::WriteFile()
|
||||
void WriteFile( const std::string& aFilePath ) override{};
|
||||
|
|
Loading…
Reference in New Issue