KiCad PCB EDA Suite
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
kibis.cpp
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 Fabien Corona f.corona<at>laposte.net
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * Redistribution and use in source and binary forms, with or without modification,
8 * are permitted provided that the following conditions are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright notice,
11 * this list of conditions and the following disclaimer.
12 *
13 * 2. Redistributions in binary form must reproduce the above copyright notice,
14 * this list of conditions and the following disclaimer in the documentation
15 * and/or other materials provided with the distribution.
16 *
17 * 3. Neither the name of the copyright holder nor the names of its contributors may be used
18 * to endorse or promote products derived from this software without specific
19 * prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
22 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
23 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32
33#include "kibis.h"
34#include "ibis_parser.h"
35#include <sstream>
36#include <sim/spice_simulator.h>
37
38
39// _() is used here to mark translatable strings in IBIS_REPORTER::Report()
40// However, currently non ASCII7 chars are nor correctly handled when printing messages
41// So we disable translations
42#if 0
43#include <wx/intl.h> // for _() macro and wxGetTranslation()
44#else
45#undef _
46#define _( x ) x
47#endif
48
49
50std::vector<std::pair<int, double>>
51SimplifyBitSequence( const std::vector<std::pair<int, double>>& bits )
52{
53 std::vector<std::pair<int, double>> result;
54 int prevbit = -1;
55
56 for( const std::pair<int, double>& bit : bits )
57 {
58 if( prevbit != bit.first )
59 result.push_back( bit );
60
61 prevbit = bit.first;
62 }
63
64 return result;
65}
66
67
69 KIBIS_BASE( aTopLevel, aTopLevel->m_Reporter )
70{
71}
72
73
74KIBIS_BASE::KIBIS_BASE( KIBIS* aTopLevel, REPORTER* aReporter ) :
75 IBIS_BASE( aReporter ),
76 m_topLevel( aTopLevel ),
77 m_valid( false )
78{
79}
80
81
83{
85
86 if( aIn == IBIS_CORNER::MIN )
87 out = IBIS_CORNER::MAX;
88 else if( aIn == IBIS_CORNER::MAX )
89 out = IBIS_CORNER::MIN;
90
91 return out;
92}
93
94KIBIS::KIBIS( const std::string& aFileName, REPORTER* aReporter ) :
95 KIBIS_BASE( this, aReporter ),
96 m_file( *this )
97{
98 IbisParser parser( m_Reporter );
99 bool status = true;
100
101 parser.m_parrot = false;
102 status &= parser.ParseFile( aFileName );
103
104 status &= m_file.Init( parser );
105
106 for( const IbisModel& iModel : parser.m_ibisFile.m_models )
107 {
108 KIBIS_MODEL& kModel = m_models.emplace_back( *this, iModel, parser );
109 status &= kModel.m_valid;
110 }
111
112 for( const IbisComponent& iComponent : parser.m_ibisFile.m_components )
113 {
114 KIBIS_COMPONENT& kComponent = m_components.emplace_back( *this, iComponent, parser );
115 status &= kComponent.m_valid;
116
117 for( KIBIS_PIN& pin : kComponent.m_pins )
118 pin.m_parent = &kComponent;
119
120 for( const IbisDiffPinEntry& dpEntry : iComponent.m_diffPin.m_entries )
121 {
122 KIBIS_PIN* pinA = kComponent.GetPin( dpEntry.pinA );
123 KIBIS_PIN* pinB = kComponent.GetPin( dpEntry.pinB );
124
125 if( pinA && pinB )
126 {
127 pinA->m_complementaryPin = pinB;
128 pinB->m_complementaryPin = pinA;
129 }
130 }
131 }
132
133 m_valid = status;
134}
135
136
138 KIBIS_BASE( &aTopLevel )
139{
140 m_fileRev = -1;
141 m_ibisVersion = -1;
142}
143
144
145bool KIBIS_FILE::Init( const IbisParser& aParser )
146{
147 bool status = true;
155
156 m_valid = status;
157
158 return status;
159}
160
161
163 const IbisComponentPackage& aPackage, IbisParser& aParser,
164 KIBIS_COMPONENT* aParent, std::vector<KIBIS_MODEL>& aModels ) :
165 KIBIS_BASE( &aTopLevel ),
166 m_Rpin( aTopLevel.m_Reporter ),
167 m_Lpin( aTopLevel.m_Reporter ),
168 m_Cpin( aTopLevel.m_Reporter )
169{
171 m_pinNumber = aPin.m_pinName;
172 m_parent = aParent;
173
174 m_Rpin = aPackage.m_Rpkg;
175 m_Lpin = aPackage.m_Lpkg;
176 m_Cpin = aPackage.m_Cpkg;
177
178 // The values listed in the [Pin] description section override the default
179 // values defined in [Package]
180
181 // @TODO : Reading the IBIS standard, I can't figure out if we are supposed
182 // to replace typ, min, and max, or just the typ ?
183
184 if( !std::isnan( aPin.m_Rpin ) )
185 {
186 m_Rpin.value[IBIS_CORNER::TYP] = aPin.m_Rpin;
187 m_Rpin.value[IBIS_CORNER::MIN] = aPin.m_Rpin;
188 m_Rpin.value[IBIS_CORNER::MAX] = aPin.m_Rpin;
189 }
190
191 if( !std::isnan( aPin.m_Lpin ) )
192 {
193 m_Lpin.value[IBIS_CORNER::TYP] = aPin.m_Lpin;
194 m_Lpin.value[IBIS_CORNER::MIN] = aPin.m_Lpin;
195 m_Lpin.value[IBIS_CORNER::MAX] = aPin.m_Lpin;
196 }
197
198 if( !std::isnan( aPin.m_Cpin ) )
199 {
200 m_Cpin.value[IBIS_CORNER::TYP] = aPin.m_Cpin;
201 m_Cpin.value[IBIS_CORNER::MIN] = aPin.m_Cpin;
202 m_Cpin.value[IBIS_CORNER::MAX] = aPin.m_Cpin;
203 }
204
205 bool modelSelected = false;
206 std::vector<std::string> listOfModels;
207
208 for( const IbisModelSelector& modelSelector : aParser.m_ibisFile.m_modelSelectors )
209 {
210 if( !strcmp( modelSelector.m_name.c_str(), aPin.m_modelName.c_str() ) )
211 {
212 for( const IbisModelSelectorEntry& model : modelSelector.m_models )
213 listOfModels.push_back( model.m_modelName );
214
215 modelSelected = true;
216 break;
217 }
218 }
219
220 if( !modelSelected )
221 listOfModels.push_back( aPin.m_modelName );
222
223 for( const std::string& modelName : listOfModels )
224 {
225 for( KIBIS_MODEL& model : aModels )
226 {
227 if( !strcmp( model.m_name.c_str(), modelName.c_str() ) )
228 m_models.push_back( &model );
229 }
230 }
231
232 m_valid = true;
233}
234
235
236KIBIS_MODEL::KIBIS_MODEL( KIBIS& aTopLevel, const IbisModel& aSource, IbisParser& aParser ) :
237 KIBIS_BASE( &aTopLevel ),
238 m_C_comp( aTopLevel.m_Reporter ),
239 m_voltageRange( aTopLevel.m_Reporter ),
240 m_temperatureRange( aTopLevel.m_Reporter ),
241 m_pullupReference( aTopLevel.m_Reporter ),
242 m_pulldownReference( aTopLevel.m_Reporter ),
243 m_GNDClampReference( aTopLevel.m_Reporter ),
244 m_POWERClampReference( aTopLevel.m_Reporter ),
245 m_Rgnd( aTopLevel.m_Reporter ),
246 m_Rpower( aTopLevel.m_Reporter ),
247 m_Rac( aTopLevel.m_Reporter ),
248 m_Cac( aTopLevel.m_Reporter ),
249 m_GNDClamp( aTopLevel.m_Reporter ),
250 m_POWERClamp( aTopLevel.m_Reporter ),
251 m_pullup( aTopLevel.m_Reporter ),
252 m_pulldown( aTopLevel.m_Reporter ),
253 m_ramp( aTopLevel.m_Reporter )
254{
255 bool status = true;
256
257 m_name = aSource.m_name;
258 m_type = aSource.m_type;
259
260 m_description = std::string( "No description available." );
261
262 for( const IbisModelSelector& modelSelector : aParser.m_ibisFile.m_modelSelectors )
263 {
264 for( const IbisModelSelectorEntry& entry : modelSelector.m_models )
265 {
266 if( !strcmp( entry.m_modelName.c_str(), m_name.c_str() ) )
268 }
269 }
270
271 m_vinh = aSource.m_vinh;
272 m_vinl = aSource.m_vinl;
273 m_vref = aSource.m_vref;
274 m_rref = aSource.m_rref;
275 m_cref = aSource.m_cref;
276 m_vmeas = aSource.m_vmeas;
277
278 m_enable = aSource.m_enable;
279 m_polarity = aSource.m_polarity;
280
281 m_ramp = aSource.m_ramp;
284 m_GNDClamp = aSource.m_GNDClamp;
286 m_POWERClamp = aSource.m_POWERClamp;
288
289 m_C_comp = aSource.m_C_comp;
294
295 m_Rgnd = aSource.m_Rgnd;
296 m_Rpower = aSource.m_Rpower;
297 m_Rac = aSource.m_Rac;
298 m_Cac = aSource.m_Cac;
299 m_pullup = aSource.m_pullup;
300 m_pulldown = aSource.m_pulldown;
301
302 m_valid = status;
303}
304
305
307 IbisParser& aParser ) :
308 KIBIS_BASE( &aTopLevel )
309{
310 bool status = true;
311
312 m_name = aSource.m_name;
314
315 for( const IbisComponentPin& iPin : aSource.m_pins )
316 {
317 if( iPin.m_dummy )
318 continue;
319
320 KIBIS_PIN kPin( aTopLevel, iPin, aSource.m_package, aParser, nullptr,
322 status &= kPin.m_valid;
323 m_pins.push_back( kPin );
324 }
325
326 m_valid = status;
327}
328
329
330KIBIS_PIN* KIBIS_COMPONENT::GetPin( const std::string& aPinNumber )
331{
332 for( KIBIS_PIN& pin : m_pins )
333 {
334 if( pin.m_pinNumber == aPinNumber )
335 return &pin;
336 }
337
338 return nullptr;
339}
340
341std::vector<std::pair<IbisWaveform*, IbisWaveform*>> KIBIS_MODEL::waveformPairs()
342{
343 std::vector<std::pair<IbisWaveform*, IbisWaveform*>> pairs;
344 IbisWaveform* wf1;
345 IbisWaveform* wf2;
346
347 for( size_t i = 0; i < m_risingWaveforms.size(); i++ )
348 {
349 for( size_t j = 0; j < m_fallingWaveforms.size(); j++ )
350 {
351 wf1 = m_risingWaveforms.at( i );
352 wf2 = m_fallingWaveforms.at( j );
353
354 if( wf1->m_R_fixture == wf2->m_R_fixture && wf1->m_L_fixture == wf2->m_L_fixture
355 && wf1->m_C_fixture == wf2->m_C_fixture && wf1->m_V_fixture == wf2->m_V_fixture
356 && wf1->m_V_fixture_min == wf2->m_V_fixture_min
357 && wf1->m_V_fixture_max == wf2->m_V_fixture_max )
358 {
359 pairs.emplace_back( wf1, wf2 );
360 }
361 }
362 }
363
364 return pairs;
365}
366
367
368std::string KIBIS_MODEL::SpiceDie( const KIBIS_PARAMETER& aParam, int aIndex ) const
369{
370 std::string result;
371
372 std::string GC_GND = "GC_GND";
373 std::string PC_PWR = "PC_PWR";
374 std::string PU_PWR = "PU_PWR";
375 std::string PD_GND = "PD_GND";
376 std::string DIE = "DIE";
377 std::string DIEBUFF = "DIEBUFF";
378
379 IBIS_CORNER supply = aParam.m_supply;
380 IBIS_CORNER ccomp = aParam.m_Ccomp;
381
382 GC_GND += std::to_string( aIndex );
383 PC_PWR += std::to_string( aIndex );
384 PU_PWR += std::to_string( aIndex );
385 PD_GND += std::to_string( aIndex );
386 DIE += std::to_string( aIndex );
387 DIEBUFF += std::to_string( aIndex );
388
389
390 std::string GC = "GC";
391 std::string PC = "PC";
392 std::string PU = "PU";
393 std::string PD = "PD";
394
395 GC += std::to_string( aIndex );
396 PC += std::to_string( aIndex );
397 PU += std::to_string( aIndex );
398 PD += std::to_string( aIndex );
399
400 result = "\n";
401 result += "VPWR POWER GND ";
402 result += doubleToString( m_voltageRange.value[supply] );
403 result += "\n";
404 result += "CCPOMP " + DIE + " GND ";
405 result += doubleToString( m_C_comp.value[ccomp] );
406 result += "\n";
407
408 if( HasGNDClamp() )
409 {
410 result += m_GNDClamp.Spice( aIndex * 4 + 1, DIE, GC_GND, GC, supply );
411 result += "VmeasGC GND " + GC_GND + " 0\n";
412 }
413
414 if( HasPOWERClamp() )
415 {
416 result += m_POWERClamp.Spice( aIndex * 4 + 2, "POWER", DIE, PC, supply );
417 result += "VmeasPC POWER " + PC_PWR + " 0\n";
418 }
419
420 if( HasPulldown() )
421 {
422 result += m_pulldown.Spice( aIndex * 4 + 3, DIEBUFF, PD_GND, PD, supply );
423 result += "VmeasPD GND " + PD_GND + " 0\n";
424 result += "BKD GND " + DIE + " i=( i(VmeasPD) * v(KD) )\n";
425 }
426
427 if( HasPullup() )
428 {
429 result += m_pullup.Spice( aIndex * 4 + 4, PU_PWR, DIEBUFF, PU, supply );
430 result += "VmeasPU POWER " + PU_PWR + " 0\n";
431 result += "BKU POWER " + DIE + " i=( -i(VmeasPU) * v(KU) )\n";
432 }
433
434 if ( HasPullup() || HasPulldown() )
435 result += "BDIEBUFF " + DIEBUFF + " GND v=v(" + DIE + ")\n";
436
437 return result;
438}
439
440
442{
443 IbisWaveform out( aIn.m_Reporter );
444
445 const int nbPoints = aIn.m_table.m_entries.size();
446
447 if( nbPoints < 2 )
448 {
449 Report( _( "waveform has less than two points" ), RPT_SEVERITY_ERROR );
450 return out;
451 }
452
453 const double DCtyp = aIn.m_table.m_entries[0].V.value[IBIS_CORNER::TYP];
454 const double DCmin = aIn.m_table.m_entries[0].V.value[IBIS_CORNER::MIN];
455 const double DCmax = aIn.m_table.m_entries[0].V.value[IBIS_CORNER::MAX];
456
457 if( nbPoints == 2 )
458 return out;
459
460 out.m_table.m_entries.clear();
461
462 for( int i = 0; i < nbPoints; i++ )
463 {
464 const VTtableEntry& inEntry = aIn.m_table.m_entries.at( i );
465 VTtableEntry& outEntry = out.m_table.m_entries.emplace_back( out.m_Reporter );
466
467 outEntry.t = inEntry.t;
468 outEntry.V.value[IBIS_CORNER::TYP] = inEntry.V.value[IBIS_CORNER::TYP] - DCtyp;
469 outEntry.V.value[IBIS_CORNER::MIN] = inEntry.V.value[IBIS_CORNER::MIN] - DCmin;
470 outEntry.V.value[IBIS_CORNER::MAX] = inEntry.V.value[IBIS_CORNER::MAX] - DCmax;
471 }
472
473 return out;
474}
475
476
478{
479 return m_pulldown.m_entries.size() > 0;
480}
481
482
484{
485 return m_pullup.m_entries.size() > 0;
486}
487
488
490{
491 return m_GNDClamp.m_entries.size() > 0;
492}
493
494
496{
497 return m_POWERClamp.m_entries.size() > 0;
498}
499
500
501std::string KIBIS_MODEL::generateSquareWave( const std::string& aNode1, const std::string& aNode2,
502 const std::vector<std::pair<int, double>>& aBits,
503 const std::pair<IbisWaveform*, IbisWaveform*>& aPair,
504 const KIBIS_PARAMETER& aParam )
505{
506 const IBIS_CORNER supply = aParam.m_supply;
507 std::string simul;
508 std::vector<int> stimuliIndex;
509
510 IbisWaveform risingWF = TrimWaveform( *( aPair.first ) );
511 IbisWaveform fallingWF = TrimWaveform( *( aPair.second ) );
512
513 double deltaR = risingWF.m_table.m_entries.back().V.value[supply]
514 - risingWF.m_table.m_entries.at( 0 ).V.value[supply];
515 double deltaF = fallingWF.m_table.m_entries.back().V.value[supply]
516 - fallingWF.m_table.m_entries.at( 0 ).V.value[supply];
517
518 // Ideally, delta should be equal to zero.
519 // It can be different from zero if the falling waveform does not start were the rising one ended.
520 double delta = deltaR + deltaF;
521
522 int i = 0;
523
524 int prevBit = 2;
525
526 for( const std::pair<int, double>& bit : aBits )
527 {
529 double timing = bit.second;
530
531
532 if ( bit.first != prevBit )
533 {
534 if( bit.first == 1 )
535 WF = &risingWF;
536 else
537 WF = &fallingWF;
538
539 stimuliIndex.push_back( i );
540
541 simul += "Vstimuli";
542 simul += std::to_string( i );
543 simul += " stimuli";
544 simul += std::to_string( i );
545 simul += " ";
546 simul += aNode2;
547 simul += " pwl ( \n+";
548
549 if( i != 0 )
550 {
551 simul += "0 0 ";
552 VTtableEntry entry0 = WF->m_table.m_entries.at( 0 );
553 VTtableEntry entry1 = WF->m_table.m_entries.at( 1 );
554 double deltaT = entry1.t - entry0.t;
555
556 simul += doubleToString( entry0.t + timing - deltaT );
557 simul += " ";
558 simul += "0";
559 simul += "\n+";
560 }
561
562 for( const VTtableEntry& entry : WF->m_table.m_entries )
563 {
564 simul += doubleToString( entry.t + timing );
565 simul += " ";
566 simul += doubleToString( entry.V.value[supply] - delta );
567 simul += "\n+";
568 }
569
570 simul += ")\n";
571 }
572
573 i++;
574 prevBit = bit.first;
575 }
576
577 simul += "bin ";
578 simul += aNode1;
579 simul += " ";
580 simul += aNode2;
581 simul += " v=(";
582
583 for( int ii: stimuliIndex )
584 {
585 simul += " v( stimuli";
586 simul += std::to_string( ii );
587 simul += " ) +\n+";
588 }
589
590 // Depending on the first bit, we add a different DC value
591 // The DC value we add is the first value of the first bit.
592 if( ( aBits.size() > 0 ) && ( aBits[0].first == 0 ) )
593 simul += doubleToString( aPair.second->m_table.m_entries.at( 0 ).V.value[supply] );
594 else
595 simul += doubleToString( aPair.first->m_table.m_entries.at( 0 ).V.value[supply] );
596
597 simul += ")\n";
598 return simul;
599}
600
601
602std::string KIBIS_PIN::addDie( KIBIS_MODEL& aModel, const KIBIS_PARAMETER& aParam, int aIndex )
603{
604 const IBIS_CORNER supply = aParam.m_supply;
605 std::string simul;
606
607 std::string GC_GND = "GC_GND";
608 std::string PC_PWR = "PC_PWR";
609 std::string PU_PWR = "PU_PWR";
610 std::string PD_GND = "PD_GND";
611 std::string DIE = "DIE";
612
613 GC_GND += std::to_string( aIndex );
614 PC_PWR += std::to_string( aIndex );
615 PU_PWR += std::to_string( aIndex );
616 PD_GND += std::to_string( aIndex );
617 DIE += std::to_string( aIndex );
618
619
620 std::string GC = "GC";
621 std::string PC = "PC";
622 std::string PU = "PU";
623 std::string PD = "PD";
624
625 GC += std::to_string( aIndex );
626 PC += std::to_string( aIndex );
627 PU += std::to_string( aIndex );
628 PD += std::to_string( aIndex );
629
630 if( aModel.HasGNDClamp() )
631 simul += aModel.m_GNDClamp.Spice( aIndex * 4 + 1, DIE, GC_GND, GC, supply );
632
633 if( aModel.HasPOWERClamp() )
634 simul += aModel.m_POWERClamp.Spice( aIndex * 4 + 2, PC_PWR, DIE, PC, supply );
635
636 if( aModel.HasPulldown() )
637 simul += aModel.m_pulldown.Spice( aIndex * 4 + 3, DIE, PD_GND, PD, supply );
638
639 if( aModel.HasPullup() )
640 simul += aModel.m_pullup.Spice( aIndex * 4 + 4, PU_PWR, DIE, PU, supply );
641
642 return simul;
643}
644
645
646void KIBIS_PIN::getKuKdFromFile( const std::string& aSimul )
647{
648 const std::string outputFileName = m_topLevel->m_cacheDir + "temp_output.spice";
649
650 if( std::remove( outputFileName.c_str() ) )
651 Report( _( "Cannot remove temporary output file" ), RPT_SEVERITY_WARNING );
652
653 std::shared_ptr<SPICE_SIMULATOR> ng = SIMULATOR::CreateInstance( "ng-kibis" );
654
655 if( !ng )
656 throw std::runtime_error( "Could not create simulator instance" );
657
658 ng->Init();
659 ng->LoadNetlist( aSimul );
660
661 std::ifstream KuKdfile;
662 KuKdfile.open( outputFileName );
663
664 std::vector<double> ku, kd, t;
665
666 if( KuKdfile )
667 {
668 std::string line;
669
670 while( std::getline( KuKdfile, line ) ) // skip ngspice output header
671 {
672 if( line.find( "Values:" ) != std::string::npos )
673 {
674 break;
675 }
676 }
677
678 int i = 0;
679 double t_v, ku_v, kd_v;
680
681 while( KuKdfile )
682 {
683 std::getline( KuKdfile, line );
684
685 if( line.empty() )
686 continue;
687
688 switch( i )
689 {
690 case 0:
691 line = line.substr( line.find_first_of( "\t" ) + 1 );
692 t_v = std::stod( line );
693 break;
694 case 1: ku_v = std::stod( line ); break;
695 case 2:
696 kd_v = std::stod( line );
697 ku.push_back( ku_v );
698 kd.push_back( kd_v );
699 t.push_back( t_v );
700 break;
701 default:
702 Report( _( "Error while reading temporary file" ), RPT_SEVERITY_ERROR );
703 }
704
705 i = ( i + 1 ) % 3;
706 }
707
708 std::getline( KuKdfile, line );
709 }
710 else
711 {
712 Report( _( "Error while creating temporary output file" ), RPT_SEVERITY_ERROR );
713 }
714
715 if( std::remove( outputFileName.c_str() ) )
716 {
717 Report( _( "Cannot remove temporary output file" ), RPT_SEVERITY_WARNING );
718 }
719
720 m_Ku = ku;
721 m_Kd = kd;
722 m_t = t;
723}
724
725
727 const std::pair<IbisWaveform*, IbisWaveform*>& aPair,
728 const KIBIS_PARAMETER& aParam, int aIndex )
729{
730 IBIS_CORNER supply = aParam.m_supply;
731 IBIS_CORNER ccomp = aParam.m_Ccomp;
732 KIBIS_WAVEFORM* wave = aParam.m_waveform;
733
734 std::string simul = "";
735
736 simul += "*THIS IS NOT A VALID SPICE MODEL.\n";
737 simul += "*This part is intended to be executed by Kibis internally.\n";
738 simul += "*You should not be able to read this.\n\n";
739
740 simul += ".SUBCKT DRIVER";
741 simul += std::to_string( aIndex );
742 simul += " POWER GND PIN \n"; // 1: POWER, 2:GND, 3:PIN
743
744 simul += "Vdummy 2 PIN 0\n";
745
746 if( ( aPair.first->m_R_dut != 0 ) || ( aPair.first->m_L_dut != 0 )
747 || ( aPair.first->m_C_dut != 0 ) )
748 {
749 Report( _( "Kibis does not support DUT values yet. "
750 "https://ibis.org/summits/nov16a/chen.pdf" ),
752 }
753
754 simul += "\n";
755 simul += "CCPOMP 2 GND ";
756 simul += doubleToString( aModel.m_C_comp.value[ccomp] ); //@TODO: Check the corner ?
757 simul += "\n";
758
759 const IbisWaveform* risingWF = aPair.first;
760 const IbisWaveform* fallingWF = aPair.second;
761
762 switch( wave->GetType() )
763 {
764 case KIBIS_WAVEFORM_TYPE::RECTANGULAR:
765 case KIBIS_WAVEFORM_TYPE::PRBS:
766 {
767 wave->Check( risingWF, fallingWF );
768 std::vector<std::pair<int, double>> bits = wave->GenerateBitSequence();
769 bits = SimplifyBitSequence( bits );
770 simul += aModel.generateSquareWave( "DIE0", "GND", bits, aPair, aParam );
771 break;
772 }
773 case KIBIS_WAVEFORM_TYPE::STUCK_HIGH:
774 {
775 const IbisWaveform* waveform = wave->inverted ? risingWF : fallingWF;
776 simul += "Vsig DIE0 GND ";
777 simul += doubleToString( waveform->m_table.m_entries.at( 0 ).V.value[supply] );
778 simul += "\n";
779 break;
780 }
781 case KIBIS_WAVEFORM_TYPE::STUCK_LOW:
782 {
783 const IbisWaveform* waveform = wave->inverted ? fallingWF : risingWF;
784 simul += "Vsig DIE0 GND ";
785 simul += doubleToString( waveform->m_table.m_entries.at( 0 ).V.value[supply] );
786 simul += "\n";
787 break;
788 }
789 case KIBIS_WAVEFORM_TYPE::NONE:
790 case KIBIS_WAVEFORM_TYPE::HIGH_Z:
791 default:
792 break;
793 }
794
795 simul += addDie( aModel, aParam, 0 );
796
797 simul += "\n.ENDS DRIVER\n\n";
798 return simul;
799}
800
801
803 const std::pair<IbisWaveform*, IbisWaveform*>& aPair,
804 const KIBIS_PARAMETER& aParam )
805{
806 IBIS_CORNER supply = aParam.m_supply;
807 const KIBIS_WAVEFORM* wave = aParam.m_waveform;
808
809 std::string simul = "";
810
811 if( !wave )
812 return;
813
814 if( wave->GetType() == KIBIS_WAVEFORM_TYPE::NONE )
815 {
816 //@TODO , there could be some current flowing through pullup / pulldown transistors, even when off
817 std::vector<double> ku, kd, t;
818 ku.push_back( 0 );
819 kd.push_back( 0 );
820 t.push_back( 0 );
821 m_Ku = ku;
822 m_Kd = kd;
823 m_t = t;
824 }
825 else
826 {
827 simul += KuKdDriver( aModel, aPair, aParam, 0 );
828 simul += "\n x1 3 0 1 DRIVER0 \n";
829
830 simul += "VCC 3 0 ";
831 simul += doubleToString( aModel.m_voltageRange.value[supply] );
832 simul += "\n";
833 //simul += "Vpin x1.DIE 0 1 \n"
834 simul += "Lfixture 1 4 ";
835 simul += doubleToString( aPair.first->m_L_fixture );
836 simul += "\n";
837 simul += "Rfixture 4 5 ";
838 simul += doubleToString( aPair.first->m_R_fixture );
839 simul += "\n";
840 simul += "Cfixture 4 0 ";
841 simul += doubleToString( aPair.first->m_C_fixture );
842 simul += "\n";
843 simul += "Vfixture 5 0 ";
844 simul += doubleToString( aPair.first->m_V_fixture );
845 simul += "\n";
846 simul += "VmeasIout x1.DIE0 x1.2 0\n";
847 simul += "VmeasPD 0 x1.PD_GND0 0\n";
848 simul += "VmeasPU x1.PU_PWR0 3 0\n";
849 simul += "VmeasPC x1.PC_PWR0 3 0\n";
850 simul += "VmeasGC 0 x1.GC_GND0 0\n";
851
852 if( aModel.HasPullup() && aModel.HasPulldown() )
853 {
854 Report( _( "Model has only one waveform pair, reduced accuracy" ),
856 simul += "Bku KU 0 v=( (i(VmeasIout)-i(VmeasPC)-i(VmeasGC)-i(VmeasPD) "
857 ")/(i(VmeasPU)-i(VmeasPD)))\n";
858 simul += "Bkd KD 0 v=(1-v(KU))\n";
859 }
860
861 else if( !aModel.HasPullup() && aModel.HasPulldown() )
862 {
863 simul += "Bku KD 0 v=( ( i(VmeasIout)+i(VmeasPC)+i(VmeasGC) )/(i(VmeasPD)))\n";
864 simul += "Bkd KU 0 v=0\n";
865 }
866
867 else if( aModel.HasPullup() && !aModel.HasPulldown() )
868 {
869 simul += "Bku KU 0 v=( ( i(VmeasIout)+i(VmeasPC)+i(VmeasGC) )/(i(VmeasPU)))\n";
870 simul += "Bkd KD 0 v=0\n";
871 }
872 else
873 {
874 Report( _( "Driver needs at least a pullup or a pulldown" ), RPT_SEVERITY_ERROR );
875 }
876
877 switch( wave->GetType() )
878 {
879 case KIBIS_WAVEFORM_TYPE::PRBS:
880 case KIBIS_WAVEFORM_TYPE::RECTANGULAR:
881 {
882 double duration = wave->GetDuration();
883 simul += ".tran 0.1n ";
884 simul += doubleToString( duration );
885 simul += "\n";
886 break;
887 }
888 case KIBIS_WAVEFORM_TYPE::HIGH_Z:
889 case KIBIS_WAVEFORM_TYPE::STUCK_LOW:
890 case KIBIS_WAVEFORM_TYPE::STUCK_HIGH:
891 default:
892 simul += ".tran 0.5 1 \n"; //
893 }
894
895 //simul += ".dc Vpin -5 5 0.1\n";
896 simul += ".control run \n";
897 simul += "set filetype=ascii\n";
898 simul += "run \n";
899 //simul += "plot v(x1.DIE0) i(VmeasIout) i(VmeasPD) i(VmeasPU) i(VmeasPC) i(VmeasGC)\n";
900 //simul += "plot v(KU) v(KD)\n";
901
902 std::string outputFileName = m_topLevel->m_cacheDir + "temp_output.spice";
903 simul += "write '" + outputFileName + "' v(KU) v(KD)\n";
904 simul += "quit\n";
905 simul += ".endc \n";
906 simul += ".end \n";
907
908 getKuKdFromFile( simul );
909 }
910}
911
912
914{
915 std::vector<double> ku, kd, t;
916 const KIBIS_WAVEFORM* wave = aParam.m_waveform;
917 const IBIS_CORNER& supply = aParam.m_supply;
918
919 if( !wave )
920 return;
921
922 switch( wave->GetType() )
923 {
924 case KIBIS_WAVEFORM_TYPE::RECTANGULAR:
925 case KIBIS_WAVEFORM_TYPE::PRBS:
926 {
927 wave->Check( aModel.m_ramp.m_rising, aModel.m_ramp.m_falling );
928 std::vector<std::pair<int, double>> bits = wave->GenerateBitSequence();
929 bits = SimplifyBitSequence( bits );
930
931 for( const std::pair<int, double>& bit : bits )
932 {
933 ku.push_back( bit.first ? 0 : 1 );
934 kd.push_back( bit.first ? 1 : 0 );
935 t.push_back( bit.second );
936 ku.push_back( bit.first ? 1 : 0 );
937 kd.push_back( bit.first ? 0 : 1 );
938 t.push_back( bit.second
939 + ( bit.first ? +aModel.m_ramp.m_rising.value[supply].m_dt
940 : aModel.m_ramp.m_falling.value[supply].m_dt )
941 / 0.6 );
942 // 0.6 because ibis only gives 20%-80% time
943 }
944 break;
945 }
946 case KIBIS_WAVEFORM_TYPE::STUCK_HIGH:
947 {
948 ku.push_back( wave->inverted ? 0 : 1 );
949 kd.push_back( wave->inverted ? 1 : 0 );
950 t.push_back( 0 );
951 break;
952 }
953 case KIBIS_WAVEFORM_TYPE::STUCK_LOW:
954 {
955 ku.push_back( wave->inverted ? 1 : 0 );
956 kd.push_back( wave->inverted ? 0 : 1 );
957 t.push_back( 0 );
958 break;
959 }
960 case KIBIS_WAVEFORM_TYPE::HIGH_Z:
961 case KIBIS_WAVEFORM_TYPE::NONE:
962 default:
963 ku.push_back( 0 );
964 kd.push_back( 0 );
965 t.push_back( 0 );
966 }
967
968 m_Ku = ku;
969 m_Kd = kd;
970 m_t = t;
971}
972
973
975 const std::pair<IbisWaveform*, IbisWaveform*>& aPair1,
976 const std::pair<IbisWaveform*, IbisWaveform*>& aPair2,
977 const KIBIS_PARAMETER& aParam )
978{
979 std::string simul = "";
980 const IBIS_CORNER supply = aParam.m_supply;
981 const KIBIS_WAVEFORM* wave = aParam.m_waveform;
982
983 if( !wave )
984 return;
985
986 if( wave->GetType() == KIBIS_WAVEFORM_TYPE::NONE )
987 {
988 //@TODO , there could be some current flowing through pullup / pulldown transistors, even when off
989 std::vector<double> ku, kd, t;
990 ku.push_back( 0 );
991 kd.push_back( 0 );
992 t.push_back( 0 );
993 m_Ku = ku;
994 m_Kd = kd;
995 m_t = t;
996 }
997 else
998 {
999 simul += KuKdDriver( aModel, aPair1, aParam, 0 );
1000 simul += KuKdDriver( aModel, aPair2, aParam, 1 );
1001 simul += "\n x1 3 0 1 DRIVER0 \n";
1002
1003 simul += "VCC 3 0 ";
1004 simul += doubleToString( aModel.m_voltageRange.value[supply] );
1005 simul += "\n";
1006 //simul += "Vpin x1.DIE 0 1 \n"
1007 simul += "Lfixture0 1 4 ";
1008 simul += doubleToString( aPair1.first->m_L_fixture );
1009 simul += "\n";
1010 simul += "Rfixture0 4 5 ";
1011 simul += doubleToString( aPair1.first->m_R_fixture );
1012 simul += "\n";
1013 simul += "Cfixture0 4 0 ";
1014 simul += doubleToString( aPair1.first->m_C_fixture );
1015 simul += "\n";
1016 simul += "Vfixture0 5 0 ";
1017 simul += doubleToString( aPair1.first->m_V_fixture );
1018 simul += "\n";
1019 simul += "VmeasIout0 x1.2 x1.DIE0 0\n";
1020 simul += "VmeasPD0 0 x1.PD_GND0 0\n";
1021 simul += "VmeasPU0 x1.PU_PWR0 3 0\n";
1022 simul += "VmeasPC0 x1.PC_PWR0 3 0\n";
1023 simul += "VmeasGC0 0 x1.GC_GND0 0\n";
1024
1025
1026 simul += "\n x2 3 0 7 DRIVER1 \n";
1027 //simul += "Vpin x1.DIE 0 1 \n"
1028 simul += "Lfixture1 7 8 ";
1029 simul += doubleToString( aPair2.first->m_L_fixture );
1030 simul += "\n";
1031 simul += "Rfixture1 8 9 ";
1032 simul += doubleToString( aPair2.first->m_R_fixture );
1033 simul += "\n";
1034 simul += "Cfixture1 8 0 ";
1035 simul += doubleToString( aPair2.first->m_C_fixture );
1036 simul += "\n";
1037 simul += "Vfixture1 9 0 ";
1038 simul += doubleToString( aPair2.first->m_V_fixture );
1039 simul += "\n";
1040 simul += "VmeasIout1 x2.2 x2.DIE0 0\n";
1041 simul += "VmeasPD1 0 x2.PD_GND0 0\n";
1042 simul += "VmeasPU1 x2.PU_PWR0 3 0\n";
1043 simul += "VmeasPC1 x2.PC_PWR0 3 0\n";
1044 simul += "VmeasGC1 0 x2.GC_GND0 0\n";
1045
1046 if( aModel.HasPullup() && aModel.HasPulldown() )
1047 {
1048 simul +=
1049 "Bku KU 0 v=( ( i(VmeasPD1) * ( i(VmeasIout0) + i(VmeasPC0) + i(VmeasGC0) ) - "
1050 "i(VmeasPD0) * ( i(VmeasIout1) + i(VmeasPC1) + i(VmeasGC1) ) )/ ( i(VmeasPU1) "
1051 "* "
1052 "i(VmeasPD0) - i(VmeasPU0) * i(VmeasPD1) ) )\n";
1053 simul +=
1054 "Bkd KD 0 v=( ( i(VmeasPU1) * ( i(VmeasIout0) + i(VmeasPC0) + i(VmeasGC0) ) - "
1055 "i(VmeasPU0) * ( i(VmeasIout1) + i(VmeasPC1) + i(VmeasGC1) ) )/ ( i(VmeasPD1) "
1056 "* "
1057 "i(VmeasPU0) - i(VmeasPD0) * i(VmeasPU1) ) )\n";
1058 //simul += "Bkd KD 0 v=(1-v(KU))\n";
1059 }
1060
1061 else if( !aModel.HasPullup() && aModel.HasPulldown() )
1062 {
1063 Report( _( "There are two waveform pairs, but only one transistor. More equations than "
1064 "unknowns." ),
1066 simul += "Bku KD 0 v=( ( i(VmeasIout0)+i(VmeasPC0)+i(VmeasGC0) )/(i(VmeasPD0)))\n";
1067 simul += "Bkd KU 0 v=0\n";
1068 }
1069
1070 else if( aModel.HasPullup() && !aModel.HasPulldown() )
1071 {
1072 Report( _( "There are two waveform pairs, but only one transistor. More equations than "
1073 "unknowns." ),
1075 simul += "Bku KU 0 v=( ( i(VmeasIout)+i(VmeasPC)+i(VmeasGC) )/(i(VmeasPU)))\n";
1076 simul += "Bkd KD 0 v=0\n";
1077 }
1078 else
1079 {
1080 Report( _( "Driver needs at least a pullup or a pulldown" ), RPT_SEVERITY_ERROR );
1081 }
1082
1083 switch( wave->GetType() )
1084 {
1085 case KIBIS_WAVEFORM_TYPE::RECTANGULAR:
1086 case KIBIS_WAVEFORM_TYPE::PRBS:
1087 {
1088 double duration = wave->GetDuration();
1089 simul += ".tran 0.1n ";
1090 simul += doubleToString( duration );
1091 simul += "\n";
1092 break;
1093 }
1094 case KIBIS_WAVEFORM_TYPE::HIGH_Z:
1095 case KIBIS_WAVEFORM_TYPE::STUCK_LOW:
1096 case KIBIS_WAVEFORM_TYPE::STUCK_HIGH:
1097 default:
1098 simul += ".tran 0.5 1 \n"; //
1099 }
1100
1101 //simul += ".dc Vpin -5 5 0.1\n";
1102 simul += ".control run \n";
1103 simul += "set filetype=ascii\n";
1104 simul += "run \n";
1105 simul += "plot v(KU) v(KD)\n";
1106 //simul += "plot v(x1.DIE0) \n";
1107 std::string outputFileName = m_topLevel->m_cacheDir + "temp_output.spice";
1108 simul += "write '" + outputFileName + "' v(KU) v(KD)\n";
1109 simul += "quit\n";
1110 simul += ".endc \n";
1111 simul += ".end \n";
1112
1113 getKuKdFromFile( simul );
1114 }
1115}
1116
1117
1118bool KIBIS_PIN::writeSpiceDriver( std::string& aDest, const std::string& aName, KIBIS_MODEL& aModel,
1119 const KIBIS_PARAMETER& aParam )
1120{
1121 bool status = true;
1122
1123 switch( aModel.m_type )
1124 {
1125 case IBIS_MODEL_TYPE::OUTPUT:
1126 case IBIS_MODEL_TYPE::IO:
1127 case IBIS_MODEL_TYPE::THREE_STATE:
1128 case IBIS_MODEL_TYPE::OPEN_DRAIN:
1129 case IBIS_MODEL_TYPE::IO_OPEN_DRAIN:
1130 case IBIS_MODEL_TYPE::OPEN_SINK:
1131 case IBIS_MODEL_TYPE::IO_OPEN_SINK:
1132 case IBIS_MODEL_TYPE::OPEN_SOURCE:
1133 case IBIS_MODEL_TYPE::IO_OPEN_SOURCE:
1134 case IBIS_MODEL_TYPE::OUTPUT_ECL:
1135 case IBIS_MODEL_TYPE::IO_ECL:
1136 case IBIS_MODEL_TYPE::THREE_STATE_ECL:
1137 {
1138 std::string result;
1139 std::string tmp;
1140
1141 result = "\n*Driver model generated by Kicad using Ibis data. ";
1142
1143 result += "\n*Pin number: ";
1144 result += m_pinNumber;
1145 result += "\n*Signal name: ";
1146 result += m_signalName;
1147 result += "\n*Model: ";
1148 result += aModel.m_name;
1149 result += "\n.SUBCKT ";
1150 result += aName;
1151 result += " GND PIN \n";
1152 result += "\n";
1153
1154 result += "RPIN 1 PIN ";
1155 result += doubleToString( m_Rpin.value[aParam.m_Rpin] );
1156 result += "\n";
1157 result += "LPIN DIE0 1 ";
1158 result += doubleToString( m_Lpin.value[aParam.m_Lpin] );
1159 result += "\n";
1160 result += "CPIN PIN GND ";
1161 result += doubleToString( m_Cpin.value[aParam.m_Cpin] );
1162 result += "\n";
1163
1164 std::vector<std::pair<IbisWaveform*, IbisWaveform*>> wfPairs = aModel.waveformPairs();
1166
1167 if( wfPairs.size() < 1 || accuracy <= KIBIS_ACCURACY::LEVEL_0 )
1168 {
1169 if( accuracy > KIBIS_ACCURACY::LEVEL_0 )
1170 {
1171 Report( _( "Model has no waveform pair, using [Ramp] instead, poor accuracy" ),
1173 }
1174
1175 getKuKdNoWaveform( aModel, aParam );
1176 }
1177 else if( wfPairs.size() == 1 || accuracy <= KIBIS_ACCURACY::LEVEL_1 )
1178 {
1179 getKuKdOneWaveform( aModel, wfPairs.at( 0 ), aParam );
1180 }
1181 else
1182 {
1183 if( wfPairs.size() > 2 || accuracy <= KIBIS_ACCURACY::LEVEL_2 )
1184 {
1185 Report( _( "Model has more than 2 waveform pairs, using the first two." ),
1187 }
1188
1189 getKuKdTwoWaveforms( aModel, wfPairs.at( 0 ), wfPairs.at( 1 ), aParam );
1190 }
1191
1192 result += "Vku KU GND pwl ( ";
1193
1194 for( size_t i = 0; i < m_t.size(); i++ )
1195 {
1196 result += doubleToString( m_t.at( i ) );
1197 result += " ";
1198 result += doubleToString( m_Ku.at( i ) );
1199 result += " ";
1200 }
1201
1202 result += ") \n";
1203
1204
1205 result += "Vkd KD GND pwl ( ";
1206
1207 for( size_t i = 0; i < m_t.size(); i++ )
1208 {
1209 result += doubleToString( m_t.at( i ) );
1210 result += " ";
1211 result += doubleToString( m_Kd.at( i ) );
1212 result += " ";
1213 }
1214
1215 result += ") \n";
1216
1217 result += aModel.SpiceDie( aParam, 0 );
1218
1219 result += "\n.ENDS DRIVER\n\n";
1220
1221 aDest += result;
1222 break;
1223 }
1224 default:
1225 Report( _( "Invalid model type for a driver." ), RPT_SEVERITY_ERROR );
1226 status = false;
1227 }
1228
1229 return status;
1230}
1231
1232
1233bool KIBIS_PIN::writeSpiceDevice( std::string& aDest, const std::string& aName, KIBIS_MODEL& aModel,
1234 const KIBIS_PARAMETER& aParam )
1235{
1236 bool status = true;
1237
1238 switch( aModel.m_type )
1239 {
1240 case IBIS_MODEL_TYPE::INPUT_STD:
1241 case IBIS_MODEL_TYPE::IO:
1242 case IBIS_MODEL_TYPE::IO_OPEN_DRAIN:
1243 case IBIS_MODEL_TYPE::IO_OPEN_SINK:
1244 case IBIS_MODEL_TYPE::IO_OPEN_SOURCE:
1245 case IBIS_MODEL_TYPE::IO_ECL:
1246 {
1247 std::string result;
1248
1249 result += "\n";
1250 result = "*Device model generated by Kicad using Ibis data.";
1251 result += "\n.SUBCKT ";
1252 result += aName;
1253 result += " GND PIN\n";
1254 result += "\n";
1255 result += "\n";
1256 result += "RPIN 1 PIN ";
1257 result += doubleToString( m_Rpin.value[aParam.m_Rpin] );
1258 result += "\n";
1259 result += "LPIN DIE0 1 ";
1260 result += doubleToString( m_Lpin.value[aParam.m_Lpin] );
1261 result += "\n";
1262 result += "CPIN PIN GND ";
1263 result += doubleToString( m_Cpin.value[aParam.m_Cpin] );
1264 result += "\n";
1265
1266
1267 result += "Vku KU GND pwl ( 0 0 )\n";
1268 result += "Vkd KD GND pwl ( 0 0 )\n";
1269
1270 result += aModel.SpiceDie( aParam, 0 );
1271
1272 result += "\n.ENDS DRIVER\n\n";
1273
1274 aDest = std::move( result );
1275 break;
1276 }
1277 default:
1278 Report( _( "Invalid model type for a device" ), RPT_SEVERITY_ERROR );
1279 status = false;
1280 }
1281
1282 return status;
1283}
1284
1285
1286bool KIBIS_PIN::writeSpiceDiffDriver( std::string& aDest, const std::string& aName,
1287 KIBIS_MODEL& aModel, const KIBIS_PARAMETER& aParam )
1288{
1289 bool status = true;
1290 KIBIS_WAVEFORM* wave = aParam.m_waveform;
1291
1292 if( !wave )
1293 return false;
1294
1295 std::string result;
1296 result = "\n*Differential driver model generated by Kicad using Ibis data. ";
1297
1298 result += "\n.SUBCKT ";
1299 result += aName;
1300 result += " GND PIN_P PIN_N\n";
1301 result += "\n";
1302
1303 status &= writeSpiceDriver( result, aName + "_P", aModel, aParam );
1304 wave->inverted = !wave->inverted;
1305 status &= writeSpiceDriver( result, aName + "_N", aModel, aParam );
1306 wave->inverted = !wave->inverted;
1307
1308
1309 result += "\n";
1310 result += "x1 GND PIN_P " + aName + "_P \n";
1311 result += "x2 GND PIN_N " + aName + "_N \n";
1312 result += "\n";
1313
1314 result += "\n.ENDS " + aName + "\n\n";
1315
1316 if( status )
1317 aDest += result;
1318
1319 return status;
1320}
1321
1322
1323bool KIBIS_PIN::writeSpiceDiffDevice( std::string& aDest, const std::string& aName,
1324 KIBIS_MODEL& aModel, const KIBIS_PARAMETER& aParam )
1325{
1326 bool status = true;
1327
1328 std::string result;
1329 result = "\n*Differential device model generated by Kicad using Ibis data. ";
1330
1331 result += "\n.SUBCKT ";
1332 result += aName;
1333 result += " GND PIN_P PIN_N\n";
1334 result += "\n";
1335
1336 status &= writeSpiceDevice( result, aName + "_P", aModel, aParam );
1337 status &= writeSpiceDevice( result, aName + "_N", aModel, aParam );
1338
1339 result += "\n";
1340 result += "x1 GND PIN_P " + aName + "_P \n";
1341 result += "x2 GND PIN_N " + aName + "_N \n";
1342 result += "\n";
1343
1344 result += "\n.ENDS " + aName + "\n\n";
1345
1346 if( status )
1347 aDest += result;
1348
1349 return status;
1350}
1351
1352
1353KIBIS_MODEL* KIBIS::GetModel( const std::string& aName )
1354{
1355 for( KIBIS_MODEL& model : m_models )
1356 {
1357 if( model.m_name == aName )
1358 return &model;
1359 }
1360
1361 return nullptr;
1362}
1363
1364
1365KIBIS_COMPONENT* KIBIS::GetComponent( const std::string& aName )
1366{
1367 for( KIBIS_COMPONENT& cmp : m_components )
1368 {
1369 if( cmp.m_name == aName )
1370 return &cmp;
1371 }
1372
1373 return nullptr;
1374}
1375
1376
1377void KIBIS_PARAMETER::SetCornerFromString( IBIS_CORNER& aCorner, const std::string& aString )
1378{
1379 if( aString == "MIN" )
1380 aCorner = IBIS_CORNER::MIN;
1381 else if( aString == "MAX" )
1382 aCorner = IBIS_CORNER::MAX;
1383 else
1384 aCorner = IBIS_CORNER::TYP;
1385}
1386
1387
1388std::vector<std::pair<int, double>> KIBIS_WAVEFORM_STUCK_HIGH::GenerateBitSequence() const
1389{
1390 std::vector<std::pair<int, double>> bits;
1391 std::pair<int, double> bit;
1392 bit.first = inverted ? 1 : 0;
1393 bit.second = 0;
1394 return bits;
1395}
1396
1397
1398std::vector<std::pair<int, double>> KIBIS_WAVEFORM_STUCK_LOW::GenerateBitSequence() const
1399{
1400 std::vector<std::pair<int, double>> bits;
1401 std::pair<int, double> bit;
1402 bit.first = inverted ? 0 : 1;
1403 bit.second = 0;
1404 return bits;
1405}
1406
1407std::vector<std::pair<int, double>> KIBIS_WAVEFORM_HIGH_Z::GenerateBitSequence() const
1408{
1409 std::vector<std::pair<int, double>> bits;
1410 return bits;
1411}
1412
1413std::vector<std::pair<int, double>> KIBIS_WAVEFORM_RECTANGULAR::GenerateBitSequence() const
1414{
1415 std::vector<std::pair<int, double>> bits;
1416
1417 for( int i = 0; i < m_cycles; i++ )
1418 {
1419 std::pair<int, double> bit;
1420 bit.first = inverted ? 0 : 1;
1421 bit.second = ( m_ton + m_toff ) * i + m_delay;
1422 bits.push_back( bit );
1423
1424 bit.first = inverted ? 1 : 0;
1425 bit.second = ( m_ton + m_toff ) * i + m_delay + m_ton;
1426 bits.push_back( bit );
1427 }
1428
1429 return bits;
1430}
1431
1432
1433std::vector<std::pair<int, double>> KIBIS_WAVEFORM_PRBS::GenerateBitSequence() const
1434{
1435 std::vector<std::pair<int, double>> bitSequence;
1436 uint8_t polynomial = 0b1100000;
1437 //1100000 = x^7+x^6+1
1438 //10100 = x^5+x^3+1
1439 //110 = x^3+x^2+1
1440 uint8_t seed = 0x12; // Any non zero state
1441 uint8_t lfsr = seed;
1442
1443 if ( m_bitrate == 0 )
1444 return bitSequence;
1445
1446 double period = 1/m_bitrate;
1447 double t = 0;
1448
1449 wxASSERT( m_bits > 0 );
1450
1451 int bits = 0;
1452
1453 do
1454 {
1455 uint8_t lsb = lfsr & 0x01;
1456 bitSequence.emplace_back( ( static_cast<uint8_t>( inverted ) ^ lsb ? 1 : 0 ), t );
1457 lfsr = lfsr >> 1;
1458
1459 if ( lsb )
1460 lfsr ^= polynomial;
1461
1462 t += period;
1463
1464 } while ( ++bits < m_bits );
1465
1466 return bitSequence;
1467}
1468
1470 const IbisWaveform* aFallingWf ) const
1471{
1472 bool status = true;
1473
1474 if( m_cycles < 1 )
1475 {
1476 status = false;
1477 Report( _( "Number of cycles should be greater than 0." ), RPT_SEVERITY_ERROR );
1478 }
1479
1480 if( m_ton <= 0 )
1481 {
1482 status = false;
1483 Report( _( "ON time should be greater than 0." ), RPT_SEVERITY_ERROR );
1484 }
1485
1486 if( m_toff <= 0 )
1487 {
1488 status = false;
1489 Report( _( "OFF time should be greater than 0." ), RPT_SEVERITY_ERROR );
1490 }
1491
1492 if( aRisingWf )
1493 {
1494 if( m_ton < aRisingWf->m_table.m_entries.back().t )
1495 {
1496 status = false;
1497 Report( _( "Rising edge is longer than on time." ), RPT_SEVERITY_WARNING );
1498 }
1499 }
1500
1501 if( aFallingWf )
1502 {
1503 if( m_toff < aFallingWf->m_table.m_entries.back().t )
1504 {
1505 status = false;
1506 Report( _( "Falling edge is longer than off time." ), RPT_SEVERITY_WARNING );
1507 }
1508 }
1509
1510 status &= aRisingWf && aFallingWf;
1511
1512 return status;
1513}
1514
1515
1517 const dvdtTypMinMax& aFallingRp ) const
1518{
1519 bool status = true;
1520
1521 if( m_cycles < 1 )
1522 {
1523 status = false;
1524 Report( _( "Number of cycles should be greater than 0." ), RPT_SEVERITY_ERROR );
1525 }
1526
1527 if( m_ton <= 0 )
1528 {
1529 status = false;
1530 Report( _( "ON time should be greater than 0." ), RPT_SEVERITY_ERROR );
1531 }
1532
1533 if( m_toff <= 0 )
1534 {
1535 status = false;
1536 Report( _( "OFF time should be greater than 0." ), RPT_SEVERITY_ERROR );
1537 }
1538
1539 if( ( m_ton < aRisingRp.value[IBIS_CORNER::TYP].m_dt / 0.6 )
1540 || ( m_ton < aRisingRp.value[IBIS_CORNER::MIN].m_dt / 0.6 )
1541 || ( m_ton < aRisingRp.value[IBIS_CORNER::MAX].m_dt / 0.6 ) )
1542 {
1543 status = false;
1544 Report( _( "Rising edge is longer than ON time." ), RPT_SEVERITY_ERROR );
1545 }
1546
1547 if( ( m_toff < aFallingRp.value[IBIS_CORNER::TYP].m_dt / 0.6 )
1548 || ( m_toff < aFallingRp.value[IBIS_CORNER::MIN].m_dt / 0.6 )
1549 || ( m_toff < aFallingRp.value[IBIS_CORNER::MAX].m_dt / 0.6 ) )
1550 {
1551 status = false;
1552 Report( _( "Falling edge is longer than OFF time." ), RPT_SEVERITY_ERROR );
1553 }
1554
1555 return status;
1556}
1557
1558
1560 const dvdtTypMinMax& aFallingRp ) const
1561{
1562 bool status = true;
1563
1564 if( m_bitrate <= 0 )
1565 {
1566 status = false;
1567 Report( _( "Bitrate should be greater than 0." ), RPT_SEVERITY_ERROR );
1568 }
1569
1570 if( m_bits <= 0 )
1571 {
1572 status = false;
1573 Report( _( "Number of bits should be greater than 0." ), RPT_SEVERITY_ERROR );
1574 }
1575
1576 if( m_bitrate
1577 && ( ( 1 / m_bitrate ) < ( aRisingRp.value[IBIS_CORNER::TYP].m_dt / 0.6
1578 + aFallingRp.value[IBIS_CORNER::TYP].m_dt / 0.6 ) )
1579 && ( ( 1 / m_bitrate ) < ( aRisingRp.value[IBIS_CORNER::TYP].m_dt / 0.6
1580 + aFallingRp.value[IBIS_CORNER::TYP].m_dt / 0.6 ) )
1581 && ( ( 1 / m_bitrate ) < ( aRisingRp.value[IBIS_CORNER::TYP].m_dt / 0.6
1582 + aFallingRp.value[IBIS_CORNER::TYP].m_dt / 0.6 ) ) )
1583 {
1584 status = false;
1585 Report( _( "Bitrate is too high for rising / falling edges" ), RPT_SEVERITY_ERROR );
1586 }
1587
1588 return status;
1589}
1590
1592 const IbisWaveform* aFallingWf ) const
1593{
1594 bool status = true;
1595
1596 if( m_bitrate <= 0 )
1597 {
1598 status = false;
1599 Report( _( "Bitrate should be greater than 0." ), RPT_SEVERITY_ERROR );
1600 }
1601
1602 if( m_bits <= 0 )
1603 {
1604 status = false;
1605 Report( _( "Number of bits should be greater than 0." ), RPT_SEVERITY_ERROR );
1606 }
1607
1608 if( m_bitrate && aRisingWf && aFallingWf
1609 && ( ( 1 / m_bitrate ) < ( aRisingWf->m_table.m_entries.back().t
1610 + aFallingWf->m_table.m_entries.back().t ) ) )
1611 {
1612 status = false;
1613 Report( _( "Bitrate could be too high for rising / falling edges" ), RPT_SEVERITY_WARNING );
1614 }
1615
1616 return status;
1617}
void Report(const std::string &aMsg, SEVERITY aSeverity=RPT_SEVERITY_INFO) const
Print a message.
Definition: ibis_parser.h:67
REPORTER * m_Reporter
Definition: ibis_parser.h:74
static std::string doubleToString(double aNumber)
Convert a double to string using scientific notation.
std::vector< IVtableEntry > m_entries
Definition: ibis_parser.h:388
std::string Spice(int aN, const std::string &aPort1, const std::string &aPort2, const std::string &aModelName, IBIS_CORNER aCorner) const
Interpolate the IV table.
TypMinMaxValue m_Cpkg
Definition: ibis_parser.h:234
TypMinMaxValue m_Lpkg
Definition: ibis_parser.h:233
TypMinMaxValue m_Rpkg
Definition: ibis_parser.h:232
std::string m_signalName
Definition: ibis_parser.h:251
std::string m_pinName
Definition: ibis_parser.h:250
std::string m_modelName
Definition: ibis_parser.h:252
std::string m_manufacturer
Definition: ibis_parser.h:327
IbisComponentPackage m_package
Definition: ibis_parser.h:328
IbisDiffPin m_diffPin
Definition: ibis_parser.h:334
std::string m_name
Definition: ibis_parser.h:326
std::vector< IbisComponentPin > m_pins
Definition: ibis_parser.h:329
std::string pinB
Definition: ibis_parser.h:298
std::string pinA
Definition: ibis_parser.h:297
std::vector< IbisDiffPinEntry > m_entries
Definition: ibis_parser.h:311
std::vector< IbisComponent > m_components
Definition: ibis_parser.h:655
IbisHeader m_header
Definition: ibis_parser.h:654
std::vector< IbisModel > m_models
Definition: ibis_parser.h:657
std::vector< IbisModelSelector > m_modelSelectors
Definition: ibis_parser.h:656
std::string m_fileName
Definition: ibis_parser.h:198
std::string m_copyright
Definition: ibis_parser.h:203
std::string m_notes
Definition: ibis_parser.h:201
double m_ibisVersion
Definition: ibis_parser.h:196
std::string m_date
Definition: ibis_parser.h:200
double m_fileRevision
Definition: ibis_parser.h:197
std::string m_disclaimer
Definition: ibis_parser.h:202
std::string m_modelName
Definition: ibis_parser.h:343
std::string m_modelDescription
Definition: ibis_parser.h:344
std::string m_name
Definition: ibis_parser.h:358
std::vector< IbisModelSelectorEntry > m_models
Definition: ibis_parser.h:359
IBIS_MODEL_TYPE m_type
Definition: ibis_parser.h:582
double m_cref
Definition: ibis_parser.h:589
IVtable m_pullup
Definition: ibis_parser.h:608
TypMinMaxValue m_Cac
Definition: ibis_parser.h:605
TypMinMaxValue m_pullupReference
Definition: ibis_parser.h:598
double m_vmeas
Definition: ibis_parser.h:590
IVtable m_pulldown
Definition: ibis_parser.h:609
TypMinMaxValue m_Rac
Definition: ibis_parser.h:604
std::vector< IbisWaveform * > m_risingWaveforms
Definition: ibis_parser.h:610
IVtable m_POWERClamp
Definition: ibis_parser.h:607
TypMinMaxValue m_Rgnd
Definition: ibis_parser.h:602
TypMinMaxValue m_POWERClampReference
Definition: ibis_parser.h:601
IVtable m_GNDClamp
Definition: ibis_parser.h:606
IbisRamp m_ramp
Definition: ibis_parser.h:612
IBIS_MODEL_POLARITY m_polarity
Definition: ibis_parser.h:592
TypMinMaxValue m_C_comp
Definition: ibis_parser.h:595
double m_rref
Definition: ibis_parser.h:588
IBIS_MODEL_ENABLE m_enable
Definition: ibis_parser.h:591
TypMinMaxValue m_temperatureRange
Definition: ibis_parser.h:597
std::vector< IbisWaveform * > m_fallingWaveforms
Definition: ibis_parser.h:611
TypMinMaxValue m_pulldownReference
Definition: ibis_parser.h:599
double m_vref
Definition: ibis_parser.h:587
TypMinMaxValue m_GNDClampReference
Definition: ibis_parser.h:600
double m_vinh
Definition: ibis_parser.h:586
double m_vinl
Definition: ibis_parser.h:585
TypMinMaxValue m_voltageRange
Definition: ibis_parser.h:596
TypMinMaxValue m_Rpower
Definition: ibis_parser.h:603
std::string m_name
Definition: ibis_parser.h:581
bool ParseFile(const std::string &aFileName)
Parse a file.
bool m_parrot
Definition: ibis_parser.h:702
IbisFile m_ibisFile
Definition: ibis_parser.h:712
dvdtTypMinMax m_rising
Definition: ibis_parser.h:511
dvdtTypMinMax m_falling
Definition: ibis_parser.h:510
double m_L_fixture
Definition: ibis_parser.h:540
double m_V_fixture
Definition: ibis_parser.h:541
VTtable m_table
Definition: ibis_parser.h:533
double m_V_fixture_min
Definition: ibis_parser.h:542
double m_V_fixture_max
Definition: ibis_parser.h:543
double m_R_fixture
Definition: ibis_parser.h:538
double m_C_fixture
Definition: ibis_parser.h:539
bool m_valid
Definition: kibis.h:57
KIBIS * m_topLevel
Definition: kibis.h:56
KIBIS_BASE(KIBIS *aTopLevel)
Definition: kibis.cpp:68
KIBIS_COMPONENT(KIBIS &aToplevel, const IbisComponent &aSource, IbisParser &aParser)
Definition: kibis.cpp:306
std::vector< KIBIS_PIN > m_pins
Definition: kibis.h:456
std::string m_manufacturer
Name of the manufacturer.
Definition: kibis.h:454
std::string m_name
Name of the component.
Definition: kibis.h:452
KIBIS_PIN * GetPin(const std::string &aPinNumber)
Get a pin by its number ( 1, 2, A1, A2, ... )
Definition: kibis.cpp:330
KIBIS_FILE(KIBIS &aTopLevel)
Definition: kibis.cpp:137
std::string m_notes
Definition: kibis.h:238
double m_ibisVersion
Definition: kibis.h:235
std::string m_date
Definition: kibis.h:236
bool Init(const IbisParser &aParser)
Definition: kibis.cpp:145
std::string m_fileName
Definition: kibis.h:233
std::string m_copyright
Definition: kibis.h:240
std::string m_disclaimer
Definition: kibis.h:239
double m_fileRev
Definition: kibis.h:234
std::vector< IbisWaveform * > m_fallingWaveforms
Definition: kibis.h:281
IbisWaveform TrimWaveform(const IbisWaveform &aIn) const
Copy a waveform, and substract the first value to all samples.
Definition: kibis.cpp:441
IBIS_MODEL_ENABLE m_enable
Definition: kibis.h:261
double m_vref
Definition: kibis.h:257
std::string m_name
Definition: kibis.h:250
bool HasPOWERClamp() const
Return true if the model has a clamp diode to the power net.
Definition: kibis.cpp:495
double m_vmeas
Definition: kibis.h:260
std::vector< IbisWaveform * > m_risingWaveforms
Definition: kibis.h:280
TypMinMaxValue m_Cac
Definition: kibis.h:275
double m_vinh
Definition: kibis.h:256
double m_rref
Definition: kibis.h:258
bool HasPullup() const
Return true if the model has a pullup transistor.
Definition: kibis.cpp:483
bool HasGNDClamp() const
Return true if the model has a clamp diode to the gnd net.
Definition: kibis.cpp:489
TypMinMaxValue m_pulldownReference
Definition: kibis.h:269
TypMinMaxValue m_GNDClampReference
Definition: kibis.h:270
TypMinMaxValue m_Rpower
Definition: kibis.h:273
bool HasPulldown() const
Return true if the model has a pulldown transistor.
Definition: kibis.cpp:477
IBIS_MODEL_TYPE m_type
Definition: kibis.h:252
IbisRamp m_ramp
Definition: kibis.h:282
IVtable m_pullup
Definition: kibis.h:278
IBIS_MODEL_POLARITY m_polarity
Definition: kibis.h:262
double m_cref
Definition: kibis.h:259
std::string generateSquareWave(const std::string &aNode1, const std::string &aNode2, const std::vector< std::pair< int, double > > &aBits, const std::pair< IbisWaveform *, IbisWaveform * > &aPair, const KIBIS_PARAMETER &aParam)
Generate a square waveform.
Definition: kibis.cpp:501
TypMinMaxValue m_Rac
Definition: kibis.h:274
TypMinMaxValue m_temperatureRange
Definition: kibis.h:267
TypMinMaxValue m_voltageRange
Definition: kibis.h:266
IVtable m_GNDClamp
Definition: kibis.h:276
TypMinMaxValue m_Rgnd
Definition: kibis.h:272
std::string m_description
Definition: kibis.h:251
KIBIS_MODEL(KIBIS &aTopLevel, const IbisModel &aSource, IbisParser &aParser)
Definition: kibis.cpp:236
IVtable m_POWERClamp
Definition: kibis.h:277
TypMinMaxValue m_pullupReference
Definition: kibis.h:268
std::vector< std::pair< IbisWaveform *, IbisWaveform * > > waveformPairs()
Create waveform pairs.
Definition: kibis.cpp:341
TypMinMaxValue m_POWERClampReference
Definition: kibis.h:271
TypMinMaxValue m_C_comp
Definition: kibis.h:265
std::string SpiceDie(const KIBIS_PARAMETER &aParam, int aIndex) const
Generate the spice directive to simulate the die.
Definition: kibis.cpp:368
IVtable m_pulldown
Definition: kibis.h:279
double m_vinl
Definition: kibis.h:255
IBIS_CORNER m_supply
Definition: kibis.h:220
IBIS_CORNER m_Cpin
Definition: kibis.h:218
KIBIS_ACCURACY m_accuracy
Definition: kibis.h:222
IBIS_CORNER m_Ccomp
Definition: kibis.h:219
IBIS_CORNER m_Lpin
Definition: kibis.h:217
IBIS_CORNER m_Rpin
Definition: kibis.h:216
void SetCornerFromString(IBIS_CORNER &aCorner, const std::string &aString)
Definition: kibis.cpp:1377
KIBIS_WAVEFORM * m_waveform
Definition: kibis.h:221
TypMinMaxValue m_Rpin
Resistance from die to pin.
Definition: kibis.h:355
bool writeSpiceDiffDriver(std::string &aDest, const std::string &aName, KIBIS_MODEL &aModel, const KIBIS_PARAMETER &aParam)
Definition: kibis.cpp:1286
TypMinMaxValue m_Lpin
Inductance from die to pin.
Definition: kibis.h:357
void getKuKdFromFile(const std::string &aSimul)
Update m_Ku, m_Kd using with two waveform inputs.
Definition: kibis.cpp:646
KIBIS_COMPONENT * m_parent
Definition: kibis.h:361
std::vector< double > m_Ku
Definition: kibis.h:363
std::string m_pinNumber
Pin Number Examples : 1, 2, 3 ( or for BGA ), A1, A2, A3, etc...
Definition: kibis.h:352
std::string addDie(KIBIS_MODEL &aModel, const KIBIS_PARAMETER &aParam, int aIndex)
Generate the spice directive to simulate the die for Ku/Kd estimation.
Definition: kibis.cpp:602
bool writeSpiceDevice(std::string &aDest, const std::string &aName, KIBIS_MODEL &aModel, const KIBIS_PARAMETER &aParam)
Definition: kibis.cpp:1233
std::vector< KIBIS_MODEL * > m_models
Definition: kibis.h:365
std::vector< double > m_t
Definition: kibis.h:363
TypMinMaxValue m_Cpin
Capacitance from pin to GND.
Definition: kibis.h:359
std::string m_signalName
Name of the pin Examples : "VCC", "GPIOA", "CLK", etc...
Definition: kibis.h:348
void getKuKdTwoWaveforms(KIBIS_MODEL &aModel, const std::pair< IbisWaveform *, IbisWaveform * > &aPair1, const std::pair< IbisWaveform *, IbisWaveform * > &aPair2, const KIBIS_PARAMETER &aParam)
Update m_Ku, m_Kd using with two waveform inputs.
Definition: kibis.cpp:974
void getKuKdOneWaveform(KIBIS_MODEL &aModel, const std::pair< IbisWaveform *, IbisWaveform * > &aPair, const KIBIS_PARAMETER &aParam)
Update m_Ku, m_Kd using with a single waveform input.
Definition: kibis.cpp:802
bool writeSpiceDiffDevice(std::string &aDest, const std::string &aName, KIBIS_MODEL &aModel, const KIBIS_PARAMETER &aParam)
Definition: kibis.cpp:1323
std::string KuKdDriver(KIBIS_MODEL &aModel, const std::pair< IbisWaveform *, IbisWaveform * > &aPair, const KIBIS_PARAMETER &aParam, int aIndex)
Update m_Ku, m_Kd using with two waveform inputs.
Definition: kibis.cpp:726
KIBIS_PIN(KIBIS &aTopLevel, const IbisComponentPin &aPin, const IbisComponentPackage &aPackage, IbisParser &aParser, KIBIS_COMPONENT *aParent, std::vector< KIBIS_MODEL > &aModels)
Definition: kibis.cpp:162
std::vector< double > m_Kd
Definition: kibis.h:363
bool writeSpiceDriver(std::string &aDest, const std::string &aName, KIBIS_MODEL &aModel, const KIBIS_PARAMETER &aParam)
Definition: kibis.cpp:1118
KIBIS_PIN * m_complementaryPin
Definition: kibis.h:442
void getKuKdNoWaveform(KIBIS_MODEL &aModel, const KIBIS_PARAMETER &aParam)
Update m_Ku, m_Kd using no falling / rising waveform inputs ( low accuracy )
Definition: kibis.cpp:913
std::vector< std::pair< int, double > > GenerateBitSequence() const override
Definition: kibis.cpp:1407
bool Check(const IbisWaveform *aRisingWf, const IbisWaveform *aFallingWf) const override
Definition: kibis.cpp:1591
std::vector< std::pair< int, double > > GenerateBitSequence() const override
Definition: kibis.cpp:1433
double m_bitrate
Definition: kibis.h:138
bool Check(const IbisWaveform *aRisingWf, const IbisWaveform *aFallingWf) const override
Definition: kibis.cpp:1469
std::vector< std::pair< int, double > > GenerateBitSequence() const override
Definition: kibis.cpp:1413
std::vector< std::pair< int, double > > GenerateBitSequence() const override
Definition: kibis.cpp:1388
std::vector< std::pair< int, double > > GenerateBitSequence() const override
Definition: kibis.cpp:1398
virtual bool Check(const IbisWaveform *aRisingWf, const IbisWaveform *aFallingWf) const
Definition: kibis.h:92
KIBIS_WAVEFORM_TYPE GetType() const
Definition: kibis.h:80
bool inverted
Definition: kibis.h:82
virtual double GetDuration() const
Definition: kibis.h:81
virtual std::vector< std::pair< int, double > > GenerateBitSequence() const
Definition: kibis.h:85
Definition: kibis.h:467
std::vector< KIBIS_MODEL > m_models
Definition: kibis.h:478
KIBIS()
Constructor for unitialized KIBIS members.
Definition: kibis.h:470
std::vector< KIBIS_COMPONENT > m_components
Definition: kibis.h:477
KIBIS_MODEL * GetModel(const std::string &aName)
Return the model with name aName .
Definition: kibis.cpp:1353
KIBIS_COMPONENT * GetComponent(const std::string &aName)
Return the component with name aName .
Definition: kibis.cpp:1365
KIBIS_FILE m_file
Definition: kibis.h:479
std::string m_cacheDir
Absolute path of the directory that will be used for caching.
Definition: kibis.h:482
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:73
static std::shared_ptr< SPICE_SIMULATOR > CreateInstance(const std::string &aName)
double value[3]
Definition: ibis_parser.h:216
TypMinMaxValue V
Definition: ibis_parser.h:432
std::vector< VTtableEntry > m_entries
Definition: ibis_parser.h:443
dvdt value[3]
Definition: ibis_parser.h:495
double m_dt
Definition: ibis_parser.h:487
#define _(s)
IBIS_CORNER
Definition: ibis_parser.h:102
@ TYP
Definition: ibis_parser.h:103
@ MIN
Definition: ibis_parser.h:104
@ MAX
Definition: ibis_parser.h:105
std::vector< std::pair< int, double > > SimplifyBitSequence(const std::vector< std::pair< int, double > > &bits)
Definition: kibis.cpp:51
IBIS_CORNER ReverseLogic(IBIS_CORNER aIn)
Definition: kibis.cpp:82
KIBIS_ACCURACY
Accuracy level.
Definition: kibis.h:206
@ RPT_SEVERITY_WARNING
@ RPT_SEVERITY_ERROR
@ RPT_SEVERITY_INFO
const int accuracy
constexpr int delta
#define ku