38std::string GetLibraryPath(
const std::string& aBaseName )
41 fn.SetName( aBaseName );
43 return std::string( fn.GetFullPath().ToUTF8() );
70 std::string
path = GetLibraryPath(
"ibis_v1_1" );
104 std::string
path = GetLibraryPath(
"ibis_v5_1" );
367 model =
top.GetModel(
"DQ40_ODT40" );
520 BOOST_TEST(
model->m_fallingWaveforms[0]->m_table.m_entries[2].V.value[0] == 0.6815 );
521 BOOST_TEST(
model->m_fallingWaveforms[0]->m_table.m_entries[2].V.value[1] == 0.7726 );
522 BOOST_TEST(
model->m_fallingWaveforms[0]->m_table.m_entries[2].V.value[2] == 0.6551 );
524 BOOST_TEST(
model->m_fallingWaveforms[0]->m_table.m_entries[3].V.value[0] == 0.6179 );
526 BOOST_TEST(
model->m_fallingWaveforms[0]->m_table.m_entries[3].V.value[2] == 0.6325 );
563 BOOST_TEST(
model->m_submodels[0].m_POWERClamp.m_entries[2].I.value[0] == -10.50e-3 );
564 BOOST_TEST(
model->m_submodels[0].m_POWERClamp.m_entries[2].I.value[1] == -9.514e-3 );
565 BOOST_TEST(
model->m_submodels[0].m_POWERClamp.m_entries[2].I.value[2] == -12.39e-3 );
567 BOOST_TEST(
model->m_submodels[0].m_POWERClamp.m_entries[3].I.value[0] == -12.88e-3 );
568 BOOST_TEST(
model->m_submodels[0].m_POWERClamp.m_entries[3].I.value[1] == -11.66e-3 );
569 BOOST_TEST(
model->m_submodels[0].m_POWERClamp.m_entries[3].I.value[2] == -15.26e-3 );
580 std::string
path = GetLibraryPath(
"ibis_v4_1_series_pin_mapping" );
602 std::string
path = GetLibraryPath(
"ibis_v4_1_r_series" );
633 if( m.
m_name ==
"series_r" )
635 else if( m.
m_name ==
"series_sw" )
637 else if( m.
m_name ==
"series_mosfet" )
679 BOOST_TEST(
comp->m_seriesPinMappings[0].m_modelName ==
"series_r" );
681 BOOST_TEST(
comp->m_seriesPinMappings[1].m_groupName ==
"group_a" );
721 BOOST_TEST(
netlist.find(
"R_G1 ARM_OUT1 DIE_B R='0.001 / ((SW_STATE)" ) != std::string::npos );
723 != std::string::npos );
742 REPORTER& Report(
const wxString& aText,
745 m_messages << aText.ToStdString() <<
"\n";
749 bool HasMessage()
const override {
return !m_messages.str().empty(); }
751 void OnSimStateChange( SIMULATOR* aObject,
SIM_STATE aNewState )
override {}
753 std::stringstream m_messages;
758double RunSeriesOP(
const std::string& aSubckt,
const std::string& aSubcktName,
759 const std::string& aExtraParams =
"" )
766 return std::nan(
"" );
773 sim->Command(
"bg_halt" );
774 sim->Command(
"remcirc" );
775 sim->Command(
"destroy all" );
778 std::string
deck =
"* KiCad QA Series harness\n";
779 deck +=
"V1 SRC 0 1\n";
780 deck +=
"R_sense SRC PIN_A 1\n";
781 deck +=
"V2 PIN_B 0 0\n";
782 deck +=
"X_dut PIN_A PIN_B " + aSubcktName;
784 if( !aExtraParams.empty() )
785 deck +=
" PARAMS: " + aExtraParams;
789 deck +=
"\n.save all\n.op\n.end\n";
791 if( !
sim->LoadNetlist(
deck ) )
794 return std::nan(
"" );
800 return std::nan(
"" );
803 while(
sim->IsRunning() )
807 sim->SetReporter(
nullptr );
813 std::vector<double>
vSrc =
sim->GetRealVector(
"src" );
814 std::vector<double> vPinA =
sim->GetRealVector(
"pin_a" );
816 if(
vSrc.empty() || vPinA.empty() )
820 for(
const std::string&
name :
sim->AllVectors() )
823 return std::nan(
"" );
826 return (
vSrc.back() - vPinA.back() ) / 1.0;
836 std::string
path = GetLibraryPath(
"ibis_v4_1_r_series" );
850 if( warmup && warmup->LoadNetlist(
"* warmup\nR1 1 0 1k\nV1 1 0 1\n.op\n.end\n" )
853 while( warmup->IsRunning() )
891 double iOn = RunSeriesOP(
subckt,
"DEV_SW",
"SW_STATE=1" );
912std::unique_ptr<SIM_LIBRARY_IBIS> MakeLoadedSeriesLibrary(
const std::string& aIbsPath,
915 auto lib = std::make_unique<SIM_LIBRARY_IBIS>();
917 lib->ReadFile( aIbsPath,
reporter );
928 *aOutModel = candidate;
942 auto lib = MakeLoadedSeriesLibrary( GetLibraryPath(
"ibis_v4_1_r_series" ), &ibisModel );
977 auto lib = MakeLoadedSeriesLibrary( GetLibraryPath(
"ibis_v4_1_r_series" ), &ibisModel );
997 BOOST_TEST( itemParams.find(
"SW_STATE=0.5" ) != std::string::npos );
1022 std::string
path = GetLibraryPath(
"ibis_v4_1_r_series" );
1042 std::string
deck =
"* QA harness for two-port Series subckt\n";
1043 deck +=
"V1 SRC 0 1\n";
1044 deck +=
"R_sense SRC PIN_A 1\n";
1045 deck +=
"X_dut PIN_A 0 DEV_R\n";
1047 deck +=
"\n.save all\n.op\n.end\n";
1051 sim->Command(
"destroy all" );
1055 BOOST_TEST_MESSAGE(
"ngspice unavailable; skipping Run_Series_Schematic_Ngspice .op" );
1062 std::vector<double>
vSrc =
sim->GetRealVector(
"src" );
1063 std::vector<double>
vA =
sim->GetRealVector(
"pin_a" );
void Report(const std::string &aMsg, SEVERITY aSeverity=RPT_SEVERITY_INFO) const
Print a message.
bool writeSpiceDevice(std::string &aDest, const std::string &aName, KIBIS_MODEL &aModel, const KIBIS_PARAMETER &aParam)
Interface to receive simulation updates from SPICE_SIMULATOR class.
static std::shared_ptr< SPICE_SIMULATOR > CreateInstance(const std::string &aName)
bool SetIbisModel(const SIM_LIBRARY_IBIS &aLib, const std::string &aPinNumber, const std::string &aModelName)
Bind to a KIBIS model, set IO mode from its type, manage sw_state.
void SwitchSingleEndedDiff(bool aDiff) override
IBIS_IO_MODE GetIOMode() const
const std::string & GetSeriesPartnerPin() const
bool ChangePin(const SIM_LIBRARY_IBIS &aLib, const std::string &aPinNumber)
update the list of available models based on the pin number.
std::string GetComponentName() const
const SPICE_GENERATOR & SpiceGenerator() const
const PARAM * FindParam(const std::string &aParamName) const
void SetParamValue(int aParamIndex, const std::string &aValue, SIM_VALUE::NOTATION aNotation=SIM_VALUE::NOTATION::SI)
const SIM_MODEL_PIN & GetPin(unsigned aIndex) const
virtual std::string ItemParams() const
A wrapper for reporting to a wxString object.
std::string GetEeschemaTestDataDir()
Get the configured location of Eeschema test data.
std::string spiceInstanceName
bool isSpiceInstanceParam
const std::string modelPinName
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_SUITE_END()
BOOST_TEST(netlist.find("R_G1 ARM_OUT1 DIE_B R='0.001 / ((SW_STATE)") !=std::string::npos)
IbisParser parser & reporter
BOOST_AUTO_TEST_CASE(Null)
std::string seriesModelName
KIBIS top(path, &reporter)
const IbisMosfetEntry & mosfet
std::vector< double > vSrc
const IbisModel * parsedSwitch
const IbisModel * parsedMosfet
KIBIS_MODEL * mosfetModel
const IbisModel * parsedSeries
BOOST_TEST_INFO("Two-port Series .op current = "<< iDevice)
BOOST_REQUIRE(comp !=nullptr)
BOOST_TEST_MESSAGE("\n=== Real-World Polygon PIP Benchmark ===\n"<< formatTable(table))