diff --git a/src/plugins/streamers/cif/db_plugin/dbCIFReader.cc b/src/plugins/streamers/cif/db_plugin/dbCIFReader.cc index f63d9ffb5..8ad8894f7 100644 --- a/src/plugins/streamers/cif/db_plugin/dbCIFReader.cc +++ b/src/plugins/streamers/cif/db_plugin/dbCIFReader.cc @@ -581,7 +581,7 @@ CIFReader::read_cell (db::Layout &layout, db::Cell &cell, double sf, int level) if (rx >= 0 && ry == 0) { - cell.shapes ((unsigned int) layer).insert (db::Box (sf * (x - 0.5 * w), sf * (y - 0.5 * h), sf * (x + 0.5 * w), sf * (y + 0.5 * h))); + cell.shapes ((unsigned int) layer).insert (db::Box (db::Point (sf * (x - 0.5 * w), sf * (y - 0.5 * h)), db::Point (sf * (x + 0.5 * w), sf * (y + 0.5 * h)))); } else { diff --git a/src/plugins/streamers/cif/db_plugin/dbCIFWriter.cc b/src/plugins/streamers/cif/db_plugin/dbCIFWriter.cc index 67d339867..955eb8569 100644 --- a/src/plugins/streamers/cif/db_plugin/dbCIFWriter.cc +++ b/src/plugins/streamers/cif/db_plugin/dbCIFWriter.cc @@ -184,7 +184,7 @@ CIFWriter::write (db::Layout &layout, tl::OutputStream &stream, const db::SaveLa } // TODO: that can be done smarter ... - while (fabs (xa - floor (0.5 + xa)) > 1e-3 || fabs (ya - floor (0.5 + ya)) > 1e-3) { + for (int n = 0; n < 20 && (fabs (xa - floor (0.5 + xa)) > 1e-3 || fabs (ya - floor (0.5 + ya)) > 1e-3); ++n) { xa *= 2.0; ya *= 2.0; } diff --git a/src/plugins/streamers/cif/unit_tests/dbCIFReader.cc b/src/plugins/streamers/cif/unit_tests/dbCIFReader.cc index c347525a1..e572e9e11 100644 --- a/src/plugins/streamers/cif/unit_tests/dbCIFReader.cc +++ b/src/plugins/streamers/cif/unit_tests/dbCIFReader.cc @@ -194,3 +194,9 @@ TEST(rot_boxes) { run_test (_this, tl::testsrc (), "issue_305.cif", "issue_305_au.gds"); } + +// Issue #568 +TEST(rot_instances) +{ + run_test (_this, tl::testsrc (), "issue_568.cif", "issue_568_au.gds"); +} diff --git a/testdata/cif/issue_568.cif b/testdata/cif/issue_568.cif new file mode 100644 index 000000000..6625b0586 --- /dev/null +++ b/testdata/cif/issue_568.cif @@ -0,0 +1,17 @@ +(CIF generated by the cifwrite library); +DS2 1 10; +9 test_cell2; +L L1D0; +B 1000 1000 500,500; +DF; +DS3 1 10; +9 test_encore; +L L1D0; +DF; +DS1 1 10; +9 test_top_cell; +L L1D0; +C3 R100000,0 T0,0; +C2 R1048576,105207 T0,0; +DF; +E diff --git a/testdata/cif/issue_568_au.gds b/testdata/cif/issue_568_au.gds new file mode 100644 index 000000000..fbca7d584 Binary files /dev/null and b/testdata/cif/issue_568_au.gds differ