Ignore extraneous LTSpice parameters for VDMOS models.
Also adds special case handling of VDMOS syntax to allow parens (or extra spaces, linebreaks, etc.) between "VDMOS" and "NCHAN"/"PCHAN". Fixes https://gitlab.com/kicad/code/kicad/issues/14299
This commit is contained in:
parent
a65accd412
commit
a713ee852c
|
@ -210,6 +210,17 @@ bool SIM_MODEL_NGSPICE::canSilentlyIgnoreParam( const std::string& aParamName )
|
|||
}
|
||||
}
|
||||
|
||||
if( GetType() == TYPE::NMOS_VDMOS || GetType() == TYPE::PMOS_VDMOS )
|
||||
{
|
||||
// Ignore the purely informative LTspice-specific parameters "Vds", "Ron" and "Qg".
|
||||
if( aParamName == "vds"
|
||||
|| aParamName == "ron"
|
||||
|| aParamName == "qg" )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -277,12 +277,32 @@ SIM_MODEL::TYPE SPICE_MODEL_PARSER::ReadTypeFromSpiceStrings( const std::string&
|
|||
if( typePrefix == "" )
|
||||
continue;
|
||||
|
||||
// Check if `aTypeString` starts with `typePrefix`.
|
||||
if( boost::starts_with( boost::to_upper_copy( aTypeString ), typePrefix )
|
||||
&& ( level == readLevel || ( !aSkipDefaultLevel && isDefaultLevel && aLevel == "" ) )
|
||||
&& version == aVersion )
|
||||
if( boost::starts_with( typePrefix, "VDMOS" ) )
|
||||
{
|
||||
return type;
|
||||
wxString deviceType = wxString( typePrefix ).BeforeFirst( ' ' ); // VDMOS
|
||||
wxString channelType = wxString( typePrefix ).AfterFirst( ' ' ); // NCHAN or PCHAN
|
||||
|
||||
wxStringTokenizer tokenizer( aTypeString, wxT( " \t\n\r+(" ), wxTOKEN_STRTOK );
|
||||
|
||||
if( tokenizer.HasMoreTokens() && tokenizer.GetNextToken().Upper() == deviceType
|
||||
&& tokenizer.HasMoreTokens() && tokenizer.GetNextToken().Upper() == channelType )
|
||||
{
|
||||
return type;
|
||||
}
|
||||
}
|
||||
else if( boost::starts_with( boost::to_upper_copy( aTypeString ), typePrefix ) )
|
||||
{
|
||||
if( version != aVersion )
|
||||
continue;
|
||||
|
||||
if( level == readLevel )
|
||||
return type;
|
||||
|
||||
if( aSkipDefaultLevel )
|
||||
continue;
|
||||
|
||||
if( isDefaultLevel && aLevel == "" )
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue