KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sim_model_ibis.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_IBIS_H
25#define SIM_MODEL_IBIS_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};
48
50{
51 friend class SIM_LIBRARY_IBIS;
52
53public:
54 SIM_MODEL_IBIS( TYPE aType );
55
56 // @brief Special copy constructor
57 // creates a a model with aType, but tries to match parameters from aSource.
58 SIM_MODEL_IBIS( TYPE aType, const SIM_MODEL_IBIS& aSource );
59
60 std::vector<std::pair<std::string, std::string>> GetIbisPins() const
61 {
63 }
64
65 std::vector<std::string> GetIbisModels() const { return m_ibisModels; };
66
67 std::string GetComponentName() const
68 {
70 }
71
72
73 const PARAM& GetParam( unsigned aParamIndex ) const override
74 {
75 return m_params.at( aParamIndex );
76 };
77
81 bool ChangePin( const SIM_LIBRARY_IBIS& aLib, const std::string& aPinNumber );
82
83 void SetBaseModel( const SIM_MODEL& aBaseModel ) override;
84
85 void SwitchSingleEndedDiff( bool aDiff ) override;
86 bool CanDifferential() const { return m_enableDiff; } ;
88
89private:
90 bool requiresSpiceModelLine( const SPICE_ITEM& aItem ) const override { return true; }
91
92 static std::vector<PARAM::INFO> makeParamInfos( TYPE aType );
93 static std::vector<PARAM::INFO> makeDcWaveformParamInfos();
94 static std::vector<PARAM::INFO> makeRectWaveformParamInfos();
95 static std::vector<PARAM::INFO> makePrbsWaveformParamInfos();
96
98 std::vector<std::string> m_ibisModels;
99 std::vector<std::pair<std::string, std::string>> m_ibisPins;
100 std::string m_componentName;
101};
102
103#endif // SIM_MODEL_KIBIS_H
Container for project specific data.
Definition: project.h:64
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:72
static std::vector< PARAM::INFO > makeDcWaveformParamInfos()
std::vector< std::pair< std::string, std::string > > m_ibisPins
std::vector< std::string > m_ibisModels
static std::vector< PARAM::INFO > makeRectWaveformParamInfos()
const PARAM & GetParam(unsigned aParamIndex) const override
static std::vector< PARAM::INFO > makePrbsWaveformParamInfos()
std::vector< std::pair< std::string, std::string > > GetIbisPins() const
void SwitchSingleEndedDiff(bool aDiff) override
const SIM_MODEL_IBIS * m_sourceModel
bool CanDifferential() const
std::vector< std::string > GetIbisModels() const
std::string m_componentName
void SetBaseModel(const SIM_MODEL &aBaseModel) override
bool ChangePin(const SIM_LIBRARY_IBIS &aLib, const std::string &aPinNumber)
update the list of available models based on the pin number.
static std::vector< PARAM::INFO > makeParamInfos(TYPE aType)
bool requiresSpiceModelLine(const SPICE_ITEM &aItem) const override
std::string GetComponentName() const
std::vector< PARAM > m_params
Definition: sim_model.h:538
std::vector< std::string > CurrentNames(const SPICE_ITEM &aItem) const override
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::string ModelName(const SPICE_ITEM &aItem) const override
SPICE_GENERATOR(const SIM_MODEL &aModel)
SIM_MODEL::TYPE TYPE
Definition: sim_model.cpp:57