More about fix compil issues and warnings, especially in ibis code.

A few are msys2 specific and due to include files order.
This commit is contained in:
jean-pierre charras 2022-09-28 11:09:35 +02:00
parent b3b2b8b3f0
commit dcc325b3b2
8 changed files with 73 additions and 40 deletions

View File

@ -24,6 +24,7 @@
#ifndef DIALOG_SIM_MODEL_H
#define DIALOG_SIM_MODEL_H
#include <../../pcbnew/ibis/kibis.h>
#include <dialog_sim_model_base.h>
#include <netlist_exporter_spice.h>
@ -32,7 +33,6 @@
#include <sim/sim_model.h>
#include <sim/sim_library.h>
#include <sch_symbol.h>
#include <../../pcbnew/ibis/kibis.h>
// Some probable wxWidgets bugs encountered when writing this class:
@ -82,7 +82,7 @@ private:
void removeOrphanedPinAssignments();
void loadLibrary( const wxString& aFilePath );
void addParamPropertyIfRelevant( int aParamIndex );
wxPGProperty* newParamProperty( int aParamIndex ) const;

View File

@ -23,6 +23,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <../../pcbnew/ibis/kibis.h>
#include "netlist_exporter_spice.h"
#include <sim/sim_model_raw_spice.h>
#include <sim/spice_grammar.h>
@ -45,7 +46,6 @@
#include <paths.h>
#include <pegtl.hpp>
#include <pegtl/contrib/parse_tree.hpp>
#include <../../pcbnew/ibis/kibis.h>
#include <wx/dir.h>
@ -160,7 +160,7 @@ bool NETLIST_EXPORTER_SPICE::ReadSchematicAndLibraries( unsigned aNetlistOptions
int numFilesFound = dir.GetAllFiles( dirName, &fileList, fileSpec );
for( unsigned int i = 0; i < numFilesFound; i++ )
for( int i = 0; i < numFilesFound; i++ )
{
// Completes path to specific file so we can get its "last access" date
thisFile.SetFullName( fileList[i] );

View File

@ -22,9 +22,9 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <sim/sim_library_kibis.h>
#include <sim/sim_library.h>
#include <sim/sim_library_spice.h>
#include <sim/sim_library_kibis.h>
std::unique_ptr<SIM_LIBRARY> SIM_LIBRARY::Create( std::string aFilePath )

View File

@ -24,9 +24,9 @@
#ifndef SIM_LIBRARY_KIBIS_H
#define SIM_LIBRARY_KIBIS_H
#include <../../pcbnew/ibis/kibis.h>
#include <sim/sim_library.h>
#include <sim/sim_model_kibis.h>
#include <../../pcbnew/ibis/kibis.h>
class SIM_LIBRARY_KIBIS : public SIM_LIBRARY
{

View File

@ -21,9 +21,9 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <../../pcbnew/ibis/kibis.h>
#include <sim/sim_model_kibis.h>
#include <sim/sim_library_kibis.h>
#include <../../pcbnew/ibis/kibis.h>
#include <locale_io.h>

View File

@ -133,7 +133,6 @@ bool IBIS_MATRIX_SPARSE::Check()
bool isNumberNA( double aNumber )
{
bool result = false;
double NA = nan( NAN_NA );
return *reinterpret_cast<std::uint64_t*>(&aNumber) == *reinterpret_cast<std::uint64_t*>( &NA );
}

View File

@ -108,6 +108,7 @@ KIBIS_FILE::KIBIS_FILE( KIBIS* aTopLevel ) : KIBIS_ANY( aTopLevel )
m_ibisVersion = -1;
}
bool KIBIS_FILE::Init( IbisParser& aParser )
{
bool status = true;
@ -124,6 +125,7 @@ bool KIBIS_FILE::Init( IbisParser& aParser )
return status;
}
KIBIS_PIN::KIBIS_PIN( KIBIS* aTopLevel, IbisComponentPin& aPin, IbisComponentPackage& aPackage,
IbisParser& aParser, KIBIS_COMPONENT* aParent,
std::vector<KIBIS_MODEL>& aModels ) :
@ -151,12 +153,14 @@ KIBIS_PIN::KIBIS_PIN( KIBIS* aTopLevel, IbisComponentPin& aPin, IbisComponentPac
m_Rpin.value[IBIS_CORNER::MIN] = aPin.m_Rpin;
m_Rpin.value[IBIS_CORNER::MAX] = aPin.m_Rpin;
}
if( !isnan( aPin.m_Lpin ) )
{
m_Lpin.value[IBIS_CORNER::TYP] = aPin.m_Lpin;
m_Lpin.value[IBIS_CORNER::MIN] = aPin.m_Lpin;
m_Lpin.value[IBIS_CORNER::MAX] = aPin.m_Lpin;
}
if( !isnan( aPin.m_Cpin ) )
{
m_Cpin.value[IBIS_CORNER::TYP] = aPin.m_Cpin;
@ -199,6 +203,7 @@ KIBIS_PIN::KIBIS_PIN( KIBIS* aTopLevel, IbisComponentPin& aPin, IbisComponentPac
m_valid = true;
}
KIBIS_MODEL::KIBIS_MODEL( KIBIS* aTopLevel, IbisModel& aSource, IbisParser& aParser ) :
KIBIS_ANY( aTopLevel ), m_C_comp( aTopLevel->m_reporter ),
m_voltageRange( aTopLevel->m_reporter ), m_temperatureRange( aTopLevel->m_reporter ),
@ -262,6 +267,7 @@ KIBIS_MODEL::KIBIS_MODEL( KIBIS* aTopLevel, IbisModel& aSource, IbisParser& aPar
m_valid = status;
}
KIBIS_COMPONENT::KIBIS_COMPONENT( KIBIS* aTopLevel, IbisComponent& aSource, IbisParser& aParser ) :
KIBIS_ANY( aTopLevel )
{
@ -287,6 +293,7 @@ KIBIS_COMPONENT::KIBIS_COMPONENT( KIBIS* aTopLevel, IbisComponent& aSource, Ibis
m_valid = status;
}
KIBIS_PIN* KIBIS_COMPONENT::GetPin( std::string aPinNumber )
{
for( KIBIS_PIN& pin : m_pins )
@ -306,9 +313,9 @@ std::vector<std::pair<IbisWaveform*, IbisWaveform*>> KIBIS_MODEL::waveformPairs(
IbisWaveform* wf1;
IbisWaveform* wf2;
for( int i = 0; i < m_risingWaveforms.size(); i++ )
for( size_t i = 0; i < m_risingWaveforms.size(); i++ )
{
for( int j = 0; j < m_fallingWaveforms.size(); j++ )
for( size_t j = 0; j < m_fallingWaveforms.size(); j++ )
{
wf1 = m_risingWaveforms.at( i );
wf2 = m_fallingWaveforms.at( j );
@ -329,6 +336,7 @@ std::vector<std::pair<IbisWaveform*, IbisWaveform*>> KIBIS_MODEL::waveformPairs(
return pairs;
}
std::string KIBIS_MODEL::SpiceDie( KIBIS_PARAMETER& aParam, int aIndex )
{
std::string result;
@ -400,6 +408,7 @@ std::string KIBIS_MODEL::SpiceDie( KIBIS_PARAMETER& aParam, int aIndex )
return result;
}
IbisWaveform KIBIS_MODEL::TrimWaveform( IbisWaveform& aIn )
{
IbisWaveform out( aIn.m_reporter );
@ -422,7 +431,6 @@ IbisWaveform KIBIS_MODEL::TrimWaveform( IbisWaveform& aIn )
}
out.m_table.m_entries.clear();
bool kept = false;
for( int i = 0; i < nbPoints; i++ )
{
@ -441,23 +449,31 @@ IbisWaveform KIBIS_MODEL::TrimWaveform( IbisWaveform& aIn )
return out;
}
bool KIBIS_MODEL::HasPulldown()
{
return m_pulldown.m_entries.size() > 0;
}
bool KIBIS_MODEL::HasPullup()
{
return m_pullup.m_entries.size() > 0;
}
bool KIBIS_MODEL::HasGNDClamp()
{
return m_GNDClamp.m_entries.size() > 0;
}
bool KIBIS_MODEL::HasPOWERClamp()
{
return m_POWERClamp.m_entries.size() > 0;
}
std::string KIBIS_MODEL::generateSquareWave( std::string aNode1, std::string aNode2,
std::vector<std::pair<int, double>> aBits,
std::pair<IbisWaveform*, IbisWaveform*> aPair,
@ -528,10 +544,10 @@ std::string KIBIS_MODEL::generateSquareWave( std::string aNode1, std::string aNo
simul += aNode2;
simul += " v=(";
for( int i = 0; i < aBits.size(); i++ )
for( size_t ii = 0; ii < aBits.size(); ii++ )
{
simul += " v( stimuli";
simul += std::to_string( i );
simul += std::to_string( ii );
simul += " ) + ";
}
@ -550,6 +566,7 @@ std::string KIBIS_MODEL::generateSquareWave( std::string aNode1, std::string aNo
return simul;
}
std::string KIBIS_PIN::addDie( KIBIS_MODEL& aModel, KIBIS_PARAMETER& aParam, int aIndex )
{
IBIS_CORNER supply = aParam.m_supply;
@ -601,6 +618,7 @@ std::string KIBIS_PIN::addDie( KIBIS_MODEL& aModel, KIBIS_PARAMETER& aParam, int
return simul;
}
void KIBIS_PIN::getKuKdFromFile( std::string* aSimul )
{
// @TODO
@ -631,12 +649,15 @@ void KIBIS_PIN::getKuKdFromFile( std::string* aSimul )
if( KuKdfile )
{
std::string line;
for( int i = 0; i < 11; i++ ) // number of line in the ngspice output header
{
std::getline( KuKdfile, line );
}
int i = 0;
double t_v, ku_v, kd_v;
while( KuKdfile )
{
std::getline( KuKdfile, line );
@ -645,6 +666,7 @@ void KIBIS_PIN::getKuKdFromFile( std::string* aSimul )
{
continue;
}
switch( i )
{
case 0:
@ -662,6 +684,7 @@ void KIBIS_PIN::getKuKdFromFile( std::string* aSimul )
}
i = ( i + 1 ) % 3;
}
std::getline( KuKdfile, line );
}
else
@ -686,6 +709,7 @@ void KIBIS_PIN::getKuKdFromFile( std::string* aSimul )
m_t = t;
}
std::string KIBIS_PIN::KuKdDriver( KIBIS_MODEL& aModel,
std::pair<IbisWaveform*, IbisWaveform*> aPair,
KIBIS_PARAMETER& aParam, int aIndex )
@ -799,6 +823,7 @@ std::string KIBIS_PIN::KuKdDriver( KIBIS_MODEL& aMode
return simul;
}
void KIBIS_PIN::getKuKdOneWaveform( KIBIS_MODEL& aModel,
std::pair<IbisWaveform*, IbisWaveform*> aPair,
KIBIS_PARAMETER& aParam )
@ -898,6 +923,7 @@ void KIBIS_PIN::getKuKdOneWaveform( KIBIS_MODEL& aMod
}
}
void KIBIS_PIN::getKuKdNoWaveform( KIBIS_MODEL& aModel, KIBIS_PARAMETER& aParam )
{
std::vector<double> ku, kd, t;
@ -961,6 +987,7 @@ void KIBIS_PIN::getKuKdNoWaveform( KIBIS_MODEL& aModel, KIBIS_PARAMETER& aParam
m_t = t;
}
void KIBIS_PIN::getKuKdTwoWaveforms( KIBIS_MODEL& aModel,
std::pair<IbisWaveform*, IbisWaveform*> aPair1,
std::pair<IbisWaveform*, IbisWaveform*> aPair2,
@ -1086,6 +1113,7 @@ void KIBIS_PIN::getKuKdTwoWaveforms( KIBIS_MODEL& aMo
}
}
bool KIBIS_PIN::writeSpiceDriver( std::string* aDest, std::string aName, KIBIS_MODEL& aModel,
KIBIS_PARAMETER& aParam )
{
@ -1170,18 +1198,21 @@ bool KIBIS_PIN::writeSpiceDriver( std::string* aDest, std::string aName, KIBIS_M
}
result += "Vku KU GND pwl ( ";
for( int i = 0; i < m_t.size(); i++ )
for( size_t i = 0; i < m_t.size(); i++ )
{
result += doubleToString( m_t.at( i ) );
result += " ";
result += doubleToString( m_Ku.at( i ) );
result += " ";
}
result += ") \n";
result += "Vkd KD GND pwl ( ";
for( int i = 0; i < m_t.size(); i++ )
for( size_t i = 0; i < m_t.size(); i++ )
{
result += doubleToString( m_t.at( i ) );
result += " ";
@ -1256,6 +1287,7 @@ bool KIBIS_PIN::writeSpiceDevice( std::string* aDest, std::string aName, KIBIS_M
return status;
}
bool KIBIS_PIN::writeSpiceDiffDriver( std::string* aDest, std::string aName, KIBIS_MODEL& aModel,
KIBIS_PARAMETER& aParam )
{
@ -1306,6 +1338,7 @@ bool KIBIS_PIN::writeSpiceDiffDriver( std::string* aDest, std::string aName, KIB
return status;
}
bool KIBIS_PIN::writeSpiceDiffDevice( std::string* aDest, std::string aName, KIBIS_MODEL& aModel,
KIBIS_PARAMETER& aParam )
{
@ -1371,6 +1404,7 @@ KIBIS_COMPONENT* KIBIS::GetComponent( std::string aName )
return nullptr;
}
void KIBIS_PARAMETER::SetCornerFromString( IBIS_CORNER& aCorner, std::string aString )
{
if( aString == "MIN" )

View File

@ -5,18 +5,18 @@
*
* 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
@ -99,21 +99,21 @@ public:
};
/** 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
* _ 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 up to two waveforms
* _ Driver: Use _DUT info if at least one waveform
*/
enum class KIBIS_ACCURACY
@ -224,7 +224,7 @@ public:
bool HasPOWERClamp();
/** @brief Generate the spice directive to simulate the die
*
*
* @param aParam Parameters
* @param aIndex Index used to offset spice nodes / directives
* @return A multiline string with spice directives
@ -232,21 +232,21 @@ public:
std::string SpiceDie( KIBIS_PARAMETER& aParam, 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.
*
* 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 ).
@ -262,8 +262,8 @@ public:
/** @brief Copy a waveform, and substract the first value to all samples
*
*
*
*
* @param aIn Input waveform
* @return Output waveform
*/
@ -321,7 +321,7 @@ public:
KIBIS_PARAMETER& aParam );
/** @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()
@ -334,23 +334,23 @@ public:
KIBIS_PARAMETER& aParam );
/** @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 aParam Parameters
* @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_PARAMETER& aParam, 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 aParam Parameters
* @param aIndex Index for numbering ports
@ -360,11 +360,11 @@ public:
/** @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 );
@ -382,7 +382,7 @@ public:
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
*/