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
|
|
|
|
*/
|
|
|
|
|
2024-06-10 19:16:30 +00:00
|
|
|
#ifndef SIM_MODEL_IBIS_H
|
|
|
|
#define SIM_MODEL_IBIS_H
|
2022-09-27 20:47:00 +00:00
|
|
|
|
2022-10-25 09:45:40 +00:00
|
|
|
#include <sim/kibis/kibis.h>
|
2022-09-27 20:47:00 +00:00
|
|
|
#include <sim/sim_model.h>
|
|
|
|
#include <sim/spice_generator.h>
|
2022-10-08 00:59:44 +00:00
|
|
|
#include <project.h>
|
2022-09-27 20:47:00 +00:00
|
|
|
|
2024-06-10 19:16:30 +00:00
|
|
|
class SIM_LIBRARY_IBIS;
|
2024-05-18 22:44:12 +00:00
|
|
|
class REPORTER;
|
2022-09-27 20:47:00 +00:00
|
|
|
|
|
|
|
|
2024-06-10 19:16:30 +00:00
|
|
|
class SPICE_GENERATOR_IBIS : public SPICE_GENERATOR
|
2022-09-27 20:47:00 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
using SPICE_GENERATOR::SPICE_GENERATOR;
|
|
|
|
|
2022-10-10 23:23:00 +00:00
|
|
|
std::string ModelName( const SPICE_ITEM& aItem ) const override;
|
|
|
|
std::string ModelLine( const SPICE_ITEM& aItem ) const override;
|
|
|
|
std::vector<std::string> CurrentNames( const SPICE_ITEM& aItem ) const override;
|
2022-09-27 20:47:00 +00:00
|
|
|
|
2022-12-07 15:02:35 +00:00
|
|
|
std::string IbisDevice( const SPICE_ITEM& aItem, const PROJECT& aProject,
|
2024-05-18 22:44:12 +00:00
|
|
|
const wxString& aCacheDir, REPORTER& aReporter ) const;
|
2022-10-09 18:44:03 +00:00
|
|
|
|
2022-09-27 20:47:00 +00:00
|
|
|
protected:
|
|
|
|
std::vector<std::reference_wrapper<const SIM_MODEL::PARAM>> GetInstanceParams() const override;
|
|
|
|
};
|
|
|
|
|
2024-06-10 19:16:30 +00:00
|
|
|
class SIM_MODEL_IBIS : public SIM_MODEL
|
2022-09-27 20:47:00 +00:00
|
|
|
{
|
2024-06-10 19:16:30 +00:00
|
|
|
friend class SIM_LIBRARY_IBIS;
|
2022-09-27 20:47:00 +00:00
|
|
|
|
|
|
|
public:
|
2024-06-10 19:16:30 +00:00
|
|
|
SIM_MODEL_IBIS( TYPE aType );
|
2022-09-27 20:47:00 +00:00
|
|
|
|
|
|
|
// @brief Special copy constructor
|
|
|
|
// creates a a model with aType, but tries to match parameters from aSource.
|
2024-06-10 19:16:30 +00:00
|
|
|
SIM_MODEL_IBIS( TYPE aType, const SIM_MODEL_IBIS& aSource );
|
2022-09-27 20:47:00 +00:00
|
|
|
|
|
|
|
std::vector<std::pair<std::string, std::string>> GetIbisPins() const
|
|
|
|
{
|
2022-10-11 00:22:36 +00:00
|
|
|
return m_sourceModel ? m_sourceModel->GetIbisPins() : m_ibisPins;
|
|
|
|
}
|
2022-09-27 20:47:00 +00:00
|
|
|
|
|
|
|
std::vector<std::string> GetIbisModels() const { return m_ibisModels; };
|
|
|
|
|
|
|
|
std::string GetComponentName() const
|
|
|
|
{
|
2022-10-11 00:22:36 +00:00
|
|
|
return m_sourceModel ? m_sourceModel->GetComponentName() : m_componentName;
|
|
|
|
}
|
2022-09-27 20:47:00 +00:00
|
|
|
|
2022-09-29 08:35:01 +00:00
|
|
|
|
2022-10-26 18:39:44 +00:00
|
|
|
const PARAM& GetParam( unsigned aParamIndex ) const override
|
|
|
|
{
|
|
|
|
return m_params.at( aParamIndex );
|
|
|
|
};
|
2022-09-29 08:35:01 +00:00
|
|
|
|
2022-11-30 16:36:49 +00:00
|
|
|
/**
|
|
|
|
* @brief update the list of available models based on the pin number.
|
|
|
|
*/
|
2024-06-10 19:16:30 +00:00
|
|
|
bool ChangePin( const SIM_LIBRARY_IBIS& aLib, std::string aPinNumber );
|
2022-09-27 20:47:00 +00:00
|
|
|
|
2022-10-08 00:59:44 +00:00
|
|
|
void SetBaseModel( const SIM_MODEL& aBaseModel ) override;
|
|
|
|
|
2022-12-17 15:21:35 +00:00
|
|
|
void SwitchSingleEndedDiff( bool aDiff ) override;
|
2022-11-12 14:39:36 +00:00
|
|
|
bool CanDifferential() const { return m_enableDiff; } ;
|
2022-10-25 09:45:40 +00:00
|
|
|
bool m_enableDiff;
|
|
|
|
|
2022-09-27 20:47:00 +00:00
|
|
|
private:
|
2023-02-25 15:21:08 +00:00
|
|
|
bool requiresSpiceModelLine( const SPICE_ITEM& aItem ) const override { return true; }
|
2022-09-27 20:47:00 +00:00
|
|
|
|
2022-09-30 12:29:44 +00:00
|
|
|
static std::vector<PARAM::INFO> makeParamInfos( TYPE aType );
|
|
|
|
static std::vector<PARAM::INFO> makeDcWaveformParamInfos();
|
|
|
|
static std::vector<PARAM::INFO> makeRectWaveformParamInfos();
|
|
|
|
static std::vector<PARAM::INFO> makePrbsWaveformParamInfos();
|
|
|
|
|
2024-06-10 19:16:30 +00:00
|
|
|
const SIM_MODEL_IBIS* m_sourceModel;
|
2022-10-08 00:59:44 +00:00
|
|
|
std::vector<std::string> m_ibisModels;
|
|
|
|
std::vector<std::pair<std::string, std::string>> m_ibisPins;
|
|
|
|
std::string m_componentName;
|
2022-09-27 20:47:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SIM_MODEL_KIBIS_H
|