KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_library_spice.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-2023 KiCad Developers, see AUTHORS.TXT for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
25#include <eeschema_test_utils.h>
27
28#include <boost/algorithm/string/case_conv.hpp>
29#include <fmt/core.h>
30#include <locale_io.h>
31
32
34{
35public:
36 std::string GetLibraryPath( const std::string& aBaseName )
37 {
38 wxFileName fn( KI_TEST::GetEeschemaTestDataDir() );
39 fn.AppendDir( "spice_netlists" );
40 fn.AppendDir( "libraries" );
41 fn.SetName( aBaseName );
42 fn.SetExt( "lib.spice" );
43
44 return std::string( fn.GetFullPath().ToUTF8() );
45 }
46
47 void LoadLibrary( const std::string& aBaseName )
48 {
49 NULL_REPORTER devnull;
50 std::string path = GetLibraryPath( aBaseName );
51
52 m_library = std::make_unique<SIM_LIBRARY_SPICE>( true );
53 m_library->ReadFile( path, devnull );
54 }
55
56 void CompareToUsualDiodeModel( const SIM_MODEL& aModel, const std::string& aModelName, int aModelIndex )
57 {
58 BOOST_CHECK( aModel.GetType() == SIM_MODEL::TYPE::D );
59 BOOST_CHECK_EQUAL( aModelName,
60 fmt::format( "{}{}_Usual",
61 boost::to_upper_copy( aModel.GetSpiceInfo().modelType ),
62 aModelIndex ) );
63 BOOST_CHECK_EQUAL( aModel.FindParam( "bv" )->value, "1.1u" );
64 BOOST_CHECK_EQUAL( aModel.FindParam( "cjo" )->value, "2.2m" );
65 BOOST_CHECK_EQUAL( aModel.FindParam( "ibv" )->value, "3.3" );
66 BOOST_CHECK_EQUAL( aModel.FindParam( "is" )->value, "4.4k" );
67 BOOST_CHECK_EQUAL( aModel.FindParam( "m_" )->value, "5.5M" );
68 BOOST_CHECK_EQUAL( aModel.FindParam( "n" )->value, "6.6G" );
69 }
70
71 void CompareToEmptyModel( const SIM_MODEL& aModel, const std::string& aModelName, int aModelIndex )
72 {
73 BOOST_TEST_CONTEXT( "Model index: " << aModelIndex )
74 {
75 BOOST_CHECK_EQUAL( aModelName,
76 fmt::format( "{}{}_Empty",
77 boost::to_upper_copy( aModel.GetSpiceInfo().modelType ),
78 aModelIndex ) );
79
80 for( unsigned i = 0; i < aModel.GetParamCount(); ++i )
81 {
82 BOOST_TEST_CONTEXT( "Param name: " << aModel.GetParam( i ).info.name )
83 {
84 BOOST_CHECK_EQUAL( aModel.GetParamOverride( i ).value, "" );
85 }
86 }
87 }
88 }
89
90 void TestTransistor( const SIM_MODEL& aModel, const std::string& aModelName, int aModelIndex,
91 SIM_MODEL::TYPE aType, const std::vector<std::string>& aParamNames )
92 {
93 BOOST_TEST_CONTEXT( "Model index: " << aModelIndex
94 << ", Model name: " << aModelName
95 << ", Model device type: " << aModel.GetDeviceInfo().fieldValue
96 << ", Model type: " << aModel.GetTypeInfo().fieldValue )
97 {
98 if( aModel.GetType() != aType )
99 {
100 aModelIndex++;
101 }
102
103 BOOST_CHECK( aModel.GetType() == aType );
104
105 std::string modelType = aModel.GetSpiceInfo().modelType;
106 std::string fieldValue = aModel.GetTypeInfo().fieldValue;
107
108 // Special case for VDMOS because Ngspice parses it differently.
109 if( modelType == "VDMOS NCHAN" )
110 {
111 modelType = "NMOS";
112 fieldValue = "VD"; // Not "VDMOS" because Ngspice gives an error if this string is
113 // used in a model name (this is a bug in Ngspice, FIXME).
114 }
115
116 if( modelType == "VDMOS PCHAN" )
117 {
118 modelType = "PMOS";
119 fieldValue = "VD";
120 }
121
122 BOOST_CHECK_EQUAL( aModelName, fmt::format( "_{}_{}_{}",
123 aModelIndex,
124 modelType,
125 fieldValue ) );
126
127 for( int i = 0; i < aParamNames.size(); ++i )
128 {
129 std::string paramName = aParamNames.at( i );
130 const SIM_MODEL::PARAM* param = aModel.FindParam( paramName );
131
132 BOOST_TEST_CONTEXT( "Param name: " << paramName )
133 {
134 if( i % 10 == 0 )
135 {
136 BOOST_CHECK( param->value == "0M" || param->value == "0" );
137 }
138 else if( param->info.type == SIM_VALUE::TYPE_INT )
139 {
140 BOOST_CHECK_EQUAL( param->value, fmt::format( "{:d}", i % 10 ) );
141 }
143 {
144 BOOST_CHECK_EQUAL( param->value, "" );
145 }
146 else
147 {
148 BOOST_CHECK_EQUAL( param->value, fmt::format( "{}000.0{}M", i % 10, i % 10 ) );
149 }
150 }
151 }
152 }
153 }
154
155 std::unique_ptr<SIM_LIBRARY_SPICE> m_library;
156};
157
158
159BOOST_FIXTURE_TEST_SUITE( SimLibrarySpice, TEST_SIM_LIBRARY_SPICE_FIXTURE )
160
161
163{
164 LOCALE_IO toggle;
165
166 LoadLibrary( "subckts" );
167
168 const std::vector<SIM_LIBRARY::MODEL> models = m_library->GetModels();
169
170 BOOST_CHECK_EQUAL( models.size(), 7 );
171
172 for( int i = 0; i < models.size(); ++i )
173 {
174 const auto& [modelName, model] = models.at( i );
175
176 switch( i )
177 {
178 case 0:
179 BOOST_CHECK( model.GetType() == SIM_MODEL::TYPE::SUBCKT );
180 BOOST_CHECK_EQUAL( modelName, "NO_PARAMS_0" );
181 break;
182
183 case 1:
184 BOOST_CHECK( model.GetType() == SIM_MODEL::TYPE::SUBCKT );
185 BOOST_CHECK_EQUAL( modelName, "ONE_PARAM_1" );
186 BOOST_REQUIRE_EQUAL( model.GetParamCount(), 1 );
187 BOOST_CHECK_EQUAL( model.GetParam( 0 ).info.name, "PARAM1" );
188 BOOST_CHECK_EQUAL( model.GetParam( 0 ).info.defaultValue, "1" );
189 BOOST_REQUIRE_EQUAL( model.GetPinCount(), 2 );
190 BOOST_CHECK_EQUAL( model.GetPin( 0 ).modelPinName, "1" );
191 BOOST_CHECK_EQUAL( model.GetPin( 1 ).modelPinName, "2" );
192 break;
193
194 case 2:
195 BOOST_CHECK( model.GetType() == SIM_MODEL::TYPE::SUBCKT );
196 BOOST_CHECK_EQUAL( modelName, "ONE_PARAM_SHORT_FORM_2" );
197 BOOST_REQUIRE_EQUAL( model.GetParamCount(), 1 );
198 BOOST_CHECK_EQUAL( model.GetParam( 0 ).info.name, "PARAM1" );
199 BOOST_CHECK_EQUAL( model.GetParam( 0 ).info.defaultValue, "1.0" );
200 BOOST_CHECK_EQUAL( model.GetPin( 0 ).modelPinName, "1" );
201 BOOST_CHECK_EQUAL( model.GetPin( 1 ).modelPinName, "2" );
202 break;
203
204 case 3:
205 BOOST_CHECK( model.GetType() == SIM_MODEL::TYPE::SUBCKT );
206 BOOST_CHECK_EQUAL( modelName, "two_params_3" );
207 BOOST_REQUIRE_EQUAL( model.GetParamCount(), 2 );
208 BOOST_CHECK_EQUAL( model.GetParam( 0 ).info.name, "param1" );
209 BOOST_CHECK_EQUAL( model.GetParam( 0 ).info.defaultValue, "1.1e+1" );
210 BOOST_CHECK_EQUAL( model.GetParam( 1 ).info.name, "param2" );
211 BOOST_CHECK_EQUAL( model.GetParam( 1 ).info.defaultValue, "2.2e+2" );
212 BOOST_REQUIRE_EQUAL( model.GetPinCount(), 2 );
213 BOOST_CHECK_EQUAL( model.GetPin( 0 ).modelPinName, "1" );
214 BOOST_CHECK_EQUAL( model.GetPin( 1 ).modelPinName, "2" );
215 break;
216
217 case 4:
218 BOOST_CHECK( model.GetType() == SIM_MODEL::TYPE::SUBCKT );
219 BOOST_CHECK_EQUAL( modelName, "two_params_short_form_4" );
220 BOOST_REQUIRE_EQUAL( model.GetParamCount(), 2 );
221 BOOST_CHECK_EQUAL( model.GetParam( 0 ).info.name, "param1" );
222 BOOST_CHECK_EQUAL( model.GetParam( 0 ).info.defaultValue, "1.1E+1" );
223 BOOST_CHECK_EQUAL( model.GetParam( 1 ).info.name, "param2" );
224 BOOST_CHECK_EQUAL( model.GetParam( 1 ).info.defaultValue, "2.2E+2" );
225 BOOST_REQUIRE_EQUAL( model.GetPinCount(), 2 );
226 BOOST_CHECK_EQUAL( model.GetPin( 0 ).modelPinName, "1" );
227 BOOST_CHECK_EQUAL( model.GetPin( 1 ).modelPinName, "2" );
228 break;
229
230 case 5:
231 BOOST_CHECK( model.GetType() == SIM_MODEL::TYPE::SUBCKT );
232 BOOST_CHECK_EQUAL( modelName, "NOTHING_5" );
233 BOOST_CHECK_EQUAL( model.GetParamCount(), 0 );
234 BOOST_CHECK_EQUAL( model.GetPinCount(), 0 );
235 break;
236
237 case 6:
238 BOOST_CHECK( model.GetType() == SIM_MODEL::TYPE::SUBCKT );
239 BOOST_CHECK_EQUAL( modelName, "Numparam_inside_6" );
240 BOOST_CHECK_EQUAL( model.GetParamCount(), 0 );
241 BOOST_CHECK_EQUAL( model.GetPinCount(), 2 );
242 break;
243 }
244 }
245}
246
247
249{
250 LOCALE_IO toggle;
251
252 LoadLibrary( "diodes" );
253
254 const std::vector<SIM_LIBRARY::MODEL> models = m_library->GetModels();
255
256 BOOST_CHECK_EQUAL( models.size(), 26 );
257
258 for( int i = 0; i < models.size(); ++i )
259 {
260 const auto& [modelName, model] = models.at( i );
261
262 switch( i )
263 {
264 case 0:
265 BOOST_CHECK( model.GetType() == SIM_MODEL::TYPE::D );
266 BOOST_CHECK_EQUAL( modelName, "1N4148" );
267 BOOST_CHECK_EQUAL( model.FindParam( "bv" )->value, "100" );
268 BOOST_CHECK_EQUAL( model.FindParam( "cjo" )->value, "4p" );
269 BOOST_CHECK_EQUAL( model.FindParam( "ibv" )->value, "100u" );
270 BOOST_CHECK_EQUAL( model.FindParam( "is" )->value, "4n" );
271 BOOST_CHECK_EQUAL( model.FindParam( "m_" )->value, "0.33" );
272 BOOST_CHECK_EQUAL( model.FindParam( "n" )->value, "2" );
273 BOOST_CHECK_EQUAL( model.FindParam( "rs" )->value, "0.5" );
274 BOOST_CHECK_EQUAL( model.FindParam( "tt" )->value, "10n" );
275 BOOST_CHECK_EQUAL( model.FindParam( "vj" )->value, "0.8" );
276 break;
277
278 case 1:
279 BOOST_CHECK( model.GetType() == SIM_MODEL::TYPE::D );
280 BOOST_CHECK_EQUAL( modelName, "D1" );
281 BOOST_CHECK_EQUAL( model.FindParam( "is" )->value, "1.23n" );
282 BOOST_CHECK_EQUAL( model.FindParam( "n" )->value, "1.23" );
283 BOOST_CHECK_EQUAL( model.FindParam( "rs" )->value, ".7890" );
284 BOOST_CHECK_EQUAL( model.FindParam( "ikf" )->value, "12.34m" );
285 BOOST_CHECK_EQUAL( model.FindParam( "xti" )->value, "3" );
286 BOOST_CHECK_EQUAL( model.FindParam( "eg" )->value, "1.23" );
287 BOOST_CHECK_EQUAL( model.FindParam( "cjo" )->value, "0.9p" );
288 BOOST_CHECK_EQUAL( model.FindParam( "m_" )->value, ".56" );
289 BOOST_CHECK_EQUAL( model.FindParam( "vj" )->value, ".78" );
290 BOOST_CHECK_EQUAL( model.FindParam( "fc" )->value, ".9" );
291 BOOST_CHECK_EQUAL( model.FindParam( "isr" )->value, "12.34n" );
292 BOOST_CHECK_EQUAL( model.FindParam( "nr" )->value, "2.345" );
293 BOOST_CHECK_EQUAL( model.FindParam( "bv" )->value, "100" );
294 BOOST_CHECK_EQUAL( model.FindParam( "ibv" )->value, "100u" );
295 BOOST_CHECK_EQUAL( model.FindParam( "tt" )->value, "12.34n" );
296 break;
297
298 case 2:
299 case 3:
300 CompareToUsualDiodeModel( model, modelName, i );
301 break;
302
303 case 4:
304 BOOST_CHECK( model.GetType() == SIM_MODEL::TYPE::D );
305 BOOST_CHECK_EQUAL( modelName, "D4" );
306 BOOST_CHECK_EQUAL( model.FindParam( "is" )->value, "0.1p" );
307 BOOST_CHECK_EQUAL( model.FindParam( "rs" )->value, "2" );
308 BOOST_CHECK_EQUAL( model.FindParam( "cjo" )->value, "3p" );
309 BOOST_CHECK_EQUAL( model.FindParam( "tt" )->value, "45n" );
310 BOOST_CHECK_EQUAL( model.FindParam( "bv" )->value, "678" );
311 BOOST_CHECK_EQUAL( model.FindParam( "ibv" )->value, "0.1p" );
312 break;
313
314 case 5:
315 case 6:
316 case 7:
317 case 8:
318 case 9:
319 CompareToEmptyModel( model, modelName, i );
320 break;
321
322 case 10:
323 case 11:
324 case 12:
325 case 13:
326 case 14:
327 case 15:
328 case 16:
329 case 17:
330 CompareToUsualDiodeModel( model, modelName, i );
331 break;
332
333 case 18:
334 BOOST_CHECK( model.GetType() == SIM_MODEL::TYPE::D );
335 BOOST_CHECK_EQUAL( modelName, "D<>/?:\\|[]!@#$%^&-_18" );
336 BOOST_CHECK_EQUAL( model.FindParam( "n" )->value, "-1.1" );
337 BOOST_CHECK_EQUAL( model.FindParam( "m_" )->value, "2.2" );
338 BOOST_CHECK_EQUAL( model.FindParam( "is" )->value, "-3.3m" );
339 BOOST_CHECK_EQUAL( model.FindParam( "ibv" )->value, "44k" );
340 BOOST_CHECK_EQUAL( model.FindParam( "cjo" )->value, "55u" );
341 BOOST_CHECK_EQUAL( model.FindParam( "bv" )->value, "6.6M" );
342 break;
343
344 case 19:
345 case 20:
346 case 21:
347 CompareToUsualDiodeModel( model, modelName, i );
348 break;
349
350 case 22:
351 BOOST_CHECK( model.GetType() == SIM_MODEL::TYPE::D );
352 BOOST_CHECK_EQUAL( modelName, "D22" );
353 BOOST_CHECK_EQUAL( model.FindParam( "is" )->value, "11.1n" );
354 BOOST_CHECK_EQUAL( model.FindParam( "n" )->value, "2.2" );
355 BOOST_CHECK_EQUAL( model.FindParam( "rs" )->value, "33.3m" );
356 BOOST_CHECK_EQUAL( model.FindParam( "ikf" )->value, "99.9" );
357 BOOST_CHECK_EQUAL( model.FindParam( "xti" )->value, "3" );
358 BOOST_CHECK_EQUAL( model.FindParam( "eg" )->value, "1.1" );
359 break;
360
361 case 23:
362 BOOST_CHECK( model.GetType() == SIM_MODEL::TYPE::D );
363 BOOST_CHECK_EQUAL( modelName, "D23" );
364 BOOST_CHECK_EQUAL( model.FindParam( "is" )->value, "11.1n" );
365 BOOST_CHECK_EQUAL( model.FindParam( "n" )->value, "2.2" );
366 BOOST_CHECK_EQUAL( model.FindParam( "rs" )->value, "33.3m" );
367 BOOST_CHECK_EQUAL( model.FindParam( "ikf" )->value, "111.1" );
368 BOOST_CHECK_EQUAL( model.FindParam( "xti" )->value, "3" );
369 BOOST_CHECK_EQUAL( model.FindParam( "eg" )->value, "2.2" );
370 BOOST_CHECK_EQUAL( model.FindParam( "m_" )->value, ".3" );
371 break;
372
373 case 24:
374 BOOST_CHECK( model.GetType() == SIM_MODEL::TYPE::D );
375 BOOST_CHECK_EQUAL( modelName, "D24" );
376 BOOST_CHECK_EQUAL( model.FindParam( "is" )->value, "11.1n" );
377 BOOST_CHECK_EQUAL( model.FindParam( "n" )->value, "1.1" );
378 BOOST_CHECK_EQUAL( model.FindParam( "rs" )->value, "33.3m" );
379 BOOST_CHECK_EQUAL( model.FindParam( "ikf" )->value, "99.9" );
380 BOOST_CHECK_EQUAL( model.FindParam( "xti" )->value, "3" );
381 BOOST_CHECK_EQUAL( model.FindParam( "eg" )->value, "1.1" );
382 break;
383
384 case 25:
385 BOOST_CHECK( model.GetType() == SIM_MODEL::TYPE::D );
386 BOOST_CHECK_EQUAL( modelName, "D25" );
387 //level
388 BOOST_CHECK_EQUAL( model.FindParam( "is" )->value, "0M" );
389 //js
390 BOOST_CHECK_EQUAL( model.FindParam( "jsw" )->value, "1000.01M" );
391 BOOST_CHECK_EQUAL( model.FindParam( "tnom" )->value, "2000.02M" );
392 //tref
393 BOOST_CHECK_EQUAL( model.FindParam( "rs" )->value, "3000.03M" );
394 BOOST_CHECK_EQUAL( model.FindParam( "trs" )->value, "4000.04M" );
395 //trs1
396 BOOST_CHECK_EQUAL( model.FindParam( "trs2" )->value, "5000.05M" );
397 BOOST_CHECK_EQUAL( model.FindParam( "n" )->value, "6000.06M" );
398 BOOST_CHECK_EQUAL( model.FindParam( "ns" )->value, "7000.07M" );
399 BOOST_CHECK_EQUAL( model.FindParam( "tt" )->value, "8000.08M" );
400 BOOST_CHECK_EQUAL( model.FindParam( "ttt1" )->value, "9000.09M" );
401 BOOST_CHECK_EQUAL( model.FindParam( "ttt2" )->value, "0M" );
402 BOOST_CHECK_EQUAL( model.FindParam( "cjo" )->value, "1000.01M" );
403 //cj0
404 //cj
405 BOOST_CHECK_EQUAL( model.FindParam( "vj" )->value, "2000.02M" );
406 //pb
407 BOOST_CHECK_EQUAL( model.FindParam( "m_" )->value, "3000.03M" );
408 //mj
409 BOOST_CHECK_EQUAL( model.FindParam( "tm1" )->value, "4000.04M" );
410 BOOST_CHECK_EQUAL( model.FindParam( "tm2" )->value, "5000.05M" );
411 BOOST_CHECK_EQUAL( model.FindParam( "cjp" )->value, "6000.06M" );
412 //cjsw
413 BOOST_CHECK_EQUAL( model.FindParam( "php" )->value, "7000.07M" );
414 BOOST_CHECK_EQUAL( model.FindParam( "mjsw" )->value, "8000.08M" );
415 BOOST_CHECK_EQUAL( model.FindParam( "ikf" )->value, "9000.09M" );
416 //ik
417 BOOST_CHECK_EQUAL( model.FindParam( "ikr" )->value, "0M" );
418 BOOST_CHECK_EQUAL( model.FindParam( "nbv" )->value, "1000.01M" );
419 BOOST_CHECK_EQUAL( model.FindParam( "area_" )->value, "2000.02M" );
420 BOOST_CHECK_EQUAL( model.FindParam( "pj_" )->value, "3000.03M" );
421 BOOST_CHECK_EQUAL( model.FindParam( "tlev" )->value, "4" );
422 BOOST_CHECK_EQUAL( model.FindParam( "tlevc" )->value, "5" );
423 BOOST_CHECK_EQUAL( model.FindParam( "eg" )->value, "6000.06M" );
424 BOOST_CHECK_EQUAL( model.FindParam( "xti" )->value, "7000.07M" );
425 BOOST_CHECK_EQUAL( model.FindParam( "cta" )->value, "8000.08M" );
426 //ctc
427 BOOST_CHECK_EQUAL( model.FindParam( "ctp" )->value, "9000.09M" );
428 BOOST_CHECK_EQUAL( model.FindParam( "tpb" )->value, "0M" );
429 //tvj
430 BOOST_CHECK_EQUAL( model.FindParam( "tphp" )->value, "1000.01M" );
431 BOOST_CHECK_EQUAL( model.FindParam( "jtun" )->value, "2000.02M" );
432 BOOST_CHECK_EQUAL( model.FindParam( "jtunsw" )->value, "3000.03M" );
433 BOOST_CHECK_EQUAL( model.FindParam( "ntun" )->value, "4000.04M" );
434 BOOST_CHECK_EQUAL( model.FindParam( "xtitun" )->value, "5000.05M" );
435 BOOST_CHECK_EQUAL( model.FindParam( "keg" )->value, "6000.06M" );
436 BOOST_CHECK_EQUAL( model.FindParam( "kf" )->value, "7000.07M" );
437 BOOST_CHECK_EQUAL( model.FindParam( "af" )->value, "8000.08M" );
438 BOOST_CHECK_EQUAL( model.FindParam( "fc" )->value, "9000.09M" );
439 BOOST_CHECK_EQUAL( model.FindParam( "fcs" )->value, "0M" );
440 BOOST_CHECK_EQUAL( model.FindParam( "bv" )->value, "1000.01M" );
441 BOOST_CHECK_EQUAL( model.FindParam( "ibv" )->value, "2000.02M" );
442 //ib
443 BOOST_CHECK_EQUAL( model.FindParam( "tcv" )->value, "3000.03M" );
444 BOOST_CHECK_EQUAL( model.FindParam( "cond" )->value, "4000.04M" );
445 BOOST_CHECK_EQUAL( model.FindParam( "isr" )->value, "5000.05M" );
446 BOOST_CHECK_EQUAL( model.FindParam( "nr" )->value, "6000.06M" );
447 BOOST_CHECK_EQUAL( model.FindParam( "fv_max" )->value, "7000.07M" );
448 BOOST_CHECK_EQUAL( model.FindParam( "bv_max" )->value, "8000.08M" );
449 BOOST_CHECK_EQUAL( model.FindParam( "id_max" )->value, "9000.09M" );
450 BOOST_CHECK_EQUAL( model.FindParam( "te_max" )->value, "0M" );
451 BOOST_CHECK_EQUAL( model.FindParam( "pd_max" )->value, "1000.01M" );
452 BOOST_CHECK_EQUAL( model.FindParam( "rth0" )->value, "2000.02M" );
453 BOOST_CHECK_EQUAL( model.FindParam( "cth0" )->value, "3000.03M" );
454 BOOST_CHECK_EQUAL( model.FindParam( "lm_" )->value, "4000.04M" );
455 BOOST_CHECK_EQUAL( model.FindParam( "lp_" )->value, "5000.05M" );
456 BOOST_CHECK_EQUAL( model.FindParam( "wm_" )->value, "6000.06M" );
457 BOOST_CHECK_EQUAL( model.FindParam( "wp_" )->value, "7000.07M" );
458 BOOST_CHECK_EQUAL( model.FindParam( "xom" )->value, "8000.08M" );
459 BOOST_CHECK_EQUAL( model.FindParam( "xoi" )->value, "9000.09M" );
460 BOOST_CHECK_EQUAL( model.FindParam( "xm" )->value, "0M" );
461 BOOST_CHECK_EQUAL( model.FindParam( "xp" )->value, "1000.01M" );
462 //d
463 break;
464
465 default:
466 BOOST_FAIL( "Unknown parameter index" );
467 break;
468 }
469 }
470}
471
472
474{
475 LOCALE_IO toggle;
476
477 LoadLibrary( "bjts" );
478
479 const std::vector<SIM_LIBRARY::MODEL> models = m_library->GetModels();
480
481 BOOST_CHECK_EQUAL( models.size(), 8 );
482
483 for( int i = 0; i < models.size(); ++i )
484 {
485 const auto& [modelName, model] = models.at( i );
486
487 switch( i )
488 {
489
490 case 0:
491 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NPN_VBIC,
492 {
493 "rcx",
494 "rci",
495 "vo",
496 "gamm",
497 "hrcf",
498 "rbx",
499 "rbi",
500 "re",
501 "rs",
502 "rbp",
503 "is_",
504 "nf",
505 "nr",
506 "fc",
507 "cbeo",
508 "cje",
509 "pe",
510 "me",
511 "aje",
512 "cbco",
513 "cjc",
514 "qco",
515 "cjep",
516 "pc",
517 "mc",
518 "ajc",
519 "cjcp",
520 "ps",
521 "ms",
522 "ajs",
523 "ibei",
524 "wbe",
525 "nei",
526 "iben",
527 "nen",
528 "ibci",
529 "nci",
530 "ibcn",
531 "ncn",
532 "avc1",
533 "avc2",
534 "isp",
535 "wsp",
536 "nfp",
537 "ibeip",
538 "ibenp",
539 "ibcip",
540 "ncip",
541 "ibcnp",
542 "ncnp",
543 "vef",
544 "ver",
545 "ikf",
546 "ikr",
547 "ikp",
548 "tf",
549 "qtf",
550 "xtf",
551 "vtf",
552 "itf",
553 "tr",
554 "td",
555 "kfn",
556 "afn",
557 "bfn",
558 "xre",
559 "xrb",
560 "xrbi",
561 "xrc",
562 "xrci",
563 "xrs",
564 "xvo",
565 "ea",
566 "eaie",
567 "eaic",
568 "eais",
569 "eane",
570 "eanc",
571 "eans",
572 "xis",
573 "xii",
574 "xin",
575 "tnf",
576 "tavc",
577 "rth",
578 "cth",
579 "vrt",
580 "art",
581 "ccso",
582 "qbm",
583 "nkf",
584 "xikf",
585 "xrcx",
586 "xrbx",
587 "xrbp",
588 "isrr",
589 "xisr",
590 "dear",
591 "eap",
592 "vbbe",
593 "nbbe",
594 "ibbe",
595 "tvbbe1",
596 "tvbbe2",
597 "tnbbe",
598 "ebbe",
599 "dtemp_",
600 "vers",
601 "vref",
602 "vbe_max",
603 "vbc_max",
604 "vce_max"
605 } );
606 break;
607
608 case 1:
609 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PNP_VBIC,
610 {
611 "rcx",
612 "rci",
613 "vo",
614 "gamm",
615 "hrcf",
616 "rbx",
617 "rbi",
618 "re",
619 "rs",
620 "rbp",
621 "is_",
622 "nf",
623 "nr",
624 "fc",
625 "cbeo",
626 "cje",
627 "pe",
628 "me",
629 "aje",
630 "cbco",
631 "cjc",
632 "qco",
633 "cjep",
634 "pc",
635 "mc",
636 "ajc",
637 "cjcp",
638 "ps",
639 "ms",
640 "ajs",
641 "ibei",
642 "wbe",
643 "nei",
644 "iben",
645 "nen",
646 "ibci",
647 "nci",
648 "ibcn",
649 "ncn",
650 "avc1",
651 "avc2",
652 "isp",
653 "wsp",
654 "nfp",
655 "ibeip",
656 "ibenp",
657 "ibcip",
658 "ncip",
659 "ibcnp",
660 "ncnp",
661 "vef",
662 "ver",
663 "ikf",
664 "ikr",
665 "ikp",
666 "tf",
667 "qtf",
668 "xtf",
669 "vtf",
670 "itf",
671 "tr",
672 "td",
673 "kfn",
674 "afn",
675 "bfn",
676 "xre",
677 "xrb",
678 "xrbi",
679 "xrc",
680 "xrci",
681 "xrs",
682 "xvo",
683 "ea",
684 "eaie",
685 "eaic",
686 "eais",
687 "eane",
688 "eanc",
689 "eans",
690 "xis",
691 "xii",
692 "xin",
693 "tnf",
694 "tavc",
695 "rth",
696 "cth",
697 "vrt",
698 "art",
699 "ccso",
700 "qbm",
701 "nkf",
702 "xikf",
703 "xrcx",
704 "xrbx",
705 "xrbp",
706 "isrr",
707 "xisr",
708 "dear",
709 "eap",
710 "vbbe",
711 "nbbe",
712 "ibbe",
713 "tvbbe1",
714 "tvbbe2",
715 "tnbbe",
716 "ebbe",
717 "dtemp_",
718 "vers",
719 "vref",
720 "vbe_max",
721 "vbc_max",
722 "vce_max"
723 } );
724 break;
725
726 case 2:
727 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NPN_GUMMELPOON,
728 {
729 "is_",
730 "nf",
731 "ise",
732 "ne",
733 "bf",
734 "ikf",
735 "vaf",
736 "nr",
737 "isc",
738 "nc",
739 "br",
740 "ikr",
741 "var",
742 "rb",
743 "irb",
744 "rbm",
745 "re",
746 "rc",
747 "xtb",
748 "eg",
749 "xti",
750 "cje",
751 "vje",
752 "mje",
753 "tf",
754 "xtf",
755 "vtf",
756 "itf",
757 "ptf",
758 "cjc",
759 "vjc",
760 "mjc",
761 "xcjc",
762 "tr",
763 "cjs",
764 "vjs",
765 "mjs",
766 "fc"
767 } );
768 break;
769
770 case 3:
771 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PNP_GUMMELPOON,
772 {
773 "is_",
774 "nf",
775 "ise",
776 "ne",
777 "bf",
778 "ikf",
779 "vaf",
780 "nr",
781 "isc",
782 "nc",
783 "br",
784 "ikr",
785 "var",
786 "rb",
787 "irb",
788 "rbm",
789 "re",
790 "rc",
791 "xtb",
792 "eg",
793 "xti",
794 "cje",
795 "vje",
796 "mje",
797 "tf",
798 "xtf",
799 "vtf",
800 "itf",
801 "ptf",
802 "cjc",
803 "vjc",
804 "mjc",
805 "xcjc",
806 "tr",
807 "cjs",
808 "vjs",
809 "mjs",
810 "fc"
811 } );
812 break;
813
814 case 4:
815 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NPN_HICUM2,
816 {
817 "c10",
818 "qp0",
819 "ich",
820 "hf0",
821 "hfe",
822 "hfc",
823 "hjei",
824 "ahjei",
825 "rhjei",
826 "hjci",
827 "ibeis",
828 "mbei",
829 "ireis",
830 "mrei",
831 "ibeps",
832 "mbep",
833 "ireps",
834 "mrep",
835 "mcf",
836 "tbhrec",
837 "ibcis",
838 "mbci",
839 "ibcxs",
840 "mbcx",
841 "ibets",
842 "abet",
843 "tunode",
844 "favl",
845 "qavl",
846 "kavl",
847 "alfav",
848 "alqav",
849 "alkav",
850 "rbi0",
851 "rbx",
852 "fgeo",
853 "fdqr0",
854 "fcrbi",
855 "fqi",
856 "re",
857 "rcx",
858 "itss",
859 "msf",
860 "iscs",
861 "msc",
862 "tsf",
863 "rsu",
864 "csu",
865 "cjei0",
866 "vdei",
867 "zei",
868 "ajei",
869 //"aljei", Alias.
870 "cjep0",
871 "vdep",
872 "zep",
873 "ajep",
874 //"aljep", Alias.
875 "cjci0",
876 "vdci",
877 "zci",
878 "vptci",
879 "cjcx0",
880 "vdcx",
881 "zcx",
882 "vptcx",
883 "fbcpar",
884 //"fbc", Alias.
885 "fbepar",
886 //"fbe", Alias.
887 "cjs0",
888 "vds",
889 "zs",
890 "vpts",
891 "cscp0",
892 "vdsp",
893 "zsp",
894 "vptsp",
895 "t0",
896 "dt0h",
897 "tbvl",
898 "tef0",
899 "gtfe",
900 "thcs",
901 "ahc",
902 //"alhc", Alias.
903 "fthc",
904 "rci0",
905 "vlim",
906 "vces",
907 "vpt",
908 "aick",
909 "delck",
910 "tr",
911 "vcbar",
912 "icbar",
913 "acbar",
914 "cbepar",
915 //"ceox", Alias.
916 "cbcpar",
917 //"ccox", Alias.
918 "alqf",
919 "alit",
920 "flnqs",
921 "kf",
922 "af",
923 "cfbe",
924 "flcono",
925 "kfre",
926 "afre",
927 "latb",
928 "latl",
929 "vgb",
930 "alt0",
931 "kt0",
932 "zetaci",
933 "alvs",
934 "alces",
935 "zetarbi",
936 "zetarbx",
937 "zetarcx",
938 "zetare",
939 "zetacx",
940 "vge",
941 "vgc",
942 "vgs",
943 "f1vg",
944 "f2vg",
945 "zetact",
946 "zetabet",
947 "alb",
948 "dvgbe",
949 "zetahjei",
950 "zetavgbe",
951 "flsh",
952 "rth",
953 "zetarth",
954 "alrth",
955 "cth",
956 "flcomp",
957 "vbe_max",
958 "vbc_max",
959 "vce_max"
960 } );
961 break;
962
963 case 5:
964 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PNP_HICUM2,
965 {
966 "c10",
967 "qp0",
968 "ich",
969 "hf0",
970 "hfe",
971 "hfc",
972 "hjei",
973 "ahjei",
974 "rhjei",
975 "hjci",
976 "ibeis",
977 "mbei",
978 "ireis",
979 "mrei",
980 "ibeps",
981 "mbep",
982 "ireps",
983 "mrep",
984 "mcf",
985 "tbhrec",
986 "ibcis",
987 "mbci",
988 "ibcxs",
989 "mbcx",
990 "ibets",
991 "abet",
992 "tunode",
993 "favl",
994 "qavl",
995 "kavl",
996 "alfav",
997 "alqav",
998 "alkav",
999 "rbi0",
1000 "rbx",
1001 "fgeo",
1002 "fdqr0",
1003 "fcrbi",
1004 "fqi",
1005 "re",
1006 "rcx",
1007 "itss",
1008 "msf",
1009 "iscs",
1010 "msc",
1011 "tsf",
1012 "rsu",
1013 "csu",
1014 "cjei0",
1015 "vdei",
1016 "zei",
1017 "ajei",
1018 //"aljei", Alias.
1019 "cjep0",
1020 "vdep",
1021 "zep",
1022 "ajep",
1023 //"aljep", Alias.
1024 "cjci0",
1025 "vdci",
1026 "zci",
1027 "vptci",
1028 "cjcx0",
1029 "vdcx",
1030 "zcx",
1031 "vptcx",
1032 "fbcpar",
1033 //"fbc", Alias.
1034 "fbepar",
1035 //"fbe", Alias.
1036 "cjs0",
1037 "vds",
1038 "zs",
1039 "vpts",
1040 "cscp0",
1041 "vdsp",
1042 "zsp",
1043 "vptsp",
1044 "t0",
1045 "dt0h",
1046 "tbvl",
1047 "tef0",
1048 "gtfe",
1049 "thcs",
1050 "ahc",
1051 //"alhc", Alias.
1052 "fthc",
1053 "rci0",
1054 "vlim",
1055 "vces",
1056 "vpt",
1057 "aick",
1058 "delck",
1059 "tr",
1060 "vcbar",
1061 "icbar",
1062 "acbar",
1063 "cbepar",
1064 //"ceox", Alias.
1065 "cbcpar",
1066 //"ccox", Alias.
1067 "alqf",
1068 "alit",
1069 "flnqs",
1070 "kf",
1071 "af",
1072 "cfbe",
1073 "flcono",
1074 "kfre",
1075 "afre",
1076 "latb",
1077 "latl",
1078 "vgb",
1079 "alt0",
1080 "kt0",
1081 "zetaci",
1082 "alvs",
1083 "alces",
1084 "zetarbi",
1085 "zetarbx",
1086 "zetarcx",
1087 "zetare",
1088 "zetacx",
1089 "vge",
1090 "vgc",
1091 "vgs",
1092 "f1vg",
1093 "f2vg",
1094 "zetact",
1095 "zetabet",
1096 "alb",
1097 "dvgbe",
1098 "zetahjei",
1099 "zetavgbe",
1100 "flsh",
1101 "rth",
1102 "zetarth",
1103 "alrth",
1104 "cth",
1105 "flcomp",
1106 "vbe_max",
1107 "vbc_max",
1108 "vce_max"
1109 } );
1110
1111 break;
1112
1113 case 6:
1114 case 7:
1115 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NPN_GUMMELPOON,
1116 { "is_", "nf", "ise", "ne", "bf", "ikf", "vaf", "nr", "isc", "nc" } );
1117 break;
1118 }
1119 }
1120}
1121
1122
1124{
1125 LOCALE_IO toggle;
1126
1127 LoadLibrary( "fets" );
1128
1129 const std::vector<SIM_LIBRARY::MODEL> models = m_library->GetModels();
1130
1131 BOOST_CHECK_EQUAL( models.size(), 46 );
1132
1133 for( int i = 0; i < models.size(); ++i )
1134 {
1135 const auto& [modelName, model] = models.at( i );
1136
1137 // TODO: Actually test ALL model parameters.
1138
1139 switch( i )
1140 {
1141 case 0:
1142 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NJFET_SHICHMANHODGES,
1143 { "vt0", "beta", "lambda", "rd", "rs", "cgs", "cgd", "pb", "is_",
1144 "fc" } );
1145 break;
1146
1147 case 1:
1148 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PJFET_SHICHMANHODGES,
1149 { "vt0", "beta", "lambda", "rd", "rs", "cgs", "cgd", "pb", "is_",
1150 "fc" } );
1151 break;
1152
1153 case 2:
1154 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NJFET_PARKERSKELLERN,
1155 { "vbi", "af", "beta", "cds", "cgd", "cgs", "delta", "hfeta", "mvst",
1156 "mxi" } );
1157 break;
1158
1159 case 3:
1160 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PJFET_PARKERSKELLERN,
1161 { "vbi", "af", "beta", "cds", "cgd", "cgs", "delta", "hfeta", "mvst",
1162 "mxi" } );
1163 break;
1164
1165 case 4:
1166 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMES_STATZ,
1167 { "vt0", "alpha", "beta", "lambda", "b", "rd", "rs", "cgs", "cgd_",
1168 "pb" } );
1169 break;
1170
1171 case 5:
1172 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMES_STATZ,
1173 { "vt0", "alpha", "beta", "lambda", "b", "rd", "rs", "cgs", "cgd_",
1174 "pb" } );
1175 break;
1176
1177 case 6:
1178 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMES_YTTERDAL,
1179 { "vto", "lambda", "lambdahf", "beta", "vs", "rd", "rs", "rg", "ri",
1180 "rf" } );
1181 break;
1182
1183 case 7:
1184 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMES_YTTERDAL,
1185 { "vto", "lambda", "lambdahf", "beta", "vs", "rd", "rs", "rg", "ri",
1186 "rf" } );
1187 break;
1188
1189 case 8:
1190 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMES_HFET1,
1191 { "vt0", "lambda", "rd", "rs", "rg", "rdi", "rsi", "rgs", "rgd",
1192 "eta" } );
1193 break;
1194
1195 case 9:
1196 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMES_HFET1,
1197 { "vt0", "lambda", "rd", "rs", "rg", "rdi", "rsi", "rgs", "rgd",
1198 "eta" } );
1199 break;
1200
1201 case 10:
1202 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMES_HFET2,
1203 { "vs", "ggr", "js", "del", "delta", "deltad", "di", "epsi", "eta",
1204 "eta1" } );
1205 break;
1206
1207 case 11:
1208 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMES_HFET2,
1209 { "vs", "ggr", "js", "del", "delta", "deltad", "di", "epsi", "eta",
1210 "eta1" } );
1211 break;
1212
1213 case 12:
1214 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMOS_VDMOS,
1215 {
1216 //"type",
1217 "vto",
1218 //"vth0",
1219 "kp",
1220 "phi",
1221 "lambda",
1222 "theta",
1223 "rd_",
1224 "rs_",
1225 "rg",
1226 "tnom",
1227 "kf",
1228 "af",
1229 //"vdmosn",
1230 //"vdmosp",
1231 //"vdmos",
1232 "rq",
1233 "vq",
1234 "mtriode",
1235 "tcvth",
1236 //"vtotc",
1237 "mu",
1238 //"bex",
1239 "texp0",
1240 "texp1",
1241 "trd1",
1242 "trd2",
1243 "trg1",
1244 "trg2",
1245 "trs1",
1246 "trs2",
1247 "trb1",
1248 "trb2",
1249 "subshift",
1250 "ksubthres",
1251 "tksubthres1",
1252 "tksubthres2",
1253 "bv",
1254 "ibv",
1255 "nbv",
1256 "rds",
1257 "rb",
1258 "n",
1259 "tt",
1260 "eg",
1261 "xti",
1262 "is_",
1263 "vj",
1264 "cjo",
1265 "m_",
1266 "fc",
1267 "cgdmin",
1268 "cgdmax",
1269 "a",
1270 "cgs_",
1271 "rthjc",
1272 "rthca",
1273 "cthj",
1274 "vgs_max",
1275 "vgd_max",
1276 "vds_max",
1277 "vgsr_max",
1278 "vgdr_max",
1279 "pd_max",
1280 "id_max",
1281 "idr_max",
1282 "te_max",
1283 "rth_ext",
1284 "derating"
1285 } );
1286 break;
1287
1288 case 13:
1289 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMOS_VDMOS,
1290 {
1291 //"type",
1292 "vto",
1293 //"vth0",
1294 "kp",
1295 "phi",
1296 "lambda",
1297 "theta",
1298 "rd_",
1299 "rs_",
1300 "rg",
1301 "tnom",
1302 "kf",
1303 "af",
1304 //"vdmosn",
1305 //"vdmosp",
1306 //"vdmos",
1307 "rq",
1308 "vq",
1309 "mtriode",
1310 "tcvth",
1311 //"vtotc",
1312 "mu",
1313 //"bex",
1314 "texp0",
1315 "texp1",
1316 "trd1",
1317 "trd2",
1318 "trg1",
1319 "trg2",
1320 "trs1",
1321 "trs2",
1322 "trb1",
1323 "trb2",
1324 "subshift",
1325 "ksubthres",
1326 "tksubthres1",
1327 "tksubthres2",
1328 "bv",
1329 "ibv",
1330 "nbv",
1331 "rds",
1332 "rb",
1333 "n",
1334 "tt",
1335 "eg",
1336 "xti",
1337 "is_",
1338 "vj",
1339 "cjo",
1340 "m_",
1341 "fc",
1342 "cgdmin",
1343 "cgdmax",
1344 "a",
1345 "cgs_",
1346 "rthjc",
1347 "rthca",
1348 "cthj",
1349 "vgs_max",
1350 "vgd_max",
1351 "vds_max",
1352 "vgsr_max",
1353 "vgdr_max",
1354 "pd_max",
1355 "id_max",
1356 "idr_max",
1357 "te_max",
1358 "rth_ext",
1359 "derating"
1360 } );
1361 break;
1362
1363 case 14:
1364 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMOS_MOS1,
1365 { "vto", "kp", "gamma", "phi", "lambda", "rd_", "rs_", "cbd_", "cbs_",
1366 "is_" } );
1367 break;
1368
1369 case 15:
1370 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMOS_MOS1,
1371 { "vto", "kp", "gamma", "phi", "lambda", "rd_", "rs_", "cbd_", "cbs_",
1372 "is_" } );
1373 break;
1374
1375 case 16:
1376 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMOS_MOS2,
1377 { "vto", "kp", "gamma", "phi", "lambda", "rd_", "rs_", "cbd_", "cbs_",
1378 "is_" } );
1379 break;
1380
1381 case 17:
1382 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMOS_MOS2,
1383 { "vto", "kp", "gamma", "phi", "lambda", "rd_", "rs_", "cbd_", "cbs_",
1384 "is_" } );
1385 break;
1386
1387 case 18:
1388 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMOS_MOS3,
1389 { "vto", "theta", "gamma", "phi", "eta", "rd_", "rs_", "cbd_", "cbs_",
1390 "is_" } );
1391 break;
1392
1393 case 19:
1394 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMOS_MOS3,
1395 { "vto", "theta", "gamma", "phi", "eta", "rd_", "rs_", "cbd_", "cbs_",
1396 "is_" } );
1397 break;
1398
1399 case 20:
1400 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMOS_BSIM1,
1401 { "vfb", "lvfb", "wvfb", "phi", "lphi", "wphi", "k1", "lk1", "wk1",
1402 "k2" } );
1403 break;
1404
1405 case 21:
1406 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMOS_BSIM1,
1407 { "vfb", "lvfb", "wvfb", "phi", "lphi", "wphi", "k1", "lk1", "wk1",
1408 "k2" } );
1409 break;
1410
1411 case 22:
1412 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMOS_BSIM2,
1413 { "bib", "lbib", "wbib", "vghigh", "lvghigh", "wvghigh",
1414 "waib", "bi0", "lbi0", "wbi0" } );
1415 break;
1416
1417 case 23:
1418 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMOS_BSIM2,
1419 { "bib", "lbib", "wbib", "vghigh", "lvghigh", "wvghigh",
1420 "waib", "bi0", "lbi0", "wbi0" } );
1421 break;
1422
1423 case 24:
1424 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMOS_MOS6,
1425 { "vto", "nvth", "gamma", "phi", "lambda", "rd_", "rs_", "cbd_", "cbs_",
1426 "is_" } );
1427 break;
1428
1429 case 25:
1430 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMOS_MOS6,
1431 { "vto", "nvth", "gamma", "phi", "lambda", "rd_", "rs_", "cbd_", "cbs_",
1432 "is_" } );
1433 break;
1434
1435 case 26:
1436 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMOS_BSIM3,
1437 { "tox", "toxm", "cdsc", "cdscb", "cdscd", "cit", "nfactor", "xj",
1438 "vsat", "at" } );
1439 break;
1440
1441 case 27:
1442 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMOS_BSIM3,
1443 { "tox", "toxm", "cdsc", "cdscb", "cdscd", "cit", "nfactor", "xj",
1444 "vsat", "at" } );
1445 break;
1446
1447 case 28:
1448 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMOS_MOS9,
1449 { "vto", "theta", "gamma", "phi", "eta", "rd_", "rs_", "cbd_", "cbs_",
1450 "is_" } );
1451 break;
1452
1453 case 29:
1454 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMOS_MOS9,
1455 { "vto", "theta", "gamma", "phi", "eta", "rd_", "rs_", "cbd_", "cbs_",
1456 "is_" } );
1457 break;
1458
1459 case 30:
1460 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMOS_B4SOI,
1461 { "tox", "toxp", "toxm", "dtoxcv", "cdsc", "cdscb", "cdscd", "cit",
1462 "nfactor", "vsat" } );
1463 break;
1464
1465 case 31:
1466 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMOS_B4SOI,
1467 { "tox", "toxp", "toxm", "dtoxcv", "cdsc", "cdscb", "cdscd", "cit",
1468 "nfactor", "vsat" } );
1469 break;
1470
1471 case 32:
1472 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMOS_BSIM4,
1473 { "rbps0", "rbpsl", "rbpsw", "rbpsnf", "rbpd0", "rbpdl", "rbpdw", "rbpdnf",
1474 "rbpbx0", "rbpbxl" } );
1475 break;
1476
1477 case 33:
1478 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMOS_BSIM4,
1479 { "rbps0", "rbpsl", "rbpsw", "rbpsnf", "rbpd0", "rbpdl", "rbpdw", "rbpdnf",
1480 "rbpbx0", "rbpbxl" } );
1481 break;
1482
1483 case 34:
1484 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMOS_B3SOIFD,
1485 { "tox", "cdsc", "cdscb", "cdscd", "cit", "nfactor", "vsat", "at", "a0",
1486 "ags" } );
1487 break;
1488
1489 case 35:
1490 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMOS_B3SOIFD,
1491 { "tox", "cdsc", "cdscb", "cdscd", "cit", "nfactor", "vsat", "at", "a0",
1492 "ags" } );
1493 break;
1494
1495 case 36:
1496 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMOS_B3SOIDD,
1497 { "tox", "cdsc", "cdscb", "cdscd", "cit", "nfactor", "vsat", "at", "a0",
1498 "ags" } );
1499 break;
1500
1501 case 37:
1502 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMOS_B3SOIDD,
1503 { "tox", "cdsc", "cdscb", "cdscd", "cit", "nfactor", "vsat", "at", "a0",
1504 "ags" } );
1505 break;
1506
1507 case 38:
1508 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMOS_B3SOIPD,
1509 { "tox", "cdsc", "cdscb", "cdscd", "cit", "nfactor", "vsat", "at", "a0",
1510 "ags" } );
1511 break;
1512
1513 case 39:
1514 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMOS_B3SOIPD,
1515 { "tox", "cdsc", "cdscb", "cdscd", "cit", "nfactor", "vsat", "at", "a0",
1516 "ags" } );
1517 break;
1518
1519 case 40:
1520 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMOS_HISIM2,
1521 { "depmue0", "depmue0l", "depmue0lp", "depmue1", "depmue1l",
1522 "depmue1lp", "depmueback0", "depmueback0l", "depmueback0lp",
1523 "depmueback1" } );
1524 break;
1525
1526 case 41:
1527 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMOS_HISIM2,
1528 { "depmue0", "depmue0l", "depmue0lp", "depmue1", "depmue1l", "depmue1lp",
1529 "depmueback0", "depmueback0l", "depmueback0lp", "depmueback1" } );
1530 break;
1531
1532 case 42:
1533 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMOS_HISIMHV1,
1534 { "prd", "prd22", "prd23", "prd24", "prdict1", "prdov13", "prdslp1",
1535 "prdvb", "prdvd", "prdvg11" } );
1536 break;
1537
1538 case 43:
1539 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMOS_HISIMHV1,
1540 { "prd", "prd22", "prd23", "prd24", "prdict1", "prdov13", "prdslp1",
1541 "prdvb", "prdvd", "prdvg11" } );
1542 break;
1543
1544 case 44:
1545 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMOS_HISIMHV2,
1546 { "pjs0d", "pjs0swd", "pnjd", "pcisbkd", "pvdiffjd", "pjs0s", "pjs0sws",
1547 "prs", "prth0", "pvover" } );
1548 break;
1549
1550 case 45:
1551 TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMOS_HISIMHV2,
1552 { "pjs0d", "pjs0swd", "pnjd", "pcisbkd", "pvdiffjd", "pjs0s", "pjs0sws",
1553 "prs", "prth0", "pvover" } );
1554 break;
1555 }
1556 }
1557}
1558
1559
1560BOOST_AUTO_TEST_SUITE_END()
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: locale_io.h:49
A singleton reporter that reports to nowhere.
Definition: reporter.h:192
virtual const PARAM & GetParam(unsigned aParamIndex) const
Definition: sim_model.cpp:780
int GetParamCount() const
Definition: sim_model.h:481
DEVICE_INFO GetDeviceInfo() const
Definition: sim_model.h:460
INFO GetTypeInfo() const
Definition: sim_model.h:461
const PARAM * FindParam(const std::string &aParamName) const
Definition: sim_model.cpp:807
const PARAM & GetParamOverride(unsigned aParamIndex) const
Definition: sim_model.cpp:815
SPICE_INFO GetSpiceInfo() const
Definition: sim_model.h:452
TYPE GetType() const
Definition: sim_model.h:464
@ TYPE_INT
Definition: sim_value.h:68
void LoadLibrary(const std::string &aBaseName)
void TestTransistor(const SIM_MODEL &aModel, const std::string &aModelName, int aModelIndex, SIM_MODEL::TYPE aType, const std::vector< std::string > &aParamNames)
std::string GetLibraryPath(const std::string &aBaseName)
void CompareToUsualDiodeModel(const SIM_MODEL &aModel, const std::string &aModelName, int aModelIndex)
std::unique_ptr< SIM_LIBRARY_SPICE > m_library
void CompareToEmptyModel(const SIM_MODEL &aModel, const std::string &aModelName, int aModelIndex)
std::string GetEeschemaTestDataDir()
Get the configured location of Eeschema test data.
SIM_VALUE::TYPE type
Definition: sim_model.h:379
std::string value
Definition: sim_model.h:400
const INFO & info
Definition: sim_model.h:401
std::string modelType
Definition: sim_model.h:305
BOOST_CHECK(box.ClosestPointTo(VECTOR2D(0, 0))==VECTOR2D(1, 2))
Test suite for KiCad math code.
BOOST_AUTO_TEST_CASE(Subckts)