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