Fixed issue #1499 (strm2oas: support LAYER <layername> TYPE OVERLAP ; for L-shaped abstracts)

This commit is contained in:
Matthias Koefferlein 2023-10-06 11:41:16 +02:00
parent 01c19048aa
commit c62480c49b
4 changed files with 64 additions and 1 deletions

View File

@ -24,6 +24,7 @@
#include "dbLEFDEFImporter.h"
#include "dbLayoutUtils.h"
#include "dbTechnology.h"
#include "dbShapeProcessor.h"
#include "tlStream.h"
#include "tlProgress.h"
@ -480,6 +481,55 @@ GeometryBasedLayoutGenerator::add_via (const std::string &vn, const db::Trans &t
m_vias.back ().top_mask = top_mask;
}
void
GeometryBasedLayoutGenerator::subtract_overlap_from_outline (const std::set<std::string> &overlap_layers)
{
db::Shapes all_overlaps;
std::vector<std::map <std::pair<std::string, LayerDetailsKey>, db::Shapes>::iterator> to_remove;
for (auto s = m_shapes.begin (); s != m_shapes.end (); ++s) {
if (overlap_layers.find (s->first.first) != overlap_layers.end ()) {
all_overlaps.insert (s->second);
to_remove.push_back (s);
}
}
for (auto i = to_remove.begin (); i != to_remove.end (); ++i) {
m_shapes.erase (*i);
}
if (all_overlaps.empty ()) {
return;
}
for (auto s = m_shapes.begin (); s != m_shapes.end (); ++s) {
if (s->first.second.purpose != Outline) {
continue;
}
db::ShapeProcessor proc;
size_t pn = 0;
for (auto sh = s->second.begin (db::ShapeIterator::All); ! sh.at_end (); ++sh) {
proc.insert (*sh, pn);
pn += 2;
}
pn = 1;
for (auto sh = all_overlaps.begin (db::ShapeIterator::All); ! sh.at_end (); ++sh) {
proc.insert (*sh, pn);
pn += 2;
}
db::BooleanOp op (db::BooleanOp::ANotB);
db::ShapeGenerator sg (s->second, true /*clear shapes*/);
db::PolygonGenerator out (sg, true, true);
proc.process (out, op);
}
}
// -----------------------------------------------------------------------------------
// LEFDEFTechnologyComponent implementation

View File

@ -1213,6 +1213,8 @@ public:
m_fixedmask = f;
}
void subtract_overlap_from_outline (const std::set<std::string> &overlap_layers);
private:
struct Via {
Via () : bottom_mask (0), cut_mask (0), top_mask (0) { }

View File

@ -721,6 +721,8 @@ LEFImporter::read_layer (Layout & /*layout*/)
m_routing_layers.insert (ln);
} else if (type == "CUT") {
m_cut_layers.insert (ln);
} else if (type == "OVERLAP") {
m_overlap_layers.insert (ln);
}
expect (";");
@ -1029,6 +1031,7 @@ LEFImporter::read_macro (Layout &layout)
}
mg->add_box (std::string (), Outline, db::Box (-origin, -origin + size), 0, 0);
mg->subtract_overlap_from_outline (m_overlap_layers);
MacroDesc macro_desc;
macro_desc.foreign_name = foreign_name;

View File

@ -94,6 +94,14 @@ public:
return m_cut_layers.find (layer) != m_cut_layers.end ();
}
/**
* @brief Returns true if the given layer is an overlap layer
*/
bool is_overlap_layer (const std::string &layer) const
{
return m_overlap_layers.find (layer) != m_overlap_layers.end ();
}
/**
* @brief Returns the number of masks for the given layer
*/
@ -141,7 +149,7 @@ private:
std::map<std::string, std::pair<double, double> > m_min_widths;
std::map<std::string, MacroDesc> m_macros;
std::map<std::string, ViaDesc> m_vias;
std::set<std::string> m_routing_layers, m_cut_layers;
std::set<std::string> m_routing_layers, m_cut_layers, m_overlap_layers;
std::map<std::string, unsigned int> m_num_masks;
std::vector <db::Trans> get_iteration (double dbu);