API for adding log entries to LVS and L2N databases

This commit is contained in:
Matthias Koefferlein 2025-05-22 19:57:06 +02:00
parent 3e3dcb757e
commit 90c4f654b6
2 changed files with 25 additions and 0 deletions

View File

@ -1118,6 +1118,14 @@ Class<db::LayoutToNetlist> decl_dbLayoutToNetlist ("db", "LayoutToNetlist",
"@brief Reads the extracted netlist from the file.\n"
"This method employs the native format of KLayout.\n"
) +
gsi::method ("clear_log_entries", &db::LayoutToNetlist::clear_log_entries,
"@brief Clears the log entries.\n"
"This method has been introduced in version 0.30.2"
) +
gsi::method ("add_log_entry", &db::LayoutToNetlist::log_entry, gsi::arg ("entry"),
"@brief Adds a log entry.\n"
"This method has been introduced in version 0.30.2"
) +
gsi::iterator ("each_log_entry|#each_error", &db::LayoutToNetlist::begin_log_entries, &db::LayoutToNetlist::end_log_entries,
"@brief Iterates over all log entries collected during device and netlist extraction.\n"
"This method has been introduced in version 0.28.13."

View File

@ -1121,6 +1121,23 @@ END
assert_equal(le[2].to_s, "warning")
assert_equal(le[3].to_s, "error")
le = RBA::LogEntryData::new
le.severity = RBA::LogEntryData::Error
le.message = "A new entry"
le.geometry = RBA::DPolygon::new(RBA::DBox::new(0, 1, 2, 3))
le.cell_name = "MYCELL"
le.category_name = "CAT"
le.category_description = "Cat Desc"
l2n.add_log_entry(le)
le = l2n.each_log_entry.collect { |s| s.to_s }
assert_equal(le.size, 5)
assert_equal(le[4].to_s, "[Cat Desc] In cell MYCELL: A new entry, shape: (0,1;0,3;2,3;2,1)")
l2n.clear_log_entries
le = l2n.each_log_entry.collect { |s| s.to_s }
assert_equal(le.size, 0)
end
def test_22_Layers