Cleanup.
This commit is contained in:
parent
a02cb75656
commit
4e133ae83b
|
@ -205,7 +205,7 @@ set( EESCHEMA_SIM_SRCS
|
||||||
|
|
||||||
sim/sim_library.cpp
|
sim/sim_library.cpp
|
||||||
sim/sim_library_spice.cpp
|
sim/sim_library_spice.cpp
|
||||||
sim/sim_library_kibis.cpp
|
sim/sim_library_ibis.cpp
|
||||||
sim/sim_lib_mgr.cpp
|
sim/sim_lib_mgr.cpp
|
||||||
|
|
||||||
sim/sim_model_serializer.cpp
|
sim/sim_model_serializer.cpp
|
||||||
|
@ -213,7 +213,7 @@ set( EESCHEMA_SIM_SRCS
|
||||||
sim/sim_model_behavioral.cpp
|
sim/sim_model_behavioral.cpp
|
||||||
sim/sim_model_ideal.cpp
|
sim/sim_model_ideal.cpp
|
||||||
sim/sim_model_l_mutual.cpp
|
sim/sim_model_l_mutual.cpp
|
||||||
sim/sim_model_kibis.cpp
|
sim/sim_model_ibis.cpp
|
||||||
sim/sim_model_ngspice.cpp
|
sim/sim_model_ngspice.cpp
|
||||||
sim/sim_model_ngspice_data_bjt.cpp
|
sim/sim_model_ngspice_data_bjt.cpp
|
||||||
sim/sim_model_ngspice_data_bsim1.cpp
|
sim/sim_model_ngspice_data_bsim1.cpp
|
||||||
|
|
|
@ -26,9 +26,9 @@
|
||||||
#include <dialog_ibis_parser_reporter.h>
|
#include <dialog_ibis_parser_reporter.h>
|
||||||
#include <dialog_sim_model.h>
|
#include <dialog_sim_model.h>
|
||||||
#include <sim/sim_property.h>
|
#include <sim/sim_property.h>
|
||||||
#include <sim/sim_library_kibis.h>
|
#include <sim/sim_library_ibis.h>
|
||||||
#include <sim/sim_model.h>
|
#include <sim/sim_model.h>
|
||||||
#include <sim/sim_model_kibis.h>
|
#include <sim/sim_model_ibis.h>
|
||||||
#include <sim/sim_model_raw_spice.h>
|
#include <sim/sim_model_raw_spice.h>
|
||||||
#include <sim/sim_model_spice_fallback.h>
|
#include <sim/sim_model_spice_fallback.h>
|
||||||
#include <sim/sim_model_subckt.h>
|
#include <sim/sim_model_subckt.h>
|
||||||
|
@ -251,43 +251,43 @@ bool DIALOG_SIM_MODEL<T>::TransferDataToWindow()
|
||||||
if( isIbisLoaded() && ( m_modelNameChoice->GetSelection() >= 0 ) )
|
if( isIbisLoaded() && ( m_modelNameChoice->GetSelection() >= 0 ) )
|
||||||
{
|
{
|
||||||
int idx = m_modelNameChoice->GetSelection();
|
int idx = m_modelNameChoice->GetSelection();
|
||||||
auto kibismodel = dynamic_cast<SIM_MODEL_KIBIS*>( &m_libraryModelsMgr.GetModels()[idx].get() );
|
auto ibismodel = dynamic_cast<SIM_MODEL_IBIS*>( &m_libraryModelsMgr.GetModels()[idx].get() );
|
||||||
|
|
||||||
if( kibismodel )
|
if( ibismodel )
|
||||||
{
|
{
|
||||||
onModelNameChoice( dummyEvent ); // refresh list of pins
|
onModelNameChoice( dummyEvent ); // refresh list of pins
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
for( const std::pair<std::string, std::string>& strs : kibismodel->GetIbisPins() )
|
for( const std::pair<std::string, std::string>& strs : ibismodel->GetIbisPins() )
|
||||||
{
|
{
|
||||||
if( strs.first == SIM_MODEL::GetFieldValue( &m_fields, SIM_LIBRARY_KIBIS::PIN_FIELD ) )
|
if( strs.first == SIM_MODEL::GetFieldValue( &m_fields, SIM_LIBRARY_IBIS::PIN_FIELD ) )
|
||||||
{
|
{
|
||||||
auto kibisLibrary = static_cast<const SIM_LIBRARY_KIBIS*>( library() );
|
auto ibisLibrary = static_cast<const SIM_LIBRARY_IBIS*>( library() );
|
||||||
|
|
||||||
kibismodel->ChangePin( *kibisLibrary, strs.first );
|
ibismodel->ChangePin( *ibisLibrary, strs.first );
|
||||||
m_pinCombobox->SetSelection( static_cast<int>( i ) );
|
m_pinCombobox->SetSelection( static_cast<int>( i ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( i < static_cast<int>( kibismodel->GetIbisPins().size() ) )
|
if( i < static_cast<int>( ibismodel->GetIbisPins().size() ) )
|
||||||
{
|
{
|
||||||
onPinCombobox( dummyEvent ); // refresh list of models
|
onPinCombobox( dummyEvent ); // refresh list of models
|
||||||
|
|
||||||
m_pinModelCombobox->SetStringSelection(
|
m_pinModelCombobox->SetStringSelection(
|
||||||
SIM_MODEL::GetFieldValue( &m_fields, SIM_LIBRARY_KIBIS::MODEL_FIELD ) );
|
SIM_MODEL::GetFieldValue( &m_fields, SIM_LIBRARY_IBIS::MODEL_FIELD ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( SIM_MODEL::GetFieldValue( &m_fields, SIM_LIBRARY_KIBIS::DIFF_FIELD ) == "1" )
|
if( SIM_MODEL::GetFieldValue( &m_fields, SIM_LIBRARY_IBIS::DIFF_FIELD ) == "1" )
|
||||||
{
|
{
|
||||||
kibismodel->SwitchSingleEndedDiff( true );
|
ibismodel->SwitchSingleEndedDiff( true );
|
||||||
m_differentialCheckbox->SetValue( true );
|
m_differentialCheckbox->SetValue( true );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
kibismodel->SwitchSingleEndedDiff( false );
|
ibismodel->SwitchSingleEndedDiff( false );
|
||||||
m_differentialCheckbox->SetValue( false );
|
m_differentialCheckbox->SetValue( false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -372,7 +372,7 @@ bool DIALOG_SIM_MODEL<T>::TransferDataFromWindow()
|
||||||
|
|
||||||
if( isIbisLoaded() )
|
if( isIbisLoaded() )
|
||||||
{
|
{
|
||||||
SIM_MODEL_KIBIS* ibismodel = static_cast<SIM_MODEL_KIBIS*>(
|
SIM_MODEL_IBIS* ibismodel = static_cast<SIM_MODEL_IBIS*>(
|
||||||
&m_libraryModelsMgr.GetModels().at( m_modelNameChoice->GetSelection() ).get() );
|
&m_libraryModelsMgr.GetModels().at( m_modelNameChoice->GetSelection() ).get() );
|
||||||
|
|
||||||
if( ibismodel )
|
if( ibismodel )
|
||||||
|
@ -387,9 +387,9 @@ bool DIALOG_SIM_MODEL<T>::TransferDataFromWindow()
|
||||||
if( ibismodel->CanDifferential() && m_differentialCheckbox->GetValue() )
|
if( ibismodel->CanDifferential() && m_differentialCheckbox->GetValue() )
|
||||||
differential = "1";
|
differential = "1";
|
||||||
|
|
||||||
SIM_MODEL::SetFieldValue( m_fields, SIM_LIBRARY_KIBIS::PIN_FIELD, pins );
|
SIM_MODEL::SetFieldValue( m_fields, SIM_LIBRARY_IBIS::PIN_FIELD, pins );
|
||||||
SIM_MODEL::SetFieldValue( m_fields, SIM_LIBRARY_KIBIS::MODEL_FIELD, modelName );
|
SIM_MODEL::SetFieldValue( m_fields, SIM_LIBRARY_IBIS::MODEL_FIELD, modelName );
|
||||||
SIM_MODEL::SetFieldValue( m_fields, SIM_LIBRARY_KIBIS::DIFF_FIELD, differential );
|
SIM_MODEL::SetFieldValue( m_fields, SIM_LIBRARY_IBIS::DIFF_FIELD, differential );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -474,7 +474,7 @@ void DIALOG_SIM_MODEL<T>::updateWidgets()
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void DIALOG_SIM_MODEL<T>::updateIbisWidgets( SIM_MODEL* aModel )
|
void DIALOG_SIM_MODEL<T>::updateIbisWidgets( SIM_MODEL* aModel )
|
||||||
{
|
{
|
||||||
SIM_MODEL_KIBIS* modelkibis = isIbisLoaded() ? dynamic_cast<SIM_MODEL_KIBIS*>( aModel )
|
SIM_MODEL_IBIS* modelibis = isIbisLoaded() ? dynamic_cast<SIM_MODEL_IBIS*>( aModel )
|
||||||
: nullptr;
|
: nullptr;
|
||||||
|
|
||||||
m_pinLabel->Show( isIbisLoaded() );
|
m_pinLabel->Show( isIbisLoaded() );
|
||||||
|
@ -510,7 +510,7 @@ void DIALOG_SIM_MODEL<T>::updateIbisWidgets( SIM_MODEL* aModel )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_differentialCheckbox->Show( isIbisLoaded() && modelkibis && modelkibis->CanDifferential() );
|
m_differentialCheckbox->Show( isIbisLoaded() && modelibis && modelibis->CanDifferential() );
|
||||||
m_modelNameLabel->SetLabel( isIbisLoaded() ? _( "Component:" ) : _( "Model:" ) );
|
m_modelNameLabel->SetLabel( isIbisLoaded() ? _( "Component:" ) : _( "Model:" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1244,7 +1244,7 @@ void DIALOG_SIM_MODEL<T>::onModelNameChoice( wxCommandEvent& aEvent )
|
||||||
if( isIbisLoaded() )
|
if( isIbisLoaded() )
|
||||||
{
|
{
|
||||||
wxArrayString pinLabels;
|
wxArrayString pinLabels;
|
||||||
SIM_MODEL_KIBIS* modelkibis = dynamic_cast<SIM_MODEL_KIBIS*>( &curModel() );
|
SIM_MODEL_IBIS* modelkibis = dynamic_cast<SIM_MODEL_IBIS*>( &curModel() );
|
||||||
|
|
||||||
wxCHECK2( modelkibis, return );
|
wxCHECK2( modelkibis, return );
|
||||||
|
|
||||||
|
@ -1267,12 +1267,12 @@ void DIALOG_SIM_MODEL<T>::onPinCombobox( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
wxArrayString modelLabels;
|
wxArrayString modelLabels;
|
||||||
|
|
||||||
SIM_MODEL_KIBIS& ibisModel = static_cast<SIM_MODEL_KIBIS&>( curModel() );
|
SIM_MODEL_IBIS& ibisModel = static_cast<SIM_MODEL_IBIS&>( curModel() );
|
||||||
|
|
||||||
std::vector<std::pair<std::string, std::string>> strs = ibisModel.GetIbisPins();
|
std::vector<std::pair<std::string, std::string>> strs = ibisModel.GetIbisPins();
|
||||||
std::string pinNumber = strs.at( m_pinCombobox->GetSelection() ).first;
|
std::string pinNumber = strs.at( m_pinCombobox->GetSelection() ).first;
|
||||||
|
|
||||||
const SIM_LIBRARY_KIBIS* ibisLibrary = dynamic_cast<const SIM_LIBRARY_KIBIS*>( library() );
|
const SIM_LIBRARY_IBIS* ibisLibrary = dynamic_cast<const SIM_LIBRARY_IBIS*>( library() );
|
||||||
|
|
||||||
ibisModel.ChangePin( *ibisLibrary, pinNumber );
|
ibisModel.ChangePin( *ibisLibrary, pinNumber );
|
||||||
|
|
||||||
|
@ -1317,12 +1317,12 @@ void DIALOG_SIM_MODEL<T>::onPinModelComboboxTextEnter( wxCommandEvent& aEvent )
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void DIALOG_SIM_MODEL<T>::onDifferentialCheckbox( wxCommandEvent& aEvent )
|
void DIALOG_SIM_MODEL<T>::onDifferentialCheckbox( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
SIM_MODEL_KIBIS* modelkibis = dynamic_cast<SIM_MODEL_KIBIS*>( &curModel() );
|
SIM_MODEL_IBIS* modelibis = dynamic_cast<SIM_MODEL_IBIS*>( &curModel() );
|
||||||
|
|
||||||
wxCHECK( modelkibis, /* void */ );
|
wxCHECK( modelibis, /* void */ );
|
||||||
|
|
||||||
bool diff = m_differentialCheckbox->GetValue() && modelkibis->CanDifferential();
|
bool diff = m_differentialCheckbox->GetValue() && modelibis->CanDifferential();
|
||||||
modelkibis->SwitchSingleEndedDiff( diff );
|
modelibis->SwitchSingleEndedDiff( diff );
|
||||||
|
|
||||||
updateWidgets();
|
updateWidgets();
|
||||||
}
|
}
|
||||||
|
@ -1362,9 +1362,9 @@ void DIALOG_SIM_MODEL<T>::onWaveformChoice( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
int idx = m_modelNameChoice->GetSelection();
|
int idx = m_modelNameChoice->GetSelection();
|
||||||
|
|
||||||
auto& baseModel = static_cast<SIM_MODEL_KIBIS&>( m_libraryModelsMgr.GetModels()[idx].get() );
|
auto& baseModel = static_cast<SIM_MODEL_IBIS&>( m_libraryModelsMgr.GetModels()[idx].get() );
|
||||||
|
|
||||||
m_libraryModelsMgr.SetModel( idx, std::make_unique<SIM_MODEL_KIBIS>( type, baseModel ) );
|
m_libraryModelsMgr.SetModel( idx, std::make_unique<SIM_MODEL_IBIS>( type, baseModel ) );
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
#include <sim/sim_model.h>
|
#include <sim/sim_model.h>
|
||||||
#include <sim/sim_library.h>
|
#include <sim/sim_library.h>
|
||||||
#include <sim/sim_library_kibis.h>
|
#include <sim/sim_library_ibis.h>
|
||||||
#include <sch_symbol.h>
|
#include <sch_symbol.h>
|
||||||
|
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ private:
|
||||||
|
|
||||||
void adjustParamGridColumns( int aWidth, bool aForce );
|
void adjustParamGridColumns( int aWidth, bool aForce );
|
||||||
|
|
||||||
bool isIbisLoaded() { return dynamic_cast<const SIM_LIBRARY_KIBIS*>( library() ); }
|
bool isIbisLoaded() { return dynamic_cast<const SIM_LIBRARY_IBIS*>( library() ); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
EDA_BASE_FRAME* m_frame;
|
EDA_BASE_FRAME* m_frame;
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
#include <pgm_base.h>
|
#include <pgm_base.h>
|
||||||
#include <env_paths.h>
|
#include <env_paths.h>
|
||||||
#include <sim/sim_library_kibis.h>
|
#include <sim/sim_library_ibis.h>
|
||||||
#include <sim/sim_xspice_parser.h>
|
#include <sim/sim_xspice_parser.h>
|
||||||
#include <sch_screen.h>
|
#include <sch_screen.h>
|
||||||
#include <sch_textbox.h>
|
#include <sch_textbox.h>
|
||||||
|
@ -428,7 +428,7 @@ void NETLIST_EXPORTER_SPICE::readModel( SCH_SHEET_PATH& aSheet, SCH_SYMBOL& aSym
|
||||||
if( !path.IsEmpty() )
|
if( !path.IsEmpty() )
|
||||||
m_rawIncludes.insert( path );
|
m_rawIncludes.insert( path );
|
||||||
}
|
}
|
||||||
else if( auto kibisModel = dynamic_cast<const SIM_MODEL_KIBIS*>( aItem.model ) )
|
else if( auto ibisModel = dynamic_cast<const SIM_MODEL_IBIS*>( aItem.model ) )
|
||||||
{
|
{
|
||||||
wxFileName cacheFn;
|
wxFileName cacheFn;
|
||||||
cacheFn.AssignDir( PATHS::GetUserCachePath() );
|
cacheFn.AssignDir( PATHS::GetUserCachePath() );
|
||||||
|
@ -443,10 +443,11 @@ void NETLIST_EXPORTER_SPICE::readModel( SCH_SHEET_PATH& aSheet, SCH_SYMBOL& aSym
|
||||||
cacheFn.GetFullPath() );
|
cacheFn.GetFullPath() );
|
||||||
}
|
}
|
||||||
|
|
||||||
auto spiceGenerator = static_cast<const SPICE_GENERATOR_KIBIS&>( kibisModel->SpiceGenerator() );
|
auto spiceGenerator = static_cast<const SPICE_GENERATOR_IBIS&>( ibisModel->SpiceGenerator() );
|
||||||
std::string modelData = spiceGenerator.IbisDevice(
|
|
||||||
aItem, m_schematic->Prj(),
|
wxString cacheFilepath = cacheFn.GetPath( wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR );
|
||||||
cacheFn.GetPath( wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR ), aReporter );
|
std::string modelData = spiceGenerator.IbisDevice( aItem, m_schematic->Prj(),
|
||||||
|
cacheFilepath, aReporter );
|
||||||
|
|
||||||
cacheFile.Write( wxString( modelData ) );
|
cacheFile.Write( wxString( modelData ) );
|
||||||
m_rawIncludes.insert( cacheFn.GetFullPath() );
|
m_rawIncludes.insert( cacheFn.GetFullPath() );
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sim/sim_library_kibis.h>
|
#include <sim/sim_library_ibis.h>
|
||||||
#include <sim/sim_library.h>
|
#include <sim/sim_library.h>
|
||||||
#include <sim/sim_library_spice.h>
|
#include <sim/sim_library_spice.h>
|
||||||
#include <boost/algorithm/string/case_conv.hpp>
|
#include <boost/algorithm/string/case_conv.hpp>
|
||||||
|
@ -36,7 +36,7 @@ SIM_LIBRARY::Create( const wxString& aFilePath, bool aForceFullParse, REPORTER&
|
||||||
std::unique_ptr<SIM_LIBRARY> library;
|
std::unique_ptr<SIM_LIBRARY> library;
|
||||||
|
|
||||||
if( aFilePath.EndsWith( ".ibs" ) )
|
if( aFilePath.EndsWith( ".ibs" ) )
|
||||||
library = std::make_unique<SIM_LIBRARY_KIBIS>();
|
library = std::make_unique<SIM_LIBRARY_IBIS>();
|
||||||
else
|
else
|
||||||
library = std::make_unique<SIM_LIBRARY_SPICE>( aForceFullParse );
|
library = std::make_unique<SIM_LIBRARY_SPICE>( aForceFullParse );
|
||||||
|
|
||||||
|
|
|
@ -21,15 +21,15 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sim/sim_library_kibis.h>
|
#include <sim/sim_library_ibis.h>
|
||||||
#include <sim/sim_model_kibis.h>
|
#include <sim/sim_model_ibis.h>
|
||||||
#include <ki_exception.h>
|
#include <ki_exception.h>
|
||||||
#include <locale_io.h>
|
#include <locale_io.h>
|
||||||
#include <pegtl/contrib/parse_tree.hpp>
|
#include <pegtl/contrib/parse_tree.hpp>
|
||||||
#include <sch_pin.h>
|
#include <sch_pin.h>
|
||||||
|
|
||||||
|
|
||||||
void SIM_LIBRARY_KIBIS::ReadFile( const wxString& aFilePath, REPORTER& aReporter )
|
void SIM_LIBRARY_IBIS::ReadFile( const wxString& aFilePath, REPORTER& aReporter )
|
||||||
{
|
{
|
||||||
SIM_LIBRARY::ReadFile( aFilePath, aReporter );
|
SIM_LIBRARY::ReadFile( aFilePath, aReporter );
|
||||||
m_kibis = KIBIS( aFilePath.ToStdString(), &aReporter );
|
m_kibis = KIBIS( aFilePath.ToStdString(), &aReporter );
|
||||||
|
@ -52,7 +52,7 @@ void SIM_LIBRARY_KIBIS::ReadFile( const wxString& aFilePath, REPORTER& aReporter
|
||||||
m_models.push_back( SIM_MODEL::Create( SIM_MODEL::TYPE::KIBIS_DEVICE, pins, aReporter ) );
|
m_models.push_back( SIM_MODEL::Create( SIM_MODEL::TYPE::KIBIS_DEVICE, pins, aReporter ) );
|
||||||
m_modelNames.emplace_back( kcomp.m_name );
|
m_modelNames.emplace_back( kcomp.m_name );
|
||||||
|
|
||||||
SIM_MODEL_KIBIS* libcomp = dynamic_cast<SIM_MODEL_KIBIS*>( m_models.back().get() );
|
SIM_MODEL_IBIS* libcomp = dynamic_cast<SIM_MODEL_IBIS*>( m_models.back().get() );
|
||||||
|
|
||||||
if ( libcomp )
|
if ( libcomp )
|
||||||
InitModel( *libcomp, kcomp.m_name );
|
InitModel( *libcomp, kcomp.m_name );
|
||||||
|
@ -60,7 +60,7 @@ void SIM_LIBRARY_KIBIS::ReadFile( const wxString& aFilePath, REPORTER& aReporter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SIM_LIBRARY_KIBIS::InitModel( SIM_MODEL_KIBIS& aModel, wxString aCompName )
|
bool SIM_LIBRARY_IBIS::InitModel( SIM_MODEL_IBIS& aModel, wxString aCompName )
|
||||||
{
|
{
|
||||||
for( KIBIS_COMPONENT& kcomp : m_kibis.m_components )
|
for( KIBIS_COMPONENT& kcomp : m_kibis.m_components )
|
||||||
{
|
{
|
||||||
|
@ -83,7 +83,7 @@ bool SIM_LIBRARY_KIBIS::InitModel( SIM_MODEL_KIBIS& aModel, wxString aCompName )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SIM_LIBRARY_KIBIS::isPinDiff( const std::string& aComp, const std::string& aPinNumber ) const
|
bool SIM_LIBRARY_IBIS::isPinDiff( const std::string& aComp, const std::string& aPinNumber ) const
|
||||||
{
|
{
|
||||||
for( std::pair<std::string, std::string> aInfo : m_diffPins )
|
for( std::pair<std::string, std::string> aInfo : m_diffPins )
|
||||||
{
|
{
|
|
@ -21,16 +21,16 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SIM_LIBRARY_KIBIS_H
|
#ifndef SIM_LIBRARY_IBIS_H
|
||||||
#define SIM_LIBRARY_KIBIS_H
|
#define SIM_LIBRARY_IBIS_H
|
||||||
|
|
||||||
#include <sim/kibis/kibis.h>
|
#include <sim/kibis/kibis.h>
|
||||||
#include <sim/sim_library.h>
|
#include <sim/sim_library.h>
|
||||||
#include <sim/sim_model_kibis.h>
|
#include <sim/sim_model_ibis.h>
|
||||||
|
|
||||||
class SIM_LIBRARY_KIBIS : public SIM_LIBRARY
|
class SIM_LIBRARY_IBIS : public SIM_LIBRARY
|
||||||
{
|
{
|
||||||
friend class SIM_MODEL_KIBIS;
|
friend class SIM_MODEL_IBIS;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static constexpr auto PIN_FIELD = "Sim.Ibis.Pin";
|
static constexpr auto PIN_FIELD = "Sim.Ibis.Pin";
|
||||||
|
@ -40,7 +40,7 @@ public:
|
||||||
// @copydoc SIM_LIBRARY::ReadFile()
|
// @copydoc SIM_LIBRARY::ReadFile()
|
||||||
void ReadFile( const wxString& aFilePath, REPORTER& aReporter ) override;
|
void ReadFile( const wxString& aFilePath, REPORTER& aReporter ) override;
|
||||||
|
|
||||||
bool InitModel( SIM_MODEL_KIBIS& aModel, wxString aCompName );
|
bool InitModel( SIM_MODEL_IBIS& aModel, wxString aCompName );
|
||||||
bool isPinDiff( const std::string& aComp, const std::string& aPinNumber ) const;
|
bool isPinDiff( const std::string& aComp, const std::string& aPinNumber ) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -48,4 +48,4 @@ protected:
|
||||||
std::vector<std::pair<std::string, std::string>> m_diffPins;
|
std::vector<std::pair<std::string, std::string>> m_diffPins;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SIM_LIBRARY_SPICE_H
|
#endif // SIM_LIBRARY_IBIS_H
|
|
@ -33,7 +33,7 @@
|
||||||
#include <sim/sim_model_l_mutual.h>
|
#include <sim/sim_model_l_mutual.h>
|
||||||
#include <sim/sim_model_ngspice.h>
|
#include <sim/sim_model_ngspice.h>
|
||||||
#include <sim/sim_model_r_pot.h>
|
#include <sim/sim_model_r_pot.h>
|
||||||
#include <sim/sim_model_kibis.h>
|
#include <sim/sim_model_ibis.h>
|
||||||
#include <sim/sim_model_source.h>
|
#include <sim/sim_model_source.h>
|
||||||
#include <sim/sim_model_raw_spice.h>
|
#include <sim/sim_model_raw_spice.h>
|
||||||
#include <sim/sim_model_subckt.h>
|
#include <sim/sim_model_subckt.h>
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
#include <sim/sim_model_tline.h>
|
#include <sim/sim_model_tline.h>
|
||||||
#include <sim/sim_model_xspice.h>
|
#include <sim/sim_model_xspice.h>
|
||||||
#include <sim/sim_lib_mgr.h>
|
#include <sim/sim_lib_mgr.h>
|
||||||
#include <sim/sim_library_kibis.h>
|
#include <sim/sim_library_ibis.h>
|
||||||
|
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
#include <fmt/core.h>
|
#include <fmt/core.h>
|
||||||
|
@ -423,7 +423,7 @@ TYPE SIM_MODEL::ReadTypeFromFields( const std::vector<SCH_FIELD>& aFields, REPOR
|
||||||
void SIM_MODEL::ReadDataFields( const std::vector<SCH_FIELD>* aFields,
|
void SIM_MODEL::ReadDataFields( const std::vector<SCH_FIELD>* aFields,
|
||||||
const std::vector<SCH_PIN*>& aPins )
|
const std::vector<SCH_PIN*>& aPins )
|
||||||
{
|
{
|
||||||
bool diffMode = GetFieldValue( aFields, SIM_LIBRARY_KIBIS::DIFF_FIELD ) == "1";
|
bool diffMode = GetFieldValue( aFields, SIM_LIBRARY_IBIS::DIFF_FIELD ) == "1";
|
||||||
SwitchSingleEndedDiff( diffMode );
|
SwitchSingleEndedDiff( diffMode );
|
||||||
|
|
||||||
m_serializer->ParseEnable( GetFieldValue( aFields, SIM_LEGACY_ENABLE_FIELD_V7 ) );
|
m_serializer->ParseEnable( GetFieldValue( aFields, SIM_LEGACY_ENABLE_FIELD_V7 ) );
|
||||||
|
@ -944,7 +944,7 @@ std::unique_ptr<SIM_MODEL> SIM_MODEL::Create( TYPE aType )
|
||||||
case TYPE::KIBIS_DRIVER_DC:
|
case TYPE::KIBIS_DRIVER_DC:
|
||||||
case TYPE::KIBIS_DRIVER_RECT:
|
case TYPE::KIBIS_DRIVER_RECT:
|
||||||
case TYPE::KIBIS_DRIVER_PRBS:
|
case TYPE::KIBIS_DRIVER_PRBS:
|
||||||
return std::make_unique<SIM_MODEL_KIBIS>( aType );
|
return std::make_unique<SIM_MODEL_IBIS>( aType );
|
||||||
|
|
||||||
case TYPE::RAWSPICE:
|
case TYPE::RAWSPICE:
|
||||||
return std::make_unique<SIM_MODEL_RAW_SPICE>();
|
return std::make_unique<SIM_MODEL_RAW_SPICE>();
|
||||||
|
|
|
@ -22,32 +22,32 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sim/kibis/kibis.h>
|
#include <sim/kibis/kibis.h>
|
||||||
#include <sim/sim_model_kibis.h>
|
#include <sim/sim_model_ibis.h>
|
||||||
#include <sim/sim_library_kibis.h>
|
#include <sim/sim_library_ibis.h>
|
||||||
#include <fmt/core.h>
|
#include <fmt/core.h>
|
||||||
#include <wx/filename.h>
|
#include <wx/filename.h>
|
||||||
#include <kiway.h>
|
#include <kiway.h>
|
||||||
#include "sim_lib_mgr.h"
|
#include "sim_lib_mgr.h"
|
||||||
|
|
||||||
std::string SPICE_GENERATOR_KIBIS::ModelName( const SPICE_ITEM& aItem ) const
|
std::string SPICE_GENERATOR_IBIS::ModelName( const SPICE_ITEM& aItem ) const
|
||||||
{
|
{
|
||||||
return fmt::format( "{}.{}", aItem.refName, aItem.baseModelName );
|
return fmt::format( "{}.{}", aItem.refName, aItem.baseModelName );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string SPICE_GENERATOR_KIBIS::ModelLine( const SPICE_ITEM& aItem ) const
|
std::string SPICE_GENERATOR_IBIS::ModelLine( const SPICE_ITEM& aItem ) const
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::reference_wrapper<const SIM_MODEL::PARAM>> SPICE_GENERATOR_KIBIS::GetInstanceParams() const
|
std::vector<std::reference_wrapper<const SIM_MODEL::PARAM>> SPICE_GENERATOR_IBIS::GetInstanceParams() const
|
||||||
{
|
{
|
||||||
std::vector<std::reference_wrapper<const SIM_MODEL::PARAM>> vec;
|
std::vector<std::reference_wrapper<const SIM_MODEL::PARAM>> vec;
|
||||||
return vec;
|
return vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::vector<std::string> SPICE_GENERATOR_KIBIS::CurrentNames( const SPICE_ITEM& aItem ) const
|
std::vector<std::string> SPICE_GENERATOR_IBIS::CurrentNames( const SPICE_ITEM& aItem ) const
|
||||||
{
|
{
|
||||||
std::vector<std::string> currentNames;
|
std::vector<std::string> currentNames;
|
||||||
|
|
||||||
|
@ -58,15 +58,15 @@ std::vector<std::string> SPICE_GENERATOR_KIBIS::CurrentNames( const SPICE_ITEM&
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string SPICE_GENERATOR_KIBIS::IbisDevice( const SPICE_ITEM& aItem, const PROJECT& aProject,
|
std::string SPICE_GENERATOR_IBIS::IbisDevice( const SPICE_ITEM& aItem, const PROJECT& aProject,
|
||||||
const wxString& aCacheDir,
|
const wxString& aCacheDir,
|
||||||
REPORTER& aReporter ) const
|
REPORTER& aReporter ) const
|
||||||
{
|
{
|
||||||
std::string ibisLibFilename = SIM_MODEL::GetFieldValue( &aItem.fields, SIM_LIBRARY::LIBRARY_FIELD );
|
std::string ibisLibFilename = SIM_MODEL::GetFieldValue( &aItem.fields, SIM_LIBRARY::LIBRARY_FIELD );
|
||||||
std::string ibisCompName = SIM_MODEL::GetFieldValue( &aItem.fields, SIM_LIBRARY::NAME_FIELD );
|
std::string ibisCompName = SIM_MODEL::GetFieldValue( &aItem.fields, SIM_LIBRARY::NAME_FIELD );
|
||||||
std::string ibisPinName = SIM_MODEL::GetFieldValue( &aItem.fields, SIM_LIBRARY_KIBIS::PIN_FIELD );
|
std::string ibisPinName = SIM_MODEL::GetFieldValue( &aItem.fields, SIM_LIBRARY_IBIS::PIN_FIELD );
|
||||||
std::string ibisModelName = SIM_MODEL::GetFieldValue( &aItem.fields, SIM_LIBRARY_KIBIS::MODEL_FIELD );
|
std::string ibisModelName = SIM_MODEL::GetFieldValue( &aItem.fields, SIM_LIBRARY_IBIS::MODEL_FIELD );
|
||||||
bool diffMode = SIM_MODEL::GetFieldValue( &aItem.fields, SIM_LIBRARY_KIBIS::DIFF_FIELD ) == "1";
|
bool diffMode = SIM_MODEL::GetFieldValue( &aItem.fields, SIM_LIBRARY_IBIS::DIFF_FIELD ) == "1";
|
||||||
|
|
||||||
wxString path = SIM_LIB_MGR::ResolveLibraryPath( ibisLibFilename, &aProject );
|
wxString path = SIM_LIB_MGR::ResolveLibraryPath( ibisLibFilename, &aProject );
|
||||||
|
|
||||||
|
@ -220,8 +220,8 @@ std::string SPICE_GENERATOR_KIBIS::IbisDevice( const SPICE_ITEM& aItem, const PR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SIM_MODEL_KIBIS::SIM_MODEL_KIBIS( TYPE aType ) :
|
SIM_MODEL_IBIS::SIM_MODEL_IBIS( TYPE aType ) :
|
||||||
SIM_MODEL( aType, std::make_unique<SPICE_GENERATOR_KIBIS>( *this ) ),
|
SIM_MODEL( aType, std::make_unique<SPICE_GENERATOR_IBIS>( *this ) ),
|
||||||
m_enableDiff( false ),
|
m_enableDiff( false ),
|
||||||
m_sourceModel( nullptr )
|
m_sourceModel( nullptr )
|
||||||
{
|
{
|
||||||
|
@ -251,7 +251,7 @@ SIM_MODEL_KIBIS::SIM_MODEL_KIBIS( TYPE aType ) :
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SIM_MODEL_KIBIS::SwitchSingleEndedDiff( bool aDiff )
|
void SIM_MODEL_IBIS::SwitchSingleEndedDiff( bool aDiff )
|
||||||
{
|
{
|
||||||
ClearPins();
|
ClearPins();
|
||||||
|
|
||||||
|
@ -268,8 +268,8 @@ void SIM_MODEL_KIBIS::SwitchSingleEndedDiff( bool aDiff )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SIM_MODEL_KIBIS::SIM_MODEL_KIBIS( TYPE aType, const SIM_MODEL_KIBIS& aSource ) :
|
SIM_MODEL_IBIS::SIM_MODEL_IBIS( TYPE aType, const SIM_MODEL_IBIS& aSource ) :
|
||||||
SIM_MODEL_KIBIS( aType )
|
SIM_MODEL_IBIS( aType )
|
||||||
{
|
{
|
||||||
for( PARAM& param1 : m_params )
|
for( PARAM& param1 : m_params )
|
||||||
{
|
{
|
||||||
|
@ -291,7 +291,7 @@ SIM_MODEL_KIBIS::SIM_MODEL_KIBIS( TYPE aType, const SIM_MODEL_KIBIS& aSource ) :
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SIM_MODEL_KIBIS::ChangePin( const SIM_LIBRARY_KIBIS& aLib, std::string aPinNumber )
|
bool SIM_MODEL_IBIS::ChangePin( const SIM_LIBRARY_IBIS& aLib, std::string aPinNumber )
|
||||||
{
|
{
|
||||||
KIBIS_COMPONENT* kcomp = aLib.m_kibis.GetComponent( std::string( GetComponentName() ) );
|
KIBIS_COMPONENT* kcomp = aLib.m_kibis.GetComponent( std::string( GetComponentName() ) );
|
||||||
|
|
||||||
|
@ -312,17 +312,17 @@ bool SIM_MODEL_KIBIS::ChangePin( const SIM_LIBRARY_KIBIS& aLib, std::string aPin
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SIM_MODEL_KIBIS::SetBaseModel( const SIM_MODEL& aBaseModel )
|
void SIM_MODEL_IBIS::SetBaseModel( const SIM_MODEL& aBaseModel )
|
||||||
{
|
{
|
||||||
// Actual base models can only be of the same type, which is not the case here, as in addition
|
// Actual base models can only be of the same type, which is not the case here, as in addition
|
||||||
// to IBIS device model type we have multiple types of drivers available for the same sourced
|
// to IBIS device model type we have multiple types of drivers available for the same sourced
|
||||||
// model. And we don't want to inherit the default values anyway. So we just store these models
|
// model. And we don't want to inherit the default values anyway. So we just store these models
|
||||||
// and use the only for Spice code generation.
|
// and use the only for Spice code generation.
|
||||||
m_sourceModel = dynamic_cast<const SIM_MODEL_KIBIS*>( &aBaseModel );
|
m_sourceModel = dynamic_cast<const SIM_MODEL_IBIS*>( &aBaseModel );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_KIBIS::makeParamInfos( TYPE aType )
|
std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_IBIS::makeParamInfos( TYPE aType )
|
||||||
{
|
{
|
||||||
std::vector<PARAM::INFO> paramInfos;
|
std::vector<PARAM::INFO> paramInfos;
|
||||||
PARAM::INFO paramInfo;
|
PARAM::INFO paramInfo;
|
||||||
|
@ -396,7 +396,7 @@ std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_KIBIS::makeParamInfos( TYPE aType
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_KIBIS::makeDcWaveformParamInfos()
|
std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_IBIS::makeDcWaveformParamInfos()
|
||||||
{
|
{
|
||||||
std::vector<PARAM::INFO> paramInfos;
|
std::vector<PARAM::INFO> paramInfos;
|
||||||
PARAM::INFO paramInfo;
|
PARAM::INFO paramInfo;
|
||||||
|
@ -414,7 +414,7 @@ std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_KIBIS::makeDcWaveformParamInfos()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_KIBIS::makeRectWaveformParamInfos()
|
std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_IBIS::makeRectWaveformParamInfos()
|
||||||
{
|
{
|
||||||
std::vector<PARAM::INFO> paramInfos;
|
std::vector<PARAM::INFO> paramInfos;
|
||||||
PARAM::INFO paramInfo;
|
PARAM::INFO paramInfo;
|
||||||
|
@ -455,7 +455,7 @@ std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_KIBIS::makeRectWaveformParamInfos(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_KIBIS::makePrbsWaveformParamInfos()
|
std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_IBIS::makePrbsWaveformParamInfos()
|
||||||
{
|
{
|
||||||
std::vector<PARAM::INFO> paramInfos;
|
std::vector<PARAM::INFO> paramInfos;
|
||||||
PARAM::INFO paramInfo;
|
PARAM::INFO paramInfo;
|
|
@ -21,19 +21,19 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SIM_MODEL_KIBIS_H
|
#ifndef SIM_MODEL_IBIS_H
|
||||||
#define SIM_MODEL_KIBIS_H
|
#define SIM_MODEL_IBIS_H
|
||||||
|
|
||||||
#include <sim/kibis/kibis.h>
|
#include <sim/kibis/kibis.h>
|
||||||
#include <sim/sim_model.h>
|
#include <sim/sim_model.h>
|
||||||
#include <sim/spice_generator.h>
|
#include <sim/spice_generator.h>
|
||||||
#include <project.h>
|
#include <project.h>
|
||||||
|
|
||||||
class SIM_LIBRARY_KIBIS;
|
class SIM_LIBRARY_IBIS;
|
||||||
class REPORTER;
|
class REPORTER;
|
||||||
|
|
||||||
|
|
||||||
class SPICE_GENERATOR_KIBIS : public SPICE_GENERATOR
|
class SPICE_GENERATOR_IBIS : public SPICE_GENERATOR
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using SPICE_GENERATOR::SPICE_GENERATOR;
|
using SPICE_GENERATOR::SPICE_GENERATOR;
|
||||||
|
@ -49,16 +49,16 @@ protected:
|
||||||
std::vector<std::reference_wrapper<const SIM_MODEL::PARAM>> GetInstanceParams() const override;
|
std::vector<std::reference_wrapper<const SIM_MODEL::PARAM>> GetInstanceParams() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SIM_MODEL_KIBIS : public SIM_MODEL
|
class SIM_MODEL_IBIS : public SIM_MODEL
|
||||||
{
|
{
|
||||||
friend class SIM_LIBRARY_KIBIS;
|
friend class SIM_LIBRARY_IBIS;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SIM_MODEL_KIBIS( TYPE aType );
|
SIM_MODEL_IBIS( TYPE aType );
|
||||||
|
|
||||||
// @brief Special copy constructor
|
// @brief Special copy constructor
|
||||||
// creates a a model with aType, but tries to match parameters from aSource.
|
// creates a a model with aType, but tries to match parameters from aSource.
|
||||||
SIM_MODEL_KIBIS( TYPE aType, const SIM_MODEL_KIBIS& aSource );
|
SIM_MODEL_IBIS( TYPE aType, const SIM_MODEL_IBIS& aSource );
|
||||||
|
|
||||||
std::vector<std::pair<std::string, std::string>> GetIbisPins() const
|
std::vector<std::pair<std::string, std::string>> GetIbisPins() const
|
||||||
{
|
{
|
||||||
|
@ -81,7 +81,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief update the list of available models based on the pin number.
|
* @brief update the list of available models based on the pin number.
|
||||||
*/
|
*/
|
||||||
bool ChangePin( const SIM_LIBRARY_KIBIS& aLib, std::string aPinNumber );
|
bool ChangePin( const SIM_LIBRARY_IBIS& aLib, std::string aPinNumber );
|
||||||
|
|
||||||
void SetBaseModel( const SIM_MODEL& aBaseModel ) override;
|
void SetBaseModel( const SIM_MODEL& aBaseModel ) override;
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ private:
|
||||||
static std::vector<PARAM::INFO> makeRectWaveformParamInfos();
|
static std::vector<PARAM::INFO> makeRectWaveformParamInfos();
|
||||||
static std::vector<PARAM::INFO> makePrbsWaveformParamInfos();
|
static std::vector<PARAM::INFO> makePrbsWaveformParamInfos();
|
||||||
|
|
||||||
const SIM_MODEL_KIBIS* m_sourceModel;
|
const SIM_MODEL_IBIS* m_sourceModel;
|
||||||
std::vector<std::string> m_ibisModels;
|
std::vector<std::string> m_ibisModels;
|
||||||
std::vector<std::pair<std::string, std::string>> m_ibisPins;
|
std::vector<std::pair<std::string, std::string>> m_ibisPins;
|
||||||
std::string m_componentName;
|
std::string m_componentName;
|
Loading…
Reference in New Issue