KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sim_model_kibis.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 3
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * https://www.gnu.org/licenses/gpl-3.0.html
19 * or you may search the http://www.gnu.org website for the version 3 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#ifndef SIM_MODEL_KIBIS_H
25#define SIM_MODEL_KIBIS_H
26
27#include <sim/kibis/kibis.h>
28#include <sim/sim_model.h>
29#include <sim/spice_generator.h>
30#include <project.h>
31
33
34
36{
37public:
39
40 std::string ModelName( const SPICE_ITEM& aItem ) const override;
41 std::string ModelLine( const SPICE_ITEM& aItem ) const override;
42 std::vector<std::string> CurrentNames( const SPICE_ITEM& aItem ) const override;
43
44 std::string IbisDevice( const SPICE_ITEM& aItem, const PROJECT& aProject,
45 const wxString& aCacheDir ) const;
46
47protected:
48 std::vector<std::reference_wrapper<const SIM_MODEL::PARAM>> GetInstanceParams() const override;
49};
50
52{
53 friend class SIM_LIBRARY_KIBIS;
54
55public:
56 SIM_MODEL_KIBIS( TYPE aType );
57
58 // @brief Special copy constructor
59 // creates a a model with aType, but tries to match parameters from aSource.
60 SIM_MODEL_KIBIS( TYPE aType, const SIM_MODEL_KIBIS& aSource );
61
62 std::vector<std::pair<std::string, std::string>> GetIbisPins() const
63 {
65 }
66
67 std::vector<std::string> GetIbisModels() const { return m_ibisModels; };
68
69 std::string GetComponentName() const
70 {
72 }
73
74
75 const PARAM& GetParam( unsigned aParamIndex ) const override
76 {
77 return m_params.at( aParamIndex );
78 };
79
83 bool ChangePin( const SIM_LIBRARY_KIBIS& aLib, std::string aPinNumber );
84
85 void SetBaseModel( const SIM_MODEL& aBaseModel ) override;
86
87 void SwitchSingleEndedDiff( bool aDiff ) override;
88 bool CanDifferential() const { return m_enableDiff; } ;
90
91private:
92 bool requiresSpiceModelLine( const SPICE_ITEM& aItem ) const override { return true; }
93
94 static std::vector<PARAM::INFO> makeParamInfos( TYPE aType );
95 static std::vector<PARAM::INFO> makeDcWaveformParamInfos();
96 static std::vector<PARAM::INFO> makeRectWaveformParamInfos();
97 static std::vector<PARAM::INFO> makePrbsWaveformParamInfos();
98
100 std::vector<std::string> m_ibisModels;
101 std::vector<std::pair<std::string, std::string>> m_ibisPins;
102 std::string m_componentName;
103};
104
105#endif // SIM_MODEL_KIBIS_H
Container for project specific data.
Definition: project.h:62
bool ChangePin(const SIM_LIBRARY_KIBIS &aLib, std::string aPinNumber)
update the list of available models based on the pin number.
void SetBaseModel(const SIM_MODEL &aBaseModel) override
const SIM_MODEL_KIBIS * m_sourceModel
static std::vector< PARAM::INFO > makeRectWaveformParamInfos()
std::vector< std::string > GetIbisModels() const
static std::vector< PARAM::INFO > makeParamInfos(TYPE aType)
static std::vector< PARAM::INFO > makePrbsWaveformParamInfos()
std::string m_componentName
const PARAM & GetParam(unsigned aParamIndex) const override
std::vector< std::pair< std::string, std::string > > m_ibisPins
static std::vector< PARAM::INFO > makeDcWaveformParamInfos()
std::vector< std::string > m_ibisModels
bool requiresSpiceModelLine(const SPICE_ITEM &aItem) const override
std::string GetComponentName() const
bool CanDifferential() const
void SwitchSingleEndedDiff(bool aDiff) override
std::vector< std::pair< std::string, std::string > > GetIbisPins() const
std::vector< PARAM > m_params
Definition: sim_model.h:541
std::string ModelLine(const SPICE_ITEM &aItem) const override
std::vector< std::reference_wrapper< const SIM_MODEL::PARAM > > GetInstanceParams() const override
std::string IbisDevice(const SPICE_ITEM &aItem, const PROJECT &aProject, const wxString &aCacheDir) const
std::string ModelName(const SPICE_ITEM &aItem) const override
std::vector< std::string > CurrentNames(const SPICE_ITEM &aItem) const override
SPICE_GENERATOR(const SIM_MODEL &aModel)
SIM_MODEL::TYPE TYPE
Definition: sim_model.cpp:53