KiCad PCB EDA Suite
Loading...
Searching...
No Matches
qaIbisParser.cpp
Go to the documentation of this file.
1#include "../../eeschema/sim/kibis/kibis.h"
2#include <wx/textfile.h>
3
4int main( void )
5{
6 //KIBIS* k1 = new KIBIS( "ibis_v1_1.ibs" );
7 //KIBIS* k2 = new KIBIS( "ibis_v2_1.ibs" );
8 //KIBIS* k4 = new KIBIS( "sn74lvc541a.ibs" );
9 KIBIS* k4 = new KIBIS( "ibis_lan8670_1_2_1v3.ibs" );
10
11 KIBIS_COMPONENT& comp = k4->m_components.at( 0 );
12
13 std::cout << "Component: " << comp.m_name << std::endl;
14
15 for( KIBIS_PIN& pin : comp.m_pins )
16 {
17 std::cout << "--Pin: " << pin.m_pinNumber << " " << pin.m_signalName << std::endl;
18 }
19
20
21 KIBIS_PIN* pin1 = comp.GetPin( "30" );
22 KIBIS_PIN* pin2 = comp.GetPin( "31" );
23
24
25 std::cout << "pin1 name: " << pin1->m_signalName << std::endl;
26 std::cout << "pin2 name: " << pin2->m_signalName << std::endl;
27 std::cout << "pin1 model length: " << pin1->m_models.size()<< std::endl;
28 std::cout << "pin2 model length: " << pin2->m_models.size()<< std::endl;
29 std::string* tmp1 = new std::string();
30 std::string* tmp2 = new std::string();
31 std::string* tmp3 = new std::string();
32 std::string* tmp4 = new std::string();
33
35 wave->m_ton = 80e-9;
36 wave->m_toff = 80e-9;
37 wave->m_cycles = 10;
38 wave->m_delay = 0;
39 //KIBIS_WAVEFORM_STUCK_HIGH* wave = new KIBIS_WAVEFORM_STUCK_HIGH();
40
41 std::cout << "WAVEFORM TYPE IN QA: " << wave->GetType() << std::endl;
42 std::cout << pin2->m_models.at(0)->m_name << std::endl;
43
44 KIBIS_PARAMETER params;
45
47
48 pin2->writeSpiceDevice( tmp4, "device_typ", *( pin2->m_models.at( 0 ) ), params );
49
50 KIBIS_MODEL* model1 = pin1->m_models.at( 0 );
51 std::cout << "Model used for driver: " << model1->m_name << std::endl;
52 pin1->writeSpiceDiffDriver( tmp1, "driver_typ", *( model1 ), params );
53
54 wxTextFile file( "output.sp" );
55 if( file.Exists() )
56 {
57 file.Clear();
58 }
59 else
60 {
61 file.Create();
62 }
63 file.AddLine( *tmp1 );
64 file.AddLine( *tmp2 );
65 file.AddLine( *tmp3 );
66 file.AddLine( *tmp4 );
67
68 wxString simul = "";
69 simul += "x1 0 OUT_1 OUT_2 driver_typ \n";
70 simul += "R1 OUT_1 COM 25\n";
71 simul += "R2 OUT_2 COM 25\n";
72 simul += "V1 COM 0 1.25\n";
73 simul += ".tran 0.1n 1000n \n";
74 simul += ".control run \n";
75 simul += "run \n";
76 simul += "plot v(OUT_1) v(OUT_2)\n";
77 //simul += "plot v(x1.KU) v(x1.KD) v(1) v(x1.DIEBUFF) \n";
78 simul += ".endc \n";
79 simul += ".end \n";
80
81
82 file.AddLine( simul );
83
84 file.Write();
85
86
87 std::cout << "Done" << std::endl;
88
89 return 1;
90}
std::vector< KIBIS_PIN > m_pins
Definition: kibis.h:422
KIBIS_PIN * GetPin(std::string aPinNumber)
Get a pin by its number ( 1, 2, A1, A2, ... )
Definition: kibis.cpp:331
std::string m_name
Name of the component.
Definition: kibis.h:418
std::string m_name
Definition: kibis.h:219
KIBIS_WAVEFORM * m_waveform
Definition: kibis.h:190
bool writeSpiceDiffDriver(std::string *aDest, std::string aName, KIBIS_MODEL &aModel, KIBIS_PARAMETER &aParam)
Definition: kibis.cpp:1309
std::vector< KIBIS_MODEL * > m_models
Definition: kibis.h:334
std::string m_signalName
Name of the pin Examples : "VCC", "GPIOA", "CLK", etc...
Definition: kibis.h:317
bool writeSpiceDevice(std::string *aDest, std::string aName, KIBIS_MODEL &aModel, KIBIS_PARAMETER &aParam)
Definition: kibis.cpp:1257
KIBIS_WAVEFORM_TYPE GetType()
Definition: kibis.h:67
Definition: kibis.h:433
std::vector< KIBIS_COMPONENT > m_components
Definition: kibis.h:443
int main(void)
Definition: qaIbisParser.cpp:4