Reading all parameters declared by incoming parameter expressions, changing the evaluation such that no defaults are required for 'M' parameter

This commit is contained in:
Matthias Koefferlein 2026-06-13 17:35:17 +02:00
parent 12071e7300
commit 4d67c49b75
3 changed files with 28 additions and 22 deletions

View File

@ -501,10 +501,10 @@ DeviceClassResistor::DeviceClassResistor ()
sp.incoming_parameters = {
{ "M", "" }, // drop
// apply scaling if available
{ "R", "(R||$)/(M||1.0)" },
{ "A", "A*(M||1.0)" },
{ "W", "W*(M||1.0)" },
{ "P", "P*(M||1.0)" }
{ "R", "(R||$)/M" },
{ "A", "A*M" },
{ "W", "W*M" },
{ "P", "P*M" }
};
set_spice_profile (std::string ("*"), sp);
@ -560,9 +560,9 @@ DeviceClassCapacitor::DeviceClassCapacitor ()
sp.incoming_parameters = {
{ "M", "" }, // drop
// apply scaling if available
{ "C", "(C||$)*(M||1.0)" },
{ "A", "A*(M||1.0)" },
{ "P", "P*(M||1.0)" }
{ "C", "(C||$)*M" },
{ "A", "A*M" },
{ "P", "P*M" }
};
set_spice_profile (std::string ("*"), sp);
@ -614,7 +614,7 @@ DeviceClassInductor::DeviceClassInductor ()
sp.incoming_parameters = {
{ "M", "" }, // drop
// apply scaling if available
{ "L", "(L||$)/(M||1.0)" }
{ "L", "(L||$)/M" }
};
set_spice_profile (std::string ("*"), sp);
@ -649,8 +649,8 @@ DeviceClassDiode::DeviceClassDiode ()
sp.incoming_parameters = {
{ "M", "" }, // drop
// apply scaling if available
{ "A", "A*(M||1.0)" },
{ "P", "P*(M||1.0)" }
{ "A", "A*M" },
{ "P", "P*M" }
};
set_spice_profile (std::string ("*"), sp);
@ -697,11 +697,11 @@ DeviceClassMOS3Transistor::DeviceClassMOS3Transistor ()
{ "M", "" }, // drop
// apply scaling if available
{ "L", "_" },
{ "W", "W*(M||1.0)" },
{ "AS", "AS*(M||1.0)" },
{ "PS", "PS*(M||1.0)" },
{ "AD", "AD*(M||1.0)" },
{ "PD", "PD*(M||1.0)" }
{ "W", "W*M" },
{ "AS", "AS*M" },
{ "PS", "PS*M" },
{ "AD", "AD*M" },
{ "PD", "PD*M" }
};
set_spice_profile (std::string ("*"), sp);
@ -1001,12 +1001,12 @@ DeviceClassBJT3Transistor::DeviceClassBJT3Transistor ()
{ "M", "" }, // drop
// apply scaling if available
{ "NE", "_" },
{ "AE", "AE*(M||1.0)" },
{ "PE", "PE*(M||1.0)" },
{ "AB", "AB*(M||1.0)" },
{ "PB", "PB*(M||1.0)" },
{ "AC", "AC*(M||1.0)" },
{ "PC", "PC*(M||1.0)" }
{ "AE", "AE*M" },
{ "PE", "PE*M" },
{ "AB", "AB*M" },
{ "PB", "PB*M" },
{ "AC", "AC*M" },
{ "PC", "PC*M" }
};
set_spice_profile (std::string ("*"), sp);

View File

@ -594,6 +594,12 @@ bool NetlistSpiceReaderDelegate::element (db::Circuit *circuit, const std::strin
}
}
for (auto d = dict.begin (); d != dict.end (); ++d) {
if (! d->first.empty () && d->first.front () != '*' && all_params.find (d->first) == all_params.end ()) {
all_params.insert (std::make_pair (d->first, (const db::DeviceParameterDefinition *) 0));
}
}
for (auto p = all_params.begin (); p != all_params.end (); ++p) {
std::map<std::string, std::string>::const_iterator id;

View File

@ -1077,7 +1077,7 @@ TEST(28_SpiceProfiles3)
EXPECT_EQ (nl.to_string (),
"circuit TOP ();\n"
" device NMOS '1' (S=N3,G=N2,D=N1,B=N1) (L=0.25,W=3,AS=0,AD=0,PS=0,PD=0,X=200);\n"
" device PMOS '2' (S=N3,G=N2,D=N5,B=N5) (L=0.25,W=4,AS=0,AD=0,PS=0,PD=0,Y=HELLO!);\n"
" device PMOS '2' (S=N3,G=N2,D=N5,B=N5) (L=0.25,W=4,AS=0,AD=0,PS=0,PD=0,X=42,Y=HELLO!);\n"
"end;\n"
);
}