KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 for( int i = 0; i < 11; i++ ) // number of line in the ngspice output header
671 std::getline( KuKdfile, line );
672
673 int i = 0;
674 double t_v, ku_v, kd_v;
675
676 while( KuKdfile )
677 {
678 std::getline( KuKdfile, line );
679
680 if( line.empty() )
681 continue;
682
683 switch( i )
684 {
685 case 0:
686 line = line.substr( line.find_first_of( "\t" ) + 1 );
687 t_v = std::stod( line );
688 break;
689 case 1: ku_v = std::stod( line ); break;
690 case 2:
691 kd_v = std::stod( line );
692 ku.push_back( ku_v );
693 kd.push_back( kd_v );
694 t.push_back( t_v );
695 break;
696 default:
697 Report( _( "Error while reading temporary file" ), RPT_SEVERITY_ERROR );
698 }
699
700 i = ( i + 1 ) % 3;
701 }
702
703 std::getline( KuKdfile, line );
704 }
705 else
706 {
707 Report( _( "Error while creating temporary output file" ), RPT_SEVERITY_ERROR );
708 }
709
710 if( std::remove( outputFileName.c_str() ) )
711 {
712 Report( _( "Cannot remove temporary output file" ), RPT_SEVERITY_WARNING );
713 }
714
715 m_Ku = ku;
716 m_Kd = kd;
717 m_t = t;
718}
719
720
722 const std::pair<IbisWaveform*, IbisWaveform*>& aPair,
723 const KIBIS_PARAMETER& aParam, int aIndex )
724{
725 IBIS_CORNER supply = aParam.m_supply;
726 IBIS_CORNER ccomp = aParam.m_Ccomp;
727 KIBIS_WAVEFORM* wave = aParam.m_waveform;
728
729 std::string simul = "";
730
731 simul += "*THIS IS NOT A VALID SPICE MODEL.\n";
732 simul += "*This part is intended to be executed by Kibis internally.\n";
733 simul += "*You should not be able to read this.\n\n";
734
735 simul += ".SUBCKT DRIVER";
736 simul += std::to_string( aIndex );
737 simul += " POWER GND PIN \n"; // 1: POWER, 2:GND, 3:PIN
738
739 simul += "Vdummy 2 PIN 0\n";
740
741 if( ( aPair.first->m_R_dut != 0 ) || ( aPair.first->m_L_dut != 0 )
742 || ( aPair.first->m_C_dut != 0 ) )
743 {
744 Report( _( "Kibis does not support DUT values yet. "
745 "https://ibis.org/summits/nov16a/chen.pdf" ),
747 }
748
749 simul += "\n";
750 simul += "CCPOMP 2 GND ";
751 simul += doubleToString( aModel.m_C_comp.value[ccomp] ); //@TODO: Check the corner ?
752 simul += "\n";
753
754 const IbisWaveform* risingWF = aPair.first;
755 const IbisWaveform* fallingWF = aPair.second;
756
757 switch( wave->GetType() )
758 {
759 case KIBIS_WAVEFORM_TYPE::RECTANGULAR:
760 case KIBIS_WAVEFORM_TYPE::PRBS:
761 {
762 wave->Check( risingWF, fallingWF );
763 std::vector<std::pair<int, double>> bits = wave->GenerateBitSequence();
764 bits = SimplifyBitSequence( bits );
765 simul += aModel.generateSquareWave( "DIE0", "GND", bits, aPair, aParam );
766 break;
767 }
768 case KIBIS_WAVEFORM_TYPE::STUCK_HIGH:
769 {
770 const IbisWaveform* waveform = wave->inverted ? risingWF : fallingWF;
771 simul += "Vsig DIE0 GND ";
772 simul += doubleToString( waveform->m_table.m_entries.at( 0 ).V.value[supply] );
773 simul += "\n";
774 break;
775 }
776 case KIBIS_WAVEFORM_TYPE::STUCK_LOW:
777 {
778 const IbisWaveform* waveform = wave->inverted ? fallingWF : risingWF;
779 simul += "Vsig DIE0 GND ";
780 simul += doubleToString( waveform->m_table.m_entries.at( 0 ).V.value[supply] );
781 simul += "\n";
782 break;
783 }
784 case KIBIS_WAVEFORM_TYPE::NONE:
785 case KIBIS_WAVEFORM_TYPE::HIGH_Z:
786 default:
787 break;
788 }
789
790 simul += addDie( aModel, aParam, 0 );
791
792 simul += "\n.ENDS DRIVER\n\n";
793 return simul;
794}
795
796
798 const std::pair<IbisWaveform*, IbisWaveform*>& aPair,
799 const KIBIS_PARAMETER& aParam )
800{
801 IBIS_CORNER supply = aParam.m_supply;
802 const KIBIS_WAVEFORM* wave = aParam.m_waveform;
803
804 std::string simul = "";
805
806 if( !wave )
807 return;
808
809 if( wave->GetType() == KIBIS_WAVEFORM_TYPE::NONE )
810 {
811 //@TODO , there could be some current flowing through pullup / pulldown transistors, even when off
812 std::vector<double> ku, kd, t;
813 ku.push_back( 0 );
814 kd.push_back( 0 );
815 t.push_back( 0 );
816 m_Ku = ku;
817 m_Kd = kd;
818 m_t = t;
819 }
820 else
821 {
822 simul += KuKdDriver( aModel, aPair, aParam, 0 );
823 simul += "\n x1 3 0 1 DRIVER0 \n";
824
825 simul += "VCC 3 0 ";
826 simul += doubleToString( aModel.m_voltageRange.value[supply] );
827 simul += "\n";
828 //simul += "Vpin x1.DIE 0 1 \n"
829 simul += "Lfixture 1 4 ";
830 simul += doubleToString( aPair.first->m_L_fixture );
831 simul += "\n";
832 simul += "Rfixture 4 5 ";
833 simul += doubleToString( aPair.first->m_R_fixture );
834 simul += "\n";
835 simul += "Cfixture 4 0 ";
836 simul += doubleToString( aPair.first->m_C_fixture );
837 simul += "\n";
838 simul += "Vfixture 5 0 ";
839 simul += doubleToString( aPair.first->m_V_fixture );
840 simul += "\n";
841 simul += "VmeasIout x1.DIE0 x1.2 0\n";
842 simul += "VmeasPD 0 x1.PD_GND0 0\n";
843 simul += "VmeasPU x1.PU_PWR0 3 0\n";
844 simul += "VmeasPC x1.PC_PWR0 3 0\n";
845 simul += "VmeasGC 0 x1.GC_GND0 0\n";
846
847 if( aModel.HasPullup() && aModel.HasPulldown() )
848 {
849 Report( _( "Model has only one waveform pair, reduced accuracy" ),
851 simul += "Bku KU 0 v=( (i(VmeasIout)-i(VmeasPC)-i(VmeasGC)-i(VmeasPD) "
852 ")/(i(VmeasPU)-i(VmeasPD)))\n";
853 simul += "Bkd KD 0 v=(1-v(KU))\n";
854 }
855
856 else if( !aModel.HasPullup() && aModel.HasPulldown() )
857 {
858 simul += "Bku KD 0 v=( ( i(VmeasIout)+i(VmeasPC)+i(VmeasGC) )/(i(VmeasPD)))\n";
859 simul += "Bkd KU 0 v=0\n";
860 }
861
862 else if( aModel.HasPullup() && !aModel.HasPulldown() )
863 {
864 simul += "Bku KU 0 v=( ( i(VmeasIout)+i(VmeasPC)+i(VmeasGC) )/(i(VmeasPU)))\n";
865 simul += "Bkd KD 0 v=0\n";
866 }
867 else
868 {
869 Report( _( "Driver needs at least a pullup or a pulldown" ), RPT_SEVERITY_ERROR );
870 }
871
872 switch( wave->GetType() )
873 {
874 case KIBIS_WAVEFORM_TYPE::PRBS:
875 case KIBIS_WAVEFORM_TYPE::RECTANGULAR:
876 {
877 double duration = wave->GetDuration();
878 simul += ".tran 0.1n ";
879 simul += doubleToString( duration );
880 simul += "\n";
881 break;
882 }
883 case KIBIS_WAVEFORM_TYPE::HIGH_Z:
884 case KIBIS_WAVEFORM_TYPE::STUCK_LOW:
885 case KIBIS_WAVEFORM_TYPE::STUCK_HIGH:
886 default:
887 simul += ".tran 0.5 1 \n"; //
888 }
889
890 //simul += ".dc Vpin -5 5 0.1\n";
891 simul += ".control run \n";
892 simul += "set filetype=ascii\n";
893 simul += "run \n";
894 //simul += "plot v(x1.DIE0) i(VmeasIout) i(VmeasPD) i(VmeasPU) i(VmeasPC) i(VmeasGC)\n";
895 //simul += "plot v(KU) v(KD)\n";
896
897 std::string outputFileName = m_topLevel->m_cacheDir + "temp_output.spice";
898 simul += "write '" + outputFileName + "' v(KU) v(KD)\n";
899 simul += "quit\n";
900 simul += ".endc \n";
901 simul += ".end \n";
902
903 getKuKdFromFile( simul );
904 }
905}
906
907
909{
910 std::vector<double> ku, kd, t;
911 const KIBIS_WAVEFORM* wave = aParam.m_waveform;
912 const IBIS_CORNER& supply = aParam.m_supply;
913
914 if( !wave )
915 return;
916
917 switch( wave->GetType() )
918 {
919 case KIBIS_WAVEFORM_TYPE::RECTANGULAR:
920 case KIBIS_WAVEFORM_TYPE::PRBS:
921 {
922 wave->Check( aModel.m_ramp.m_rising, aModel.m_ramp.m_falling );
923 std::vector<std::pair<int, double>> bits = wave->GenerateBitSequence();
924 bits = SimplifyBitSequence( bits );
925
926 for( const std::pair<int, double>& bit : bits )
927 {
928 ku.push_back( bit.first ? 0 : 1 );
929 kd.push_back( bit.first ? 1 : 0 );
930 t.push_back( bit.second );
931 ku.push_back( bit.first ? 1 : 0 );
932 kd.push_back( bit.first ? 0 : 1 );
933 t.push_back( bit.second
934 + ( bit.first ? +aModel.m_ramp.m_rising.value[supply].m_dt
935 : aModel.m_ramp.m_falling.value[supply].m_dt )
936 / 0.6 );
937 // 0.6 because ibis only gives 20%-80% time
938 }
939 break;
940 }
941 case KIBIS_WAVEFORM_TYPE::STUCK_HIGH:
942 {
943 ku.push_back( wave->inverted ? 0 : 1 );
944 kd.push_back( wave->inverted ? 1 : 0 );
945 t.push_back( 0 );
946 break;
947 }
948 case KIBIS_WAVEFORM_TYPE::STUCK_LOW:
949 {
950 ku.push_back( wave->inverted ? 1 : 0 );
951 kd.push_back( wave->inverted ? 0 : 1 );
952 t.push_back( 0 );
953 break;
954 }
955 case KIBIS_WAVEFORM_TYPE::HIGH_Z:
956 case KIBIS_WAVEFORM_TYPE::NONE:
957 default:
958 ku.push_back( 0 );
959 kd.push_back( 0 );
960 t.push_back( 0 );
961 }
962
963 m_Ku = ku;
964 m_Kd = kd;
965 m_t = t;
966}
967
968
970 const std::pair<IbisWaveform*, IbisWaveform*>& aPair1,
971 const std::pair<IbisWaveform*, IbisWaveform*>& aPair2,
972 const KIBIS_PARAMETER& aParam )
973{
974 std::string simul = "";
975 const IBIS_CORNER supply = aParam.m_supply;
976 const KIBIS_WAVEFORM* wave = aParam.m_waveform;
977
978 if( !wave )
979 return;
980
981 if( wave->GetType() == KIBIS_WAVEFORM_TYPE::NONE )
982 {
983 //@TODO , there could be some current flowing through pullup / pulldown transistors, even when off
984 std::vector<double> ku, kd, t;
985 ku.push_back( 0 );
986 kd.push_back( 0 );
987 t.push_back( 0 );
988 m_Ku = ku;
989 m_Kd = kd;
990 m_t = t;
991 }
992 else
993 {
994 simul += KuKdDriver( aModel, aPair1, aParam, 0 );
995 simul += KuKdDriver( aModel, aPair2, aParam, 1 );
996 simul += "\n x1 3 0 1 DRIVER0 \n";
997
998 simul += "VCC 3 0 ";
999 simul += doubleToString( aModel.m_voltageRange.value[supply] );
1000 simul += "\n";
1001 //simul += "Vpin x1.DIE 0 1 \n"
1002 simul += "Lfixture0 1 4 ";
1003 simul += doubleToString( aPair1.first->m_L_fixture );
1004 simul += "\n";
1005 simul += "Rfixture0 4 5 ";
1006 simul += doubleToString( aPair1.first->m_R_fixture );
1007 simul += "\n";
1008 simul += "Cfixture0 4 0 ";
1009 simul += doubleToString( aPair1.first->m_C_fixture );
1010 simul += "\n";
1011 simul += "Vfixture0 5 0 ";
1012 simul += doubleToString( aPair1.first->m_V_fixture );
1013 simul += "\n";
1014 simul += "VmeasIout0 x1.2 x1.DIE0 0\n";
1015 simul += "VmeasPD0 0 x1.PD_GND0 0\n";
1016 simul += "VmeasPU0 x1.PU_PWR0 3 0\n";
1017 simul += "VmeasPC0 x1.PC_PWR0 3 0\n";
1018 simul += "VmeasGC0 0 x1.GC_GND0 0\n";
1019
1020
1021 simul += "\n x2 3 0 7 DRIVER1 \n";
1022 //simul += "Vpin x1.DIE 0 1 \n"
1023 simul += "Lfixture1 7 8 ";
1024 simul += doubleToString( aPair2.first->m_L_fixture );
1025 simul += "\n";
1026 simul += "Rfixture1 8 9 ";
1027 simul += doubleToString( aPair2.first->m_R_fixture );
1028 simul += "\n";
1029 simul += "Cfixture1 8 0 ";
1030 simul += doubleToString( aPair2.first->m_C_fixture );
1031 simul += "\n";
1032 simul += "Vfixture1 9 0 ";
1033 simul += doubleToString( aPair2.first->m_V_fixture );
1034 simul += "\n";
1035 simul += "VmeasIout1 x2.2 x2.DIE0 0\n";
1036 simul += "VmeasPD1 0 x2.PD_GND0 0\n";
1037 simul += "VmeasPU1 x2.PU_PWR0 3 0\n";
1038 simul += "VmeasPC1 x2.PC_PWR0 3 0\n";
1039 simul += "VmeasGC1 0 x2.GC_GND0 0\n";
1040
1041 if( aModel.HasPullup() && aModel.HasPulldown() )
1042 {
1043 simul +=
1044 "Bku KU 0 v=( ( i(VmeasPD1) * ( i(VmeasIout0) + i(VmeasPC0) + i(VmeasGC0) ) - "
1045 "i(VmeasPD0) * ( i(VmeasIout1) + i(VmeasPC1) + i(VmeasGC1) ) )/ ( i(VmeasPU1) "
1046 "* "
1047 "i(VmeasPD0) - i(VmeasPU0) * i(VmeasPD1) ) )\n";
1048 simul +=
1049 "Bkd KD 0 v=( ( i(VmeasPU1) * ( i(VmeasIout0) + i(VmeasPC0) + i(VmeasGC0) ) - "
1050 "i(VmeasPU0) * ( i(VmeasIout1) + i(VmeasPC1) + i(VmeasGC1) ) )/ ( i(VmeasPD1) "
1051 "* "
1052 "i(VmeasPU0) - i(VmeasPD0) * i(VmeasPU1) ) )\n";
1053 //simul += "Bkd KD 0 v=(1-v(KU))\n";
1054 }
1055
1056 else if( !aModel.HasPullup() && aModel.HasPulldown() )
1057 {
1058 Report( _( "There are two waveform pairs, but only one transistor. More equations than "
1059 "unknowns." ),
1061 simul += "Bku KD 0 v=( ( i(VmeasIout0)+i(VmeasPC0)+i(VmeasGC0) )/(i(VmeasPD0)))\n";
1062 simul += "Bkd KU 0 v=0\n";
1063 }
1064
1065 else if( aModel.HasPullup() && !aModel.HasPulldown() )
1066 {
1067 Report( _( "There are two waveform pairs, but only one transistor. More equations than "
1068 "unknowns." ),
1070 simul += "Bku KU 0 v=( ( i(VmeasIout)+i(VmeasPC)+i(VmeasGC) )/(i(VmeasPU)))\n";
1071 simul += "Bkd KD 0 v=0\n";
1072 }
1073 else
1074 {
1075 Report( _( "Driver needs at least a pullup or a pulldown" ), RPT_SEVERITY_ERROR );
1076 }
1077
1078 switch( wave->GetType() )
1079 {
1080 case KIBIS_WAVEFORM_TYPE::RECTANGULAR:
1081 case KIBIS_WAVEFORM_TYPE::PRBS:
1082 {
1083 double duration = wave->GetDuration();
1084 simul += ".tran 0.1n ";
1085 simul += doubleToString( duration );
1086 simul += "\n";
1087 break;
1088 }
1089 case KIBIS_WAVEFORM_TYPE::HIGH_Z:
1090 case KIBIS_WAVEFORM_TYPE::STUCK_LOW:
1091 case KIBIS_WAVEFORM_TYPE::STUCK_HIGH:
1092 default:
1093 simul += ".tran 0.5 1 \n"; //
1094 }
1095
1096 //simul += ".dc Vpin -5 5 0.1\n";
1097 simul += ".control run \n";
1098 simul += "set filetype=ascii\n";
1099 simul += "run \n";
1100 simul += "plot v(KU) v(KD)\n";
1101 //simul += "plot v(x1.DIE0) \n";
1102 std::string outputFileName = m_topLevel->m_cacheDir + "temp_output.spice";
1103 simul += "write '" + outputFileName + "' v(KU) v(KD)\n";
1104 simul += "quit\n";
1105 simul += ".endc \n";
1106 simul += ".end \n";
1107
1108 getKuKdFromFile( simul );
1109 }
1110}
1111
1112
1113bool KIBIS_PIN::writeSpiceDriver( std::string& aDest, const std::string& aName, KIBIS_MODEL& aModel,
1114 const KIBIS_PARAMETER& aParam )
1115{
1116 bool status = true;
1117
1118 switch( aModel.m_type )
1119 {
1120 case IBIS_MODEL_TYPE::OUTPUT:
1121 case IBIS_MODEL_TYPE::IO:
1122 case IBIS_MODEL_TYPE::THREE_STATE:
1123 case IBIS_MODEL_TYPE::OPEN_DRAIN:
1124 case IBIS_MODEL_TYPE::IO_OPEN_DRAIN:
1125 case IBIS_MODEL_TYPE::OPEN_SINK:
1126 case IBIS_MODEL_TYPE::IO_OPEN_SINK:
1127 case IBIS_MODEL_TYPE::OPEN_SOURCE:
1128 case IBIS_MODEL_TYPE::IO_OPEN_SOURCE:
1129 case IBIS_MODEL_TYPE::OUTPUT_ECL:
1130 case IBIS_MODEL_TYPE::IO_ECL:
1131 case IBIS_MODEL_TYPE::THREE_STATE_ECL:
1132 {
1133 std::string result;
1134 std::string tmp;
1135
1136 result = "\n*Driver model generated by Kicad using Ibis data. ";
1137
1138 result += "\n*Pin number: ";
1139 result += m_pinNumber;
1140 result += "\n*Signal name: ";
1141 result += m_signalName;
1142 result += "\n*Model: ";
1143 result += aModel.m_name;
1144 result += "\n.SUBCKT ";
1145 result += aName;
1146 result += " GND PIN \n";
1147 result += "\n";
1148
1149 result += "RPIN 1 PIN ";
1150 result += doubleToString( m_Rpin.value[aParam.m_Rpin] );
1151 result += "\n";
1152 result += "LPIN DIE0 1 ";
1153 result += doubleToString( m_Lpin.value[aParam.m_Lpin] );
1154 result += "\n";
1155 result += "CPIN PIN GND ";
1156 result += doubleToString( m_Cpin.value[aParam.m_Cpin] );
1157 result += "\n";
1158
1159 std::vector<std::pair<IbisWaveform*, IbisWaveform*>> wfPairs = aModel.waveformPairs();
1160 KIBIS_ACCURACY accuracy = aParam.m_accuracy;
1161
1162 if( wfPairs.size() < 1 || accuracy <= KIBIS_ACCURACY::LEVEL_0 )
1163 {
1164 if( accuracy > KIBIS_ACCURACY::LEVEL_0 )
1165 {
1166 Report( _( "Model has no waveform pair, using [Ramp] instead, poor accuracy" ),
1168 }
1169
1170 getKuKdNoWaveform( aModel, aParam );
1171 }
1172 else if( wfPairs.size() == 1 || accuracy <= KIBIS_ACCURACY::LEVEL_1 )
1173 {
1174 getKuKdOneWaveform( aModel, wfPairs.at( 0 ), aParam );
1175 }
1176 else
1177 {
1178 if( wfPairs.size() > 2 || accuracy <= KIBIS_ACCURACY::LEVEL_2 )
1179 {
1180 Report( _( "Model has more than 2 waveform pairs, using the first two." ),
1182 }
1183
1184 getKuKdTwoWaveforms( aModel, wfPairs.at( 0 ), wfPairs.at( 1 ), aParam );
1185 }
1186
1187 result += "Vku KU GND pwl ( ";
1188
1189 for( size_t i = 0; i < m_t.size(); i++ )
1190 {
1191 result += doubleToString( m_t.at( i ) );
1192 result += " ";
1193 result += doubleToString( m_Ku.at( i ) );
1194 result += " ";
1195 }
1196
1197 result += ") \n";
1198
1199
1200 result += "Vkd KD GND pwl ( ";
1201
1202 for( size_t i = 0; i < m_t.size(); i++ )
1203 {
1204 result += doubleToString( m_t.at( i ) );
1205 result += " ";
1206 result += doubleToString( m_Kd.at( i ) );
1207 result += " ";
1208 }
1209
1210 result += ") \n";
1211
1212 result += aModel.SpiceDie( aParam, 0 );
1213
1214 result += "\n.ENDS DRIVER\n\n";
1215
1216 aDest += result;
1217 break;
1218 }
1219 default:
1220 Report( _( "Invalid model type for a driver." ), RPT_SEVERITY_ERROR );
1221 status = false;
1222 }
1223
1224 return status;
1225}
1226
1227
1228bool KIBIS_PIN::writeSpiceDevice( std::string& aDest, const std::string& aName, KIBIS_MODEL& aModel,
1229 const KIBIS_PARAMETER& aParam )
1230{
1231 bool status = true;
1232
1233 switch( aModel.m_type )
1234 {
1235 case IBIS_MODEL_TYPE::INPUT_STD:
1236 case IBIS_MODEL_TYPE::IO:
1237 case IBIS_MODEL_TYPE::IO_OPEN_DRAIN:
1238 case IBIS_MODEL_TYPE::IO_OPEN_SINK:
1239 case IBIS_MODEL_TYPE::IO_OPEN_SOURCE:
1240 case IBIS_MODEL_TYPE::IO_ECL:
1241 {
1242 std::string result;
1243
1244 result += "\n";
1245 result = "*Device model generated by Kicad using Ibis data.";
1246 result += "\n.SUBCKT ";
1247 result += aName;
1248 result += " GND PIN\n";
1249 result += "\n";
1250 result += "\n";
1251 result += "RPIN 1 PIN ";
1252 result += doubleToString( m_Rpin.value[aParam.m_Rpin] );
1253 result += "\n";
1254 result += "LPIN DIE0 1 ";
1255 result += doubleToString( m_Lpin.value[aParam.m_Lpin] );
1256 result += "\n";
1257 result += "CPIN PIN GND ";
1258 result += doubleToString( m_Cpin.value[aParam.m_Cpin] );
1259 result += "\n";
1260
1261
1262 result += "Vku KU GND pwl ( 0 0 )\n";
1263 result += "Vkd KD GND pwl ( 0 0 )\n";
1264
1265 result += aModel.SpiceDie( aParam, 0 );
1266
1267 result += "\n.ENDS DRIVER\n\n";
1268
1269 aDest = std::move( result );
1270 break;
1271 }
1272 default:
1273 Report( _( "Invalid model type for a device" ), RPT_SEVERITY_ERROR );
1274 status = false;
1275 }
1276
1277 return status;
1278}
1279
1280
1281bool KIBIS_PIN::writeSpiceDiffDriver( std::string& aDest, const std::string& aName,
1282 KIBIS_MODEL& aModel, const KIBIS_PARAMETER& aParam )
1283{
1284 bool status = true;
1285 KIBIS_WAVEFORM* wave = aParam.m_waveform;
1286
1287 if( !wave )
1288 return false;
1289
1290 std::string result;
1291 result = "\n*Differential driver model generated by Kicad using Ibis data. ";
1292
1293 result += "\n.SUBCKT ";
1294 result += aName;
1295 result += " GND PIN_P PIN_N\n";
1296 result += "\n";
1297
1298 status &= writeSpiceDriver( result, aName + "_P", aModel, aParam );
1299 wave->inverted = !wave->inverted;
1300 status &= writeSpiceDriver( result, aName + "_N", aModel, aParam );
1301 wave->inverted = !wave->inverted;
1302
1303
1304 result += "\n";
1305 result += "x1 GND PIN_P " + aName + "_P \n";
1306 result += "x2 GND PIN_N " + aName + "_N \n";
1307 result += "\n";
1308
1309 result += "\n.ENDS " + aName + "\n\n";
1310
1311 if( status )
1312 aDest += result;
1313
1314 return status;
1315}
1316
1317
1318bool KIBIS_PIN::writeSpiceDiffDevice( std::string& aDest, const std::string& aName,
1319 KIBIS_MODEL& aModel, const KIBIS_PARAMETER& aParam )
1320{
1321 bool status = true;
1322
1323 std::string result;
1324 result = "\n*Differential device model generated by Kicad using Ibis data. ";
1325
1326 result += "\n.SUBCKT ";
1327 result += aName;
1328 result += " GND PIN_P PIN_N\n";
1329 result += "\n";
1330
1331 status &= writeSpiceDevice( result, aName + "_P", aModel, aParam );
1332 status &= writeSpiceDevice( result, aName + "_N", aModel, aParam );
1333
1334 result += "\n";
1335 result += "x1 GND PIN_P " + aName + "_P \n";
1336 result += "x2 GND PIN_N " + aName + "_N \n";
1337 result += "\n";
1338
1339 result += "\n.ENDS " + aName + "\n\n";
1340
1341 if( status )
1342 aDest += result;
1343
1344 return status;
1345}
1346
1347
1348KIBIS_MODEL* KIBIS::GetModel( const std::string& aName )
1349{
1350 for( KIBIS_MODEL& model : m_models )
1351 {
1352 if( model.m_name == aName )
1353 return &model;
1354 }
1355
1356 return nullptr;
1357}
1358
1359
1360KIBIS_COMPONENT* KIBIS::GetComponent( const std::string& aName )
1361{
1362 for( KIBIS_COMPONENT& cmp : m_components )
1363 {
1364 if( cmp.m_name == aName )
1365 return &cmp;
1366 }
1367
1368 return nullptr;
1369}
1370
1371
1372void KIBIS_PARAMETER::SetCornerFromString( IBIS_CORNER& aCorner, const std::string& aString )
1373{
1374 if( aString == "MIN" )
1375 aCorner = IBIS_CORNER::MIN;
1376 else if( aString == "MAX" )
1377 aCorner = IBIS_CORNER::MAX;
1378 else
1379 aCorner = IBIS_CORNER::TYP;
1380}
1381
1382
1383std::vector<std::pair<int, double>> KIBIS_WAVEFORM_STUCK_HIGH::GenerateBitSequence() const
1384{
1385 std::vector<std::pair<int, double>> bits;
1386 std::pair<int, double> bit;
1387 bit.first = inverted ? 1 : 0;
1388 bit.second = 0;
1389 return bits;
1390}
1391
1392
1393std::vector<std::pair<int, double>> KIBIS_WAVEFORM_STUCK_LOW::GenerateBitSequence() const
1394{
1395 std::vector<std::pair<int, double>> bits;
1396 std::pair<int, double> bit;
1397 bit.first = inverted ? 0 : 1;
1398 bit.second = 0;
1399 return bits;
1400}
1401
1402std::vector<std::pair<int, double>> KIBIS_WAVEFORM_HIGH_Z::GenerateBitSequence() const
1403{
1404 std::vector<std::pair<int, double>> bits;
1405 return bits;
1406}
1407
1408std::vector<std::pair<int, double>> KIBIS_WAVEFORM_RECTANGULAR::GenerateBitSequence() const
1409{
1410 std::vector<std::pair<int, double>> bits;
1411
1412 for( int i = 0; i < m_cycles; i++ )
1413 {
1414 std::pair<int, double> bit;
1415 bit.first = inverted ? 0 : 1;
1416 bit.second = ( m_ton + m_toff ) * i + m_delay;
1417 bits.push_back( bit );
1418
1419 bit.first = inverted ? 1 : 0;
1420 bit.second = ( m_ton + m_toff ) * i + m_delay + m_ton;
1421 bits.push_back( bit );
1422 }
1423
1424 return bits;
1425}
1426
1427
1428std::vector<std::pair<int, double>> KIBIS_WAVEFORM_PRBS::GenerateBitSequence() const
1429{
1430 std::vector<std::pair<int, double>> bitSequence;
1431 uint8_t polynomial = 0b1100000;
1432 //1100000 = x^7+x^6+1
1433 //10100 = x^5+x^3+1
1434 //110 = x^3+x^2+1
1435 uint8_t seed = 0x12; // Any non zero state
1436 uint8_t lfsr = seed;
1437
1438 if ( m_bitrate == 0 )
1439 return bitSequence;
1440
1441 double period = 1/m_bitrate;
1442 double t = 0;
1443
1444 wxASSERT( m_bits > 0 );
1445
1446 int bits = 0;
1447
1448 do
1449 {
1450 uint8_t lsb = lfsr & 0x01;
1451 bitSequence.emplace_back( ( static_cast<uint8_t>( inverted ) ^ lsb ? 1 : 0 ), t );
1452 lfsr = lfsr >> 1;
1453
1454 if ( lsb )
1455 lfsr ^= polynomial;
1456
1457 t += period;
1458
1459 } while ( ++bits < m_bits );
1460
1461 return bitSequence;
1462}
1463
1465 const IbisWaveform* aFallingWf ) const
1466{
1467 bool status = true;
1468
1469 if( m_cycles < 1 )
1470 {
1471 status = false;
1472 Report( _( "Number of cycles should be greater than 0." ), RPT_SEVERITY_ERROR );
1473 }
1474
1475 if( m_ton <= 0 )
1476 {
1477 status = false;
1478 Report( _( "ON time should be greater than 0." ), RPT_SEVERITY_ERROR );
1479 }
1480
1481 if( m_toff <= 0 )
1482 {
1483 status = false;
1484 Report( _( "OFF time should be greater than 0." ), RPT_SEVERITY_ERROR );
1485 }
1486
1487 if( aRisingWf )
1488 {
1489 if( m_ton < aRisingWf->m_table.m_entries.back().t )
1490 {
1491 status = false;
1492 Report( _( "Rising edge is longer than on time." ), RPT_SEVERITY_WARNING );
1493 }
1494 }
1495
1496 if( aFallingWf )
1497 {
1498 if( m_toff < aFallingWf->m_table.m_entries.back().t )
1499 {
1500 status = false;
1501 Report( _( "Falling edge is longer than off time." ), RPT_SEVERITY_WARNING );
1502 }
1503 }
1504
1505 status &= aRisingWf && aFallingWf;
1506
1507 return status;
1508}
1509
1510
1512 const dvdtTypMinMax& aFallingRp ) const
1513{
1514 bool status = true;
1515
1516 if( m_cycles < 1 )
1517 {
1518 status = false;
1519 Report( _( "Number of cycles should be greater than 0." ), RPT_SEVERITY_ERROR );
1520 }
1521
1522 if( m_ton <= 0 )
1523 {
1524 status = false;
1525 Report( _( "ON time should be greater than 0." ), RPT_SEVERITY_ERROR );
1526 }
1527
1528 if( m_toff <= 0 )
1529 {
1530 status = false;
1531 Report( _( "OFF time should be greater than 0." ), RPT_SEVERITY_ERROR );
1532 }
1533
1534 if( ( m_ton < aRisingRp.value[IBIS_CORNER::TYP].m_dt / 0.6 )
1535 || ( m_ton < aRisingRp.value[IBIS_CORNER::MIN].m_dt / 0.6 )
1536 || ( m_ton < aRisingRp.value[IBIS_CORNER::MAX].m_dt / 0.6 ) )
1537 {
1538 status = false;
1539 Report( _( "Rising edge is longer than ON time." ), RPT_SEVERITY_ERROR );
1540 }
1541
1542 if( ( m_toff < aFallingRp.value[IBIS_CORNER::TYP].m_dt / 0.6 )
1543 || ( m_toff < aFallingRp.value[IBIS_CORNER::MIN].m_dt / 0.6 )
1544 || ( m_toff < aFallingRp.value[IBIS_CORNER::MAX].m_dt / 0.6 ) )
1545 {
1546 status = false;
1547 Report( _( "Falling edge is longer than OFF time." ), RPT_SEVERITY_ERROR );
1548 }
1549
1550 return status;
1551}
1552
1553
1555 const dvdtTypMinMax& aFallingRp ) const
1556{
1557 bool status = true;
1558
1559 if( m_bitrate <= 0 )
1560 {
1561 status = false;
1562 Report( _( "Bitrate should be greater than 0." ), RPT_SEVERITY_ERROR );
1563 }
1564
1565 if( m_bits <= 0 )
1566 {
1567 status = false;
1568 Report( _( "Number of bits should be greater than 0." ), RPT_SEVERITY_ERROR );
1569 }
1570
1571 if( m_bitrate
1572 && ( ( 1 / m_bitrate ) < ( aRisingRp.value[IBIS_CORNER::TYP].m_dt / 0.6
1573 + aFallingRp.value[IBIS_CORNER::TYP].m_dt / 0.6 ) )
1574 && ( ( 1 / m_bitrate ) < ( aRisingRp.value[IBIS_CORNER::TYP].m_dt / 0.6
1575 + aFallingRp.value[IBIS_CORNER::TYP].m_dt / 0.6 ) )
1576 && ( ( 1 / m_bitrate ) < ( aRisingRp.value[IBIS_CORNER::TYP].m_dt / 0.6
1577 + aFallingRp.value[IBIS_CORNER::TYP].m_dt / 0.6 ) ) )
1578 {
1579 status = false;
1580 Report( _( "Bitrate is too high for rising / falling edges" ), RPT_SEVERITY_ERROR );
1581 }
1582
1583 return status;
1584}
1585
1587 const IbisWaveform* aFallingWf ) const
1588{
1589 bool status = true;
1590
1591 if( m_bitrate <= 0 )
1592 {
1593 status = false;
1594 Report( _( "Bitrate should be greater than 0." ), RPT_SEVERITY_ERROR );
1595 }
1596
1597 if( m_bits <= 0 )
1598 {
1599 status = false;
1600 Report( _( "Number of bits should be greater than 0." ), RPT_SEVERITY_ERROR );
1601 }
1602
1603 if( m_bitrate && aRisingWf && aFallingWf
1604 && ( ( 1 / m_bitrate ) < ( aRisingWf->m_table.m_entries.back().t
1605 + aFallingWf->m_table.m_entries.back().t ) ) )
1606 {
1607 status = false;
1608 Report( _( "Bitrate could be too high for rising / falling edges" ), RPT_SEVERITY_WARNING );
1609 }
1610
1611 return status;
1612}
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:1372
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:1281
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:1228
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:969
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:797
bool writeSpiceDiffDevice(std::string &aDest, const std::string &aName, KIBIS_MODEL &aModel, const KIBIS_PARAMETER &aParam)
Definition: kibis.cpp:1318
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:721
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:1113
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:908
std::vector< std::pair< int, double > > GenerateBitSequence() const override
Definition: kibis.cpp:1402
bool Check(const IbisWaveform *aRisingWf, const IbisWaveform *aFallingWf) const override
Definition: kibis.cpp:1586
std::vector< std::pair< int, double > > GenerateBitSequence() const override
Definition: kibis.cpp:1428
double m_bitrate
Definition: kibis.h:138
bool Check(const IbisWaveform *aRisingWf, const IbisWaveform *aFallingWf) const override
Definition: kibis.cpp:1464
std::vector< std::pair< int, double > > GenerateBitSequence() const override
Definition: kibis.cpp:1408
std::vector< std::pair< int, double > > GenerateBitSequence() const override
Definition: kibis.cpp:1383
std::vector< std::pair< int, double > > GenerateBitSequence() const override
Definition: kibis.cpp:1393
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:1348
KIBIS_COMPONENT * GetComponent(const std::string &aName)
Return the component with name aName .
Definition: kibis.cpp:1360
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:72
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
constexpr int delta
#define ku