diff --git a/src/plugins/streamers/oasis/db_plugin/dbOASISWriter.cc b/src/plugins/streamers/oasis/db_plugin/dbOASISWriter.cc index 77f82f653..8d486117e 100644 --- a/src/plugins/streamers/oasis/db_plugin/dbOASISWriter.cc +++ b/src/plugins/streamers/oasis/db_plugin/dbOASISWriter.cc @@ -1998,10 +1998,10 @@ OASISWriter::write (const db::CellInstArray &inst, db::properties_id_type prop_i if (rep != db::Repetition ()) { for (db::RepetitionIterator r = rep.begin (); ! r.at_end (); ++r) { - write_inst_with_rep (inst, prop_id, *r, array_rep); + write_inst_with_rep (inst, prop_id, *r + po, array_rep); } } else { - write_inst_with_rep (inst, prop_id, db::Vector (), array_rep); + write_inst_with_rep (inst, prop_id, po, array_rep); } } else if (inst.is_regular_array (a, b, amax, bmax) && (amax > 1 || bmax > 1)) { diff --git a/src/plugins/streamers/oasis/unit_tests/dbOASISWriterTests.cc b/src/plugins/streamers/oasis/unit_tests/dbOASISWriterTests.cc index b7d70b664..c632840b3 100644 --- a/src/plugins/streamers/oasis/unit_tests/dbOASISWriterTests.cc +++ b/src/plugins/streamers/oasis/unit_tests/dbOASISWriterTests.cc @@ -1805,3 +1805,45 @@ TEST(119_WithAndWithoutContext) } } + +TEST(120_IrregularInstRepetitions) +{ + db::Manager m (false); + db::Layout g (&m); + + db::cell_index_type top = g.add_cell ("TOP"); + db::cell_index_type c1 = g.add_cell ("C1"); + + db::Vector pts[3] = { db::Vector (0, 10), db::Vector (0, 20), db::Vector (0, 30) }; + + unsigned int l1 = g.insert_layer (db::LayerProperties (1, 0)); + g.cell (c1).shapes (l1).insert (db::Box (-5, -5, 5, 5)); + db::iterated_array *reps = new db::iterated_array (pts + 0, pts + 3); + g.cell (top).shapes (l1).insert (db::array (db::Box (-5, -5, 5, 5), db::UnitTrans (), reps)); + + db::iterated_array *rep = new db::iterated_array (pts + 0, pts + 3); + db::CellInstArray ci1 (db::CellInst (c1), db::Trans (db::Vector (10, 0)), rep); + g.cell (top).insert (ci1); + + std::string tmp_file = tl::TestBase::tmp_file (tl::sprintf ("tmp_dbOASISWriter120.oas")); + + { + tl::OutputStream out (tmp_file); + db::SaveLayoutOptions options; + options.set_format ("OASIS"); + db::Writer writer (options); + writer.write (g, out); + } + + { + tl::InputStream in (tmp_file); + db::Reader reader (in); + db::Layout gg; + reader.set_warnings_as_errors (true); + reader.read (gg); + + CHECKPOINT (); + db::compare_layouts (_this, gg, tl::testdata () + "/oasis/dbOASISWriter120_au.gds", db::NoNormalization); + } + +} diff --git a/testdata/oasis/dbOASISWriter120_au.gds b/testdata/oasis/dbOASISWriter120_au.gds new file mode 100644 index 000000000..39355df92 Binary files /dev/null and b/testdata/oasis/dbOASISWriter120_au.gds differ