Generalized concept of region, texts etc. into 'shape collections'. Fixed LVS and DRC tests.

This commit is contained in:
Matthias Koefferlein 2020-05-21 23:59:30 +02:00
parent 5795ec8b07
commit c682cc85d0
62 changed files with 681 additions and 410 deletions

View File

@ -194,7 +194,9 @@ SOURCES = \
dbFlatTexts.cc \
dbTextsUtils.cc \
dbOriginalLayerTexts.cc \
dbNetShape.cc
dbNetShape.cc \
dbShapeCollection.cc \
gsiDeclDbShapeCollection.cc
HEADERS = \
dbArray.h \
@ -350,7 +352,8 @@ HEADERS = \
dbFlatTexts.h \
dbTextsUtils.h \
dbOriginalLayerTexts.h \
dbNetShape.h
dbNetShape.h \
dbShapeCollection.h
!equals(HAVE_QT, "0") {

View File

@ -86,34 +86,33 @@ private:
DeepEdgePairs::DeepEdgePairs ()
: AsIfFlatEdgePairs (), m_deep_layer ()
: AsIfFlatEdgePairs ()
{
// .. nothing yet ..
}
DeepEdgePairs::DeepEdgePairs (const RecursiveShapeIterator &si, DeepShapeStore &dss)
: AsIfFlatEdgePairs (), m_deep_layer (dss.create_edge_pair_layer (si))
: AsIfFlatEdgePairs ()
{
// .. nothing yet ..
set_deep_layer (dss.create_edge_pair_layer (si));
}
DeepEdgePairs::DeepEdgePairs (const RecursiveShapeIterator &si, DeepShapeStore &dss, const db::ICplxTrans &trans)
: AsIfFlatEdgePairs (), m_deep_layer (dss.create_edge_pair_layer (si, trans))
: AsIfFlatEdgePairs ()
{
// .. nothing yet ..
set_deep_layer (dss.create_edge_pair_layer (si, trans));
}
DeepEdgePairs::DeepEdgePairs (const DeepEdgePairs &other)
: AsIfFlatEdgePairs (other),
m_deep_layer (other.m_deep_layer.copy ())
: AsIfFlatEdgePairs (other), db::DeepShapeCollectionDelegateBase (other)
{
// .. nothing yet ..
}
DeepEdgePairs::DeepEdgePairs (const DeepLayer &dl)
: AsIfFlatEdgePairs (), m_deep_layer (dl)
: AsIfFlatEdgePairs ()
{
// .. nothing yet ..
set_deep_layer (dl);
}
DeepEdgePairs::~DeepEdgePairs ()
@ -133,7 +132,7 @@ EdgePairsIteratorDelegate *DeepEdgePairs::begin () const
std::pair<db::RecursiveShapeIterator, db::ICplxTrans> DeepEdgePairs::begin_iter () const
{
const db::Layout &layout = m_deep_layer.layout ();
const db::Layout &layout = deep_layer ().layout ();
if (layout.cells () == 0) {
return std::make_pair (db::RecursiveShapeIterator (), db::ICplxTrans ());
@ -141,7 +140,7 @@ std::pair<db::RecursiveShapeIterator, db::ICplxTrans> DeepEdgePairs::begin_iter
} else {
const db::Cell &top_cell = layout.cell (*layout.begin_top_down ());
db::RecursiveShapeIterator iter (m_deep_layer.layout (), top_cell, m_deep_layer.layer ());
db::RecursiveShapeIterator iter (deep_layer ().layout (), top_cell, deep_layer ().layer ());
return std::make_pair (iter, db::ICplxTrans ());
}
@ -151,10 +150,10 @@ size_t DeepEdgePairs::size () const
{
size_t n = 0;
const db::Layout &layout = m_deep_layer.layout ();
const db::Layout &layout = deep_layer ().layout ();
db::CellCounter cc (&layout);
for (db::Layout::top_down_const_iterator c = layout.begin_top_down (); c != layout.end_top_down (); ++c) {
n += cc.weight (*c) * layout.cell (*c).shapes (m_deep_layer.layer ()).size ();
n += cc.weight (*c) * layout.cell (*c).shapes (deep_layer ().layer ()).size ();
}
return n;
@ -167,7 +166,7 @@ std::string DeepEdgePairs::to_string (size_t nmax) const
Box DeepEdgePairs::bbox () const
{
return m_deep_layer.initial_cell ().bbox (m_deep_layer.layer ());
return deep_layer ().initial_cell ().bbox (deep_layer ().layer ());
}
bool DeepEdgePairs::empty () const
@ -243,12 +242,12 @@ EdgePairsDelegate *DeepEdgePairs::filtered (const EdgePairFilterBase &filter) co
RegionDelegate *DeepEdgePairs::polygons (db::Coord e) const
{
db::DeepLayer new_layer = m_deep_layer.derived ();
db::Layout &layout = const_cast<db::Layout &> (m_deep_layer.layout ());
db::DeepLayer new_layer = deep_layer ().derived ();
db::Layout &layout = const_cast<db::Layout &> (deep_layer ().layout ());
for (db::Layout::iterator c = layout.begin (); c != layout.end (); ++c) {
db::Shapes &output = c->shapes (new_layer.layer ());
for (db::Shapes::shape_iterator s = c->shapes (m_deep_layer.layer ()).begin (db::ShapeIterator::EdgePairs); ! s.at_end (); ++s) {
for (db::Shapes::shape_iterator s = c->shapes (deep_layer ().layer ()).begin (db::ShapeIterator::EdgePairs); ! s.at_end (); ++s) {
db::Polygon poly = s->edge_pair ().normalized ().to_polygon (e);
if (poly.vertices () >= 3) {
output.insert (db::PolygonRef (poly, layout.shape_repository ()));
@ -261,12 +260,12 @@ RegionDelegate *DeepEdgePairs::polygons (db::Coord e) const
EdgesDelegate *DeepEdgePairs::generic_edges (bool first, bool second) const
{
db::DeepLayer new_layer = m_deep_layer.derived ();
db::Layout &layout = const_cast<db::Layout &> (m_deep_layer.layout ());
db::DeepLayer new_layer = deep_layer ().derived ();
db::Layout &layout = const_cast<db::Layout &> (deep_layer ().layout ());
for (db::Layout::iterator c = layout.begin (); c != layout.end (); ++c) {
db::Shapes &output = c->shapes (new_layer.layer ());
for (db::Shapes::shape_iterator s = c->shapes (m_deep_layer.layer ()).begin (db::ShapeIterator::EdgePairs); ! s.at_end (); ++s) {
for (db::Shapes::shape_iterator s = c->shapes (deep_layer ().layer ()).begin (db::ShapeIterator::EdgePairs); ! s.at_end (); ++s) {
db::EdgePair ep = s->edge_pair ();
if (first) {
output.insert (ep.first ());
@ -304,8 +303,8 @@ EdgePairsDelegate *DeepEdgePairs::in (const EdgePairs &other, bool invert) const
bool DeepEdgePairs::equals (const EdgePairs &other) const
{
const DeepEdgePairs *other_delegate = dynamic_cast<const DeepEdgePairs *> (other.delegate ());
if (other_delegate && &other_delegate->m_deep_layer.layout () == &m_deep_layer.layout ()
&& other_delegate->m_deep_layer.layer () == m_deep_layer.layer ()) {
if (other_delegate && &other_delegate->deep_layer ().layout () == &deep_layer ().layout ()
&& other_delegate->deep_layer ().layer () == deep_layer ().layer ()) {
return true;
} else {
return AsIfFlatEdgePairs::equals (other);
@ -315,8 +314,8 @@ bool DeepEdgePairs::equals (const EdgePairs &other) const
bool DeepEdgePairs::less (const EdgePairs &other) const
{
const DeepEdgePairs *other_delegate = dynamic_cast<const DeepEdgePairs *> (other.delegate ());
if (other_delegate && &other_delegate->m_deep_layer.layout () == &m_deep_layer.layout ()) {
return other_delegate->m_deep_layer.layer () < m_deep_layer.layer ();
if (other_delegate && &other_delegate->deep_layer ().layout () == &deep_layer ().layout ()) {
return other_delegate->deep_layer ().layer () < deep_layer ().layer ();
} else {
return AsIfFlatEdgePairs::less (other);
}
@ -324,13 +323,12 @@ bool DeepEdgePairs::less (const EdgePairs &other) const
void DeepEdgePairs::insert_into (Layout *layout, db::cell_index_type into_cell, unsigned int into_layer) const
{
m_deep_layer.insert_into (layout, into_cell, into_layer);
deep_layer ().insert_into (layout, into_cell, into_layer);
}
void DeepEdgePairs::insert_into_as_polygons (Layout *layout, db::cell_index_type into_cell, unsigned int into_layer, db::Coord enl) const
{
m_deep_layer.insert_into_as_polygons (layout, into_cell, into_layer, enl);
deep_layer ().insert_into_as_polygons (layout, into_cell, into_layer, enl);
}
}

View File

@ -36,7 +36,7 @@ namespace db {
* @brief Provides hierarchical edges implementation
*/
class DB_PUBLIC DeepEdgePairs
: public db::AsIfFlatEdgePairs
: public db::AsIfFlatEdgePairs, public db::DeepShapeCollectionDelegateBase
{
public:
DeepEdgePairs ();
@ -80,21 +80,14 @@ public:
virtual void insert_into (Layout *layout, db::cell_index_type into_cell, unsigned int into_layer) const;
virtual void insert_into_as_polygons (Layout *layout, db::cell_index_type into_cell, unsigned int into_layer, db::Coord enl) const;
const DeepLayer &deep_layer () const
virtual DeepShapeCollectionDelegateBase *deep ()
{
return m_deep_layer;
}
DeepLayer &deep_layer ()
{
return m_deep_layer;
return this;
}
private:
DeepEdgePairs &operator= (const DeepEdgePairs &other);
DeepLayer m_deep_layer;
void init ();
EdgesDelegate *generic_edges (bool first, bool second) const;
};

View File

@ -96,14 +96,16 @@ private:
// DeepEdges implementation
DeepEdges::DeepEdges (const RecursiveShapeIterator &si, DeepShapeStore &dss, bool as_edges)
: AsIfFlatEdges (), m_deep_layer (dss.create_edge_layer (si, as_edges)), m_merged_edges ()
: AsIfFlatEdges (), m_merged_edges ()
{
set_deep_layer (dss.create_edge_layer (si, as_edges));
init ();
}
DeepEdges::DeepEdges (const RecursiveShapeIterator &si, DeepShapeStore &dss, const db::ICplxTrans &trans, bool as_edges, bool merged_semantics)
: AsIfFlatEdges (), m_deep_layer (dss.create_edge_layer (si, as_edges, trans)), m_merged_edges ()
: AsIfFlatEdges (), m_merged_edges ()
{
set_deep_layer (dss.create_edge_layer (si, as_edges, trans));
init ();
set_merged_semantics (merged_semantics);
}
@ -111,7 +113,7 @@ DeepEdges::DeepEdges (const RecursiveShapeIterator &si, DeepShapeStore &dss, con
DeepEdges::DeepEdges (const db::Edges &other, DeepShapeStore &dss)
: AsIfFlatEdges (), m_merged_edges ()
{
m_deep_layer = dss.create_from_flat (other);
set_deep_layer (dss.create_from_flat (other));
init ();
set_merged_semantics (other.merged_semantics ());
@ -124,8 +126,9 @@ DeepEdges::DeepEdges ()
}
DeepEdges::DeepEdges (const DeepLayer &dl)
: AsIfFlatEdges (), m_deep_layer (dl)
: AsIfFlatEdges ()
{
set_deep_layer (dl);
init ();
}
@ -135,8 +138,7 @@ DeepEdges::~DeepEdges ()
}
DeepEdges::DeepEdges (const DeepEdges &other)
: AsIfFlatEdges (other),
m_deep_layer (other.m_deep_layer.copy ()),
: AsIfFlatEdges (other), DeepShapeCollectionDelegateBase (other),
m_merged_edges_valid (other.m_merged_edges_valid),
m_is_merged (other.m_is_merged)
{
@ -151,8 +153,8 @@ DeepEdges::operator= (const DeepEdges &other)
if (this != &other) {
AsIfFlatEdges::operator= (other);
DeepShapeCollectionDelegateBase::operator= (other);
m_deep_layer = other.m_deep_layer.copy ();
m_merged_edges_valid = other.m_merged_edges_valid;
m_is_merged = other.m_is_merged;
if (m_merged_edges_valid) {
@ -201,7 +203,7 @@ DeepEdges::begin_merged () const
std::pair<db::RecursiveShapeIterator, db::ICplxTrans>
DeepEdges::begin_iter () const
{
const db::Layout &layout = m_deep_layer.layout ();
const db::Layout &layout = deep_layer ().layout ();
if (layout.cells () == 0) {
return std::make_pair (db::RecursiveShapeIterator (), db::ICplxTrans ());
@ -209,7 +211,7 @@ DeepEdges::begin_iter () const
} else {
const db::Cell &top_cell = layout.cell (*layout.begin_top_down ());
db::RecursiveShapeIterator iter (m_deep_layer.layout (), top_cell, m_deep_layer.layer ());
db::RecursiveShapeIterator iter (deep_layer ().layout (), top_cell, deep_layer ().layer ());
return std::make_pair (iter, db::ICplxTrans ());
}
@ -281,8 +283,8 @@ DeepEdges::iter () const
bool DeepEdges::equals (const Edges &other) const
{
const DeepEdges *other_delegate = dynamic_cast<const DeepEdges *> (other.delegate ());
if (other_delegate && &other_delegate->m_deep_layer.layout () == &m_deep_layer.layout ()
&& other_delegate->m_deep_layer.layer () == m_deep_layer.layer ()) {
if (other_delegate && &other_delegate->deep_layer ().layout () == &deep_layer ().layout ()
&& other_delegate->deep_layer ().layer () == deep_layer ().layer ()) {
return true;
} else {
return AsIfFlatEdges::equals (other);
@ -292,8 +294,8 @@ bool DeepEdges::equals (const Edges &other) const
bool DeepEdges::less (const Edges &other) const
{
const DeepEdges *other_delegate = dynamic_cast<const DeepEdges *> (other.delegate ());
if (other_delegate && &other_delegate->m_deep_layer.layout () == &m_deep_layer.layout ()) {
return other_delegate->m_deep_layer.layer () < m_deep_layer.layer ();
if (other_delegate && &other_delegate->deep_layer ().layout () == &deep_layer ().layout ()) {
return other_delegate->deep_layer ().layer () < deep_layer ().layer ();
} else {
return AsIfFlatEdges::less (other);
}
@ -403,27 +405,27 @@ DeepEdges::ensure_merged_edges_valid () const
if (m_is_merged) {
// NOTE: this will reuse the deep layer reference
m_merged_edges = m_deep_layer;
m_merged_edges = deep_layer ();
} else {
m_merged_edges = m_deep_layer.derived ();
m_merged_edges = deep_layer ().derived ();
tl::SelfTimer timer (tl::verbosity () > base_verbosity (), "Ensure merged polygons");
db::Layout &layout = const_cast<db::Layout &> (m_deep_layer.layout ());
db::Layout &layout = const_cast<db::Layout &> (deep_layer ().layout ());
db::hier_clusters<db::Edge> hc;
db::Connectivity conn;
conn.connect (m_deep_layer);
conn.connect (deep_layer ());
hc.set_base_verbosity (base_verbosity() + 10);
hc.build (layout, m_deep_layer.initial_cell (), conn);
hc.build (layout, deep_layer ().initial_cell (), conn);
// collect the clusters and merge them into big polygons
// NOTE: using the ClusterMerger we merge bottom-up forming bigger and bigger polygons. This is
// hopefully more efficient that collecting everything and will lead to reuse of parts.
ClusterMerger cm (m_deep_layer.layer (), hc, report_progress (), progress_desc ());
ClusterMerger cm (deep_layer ().layer (), hc, report_progress (), progress_desc ());
cm.set_base_verbosity (base_verbosity () + 10);
// TODO: iterate only over the called cells?
@ -455,17 +457,17 @@ DeepEdges::set_is_merged (bool f)
void
DeepEdges::insert_into (db::Layout *layout, db::cell_index_type into_cell, unsigned int into_layer) const
{
m_deep_layer.insert_into (layout, into_cell, into_layer);
deep_layer ().insert_into (layout, into_cell, into_layer);
}
size_t DeepEdges::size () const
{
size_t n = 0;
const db::Layout &layout = m_deep_layer.layout ();
const db::Layout &layout = deep_layer ().layout ();
db::CellCounter cc (&layout);
for (db::Layout::top_down_const_iterator c = layout.begin_top_down (); c != layout.end_top_down (); ++c) {
n += cc.weight (*c) * layout.cell (*c).shapes (m_deep_layer.layer ()).size ();
n += cc.weight (*c) * layout.cell (*c).shapes (deep_layer ().layer ()).size ();
}
return n;
@ -473,7 +475,7 @@ size_t DeepEdges::size () const
Box DeepEdges::bbox () const
{
return m_deep_layer.initial_cell ().bbox (m_deep_layer.layer ());
return deep_layer ().initial_cell ().bbox (deep_layer ().layer ());
}
DeepEdges::length_type DeepEdges::length (const db::Box &box) const
@ -756,7 +758,7 @@ EdgesDelegate *DeepEdges::merged_in_place ()
ensure_merged_edges_valid ();
// NOTE: this makes both layers share the same resource
m_deep_layer = m_merged_edges;
set_deep_layer (m_merged_edges);
return this;
}
@ -779,17 +781,17 @@ EdgesDelegate *DeepEdges::merged () const
DeepLayer
DeepEdges::and_or_not_with (const DeepEdges *other, EdgeBoolOp op) const
{
DeepLayer dl_out (m_deep_layer.derived ());
DeepLayer dl_out (deep_layer ().derived ());
db::EdgeBoolAndOrNotLocalOperation local_op (op);
db::local_processor<db::Edge, db::Edge, db::Edge> proc (const_cast<db::Layout *> (&m_deep_layer.layout ()), const_cast<db::Cell *> (&m_deep_layer.initial_cell ()), &other->deep_layer ().layout (), &other->deep_layer ().initial_cell ());
db::local_processor<db::Edge, db::Edge, db::Edge> proc (const_cast<db::Layout *> (&deep_layer ().layout ()), const_cast<db::Cell *> (&deep_layer ().initial_cell ()), &other->deep_layer ().layout (), &other->deep_layer ().initial_cell ());
proc.set_base_verbosity (base_verbosity ());
proc.set_threads (m_deep_layer.store ()->threads ());
proc.set_area_ratio (m_deep_layer.store ()->max_area_ratio ());
proc.set_max_vertex_count (m_deep_layer.store ()->max_vertex_count ());
proc.set_threads (deep_layer ().store ()->threads ());
proc.set_area_ratio (deep_layer ().store ()->max_area_ratio ());
proc.set_max_vertex_count (deep_layer ().store ()->max_vertex_count ());
proc.run (&local_op, m_deep_layer.layer (), other->deep_layer ().layer (), dl_out.layer ());
proc.run (&local_op, deep_layer ().layer (), other->deep_layer ().layer (), dl_out.layer ());
return dl_out;
}
@ -797,17 +799,17 @@ DeepEdges::and_or_not_with (const DeepEdges *other, EdgeBoolOp op) const
DeepLayer
DeepEdges::edge_region_op (const DeepRegion *other, bool outside, bool include_borders) const
{
DeepLayer dl_out (m_deep_layer.derived ());
DeepLayer dl_out (deep_layer ().derived ());
db::EdgeToPolygonLocalOperation op (outside, include_borders);
db::local_processor<db::Edge, db::PolygonRef, db::Edge> proc (const_cast<db::Layout *> (&m_deep_layer.layout ()), const_cast<db::Cell *> (&m_deep_layer.initial_cell ()), &other->deep_layer ().layout (), &other->deep_layer ().initial_cell ());
db::local_processor<db::Edge, db::PolygonRef, db::Edge> proc (const_cast<db::Layout *> (&deep_layer ().layout ()), const_cast<db::Cell *> (&deep_layer ().initial_cell ()), &other->deep_layer ().layout (), &other->deep_layer ().initial_cell ());
proc.set_base_verbosity (base_verbosity ());
proc.set_threads (m_deep_layer.store ()->threads ());
proc.set_area_ratio (m_deep_layer.store ()->max_area_ratio ());
proc.set_max_vertex_count (m_deep_layer.store ()->max_vertex_count ());
proc.set_threads (deep_layer ().store ()->threads ());
proc.set_area_ratio (deep_layer ().store ()->max_area_ratio ());
proc.set_max_vertex_count (deep_layer ().store ()->max_vertex_count ());
proc.run (&op, m_deep_layer.layer (), other->deep_layer ().layer (), dl_out.layer ());
proc.run (&op, deep_layer ().layer (), other->deep_layer ().layer (), dl_out.layer ());
return dl_out;
}

View File

@ -40,7 +40,7 @@ class DeepRegion;
* @brief Provides hierarchical edges implementation
*/
class DB_PUBLIC DeepEdges
: public db::AsIfFlatEdges
: public db::AsIfFlatEdges, public db::DeepShapeCollectionDelegateBase
{
public:
DeepEdges ();
@ -144,14 +144,9 @@ public:
virtual void insert_into (Layout *layout, db::cell_index_type into_cell, unsigned int into_layer) const;
const DeepLayer &deep_layer () const
virtual DeepShapeCollectionDelegateBase *deep ()
{
return m_deep_layer;
}
DeepLayer &deep_layer ()
{
return m_deep_layer;
return this;
}
protected:
@ -163,7 +158,6 @@ private:
DeepEdges &operator= (const DeepEdges &other);
DeepLayer m_deep_layer;
mutable DeepLayer m_merged_edges;
mutable bool m_merged_edges_valid;
bool m_is_merged;

View File

@ -102,14 +102,16 @@ private:
// DeepRegion implementation
DeepRegion::DeepRegion (const RecursiveShapeIterator &si, DeepShapeStore &dss, double area_ratio, size_t max_vertex_count)
: AsIfFlatRegion (), m_deep_layer (dss.create_polygon_layer (si, area_ratio, max_vertex_count)), m_merged_polygons ()
: AsIfFlatRegion (), m_merged_polygons ()
{
set_deep_layer (dss.create_polygon_layer (si, area_ratio, max_vertex_count));
init ();
}
DeepRegion::DeepRegion (const RecursiveShapeIterator &si, DeepShapeStore &dss, const db::ICplxTrans &trans, bool merged_semantics, double area_ratio, size_t max_vertex_count)
: AsIfFlatRegion (), m_deep_layer (dss.create_polygon_layer (si, area_ratio, max_vertex_count, trans)), m_merged_polygons ()
: AsIfFlatRegion (), m_merged_polygons ()
{
set_deep_layer (dss.create_polygon_layer (si, area_ratio, max_vertex_count, trans));
init ();
set_merged_semantics (merged_semantics);
}
@ -117,7 +119,7 @@ DeepRegion::DeepRegion (const RecursiveShapeIterator &si, DeepShapeStore &dss, c
DeepRegion::DeepRegion (const db::Region &other, DeepShapeStore &dss)
: AsIfFlatRegion (), m_merged_polygons ()
{
m_deep_layer = dss.create_from_flat (other, false);
set_deep_layer (dss.create_from_flat (other, false));
init ();
set_merged_semantics (other.merged_semantics ());
@ -130,8 +132,9 @@ DeepRegion::DeepRegion ()
}
DeepRegion::DeepRegion (const DeepLayer &dl)
: AsIfFlatRegion (), m_deep_layer (dl)
: AsIfFlatRegion ()
{
set_deep_layer (dl);
init ();
}
@ -141,8 +144,7 @@ DeepRegion::~DeepRegion ()
}
DeepRegion::DeepRegion (const DeepRegion &other)
: AsIfFlatRegion (other),
m_deep_layer (other.m_deep_layer.copy ()),
: AsIfFlatRegion (other), DeepShapeCollectionDelegateBase (other),
m_merged_polygons_valid (other.m_merged_polygons_valid),
m_is_merged (other.m_is_merged)
{
@ -157,8 +159,8 @@ DeepRegion::operator= (const DeepRegion &other)
if (this != &other) {
AsIfFlatRegion::operator= (other);
DeepShapeCollectionDelegateBase::operator= (other);
m_deep_layer = other.m_deep_layer.copy ();
m_merged_polygons_valid = other.m_merged_polygons_valid;
m_is_merged = other.m_is_merged;
if (m_merged_polygons_valid) {
@ -212,7 +214,7 @@ DeepRegion::begin_merged () const
std::pair<db::RecursiveShapeIterator, db::ICplxTrans>
DeepRegion::begin_iter () const
{
const db::Layout &layout = m_deep_layer.layout ();
const db::Layout &layout = deep_layer ().layout ();
if (layout.cells () == 0) {
return std::make_pair (db::RecursiveShapeIterator (), db::ICplxTrans ());
@ -220,7 +222,7 @@ DeepRegion::begin_iter () const
} else {
const db::Cell &top_cell = layout.cell (*layout.begin_top_down ());
db::RecursiveShapeIterator iter (m_deep_layer.layout (), top_cell, m_deep_layer.layer ());
db::RecursiveShapeIterator iter (deep_layer ().layout (), top_cell, deep_layer ().layer ());
return std::make_pair (iter, db::ICplxTrans ());
}
@ -293,8 +295,8 @@ bool
DeepRegion::equals (const Region &other) const
{
const DeepRegion *other_delegate = dynamic_cast<const DeepRegion *> (other.delegate ());
if (other_delegate && &other_delegate->m_deep_layer.layout () == &m_deep_layer.layout ()
&& other_delegate->m_deep_layer.layer () == m_deep_layer.layer ()) {
if (other_delegate && &other_delegate->deep_layer ().layout () == &deep_layer ().layout ()
&& other_delegate->deep_layer ().layer () == deep_layer ().layer ()) {
return true;
} else {
return AsIfFlatRegion::equals (other);
@ -305,8 +307,8 @@ bool
DeepRegion::less (const Region &other) const
{
const DeepRegion *other_delegate = dynamic_cast<const DeepRegion *> (other.delegate ());
if (other_delegate && &other_delegate->m_deep_layer.layout () == &m_deep_layer.layout ()) {
return other_delegate->m_deep_layer.layer () < m_deep_layer.layer ();
if (other_delegate && &other_delegate->deep_layer ().layout () == &deep_layer ().layout ()) {
return other_delegate->deep_layer ().layer () < deep_layer ().layer ();
} else {
return AsIfFlatRegion::less (other);
}
@ -441,27 +443,27 @@ DeepRegion::ensure_merged_polygons_valid () const
if (m_is_merged) {
// NOTE: this will reuse the deep layer reference
m_merged_polygons = m_deep_layer;
m_merged_polygons = deep_layer ();
} else {
m_merged_polygons = m_deep_layer.derived ();
m_merged_polygons = deep_layer ().derived ();
tl::SelfTimer timer (tl::verbosity () > base_verbosity (), "Ensure merged polygons");
db::Layout &layout = const_cast<db::Layout &> (m_deep_layer.layout ());
db::Layout &layout = const_cast<db::Layout &> (deep_layer ().layout ());
db::hier_clusters<db::PolygonRef> hc;
db::Connectivity conn;
conn.connect (m_deep_layer);
conn.connect (deep_layer ());
hc.set_base_verbosity (base_verbosity () + 10);
hc.build (layout, m_deep_layer.initial_cell (), conn);
hc.build (layout, deep_layer ().initial_cell (), conn);
// collect the clusters and merge them into big polygons
// NOTE: using the ClusterMerger we merge bottom-up forming bigger and bigger polygons. This is
// hopefully more efficient that collecting everything and will lead to reuse of parts.
ClusterMerger cm (m_deep_layer.layer (), layout, hc, min_coherence (), report_progress (), progress_desc ());
ClusterMerger cm (deep_layer ().layer (), layout, hc, min_coherence (), report_progress (), progress_desc ());
cm.set_base_verbosity (base_verbosity () + 10);
// TODO: iterate only over the called cells?
@ -493,7 +495,7 @@ DeepRegion::set_is_merged (bool f)
void
DeepRegion::insert_into (db::Layout *layout, db::cell_index_type into_cell, unsigned int into_layer) const
{
m_deep_layer.insert_into (layout, into_cell, into_layer);
deep_layer ().insert_into (layout, into_cell, into_layer);
}
RegionDelegate *
@ -543,17 +545,17 @@ DeepRegion::not_with (const Region &other) const
DeepLayer
DeepRegion::and_or_not_with (const DeepRegion *other, bool and_op) const
{
DeepLayer dl_out (m_deep_layer.derived ());
DeepLayer dl_out (deep_layer ().derived ());
db::BoolAndOrNotLocalOperation op (and_op);
db::local_processor<db::PolygonRef, db::PolygonRef, db::PolygonRef> proc (const_cast<db::Layout *> (&m_deep_layer.layout ()), const_cast<db::Cell *> (&m_deep_layer.initial_cell ()), &other->deep_layer ().layout (), &other->deep_layer ().initial_cell (), m_deep_layer.breakout_cells (), other->deep_layer ().breakout_cells ());
db::local_processor<db::PolygonRef, db::PolygonRef, db::PolygonRef> proc (const_cast<db::Layout *> (&deep_layer ().layout ()), const_cast<db::Cell *> (&deep_layer ().initial_cell ()), &other->deep_layer ().layout (), &other->deep_layer ().initial_cell (), deep_layer ().breakout_cells (), other->deep_layer ().breakout_cells ());
proc.set_base_verbosity (base_verbosity ());
proc.set_threads (m_deep_layer.store ()->threads ());
proc.set_area_ratio (m_deep_layer.store ()->max_area_ratio ());
proc.set_max_vertex_count (m_deep_layer.store ()->max_vertex_count ());
proc.set_threads (deep_layer ().store ()->threads ());
proc.set_area_ratio (deep_layer ().store ()->max_area_ratio ());
proc.set_max_vertex_count (deep_layer ().store ()->max_vertex_count ());
proc.run (&op, m_deep_layer.layer (), other->deep_layer ().layer (), dl_out.layer ());
proc.run (&op, deep_layer ().layer (), other->deep_layer ().layer (), dl_out.layer ());
return dl_out;
}
@ -668,10 +670,10 @@ DeepRegion::size () const
{
size_t n = 0;
const db::Layout &layout = m_deep_layer.layout ();
const db::Layout &layout = deep_layer ().layout ();
db::CellCounter cc (&layout);
for (db::Layout::top_down_const_iterator c = layout.begin_top_down (); c != layout.end_top_down (); ++c) {
n += cc.weight (*c) * layout.cell (*c).shapes (m_deep_layer.layer ()).size ();
n += cc.weight (*c) * layout.cell (*c).shapes (deep_layer ().layer ()).size ();
}
return n;
@ -746,7 +748,7 @@ DeepRegion::perimeter (const db::Box &box) const
Box
DeepRegion::bbox () const
{
return m_deep_layer.initial_cell ().bbox (m_deep_layer.layer ());
return deep_layer ().initial_cell ().bbox (deep_layer ().layer ());
}
std::string
@ -1197,7 +1199,7 @@ DeepRegion::merged_in_place ()
ensure_merged_polygons_valid ();
// NOTE: this makes both layers share the same resource
m_deep_layer = m_merged_polygons;
set_deep_layer (m_merged_polygons);
set_is_merged (true);
return this;
@ -1232,21 +1234,21 @@ DeepRegion::merged (bool min_coherence, unsigned int min_wc) const
{
tl::SelfTimer timer (tl::verbosity () > base_verbosity (), "Ensure merged polygons");
db::Layout &layout = const_cast<db::Layout &> (m_deep_layer.layout ());
db::Layout &layout = const_cast<db::Layout &> (deep_layer ().layout ());
db::hier_clusters<db::PolygonRef> hc;
db::Connectivity conn;
conn.connect (m_deep_layer);
conn.connect (deep_layer ());
hc.set_base_verbosity (base_verbosity () + 10);
hc.build (layout, m_deep_layer.initial_cell (), conn);
hc.build (layout, deep_layer ().initial_cell (), conn);
// collect the clusters and merge them into big polygons
// NOTE: using the ClusterMerger we merge bottom-up forming bigger and bigger polygons. This is
// hopefully more efficient that collecting everything and will lead to reuse of parts.
DeepLayer dl_out (m_deep_layer.derived ());
DeepLayer dl_out (deep_layer ().derived ());
ClusterMerger cm (m_deep_layer.layer (), layout, hc, min_coherence, report_progress (), progress_desc ());
ClusterMerger cm (deep_layer ().layer (), layout, hc, min_coherence, report_progress (), progress_desc ());
cm.set_base_verbosity (base_verbosity () + 10);
for (db::Layout::iterator c = layout.begin (); c != layout.end (); ++c) {
@ -1529,7 +1531,7 @@ DeepRegion::run_check (db::edge_relation_type rel, bool different_polygons, cons
const_cast<db::Cell *> (&polygons.initial_cell ()),
other_deep ? &other_deep->deep_layer ().layout () : const_cast<db::Layout *> (&polygons.layout ()),
other_deep ? &other_deep->deep_layer ().initial_cell () : const_cast<db::Cell *> (&polygons.initial_cell ()),
m_deep_layer.breakout_cells (),
deep_layer ().breakout_cells (),
other_deep ? other_deep->deep_layer ().breakout_cells () : 0);
proc.set_base_verbosity (base_verbosity ());

View File

@ -35,7 +35,7 @@ namespace db {
* @brief A deep, polygon-set delegate
*/
class DB_PUBLIC DeepRegion
: public AsIfFlatRegion
: public AsIfFlatRegion, public DeepShapeCollectionDelegateBase
{
public:
typedef db::layer<db::Polygon, db::unstable_layer_tag> polygon_layer_type;
@ -159,14 +159,9 @@ public:
virtual void insert_into (Layout *layout, db::cell_index_type into_cell, unsigned int into_layer) const;
const DeepLayer &deep_layer () const
virtual DeepShapeCollectionDelegateBase *deep ()
{
return m_deep_layer;
}
DeepLayer &deep_layer ()
{
return m_deep_layer;
return this;
}
protected:
@ -180,7 +175,6 @@ private:
DeepRegion &operator= (const DeepRegion &other);
DeepLayer m_deep_layer;
mutable DeepLayer m_merged_polygons;
mutable bool m_merged_polygons_valid;
bool m_is_merged;

View File

@ -32,6 +32,7 @@
#include "dbDeepEdges.h"
#include "dbDeepEdgePairs.h"
#include "dbDeepTexts.h"
#include "dbShapeCollection.h"
#include "tlTimer.h"
@ -519,9 +520,9 @@ DeepLayer DeepShapeStore::create_from_flat (const db::Texts &texts, const db::IC
return dl;
}
std::pair<bool, DeepLayer> DeepShapeStore::layer_for_flat (const db::Region &region) const
std::pair<bool, DeepLayer> DeepShapeStore::layer_for_flat (const ShapeCollection &coll) const
{
return layer_for_flat (tl::id_of (region.delegate ()));
return layer_for_flat (tl::id_of (coll.get_delegate ()));
}
std::pair<bool, DeepLayer> DeepShapeStore::layer_for_flat (size_t region_id) const

View File

@ -45,6 +45,7 @@ class Region;
class Edges;
class EdgePairs;
class Texts;
class ShapeCollection;
/**
* @brief Represents a shape collection from the deep shape store
@ -372,12 +373,12 @@ public:
DeepLayer create_from_flat (const db::Texts &texts, const db::ICplxTrans &trans = db::ICplxTrans ());
/**
* @brief Gets the layer for a given flat region.
* @brief Gets the layer for a given flat collection (Region, Edges, Texts, EdgePairs)
*
* If a layer has been created for a flat region with create_from_flat, it can be retrieved with this method.
* The first return value is true in this case.
*/
std::pair<bool, DeepLayer> layer_for_flat (const db::Region &region) const;
std::pair<bool, DeepLayer> layer_for_flat (const ShapeCollection &coll) const;
/**
* @brief Same as layer_for_flat, but takes a region Id

View File

@ -91,7 +91,7 @@ private:
DeepTexts::DeepTexts ()
: AsIfFlatTexts (), m_deep_layer ()
: AsIfFlatTexts ()
{
// .. nothing yet ..
}
@ -99,24 +99,23 @@ DeepTexts::DeepTexts ()
DeepTexts::DeepTexts (const db::Texts &other, DeepShapeStore &dss)
: AsIfFlatTexts ()
{
m_deep_layer = dss.create_from_flat (other);
set_deep_layer (dss.create_from_flat (other));
}
DeepTexts::DeepTexts (const RecursiveShapeIterator &si, DeepShapeStore &dss)
: AsIfFlatTexts (), m_deep_layer (dss.create_text_layer (si))
: AsIfFlatTexts ()
{
// .. nothing yet ..
set_deep_layer (dss.create_text_layer (si));
}
DeepTexts::DeepTexts (const RecursiveShapeIterator &si, DeepShapeStore &dss, const db::ICplxTrans &trans)
: AsIfFlatTexts (), m_deep_layer (dss.create_text_layer (si, trans))
: AsIfFlatTexts ()
{
// .. nothing yet ..
set_deep_layer (dss.create_text_layer (si, trans));
}
DeepTexts::DeepTexts (const DeepTexts &other)
: AsIfFlatTexts (other),
m_deep_layer (other.m_deep_layer.copy ())
: AsIfFlatTexts (other), DeepShapeCollectionDelegateBase (other)
{
// .. nothing yet ..
}
@ -126,15 +125,15 @@ DeepTexts::operator= (const DeepTexts &other)
{
if (this != &other) {
AsIfFlatTexts::operator= (other);
m_deep_layer = other.m_deep_layer.copy ();
DeepShapeCollectionDelegateBase::operator= (other);
}
return *this;
}
DeepTexts::DeepTexts (const DeepLayer &dl)
: AsIfFlatTexts (), m_deep_layer (dl)
: AsIfFlatTexts ()
{
// .. nothing yet ..
set_deep_layer (dl);
}
DeepTexts::~DeepTexts ()
@ -154,7 +153,7 @@ TextsIteratorDelegate *DeepTexts::begin () const
std::pair<db::RecursiveShapeIterator, db::ICplxTrans> DeepTexts::begin_iter () const
{
const db::Layout &layout = m_deep_layer.layout ();
const db::Layout &layout = deep_layer ().layout ();
if (layout.cells () == 0) {
return std::make_pair (db::RecursiveShapeIterator (), db::ICplxTrans ());
@ -162,7 +161,7 @@ std::pair<db::RecursiveShapeIterator, db::ICplxTrans> DeepTexts::begin_iter () c
} else {
const db::Cell &top_cell = layout.cell (*layout.begin_top_down ());
db::RecursiveShapeIterator iter (m_deep_layer.layout (), top_cell, m_deep_layer.layer ());
db::RecursiveShapeIterator iter (deep_layer ().layout (), top_cell, deep_layer ().layer ());
return std::make_pair (iter, db::ICplxTrans ());
}
@ -172,10 +171,10 @@ size_t DeepTexts::size () const
{
size_t n = 0;
const db::Layout &layout = m_deep_layer.layout ();
const db::Layout &layout = deep_layer ().layout ();
db::CellCounter cc (&layout);
for (db::Layout::top_down_const_iterator c = layout.begin_top_down (); c != layout.end_top_down (); ++c) {
n += cc.weight (*c) * layout.cell (*c).shapes (m_deep_layer.layer ()).size ();
n += cc.weight (*c) * layout.cell (*c).shapes (deep_layer ().layer ()).size ();
}
return n;
@ -188,7 +187,7 @@ std::string DeepTexts::to_string (size_t nmax) const
Box DeepTexts::bbox () const
{
return m_deep_layer.initial_cell ().bbox (m_deep_layer.layer ());
return deep_layer ().initial_cell ().bbox (deep_layer ().layer ());
}
bool DeepTexts::empty () const
@ -336,12 +335,12 @@ DeepTexts *DeepTexts::apply_filter (const TextFilterBase &filter) const
RegionDelegate *DeepTexts::polygons (db::Coord e) const
{
db::DeepLayer new_layer = m_deep_layer.derived ();
db::Layout &layout = const_cast<db::Layout &> (m_deep_layer.layout ());
db::DeepLayer new_layer = deep_layer ().derived ();
db::Layout &layout = const_cast<db::Layout &> (deep_layer ().layout ());
for (db::Layout::iterator c = layout.begin (); c != layout.end (); ++c) {
db::Shapes &output = c->shapes (new_layer.layer ());
for (db::Shapes::shape_iterator s = c->shapes (m_deep_layer.layer ()).begin (db::ShapeIterator::Texts); ! s.at_end (); ++s) {
for (db::Shapes::shape_iterator s = c->shapes (deep_layer ().layer ()).begin (db::ShapeIterator::Texts); ! s.at_end (); ++s) {
db::Box box = s->bbox ();
box.enlarge (db::Vector (e, e));
db::Polygon poly (box);
@ -354,12 +353,12 @@ RegionDelegate *DeepTexts::polygons (db::Coord e) const
EdgesDelegate *DeepTexts::edges () const
{
db::DeepLayer new_layer = m_deep_layer.derived ();
db::Layout &layout = const_cast<db::Layout &> (m_deep_layer.layout ());
db::DeepLayer new_layer = deep_layer ().derived ();
db::Layout &layout = const_cast<db::Layout &> (deep_layer ().layout ());
for (db::Layout::iterator c = layout.begin (); c != layout.end (); ++c) {
db::Shapes &output = c->shapes (new_layer.layer ());
for (db::Shapes::shape_iterator s = c->shapes (m_deep_layer.layer ()).begin (db::ShapeIterator::Texts); ! s.at_end (); ++s) {
for (db::Shapes::shape_iterator s = c->shapes (deep_layer ().layer ()).begin (db::ShapeIterator::Texts); ! s.at_end (); ++s) {
db::Box box = s->bbox ();
output.insert (db::Edge (box.p1 (), box.p2 ()));
}
@ -377,8 +376,8 @@ TextsDelegate *DeepTexts::in (const Texts &other, bool invert) const
bool DeepTexts::equals (const Texts &other) const
{
const DeepTexts *other_delegate = dynamic_cast<const DeepTexts *> (other.delegate ());
if (other_delegate && &other_delegate->m_deep_layer.layout () == &m_deep_layer.layout ()
&& other_delegate->m_deep_layer.layer () == m_deep_layer.layer ()) {
if (other_delegate && &other_delegate->deep_layer ().layout () == &deep_layer ().layout ()
&& other_delegate->deep_layer ().layer () == deep_layer ().layer ()) {
return true;
} else {
return AsIfFlatTexts::equals (other);
@ -388,8 +387,8 @@ bool DeepTexts::equals (const Texts &other) const
bool DeepTexts::less (const Texts &other) const
{
const DeepTexts *other_delegate = dynamic_cast<const DeepTexts *> (other.delegate ());
if (other_delegate && &other_delegate->m_deep_layer.layout () == &m_deep_layer.layout ()) {
return other_delegate->m_deep_layer.layer () < m_deep_layer.layer ();
if (other_delegate && &other_delegate->deep_layer ().layout () == &deep_layer ().layout ()) {
return other_delegate->deep_layer ().layer () < deep_layer ().layer ();
} else {
return AsIfFlatTexts::less (other);
}
@ -397,12 +396,12 @@ bool DeepTexts::less (const Texts &other) const
void DeepTexts::insert_into (Layout *layout, db::cell_index_type into_cell, unsigned int into_layer) const
{
m_deep_layer.insert_into (layout, into_cell, into_layer);
deep_layer ().insert_into (layout, into_cell, into_layer);
}
void DeepTexts::insert_into_as_polygons (Layout *layout, db::cell_index_type into_cell, unsigned int into_layer, db::Coord enl) const
{
m_deep_layer.insert_into_as_polygons (layout, into_cell, into_layer, enl);
deep_layer ().insert_into_as_polygons (layout, into_cell, into_layer, enl);
}
namespace {

View File

@ -36,7 +36,7 @@ namespace db {
* @brief Provides hierarchical edges implementation
*/
class DB_PUBLIC DeepTexts
: public db::AsIfFlatTexts
: public db::AsIfFlatTexts, public db::DeepShapeCollectionDelegateBase
{
public:
DeepTexts ();
@ -79,21 +79,14 @@ public:
virtual void insert_into (Layout *layout, db::cell_index_type into_cell, unsigned int into_layer) const;
virtual void insert_into_as_polygons (Layout *layout, db::cell_index_type into_cell, unsigned int into_layer, db::Coord enl) const;
const DeepLayer &deep_layer () const
virtual DeepShapeCollectionDelegateBase *deep ()
{
return m_deep_layer;
}
DeepLayer &deep_layer ()
{
return m_deep_layer;
return this;
}
private:
DeepTexts &operator= (const DeepTexts &other);
DeepLayer m_deep_layer;
void init ();
DeepTexts *apply_filter (const TextFilterBase &filter) const;

View File

@ -57,7 +57,7 @@ EdgePairs::EdgePairs (EdgePairsDelegate *delegate)
}
EdgePairs::EdgePairs (const EdgePairs &other)
: gsi::ObjectBase (), mp_delegate (other.mp_delegate->clone ())
: db::ShapeCollection (), mp_delegate (other.mp_delegate->clone ())
{
// .. nothing yet ..
}

View File

@ -27,8 +27,7 @@
#include "dbEdgePairsDelegate.h"
#include "dbShape.h"
#include "dbRecursiveShapeIterator.h"
#include "gsiObject.h"
#include "dbShapeCollection.h"
#include <list>
@ -230,7 +229,7 @@ public:
* can be converted to polygons or to individual edges.
*/
class DB_PUBLIC EdgePairs
: public gsi::ObjectBase
: public db::ShapeCollection
{
public:
typedef db::Coord coord_type;
@ -339,6 +338,14 @@ public:
*/
explicit EdgePairs (const RecursiveShapeIterator &si, DeepShapeStore &dss, const db::ICplxTrans &trans);
/**
* @brief Implementation of the ShapeCollection interface
*/
ShapeCollectionDelegateBase *get_delegate () const
{
return mp_delegate;
}
/**
* @brief Gets the underlying delegate object
*/

View File

@ -34,7 +34,7 @@ EdgePairsDelegate::EdgePairsDelegate ()
}
EdgePairsDelegate::EdgePairsDelegate (const EdgePairsDelegate &other)
: tl::UniqueId ()
: ShapeCollectionDelegateBase ()
{
operator= (other);
}

View File

@ -25,9 +25,8 @@
#define HDR_dbEdgePairsDelegate
#include "dbCommon.h"
#include "dbEdgePair.h"
#include "tlUniqueId.h"
#include "dbShapeCollection.h"
namespace db {
@ -59,7 +58,7 @@ public:
* @brief The delegate for the actual edge set implementation
*/
class DB_PUBLIC EdgePairsDelegate
: public tl::UniqueId
: public ShapeCollectionDelegateBase
{
public:
typedef db::Coord coord_type;

View File

@ -97,7 +97,7 @@ Edges::Edges (EdgesDelegate *delegate)
}
Edges::Edges (const Edges &other)
: gsi::ObjectBase (), mp_delegate (other.mp_delegate->clone ())
: db::ShapeCollection (), mp_delegate (other.mp_delegate->clone ())
{
// .. nothing yet ..
}

View File

@ -27,8 +27,7 @@
#include "dbEdgesDelegate.h"
#include "dbRecursiveShapeIterator.h"
#include "dbCellVariants.h"
#include "gsiObject.h"
#include "dbShapeCollection.h"
#include <list>
@ -215,7 +214,7 @@ class Edges;
*/
class DB_PUBLIC Edges
: public gsi::ObjectBase
: public db::ShapeCollection
{
public:
typedef db::Coord coord_type;
@ -359,6 +358,14 @@ public:
*/
explicit Edges (const RecursiveShapeIterator &si, DeepShapeStore &dss, const db::ICplxTrans &trans, bool as_edges = true, bool merged_semantics = true);
/**
* @brief Implementation of the ShapeCollection interface
*/
ShapeCollectionDelegateBase *get_delegate () const
{
return mp_delegate;
}
/**
* @brief Gets the underlying delegate object
*/

View File

@ -37,7 +37,7 @@ EdgesDelegate::EdgesDelegate ()
}
EdgesDelegate::EdgesDelegate (const EdgesDelegate &other)
: tl::UniqueId ()
: ShapeCollectionDelegateBase ()
{
operator= (other);
}

View File

@ -29,7 +29,7 @@
#include "dbEdge.h"
#include "dbEdgePairs.h"
#include "dbEdgePairRelations.h"
#include "tlUniqueId.h"
#include "dbShapeCollection.h"
#include <list>
@ -181,7 +181,7 @@ public:
* @brief The delegate for the actual edge set implementation
*/
class DB_PUBLIC EdgesDelegate
: public tl::UniqueId
: public ShapeCollectionDelegateBase
{
public:
typedef db::Coord coord_type;

View File

@ -24,6 +24,7 @@
#include "dbCommon.h"
#include "dbLayoutToNetlist.h"
#include "dbDeepRegion.h"
#include "dbDeepTexts.h"
#include "dbShapeRepository.h"
#include "dbCellMapping.h"
#include "dbLayoutToNetlistWriter.h"
@ -172,17 +173,17 @@ db::Region *LayoutToNetlist::make_layer (unsigned int layer_index, const std::st
return region.release ();
}
db::Region *LayoutToNetlist::make_text_layer (unsigned int layer_index, const std::string &n)
db::Texts *LayoutToNetlist::make_text_layer (unsigned int layer_index, const std::string &n)
{
db::RecursiveShapeIterator si (m_iter);
si.set_layer (layer_index);
si.shape_flags (db::ShapeIterator::Texts);
std::auto_ptr <db::Region> region (new db::Region (si, dss ()));
std::auto_ptr <db::Texts> texts (new db::Texts (si, dss ()));
if (! n.empty ()) {
register_layer (*region, n);
register_layer (*texts, n);
}
return region.release ();
return texts.release ();
}
db::Region *LayoutToNetlist::make_polygon_layer (unsigned int layer_index, const std::string &n)
@ -236,7 +237,7 @@ void LayoutToNetlist::ensure_netlist ()
}
}
void LayoutToNetlist::extract_devices (db::NetlistDeviceExtractor &extractor, const std::map<std::string, db::Region *> &layers)
void LayoutToNetlist::extract_devices (db::NetlistDeviceExtractor &extractor, const std::map<std::string, db::ShapeCollection *> &layers)
{
if (m_netlist_extracted) {
throw tl::Exception (tl::to_string (tr ("The netlist has already been extracted")));
@ -262,7 +263,7 @@ void LayoutToNetlist::connect (const db::Region &l)
m_conn.connect (dl.layer ());
}
void LayoutToNetlist::connect (const db::Region &a, const db::Region &b)
void LayoutToNetlist::connect_impl (const db::ShapeCollection &a, const db::ShapeCollection &b)
{
if (m_netlist_extracted) {
throw tl::Exception (tl::to_string (tr ("The netlist has already been extracted")));
@ -283,7 +284,7 @@ void LayoutToNetlist::connect (const db::Region &a, const db::Region &b)
m_conn.connect (dla.layer (), dlb.layer ());
}
size_t LayoutToNetlist::connect_global (const db::Region &l, const std::string &gn)
void LayoutToNetlist::connect_global_impl (const db::ShapeCollection &l, const std::string &gn)
{
if (m_netlist_extracted) {
throw tl::Exception (tl::to_string (tr ("The netlist has already been extracted")));
@ -296,7 +297,7 @@ size_t LayoutToNetlist::connect_global (const db::Region &l, const std::string &
db::DeepLayer dl = deep_layer_of (l);
m_dlrefs.insert (dl);
return m_conn.connect_global (dl.layer (), gn);
m_conn.connect_global (dl.layer (), gn);
}
const std::string &LayoutToNetlist::global_net_name (size_t id) const
@ -393,42 +394,6 @@ void LayoutToNetlist::ensure_layout () const
}
}
void LayoutToNetlist::register_layer (const db::Region &region, const std::string &n)
{
if (m_named_regions.find (n) != m_named_regions.end ()) {
throw tl::Exception (tl::to_string (tr ("Layer name is already used: ")) + n);
}
db::DeepLayer dl;
if (m_is_flat) {
dl = dss ().create_from_flat (region, true);
} else {
db::DeepRegion *delegate = dynamic_cast<db::DeepRegion *> (region.delegate());
if (! delegate) {
dl = dss ().create_from_flat (region, true);
} else {
if (is_persisted (region)) {
std::string prev_name = name (region);
m_named_regions.erase (prev_name);
}
dl = delegate->deep_layer ();
}
}
m_named_regions [n] = dl;
m_name_of_layer [dl.layer ()] = n;
}
std::string LayoutToNetlist::make_new_name (const std::string &stem)
{
int m = std::numeric_limits<int>::max () / 2 + 1;
@ -452,16 +417,6 @@ std::string LayoutToNetlist::make_new_name (const std::string &stem)
return name;
}
std::string LayoutToNetlist::name (const db::Region &region) const
{
std::map<unsigned int, std::string>::const_iterator n = m_name_of_layer.find (layer_of (region));
if (n != m_name_of_layer.end ()) {
return n->second;
} else {
return std::string ();
}
}
std::string LayoutToNetlist::name (unsigned int l) const
{
std::map<unsigned int, std::string>::const_iterator n = m_name_of_layer.find (l);
@ -472,11 +427,6 @@ std::string LayoutToNetlist::name (unsigned int l) const
}
}
bool LayoutToNetlist::is_persisted (const db::Region &region) const
{
return m_name_of_layer.find (layer_of (region)) != m_name_of_layer.end ();
}
db::Region *LayoutToNetlist::layer_by_name (const std::string &name)
{
std::map<std::string, db::DeepLayer>::const_iterator l = m_named_regions.find (name);
@ -497,12 +447,71 @@ db::Region *LayoutToNetlist::layer_by_index (unsigned int index)
}
}
db::DeepLayer LayoutToNetlist::deep_layer_of (const db::Region &region) const
static db::DeepLayer dss_create_from_flat (db::DeepShapeStore &dss, const db::ShapeCollection &coll)
{
const db::DeepRegion *dr = dynamic_cast<const db::DeepRegion *> (region.delegate ());
const db::Region *region = dynamic_cast<const db::Region *> (&coll);
const db::Texts *texts = dynamic_cast<const db::Texts *> (&coll);
if (region) {
return dss.create_from_flat (*region, true);
} else if (texts) {
return dss.create_from_flat (*texts);
} else {
tl_assert (false);
}
}
std::string LayoutToNetlist::name (const ShapeCollection &coll) const
{
std::map<unsigned int, std::string>::const_iterator n = m_name_of_layer.find (layer_of (coll));
if (n != m_name_of_layer.end ()) {
return n->second;
} else {
return std::string ();
}
}
void LayoutToNetlist::register_layer (const ShapeCollection &collection, const std::string &n)
{
if (m_named_regions.find (n) != m_named_regions.end ()) {
throw tl::Exception (tl::to_string (tr ("Layer name is already used: ")) + n);
}
db::DeepLayer dl;
if (m_is_flat) {
dl = dss_create_from_flat (dss (), collection);
} else {
db::DeepShapeCollectionDelegateBase *delegate = collection.get_delegate ()->deep ();
if (! delegate) {
dl = dss_create_from_flat (dss (), collection);
} else {
if (is_persisted (collection)) {
std::string prev_name = name (collection);
m_named_regions.erase (prev_name);
}
dl = delegate->deep_layer ();
}
}
m_named_regions [n] = dl;
m_name_of_layer [dl.layer ()] = n;
}
db::DeepLayer LayoutToNetlist::deep_layer_of (const db::ShapeCollection &coll) const
{
const db::DeepShapeCollectionDelegateBase *dr = coll.get_delegate ()->deep ();
if (! dr) {
std::pair<bool, db::DeepLayer> lff = dss ().layer_for_flat (region);
std::pair<bool, db::DeepLayer> lff = dss ().layer_for_flat (coll);
if (lff.first) {
return lff.second;
} else {
@ -514,11 +523,6 @@ db::DeepLayer LayoutToNetlist::deep_layer_of (const db::Region &region) const
}
}
unsigned int LayoutToNetlist::layer_of (const db::Region &region) const
{
return deep_layer_of (region).layer ();
}
db::CellMapping LayoutToNetlist::make_cell_mapping_into (db::Layout &layout, db::Cell &cell, const std::vector<const db::Net *> *nets, bool with_device_cells)
{
std::set<db::cell_index_type> device_cells;

View File

@ -240,13 +240,13 @@ public:
* derived by boolean operations for example.
* Named regions are persisted inside the LayoutToNetlist object.
*/
void register_layer (const db::Region &region, const std::string &name);
void register_layer (const ShapeCollection &collection, const std::string &name);
/**
* @brief Gets the name of the given region
* Returns an empty string if the region does not have a name.
* @brief Gets the name of the given collection
* Returns an empty string if the collection does not have a name.
*/
std::string name (const db::Region &region) const;
std::string name (const ShapeCollection &coll) const;
/**
* @brief Gets the name of the given layer by index
@ -272,7 +272,11 @@ public:
* Persisted regions have a name and are kept inside the LayoutToNetlist
* object.
*/
bool is_persisted (const db::Region &region) const;
template <class Collection>
bool is_persisted (const Collection &coll) const
{
return m_name_of_layer.find (layer_of (coll)) != m_name_of_layer.end ();
}
/**
* @brief Gets the region (layer) with the given name
@ -329,10 +333,10 @@ public:
db::Region *make_layer (unsigned int layer_index, const std::string &name = std::string ());
/**
* @brief Creates a new region representing an original layer taking texts only
* @brief Creates a new text collection representing an original layer taking texts only
* See "make_layer" for details.
*/
db::Region *make_text_layer (unsigned int layer_index, const std::string &name = std::string ());
db::Texts *make_text_layer (unsigned int layer_index, const std::string &name = std::string ());
/**
* @brief Creates a new region representing an original layer taking polygons and texts
@ -346,13 +350,13 @@ public:
* This method will run device extraction for the given extractor. The layer map is specific
* for the extractor and uses the region objects derived with "make_layer" and it's variants.
*
* In addition, derived regions can be passed too. Certain limitations apply. It's safe to use
* In addition, derived regions/text collections can be passed too. Certain limitations apply. It's safe to use
* boolean operations for deriving layers. Other operations are applicable as long as they are
* capable of delivering hierarchical layers.
*
* If errors occur, the device extractor will contain theses errors.
*/
void extract_devices (db::NetlistDeviceExtractor &extractor, const std::map<std::string, db::Region *> &layers);
void extract_devices (db::NetlistDeviceExtractor &extractor, const std::map<std::string, db::ShapeCollection *> &layers);
/**
* @brief Defines an intra-layer connection for the given layer.
@ -367,13 +371,46 @@ public:
* @brief Defines an inter-layer connection for the given layers.
* The conditions mentioned with intra-layer "connect" apply for this method too.
*/
void connect (const db::Region &a, const db::Region &b);
void connect (const db::Region &a, const db::Region &b)
{
connect_impl (a, b);
}
/**
* @brief Defines an inter-layer connection for the given layers.
* As one layer is a texts layer, this connection will basically add net labels.
*/
void connect (const db::Region &a, const db::Texts &b)
{
connect_impl (a, b);
}
/**
* @brief Defines an inter-layer connection for the given layers.
* As one layer is a texts layer, this connection will basically add net labels.
*/
void connect (const db::Texts &a, const db::Region &b)
{
connect_impl (b, a);
}
/**
* @brief Connects the given layer with a global net with the given name
* Returns the global net ID
*/
size_t connect_global (const db::Region &l, const std::string &gn);
void connect_global (const db::Region &l, const std::string &gn)
{
connect_global_impl (l, gn);
}
/**
* @brief Connects the given text layer with a global net with the given name
* Returns the global net ID
*/
void connect_global (const db::Texts &l, const std::string &gn)
{
connect_global_impl (l, gn);
}
/**
* @brief Gets the global net name for a given global net ID
@ -470,7 +507,11 @@ public:
* This method is required to derive the internal layer index - for example for
* investigating the cluster tree.
*/
unsigned int layer_of (const db::Region &region) const;
template <class Collection>
unsigned int layer_of (const Collection &coll) const
{
return deep_layer_of (coll).layer ();
}
/**
* @brief Creates a cell mapping for copying shapes from the internal layout to the given target layout.
@ -790,11 +831,13 @@ private:
void build_net_rec (const db::Net &net, db::Layout &target, cell_index_type circuit_cell, const db::CellMapping &cmap, const std::map<unsigned int, const db::Region *> &lmap, const char *net_cell_name_prefix, db::properties_id_type netname_propid, BuildNetHierarchyMode hier_mode, const char *cell_name_prefix, const char *device_cell_name_prefix, cell_reuse_table_type &reuse_table, const ICplxTrans &tr) const;
void build_net_rec (const db::Net &net, db::Layout &target, db::Cell &target_cell, const std::map<unsigned int, const db::Region *> &lmap, const char *net_cell_name_prefix, db::properties_id_type netname_propid, BuildNetHierarchyMode hier_mode, const char *cell_name_prefix, const char *device_cell_name_prefix, cell_reuse_table_type &reuse_table, const ICplxTrans &tr) const;
void build_net_rec (db::cell_index_type ci, size_t cid, db::Layout &target, db::Cell &target_cell, const std::map<unsigned int, const db::Region *> &lmap, const Net *net, const char *net_cell_name_prefix, db::properties_id_type netname_propid, BuildNetHierarchyMode hier_mode, const char *cell_name_prefix, const char *device_cell_name_prefix, cell_reuse_table_type &reuse_table, const ICplxTrans &tr) const;
db::DeepLayer deep_layer_of (const db::Region &region) const;
db::DeepLayer deep_layer_of (const ShapeCollection &coll) const;
void ensure_layout () const;
std::string make_new_name (const std::string &stem = std::string ());
db::properties_id_type make_netname_propid (db::Layout &ly, const tl::Variant &netname_prop, const db::Net &net) const;
db::CellMapping make_cell_mapping_into (db::Layout &layout, db::Cell &cell, const std::vector<const db::Net *> *nets, bool with_device_cells);
void connect_impl (const db::ShapeCollection &a, const db::ShapeCollection &b);
void connect_global_impl (const db::ShapeCollection &l, const std::string &gn);
// implementation of NetlistManipulationCallbacks
virtual size_t link_net_to_parent_circuit (const Net *subcircuit_net, Circuit *parent_circuit, const DCplxTrans &trans);

View File

@ -135,7 +135,7 @@ LayoutToNetlistStandardReader::skip ()
void LayoutToNetlistStandardReader::do_read (db::LayoutToNetlist *l2n)
{
tl::SelfTimer timer (tl::verbosity () >= 21, tl::to_string (tr ("File read")));
tl::SelfTimer timer (tl::verbosity () >= 21, tl::to_string (tr ("File read: ")) + m_path);
try {
read_netlist (0, l2n);

View File

@ -164,10 +164,10 @@ void NetlistDeviceExtractor::extract (db::DeepShapeStore &dss, unsigned int layo
}
tl_assert (l->second != 0);
db::DeepRegion *dr = dynamic_cast<db::DeepRegion *> (l->second->delegate ());
db::DeepShapeCollectionDelegateBase *dr = l->second->get_delegate ()->deep ();
if (dr == 0) {
std::pair<bool, db::DeepLayer> alias = dss.layer_for_flat (tl::id_of (l->second->delegate ()));
std::pair<bool, db::DeepLayer> alias = dss.layer_for_flat (tl::id_of (l->second->get_delegate ()));
if (alias.first) {
// use deep layer alias for a given flat one (if found)
layers.push_back (alias.second.layer ());

View File

@ -205,7 +205,7 @@ public:
typedef error_list::const_iterator error_iterator;
typedef std::vector<db::NetlistDeviceExtractorLayerDefinition> layer_definitions;
typedef layer_definitions::const_iterator layer_definitions_iterator;
typedef std::map<std::string, db::Region *> input_layers;
typedef std::map<std::string, db::ShapeCollection *> input_layers;
typedef db::hier_clusters<db::NetShape> hier_clusters_type;
/**

View File

@ -193,7 +193,7 @@ Region::Region (RegionDelegate *delegate)
}
Region::Region (const Region &other)
: gsi::ObjectBase (), mp_delegate (other.mp_delegate->clone ())
: db::ShapeCollection (), mp_delegate (other.mp_delegate->clone ())
{
// .. nothing yet ..
}

View File

@ -29,8 +29,7 @@
#include "dbRecursiveShapeIterator.h"
#include "dbPolygonGenerators.h"
#include "dbCellVariants.h"
#include "gsiObject.h"
#include "dbShapeCollection.h"
#include <list>
@ -216,7 +215,7 @@ private:
* Polygons inside the region may contain holes if the region is merged.
*/
class DB_PUBLIC Region
: public gsi::ObjectBase
: public db::ShapeCollection
{
public:
typedef db::Coord coord_type;
@ -351,6 +350,14 @@ public:
*/
explicit Region (DeepShapeStore &dss);
/**
* @brief Implementation of the ShapeCollection interface
*/
ShapeCollectionDelegateBase *get_delegate () const
{
return mp_delegate;
}
/**
* @brief Gets the underlying delegate object
*/

View File

@ -38,7 +38,7 @@ RegionDelegate::RegionDelegate ()
}
RegionDelegate::RegionDelegate (const RegionDelegate &other)
: tl::UniqueId ()
: ShapeCollectionDelegateBase ()
{
operator= (other);
}

View File

@ -31,7 +31,7 @@
#include "dbTexts.h"
#include "dbEdgePairs.h"
#include "dbEdgePairRelations.h"
#include "tlUniqueId.h"
#include "dbShapeCollection.h"
#include <list>
@ -183,7 +183,7 @@ public:
* @brief The delegate for the actual region implementation
*/
class DB_PUBLIC RegionDelegate
: public tl::UniqueId
: public db::ShapeCollectionDelegateBase
{
public:
typedef db::Coord coord_type;

View File

View File

@ -0,0 +1,115 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2020 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _HDR_dbShapeCollection
#define _HDR_dbShapeCollection
#include "dbCommon.h"
#include "dbDeepShapeStore.h"
#include "tlUniqueId.h"
#include "gsiObject.h"
namespace db
{
/**
* @brief A base class for the deep collection delegates
*/
class DB_PUBLIC DeepShapeCollectionDelegateBase
{
public:
DeepShapeCollectionDelegateBase () { }
DeepShapeCollectionDelegateBase (const DeepShapeCollectionDelegateBase &other)
{
m_deep_layer = other.m_deep_layer.copy ();
}
DeepShapeCollectionDelegateBase &operator= (const DeepShapeCollectionDelegateBase &other)
{
if (this != &other) {
m_deep_layer = other.m_deep_layer.copy ();
}
return *this;
}
const db::DeepLayer &deep_layer () const
{
return m_deep_layer;
}
db::DeepLayer &deep_layer ()
{
return m_deep_layer;
}
protected:
virtual void set_deep_layer (const db::DeepLayer &dl)
{
m_deep_layer = dl;
}
private:
db::DeepLayer m_deep_layer;
};
/**
* @brief A base class for the shape collection delegates
*/
class DB_PUBLIC ShapeCollectionDelegateBase
: public tl::UniqueId
{
public:
ShapeCollectionDelegateBase () { }
virtual ~ShapeCollectionDelegateBase () { }
virtual DeepShapeCollectionDelegateBase *deep () { return 0; }
};
/**
* @brief A base class for the shape collections such as Region, Edges, EdgePairs etc.
*/
class DB_PUBLIC ShapeCollection
: public gsi::ObjectBase
{
public:
ShapeCollection () { }
virtual ~ShapeCollection () { }
virtual ShapeCollectionDelegateBase *get_delegate () const = 0;
};
}
namespace tl
{
template<> struct type_traits<db::ShapeCollection> : public tl::type_traits<void>
{
// mark "NetlistDeviceExtractor" as having a default ctor and no copy ctor
typedef tl::false_tag has_copy_constructor;
typedef tl::false_tag has_default_constructor;
};
}
#endif

View File

@ -57,7 +57,7 @@ Texts::Texts (TextsDelegate *delegate)
}
Texts::Texts (const Texts &other)
: gsi::ObjectBase (), mp_delegate (other.mp_delegate->clone ())
: db::ShapeCollection (), mp_delegate (other.mp_delegate->clone ())
{
// .. nothing yet ..
}

View File

@ -27,8 +27,7 @@
#include "dbTextsDelegate.h"
#include "dbShape.h"
#include "dbRecursiveShapeIterator.h"
#include "gsiObject.h"
#include "dbShapeCollection.h"
#include <list>
@ -228,7 +227,7 @@ public:
* edges representing the point of the text.
*/
class DB_PUBLIC Texts
: public gsi::ObjectBase
: public db::ShapeCollection
{
public:
typedef db::Coord coord_type;
@ -337,6 +336,14 @@ public:
*/
explicit Texts (const RecursiveShapeIterator &si, DeepShapeStore &dss, const db::ICplxTrans &trans);
/**
* @brief Implementation of the ShapeCollection interface
*/
ShapeCollectionDelegateBase *get_delegate () const
{
return mp_delegate;
}
/**
* @brief Gets the underlying delegate object
*/

View File

@ -34,7 +34,7 @@ TextsDelegate::TextsDelegate ()
}
TextsDelegate::TextsDelegate (const TextsDelegate &other)
: tl::UniqueId ()
: db::ShapeCollectionDelegateBase ()
{
operator= (other);
}

View File

@ -25,9 +25,8 @@
#define HDR_dbTextsDelegate
#include "dbCommon.h"
#include "dbShapeCollection.h"
#include "dbText.h"
#include "tlUniqueId.h"
namespace db {
@ -60,7 +59,7 @@ public:
* @brief The delegate for the actual edge set implementation
*/
class DB_PUBLIC TextsDelegate
: public tl::UniqueId
: public ShapeCollectionDelegateBase
{
public:
typedef db::Coord coord_type;

View File

@ -179,7 +179,9 @@ static size_t id (const db::EdgePairs *ep)
return tl::id_of (ep->delegate ());
}
Class<db::EdgePairs> decl_EdgePairs ("db", "EdgePairs",
extern Class<db::ShapeCollection> decl_dbShapeCollection;
Class<db::EdgePairs> decl_EdgePairs (decl_dbShapeCollection, "db", "EdgePairs",
constructor ("new", &new_v,
"@brief Default constructor\n"
"\n"

View File

@ -412,7 +412,9 @@ static size_t id (const db::Edges *e)
return tl::id_of (e->delegate ());
}
Class<db::Edges> dec_Edges ("db", "Edges",
extern Class<db::ShapeCollection> decl_dbShapeCollection;
Class<db::Edges> dec_Edges (decl_dbShapeCollection, "db", "Edges",
constructor ("new", &new_v,
"@brief Default constructor\n"
"\n"

View File

@ -237,7 +237,7 @@ Class<db::LayoutToNetlist> decl_dbLayoutToNetlist ("db", "LayoutToNetlist",
gsi::method ("original_file=", &db::LayoutToNetlist::set_original_file,
"@brief Sets the original file name of the database\n"
) +
gsi::method ("layer_name", (std::string (db::LayoutToNetlist::*) (const db::Region &region) const) &db::LayoutToNetlist::name, gsi::arg ("l"),
gsi::method ("layer_name", (std::string (db::LayoutToNetlist::*) (const db::ShapeCollection &region) const) &db::LayoutToNetlist::name, gsi::arg ("l"),
"@brief Gets the name of the given layer\n"
) +
gsi::method ("layer_name", (std::string (db::LayoutToNetlist::*) (unsigned int) const) &db::LayoutToNetlist::name, gsi::arg ("l"),
@ -254,6 +254,13 @@ Class<db::LayoutToNetlist> decl_dbLayoutToNetlist ("db", "LayoutToNetlist",
"\n"
"If required, the system will assign a name automatically."
) +
gsi::method ("register", (void (db::LayoutToNetlist::*) (const db::Texts &texts, const std::string &)) &db::LayoutToNetlist::register_layer, gsi::arg ("l"), gsi::arg ("n"),
"@brief Names the given layer\n"
"This method behaves like the one provided for Regions but accepts Texts. "
"Texts (hierarchical text collections) are useful to represent labels for naming nets.\n"
"\n"
"This variant has been introduced in version 0.27.\n"
) +
gsi::method_ext ("layer_names", &l2n_layer_names,
"@brief Returns a list of names of the layer kept inside the LayoutToNetlist object."
) +
@ -266,12 +273,20 @@ Class<db::LayoutToNetlist> decl_dbLayoutToNetlist ("db", "LayoutToNetlist",
"Only named layers can be retrieved with this method. "
"The returned object is a copy which represents the named layer."
) +
gsi::method ("is_persisted?", &db::LayoutToNetlist::is_persisted, gsi::arg ("layer"),
gsi::method ("is_persisted?", &db::LayoutToNetlist::is_persisted<db::Region>, gsi::arg ("layer"),
"@brief Returns true, if the given layer is a persisted region.\n"
"Persisted layers are kept inside the LayoutToNetlist object and are not released "
"if their object is destroyed. Named layers are persisted, unnamed layers are not. "
"Only persisted, named layers can be put into \\connect."
) +
gsi::method ("is_persisted?", &db::LayoutToNetlist::is_persisted<db::Texts>, gsi::arg ("layer"),
"@brief Returns true, if the given layer is a persisted texts collection.\n"
"Persisted layers are kept inside the LayoutToNetlist object and are not released "
"if their object is destroyed. Named layers are persisted, unnamed layers are not. "
"Only persisted, named layers can be put into \\connect.\n"
"\n"
"The variant for Texts collections has been added in version 0.27."
) +
gsi::factory ("make_layer", (db::Region *(db::LayoutToNetlist::*) (const std::string &)) &db::LayoutToNetlist::make_layer, gsi::arg ("name", std::string ()),
"@brief Creates a new, empty hierarchical region\n"
"\n"
@ -291,6 +306,8 @@ Class<db::LayoutToNetlist> decl_dbLayoutToNetlist ("db", "LayoutToNetlist",
"See \\make_layer for details.\n"
"\n"
"The name is optional. If given, the layer will already be named accordingly (see \\register).\n"
"\n"
"Starting with version 0.27, this method returns a \\Texts object."
) +
gsi::factory ("make_polygon_layer", &db::LayoutToNetlist::make_polygon_layer, gsi::arg ("layer_index"), gsi::arg ("name", std::string ()),
"@brief Creates a new region representing an original layer taking polygons and texts\n"
@ -321,11 +338,32 @@ Class<db::LayoutToNetlist> decl_dbLayoutToNetlist ("db", "LayoutToNetlist",
"@brief Defines an inter-layer connection for the given layers.\n"
"The conditions mentioned with intra-layer \\connect apply for this method too.\n"
) +
gsi::method ("connect", (void (db::LayoutToNetlist::*) (const db::Region &, const db::Texts &)) &db::LayoutToNetlist::connect, gsi::arg ("a"), gsi::arg ("b"),
"@brief Defines an inter-layer connection for the given layers.\n"
"The conditions mentioned with intra-layer \\connect apply for this method too.\n"
"As one argument is a (hierarchical) text collection, this method is used to attach net labels to polygons.\n"
"\n"
"This variant has been introduced in version 0.27.\n"
) +
gsi::method ("connect", (void (db::LayoutToNetlist::*) (const db::Texts &, const db::Region &)) &db::LayoutToNetlist::connect, gsi::arg ("a"), gsi::arg ("b"),
"@brief Defines an inter-layer connection for the given layers.\n"
"The conditions mentioned with intra-layer \\connect apply for this method too.\n"
"As one argument is a (hierarchical) text collection, this method is used to attach net labels to polygons.\n"
"\n"
"This variant has been introduced in version 0.27.\n"
) +
gsi::method ("connect_global", (void (db::LayoutToNetlist::*) (const db::Region &, const std::string &)) &db::LayoutToNetlist::connect_global, gsi::arg ("l"), gsi::arg ("global_net_name"),
"@brief Defines a connection of the given layer with a global net.\n"
"This method returns the ID of the global net. Use \\global_net_name to get "
"the name back from the ID."
) +
gsi::method ("connect_global", (void (db::LayoutToNetlist::*) (const db::Texts &, const std::string &)) &db::LayoutToNetlist::connect_global, gsi::arg ("l"), gsi::arg ("global_net_name"),
"@brief Defines a connection of the given text layer with a global net.\n"
"This method returns the ID of the global net. Use \\global_net_name to get "
"the name back from the ID."
"\n"
"This variant has been introduced in version 0.27.\n"
) +
gsi::method ("global_net_name", &db::LayoutToNetlist::global_net_name, gsi::arg ("global_net_id"),
"@brief Gets the global net name for the given global net ID."
) +
@ -378,11 +416,18 @@ Class<db::LayoutToNetlist> decl_dbLayoutToNetlist ("db", "LayoutToNetlist",
"Usually it should not be required to obtain the internal cell. If you need to do so, make sure not to modify the cell as\n"
"the functionality of the netlist extractor depends on it."
) +
gsi::method ("layer_of", &db::LayoutToNetlist::layer_of, gsi::arg ("l"),
gsi::method ("layer_of", &db::LayoutToNetlist::layer_of<db::Region>, gsi::arg ("l"),
"@brief Gets the internal layer for a given extraction layer\n"
"This method is required to derive the internal layer index - for example for\n"
"investigating the cluster tree.\n"
) +
gsi::method ("layer_of", &db::LayoutToNetlist::layer_of<db::Texts>, gsi::arg ("l"),
"@brief Gets the internal layer for a given text collection\n"
"This method is required to derive the internal layer index - for example for\n"
"investigating the cluster tree.\n"
"\n"
"The variant for Texts collections has been added in version 0.27.\n"
) +
gsi::method ("cell_mapping_into", (db::CellMapping (db::LayoutToNetlist::*) (db::Layout &, db::Cell &, bool)) &db::LayoutToNetlist::cell_mapping_into, gsi::arg ("layout"), gsi::arg ("cell"), gsi::arg ("with_device_cells", false),
"@brief Creates a cell mapping for copying shapes from the internal layout to the given target layout.\n"
"If 'with_device_cells' is true, cells will be produced for devices. These are cells not corresponding to circuits, so they are disabled normally.\n"

View File

@ -607,7 +607,9 @@ static size_t id (const db::Region *r)
int td_simple ();
int po_any ();
Class<db::Region> decl_Region ("db", "Region",
extern Class<db::ShapeCollection> decl_dbShapeCollection;
Class<db::Region> decl_Region (decl_dbShapeCollection, "db", "Region",
constructor ("new", &new_v,
"@brief Default constructor\n"
"\n"

View File

@ -0,0 +1,36 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2020 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "gsiDecl.h"
#include "dbShapeCollection.h"
namespace gsi
{
Class<db::ShapeCollection> decl_dbShapeCollection ("db", "ShapeCollection",
gsi::Methods (),
"@brief A base class for the shape collections (\\Region, \\Edges, \\EdgePairs and \\Texts)\n"
"\n"
"This class has been introduced in version 0.27."
);
}

View File

@ -172,7 +172,9 @@ static db::Region pull_interacting (const db::Texts *r, const db::Region &other)
return out;
}
Class<db::Texts> decl_Texts ("db", "Texts",
extern Class<db::ShapeCollection> decl_dbShapeCollection;
Class<db::Texts> decl_Texts (decl_dbShapeCollection, "db", "Texts",
constructor ("new", &new_v,
"@brief Default constructor\n"
"\n"

View File

@ -205,14 +205,14 @@ TEST(1_BasicExtraction)
std::auto_ptr<db::Region> rnwell (l2n.make_layer (nwell, "nwell"));
std::auto_ptr<db::Region> ractive (l2n.make_layer (active, "active"));
std::auto_ptr<db::Region> rpoly (l2n.make_polygon_layer (poly, "poly"));
std::auto_ptr<db::Region> rpoly_lbl (l2n.make_text_layer (poly_lbl, "poly_lbl"));
std::auto_ptr<db::Texts> rpoly_lbl (l2n.make_text_layer (poly_lbl, "poly_lbl"));
std::auto_ptr<db::Region> rdiff_cont (l2n.make_polygon_layer (diff_cont, "diff_cont"));
std::auto_ptr<db::Region> rpoly_cont (l2n.make_polygon_layer (poly_cont, "poly_cont"));
std::auto_ptr<db::Region> rmetal1 (l2n.make_polygon_layer (metal1, "metal1"));
std::auto_ptr<db::Region> rmetal1_lbl (l2n.make_text_layer (metal1_lbl, "metal1_lbl"));
std::auto_ptr<db::Texts> rmetal1_lbl (l2n.make_text_layer (metal1_lbl, "metal1_lbl"));
std::auto_ptr<db::Region> rvia1 (l2n.make_polygon_layer (via1, "via1"));
std::auto_ptr<db::Region> rmetal2 (l2n.make_polygon_layer (metal2, "metal2"));
std::auto_ptr<db::Region> rmetal2_lbl (l2n.make_text_layer (metal2_lbl, "metal2_lbl"));
std::auto_ptr<db::Texts> rmetal2_lbl (l2n.make_text_layer (metal2_lbl, "metal2_lbl"));
// derived regions
@ -693,14 +693,14 @@ TEST(2_Probing)
std::auto_ptr<db::Region> rnwell (l2n.make_layer (nwell, "nwell"));
std::auto_ptr<db::Region> ractive (l2n.make_layer (active, "active"));
std::auto_ptr<db::Region> rpoly (l2n.make_polygon_layer (poly, "poly"));
std::auto_ptr<db::Region> rpoly_lbl (l2n.make_text_layer (poly_lbl, "poly_lbl"));
std::auto_ptr<db::Texts> rpoly_lbl (l2n.make_text_layer (poly_lbl, "poly_lbl"));
std::auto_ptr<db::Region> rdiff_cont (l2n.make_polygon_layer (diff_cont, "diff_cont"));
std::auto_ptr<db::Region> rpoly_cont (l2n.make_polygon_layer (poly_cont, "poly_cont"));
std::auto_ptr<db::Region> rmetal1 (l2n.make_polygon_layer (metal1, "metal1"));
std::auto_ptr<db::Region> rmetal1_lbl (l2n.make_text_layer (metal1_lbl, "metal1_lbl"));
std::auto_ptr<db::Texts> rmetal1_lbl (l2n.make_text_layer (metal1_lbl, "metal1_lbl"));
std::auto_ptr<db::Region> rvia1 (l2n.make_polygon_layer (via1, "via1"));
std::auto_ptr<db::Region> rmetal2 (l2n.make_polygon_layer (metal2, "metal2"));
std::auto_ptr<db::Region> rmetal2_lbl (l2n.make_text_layer (metal2_lbl, "metal2_lbl"));
std::auto_ptr<db::Texts> rmetal2_lbl (l2n.make_text_layer (metal2_lbl, "metal2_lbl"));
// derived regions
@ -947,14 +947,14 @@ TEST(3_GlobalNetConnections)
std::auto_ptr<db::Region> rpplus (l2n.make_layer (pplus, "pplus"));
std::auto_ptr<db::Region> rnplus (l2n.make_layer (nplus, "nplus"));
std::auto_ptr<db::Region> rpoly (l2n.make_polygon_layer (poly, "poly"));
std::auto_ptr<db::Region> rpoly_lbl (l2n.make_text_layer (poly_lbl, "poly_lbl"));
std::auto_ptr<db::Texts> rpoly_lbl (l2n.make_text_layer (poly_lbl, "poly_lbl"));
std::auto_ptr<db::Region> rdiff_cont (l2n.make_polygon_layer (diff_cont, "diff_cont"));
std::auto_ptr<db::Region> rpoly_cont (l2n.make_polygon_layer (poly_cont, "poly_cont"));
std::auto_ptr<db::Region> rmetal1 (l2n.make_polygon_layer (metal1, "metal1"));
std::auto_ptr<db::Region> rmetal1_lbl (l2n.make_text_layer (metal1_lbl, "metal1_lbl"));
std::auto_ptr<db::Texts> rmetal1_lbl (l2n.make_text_layer (metal1_lbl, "metal1_lbl"));
std::auto_ptr<db::Region> rvia1 (l2n.make_polygon_layer (via1, "via1"));
std::auto_ptr<db::Region> rmetal2 (l2n.make_polygon_layer (metal2, "metal2"));
std::auto_ptr<db::Region> rmetal2_lbl (l2n.make_text_layer (metal2_lbl, "metal2_lbl"));
std::auto_ptr<db::Texts> rmetal2_lbl (l2n.make_text_layer (metal2_lbl, "metal2_lbl"));
// derived regions
@ -1228,14 +1228,14 @@ TEST(4_GlobalNetDeviceExtraction)
std::auto_ptr<db::Region> rpplus (l2n.make_layer (pplus, "pplus"));
std::auto_ptr<db::Region> rnplus (l2n.make_layer (nplus, "nplus"));
std::auto_ptr<db::Region> rpoly (l2n.make_polygon_layer (poly, "poly"));
std::auto_ptr<db::Region> rpoly_lbl (l2n.make_text_layer (poly_lbl, "poly_lbl"));
std::auto_ptr<db::Texts> rpoly_lbl (l2n.make_text_layer (poly_lbl, "poly_lbl"));
std::auto_ptr<db::Region> rdiff_cont (l2n.make_polygon_layer (diff_cont, "diff_cont"));
std::auto_ptr<db::Region> rpoly_cont (l2n.make_polygon_layer (poly_cont, "poly_cont"));
std::auto_ptr<db::Region> rmetal1 (l2n.make_polygon_layer (metal1, "metal1"));
std::auto_ptr<db::Region> rmetal1_lbl (l2n.make_text_layer (metal1_lbl, "metal1_lbl"));
std::auto_ptr<db::Texts> rmetal1_lbl (l2n.make_text_layer (metal1_lbl, "metal1_lbl"));
std::auto_ptr<db::Region> rvia1 (l2n.make_polygon_layer (via1, "via1"));
std::auto_ptr<db::Region> rmetal2 (l2n.make_polygon_layer (metal2, "metal2"));
std::auto_ptr<db::Region> rmetal2_lbl (l2n.make_text_layer (metal2_lbl, "metal2_lbl"));
std::auto_ptr<db::Texts> rmetal2_lbl (l2n.make_text_layer (metal2_lbl, "metal2_lbl"));
// derived regions
@ -1514,14 +1514,14 @@ TEST(5_DeviceExtractionWithDeviceCombination)
std::auto_ptr<db::Region> rpplus (l2n.make_layer (pplus, "pplus"));
std::auto_ptr<db::Region> rnplus (l2n.make_layer (nplus, "nplus"));
std::auto_ptr<db::Region> rpoly (l2n.make_polygon_layer (poly, "poly"));
std::auto_ptr<db::Region> rpoly_lbl (l2n.make_text_layer (poly_lbl, "poly_lbl"));
std::auto_ptr<db::Texts> rpoly_lbl (l2n.make_text_layer (poly_lbl, "poly_lbl"));
std::auto_ptr<db::Region> rdiff_cont (l2n.make_polygon_layer (diff_cont, "diff_cont"));
std::auto_ptr<db::Region> rpoly_cont (l2n.make_polygon_layer (poly_cont, "poly_cont"));
std::auto_ptr<db::Region> rmetal1 (l2n.make_polygon_layer (metal1, "metal1"));
std::auto_ptr<db::Region> rmetal1_lbl (l2n.make_text_layer (metal1_lbl, "metal1_lbl"));
std::auto_ptr<db::Texts> rmetal1_lbl (l2n.make_text_layer (metal1_lbl, "metal1_lbl"));
std::auto_ptr<db::Region> rvia1 (l2n.make_polygon_layer (via1, "via1"));
std::auto_ptr<db::Region> rmetal2 (l2n.make_polygon_layer (metal2, "metal2"));
std::auto_ptr<db::Region> rmetal2_lbl (l2n.make_text_layer (metal2_lbl, "metal2_lbl"));
std::auto_ptr<db::Texts> rmetal2_lbl (l2n.make_text_layer (metal2_lbl, "metal2_lbl"));
// derived regions
@ -1793,13 +1793,13 @@ TEST(6_MoreDeviceTypes)
std::auto_ptr<db::Region> rpplus (l2n.make_layer (pplus, "pplus"));
std::auto_ptr<db::Region> rnplus (l2n.make_layer (nplus, "nplus"));
std::auto_ptr<db::Region> rpoly (l2n.make_polygon_layer (poly, "poly"));
std::auto_ptr<db::Region> rpoly_lbl (l2n.make_text_layer (poly_lbl, "poly_lbl"));
std::auto_ptr<db::Texts> rpoly_lbl (l2n.make_text_layer (poly_lbl, "poly_lbl"));
std::auto_ptr<db::Region> rcont (l2n.make_polygon_layer (cont, "cont"));
std::auto_ptr<db::Region> rmetal1 (l2n.make_polygon_layer (metal1, "metal1"));
std::auto_ptr<db::Region> rmetal1_lbl (l2n.make_text_layer (metal1_lbl, "metal1_lbl"));
std::auto_ptr<db::Texts> rmetal1_lbl (l2n.make_text_layer (metal1_lbl, "metal1_lbl"));
std::auto_ptr<db::Region> rvia1 (l2n.make_polygon_layer (via1, "via1"));
std::auto_ptr<db::Region> rmetal2 (l2n.make_polygon_layer (metal2, "metal2"));
std::auto_ptr<db::Region> rmetal2_lbl (l2n.make_text_layer (metal2_lbl, "metal2_lbl"));
std::auto_ptr<db::Texts> rmetal2_lbl (l2n.make_text_layer (metal2_lbl, "metal2_lbl"));
// derived regions
@ -1950,13 +1950,13 @@ TEST(7_MoreByEmptyDeviceTypes)
std::auto_ptr<db::Region> rpplus (l2n.make_layer (pplus, "pplus"));
std::auto_ptr<db::Region> rnplus (l2n.make_layer (nplus, "nplus"));
std::auto_ptr<db::Region> rpoly (l2n.make_polygon_layer (poly, "poly"));
std::auto_ptr<db::Region> rpoly_lbl (l2n.make_text_layer (poly_lbl, "poly_lbl"));
std::auto_ptr<db::Texts> rpoly_lbl (l2n.make_text_layer (poly_lbl, "poly_lbl"));
std::auto_ptr<db::Region> rcont (l2n.make_polygon_layer (cont, "cont"));
std::auto_ptr<db::Region> rmetal1 (l2n.make_polygon_layer (metal1, "metal1"));
std::auto_ptr<db::Region> rmetal1_lbl (l2n.make_text_layer (metal1_lbl, "metal1_lbl"));
std::auto_ptr<db::Texts> rmetal1_lbl (l2n.make_text_layer (metal1_lbl, "metal1_lbl"));
std::auto_ptr<db::Region> rvia1 (l2n.make_polygon_layer (via1, "via1"));
std::auto_ptr<db::Region> rmetal2 (l2n.make_polygon_layer (metal2, "metal2"));
std::auto_ptr<db::Region> rmetal2_lbl (l2n.make_text_layer (metal2_lbl, "metal2_lbl"));
std::auto_ptr<db::Texts> rmetal2_lbl (l2n.make_text_layer (metal2_lbl, "metal2_lbl"));
// derived regions
@ -2655,14 +2655,14 @@ TEST(11_DuplicateInstances)
std::auto_ptr<db::Region> rnwell (l2n.make_layer (nwell, "nwell"));
std::auto_ptr<db::Region> ractive (l2n.make_layer (active, "active"));
std::auto_ptr<db::Region> rpoly (l2n.make_polygon_layer (poly, "poly"));
std::auto_ptr<db::Region> rpoly_lbl (l2n.make_text_layer (poly_lbl, "poly_lbl"));
std::auto_ptr<db::Texts> rpoly_lbl (l2n.make_text_layer (poly_lbl, "poly_lbl"));
std::auto_ptr<db::Region> rdiff_cont (l2n.make_polygon_layer (diff_cont, "diff_cont"));
std::auto_ptr<db::Region> rpoly_cont (l2n.make_polygon_layer (poly_cont, "poly_cont"));
std::auto_ptr<db::Region> rmetal1 (l2n.make_polygon_layer (metal1, "metal1"));
std::auto_ptr<db::Region> rmetal1_lbl (l2n.make_text_layer (metal1_lbl, "metal1_lbl"));
std::auto_ptr<db::Texts> rmetal1_lbl (l2n.make_text_layer (metal1_lbl, "metal1_lbl"));
std::auto_ptr<db::Region> rvia1 (l2n.make_polygon_layer (via1, "via1"));
std::auto_ptr<db::Region> rmetal2 (l2n.make_polygon_layer (metal2, "metal2"));
std::auto_ptr<db::Region> rmetal2_lbl (l2n.make_text_layer (metal2_lbl, "metal2_lbl"));
std::auto_ptr<db::Texts> rmetal2_lbl (l2n.make_text_layer (metal2_lbl, "metal2_lbl"));
// derived regions
@ -2863,14 +2863,14 @@ TEST(12_FlattenCircuitDoesFlattenLayout)
std::auto_ptr<db::Region> rpplus (l2n.make_layer (pplus, "pplus"));
std::auto_ptr<db::Region> rnplus (l2n.make_layer (nplus, "nplus"));
std::auto_ptr<db::Region> rpoly (l2n.make_polygon_layer (poly, "poly"));
std::auto_ptr<db::Region> rpoly_lbl (l2n.make_text_layer (poly_lbl, "poly_lbl"));
std::auto_ptr<db::Texts> rpoly_lbl (l2n.make_text_layer (poly_lbl, "poly_lbl"));
std::auto_ptr<db::Region> rdiff_cont (l2n.make_polygon_layer (diff_cont, "diff_cont"));
std::auto_ptr<db::Region> rpoly_cont (l2n.make_polygon_layer (poly_cont, "poly_cont"));
std::auto_ptr<db::Region> rmetal1 (l2n.make_polygon_layer (metal1, "metal1"));
std::auto_ptr<db::Region> rmetal1_lbl (l2n.make_text_layer (metal1_lbl, "metal1_lbl"));
std::auto_ptr<db::Texts> rmetal1_lbl (l2n.make_text_layer (metal1_lbl, "metal1_lbl"));
std::auto_ptr<db::Region> rvia1 (l2n.make_polygon_layer (via1, "via1"));
std::auto_ptr<db::Region> rmetal2 (l2n.make_polygon_layer (metal2, "metal2"));
std::auto_ptr<db::Region> rmetal2_lbl (l2n.make_text_layer (metal2_lbl, "metal2_lbl"));
std::auto_ptr<db::Texts> rmetal2_lbl (l2n.make_text_layer (metal2_lbl, "metal2_lbl"));
// derived regions

View File

@ -76,14 +76,14 @@ TEST(1_WriterBasic)
std::auto_ptr<db::Region> rnwell (l2n.make_layer (nwell, "nwell"));
std::auto_ptr<db::Region> ractive (l2n.make_layer (active, "active"));
std::auto_ptr<db::Region> rpoly (l2n.make_polygon_layer (poly, "poly"));
std::auto_ptr<db::Region> rpoly_lbl (l2n.make_text_layer (poly_lbl, "poly_lbl"));
std::auto_ptr<db::Texts> rpoly_lbl (l2n.make_text_layer (poly_lbl, "poly_lbl"));
std::auto_ptr<db::Region> rdiff_cont (l2n.make_polygon_layer (diff_cont, "diff_cont"));
std::auto_ptr<db::Region> rpoly_cont (l2n.make_polygon_layer (poly_cont, "poly_cont"));
std::auto_ptr<db::Region> rmetal1 (l2n.make_polygon_layer (metal1, "metal1"));
std::auto_ptr<db::Region> rmetal1_lbl (l2n.make_text_layer (metal1_lbl, "metal1_lbl"));
std::auto_ptr<db::Texts> rmetal1_lbl (l2n.make_text_layer (metal1_lbl, "metal1_lbl"));
std::auto_ptr<db::Region> rvia1 (l2n.make_polygon_layer (via1, "via1"));
std::auto_ptr<db::Region> rmetal2 (l2n.make_polygon_layer (metal2, "metal2"));
std::auto_ptr<db::Region> rmetal2_lbl (l2n.make_text_layer (metal2_lbl, "metal2_lbl"));
std::auto_ptr<db::Texts> rmetal2_lbl (l2n.make_text_layer (metal2_lbl, "metal2_lbl"));
// derived regions
@ -289,14 +289,14 @@ TEST(2_WriterWithGlobalNets)
std::auto_ptr<db::Region> rpplus (l2n.make_layer (pplus, "pplus"));
std::auto_ptr<db::Region> rnplus (l2n.make_layer (nplus, "nplus"));
std::auto_ptr<db::Region> rpoly (l2n.make_polygon_layer (poly, "poly"));
std::auto_ptr<db::Region> rpoly_lbl (l2n.make_text_layer (poly_lbl, "poly_lbl"));
std::auto_ptr<db::Region> rpoly_lbl (l2n.make_layer (poly_lbl, "poly_lbl"));
std::auto_ptr<db::Region> rdiff_cont (l2n.make_polygon_layer (diff_cont, "diff_cont"));
std::auto_ptr<db::Region> rpoly_cont (l2n.make_polygon_layer (poly_cont, "poly_cont"));
std::auto_ptr<db::Region> rmetal1 (l2n.make_polygon_layer (metal1, "metal1"));
std::auto_ptr<db::Region> rmetal1_lbl (l2n.make_text_layer (metal1_lbl, "metal1_lbl"));
std::auto_ptr<db::Region> rmetal1_lbl (l2n.make_layer (metal1_lbl, "metal1_lbl"));
std::auto_ptr<db::Region> rvia1 (l2n.make_polygon_layer (via1, "via1"));
std::auto_ptr<db::Region> rmetal2 (l2n.make_polygon_layer (metal2, "metal2"));
std::auto_ptr<db::Region> rmetal2_lbl (l2n.make_text_layer (metal2_lbl, "metal2_lbl"));
std::auto_ptr<db::Region> rmetal2_lbl (l2n.make_layer (metal2_lbl, "metal2_lbl"));
// derived regions

View File

@ -95,14 +95,14 @@ TEST(1_BasicFlow)
std::auto_ptr<db::Region> rpplus (lvs.make_layer (pplus, "pplus"));
std::auto_ptr<db::Region> rnplus (lvs.make_layer (nplus, "nplus"));
std::auto_ptr<db::Region> rpoly (lvs.make_polygon_layer (poly, "poly"));
std::auto_ptr<db::Region> rpoly_lbl (lvs.make_text_layer (poly_lbl, "poly_lbl"));
std::auto_ptr<db::Region> rpoly_lbl (lvs.make_layer (poly_lbl, "poly_lbl"));
std::auto_ptr<db::Region> rdiff_cont (lvs.make_polygon_layer (diff_cont, "diff_cont"));
std::auto_ptr<db::Region> rpoly_cont (lvs.make_polygon_layer (poly_cont, "poly_cont"));
std::auto_ptr<db::Region> rmetal1 (lvs.make_polygon_layer (metal1, "metal1"));
std::auto_ptr<db::Region> rmetal1_lbl (lvs.make_text_layer (metal1_lbl, "metal1_lbl"));
std::auto_ptr<db::Region> rmetal1_lbl (lvs.make_layer (metal1_lbl, "metal1_lbl"));
std::auto_ptr<db::Region> rvia1 (lvs.make_polygon_layer (via1, "via1"));
std::auto_ptr<db::Region> rmetal2 (lvs.make_polygon_layer (metal2, "metal2"));
std::auto_ptr<db::Region> rmetal2_lbl (lvs.make_text_layer (metal2_lbl, "metal2_lbl"));
std::auto_ptr<db::Region> rmetal2_lbl (lvs.make_layer (metal2_lbl, "metal2_lbl"));
// derived regions
@ -293,14 +293,14 @@ TEST(2_FlowWithErrors)
std::auto_ptr<db::Region> rpplus (lvs.make_layer (pplus, "pplus"));
std::auto_ptr<db::Region> rnplus (lvs.make_layer (nplus, "nplus"));
std::auto_ptr<db::Region> rpoly (lvs.make_polygon_layer (poly, "poly"));
std::auto_ptr<db::Region> rpoly_lbl (lvs.make_text_layer (poly_lbl, "poly_lbl"));
std::auto_ptr<db::Region> rpoly_lbl (lvs.make_layer (poly_lbl, "poly_lbl"));
std::auto_ptr<db::Region> rdiff_cont (lvs.make_polygon_layer (diff_cont, "diff_cont"));
std::auto_ptr<db::Region> rpoly_cont (lvs.make_polygon_layer (poly_cont, "poly_cont"));
std::auto_ptr<db::Region> rmetal1 (lvs.make_polygon_layer (metal1, "metal1"));
std::auto_ptr<db::Region> rmetal1_lbl (lvs.make_text_layer (metal1_lbl, "metal1_lbl"));
std::auto_ptr<db::Region> rmetal1_lbl (lvs.make_layer (metal1_lbl, "metal1_lbl"));
std::auto_ptr<db::Region> rvia1 (lvs.make_polygon_layer (via1, "via1"));
std::auto_ptr<db::Region> rmetal2 (lvs.make_polygon_layer (metal2, "metal2"));
std::auto_ptr<db::Region> rmetal2_lbl (lvs.make_text_layer (metal2_lbl, "metal2_lbl"));
std::auto_ptr<db::Region> rmetal2_lbl (lvs.make_layer (metal2_lbl, "metal2_lbl"));
// derived regions

View File

@ -94,13 +94,13 @@ module DRC
a.is_a?(DRC::DRCLayer) || raise("First argument of Netter#connect must be a layer")
b.is_a?(DRC::DRCLayer) || raise("Second argument of Netter#connect must be a layer")
a.requires_region("Netter#connect (first argument)")
b.requires_region("Netter#connect (second argument)")
a.requires_texts_or_region("Netter#connect (first argument)")
b.requires_texts_or_region("Netter#connect (second argument)")
register_layer(a.data)
register_layer(b.data)
@l2n.connect(a.data)
@l2n.connect(b.data)
a.data.is_a?(RBA::Region) && @l2n.connect(a.data)
b.data.is_a?(RBA::Region) && @l2n.connect(b.data)
@l2n.connect(a.data, b.data)
end
@ -117,10 +117,10 @@ module DRC
def connect_global(l, name)
l.is_a?(DRC::DRCLayer) || raise("Layer argument of Netter#connect_global must be a layer")
l.requires_region("Netter#connect_global (layer argument)")
l.requires_texts_or_region("Netter#connect_global (layer argument)")
register_layer(l.data)
@l2n.connect(l.data)
l.data.is_a?(RBA::Region) && @l2n.connect(l.data)
@l2n.connect_global(l.data, name)
end
@ -189,7 +189,7 @@ module DRC
ls = {}
layer_selection.keys.sort.each do |n|
l = layer_selection[n]
l.requires_region("Netter#extract_devices (#{n} layer)")
l.requires_texts_or_region("Netter#extract_devices (#{n} layer)")
register_layer(l.data)
ls[n.to_s] = l.data
end

View File

@ -818,7 +818,7 @@ CIFReader::read_cell (db::Layout &layout, db::Cell &cell, double sf, int level)
void
CIFReader::do_read (db::Layout &layout)
{
tl::SelfTimer timer (tl::verbosity () >= 21, "File read");
tl::SelfTimer timer (tl::verbosity () >= 21, tl::to_string (tr ("File read: ")) + m_stream.source ());
try {

View File

@ -379,7 +379,7 @@ DXFReader::open_layer (db::Layout &layout, const std::string &n)
void
DXFReader::do_read (db::Layout &layout, db::cell_index_type top)
{
tl::SelfTimer timer (tl::verbosity () >= 21, "File read");
tl::SelfTimer timer (tl::verbosity () >= 21, tl::to_string (tr ("File read: ")) + m_stream.source ());
// create the zero layer - this is not mapped to GDS but can be specified in the layer mapping as
// a layer named "0".

View File

@ -301,6 +301,12 @@ GDS2ReaderText::get_ushort ()
return x;
}
std::string
GDS2ReaderText::path () const
{
return sStream.source ();
}
void
GDS2ReaderText::error (const std::string &msg)
{

View File

@ -110,6 +110,7 @@ private:
tl::Extractor reader;
std::vector<GDS2XY> xyData;
virtual std::string path () const;
const char *get_string ();
void get_string (tl::string &s) const;
int get_int ();

View File

@ -256,6 +256,12 @@ GDS2Reader::progress_checkpoint ()
m_progress.set (m_stream.pos ());
}
std::string
GDS2Reader::path () const
{
return m_stream.source ();
}
void
GDS2Reader::error (const std::string &msg)
{

View File

@ -124,6 +124,7 @@ private:
virtual void error (const std::string &txt);
virtual void warn (const std::string &txt);
virtual std::string path () const;
virtual const char *get_string ();
virtual void get_string (tl::string &s) const;
virtual int get_int ();

View File

@ -233,7 +233,7 @@ eq_y (const GDS2XY &a, const GDS2XY &b)
void
GDS2ReaderBase::do_read (db::Layout &layout)
{
tl::SelfTimer timer (tl::verbosity () >= 21, "File read");
tl::SelfTimer timer (tl::verbosity () >= 21, tl::to_string (tr ("File read: ")) + path ());
m_cellname = "";
m_libname = "";

View File

@ -128,6 +128,7 @@ private:
virtual void error (const std::string &txt) = 0;
virtual void warn (const std::string &txt) = 0;
virtual std::string path () const = 0;
virtual const char *get_string () = 0;
virtual void get_string (tl::string &s) const = 0;
virtual int get_int () = 0;

View File

@ -303,7 +303,7 @@ MAGReader::do_read (db::Layout &layout, db::cell_index_type cell_index, tl::Text
void
MAGReader::do_read_part (db::Layout &layout, db::cell_index_type cell_index, tl::TextInputStream &stream)
{
tl::SelfTimer timer (tl::verbosity () >= 31, "File read");
tl::SelfTimer timer (tl::verbosity () >= 31, tl::to_string (tr ("File read: ")) + m_stream.source ());
if (tl::verbosity () >= 30) {
tl::log << "Reading layout file: " << stream.source ();

View File

@ -689,7 +689,7 @@ static const char magic_bytes[] = { "%SEMI-OASIS\015\012" };
void
OASISReader::do_read (db::Layout &layout)
{
tl::SelfTimer timer (tl::verbosity () >= 21, "File read");
tl::SelfTimer timer (tl::verbosity () >= 21, tl::to_string (tr ("File read: ")) + m_stream.source ());
unsigned char r;
char *mb;

View File

@ -95,8 +95,8 @@ circuit(INV2
rect(poly (-1425 -630) (1300 360))
rect(poly (-125 -2780) (250 1600))
rect(poly (-250 1200) (250 1600))
rect(poly_lbl (-526 -1801) (2 2))
rect(poly_cont (-831 -111) (220 220))
rect(poly_cont (-1355 -1910) (220 220))
)
net(2
rect(poly (275 -250) (250 2500))
@ -123,8 +123,8 @@ circuit(INV2
polygon(metal1 (-110 110) (0 360) (140 0) (0 1240) (-320 0) (0 800) (360 0) (0 -440) (320 0) (0 -1960))
rect(metal1 (-680 2400) (360 760))
rect(metal1 (-360 -3560) (360 760))
rect(metal1_lbl (-181 1419) (2 2))
rect(psd (-276 524) (525 950))
rect(psd (-455 1945) (525 950))
rect(nsd (-525 -3750) (525 950))
)
net(4
@ -221,18 +221,18 @@ circuit(RINGO
rect(via1 (-305 -305) (250 250))
rect(via1 (24230 -250) (250 250))
rect(metal2 (-24805 -325) (24880 400))
rect(metal2_lbl (-23161 -201) (2 2))
)
net(2 name(OSC)
rect(via1 (24435 1675) (250 250))
rect(metal2 (-325 -325) (400 400))
rect(metal2_lbl (-201 -201) (2 2))
)
net(3 name(VSS)
rect(metal2_lbl (-1 -1) (2 2))
)
net(4 name(VDD)
rect(metal2_lbl (-1 2799) (2 2))
)
net(5)
net(6)

View File

@ -76,8 +76,8 @@ X(INV2
R(poly (-1425 -630) (1300 360))
R(poly (-125 -2780) (250 1600))
R(poly (-250 1200) (250 1600))
R(poly_lbl (-526 -1801) (2 2))
R(poly_cont (-831 -111) (220 220))
R(poly_cont (-1355 -1910) (220 220))
)
N(2
R(poly (275 -250) (250 2500))
@ -104,8 +104,8 @@ X(INV2
Q(metal1 (-110 110) (0 360) (140 0) (0 1240) (-320 0) (0 800) (360 0) (0 -440) (320 0) (0 -1960))
R(metal1 (-680 2400) (360 760))
R(metal1 (-360 -3560) (360 760))
R(metal1_lbl (-181 1419) (2 2))
R(psd (-276 524) (525 950))
R(psd (-455 1945) (525 950))
R(nsd (-525 -3750) (525 950))
)
N(4
@ -202,18 +202,18 @@ X(RINGO
R(via1 (-305 -305) (250 250))
R(via1 (24230 -250) (250 250))
R(metal2 (-24805 -325) (24880 400))
R(metal2_lbl (-23161 -201) (2 2))
)
N(2 I(OSC)
R(via1 (24435 1675) (250 250))
R(metal2 (-325 -325) (400 400))
R(metal2_lbl (-201 -201) (2 2))
)
N(3 I(VSS)
R(metal2_lbl (-1 -1) (2 2))
)
N(4 I(VDD)
R(metal2_lbl (-1 2799) (2 2))
)
N(5)
N(6)

View File

@ -76,8 +76,8 @@ X(INV2
R(poly (-1425 -630) (1300 360))
R(poly (-125 -2780) (250 1600))
R(poly (-250 1200) (250 1600))
R(poly_lbl (-526 -1801) (2 2))
R(poly_cont (-831 -111) (220 220))
R(poly_cont (-1355 -1910) (220 220))
)
N(2
R(poly (275 -250) (250 2500))
@ -104,8 +104,8 @@ X(INV2
Q(metal1 (-110 110) (0 360) (140 0) (0 1240) (-320 0) (0 800) (360 0) (0 -440) (320 0) (0 -1960))
R(metal1 (-680 2400) (360 760))
R(metal1 (-360 -3560) (360 760))
R(metal1_lbl (-181 1419) (2 2))
R(psd (-276 524) (525 950))
R(psd (-455 1945) (525 950))
R(nsd (-525 -3750) (525 950))
)
N(4
@ -193,18 +193,18 @@ X(RINGO
R(via1 (-305 -305) (250 250))
R(via1 (24230 -250) (250 250))
R(metal2 (-24805 -325) (24880 400))
R(metal2_lbl (-23161 -201) (2 2))
)
N(2 I(OSC)
R(via1 (24435 1675) (250 250))
R(metal2 (-325 -325) (400 400))
R(metal2_lbl (-201 -201) (2 2))
)
N(3 I(VSS)
R(metal2_lbl (-1 -1) (2 2))
)
N(4 I(VDD)
R(metal2_lbl (-1 2799) (2 2))
)
N(5)
N(6)

View File

@ -26,10 +26,10 @@ layout(
connect(l4 l4 l8)
connect(l8 l4 l8 l9 l2 l6)
connect(l9 l8 l9 l10 l11)
connect(l10 l9 l10)
connect(l10 l9)
connect(l11 l9 l11 l12)
connect(l12 l11 l12 l13)
connect(l13 l12 l13)
connect(l13 l12)
connect(l7 l7)
connect(l2 l8 l2)
connect(l6 l8 l6)
@ -88,7 +88,7 @@ layout(
rect(l4 (-800 -3100) (550 400))
rect(l8 (-450 -300) (200 200))
rect(l9 (-300 -300) (400 400))
rect(l10 (-201 -201) (2 2))
)
net(2 name(VSS)
rect(l8 (550 300) (200 200))
@ -97,8 +97,8 @@ layout(
rect(l11 (-250 -950) (200 200))
rect(l11 (-200 300) (200 200))
rect(l12 (-750 -850) (2000 1000))
rect(l13 (-101 -851) (2 2))
rect(l6 (-1451 49) (450 900))
rect(l6 (-1550 -800) (450 900))
)
net(3 name(VDD)
rect(l8 (550 4350) (200 200))
@ -108,8 +108,8 @@ layout(
rect(l11 (-250 -800) (200 200))
rect(l11 (-200 300) (200 200))
rect(l12 (-750 -850) (2000 1000))
rect(l13 (-151 -851) (2 2))
rect(l2 (-1401 -851) (450 1500))
rect(l2 (-1550 -1700) (450 1500))
)
net(4 name(OUT)
rect(l8 (1300 4350) (200 200))
@ -121,8 +121,8 @@ layout(
rect(l9 (-300 -4600) (300 3200))
rect(l9 (-300 -2900) (450 400))
rect(l9 (-450 -1550) (300 850))
rect(l10 (-51 499) (2 2))
rect(l2 (-351 2649) (450 1500))
rect(l2 (-400 3150) (450 1500))
rect(l6 (-450 -5500) (450 900))
)
net(5 name(NWELL)

View File

@ -19,10 +19,10 @@ J(
C(l4 l4 l8)
C(l8 l4 l8 l11 l2 l9 l6 l10)
C(l11 l8 l11 l12 l13)
C(l12 l11 l12)
C(l12 l11)
C(l13 l11 l13 l14)
C(l14 l13 l14 l15)
C(l15 l14 l15)
C(l15 l14)
C(l7 l7)
C(l2 l8 l2)
C(l9 l3 l8 l9)
@ -69,7 +69,7 @@ J(
R(l4 (-800 -3100) (550 400))
R(l8 (-450 -300) (200 200))
R(l11 (-300 -300) (400 400))
R(l12 (-201 -201) (2 2))
)
N(2 I(VDD)
R(l3 (0 2950) (3000 3200))
@ -85,8 +85,8 @@ J(
R(l13 (1400 -700) (200 200))
R(l13 (-200 300) (200 200))
R(l14 (-2350 -850) (3000 1000))
R(l15 (-151 -851) (2 2))
R(l2 (-2401 -851) (450 1500))
R(l2 (-2550 -1700) (450 1500))
R(l9 (1050 -1200) (600 1200))
)
N(3 I(OUT)
@ -99,8 +99,8 @@ J(
R(l11 (-300 -4600) (300 3200))
R(l11 (-300 -2900) (450 400))
R(l11 (-450 -1550) (300 850))
R(l12 (-51 499) (2 2))
R(l2 (-351 2649) (450 1500))
R(l2 (-400 3150) (450 1500))
R(l6 (-450 -5500) (450 900))
)
N(4 I(VSS)
@ -115,8 +115,8 @@ J(
R(l13 (1400 -700) (200 200))
R(l13 (-200 300) (200 200))
R(l14 (-2350 -850) (3000 1000))
R(l15 (-151 -851) (2 2))
R(l6 (-2401 49) (450 900))
R(l6 (-2550 -800) (450 900))
R(l10 (1050 -900) (600 1200))
)
D(1 D$PMOS

View File

@ -28,10 +28,10 @@ layout(
connect(l4 l4 l8)
connect(l8 l4 l8 l11 l2 l9 l6 l10)
connect(l11 l8 l11 l12 l13)
connect(l12 l11 l12)
connect(l12 l11)
connect(l13 l11 l13 l14)
connect(l14 l13 l14 l15)
connect(l15 l14 l15)
connect(l15 l14)
connect(l7 l7)
connect(l2 l8 l2)
connect(l9 l3 l8 l9)
@ -121,7 +121,7 @@ layout(
rect(l4 (-250 300) (250 1050))
rect(l8 (-700 400) (200 200))
rect(l11 (-300 -300) (400 400))
rect(l12 (-201 -201) (2 2))
)
net(2 name(A)
rect(l4 (1900 3400) (550 400))
@ -131,7 +131,7 @@ layout(
rect(l4 (-250 300) (250 1050))
rect(l8 (250 1050) (200 200))
rect(l11 (-300 -300) (400 400))
rect(l12 (-201 -201) (2 2))
)
net(3
rect(l8 (1300 300) (200 200))
@ -167,8 +167,8 @@ layout(
rect(l11 (-1200 -300) (1050 300))
rect(l11 (-1050 1150) (300 1400))
rect(l11 (-300 -2700) (300 1950))
rect(l12 (699 -2001) (2 2))
rect(l2 (-1101 1299) (500 1500))
rect(l2 (-400 -700) (500 1500))
rect(l6 (250 -5500) (450 900))
rect(l6 (-450 450) (450 900))
)
@ -192,8 +192,8 @@ layout(
rect(l13 (700 -700) (200 200))
rect(l13 (-200 300) (200 200))
rect(l14 (-3150 -850) (3750 1000))
rect(l15 (-101 -851) (2 2))
rect(l2 (-3201 -851) (450 1500))
rect(l2 (-3300 -1700) (450 1500))
rect(l2 (1000 -1500) (450 1500))
rect(l9 (400 -1200) (600 1200))
)
@ -212,8 +212,8 @@ layout(
rect(l13 (2200 -700) (200 200))
rect(l13 (-200 300) (200 200))
rect(l14 (-3150 -850) (3750 1000))
rect(l15 (-101 -851) (2 2))
rect(l6 (-3201 1399) (450 900))
rect(l6 (-3300 550) (450 900))
rect(l6 (-450 -2250) (450 900))
rect(l10 (1850 -900) (600 1200))
)

View File

@ -28,10 +28,10 @@ layout(
connect(l4 l4 l8)
connect(l8 l4 l8 l11 l2 l9 l6 l10)
connect(l11 l8 l11 l12 l13)
connect(l12 l11 l12)
connect(l12 l11)
connect(l13 l11 l13 l14)
connect(l14 l13 l14 l15)
connect(l15 l14 l15)
connect(l15 l14)
connect(l7 l7)
connect(l2 l8 l2)
connect(l9 l3 l8 l9)
@ -121,7 +121,7 @@ layout(
rect(l4 (-250 300) (250 1050))
rect(l8 (-700 400) (200 200))
rect(l11 (-300 -300) (400 400))
rect(l12 (-201 -201) (2 2))
)
net(2 name(A)
rect(l4 (1900 3400) (550 400))
@ -131,7 +131,7 @@ layout(
rect(l4 (-250 300) (250 1050))
rect(l8 (250 1050) (200 200))
rect(l11 (-300 -300) (400 400))
rect(l12 (-201 -201) (2 2))
)
net(3
rect(l8 (1300 300) (200 200))
@ -167,8 +167,8 @@ layout(
rect(l11 (-1200 -300) (1050 300))
rect(l11 (-1050 1150) (300 1400))
rect(l11 (-300 -2700) (300 1950))
rect(l12 (699 -2001) (2 2))
rect(l2 (-1101 1299) (500 1500))
rect(l2 (-400 -700) (500 1500))
rect(l6 (250 -5500) (450 900))
rect(l6 (-450 450) (450 900))
)
@ -192,8 +192,8 @@ layout(
rect(l13 (700 -700) (200 200))
rect(l13 (-200 300) (200 200))
rect(l14 (-3150 -850) (3750 1000))
rect(l15 (-101 -851) (2 2))
rect(l2 (-3201 -851) (450 1500))
rect(l2 (-3300 -1700) (450 1500))
rect(l2 (1000 -1500) (450 1500))
rect(l9 (400 -1200) (600 1200))
)
@ -212,8 +212,8 @@ layout(
rect(l13 (2200 -700) (200 200))
rect(l13 (-200 300) (200 200))
rect(l14 (-3150 -850) (3750 1000))
rect(l15 (-101 -851) (2 2))
rect(l6 (-3201 1399) (450 900))
rect(l6 (-3300 550) (450 900))
rect(l6 (-450 -2250) (450 900))
rect(l10 (1850 -900) (600 1200))
)

View File

@ -28,7 +28,6 @@ layout(
connect(l11 l8 l11 l12)
connect(l12 l11 l12 l13)
connect(l13 l12 l13)
connect(l7 l7)
connect(l2 l8 l2)
connect(l9 l3 l8 l9)
connect(l6 l8 l6)
@ -47,7 +46,7 @@ layout(
circuit(ND2X1
# Circuit boundary
rect((-100 249) (2600 7751))
rect((-100 250) (2600 7750))
# Outgoing pins and their connections to nets
pin(name(VDD))
@ -62,7 +61,7 @@ layout(
circuit(INVX1
# Circuit boundary
rect((-100 249) (2000 7751))
rect((-100 250) (2000 7750))
# Outgoing pins and their connections to nets
pin(name(VDD))
@ -76,7 +75,7 @@ layout(
circuit(INVX2
# Circuit boundary
rect((-100 249) (2600 7751))
rect((-100 250) (2600 7750))
# Outgoing pins and their connections to nets
pin(name(IN))
@ -90,7 +89,7 @@ layout(
circuit(RINGO
# Circuit boundary
rect((600 249) (25800 7751))
rect((600 250) (25800 7750))
# Nets with their geometries
net(1