This commit is contained in:
Matthias Koefferlein 2023-09-17 19:58:22 +02:00
parent 7c1fd487d6
commit 1333856337
4 changed files with 100 additions and 5 deletions

View File

@ -497,3 +497,45 @@ TEST(5_ReaderFuture)
compare_text_files (path, au_path);
}
TEST(6_ReaderLog)
{
db::LayoutToNetlist l2n;
std::string in_path = tl::combine_path (tl::combine_path (tl::testdata (), "algo"), "l2n_reader_6.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_6.l2n");
compare_text_files (path, au_path);
std::string in_path_s = tl::combine_path (tl::combine_path (tl::testdata (), "algo"), "l2n_reader_6s.l2n");
tl::InputStream is_in_s (in_path_s);
l2n.clear_log_entries ();
db::LayoutToNetlistStandardReader reader_s (is_in_s);
reader_s.read (&l2n);
// verify against the input
path = tmp_file ("tmp2.txt");
{
tl::OutputStream stream (path);
db::LayoutToNetlistStandardWriter writer (stream, false);
writer.write (&l2n);
}
compare_text_files (path, au_path);
}

View File

@ -449,3 +449,38 @@ TEST(2_WriterWithGlobalNets)
db::compare_layouts (_this, ly2, au);
}
}
TEST(3_Messages)
{
db::Layout ly;
db::Cell &tc = ly.cell (ly.add_cell ("TOP"));
db::LayoutToNetlist l2n (db::RecursiveShapeIterator (ly, tc, std::set<unsigned int> ()));
l2n.extract_netlist ();
l2n.log_entry (db::LogEntryData (db::Info, "info"));
l2n.log_entry (db::LogEntryData (db::Warning, "warning"));
l2n.log_entry (db::LogEntryData (db::Error, "error"));
std::string path = tmp_file ("tmp_l2nwriter_3.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_writer_au_3.txt");
compare_text_files (path, au_path);
path = tmp_file ("tmp_l2nwriter_3s.txt");
{
tl::OutputStream stream (path);
db::LayoutToNetlistStandardWriter writer (stream, true);
writer.write (&l2n);
}
au_path = tl::combine_path (tl::combine_path (tl::testdata (), "algo"), "l2n_writer_au_3s.txt");
compare_text_files (path, au_path);
}

View File

@ -1,6 +1,18 @@
#%l2n-klayout
W(TOP)
U(0.001)
H(I B(info))
H(W B(warning))
H(E B(error))
top(TOP)
unit(0.001)
# Layer section
# This section lists the mask layers (drawing or derived) and their connections.
# Mask layers
# Mask layer connectivity
# Log entries
message(info description(info))
message(warning description(warning))
message(error description(error))
# Circuit section
# Circuits are the hierarchical building blocks of the netlist.

6
testdata/algo/l2n_reader_6s.l2n vendored Normal file
View File

@ -0,0 +1,6 @@
#%l2n-klayout
W(TOP)
U(0.001)
H(I B(info))
H(W B(warning))
H(E B(error))