ADDED: Read IBIS files

This commit is contained in:
Fabien Corona 2022-06-09 18:30:51 +00:00 committed by Seth Hillbrand
parent ac0f95683f
commit 0d35d69f70
15 changed files with 5933 additions and 0 deletions

View File

@ -96,6 +96,10 @@ option( KICAD_SANITIZE_THREADS
"Build KiCad with sanitizer options. WARNING: Not compatible with gold linker" "Build KiCad with sanitizer options. WARNING: Not compatible with gold linker"
OFF ) OFF )
option( KICAD_SIGNAL_INTEGRITY
"Build tools for signal integrity analysis ( default ON )"
ON )
option( KICAD_STDLIB_DEBUG option( KICAD_STDLIB_DEBUG
"Build KiCad with libstdc++ debug flags enabled." "Build KiCad with libstdc++ debug flags enabled."
OFF ) OFF )
@ -510,6 +514,11 @@ if( KICAD_USE_OCC )
add_definitions( -DKICAD_USE_OCC ) add_definitions( -DKICAD_USE_OCC )
endif() endif()
if( KICAD_SIGNAL_INTEGRITY )
add_definitions( -DKICAD_SIGNAL_INTEGRITY )
endif()
if( KICAD_USE_EGL AND UNIX AND NOT APPLE ) if( KICAD_USE_EGL AND UNIX AND NOT APPLE )
message( STATUS "Configuring KiCad for the wxGLCanvas EGL backend" ) message( STATUS "Configuring KiCad for the wxGLCanvas EGL backend" )
add_definitions( -DKICAD_USE_EGL ) add_definitions( -DKICAD_USE_EGL )

25
LICENSE.3-CLAUSE-BSD Normal file
View File

@ -0,0 +1,25 @@
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.

View File

@ -34,5 +34,7 @@ Licensed in the public domain:
- lemon in thirdparty/lemon - lemon in thirdparty/lemon
Licensed under CC BY-SA 4.0: Licensed under CC BY-SA 4.0:
- All the demo files provided in demos/* - All the demo files provided in demos/*
Licensed under clause-3 BSD:
- ibis / kibis files in pcbnew/signalIntegrity
Licensed under GPLv3 (or later): Licensed under GPLv3 (or later):
- All remaining code not listed above - All remaining code not listed above

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,765 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2022 Fabien Corona f.corona<at>laposte.net
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef IBIS_PARSER_H
#define IBIS_PARSER_H
#define _( x ) x
#define NAN_NA "1"
#define NAN_INVALID "0"
#define IBIS_MAX_VERSION 7.0 // Up to v7.0, IBIS is fully backward compatible
#define IBIS_MAX_LINE_LENGTH 2048 // official limit is 1024
#include <wx/string.h>
#include <reporter.h>
//#include "common.h"
#include <iostream>
#include <fstream>
#include <vector>
#include <math.h>
#include <cstring>
class IBIS_REPORTER
{
public:
/** @brief Print a message
*
* In the future, this function could do more than just printing a message.
* All KIBIS messages are concentrated at a single point in the code.
*
* @param aMsg Message
* @param aSeverity Message sevirity
*/
void Report( std::string aMsg, SEVERITY aSeverity ) { std::cout << aMsg << std::endl; };
};
class IBIS_ANY
{
public:
IBIS_ANY( IBIS_REPORTER* aReporter ) { m_reporter = aReporter; };
IBIS_REPORTER* m_reporter;
/** @brief Print a message
*
* Call m_reporter->Report if m_reporter exists.
*
* @param aMsg Message
* @param aSeverity Message sevirity
*/
void Report( std::string aMsg, SEVERITY aSeverity = RPT_SEVERITY_INFO )
{
if( m_reporter )
{
m_reporter->Report( aMsg, aSeverity );
}
};
protected:
/** @brief Convert a double to string using scientific notation
*
* @param aNumber Number
* @return Output string
*/
std::string doubleToString( double aNumber );
};
class IBIS_INPUT : public IBIS_ANY
{
public:
IBIS_INPUT( IBIS_REPORTER* aReporter ) : IBIS_ANY( aReporter ){};
/** @brief Check if the data held by the object is valid.
*
* @return true in case of success
*/
bool virtual Check() { return false; };
};
enum IBIS_CORNER
{
TYP = 0,
MIN,
MAX
};
enum class IBIS_MATRIX_TYPE
{
// All matrices are supposed to be symmetrical, only upper right triangle is given
UNDEFINED,
BANDED, // Give the main diagonal + [bandwith] elements on the right
SPARSE, // Only give non-zero values.
FULL, // Give the whole upper triangle.
};
class IBIS_MATRIX : public IBIS_INPUT
{
public:
IBIS_MATRIX( IBIS_REPORTER* aReporter ) : IBIS_INPUT( aReporter ){};
IBIS_MATRIX_TYPE m_type = IBIS_MATRIX_TYPE::UNDEFINED;
int m_dim = -5;
std::vector<double> m_data;
};
class IBIS_MATRIX_BANDED : public IBIS_MATRIX
{
public:
IBIS_MATRIX_BANDED( IBIS_REPORTER* aReporter ) : IBIS_MATRIX( aReporter ){};
IBIS_MATRIX_TYPE m_type = IBIS_MATRIX_TYPE::BANDED;
int m_dim = -2;
int m_bandwidth = 0;
std::vector<double> m_data;
bool Check() override;
};
class IBIS_MATRIX_SPARSE : public IBIS_MATRIX
{
public:
IBIS_MATRIX_SPARSE( IBIS_REPORTER* aReporter ) : IBIS_MATRIX( aReporter ){};
IBIS_MATRIX_TYPE m_type = IBIS_MATRIX_TYPE::BANDED;
int m_dim = -3;
std::vector<double> m_data;
bool Check() override;
};
class IBIS_MATRIX_FULL : public IBIS_MATRIX
{
public:
IBIS_MATRIX_FULL( IBIS_REPORTER* aReporter ) : IBIS_MATRIX( aReporter ){};
IBIS_MATRIX_TYPE m_type = IBIS_MATRIX_TYPE::FULL;
int m_dim = -4;
std::vector<double> m_data;
bool Check() override;
};
class IBIS_SECTION : public IBIS_INPUT
{
public:
IBIS_SECTION( IBIS_REPORTER* aReporter ) : IBIS_INPUT( aReporter ){};
};
class IbisHeader : IBIS_SECTION
{
public:
IbisHeader( IBIS_REPORTER* aReporter ) : IBIS_SECTION( aReporter ){};
double m_ibisVersion = -1;
double m_fileRevision = -1;
std::string m_fileName;
std::string m_source;
std::string m_date;
std::string m_notes;
std::string m_disclaimer;
std::string m_copyright;
bool Check() override;
};
class TypMinMaxValue : public IBIS_INPUT
{
public:
TypMinMaxValue( IBIS_REPORTER* aReporter ) : IBIS_INPUT( aReporter ){};
double value[3];
bool Check() override;
};
class IbisComponentPackage : public IBIS_INPUT
{
public:
IbisComponentPackage( IBIS_REPORTER* aReporter ) : IBIS_INPUT( aReporter )
{
m_Rpkg = new TypMinMaxValue( m_reporter );
m_Lpkg = new TypMinMaxValue( m_reporter );
m_Cpkg = new TypMinMaxValue( m_reporter );
};
TypMinMaxValue* m_Rpkg;
TypMinMaxValue* m_Lpkg;
TypMinMaxValue* m_Cpkg;
bool Check() override;
};
class IbisComponentPin : public IBIS_INPUT
{
public:
IbisComponentPin( IBIS_REPORTER* aReporter ) : IBIS_INPUT( aReporter ){};
std::string m_pinName;
std::string m_signalName;
std::string m_modelName;
double m_Rpin = std::nan( NAN_NA );
double m_Lpin = std::nan( NAN_NA );
double m_Cpin = std::nan( NAN_NA );
int m_Rcol = 0;
int m_Lcol = 0;
int m_Ccol = 0;
bool Check() override;
bool m_dummy = false;
};
class IbisComponentPinMapping : public IBIS_INPUT
{
public:
IbisComponentPinMapping( IBIS_REPORTER* aReporter ) : IBIS_INPUT( aReporter ){};
std::string m_pinName;
std::string m_PDref;
std::string m_PUref;
std::string m_GNDClampRef;
std::string m_POWERClampRef;
std::string m_extRef;
bool m_virtual;
};
class IbisDiffPinEntry : public IBIS_INPUT
{
public:
IbisDiffPinEntry( IBIS_REPORTER* aReporter ) : IBIS_INPUT( aReporter )
{
tdelay = new TypMinMaxValue( aReporter );
};
std::string pinA;
std::string pinB;
double Vdiff = 0.2; // ignored for input
TypMinMaxValue* tdelay; // ignored for outputs
};
class IbisDiffPin : IBIS_INPUT
{
public:
IbisDiffPin( IBIS_REPORTER* aReporter ) : IBIS_INPUT( aReporter ){};
std::vector<IbisDiffPinEntry> m_entries;
};
class IbisComponent : public IBIS_INPUT
{
public:
IbisComponent( IBIS_REPORTER* aReporter ) : IBIS_INPUT( aReporter ), m_package( aReporter )
{
m_diffPin = new IbisDiffPin( m_reporter );
};
std::string m_name = "";
std::string m_manufacturer = "";
IbisComponentPackage m_package;
std::vector<IbisComponentPin> m_pins;
std::vector<IbisComponentPinMapping> m_pinMappings;
std::string m_packageModel;
std::string m_busLabel;
std::string m_dieSupplyPads;
IbisDiffPin* m_diffPin;
bool Check() override;
};
class IbisModelSelectorEntry
{
public:
std::string m_modelName;
std::string m_modelDescription;
};
class IbisModelSelector : public IBIS_INPUT
{
public:
IbisModelSelector( IBIS_REPORTER* aReporter ) : IBIS_INPUT( aReporter ){};
std::string m_name;
std::vector<IbisModelSelectorEntry> m_models;
bool Check() override;
};
class IVtableEntry : public IBIS_INPUT
{
public:
IVtableEntry( IBIS_REPORTER* aReporter ) : IBIS_INPUT( aReporter )
{
I = new TypMinMaxValue( m_reporter );
};
double V;
TypMinMaxValue* I;
};
class IVtable : public IBIS_INPUT
{
public:
IVtable( IBIS_REPORTER* aReporter ) : IBIS_INPUT( aReporter ){};
std::vector<IVtableEntry> m_entries;
bool Check() override;
/** @brief Interpolate the IV table
*
* Linear interpolation to find the current for voltage aV
*
* @param aV voltage
* @param aCorner Power supply corner
* @return current
*/
double InterpolatedI( double aV, IBIS_CORNER aCorner );
/** @brief Interpolate the IV table
*
* Generate the spice directive needed to define a model defined by its IV table.
* The order of aPort1 and aPort2 is important. ( Inverting them will reverse the component )
*
* @param aN Index of the 'a' device
* @param aPort1 Spice node
* @param aPort2 Spice node
* @param aPort2 Name of the generated model
* @param aCorner Power supply corner
* @return Multline spice directives
*/
std::string Spice( int aN, std::string aPort1, std::string aPort2, std::string aModelName,
IBIS_CORNER aCorner );
private:
};
class VTtableEntry : public IBIS_INPUT
{
public:
VTtableEntry( IBIS_REPORTER* aReporter ) : IBIS_INPUT( aReporter )
{
V = new TypMinMaxValue( m_reporter );
};
double t;
TypMinMaxValue* V;
};
class VTtable : public IBIS_INPUT
{
public:
VTtable( IBIS_REPORTER* aReporter ) : IBIS_INPUT( aReporter ){};
std::vector<VTtableEntry> m_entries;
};
/*
Model_type must be one of the following:
Input, Output, I/O, 3-state, Open_drain, I/O_open_drain, Open_sink, I/O_open_sink,
Open_source, I/O_open_source, Input_ECL, Output_ECL, I/O_ECL, 3-state_ECL, Terminator,
Series, and Series_switch.
*/
enum class IBIS_MODEL_TYPE
{
UNDEFINED,
INPUT,
OUTPUT,
IO,
THREE_STATE,
OPEN_DRAIN,
IO_OPEN_DRAIN,
OPEN_SINK,
IO_OPEN_SINK,
OPEN_SOURCE,
IO_OPEN_SOURCE,
INPUT_ECL,
OUTPUT_ECL,
IO_ECL,
THREE_STATE_ECL,
TERMINATOR,
SERIES,
SERIES_SWITCH
};
enum class IBIS_MODEL_ENABLE
{
UNDEFINED,
ACTIVE_HIGH,
ACTIVE_LOW
};
class dvdt
{
public:
double m_dv;
double m_dt;
};
class dvdtTypMinMax : public IBIS_INPUT
{
public:
dvdtTypMinMax( IBIS_REPORTER* aReporter ) : IBIS_INPUT( aReporter ){};
dvdt value[3];
bool Check() override;
};
class IbisRamp : public IBIS_INPUT
{
public:
IbisRamp( IBIS_REPORTER* aReporter ) : IBIS_INPUT( aReporter )
{
m_falling = new dvdtTypMinMax( m_reporter );
m_rising = new dvdtTypMinMax( m_reporter );
};
dvdtTypMinMax* m_falling;
dvdtTypMinMax* m_rising;
double m_Rload = 50; // The R_load subparameter is optional if the default 50 ohm load is used
bool Check() override;
};
enum class IBIS_WAVEFORM_TYPE
{
RISING,
FALLING
};
class IbisWaveform : public IBIS_INPUT
{
public:
IbisWaveform( IBIS_REPORTER* aReporter ) : IBIS_INPUT( aReporter )
{
m_table = new VTtable( m_reporter );
};
VTtable* m_table;
IBIS_WAVEFORM_TYPE m_type;
double m_R_dut;
double m_C_dut;
double m_L_dut;
double m_R_fixture = 0;
double m_C_fixture = 0;
double m_L_fixture = 0;
double m_V_fixture = 0;
double m_V_fixture_min = 0;
double m_V_fixture_max = 0;
};
enum class IBIS_MODEL_POLARITY
{
UNDEFINED,
INVERTING,
NON_INVERTING
};
class IbisModel : IBIS_INPUT
{
public:
IbisModel( IBIS_REPORTER* aReporter ) : IBIS_INPUT( aReporter )
{
m_C_comp = new TypMinMaxValue( m_reporter );
m_voltageRange = new TypMinMaxValue( m_reporter );
m_temperatureRange = new TypMinMaxValue( m_reporter );
m_pullupReference = new TypMinMaxValue( m_reporter );
m_pulldownReference = new TypMinMaxValue( m_reporter );
m_GNDClampReference = new TypMinMaxValue( m_reporter );
m_POWERClampReference = new TypMinMaxValue( m_reporter );
m_Rgnd = new TypMinMaxValue( m_reporter );
m_Rpower = new TypMinMaxValue( m_reporter );
m_Rac = new TypMinMaxValue( m_reporter );
m_Cac = new TypMinMaxValue( m_reporter );
m_GNDClamp = new IVtable( m_reporter );
m_POWERClamp = new IVtable( m_reporter );
m_pullup = new IVtable( m_reporter );
m_pulldown = new IVtable( m_reporter );
m_ramp = new IbisRamp( m_reporter );
};
std::string m_name;
IBIS_MODEL_TYPE m_type = IBIS_MODEL_TYPE::UNDEFINED;
/* The Polarity, Enable, Vinl, Vinh, Vmeas, Cref, Rref, and Vref subparameters are optional. */
/* the default values of Vinl = 0.8 V and Vinh = 2.0 V are assumed. */
double m_vinl = 0.8;
double m_vinh = 2;
double m_vref = 0;
double m_rref = 0;
double m_cref = 0;
double m_vmeas = 0;
IBIS_MODEL_ENABLE m_enable = IBIS_MODEL_ENABLE::UNDEFINED;
IBIS_MODEL_POLARITY m_polarity = IBIS_MODEL_POLARITY::UNDEFINED;
// End of optional subparameters
TypMinMaxValue* m_C_comp;
TypMinMaxValue* m_voltageRange;
TypMinMaxValue* m_temperatureRange;
TypMinMaxValue* m_pullupReference;
TypMinMaxValue* m_pulldownReference;
TypMinMaxValue* m_GNDClampReference;
TypMinMaxValue* m_POWERClampReference;
TypMinMaxValue* m_Rgnd;
TypMinMaxValue* m_Rpower;
TypMinMaxValue* m_Rac;
TypMinMaxValue* m_Cac;
IVtable* m_GNDClamp;
IVtable* m_POWERClamp;
IVtable* m_pullup;
IVtable* m_pulldown;
std::vector<IbisWaveform*> m_risingWaveforms;
std::vector<IbisWaveform*> m_fallingWaveforms;
IbisRamp* m_ramp;
bool Check() override;
};
class IbisPackageModel : public IBIS_INPUT
{
public:
IbisPackageModel( IBIS_REPORTER* aReporter ) : IBIS_INPUT( aReporter ){};
std::string m_name;
std::string m_manufacturer;
std::string m_OEM;
std::string m_description;
int m_numberOfPins;
std::vector<std::string> m_pins;
std::shared_ptr<IBIS_MATRIX> m_resistanceMatrix;
std::shared_ptr<IBIS_MATRIX> m_capacitanceMatrix;
std::shared_ptr<IBIS_MATRIX> m_inductanceMatrix;
bool Check() override;
};
class IbisFile : public IBIS_INPUT
{
public:
IbisFile( IBIS_REPORTER* aReporter ) : IBIS_INPUT( aReporter )
{
m_header = new IbisHeader( m_reporter );
};
IbisHeader* m_header;
std::vector<IbisComponent> m_components;
std::vector<IbisModelSelector> m_modelSelectors;
std::vector<IbisModel> m_models;
std::vector<IbisPackageModel> m_packageModels;
};
enum class IBIS_PARSER_CONTINUE
{
NONE,
STRING,
COMPONENT_PACKAGE,
COMPONENT_PINMAPPING,
COMPONENT_DIFFPIN,
COMPONENT_DIESUPPLYPADS,
COMPONENT_PIN,
MATRIX,
MODELSELECTOR,
MODEL,
IV_TABLE,
VT_TABLE,
RAMP,
WAVEFORM,
PACKAGEMODEL_PINS
};
enum class IBIS_PARSER_CONTEXT
{
HEADER,
COMPONENT,
MODELSELECTOR,
MODEL,
PACKAGEMODEL,
PACKAGEMODEL_MODELDATA,
END
};
class IbisParser : public IBIS_INPUT
{
public:
IbisParser( IBIS_REPORTER* aReporter ) : IBIS_INPUT( aReporter ), m_ibisFile( aReporter ){};
bool m_parrot = true; // Write back all lines.
long m_lineCounter;
char m_commentChar = '|';
std::vector<char> m_buffer;
int m_bufferIndex;
int m_lineOffset;
int m_lineIndex;
int m_lineLength;
IbisFile m_ibisFile;
IbisComponent* m_currentComponent;
IbisModelSelector* m_currentModelSelector;
IbisModel* m_currentModel;
IbisPackageModel* m_currentPackageModel;
std::shared_ptr<IBIS_MATRIX> m_currentMatrix;
int m_currentMatrixRow;
int m_currentMatrixRowIndex;
IVtable* m_currentIVtable;
VTtable* m_currentVTtable;
IbisWaveform* m_currentWaveform;
/** @brief Parse a file
*
* This is the entry point to parse a file
*
* @param aFileName input file name
* @return True in case of success
*/
bool ParseFile( std::string& aFileName );
private:
std::string* m_continuingString;
/** @brief compare two strings without being case sensitive
*
* Ibis: "The content of the files is case sensitive, except for reserved words and keywords."
*
* @param a string to compare
* @param b string to compare
* @return true if the string are equal
*/
bool compareIbisWord( const std::string& a, const std::string& b );
/** @brief Parse a single keyword in the header context
*
* @param aKeyword Keyword
* @return True in case of success
*/
bool parseHeader( std::string& aKeyword );
/** @brief Parse a single keyword in the component context
*
* @param aKeyword Keyword
* @return True in case of success
*/
bool parseComponent( std::string& aKeyword );
/** @brief Parse a single keyword in the component context
*
* @param aKeyword Keyword
* @return True in case of success
*/
bool parseModelSelector( std::string& aKeyword );
/** @brief Parse a single keyword in the model selector context
*
* @param aKeyword Keyword
* @return True in case of success
*/
bool parseModel( std::string& aKeyword );
/** @brief Parse a single keyword in the model context
*
* @param aKeyword Keyword
* @return True in case of success
*/
bool parsePackageModel( std::string& aKeyword );
/** @brief Parse a single keyword in the package model context
*
* @param aKeyword Keyword
* @return True in case of success
*/
bool parsePackageModelModelData( std::string& );
/** @brief Parse a double according to the ibis standard
*
* @param aDest Where the double should be stored
* @param aStr The string to parse
* @param aAllowModifiers Allows modifiers ( p for pico, f for femto, k for kilo, ... )
* @return True in case of success
*/
bool parseDouble( double& aDest, std::string& aStr, bool aAllowModifiers = false );
/** @brief Parse the current line
*
* @return True in case of success
*/
bool onNewLine(); // Gets rid of comments ( except on a comment character change command...)
/** @brief Load the next line
*
* @return True in case of success
*/
bool getNextLine();
/** @brief Print the current line */
void printLine();
void skipWhitespaces();
bool checkEndofLine(); // To be used when there cannot be any character left on the line
bool isLineEmptyFromCursor();
std::string getKeyword();
bool readInt( int& aDest );
bool readDouble( double& aDest );
bool readWord( std::string& aDest );
bool readDvdt( std::string& aString, dvdt& aDest );
bool readMatrix( std::shared_ptr<IBIS_MATRIX> aDest );
bool readMatrixBanded( std::string, IBIS_MATRIX_BANDED& aDest );
bool readMatrixFull( std::string, IBIS_MATRIX_FULL& aDest );
bool readMatrixSparse( std::string, IBIS_MATRIX_SPARSE& aDest );
bool readRampdvdt( dvdtTypMinMax& aDest );
bool readRamp();
bool readWaveform( IbisWaveform* aDest, IBIS_WAVEFORM_TYPE aType );
bool readString( std::string& aDest );
bool storeString( std::string& aDest, bool aMultiline );
bool readTableLine( std::vector<std::string>& aDest );
bool readNumericSubparam( std::string aSubparam, double& aDest );
bool readIVtableEntry( IVtable& aTable );
bool readVTtableEntry( VTtable& aTable );
bool readTypMinMaxValue( TypMinMaxValue& aDest );
bool readTypMinMaxValueSubparam( std::string aSubparam, TypMinMaxValue& aDest );
//bool ReadDieSupplyPads();
bool readPackage();
bool readPin();
bool readPinMapping();
bool readDiffPin();
bool readModelSelector();
bool readModel();
bool readPackageModelPins();
/** @brief Ibis can change the character used for comments */
bool changeCommentChar();
bool changeContext( std::string& aKeyword );
IBIS_PARSER_CONTINUE m_continue = IBIS_PARSER_CONTINUE::NONE;
IBIS_PARSER_CONTEXT m_context = IBIS_PARSER_CONTEXT::HEADER;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,376 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2022 Fabien Corona f.corona<at>laposte.net
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef KIBIS_H
#define KIBIS_H
#include "ibisParser.h"
class KIBIS_PIN;
class KIBIS_FILE;
class KIBIS_MODEL;
class KIBIS_COMPONENT;
class KIBIS;
class KIBIS_ANY : public IBIS_ANY
{
public:
KIBIS_ANY( KIBIS* aTopLevel );
KIBIS* m_topLevel;
bool m_valid;
};
enum KIBIS_WAVEFORM_TYPE
{
NONE = 0, // Used for three state
RECTANGULAR,
STUCK_HIGH,
STUCK_LOW,
HIGH_Z
};
class KIBIS_WAVEFORM
{
public:
KIBIS_WAVEFORM(){};
KIBIS_WAVEFORM_TYPE GetType() { return m_type; };
bool inverted = false; // Used for differential drivers
protected:
KIBIS_WAVEFORM_TYPE m_type = KIBIS_WAVEFORM_TYPE::NONE;
};
class KIBIS_WAVEFORM_RECTANGULAR : public KIBIS_WAVEFORM
{
public:
KIBIS_WAVEFORM_RECTANGULAR() : KIBIS_WAVEFORM() { m_type = KIBIS_WAVEFORM_TYPE::RECTANGULAR; };
double m_ton;
double m_toff;
int m_cycles;
double m_delay = 0;
};
class KIBIS_WAVEFORM_STUCK_HIGH : public KIBIS_WAVEFORM
{
public:
KIBIS_WAVEFORM_STUCK_HIGH() : KIBIS_WAVEFORM() { m_type = KIBIS_WAVEFORM_TYPE::STUCK_HIGH; };
};
class KIBIS_WAVEFORM_STUCK_LOW : public KIBIS_WAVEFORM
{
public:
KIBIS_WAVEFORM_STUCK_LOW() : KIBIS_WAVEFORM() { m_type = KIBIS_WAVEFORM_TYPE::STUCK_LOW; };
};
class KIBIS_WAVEFORM_HIGH_Z : public KIBIS_WAVEFORM
{
public:
KIBIS_WAVEFORM_HIGH_Z() : KIBIS_WAVEFORM() { m_type = KIBIS_WAVEFORM_TYPE::HIGH_Z; };
};
/** Accuracy level.
*
* Level 0 is faster, but not as accurate
*
* Level 0 :
* - Driver: Don't use waveform
* - Driver: Don't use _DUT info
* Level 1 :
* _ Driver: Use up to one waveform
* _ Driver: Don't use _DUT info
* Level 2 :
* _ Driver: Use up to two waveforms
* _ Driver: Don't use _DUT info
*
* Level 3 : ( not implemented, fallback to level 2 )
* _ Driver: Use up to two waveforms
* _ Driver: Use _DUT info if at least one waveform
*/
enum class KIBIS_ACCURACY
{
LEVEL_0,
LEVEL_1,
LEVEL_2,
LEVEL_3,
};
class KIBIS_FILE : KIBIS_ANY
{
public:
KIBIS_FILE( KIBIS* aTopLevel );
std::string m_fileName;
double m_fileRev;
double m_ibisVersion;
std::string m_date;
std::string m_source;
std::string m_notes;
std::string m_disclaimer;
std::string m_copyright;
bool Init( IbisParser& aParser );
};
class KIBIS : public KIBIS_ANY
{
public:
KIBIS( std::string aFileName );
std::vector<KIBIS_COMPONENT> m_components;
std::vector<KIBIS_MODEL> m_models;
KIBIS_FILE m_file;
};
class KIBIS_MODEL : public KIBIS_ANY
{
public:
KIBIS_MODEL( KIBIS* aTopLevel, IbisModel& aSource, IbisParser& aParser );
std::string m_name;
std::string m_description;
IBIS_MODEL_TYPE m_type = IBIS_MODEL_TYPE::UNDEFINED;
/* The Polarity, Enable, Vinl, Vinh, Vmeas, Cref, Rref, and Vref subparameters are optional. */
/* the default values of Vinl = 0.8 V and Vinh = 2.0 V are assumed. */
double m_vinl = 0.8;
double m_vinh = 2;
double m_vref = 0;
double m_rref = 0;
double m_cref = 0;
double m_vmeas = 0;
IBIS_MODEL_ENABLE m_enable = IBIS_MODEL_ENABLE::UNDEFINED;
IBIS_MODEL_POLARITY m_polarity = IBIS_MODEL_POLARITY::UNDEFINED;
// End of optional subparameters
TypMinMaxValue* m_C_comp;
TypMinMaxValue* m_voltageRange;
TypMinMaxValue* m_temperatureRange;
TypMinMaxValue* m_pullupReference;
TypMinMaxValue* m_pulldownReference;
TypMinMaxValue* m_GNDClampReference;
TypMinMaxValue* m_POWERClampReference;
TypMinMaxValue* m_Rgnd;
TypMinMaxValue* m_Rpower;
TypMinMaxValue* m_Rac;
TypMinMaxValue* m_Cac;
IVtable* m_GNDClamp;
IVtable* m_POWERClamp;
IVtable* m_pullup;
IVtable* m_pulldown;
std::vector<IbisWaveform*> m_risingWaveforms;
std::vector<IbisWaveform*> m_fallingWaveforms;
IbisRamp* m_ramp;
/** @brief Return true if the model has a pulldown transistor */
bool HasPulldown();
/** @brief Return true if the model has a pullup transistor */
bool HasPullup();
/** @brief Return true if the model has a clamp diode to the gnd net */
bool HasGNDClamp();
/** @brief Return true if the model has a clamp diode to the power net */
bool HasPOWERClamp();
/** @brief Generate the spice directive to simulate the die
*
* @param aSupply Power supply corner
* @param aParasitics Parasitics corner
* @param aIndex Index used to offset spice nodes / directives
* @return A multiline string with spice directives
*/
std::string SpiceDie( IBIS_CORNER aSupply, IBIS_CORNER aParasitics, int aIndex );
/** @brief Create waveform pairs
*
* For maximum accuracy, we need a waveform pair.
* This function creates the pairs based on the fixture.
* The first element is the rising edge, the second is the falling edge.
*
* @return a vector of waveform pairs
*/
std::vector<std::pair<IbisWaveform*, IbisWaveform*>> waveformPairs();
/** @brief Generate a square waveform
*
* For maximum accuracy, we need a waveform pair.
* This function creates the pairs based on the fixture.
*
* @param aNode1 node where the voltage is applied
* @param aNode2 Reference node
* @param aBits The first member is the bit value ( 1 or 0 ).
* The second member is the time of the transition edge.
* @param aPair @see waveformPairs()
* @param aSupply Power supply corner
* @return A multiline string with spice directives
*/
std::string generateSquareWave( std::string aNode1, std::string aNode2,
std::vector<std::pair<int, double>> aBits,
std::pair<IbisWaveform*, IbisWaveform*> aPair,
IBIS_CORNER aSupply );
/** @brief Copy a waveform, and substract the first value to all samples
*
*
* @param aIn Input waveform
* @return Output waveform
*/
IbisWaveform TrimWaveform( IbisWaveform& aIn );
};
class KIBIS_PIN : public KIBIS_ANY
{
public:
KIBIS_PIN( KIBIS* aTopLevel, IbisComponentPin& aPin, IbisComponentPackage& aPackage,
IbisParser& aParser, KIBIS_COMPONENT* aParent, std::vector<KIBIS_MODEL>& aModels );
/** @brief Name of the pin
* Examples : "VCC", "GPIOA", "CLK", etc...
*/
std::string m_signalName;
/** @brief Pin Number
* Examples : 1, 2, 3 ( or for BGA ), A1, A2, A3, etc...
*/
std::string m_pinNumber;
/** @brief Resistance from die to pin */
TypMinMaxValue* R_pin;
/** @brief Inductance from die to pin */
TypMinMaxValue* L_pin;
/** @brief Capacitance from pin to GND */
TypMinMaxValue* C_pin;
KIBIS_COMPONENT* m_parent;
std::vector<double> m_t, m_Ku, m_Kd;
std::vector<KIBIS_MODEL*> m_models;
bool writeSpiceDriver( std::string* aDest, std::string aName, KIBIS_MODEL& aModel,
IBIS_CORNER aSupply, IBIS_CORNER aParasitics, KIBIS_ACCURACY aAccuracy,
KIBIS_WAVEFORM* aWave );
bool writeSpiceDiffDriver( std::string* aDest, std::string aName, KIBIS_MODEL& aModel,
IBIS_CORNER aSupply, IBIS_CORNER aParasitics,
KIBIS_ACCURACY aAccuracy, KIBIS_WAVEFORM* aWave );
bool writeSpiceDevice( std::string* aDest, std::string aName, KIBIS_MODEL& aModel,
IBIS_CORNER aSupply, IBIS_CORNER aParasitics );
/** @brief Update m_Ku, m_Kd using no falling / rising waveform inputs ( low accuracy )
* @param aModel Model to be used
* @param aWave Waveform to generate
* @param aSupply Power supply corner
*/
void getKuKdNoWaveform( KIBIS_MODEL& aModel, KIBIS_WAVEFORM* aWave, IBIS_CORNER aSupply );
/** @brief Update m_Ku, m_Kd using with a single waveform input
* @param aModel Model to be used
* @param aPair @see waveformPairs()
* @param aWave Waveform to generate
* @param aSupply Power supply corner
* @param aParasitics Parasitics corner
*/
void getKuKdOneWaveform( KIBIS_MODEL& aModel, std::pair<IbisWaveform*, IbisWaveform*> aPair,
KIBIS_WAVEFORM* aWave, IBIS_CORNER aSupply, IBIS_CORNER aParasitics );
/** @brief Update m_Ku, m_Kd using with two waveform inputs
*
* The order of aPair1 and aPair2 is not important.
* @param aModel Model to be used
* @param aPair1 @see waveformPairs()
* @param aPair2 @see waveformPairs()
* @param aWave Waveform to generate
* @param aSupply Power supply corner
* @param aParasitics Parasitics corner
*/
void getKuKdTwoWaveforms( KIBIS_MODEL& aModel, std::pair<IbisWaveform*, IbisWaveform*> aPair1,
std::pair<IbisWaveform*, IbisWaveform*> aPair2, KIBIS_WAVEFORM* aWave,
IBIS_CORNER aSupply, IBIS_CORNER aParasitics );
/** @brief Update m_Ku, m_Kd using with two waveform inputs
*
* The order of aPair1 and aPair2 is not important.
* @param aModel Model to be used
* @param aPair @see waveformPairs()
* @param aWave Waveform to generate
* @param aSupply Power supply corner
* @param aParasitics Parasitics corner
* @param aIndex Index for numbering spice .SUBCKT
*
* @return A multiline string with spice directives
*/
std::string KuKdDriver( KIBIS_MODEL& aModel, std::pair<IbisWaveform*, IbisWaveform*> aPair,
KIBIS_WAVEFORM* aWave, IBIS_CORNER aSupply, IBIS_CORNER aParasitics,
int aIndex );
/** @brief Generate the spice directive to simulate the die for Ku/Kd estimation
*
* DO NOT use it in order to generate a model.
* It sole purpose is to run the internal simulation to get Ku/Kd
*
* @param aModel Model to be used
* @param aSupply Power supply corner
* @param aIndex Index for numbering ports
* @return A multiline string with spice directives
*/
std::string addDie( KIBIS_MODEL& aModel, IBIS_CORNER aSupply, int aIndex );
/** @brief Update m_Ku, m_Kd using with two waveform inputs
*
* Runs a simulation. The simulation creates a specific file with Ku/Kd values
* This function then reads the output file and updates m_Ku / m_Kd.
* This function probably needs a rewrite.
*
* @param aSimul The simulation to run, multiline spice directives
*/
void getKuKdFromFile( std::string* aSimul );
};
class KIBIS_COMPONENT : public KIBIS_ANY
{
public:
KIBIS_COMPONENT( KIBIS* aToplevel, IbisComponent& aSource, IbisParser& aParser );
/** @brief Name of the component */
std::string m_name;
/** @brief Name of the manufacturer */
std::string m_manufacturer;
std::vector<KIBIS_PIN> m_pins;
/** @brief Get a pin by its number ( 1, 2, A1, A2, ... )
*
* @param aPinNumber pin number
* @return pointer to a KIBIS_PIN, or nullptr if there is no matching pin
*/
KIBIS_PIN* getPin( std::string aPinNumber );
};
#endif

View File

@ -47,3 +47,6 @@ add_subdirectory( unittests )
# Utility/debugging/profiling programs # Utility/debugging/profiling programs
add_subdirectory( tools ) add_subdirectory( tools )
if( KICAD_SIGNAL_INTEGRITY )
add_subdirectory( signalIntegrity )
endif()

View File

@ -0,0 +1,84 @@
#
# This program source code file is part of KiCad, a free EDA CAD application.
#
# Copyright (C) 2017 CERN
# @author Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
#
# 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 2
# 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:
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# or you may search the http://www.gnu.org website for the version 2 license,
# or you may write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
find_package(Boost COMPONENTS unit_test_framework REQUIRED)
find_package( wxWidgets 3.0.0 COMPONENTS gl aui adv html core net base xml stc REQUIRED )
add_definitions(-DBOOST_TEST_DYN_LINK -DPCBNEW -DDRC_PROTO -DTEST_APP_NO_MAIN)
add_executable( ibis_proto
qaIbisParser.cpp
../../pcbnew/signalIntegrity/ibisParser.cpp
../../pcbnew/signalIntegrity/kibis.cpp
)
add_dependencies( ibis_proto pnsrouter pcbcommon ${PCBNEW_IO_LIBRARIES} )
include_directories( BEFORE ${INC_BEFORE} )
include_directories(
${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/3d-viewer
${CMAKE_SOURCE_DIR}/common
${CMAKE_SOURCE_DIR}/pcbnew
${CMAKE_SOURCE_DIR}/pcbnew/router
${CMAKE_SOURCE_DIR}/pcbnew/tools
${CMAKE_SOURCE_DIR}/pcbnew/dialogs
${CMAKE_SOURCE_DIR}/polygon
${CMAKE_SOURCE_DIR}/common/geometry
${CMAKE_SOURCE_DIR}/libs/kimath/include/math
${CMAKE_SOURCE_DIR}/qa/common
${CMAKE_SOURCE_DIR}/qa
${CMAKE_SOURCE_DIR}/qa/qa_utils
${CMAKE_SOURCE_DIR}/qa/qa_utils/include
${CMAKE_SOURCE_DIR}/qa/pcbnew_utils/include
${Boost_INCLUDE_DIR}
${INC_AFTER}
)
target_link_libraries( ibis_proto
qa_pcbnew_utils
3d-viewer
connectivity
pcbcommon
pnsrouter
gal
common
gal
qa_utils
dxflib_qcad
tinyspline_lib
nanosvg
idf3
${PCBNEW_IO_LIBRARIES}
${wxWidgets_LIBRARIES}
${GDI_PLUS_LIBRARIES}
${PYTHON_LIBRARIES}
${Boost_LIBRARIES}
${PCBNEW_EXTRA_LIBS} # -lrt must follow Boost
)
configure_file( "ibis_v1_1.ibs" "ibis_v1_1.ibs" COPYONLY )
configure_file( "ibis_v2_1.ibs" "ibis_v2_1.ibs" COPYONLY )
configure_file( "ibis_v2_1.pkg" "ibis_v2_1.pkg" COPYONLY )

View File

@ -0,0 +1,89 @@
[IBIS Ver] 1.1 |Let's test a comment
[Comment char] #_char
[File name] ibis_v1_1.ibs
[File Rev] 1.0 #Let's test a comment
[Date] 26/08/2021
[Source] This is the
source for the files
[Notes] We can have some
Notes
[Disclaimer]
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017-2021 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 2
* 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:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
[Component] Virtual
[Manufacturer] KiCad
[Package]
R_pkg 1m 0.8m NA
L_pkg 1m NA NA
C_pkg 1m NA NA
[Pin] signal_name model_name R_pin L_pin C_pin
1 VCC POWER 1m 0.8m NA
2 GND GND 1m NA 2m
3 X Input 1m NA NA
4 Y Ouput 1m 0.8m 2m
[Model] Input
Model_type Input
Polarity Non-Inverting
Enable Active-High
Vinl = 0.8V
Vinh = 2.0V
C_comp 10.0pF 8.0pF 15.0pF
[Voltage range] 5.0V 4.5V 5.5V
[Pulldown]
# Voltage I(typ) I(min) I(max)
#
-5.0V -50.0m -40.0m -60.0m
0.0V 0 0 0
5.0V 50.0m 40.0m 60.0m
[Pullup]
#
# Voltage I(typ) I(min) I(max)
#
-5.0V 50.0m 40.0m 60.0m
0.0V 0 0 0
5.0V -50.0m -40.0m -60.0m
[GND_clamp]
#
# Voltage I(typ) I(min) I(max)
#
-5.0V -50.0m NA NA
0.0V 0 NA NA
5.0V 0 NA NA
[POWER_clamp]
#
# Voltage I(typ) I(min) I(max)
#
-5.0V 50.0m NA NA
0.0V 0 NA NA
5.0V 0 NA NA
[Ramp]
# variable typ min max
dV/dt_r 3.0/2n 2.8/3n NA
dV/dt_f 3.0/2n 2.8/3n 3.2/1n
[END]

View File

@ -0,0 +1,147 @@
[IBIS Ver] 2.1 |Let's test a comment
[Comment char] #_char
[File name] ibis_v2_1.pkg
[File Rev] 1.0 #Let's test a comment
[Date] 26/08/2021
[Source] This is the
source for the files
[Notes] We can have some
Notes
[Copyright]
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017-2021 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 2
* 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:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
[Disclaimer] This is NOT a valid component.
[Component] Virtual
[Manufacturer] KiCad
[Package]
R_pkg 1m 0.8m 2m
L_pkg 1m 0.8m 2m
C_pkg 1m 0.8m 2m
[Pin] signal_name model_name R_pin L_pin C_pin
1 VCC POWER 1m 0.8m 2m
2 GND GND 1m 0.8m 2m
3 X Input 1m 0.8m 2m
4 Y Ouput 1m 0.8m 2m
5 YN Ouput 1m 0.8m 2m
6 Y Ouput 1m 0.8m 2m
7 YN Ouput 1m 0.8m 2m
[Package Model] QS-SMT-cer-8-pin-pkgs
[Pin Mapping] pulldown_ref pullup_ref gnd_clamp_ref power_clamp_ref
1 GNDBUS NC
2 NC PWRBUS
3 GNDBUS PWRBUS
4 GNDBUS PWRBUS GNDBUS PWRBUS
5 GNDBUS PWRBUS GNDBUS PWRBUS
6 GNDBUS PWRBUS GNDBUS PWRBUS
7 GNDBUS PWRBUS GNDBUS PWRBUS
[Diff Pin] inv_pin vdiff tdelay_typ tdelay_min tdelay_max
#
4 5 150mV -1ns 0ns -2ns
6 7 150mV -1ns 0ns -2ns
[Model] Input
Model_type Input
Polarity Non-Inverting
Enable Active-High
Vinl = 0.8V
Vinh = 2.0V
Vmeas= 1.5V
Cref =50pF
Rref=500
Vref = 0
C_comp 10.0pF 8.0pF 15.0pF
[Voltage range] 5.0V 4.5V 5.5V
[Temperature Range] 27.0 -50 130.0
[Pullup Reference] 5.0V 4.5V 5.5V
[Pulldown Reference] 0V 0V 0V
[POWER Clamp Reference] 5.0V 4.5V 5.5V
[GND Clamp Reference] 0V 0V 0V
[Pulldown]
# Voltage I(typ) I(min) I(max)
#
-5.0V -50.0m -40.0m -60.0m
0.0V 0 0 0
5.0V 50.0m 40.0m 60.0m
[Pullup]
#
# Voltage I(typ) I(min) I(max)
#
-5.0V 50.0m 40.0m 60.0m
0.0V 0 0 0
5.0V -50.0m -40.0m -60.0m
[GND_clamp]
#
# Voltage I(typ) I(min) I(max)
#
-5.0V -50.0m NA NA
0.0V 0 NA NA
5.0V 0 NA NA
[POWER_clamp]
#
# Voltage I(typ) I(min) I(max)
#
-5.0V 50.0m NA NA
0.0V 0 NA NA
5.0V 0 NA NA
[Rgnd] 1500hm 100Ohm 3600
[Rpower] 150Ohm 100Ohm NA
[Rac] 30Ohm NA NA
[Cac] 50pF NA NA
[Ramp]
# variable typ min max
dV/dt_r 3.0/2n 2.8/3n 3.2/1n
dV/dt_f 3.0/2n 2.8/3n 3.2/1n
[Rising Waveform]
R_fixture = 500
V_fixture = 5.0
C_fixture = 10p
L_fixture = 2n
C_dut = 7p
R_dut = 1m
L_dut = 1n
#Time V(typ) V(min) V(max)
0.0ns 0 0 0
1.0ns 1 0.5 1.5
2.0ns 2 1 3
#
[Falling Waveform]
R_fixture = 50
V_fixture = 0
#Time V(typ) V(min) V(max)
0.0ns 2 1 NA
1.0ns 1 0.5 NA
2.0ns 0 0 NA
[END]

View File

@ -0,0 +1,110 @@
[IBIS Ver] 2.1 |Let's test a comment
[Comment char] |_char
[File name] ibis_v2_1.pkg
[File Rev] 1.0 #Let's test a comment
[Date] 26/08/2021
[Source] This is the
source for the files
[Notes] We can have some
Notes
[Copyright]
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017-2021 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 2
* 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:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
[Define Package Model] QFN4
[Manufacturer] Kicad
[OEM] Kicad Packaging Co.
[Description] A 4 pin QFN, really ?
[Number of Pins] 4
[Pin Numbers]
A1
A2
A3
A4
[Model Data]
|
| The resistance matrix for this package has no coupling
|
[Resistance Matrix] Banded_matrix
[Bandwidth] 3
[Row] 1
1 2 1
[Row] 2
2 3 2
[Row] 3
4 5 4
[Row] 4
5 6 5
|
| The inductance matrix has loads of coupling
|
[Inductance Matrix] Full_matrix
[Row] 1
3.04859e-07 4.73185e-08 1.3428e-08
1.74022e-07
[Row] 2
3.04859e-07 4.73185e-08 1.3428e-08
[Row] 3
3.04859e-07 4.73185e-08
[Row] 4
3.04859e-07
|
| The capacitance matrix has sparse coupling
|
[Capacitance Matrix] Sparse_matrix
[Row] 1
1 2.48227e-10
2 -1.56651e-11
5 -9.54158e-11
6 -7.15684e-12
[Row] 2
2 2.51798e-10
3 -1.56552e-11
5 -6.85199e-12
6 -9.0486e-11
7 -6.82003e-12
[Row] 3
3 2.51798e-10
4 -1.56651e-11
6 -6.82003e-12
7 -9.0486e-11
8 -6.85199e-12
[Row] 4
4 2.48227e-10
7 -7.15684e-12
8 -9.54158e-11
[Row] 5
5 1.73542e-10
6 -3.38247e-11
[Row] 6
6 1.86833e-10
7 -3.27226e-11
[Row] 7
7 1.86833e-10
8 -3.38247e-11
[Row] 8
8 1.73542e-10
|
[End Model Data]
[End Package Model]
[END]

View File

@ -0,0 +1,419 @@
[IBIS Ver] 3.2 |Let's test a comment
[Comment char] #_char
[File name] ibis_v2_1.pkg
[File Rev] 1.0 #Let's test a comment
[Date] 26/08/2021
[Source] This is the
source for the files
[Notes] We can have some
Notes
[Copyright]
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017-2021 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 2
* 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:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
[Disclaimer] This is NOT a valid component.
[Component] Virtual
[Manufacturer] KiCad
[Package]
R_pkg 1m 0.8m 2m
L_pkg 1m 0.8m 2m
C_pkg 1m 0.8m 2m
[Pin] signal_name model_name R_pin L_pin C_pin
1 VCC POWER 1m 0.8m 2m
2 GND GND 1m 0.8m 2m
3 X Input 1m 0.8m 2m
4 Y Ouput 1m 0.8m 2m
5 YN Ouput 1m 0.8m 2m
6 Y Ouput 1m 0.8m 2m
7 YN Ouput 1m 0.8m 2m
[Package Model] QS-SMT-cer-8-pin-pkgs
[Pin Mapping] pulldown_ref pullup_ref gnd_clamp_ref power_clamp_ref
1 GNDBUS NC
2 NC PWRBUS
3 GNDBUS PWRBUS
4 GNDBUS PWRBUS GNDBUS PWRBUS
5 GNDBUS PWRBUS GNDBUS PWRBUS
6 GNDBUS PWRBUS GNDBUS PWRBUS
7 GNDBUS PWRBUS GNDBUS PWRBUS
[Diff Pin] inv_pin vdiff tdelay_typ tdelay_min tdelay_max
#
4 5 150mV -1ns 0ns -2ns
6 7 150mV -1ns 0ns -2ns
[Series Pin Mapping] pin_2 model_name function_table_group
|
4 5 PinSeries 1
6 7 PinSeries 2
[Series Switch Groups]
On 4 5 /
Off 4 5 /
On 4 5 6 7 /
Off 4 5 6 7 /
[Model] Input
Model_type Input
Polarity Non-Inverting
Enable Active-High
Vinl = 0.8V
Vinh = 2.0V
Vmeas= 1.5V
Cref =50pF
Rref=500
Vref = 0
C_comp 10.0pF 8.0pF 15.0pF
[Model Spec]
| Subparameter typ min max
Vinh 3.5 3.15 3.85
Vinl 1.5 1.35 1.65
Vinh+ 2.0 NA NA | Overrides the
Vinh- 1.6 NA NA | thresholds
Vinl+ 1.1 NA NA
Vinl- 0.6 NA NA | All 4 are required
S_overshoot_high 5.5 5.0 6.0 | Static overshoot
S_overshoot_low -0.5 NA NA
D_overshoot_high 6.0 5.5 6.5 | Dynamic overshoot
D_overshoot_low -1.0 -1.0 -1.0
D_overshoot_time 20n 20n 20n | & static overshoot
Pulse_high 3V NA NA | Pulse immunity
Pulse_low 0 NA NA | requires
Pulse_time 3n NA NA | Pulse_time
Vmeas 3.68 3.18 4.68 | A 5 volt PECL
[Add Submodel]
| Submodel_name Mode
Bus_Hold_1 Non-Driving
Dynamic_clamp_1 All
[Driver Schedule]
| Model_name Rise_on_dly Rise_off_dly Fall_on_dly Fall_off_dly
MODEL_OUT 0.0ns NA 0.0ns NA
M_O_SOURCE1 0.5ns NA 0.5ns NA
| low (high-Z) to high high to low (high-Z)
M_O_SOURCE2 0.5n 1.5n NA NA
| low to high to low low (high-Z)
M_O_DRAIN1 1.0n NA 1.5n NA
| low to high (high-Z) high (high-Z) to low
M_O_DRAIN2 NA NA 1.5n 2.0n
| high (high-Z) high to low to high
[Voltage range] 5.0V 4.5V 5.5V
[Temperature Range] 27.0 -50 130.0
[Pullup Reference] 5.0V 4.5V 5.5V
[Pulldown Reference] 0V 0V 0V
[POWER Clamp Reference] 5.0V 4.5V 5.5V
[GND Clamp Reference] 0V 0V 0V
[TTgnd] 10n 12n 9n
[TTpower] 12n NA NA
[Pulldown]
# Voltage I(typ) I(min) I(max)
#
-5.0V -50.0m -40.0m -60.0m
0.0V 0 0 0
5.0V 50.0m 40.0m 60.0m
[Pullup]
#
# Voltage I(typ) I(min) I(max)
#
-5.0V 50.0m 40.0m 60.0m
0.0V 0 0 0
5.0V -50.0m -40.0m -60.0m
[GND_clamp]
#
# Voltage I(typ) I(min) I(max)
#
-5.0V -50.0m NA NA
0.0V 0 NA NA
5.0V 0 NA NA
[POWER_clamp]
#
# Voltage I(typ) I(min) I(max)
#
-5.0V 50.0m NA NA
0.0V 0 NA NA
5.0V 0 NA NA
[Rgnd] 1500hm 100Ohm 3600
[Rpower] 150Ohm 100Ohm NA
[Rac] 30Ohm NA NA
[Cac] 50pF NA NA
[On]
| variable R(typ) R(min) R(max)
[R Series] 8ohm 6ohm 12ohm
|
| variable L(typ) L(min) L(max)
[L Series] 5nH NA NA
| variable R(typ) R(min) R(max)
[Rl Series] 4ohm NA NA
|
| variable C(typ) C(min) C(max) | The other elements
[C Series] 50pF NA NA | are 0 impedance
[Off]
| variable R(typ) R(min) R(max)
[R Series] 8ohm 6ohm 12ohm
|
| variable L(typ) L(min) L(max)
[L Series] 5nH NA NA
| variable R(typ) R(min) R(max)
[Rl Series] 4ohm NA NA
|
| variable C(typ) C(min) C(max) | The other elements
[C Series] 50pF NA NA | are 0 impedance
[Series Current]
| Voltage I(typ) I(min) I(max)
-5.0V -3900.0m -3800.0m -4000.0m
-0.7V -80.0m -75.0m -85.0m
-0.6V -22.0m -20.0m -25.0m
-0.5V -2.4m -2.0m -2.9m
-0.4V 0.0m 0.0m 0.0m
5.0V 0.0m 0.0m 0.0m
[Series MOSFET]
Vds = 1.0
| Voltage I(typ) I(min) I(max)
5.0V 257.9m 153.3m 399.5m | Defines the Ids current as a
4.0V 203.0m 119.4m 317.3m | function of Vtable, for Vds = 1.0
3.0V 129.8m 74.7m 205.6m
2.0V 31.2m 16.6m 51.0m
1.0V 52.7p 46.7p 56.7p
0.0V 0.0p 0.0p 0.0p
[Off]
| variable R(typ) R(min) R(max)
[R Series] 8ohm 6ohm 12ohm
|
| variable L(typ) L(min) L(max)
[L Series] 5nH NA NA
| variable R(typ) R(min) R(max)
[Rl Series] 4ohm NA NA
|
| variable C(typ) C(min) C(max) | The other elements
[C Series] 50pF NA NA | are 0 impedance
[Off]
| variable R(typ) R(min) R(max)
[R Series] 8ohm 6ohm 12ohm
|
| variable L(typ) L(min) L(max)
[L Series] 5nH NA NA
| variable R(typ) R(min) R(max)
[Rl Series] 4ohm NA NA
|
| variable C(typ) C(min) C(max) | The other elements
[C Series] 50pF NA NA | are 0 impedance
[Series Current]
| Voltage I(typ) I(min) I(max)
-5.0V -3900.0m -3800.0m -4000.0m
-0.7V -80.0m -75.0m -85.0m
-0.6V -22.0m -20.0m -25.0m
-0.5V -2.4m -2.0m -2.9m
-0.4V 0.0m 0.0m 0.0m
5.0V 0.0m 0.0m 0.0m
[Ramp]
# variable typ min max
dV/dt_r 3.0/2n 2.8/3n 3.2/1n
dV/dt_f 3.0/2n 2.8/3n 3.2/1n
[Rising Waveform]
R_fixture = 500
V_fixture = 5.0
C_fixture = 10p
L_fixture = 2n
C_dut = 7p
R_dut = 1m
L_dut = 1n
#Time V(typ) V(min) V(max)
0.0ns 0 0 0
1.0ns 1 0.5 1.5
2.0ns 2 1 3
#
[Falling Waveform]
R_fixture = 50
V_fixture = 0
#Time V(typ) V(min) V(max)
0.0ns 2 1 NA
1.0ns 1 0.5 NA
2.0ns 0 0 NA
[Submodel] DMySubmodel
Submodel_type Dynamic_clamp
[Pulldown]
# Voltage I(typ) I(min) I(max)
#
-5.0V -50.0m -40.0m -60.0m
0.0V 0 0 0
5.0V 50.0m 40.0m 60.0m
[Pullup]
#
# Voltage I(typ) I(min) I(max)
#
-5.0V 50.0m 40.0m 60.0m
0.0V 0 0 0
5.0V -50.0m -40.0m -60.0m
[GND_clamp]
#
# Voltage I(typ) I(min) I(max)
#
-5.0V -50.0m NA NA
0.0V 0 NA NA
5.0V 0 NA NA
[POWER_clamp]
#
# Voltage I(typ) I(min) I(max)
#
-5.0V 50.0m NA NA
0.0V 0 NA NA
5.0V 0 NA NA
[Ramp]
# variable typ min max
dV/dt_r 3.0/2n 2.8/3n 3.2/1n
dV/dt_f 3.0/2n 2.8/3n 3.2/1n
[Rising Waveform]
R_fixture = 500
V_fixture = 5.0
C_fixture = 10p
L_fixture = 2n
C_dut = 7p
R_dut = 1m
L_dut = 1n
#Time V(typ) V(min) V(max)
0.0ns 0 0 0
1.0ns 1 0.5 1.5
2.0ns 2 1 3
#
[Falling Waveform]
R_fixture = 50
V_fixture = 0
#Time V(typ) V(min) V(max)
0.0ns 2 1 NA
1.0ns 1 0.5 NA
2.0ns 0 0 NA
[Submodel Spec]
| Subparameter typ min max
V_trigger_r 3.1 2.4 3.7 | Low to high transition
| triggers the turn on
| process of the pullup
V_trigger_f -10.0 -10.0 -10.0 | Not used, so trigger
| voltages are set out
| of range
Off_delay 5n 6n 4n | Time from rising edge
| trigger at which the
| pullup turned off
[GND Pulse Table] | GND Clamp offset table
| Time V(typ) V(min) V(max)
|
0 0 0 0
1e-9 0 0 0
2e-9 0.9 0.8 1.0
10e-9 0.9 0.8 1.0
11e-9 0 0 0
[GND Clamp] | Table to be offset
|
| Voltage I(typ) I(min) I(max)
|
-5.000 -3.300e+01 -3.000e+01 -3.500e+01
-4.000 -2.300e+01 -2.200e+01 -2.400e+01
-3.000 -1.300e+01 -1.200e+01 -1.400e+01
-2.000 -3.000e+00 -2.300e+00 -3.700e+00
-1.900 -2.100e+00 -1.500e+00 -2.800e+00
-1.800 -1.300e+00 -8.600e-01 -1.900e+00
-1.700 -6.800e-01 -4.000e-01 -1.100e+00
-1.600 -2.800e-01 -1.800e-01 -5.100e-01
-1.500 -1.200e-01 -9.800e-02 -1.800e-01
-1.400 -7.500e-02 -7.100e-02 -8.300e-02
-1.300 -5.750e-02 -5.700e-02 -5.900e-02
-1.200 -4.600e-02 -4.650e-02 -4.550e-02
-1.100 -3.550e-02 -3.700e-02 -3.450e-02
-1.000 -2.650e-02 -2.850e-02 -2.500e-02
-0.900 -1.850e-02 -2.100e-02 -1.650e-02
-0.800 -1.200e-02 -1.400e-02 -9.750e-03
-0.700 -6.700e-03 -8.800e-03 -4.700e-03
-0.600 -3.000e-03 -4.650e-03 -1.600e-03
-0.500 -9.450e-04 -1.950e-03 -3.650e-04
-0.400 -5.700e-05 -2.700e-04 -5.550e-06
-0.300 -1.200e-06 -1.200e-05 -5.500e-08
-0.200 -3.000e-08 -5.000e-07 0.000e+00
-0.100 0.000e+00 0.000e+00 0.000e+00
0.000 0.000e+00 0.000e+00 0.000e+00
5.000 0.000e+00 0.000e+00 0.000e+00
|
[POWER Pulse Table] | POWER Clamp offset table |
| Time V(typ) V(min) V(max)
|
0 0 0 0
1e-9 0 0 0
2e-9 -0.9 -1.0 -0.8
10e-9 -0.9 -1.0 -0.8
11e-9 0 0 0
|
[POWER Clamp] | Table to be offset
|
| Voltage I(typ) I(min) I(max)
|
-5.000 1.150e+01 1.100e+01 1.150e+01
-4.000 7.800e+00 7.500e+00 8.150e+00
-3.000 4.350e+00 4.100e+00 4.700e+00
-2.000 1.100e+00 8.750e-01 1.300e+00
-1.900 8.000e-01 6.050e-01 1.000e+00
-1.800 5.300e-01 3.700e-01 7.250e-01
-1.700 2.900e-01 1.800e-01 4.500e-01
-1.600 1.200e-01 6.850e-02 2.200e-01
-1.500 3.650e-02 2.400e-02 6.900e-02
-1.400 1.200e-02 1.100e-02 1.600e-02
-1.300 6.300e-03 6.650e-03 6.100e-03
-1.200 4.200e-03 4.750e-03 3.650e-03
-1.100 2.900e-03 3.500e-03 2.350e-03
-1.000 1.900e-03 2.450e-03 1.400e-03
-0.900 1.150e-03 1.600e-03 7.100e-04
-0.800 5.500e-04 9.150e-04 2.600e-04
-0.700 1.200e-04 4.400e-04 5.600e-05
-0.600 5.400e-05 1.550e-04 1.200e-05
-0.500 1.350e-05 5.400e-05 1.300e-06
-0.400 8.650e-07 7.450e-06 4.950e-08
-0.300 6.250e-08 7.550e-07 0.000e+00
-0.200 0.000e+00 8.400e-08 0.000e+00
-0.100 0.000e+00 0.000e-08 0.000e+00
0.000 0.000e+00 0.000e+00 0.000e+00
[END]

View File

@ -0,0 +1,46 @@
[IBIS Ver] 3.2 |Let's test a comment
[Comment char] |_char
[File name] ibis_v2_1.pkg
[File Rev] 1.0 #Let's test a comment
[Date] 26/08/2021
[Source] This is the
source for the files
[Notes] We can have some
Notes
[Copyright]
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017-2021 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 2
* 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:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
[Define Package Model] QFN4
[Manufacturer] Kicad
[OEM] Kicad Packaging Co.
[Description] A 4 pin QFN, really ?
[Number Of Sections] 2
[Number of Pins] 4
[Pin Numbers]
A1
A2
A3
A4
[End Package Model]
[END]

View File

@ -0,0 +1,89 @@
#include "../../pcbnew/signalIntegrity/kibis.h"
#include <wx/textfile.h>
int main( void )
{
//KIBIS* k1 = new KIBIS( "ibis_v1_1.ibs" );
//KIBIS* k2 = new KIBIS( "ibis_v2_1.ibs" );
//KIBIS* k4 = new KIBIS( "sn74lvc541a.ibs" );
KIBIS* k4 = new KIBIS( "ibis_lan8670_1_2_1v3.ibs" );
KIBIS_COMPONENT& comp = k4->m_components.at( 0 );
std::cout << "Component: " << comp.m_name << std::endl;
for( KIBIS_PIN& pin : comp.m_pins )
{
std::cout << "--Pin: " << pin.m_pinNumber << " " << pin.m_signalName << std::endl;
}
//KIBIS_PIN* pin1 = comp.getPin( "11" );
//KIBIS_PIN* pin2 = comp.getPin( "2" );
KIBIS_PIN* pin1 = comp.getPin( "30" );
KIBIS_PIN* pin2 = comp.getPin( "31" );
std::cout << "pin1 name: " << pin1->m_signalName << std::endl;
std::cout << "pin2 name: " << pin2->m_signalName << std::endl;
std::cout << "pin1 model length: " << pin1->m_models.size()<< std::endl;
std::cout << "pin2 model length: " << pin2->m_models.size()<< std::endl;
std::string* tmp1 = new std::string();
std::string* tmp2 = new std::string();
std::string* tmp3 = new std::string();
std::string* tmp4 = new std::string();
KIBIS_WAVEFORM_RECTANGULAR* wave = new KIBIS_WAVEFORM_RECTANGULAR();
wave->m_ton = 80e-9;
wave->m_toff = 80e-9;
wave->m_cycles = 10;
wave->m_delay = 0;
//KIBIS_WAVEFORM_STUCK_HIGH* wave = new KIBIS_WAVEFORM_STUCK_HIGH();
std::cout << "WAVEFORM TYPE IN QA: " << wave->GetType() << std::endl;
std::cout << pin2->m_models.at(0)->m_name << std::endl;
pin2->writeSpiceDevice( tmp4, "device_typ", *( pin2->m_models.at( 0 ) ), IBIS_CORNER::TYP,
IBIS_CORNER::TYP );
KIBIS_MODEL* model1 = pin1->m_models.at( 0 );
std::cout << "Model used for driver: " << model1->m_name << std::endl;
pin1->writeSpiceDiffDriver( tmp1, "driver_typ", *( model1 ), IBIS_CORNER::TYP, IBIS_CORNER::TYP,
KIBIS_ACCURACY::LEVEL_2, wave );
wxTextFile file( "output.sp" );
if( file.Exists() )
{
file.Clear();
}
else
{
file.Create();
}
file.AddLine( *tmp1 );
file.AddLine( *tmp2 );
file.AddLine( *tmp3 );
file.AddLine( *tmp4 );
wxString simul = "";
simul += "x1 0 OUT_1 OUT_2 driver_typ \n";
simul += "R1 OUT_1 COM 25\n";
simul += "R2 OUT_2 COM 25\n";
simul += "V1 COM 0 1.25\n";
simul += ".tran 0.1n 1000n \n";
simul += ".control run \n";
simul += "run \n";
simul += "plot v(OUT_1) v(OUT_2)\n";
//simul += "plot v(x1.KU) v(x1.KD) v(1) v(x1.DIEBUFF) \n";
simul += ".endc \n";
simul += ".end \n";
file.AddLine( simul );
file.Write();
std::cout << "Done" << std::endl;
return 1;
}