WIP: updated some golden data (only sequence of cells), restored old error messages, proper reporting of cell names in OASIS error messages

This commit is contained in:
Matthias Koefferlein 2020-11-03 21:18:47 +01:00
parent a92ebd0e17
commit 2ef3290f65
7 changed files with 45 additions and 19 deletions

View File

@ -128,9 +128,23 @@ CommonReader::cell_by_id (size_t id) const
}
}
const std::string &
CommonReader::name_for_id (size_t id) const
{
std::map<size_t, std::string>::const_iterator n = m_name_for_id.find (id);
if (n != m_name_for_id.end ()) {
return n->second;
} else {
static std::string empty;
return empty;
}
}
void
CommonReader::rename_cell (db::Layout &layout, size_t id, const std::string &cn)
{
m_name_for_id.insert (std::make_pair (id, cn));
std::map<size_t, std::pair<std::string, db::cell_index_type> >::iterator iid = m_id_map.find (id);
std::map<std::string, std::pair<size_t, db::cell_index_type> >::iterator iname = m_name_map.find (cn);
@ -256,7 +270,7 @@ CommonReader::finish (db::Layout &layout)
for (std::map<size_t, std::pair<std::string, db::cell_index_type> >::const_iterator i = m_id_map.begin (); i != m_id_map.end (); ++i) {
if (i->second.first.empty ()) {
common_reader_warn (tl::sprintf (tl::to_string (tr ("Cell name missing for ID %ld")), i->first));
common_reader_warn (tl::sprintf (tl::to_string (tr ("No cellname defined for cell name id %ld")), i->first));
any_missing = true;
}
}

View File

@ -105,6 +105,11 @@ public:
*/
void rename_cell (db::Layout &layout, size_t id, const std::string &cn);
/**
* @brief Gets the name for a given cell ID if known, otherwise returns an empty string
*/
const std::string &name_for_id (size_t id) const;
/**
* @brief Returns a cell reference by ID
* If the cell does not exist, it's created. It is marked as ghost cell until
@ -139,6 +144,7 @@ protected:
private:
std::map<size_t, std::pair<std::string, db::cell_index_type> > m_id_map;
std::map<std::string, std::pair<size_t, db::cell_index_type> > m_name_map;
std::map<size_t, std::string> m_name_for_id;
CellConflictResolution m_cc_resolution;
};

View File

@ -1153,6 +1153,11 @@ OASISReader::do_read (db::Layout &layout)
cell_index = make_cell (layout, id);
m_cellname = name_for_id (id);
if (m_cellname.empty ()) {
m_cellname = std::string ("#") + tl::to_string (id);
}
} else {
if (m_expect_strict_mode == 1) {
@ -1168,6 +1173,8 @@ OASISReader::do_read (db::Layout &layout)
cell_index = make_cell (layout, name);
m_cellname = name;
}
reset_modal_variables ();
@ -3260,7 +3267,6 @@ OASISReader::do_read_cell (db::cell_index_type cell_index, db::Layout &layout)
m_instances_with_props.clear ();
m_progress.set (m_stream.pos ());
m_cellname = layout.cell_name (cell_index);
bool xy_absolute = true;

View File

@ -570,11 +570,11 @@ TEST(100)
const char *expected =
"begin_lib 0.001\n"
"begin_cell {$4}\n"
"end_cell\n"
"begin_cell {$1}\n"
"box 1 0 {0 100} {1000 1200}\n"
"end_cell\n"
"begin_cell {$4}\n"
"end_cell\n"
"begin_cell {$3}\n"
"sref {$1} 90 1 1 {-10 20}\n"
"sref {$4} 90 1 1 {-10 20}\n"
@ -1327,14 +1327,14 @@ TEST(116)
" {{name} {117}}\n"
"}\n"
"begin_libp $props 0.001\n"
"begin_cell {$2}\n"
"end_cell\n"
"set props {\n"
" {42 {42}}\n"
"}\n"
"begin_cellp $props {$1}\n"
"path 1 0 0 0 0 {0 100} {1000 1200}\n"
"end_cell\n"
"begin_cell {$2}\n"
"end_cell\n"
"end_lib\n"
;
@ -1376,14 +1376,14 @@ TEST(116)
" {{name} {117}}\n"
"}\n"
"begin_libp $props 0.001\n"
"begin_cell {$2}\n"
"end_cell\n"
"set props {\n"
" {42 {42}}\n"
"}\n"
"begin_cellp $props {$1}\n"
"path 1 0 0 0 0 {0 100} {1000 1200}\n"
"end_cell\n"
"begin_cell {$2}\n"
"end_cell\n"
"end_lib\n"
;
@ -1431,17 +1431,17 @@ TEST(116)
"}\n"
"begin_libp $props 0.001\n"
"set props {\n"
" {{S_BOUNDING_BOX} {2,0,0,0,0}}\n"
"}\n"
"begin_cellp $props {$2}\n"
"end_cell\n"
"set props {\n"
" {{S_BOUNDING_BOX} {0,0,100,1000,1100}}\n"
" {42 {42}}\n"
"}\n"
"begin_cellp $props {$1}\n"
"path 1 0 0 0 0 {0 100} {1000 1200}\n"
"end_cell\n"
"set props {\n"
" {{S_BOUNDING_BOX} {2,0,0,0,0}}\n"
"}\n"
"begin_cellp $props {$2}\n"
"end_cell\n"
"end_lib\n"
;

View File

@ -7,10 +7,10 @@
# <test-intention>Explicit assignment of ID's</test-intention>
# <content>
# begin_lib 0.001
# begin_cell {ABC}
# end_cell
# begin_cell {XYZ}
# end_cell
# begin_cell {ABC}
# end_cell
# end_lib
# </content>
# </test>

View File

@ -1,6 +1,6 @@
begin_lib 0.001
begin_cell {ABC}
end_cell
begin_cell {XYZ}
end_cell
begin_cell {ABC}
end_cell
end_lib

View File

@ -1,6 +1,6 @@
begin_lib 0.001
begin_cell {ABC}
end_cell
begin_cell { XYZ}
end_cell
begin_cell {ABC}
end_cell
end_lib