2022-09-27 20:47:00 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 3
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* https://www.gnu.org/licenses/gpl-3.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 3 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2022-11-12 19:45:56 +00:00
|
|
|
#include <sim/kibis/kibis.h>
|
|
|
|
#include <sim/sim_model_kibis.h>
|
|
|
|
#include <sim/sim_library_kibis.h>
|
2022-09-27 20:47:00 +00:00
|
|
|
#include <fmt/core.h>
|
2022-10-25 09:45:40 +00:00
|
|
|
#include <wx/filename.h>
|
|
|
|
#include <kiway.h>
|
2022-12-07 22:32:50 +00:00
|
|
|
#include "sim_lib_mgr.h"
|
2022-09-27 20:47:00 +00:00
|
|
|
|
2022-10-10 23:23:00 +00:00
|
|
|
std::string SPICE_GENERATOR_KIBIS::ModelName( const SPICE_ITEM& aItem ) const
|
2022-10-10 11:35:18 +00:00
|
|
|
{
|
2022-10-10 23:23:00 +00:00
|
|
|
return fmt::format( "{}.{}", aItem.refName, aItem.baseModelName );
|
2022-10-10 11:35:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-10-10 23:23:00 +00:00
|
|
|
std::string SPICE_GENERATOR_KIBIS::ModelLine( const SPICE_ITEM& aItem ) const
|
2022-09-27 20:47:00 +00:00
|
|
|
{
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<std::reference_wrapper<const SIM_MODEL::PARAM>> SPICE_GENERATOR_KIBIS::GetInstanceParams() const
|
|
|
|
{
|
|
|
|
std::vector<std::reference_wrapper<const SIM_MODEL::PARAM>> vec;
|
|
|
|
return vec;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-10-10 23:23:00 +00:00
|
|
|
std::vector<std::string> SPICE_GENERATOR_KIBIS::CurrentNames( const SPICE_ITEM& aItem ) const
|
2022-09-27 20:47:00 +00:00
|
|
|
{
|
|
|
|
std::vector<std::string> currentNames;
|
|
|
|
|
2024-05-10 19:53:30 +00:00
|
|
|
for( const SIM_MODEL_PIN& pin : GetPins() )
|
|
|
|
currentNames.push_back( fmt::format( "I({}:{})", ItemName( aItem ), pin.modelPinName ) );
|
2022-09-27 20:47:00 +00:00
|
|
|
|
|
|
|
return currentNames;
|
|
|
|
}
|
|
|
|
|
2022-10-09 18:44:03 +00:00
|
|
|
|
2022-12-07 15:02:35 +00:00
|
|
|
std::string SPICE_GENERATOR_KIBIS::IbisDevice( const SPICE_ITEM& aItem, const PROJECT& aProject,
|
|
|
|
const wxString& aCacheDir ) const
|
2022-10-09 18:44:03 +00:00
|
|
|
{
|
2022-12-05 02:07:45 +00:00
|
|
|
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 ibisPinName = SIM_MODEL::GetFieldValue( &aItem.fields, SIM_LIBRARY_KIBIS::PIN_FIELD );
|
|
|
|
std::string ibisModelName = SIM_MODEL::GetFieldValue( &aItem.fields, SIM_LIBRARY_KIBIS::MODEL_FIELD );
|
2022-12-07 15:02:35 +00:00
|
|
|
bool diffMode = SIM_MODEL::GetFieldValue( &aItem.fields, SIM_LIBRARY_KIBIS::DIFF_FIELD ) == "1";
|
2022-10-25 09:45:40 +00:00
|
|
|
|
2022-12-14 13:00:25 +00:00
|
|
|
wxString path = SIM_LIB_MGR::ResolveLibraryPath( ibisLibFilename, &aProject );
|
2022-10-25 09:45:40 +00:00
|
|
|
|
2022-12-07 22:32:50 +00:00
|
|
|
KIBIS kibis( std::string( path.c_str() ) );
|
2022-12-07 15:02:35 +00:00
|
|
|
kibis.m_cacheDir = std::string( aCacheDir.c_str() );
|
2022-10-25 09:45:40 +00:00
|
|
|
|
|
|
|
if( !kibis.m_valid )
|
2022-12-05 02:07:45 +00:00
|
|
|
THROW_IO_ERROR( wxString::Format( _( "Invalid IBIS file '%s'" ), ibisLibFilename ) );
|
2022-10-09 18:44:03 +00:00
|
|
|
|
|
|
|
KIBIS_COMPONENT* kcomp = kibis.GetComponent( std::string( ibisCompName ) );
|
2022-10-29 07:45:45 +00:00
|
|
|
|
2022-10-09 18:44:03 +00:00
|
|
|
if( !kcomp )
|
|
|
|
THROW_IO_ERROR( wxString::Format( _( "Could not find IBIS component '%s'" ), ibisCompName ) );
|
|
|
|
|
|
|
|
KIBIS_PIN* kpin = kcomp->GetPin( ibisPinName );
|
|
|
|
|
2022-10-25 09:45:40 +00:00
|
|
|
|
|
|
|
if( !kcomp->m_valid )
|
2022-12-07 22:32:50 +00:00
|
|
|
THROW_IO_ERROR( wxString::Format( _( "Invalid IBIS component '%s'" ), ibisCompName ) );
|
2022-10-25 09:45:40 +00:00
|
|
|
|
2022-10-09 18:44:03 +00:00
|
|
|
if( !kpin )
|
|
|
|
{
|
|
|
|
THROW_IO_ERROR( wxString::Format( _( "Could not find IBIS pin '%s' in component '%s'" ),
|
|
|
|
ibisPinName,
|
|
|
|
ibisCompName ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !kpin->m_valid )
|
|
|
|
{
|
|
|
|
THROW_IO_ERROR( wxString::Format( _( "Invalid IBIS pin '%s' in component '%s'" ),
|
|
|
|
ibisPinName,
|
|
|
|
ibisCompName ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
KIBIS_MODEL* kmodel = kibis.GetModel( ibisModelName );
|
|
|
|
|
|
|
|
if( !kmodel )
|
|
|
|
THROW_IO_ERROR( wxString::Format( _( "Could not find IBIS model '%s'" ), ibisModelName ) );
|
|
|
|
|
|
|
|
if( !kmodel->m_valid )
|
|
|
|
THROW_IO_ERROR( wxString::Format( _( "Invalid IBIS model '%s'" ), ibisModelName ) );
|
|
|
|
|
|
|
|
KIBIS_PARAMETER kparams;
|
|
|
|
|
2023-05-20 19:58:13 +00:00
|
|
|
if( const SIM_MODEL::PARAM* vcc = m_model.FindParam( "vcc" ) )
|
|
|
|
kparams.SetCornerFromString( kparams.m_supply, vcc->value );
|
2023-02-18 11:54:55 +00:00
|
|
|
|
2023-05-20 19:58:13 +00:00
|
|
|
if( const SIM_MODEL::PARAM* rpin = m_model.FindParam( "rpin" ) )
|
|
|
|
kparams.SetCornerFromString( kparams.m_Rpin, rpin->value );
|
2023-02-18 11:54:55 +00:00
|
|
|
|
2023-05-20 19:58:13 +00:00
|
|
|
if( const SIM_MODEL::PARAM* lpin = m_model.FindParam( "lpin" ) )
|
|
|
|
kparams.SetCornerFromString( kparams.m_Lpin, lpin->value );
|
2023-02-18 11:54:55 +00:00
|
|
|
|
2023-05-20 19:58:13 +00:00
|
|
|
if( const SIM_MODEL::PARAM* cpin = m_model.FindParam( "cpin" ) )
|
|
|
|
kparams.SetCornerFromString( kparams.m_Cpin, cpin->value );
|
2023-02-18 11:54:55 +00:00
|
|
|
|
2023-02-22 09:10:06 +00:00
|
|
|
//kparams.SetCornerFromString( kparams.m_Ccomp, FindParam( "ccomp" )->value );
|
2022-10-09 18:44:03 +00:00
|
|
|
|
|
|
|
std::string result;
|
|
|
|
|
|
|
|
switch( m_model.GetType() )
|
|
|
|
{
|
|
|
|
case SIM_MODEL::TYPE::KIBIS_DEVICE:
|
2022-10-25 09:45:40 +00:00
|
|
|
if( diffMode )
|
|
|
|
kpin->writeSpiceDiffDevice( &result, aItem.modelName, *kmodel, kparams );
|
|
|
|
else
|
|
|
|
kpin->writeSpiceDevice( &result, aItem.modelName, *kmodel, kparams );
|
2022-10-09 18:44:03 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SIM_MODEL::TYPE::KIBIS_DRIVER_DC:
|
|
|
|
{
|
2023-02-18 11:54:55 +00:00
|
|
|
std::string paramValue = "";
|
|
|
|
|
2023-05-20 19:58:13 +00:00
|
|
|
if( const SIM_MODEL::PARAM* dc = m_model.FindParam( "dc" ) )
|
|
|
|
paramValue = dc->value;
|
2022-10-09 18:44:03 +00:00
|
|
|
|
|
|
|
if( paramValue == "hi-Z" )
|
|
|
|
{
|
2022-12-07 22:32:50 +00:00
|
|
|
kparams.m_waveform = static_cast<KIBIS_WAVEFORM*>( new KIBIS_WAVEFORM_HIGH_Z( &kibis ) );
|
2022-10-09 18:44:03 +00:00
|
|
|
}
|
|
|
|
else if( paramValue == "low" )
|
|
|
|
{
|
2022-12-07 22:32:50 +00:00
|
|
|
kparams.m_waveform = static_cast<KIBIS_WAVEFORM*>( new KIBIS_WAVEFORM_STUCK_LOW( &kibis ) );
|
2022-10-09 18:44:03 +00:00
|
|
|
}
|
|
|
|
else if( paramValue == "high" )
|
|
|
|
{
|
2022-12-07 22:32:50 +00:00
|
|
|
kparams.m_waveform = static_cast<KIBIS_WAVEFORM*>( new KIBIS_WAVEFORM_STUCK_HIGH( &kibis ) );
|
2022-10-09 18:44:03 +00:00
|
|
|
}
|
|
|
|
|
2022-10-25 09:45:40 +00:00
|
|
|
if( diffMode )
|
|
|
|
kpin->writeSpiceDiffDriver( &result, aItem.modelName, *kmodel, kparams );
|
|
|
|
else
|
|
|
|
kpin->writeSpiceDriver( &result, aItem.modelName, *kmodel, kparams );
|
2022-10-09 18:44:03 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case SIM_MODEL::TYPE::KIBIS_DRIVER_RECT:
|
|
|
|
{
|
2022-11-20 19:10:46 +00:00
|
|
|
KIBIS_WAVEFORM_RECTANGULAR* waveform = new KIBIS_WAVEFORM_RECTANGULAR( &kibis );
|
2022-10-09 18:44:03 +00:00
|
|
|
|
2023-05-20 19:58:13 +00:00
|
|
|
if( const SIM_MODEL::PARAM* ton = m_model.FindParam( "ton" ) )
|
|
|
|
waveform->m_ton = SIM_VALUE::ToDouble( ton->value, 1 );
|
2022-10-25 09:45:40 +00:00
|
|
|
|
2023-05-20 19:58:13 +00:00
|
|
|
if( const SIM_MODEL::PARAM* toff = m_model.FindParam( "toff" ) )
|
|
|
|
waveform->m_toff = SIM_VALUE::ToDouble( toff->value, 1 );
|
2022-10-25 09:45:40 +00:00
|
|
|
|
2023-05-20 19:58:13 +00:00
|
|
|
if( const SIM_MODEL::PARAM* td = m_model.FindParam( "td" ) )
|
|
|
|
waveform->m_delay = SIM_VALUE::ToDouble( td->value, 0 );
|
2022-10-25 09:45:40 +00:00
|
|
|
|
2023-05-20 19:58:13 +00:00
|
|
|
if( const SIM_MODEL::PARAM* n = m_model.FindParam( "n" ) )
|
|
|
|
waveform->m_cycles = SIM_VALUE::ToInt( n->value, 1 );
|
2022-10-09 18:44:03 +00:00
|
|
|
|
|
|
|
kparams.m_waveform = waveform;
|
2022-10-25 09:45:40 +00:00
|
|
|
|
|
|
|
if( diffMode )
|
|
|
|
kpin->writeSpiceDiffDriver( &result, aItem.modelName, *kmodel, kparams );
|
|
|
|
else
|
|
|
|
kpin->writeSpiceDriver( &result, aItem.modelName, *kmodel, kparams );
|
2022-10-09 18:44:03 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case SIM_MODEL::TYPE::KIBIS_DRIVER_PRBS:
|
|
|
|
{
|
2022-11-20 19:10:46 +00:00
|
|
|
KIBIS_WAVEFORM_PRBS* waveform = new KIBIS_WAVEFORM_PRBS( &kibis );
|
2022-10-09 18:44:03 +00:00
|
|
|
|
2023-05-20 19:58:13 +00:00
|
|
|
if( const SIM_MODEL::PARAM* f0 = m_model.FindParam( "f0" ) )
|
|
|
|
waveform->m_bitrate = SIM_VALUE::ToDouble( f0->value, 0 );
|
2022-10-25 09:45:40 +00:00
|
|
|
|
2023-05-20 19:58:13 +00:00
|
|
|
if( const SIM_MODEL::PARAM* td = m_model.FindParam( "td" ) )
|
|
|
|
waveform->m_delay = SIM_VALUE::ToDouble( td->value, 0 );
|
2022-10-25 09:45:40 +00:00
|
|
|
|
2023-05-20 19:58:13 +00:00
|
|
|
if( const SIM_MODEL::PARAM* n = m_model.FindParam( "n" ) )
|
|
|
|
waveform->m_bits = SIM_VALUE::ToInt( n->value, 0 );
|
2022-10-09 18:44:03 +00:00
|
|
|
|
|
|
|
kparams.m_waveform = waveform;
|
2022-10-25 09:45:40 +00:00
|
|
|
|
|
|
|
if( diffMode )
|
|
|
|
kpin->writeSpiceDiffDriver( &result, aItem.modelName, *kmodel, kparams );
|
|
|
|
else
|
|
|
|
kpin->writeSpiceDriver( &result, aItem.modelName, *kmodel, kparams );
|
2022-10-09 18:44:03 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
wxFAIL_MSG( "Unknown IBIS model type" );
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-09-30 12:29:44 +00:00
|
|
|
SIM_MODEL_KIBIS::SIM_MODEL_KIBIS( TYPE aType ) :
|
2022-10-10 23:23:00 +00:00
|
|
|
SIM_MODEL( aType, std::make_unique<SPICE_GENERATOR_KIBIS>( *this ) ),
|
2022-10-29 07:45:45 +00:00
|
|
|
m_enableDiff( false ),
|
2022-10-10 23:23:00 +00:00
|
|
|
m_sourceModel( nullptr )
|
2022-09-27 20:47:00 +00:00
|
|
|
{
|
2022-09-30 12:29:44 +00:00
|
|
|
static std::vector<PARAM::INFO> device = makeParamInfos( TYPE::KIBIS_DEVICE );
|
|
|
|
static std::vector<PARAM::INFO> dcDriver = makeParamInfos( TYPE::KIBIS_DRIVER_DC );
|
|
|
|
static std::vector<PARAM::INFO> rectDriver = makeParamInfos( TYPE::KIBIS_DRIVER_RECT );
|
|
|
|
static std::vector<PARAM::INFO> prbsDriver = makeParamInfos( TYPE::KIBIS_DRIVER_PRBS );
|
|
|
|
|
|
|
|
std::vector<PARAM::INFO>* paramInfos = nullptr;
|
|
|
|
|
|
|
|
switch( aType )
|
|
|
|
{
|
|
|
|
case SIM_MODEL::TYPE::KIBIS_DEVICE: paramInfos = &device; break;
|
|
|
|
case SIM_MODEL::TYPE::KIBIS_DRIVER_DC: paramInfos = &dcDriver; break;
|
|
|
|
case SIM_MODEL::TYPE::KIBIS_DRIVER_RECT: paramInfos = &rectDriver; break;
|
|
|
|
case SIM_MODEL::TYPE::KIBIS_DRIVER_PRBS: paramInfos = &prbsDriver; break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
wxFAIL;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for( const PARAM::INFO& paramInfo : *paramInfos )
|
|
|
|
AddParam( paramInfo );
|
2022-09-27 20:47:00 +00:00
|
|
|
|
2022-10-25 09:45:40 +00:00
|
|
|
SwitchSingleEndedDiff( false );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SIM_MODEL_KIBIS::SwitchSingleEndedDiff( bool aDiff )
|
|
|
|
{
|
2022-11-25 04:31:03 +00:00
|
|
|
ClearPins();
|
2022-10-25 09:45:40 +00:00
|
|
|
|
|
|
|
if( aDiff )
|
2022-09-29 08:35:01 +00:00
|
|
|
{
|
|
|
|
AddPin( { "GND", "1" } );
|
|
|
|
AddPin( { "+", "2" } );
|
|
|
|
AddPin( { "-", "3" } );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
AddPin( { "GND", "1" } );
|
|
|
|
AddPin( { "IN/OUT", "2" } );
|
|
|
|
}
|
2022-09-27 20:47:00 +00:00
|
|
|
}
|
|
|
|
|
2022-12-05 02:07:45 +00:00
|
|
|
SIM_MODEL_KIBIS::SIM_MODEL_KIBIS( TYPE aType, const SIM_MODEL_KIBIS& aSource ) :
|
|
|
|
SIM_MODEL_KIBIS( aType )
|
2022-09-27 20:47:00 +00:00
|
|
|
{
|
|
|
|
for( PARAM& param1 : m_params )
|
|
|
|
{
|
2022-09-29 08:35:01 +00:00
|
|
|
for( auto& param2refwrap : aSource.GetParams() )
|
2022-09-27 20:47:00 +00:00
|
|
|
{
|
|
|
|
const PARAM& param2 = param2refwrap.get();
|
|
|
|
|
|
|
|
if( param1.info.name == param2.info.name )
|
2023-02-22 09:10:06 +00:00
|
|
|
param1.value = param2.value;
|
2022-09-27 20:47:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
m_componentName = aSource.m_componentName;
|
|
|
|
|
|
|
|
m_ibisPins = aSource.GetIbisPins();
|
|
|
|
m_ibisModels = aSource.GetIbisModels();
|
2022-11-12 14:39:36 +00:00
|
|
|
|
|
|
|
m_enableDiff = aSource.CanDifferential();
|
2022-09-27 20:47:00 +00:00
|
|
|
}
|
|
|
|
|
2022-12-17 20:25:29 +00:00
|
|
|
|
2022-11-19 00:45:28 +00:00
|
|
|
bool SIM_MODEL_KIBIS::ChangePin( const SIM_LIBRARY_KIBIS& aLib, std::string aPinNumber )
|
2022-09-30 12:29:44 +00:00
|
|
|
{
|
|
|
|
KIBIS_COMPONENT* kcomp = aLib.m_kibis.GetComponent( std::string( GetComponentName() ) );
|
2022-09-29 08:35:01 +00:00
|
|
|
|
2022-09-30 12:29:44 +00:00
|
|
|
if( !kcomp )
|
|
|
|
return false;
|
2022-09-27 20:47:00 +00:00
|
|
|
|
2022-09-30 12:29:44 +00:00
|
|
|
KIBIS_PIN* kpin = kcomp->GetPin( std::string( aPinNumber.c_str() ) );
|
2022-09-27 20:47:00 +00:00
|
|
|
|
2022-09-30 12:29:44 +00:00
|
|
|
if( !kpin )
|
|
|
|
return false;
|
2022-09-27 20:47:00 +00:00
|
|
|
|
2022-09-30 12:29:44 +00:00
|
|
|
m_ibisModels.clear();
|
2022-09-27 20:47:00 +00:00
|
|
|
|
2022-09-30 12:29:44 +00:00
|
|
|
for( KIBIS_MODEL* kmodel : kpin->m_models )
|
|
|
|
m_ibisModels.push_back( kmodel->m_name );
|
|
|
|
|
|
|
|
return true;
|
2022-09-27 20:47:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-10-08 00:59:44 +00:00
|
|
|
void SIM_MODEL_KIBIS::SetBaseModel( const SIM_MODEL& aBaseModel )
|
|
|
|
{
|
2022-10-09 18:44:03 +00:00
|
|
|
// 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
|
|
|
|
// 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.
|
2022-10-11 00:22:36 +00:00
|
|
|
m_sourceModel = dynamic_cast<const SIM_MODEL_KIBIS*>( &aBaseModel );
|
2022-10-08 00:59:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-09-30 12:29:44 +00:00
|
|
|
std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_KIBIS::makeParamInfos( TYPE aType )
|
2022-09-27 20:47:00 +00:00
|
|
|
{
|
|
|
|
std::vector<PARAM::INFO> paramInfos;
|
|
|
|
PARAM::INFO paramInfo;
|
|
|
|
|
|
|
|
paramInfo.name = "vcc";
|
|
|
|
paramInfo.type = SIM_VALUE::TYPE_STRING;
|
|
|
|
paramInfo.unit = "";
|
|
|
|
paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
|
2022-11-30 16:36:49 +00:00
|
|
|
paramInfo.defaultValue = "typ";
|
2022-09-27 20:47:00 +00:00
|
|
|
paramInfo.description = _( "Power supply" );
|
|
|
|
paramInfo.spiceModelName = "";
|
2022-11-30 16:36:49 +00:00
|
|
|
paramInfo.enumValues = { "typ", "min", "max" };
|
2022-09-27 20:47:00 +00:00
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
paramInfo.name = "rpin";
|
|
|
|
paramInfo.type = SIM_VALUE::TYPE_STRING;
|
|
|
|
paramInfo.unit = "";
|
|
|
|
paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
|
2022-11-30 16:36:49 +00:00
|
|
|
paramInfo.defaultValue = "typ";
|
|
|
|
paramInfo.description = _( "Parasitic pin resistance" );
|
2022-09-27 20:47:00 +00:00
|
|
|
paramInfo.spiceModelName = "";
|
2022-11-30 16:36:49 +00:00
|
|
|
paramInfo.enumValues = { "typ", "min", "max" };
|
2022-09-27 20:47:00 +00:00
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
paramInfo.name = "lpin";
|
2022-09-30 12:29:44 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_STRING;
|
2022-09-27 20:47:00 +00:00
|
|
|
paramInfo.unit = "";
|
|
|
|
paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
|
2022-11-30 16:36:49 +00:00
|
|
|
paramInfo.defaultValue = "typ";
|
|
|
|
paramInfo.description = _( "Parasitic pin inductance" );
|
2022-09-27 20:47:00 +00:00
|
|
|
paramInfo.spiceModelName = "";
|
2022-11-30 16:36:49 +00:00
|
|
|
paramInfo.enumValues = { "typ", "min", "max" };
|
2022-09-27 20:47:00 +00:00
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
paramInfo.name = "cpin";
|
|
|
|
paramInfo.type = SIM_VALUE::TYPE_STRING;
|
|
|
|
paramInfo.unit = "";
|
|
|
|
paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
|
2022-11-30 16:36:49 +00:00
|
|
|
paramInfo.defaultValue = "typ";
|
|
|
|
paramInfo.description = _( "Parasitic pin capacitance" );
|
2022-09-27 20:47:00 +00:00
|
|
|
paramInfo.spiceModelName = "";
|
2022-11-30 16:36:49 +00:00
|
|
|
paramInfo.enumValues = { "typ", "min", "max" };
|
2022-09-27 20:47:00 +00:00
|
|
|
paramInfos.push_back( paramInfo );
|
2022-10-29 07:45:45 +00:00
|
|
|
|
2022-09-30 12:29:44 +00:00
|
|
|
std::vector<PARAM::INFO> dc = makeDcWaveformParamInfos();
|
|
|
|
std::vector<PARAM::INFO> rect = makeRectWaveformParamInfos();
|
|
|
|
std::vector<PARAM::INFO> prbs = makePrbsWaveformParamInfos();
|
2022-09-27 20:47:00 +00:00
|
|
|
|
2022-09-30 12:29:44 +00:00
|
|
|
switch( aType )
|
|
|
|
{
|
|
|
|
case TYPE::KIBIS_DRIVER_DC:
|
|
|
|
for( const PARAM::INFO& param : makeDcWaveformParamInfos() )
|
|
|
|
paramInfos.push_back( param );
|
|
|
|
break;
|
2022-09-29 08:35:01 +00:00
|
|
|
|
2022-09-30 12:29:44 +00:00
|
|
|
case TYPE::KIBIS_DRIVER_RECT:
|
|
|
|
for( const PARAM::INFO& param : makeRectWaveformParamInfos() )
|
|
|
|
paramInfos.push_back( param );
|
|
|
|
break;
|
2022-09-27 20:47:00 +00:00
|
|
|
|
2022-09-30 12:29:44 +00:00
|
|
|
case TYPE::KIBIS_DRIVER_PRBS:
|
|
|
|
for( const PARAM::INFO& param : makePrbsWaveformParamInfos() )
|
|
|
|
paramInfos.push_back( param );
|
|
|
|
break;
|
2022-09-27 20:47:00 +00:00
|
|
|
|
2022-09-30 12:29:44 +00:00
|
|
|
default:
|
|
|
|
break;
|
2022-09-27 20:47:00 +00:00
|
|
|
}
|
|
|
|
|
2022-09-30 12:29:44 +00:00
|
|
|
return paramInfos;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_KIBIS::makeDcWaveformParamInfos()
|
|
|
|
{
|
|
|
|
std::vector<PARAM::INFO> paramInfos;
|
|
|
|
PARAM::INFO paramInfo;
|
|
|
|
|
|
|
|
paramInfo.name = "dc";
|
2022-09-29 08:35:01 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_STRING;
|
|
|
|
paramInfo.unit = "";
|
2022-09-27 20:47:00 +00:00
|
|
|
paramInfo.category = PARAM::CATEGORY::WAVEFORM;
|
2022-09-30 12:29:44 +00:00
|
|
|
paramInfo.defaultValue = "hi-Z";
|
|
|
|
paramInfo.description = _( "DC Value" );
|
|
|
|
paramInfo.enumValues = { "hi-Z", "low", "high" };
|
2022-09-27 20:47:00 +00:00
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2022-09-30 12:29:44 +00:00
|
|
|
return paramInfos;
|
|
|
|
}
|
2022-09-27 20:47:00 +00:00
|
|
|
|
2022-09-29 08:35:01 +00:00
|
|
|
|
2022-09-30 12:29:44 +00:00
|
|
|
std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_KIBIS::makeRectWaveformParamInfos()
|
|
|
|
{
|
|
|
|
std::vector<PARAM::INFO> paramInfos;
|
|
|
|
PARAM::INFO paramInfo;
|
|
|
|
|
|
|
|
paramInfo.name = "ton";
|
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
|
|
|
paramInfo.unit = "s";
|
|
|
|
paramInfo.category = PARAM::CATEGORY::WAVEFORM;
|
|
|
|
paramInfo.defaultValue = "";
|
|
|
|
paramInfo.description = _( "ON time" );
|
|
|
|
paramInfos.push_back( paramInfo );
|
2022-09-29 08:35:01 +00:00
|
|
|
|
2022-09-30 12:29:44 +00:00
|
|
|
paramInfo.name = "toff";
|
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
|
|
|
paramInfo.unit = "s";
|
|
|
|
paramInfo.category = PARAM::CATEGORY::WAVEFORM;
|
|
|
|
paramInfo.defaultValue = "";
|
|
|
|
paramInfo.description = _( "OFF time" );
|
|
|
|
paramInfos.push_back( paramInfo );
|
2022-09-27 20:47:00 +00:00
|
|
|
|
2022-11-30 16:36:49 +00:00
|
|
|
paramInfo.name = "td";
|
2022-09-30 12:29:44 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
|
|
|
paramInfo.unit = "s";
|
|
|
|
paramInfo.category = PARAM::CATEGORY::WAVEFORM;
|
|
|
|
paramInfo.defaultValue = "0";
|
|
|
|
paramInfo.description = _( "Delay" );
|
|
|
|
paramInfos.push_back( paramInfo );
|
2022-10-25 09:45:40 +00:00
|
|
|
|
2022-11-30 16:36:49 +00:00
|
|
|
paramInfo.name = "n";
|
2022-12-01 08:14:14 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_INT;
|
2022-10-25 09:45:40 +00:00
|
|
|
paramInfo.unit = "";
|
|
|
|
paramInfo.category = PARAM::CATEGORY::WAVEFORM;
|
|
|
|
paramInfo.defaultValue = "1";
|
2022-11-30 16:36:49 +00:00
|
|
|
paramInfo.description = _( "Number of cycles" );
|
2022-10-25 09:45:40 +00:00
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2022-09-27 20:47:00 +00:00
|
|
|
return paramInfos;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-09-30 12:29:44 +00:00
|
|
|
std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_KIBIS::makePrbsWaveformParamInfos()
|
|
|
|
{
|
|
|
|
std::vector<PARAM::INFO> paramInfos;
|
|
|
|
PARAM::INFO paramInfo;
|
2022-09-27 20:47:00 +00:00
|
|
|
|
2022-09-30 12:29:44 +00:00
|
|
|
paramInfo.name = "f0";
|
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
|
|
|
paramInfo.unit = "Hz";
|
|
|
|
paramInfo.category = PARAM::CATEGORY::WAVEFORM;
|
|
|
|
paramInfo.defaultValue = "";
|
|
|
|
paramInfo.description = _( "Bitrate" );
|
|
|
|
paramInfos.push_back( paramInfo );
|
2022-09-27 20:47:00 +00:00
|
|
|
|
2022-12-01 08:14:14 +00:00
|
|
|
paramInfo.name = "td";
|
2022-09-30 12:29:44 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-12-01 08:14:14 +00:00
|
|
|
paramInfo.unit = "s";
|
|
|
|
paramInfo.category = PARAM::CATEGORY::WAVEFORM;
|
2022-12-01 11:59:33 +00:00
|
|
|
paramInfo.defaultValue = "";
|
2022-12-01 08:14:14 +00:00
|
|
|
paramInfo.description = _( "Delay" );
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
paramInfo.name = "n";
|
|
|
|
paramInfo.type = SIM_VALUE::TYPE_INT;
|
2022-09-30 12:29:44 +00:00
|
|
|
paramInfo.unit = "";
|
|
|
|
paramInfo.category = PARAM::CATEGORY::WAVEFORM;
|
|
|
|
paramInfo.defaultValue = "";
|
|
|
|
paramInfo.description = _( "Number of bits" );
|
|
|
|
paramInfos.push_back( paramInfo );
|
2022-09-27 20:47:00 +00:00
|
|
|
|
2022-09-30 12:29:44 +00:00
|
|
|
return paramInfos;
|
|
|
|
}
|
2022-10-25 09:45:40 +00:00
|
|
|
|