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
33class REPORTER;
34
35
37{
38public:
40
41 std::string ModelName( const SPICE_ITEM& aItem ) const override;
42 std::string ModelLine( const SPICE_ITEM& aItem ) const override;
43 std::vector<std::string> CurrentNames( const SPICE_ITEM& aItem ) const override;
44
45 std::string IbisDevice( const SPICE_ITEM& aItem, const PROJECT& aProject,
46 const wxString& aCacheDir, REPORTER& aReporter ) const;
47
48protected:
49 std::vector<std::reference_wrapper<const SIM_MODEL::PARAM>> GetInstanceParams() const override;
50};
51
53{
54 friend class SIM_LIBRARY_KIBIS;
55
56public:
57 SIM_MODEL_KIBIS( TYPE aType );
58
59 // @brief Special copy constructor
60 // creates a a model with aType, but tries to match parameters from aSource.
61 SIM_MODEL_KIBIS( TYPE aType, const SIM_MODEL_KIBIS& aSource );
62
63 std::vector<std::pair<std::string, std::string>> GetIbisPins() const
64 {
66 }
67
68 std::vector<std::string> GetIbisModels() const { return m_ibisModels; };
69
70 std::string GetComponentName() const
71 {
73 }
74
75
76 const PARAM& GetParam( unsigned aParamIndex ) const override
77 {
78 return m_params.at( aParamIndex );
79 };
80
84 bool ChangePin( const SIM_LIBRARY_KIBIS& aLib, std::string aPinNumber );
85
86 void SetBaseModel( const SIM_MODEL& aBaseModel ) override;
87
88 void SwitchSingleEndedDiff( bool aDiff ) override;
89 bool CanDifferential() const { return m_enableDiff; } ;
91
92private:
93 bool requiresSpiceModelLine( const SPICE_ITEM& aItem ) const override { return true; }
94
95 static std::vector<PARAM::INFO> makeParamInfos( TYPE aType );
96 static std::vector<PARAM::INFO> makeDcWaveformParamInfos();
97 static std::vector<PARAM::INFO> makeRectWaveformParamInfos();
98 static std::vector<PARAM::INFO> makePrbsWaveformParamInfos();
99
101 std::vector<std::string> m_ibisModels;
102 std::vector<std::pair<std::string, std::string>> m_ibisPins;
103 std::string m_componentName;
104};
105
106#endif // SIM_MODEL_KIBIS_H
Container for project specific data.
Definition: project.h:62
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:71
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:540
std::string IbisDevice(const SPICE_ITEM &aItem, const PROJECT &aProject, const wxString &aCacheDir, REPORTER &aReporter) const
std::string ModelLine(const SPICE_ITEM &aItem) const override
std::vector< std::reference_wrapper< const SIM_MODEL::PARAM > > GetInstanceParams() const override
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