Merge pull request #1697 from KLayout/bugfix/issue-1696

Bugfix/issue 1696
This commit is contained in:
Matthias Köfferlein 2024-04-30 15:27:31 +02:00 committed by GitHub
commit 7b3804ce1a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 2260 additions and 4 deletions

View File

@ -395,12 +395,18 @@ void LayoutToNetlistStandardReader::read_netlist (db::Netlist *netlist, db::Layo
throw tl::Exception (tl::to_string (tr ("Duplicate definition of device class: ")) + class_name);
}
db::DeviceClassTemplateBase *dct = db::DeviceClassTemplateBase::template_by_name (templ_name);
if (! dct) {
throw tl::Exception (tl::to_string (tr ("Invalid device class template: ")) + templ_name);
db::DeviceClass *dc;
if (templ_name.empty ()) {
// generic device class (issue #1696)
dc = new db::DeviceClass ();
} else {
db::DeviceClassTemplateBase *dct = db::DeviceClassTemplateBase::template_by_name (templ_name);
if (! dct) {
throw tl::Exception (tl::to_string (tr ("Invalid device class template: ")) + templ_name);
}
dc = dct->create ();
}
db::DeviceClass *dc = dct->create ();
dc->set_name (class_name);
netlist->add_device_class (dc);

View File

@ -539,3 +539,27 @@ TEST(6_ReaderLog)
compare_text_files (path, au_path);
}
// issue #1696
TEST(7_CustomDevice)
{
db::LayoutToNetlist l2n;
std::string in_path = tl::combine_path (tl::combine_path (tl::testdata (), "algo"), "l2n_reader_7.l2n");
tl::InputStream is_in (in_path);
db::LayoutToNetlistStandardReader reader (is_in);
reader.read (&l2n);
// verify against the input
std::string path = tmp_file ("tmp.txt");
{
tl::OutputStream stream (path);
db::LayoutToNetlistStandardWriter writer (stream, false);
writer.write (&l2n);
}
std::string au_path = tl::combine_path (tl::combine_path (tl::testdata (), "algo"), "l2n_reader_au_7.l2n");
compare_text_files (path, au_path);
}

1100
testdata/algo/l2n_reader_7.l2n vendored Normal file

File diff suppressed because it is too large Load Diff

1126
testdata/algo/l2n_reader_au_7.l2n vendored Normal file

File diff suppressed because it is too large Load Diff