33std::string GetLibraryPath(
const std::string& aBaseName )
36 fn.SetName( aBaseName );
38 return std::string( fn.GetFullPath().ToUTF8() );
65 std::string
path = GetLibraryPath(
"ibis_v1_1" );
99 std::string
path = GetLibraryPath(
"ibis_v5_1" );
362 model =
top.GetModel(
"DQ40_ODT40" );
515 BOOST_TEST(
model->m_fallingWaveforms[0]->m_table.m_entries[2].V.value[0] == 0.6815 );
516 BOOST_TEST(
model->m_fallingWaveforms[0]->m_table.m_entries[2].V.value[1] == 0.7726 );
517 BOOST_TEST(
model->m_fallingWaveforms[0]->m_table.m_entries[2].V.value[2] == 0.6551 );
519 BOOST_TEST(
model->m_fallingWaveforms[0]->m_table.m_entries[3].V.value[0] == 0.6179 );
521 BOOST_TEST(
model->m_fallingWaveforms[0]->m_table.m_entries[3].V.value[2] == 0.6325 );
558 BOOST_TEST(
model->m_submodels[0].m_POWERClamp.m_entries[2].I.value[0] == -10.50e-3 );
559 BOOST_TEST(
model->m_submodels[0].m_POWERClamp.m_entries[2].I.value[1] == -9.514e-3 );
560 BOOST_TEST(
model->m_submodels[0].m_POWERClamp.m_entries[2].I.value[2] == -12.39e-3 );
562 BOOST_TEST(
model->m_submodels[0].m_POWERClamp.m_entries[3].I.value[0] == -12.88e-3 );
563 BOOST_TEST(
model->m_submodels[0].m_POWERClamp.m_entries[3].I.value[1] == -11.66e-3 );
564 BOOST_TEST(
model->m_submodels[0].m_POWERClamp.m_entries[3].I.value[2] == -15.26e-3 );
575 std::string
path = GetLibraryPath(
"ibis_v4_1_series_pin_mapping" );
597 std::string
path = GetLibraryPath(
"ibis_v4_1_r_series" );
628 if( m.
m_name ==
"series_r" )
630 else if( m.
m_name ==
"series_sw" )
632 else if( m.
m_name ==
"series_mosfet" )
674 BOOST_TEST(
comp->m_seriesPinMappings[0].m_modelName ==
"series_r" );
676 BOOST_TEST(
comp->m_seriesPinMappings[1].m_groupName ==
"group_a" );
716 BOOST_TEST(
netlist.find(
"R_G1 ARM_OUT1 DIE_B R='0.001 / ((SW_STATE)" ) != std::string::npos );
718 != std::string::npos );
735double RunSeriesOP(
const std::string& aSubckt,
const std::string& aSubcktName,
736 const std::string& aExtraParams =
"" )
743 return std::nan(
"" );
750 sim->Command(
"bg_halt" );
751 sim->Command(
"remcirc" );
752 sim->Command(
"destroy all" );
755 std::string
deck =
"* KiCad QA Series harness\n";
756 deck +=
"V1 SRC 0 1\n";
757 deck +=
"R_sense SRC PIN_A 1\n";
758 deck +=
"V2 PIN_B 0 0\n";
759 deck +=
"X_dut PIN_A PIN_B " + aSubcktName;
761 if( !aExtraParams.empty() )
762 deck +=
" PARAMS: " + aExtraParams;
766 deck +=
"\n.save all\n.op\n.end\n";
768 if( !
sim->LoadNetlist(
deck ) )
771 return std::nan(
"" );
777 return std::nan(
"" );
780 while(
sim->IsRunning() )
784 sim->SetReporter(
nullptr );
790 std::vector<double>
vSrc =
sim->GetRealVector(
"src" );
791 std::vector<double> vPinA =
sim->GetRealVector(
"pin_a" );
793 if(
vSrc.empty() || vPinA.empty() )
797 for(
const std::string&
name :
sim->AllVectors() )
800 return std::nan(
"" );
803 return (
vSrc.back() - vPinA.back() ) / 1.0;
813 std::string
path = GetLibraryPath(
"ibis_v4_1_r_series" );
827 if( warmup && warmup->LoadNetlist(
"* warmup\nR1 1 0 1k\nV1 1 0 1\n.op\n.end\n" )
830 while( warmup->IsRunning() )
868 double iOn = RunSeriesOP(
subckt,
"DEV_SW",
"SW_STATE=1" );
889std::unique_ptr<SIM_LIBRARY_IBIS> MakeLoadedSeriesLibrary(
const std::string& aIbsPath,
892 auto lib = std::make_unique<SIM_LIBRARY_IBIS>();
894 lib->ReadFile( aIbsPath,
reporter );
905 *aOutModel = candidate;
919 auto lib = MakeLoadedSeriesLibrary( GetLibraryPath(
"ibis_v4_1_r_series" ), &ibisModel );
954 auto lib = MakeLoadedSeriesLibrary( GetLibraryPath(
"ibis_v4_1_r_series" ), &ibisModel );
974 BOOST_TEST( itemParams.find(
"SW_STATE=0.5" ) != std::string::npos );
999 std::string
path = GetLibraryPath(
"ibis_v4_1_r_series" );
1019 std::string
deck =
"* QA harness for two-port Series subckt\n";
1020 deck +=
"V1 SRC 0 1\n";
1021 deck +=
"R_sense SRC PIN_A 1\n";
1022 deck +=
"X_dut PIN_A 0 DEV_R\n";
1024 deck +=
"\n.save all\n.op\n.end\n";
1028 sim->Command(
"destroy all" );
1032 BOOST_TEST_MESSAGE(
"ngspice unavailable; skipping Run_Series_Schematic_Ngspice .op" );
1039 std::vector<double>
vSrc =
sim->GetRealVector(
"src" );
1040 std::vector<double>
vA =
sim->GetRealVector(
"pin_a" );
1067 std::string
path = GetLibraryPath(
"ibis_v5_1" );
1086 waveform->
m_ton = 20e-9;
1087 waveform->
m_toff = 50e-9;
1092 kparams.m_waveform = waveform;
1113 BOOST_TEST(
reporter.GetMessages().Find( wxS(
"more than 2 waveform pairs" ) ) == wxNOT_FOUND );
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)
An exception class to represent a WX assertion.
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("Polyline has "<< chain.PointCount()<< " points")
wxString result
Test unit parsing edge cases and error handling.