mirror of https://github.com/KLayout/klayout.git
WIP
This commit is contained in:
parent
a5c730dfc8
commit
8b6d6cef52
|
|
@ -47,7 +47,7 @@ NetlistSpiceReaderOptions::NetlistSpiceReaderOptions ()
|
|||
// ------------------------------------------------------------------------------------------------------
|
||||
|
||||
NetlistSpiceReaderDelegate::NetlistSpiceReaderDelegate ()
|
||||
: mp_netlist (0), m_options (), m_profile (), m_read_all_parameters (true)
|
||||
: mp_netlist (0), m_options (), m_profile (), m_read_all_parameters (false)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ static const char *s_not_connect_prefix = "nc_";
|
|||
// --------------------------------------------------------------------------------
|
||||
|
||||
NetlistSpiceWriterDelegate::NetlistSpiceWriterDelegate ()
|
||||
: mp_writer (0), mp_netlist (0), m_write_all_parameters (true)
|
||||
: mp_writer (0), mp_netlist (0), m_write_all_parameters (false)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
|
@ -288,9 +288,9 @@ std::string NetlistSpiceWriterDelegate::format_params (const db::Device &dev, si
|
|||
double sis = i->si_scaling ();
|
||||
// for compatibility
|
||||
if (fabs (sis * 1e6 - 1.0) < db::epsilon) {
|
||||
os << tl::to_string (v) << "U";
|
||||
os << tl::to_string (v.to_double ()) << "U";
|
||||
} else if (fabs (sis * 1e12 - 1.0) < db::epsilon) {
|
||||
os << tl::to_string (v) << "P";
|
||||
os << tl::to_string (v.to_double ()) << "P";
|
||||
} else {
|
||||
os << tl::to_string (v.to_double () * sis);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -418,6 +418,22 @@ Class<NetlistSpiceReaderDelegateImpl> db_NetlistSpiceReaderDelegate ("db", "Netl
|
|||
gsi::method_ext ("parse_element", &parse_element_fb, "@hide") +
|
||||
gsi::method_ext ("control_statement", &control_statement_fb, "@hide") +
|
||||
gsi::method_ext ("translate_net_name", &translate_net_name_fb, "@hide") +
|
||||
gsi::method ("read_all_parameters=", &NetlistSpiceReaderDelegateImpl::read_all_parameters,
|
||||
"@brief Sets a flag indicating whether to read all device parameters.\n"
|
||||
"If this flag is set to true, all parameters of the devices are read in the default implementation. "
|
||||
"If set to false (the default), only known parameters (i.e. only parameters declared by the device classes in the netlist) are read.\n"
|
||||
"\n"
|
||||
"Note, that you can customize the reader's device input also by reimplementing \\parse_element or \\element. This reimplementation may "
|
||||
"chose to ignore the \\read_all_parameters attribute.\n"
|
||||
"\n"
|
||||
"This attribute has been introduced in version 0.31.0."
|
||||
) +
|
||||
gsi::method ("read_all_parameters=", &NetlistSpiceReaderDelegateImpl::set_read_all_parameters, gsi::arg ("f"),
|
||||
"@brief Gets a flag indicating whether to read all device parameters.\n"
|
||||
"See \\read_all_parameters= for a description of this attribute.\n"
|
||||
"\n"
|
||||
"This attribute has been introduced in version 0.31.0."
|
||||
) +
|
||||
gsi::callback ("start", &NetlistSpiceReaderDelegateImpl::start, &NetlistSpiceReaderDelegateImpl::cb_start, gsi::arg ("netlist"),
|
||||
"@brief This method is called when the reader starts reading a netlist\n"
|
||||
) +
|
||||
|
|
|
|||
|
|
@ -133,6 +133,22 @@ Class<NetlistSpiceWriterDelegateImpl> db_NetlistSpiceWriterDelegate ("db", "Netl
|
|||
) +
|
||||
gsi::method ("format_name", &NetlistSpiceWriterDelegateImpl::format_name, gsi::arg ("name"),
|
||||
"@brief Formats the given name in a SPICE-compatible way"
|
||||
) +
|
||||
gsi::method ("write_all_parameters=", &NetlistSpiceWriterDelegateImpl::set_write_all_parameters,
|
||||
"@brief Sets a flag indicating whether to write all device parameters.\n"
|
||||
"If this flag is set to true, all parameters of the devices are written in the default implementation. "
|
||||
"If set to false (the default), only primary parameters are written.\n"
|
||||
"\n"
|
||||
"Note, that you can customize the writer's device output also by reimplementing \\write_device. This reimplementation may "
|
||||
"chose to ignore the \\write_all_parameters attribute.\n"
|
||||
"\n"
|
||||
"This attribute has been introduced in version 0.31.0."
|
||||
) +
|
||||
gsi::method ("write_all_parameters=", &NetlistSpiceWriterDelegateImpl::set_write_all_parameters, gsi::arg ("f"),
|
||||
"@brief Gets a flag indicating whether to write all device parameters.\n"
|
||||
"See \\write_all_parameters= for a description of this attribute.\n"
|
||||
"\n"
|
||||
"This attribute has been introduced in version 0.31.0."
|
||||
),
|
||||
"@brief Provides a delegate for the SPICE writer for doing special formatting for devices\n"
|
||||
"Supply a customized class to provide a specialized writing scheme for devices. "
|
||||
|
|
|
|||
|
|
@ -379,7 +379,6 @@ TEST(9_DeviceMultipliers)
|
|||
|
||||
{
|
||||
db::NetlistSpiceReader reader;
|
||||
reader.delegate ()->set_read_all_parameters (false);
|
||||
|
||||
tl::InputStream is (path);
|
||||
reader.read (is, nl);
|
||||
|
|
@ -426,7 +425,6 @@ TEST(9_DeviceMultipliers)
|
|||
// read once again, this time with known classes (must not trigger issue-652)
|
||||
{
|
||||
db::NetlistSpiceReader reader;
|
||||
reader.delegate ()->set_read_all_parameters (false);
|
||||
|
||||
tl::InputStream is (path);
|
||||
reader.read (is, nl);
|
||||
|
|
@ -646,7 +644,6 @@ TEST(17_RecursiveExpansion)
|
|||
std::string path = tl::combine_path (tl::combine_path (tl::testdata (), "algo"), "nreader17.cir");
|
||||
|
||||
db::NetlistSpiceReader reader;
|
||||
reader.delegate ()->set_read_all_parameters (false);
|
||||
|
||||
tl::InputStream is (path);
|
||||
reader.read (is, nl);
|
||||
|
|
@ -683,7 +680,6 @@ TEST(17_RecursiveExpansion)
|
|||
std::string path = tl::combine_path (tl::combine_path (tl::testdata (), "algo"), "nreader17b.cir");
|
||||
|
||||
db::NetlistSpiceReader reader;
|
||||
reader.delegate ()->set_read_all_parameters (false);
|
||||
|
||||
tl::InputStream is (path);
|
||||
reader.read (is, nl2);
|
||||
|
|
@ -699,7 +695,6 @@ TEST(18_XSchemOutput)
|
|||
std::string path = tl::combine_path (tl::combine_path (tl::testdata (), "algo"), "nreader18.cir");
|
||||
|
||||
db::NetlistSpiceReader reader;
|
||||
reader.delegate ()->set_read_all_parameters (false);
|
||||
|
||||
tl::InputStream is (path);
|
||||
reader.read (is, nl);
|
||||
|
|
@ -735,7 +730,6 @@ TEST(19_ngspice_ref)
|
|||
std::string path = tl::combine_path (tl::combine_path (tl::testdata (), "algo"), "nreader19.cir");
|
||||
|
||||
db::NetlistSpiceReader reader;
|
||||
reader.delegate ()->set_read_all_parameters (false);
|
||||
|
||||
tl::InputStream is (path);
|
||||
reader.read (is, nl);
|
||||
|
|
@ -772,7 +766,6 @@ TEST(19b_ngspice_ref)
|
|||
std::string path = tl::combine_path (tl::combine_path (tl::testdata (), "algo"), "nreader19b.cir");
|
||||
|
||||
db::NetlistSpiceReader reader;
|
||||
reader.delegate ()->set_read_all_parameters (false);
|
||||
|
||||
tl::InputStream is (path);
|
||||
reader.read (is, nl);
|
||||
|
|
@ -809,7 +802,6 @@ TEST(20_precendence)
|
|||
std::string path = tl::combine_path (tl::combine_path (tl::testdata (), "algo"), "nreader20.cir");
|
||||
|
||||
db::NetlistSpiceReader reader;
|
||||
reader.delegate ()->set_read_all_parameters (false);
|
||||
|
||||
tl::InputStream is (path);
|
||||
reader.read (is, nl);
|
||||
|
|
|
|||
Loading…
Reference in New Issue