Fixed a bug that caused a segfault in the Layout2Netlist object (array repo references to original layout rather than to the working layout)

This commit is contained in:
Matthias Koefferlein 2019-01-05 22:40:53 +01:00
parent cbca1fb530
commit f86f8149eb
5 changed files with 38 additions and 1 deletions

View File

@ -242,7 +242,7 @@ HierarchyBuilder::new_inst (const RecursiveShapeIterator *iter, const db::CellIn
// for new cells, create this instance
if (m_cell_stack.back ().first) {
db::CellInstArray new_inst = inst;
db::CellInstArray new_inst (inst, &mp_target->array_repository ());
new_inst.object () = db::CellInst (m_cm_entry->second);
m_cell_stack.back ().second->insert (new_inst);
}

View File

@ -498,3 +498,40 @@ TEST(6_DisjunctLayersPerHierarchyBranch)
db::compare_layouts (_this, target, tl::testsrc () + "/testdata/algo/hierarchy_builder_au_l4.gds");
}
TEST(7_DetachFromOriginalLayout)
{
// using OASIS means we create a lot of references to array
// and shape repo - we check here whether these references get
// translated or resolved in the hierarchy builder.
std::auto_ptr<db::Layout> ly (new db::Layout (false));
{
std::string fn (tl::testsrc ());
fn += "/testdata/algo/hierarchy_builder_l5.oas.gz";
tl::InputStream stream (fn);
db::Reader reader (stream);
reader.read (*ly);
}
db::Layout target;
db::HierarchyBuilder builder (&target);
for (db::Layout::layer_iterator li = ly->begin_layers (); li != ly->end_layers (); ++li) {
unsigned int li1 = (*li).first;
unsigned int target_layer = target.insert_layer (*(*li).second);
builder.set_target_layer (target_layer);
db::cell_index_type top_cell_index = *ly->begin_top_down ();
db::RecursiveShapeIterator iter (*ly, ly->cell (top_cell_index), li1);
iter.push (&builder);
}
// make sure there is no connection to original layout
ly.reset (0);
CHECKPOINT();
db::compare_layouts (_this, target, tl::testsrc () + "/testdata/algo/hierarchy_builder_au_l5.gds");
}

Binary file not shown.

BIN
testdata/algo/hierarchy_builder_l5.gds vendored Normal file

Binary file not shown.

Binary file not shown.