Improved generation of MASKs for geometry-defined VIAs

This commit is contained in:
Matthias Koefferlein 2020-08-18 23:02:01 +02:00
parent 471fefe79d
commit 3da56815a0
4 changed files with 28 additions and 11 deletions

View File

@ -897,8 +897,6 @@ DEFImporter::read_vias (db::Layout & /*layout*/, db::Cell & /*design*/, double s
std::auto_ptr<RuleBasedViaGenerator> rule_based_vg;
std::auto_ptr<GeometryBasedViaGenerator> geo_based_vg;
unsigned int mask = 0;
std::auto_ptr<LEFDEFViaGenerator> via_generator;
std::set<std::string> seen_layers;
std::vector<std::string> routing_layers;
@ -1018,6 +1016,7 @@ DEFImporter::read_vias (db::Layout & /*layout*/, db::Cell & /*design*/, double s
}
unsigned int mask = 0;
if (test ("+")) {
expect ("MASK");
mask = get_mask (get_long ());

View File

@ -243,27 +243,39 @@ GeometryBasedViaGenerator::GeometryBasedViaGenerator ()
{ }
unsigned int
GeometryBasedViaGenerator::mask_for (const std::string &ln, unsigned int m, unsigned int mask_bottom, unsigned int mask_cut, unsigned int mask_top) const
GeometryBasedViaGenerator::mask_for (const std::string &ln, unsigned int m, unsigned int mask_bottom, unsigned int mask_cut, unsigned int mask_top, const LEFDEFNumberOfMasks *nm) const
{
if (m == 0) {
if (m == 0 || ! nm) {
if (ln == m_bottom_layer) {
return (mask_bottom);
return mask_bottom;
} else if (ln == m_cut_layer) {
return (mask_cut);
return mask_cut;
} else if (ln == m_top_layer) {
return (mask_top);
return mask_top;
}
} else {
if (ln == m_bottom_layer) {
return mask_bottom > 0 ? ((m + mask_bottom - 2) % nm->number_of_masks (m_bottom_layer) + 1) : m;
} else if (ln == m_cut_layer) {
return mask_cut > 0 ? ((m + mask_cut - 2) % nm->number_of_masks (m_cut_layer) + 1) : m;
} else if (ln == m_top_layer) {
return mask_top > 0 ? ((m + mask_top - 2) % nm->number_of_masks (m_top_layer) + 1) : m;
}
}
return m;
}
void
GeometryBasedViaGenerator::create_cell (LEFDEFReaderState &reader, Layout &layout, db::Cell &cell, unsigned int mask_bottom, unsigned int mask_cut, unsigned int mask_top, const LEFDEFNumberOfMasks * /*nm*/)
GeometryBasedViaGenerator::create_cell (LEFDEFReaderState &reader, Layout &layout, db::Cell &cell, unsigned int mask_bottom, unsigned int mask_cut, unsigned int mask_top, const LEFDEFNumberOfMasks *nm)
{
for (std::map <std::string, std::list<std::pair<unsigned int, db::Polygon> > >::const_iterator g = m_polygons.begin (); g != m_polygons.end (); ++g) {
for (std::list<std::pair<unsigned int, db::Polygon> >::const_iterator i = g->second.begin (); i != g->second.end (); ++i) {
std::pair <bool, unsigned int> dl = reader.open_layer (layout, g->first, ViaGeometry, mask_for (g->first, i->first, mask_bottom, mask_cut, mask_top));
std::pair <bool, unsigned int> dl = reader.open_layer (layout, g->first, ViaGeometry, mask_for (g->first, i->first, mask_bottom, mask_cut, mask_top, nm));
if (dl.first) {
cell.shapes (dl.second).insert (i->second);
}
@ -272,7 +284,7 @@ GeometryBasedViaGenerator::create_cell (LEFDEFReaderState &reader, Layout &layou
for (std::map <std::string, std::list<std::pair<unsigned int, db::Box> > >::const_iterator g = m_boxes.begin (); g != m_boxes.end (); ++g) {
for (std::list<std::pair<unsigned int, db::Box> >::const_iterator i = g->second.begin (); i != g->second.end (); ++i) {
std::pair <bool, unsigned int> dl = reader.open_layer (layout, g->first, ViaGeometry, mask_for (g->first, i->first, mask_bottom, mask_cut, mask_top));
std::pair <bool, unsigned int> dl = reader.open_layer (layout, g->first, ViaGeometry, mask_for (g->first, i->first, mask_bottom, mask_cut, mask_top, nm));
if (dl.first) {
cell.shapes (dl.second).insert (i->second);
}

View File

@ -935,7 +935,7 @@ private:
std::map <std::string, std::list<std::pair<unsigned int, db::Box> > > m_boxes;
std::string m_bottom_layer, m_cut_layer, m_top_layer;
unsigned int mask_for (const std::string &ln, unsigned int m, unsigned int mask_bottom, unsigned int mask_cut, unsigned int mask_top) const;
unsigned int mask_for (const std::string &ln, unsigned int m, unsigned int mask_bottom, unsigned int mask_cut, unsigned int mask_top, const LEFDEFNumberOfMasks *nm) const;
};
/**

View File

@ -308,6 +308,12 @@ TEST(21)
run_test (_this, "def12", "lef:test.lef+def:test.def", "au.oas.gz", opt);
}
TEST(22)
{
db::LEFDEFReaderOptions opt = default_options ();
run_test (_this, "def13", "map:test.map+lef:test.lef_5.8+def:top.def.gz", "au.oas.gz", opt);
}
TEST(100)
{
run_test (_this, "issue-172", "lef:in.lef+def:in.def", "au.oas.gz", default_options (), false);