mirror of https://github.com/KLayout/klayout.git
WIP: timer enhanced (reports start now), drop empty boxes in hier processor (will make the processor stall).
This commit is contained in:
parent
611a98165d
commit
52a4459dac
|
|
@ -538,12 +538,18 @@ void LocalProcessor::compute_contexts (db::LocalProcessorCellContext *parent_con
|
|||
InteractionRegistrationInst2Inst rec (mp_layout, m_subject_layer, mp_layout, m_intruder_layer, &interactions);
|
||||
|
||||
for (db::Cell::const_iterator i = cell->begin (); !i.at_end (); ++i) {
|
||||
scanner.insert1 (&i->cell_inst (), 0);
|
||||
scanner.insert2 (&i->cell_inst (), 0);
|
||||
if (! inst_bcs (i->cell_inst ()).empty ()) {
|
||||
scanner.insert1 (&i->cell_inst (), 0);
|
||||
}
|
||||
if (! inst_bci (i->cell_inst ()).empty ()) {
|
||||
scanner.insert2 (&i->cell_inst (), 0);
|
||||
}
|
||||
}
|
||||
|
||||
for (std::set<db::CellInstArray>::const_iterator i = intruders.first.begin (); i != intruders.first.end (); ++i) {
|
||||
scanner.insert2 (i.operator-> (), 0);
|
||||
if (! inst_bci (*i).empty ()) {
|
||||
scanner.insert2 (i.operator-> (), 0);
|
||||
}
|
||||
}
|
||||
|
||||
scanner.process (rec, 0, inst_bcs, inst_bci);
|
||||
|
|
@ -554,7 +560,9 @@ void LocalProcessor::compute_contexts (db::LocalProcessorCellContext *parent_con
|
|||
InteractionRegistrationInst2Shape rec (mp_layout, m_subject_layer, &interactions);
|
||||
|
||||
for (db::Cell::const_iterator i = cell->begin (); !i.at_end (); ++i) {
|
||||
scanner.insert1 (&i->cell_inst (), 0);
|
||||
if (! inst_bcs (i->cell_inst ()).empty ()) {
|
||||
scanner.insert1 (&i->cell_inst (), 0);
|
||||
}
|
||||
}
|
||||
|
||||
for (std::set<db::PolygonRef>::const_iterator i = intruders.second.begin (); i != intruders.second.end (); ++i) {
|
||||
|
|
@ -676,10 +684,14 @@ LocalProcessor::compute_local_cell (db::Cell *cell, const std::pair<std::set<Cel
|
|||
}
|
||||
|
||||
for (db::Cell::const_iterator i = cell->begin (); !i.at_end (); ++i) {
|
||||
scanner.insert2 (&i->cell_inst (), 0);
|
||||
if (! inst_bci (i->cell_inst ()).empty ()) {
|
||||
scanner.insert2 (&i->cell_inst (), 0);
|
||||
}
|
||||
}
|
||||
for (std::set<db::CellInstArray>::const_iterator i = intruders.first.begin (); i != intruders.first.end (); ++i) {
|
||||
scanner.insert2 (i.operator-> (), 0);
|
||||
if (! inst_bci (*i).empty ()) {
|
||||
scanner.insert2 (i.operator-> (), 0);
|
||||
}
|
||||
}
|
||||
|
||||
scanner.process (rec, 0, db::box_convert<db::PolygonRef> (), inst_bci);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
|
||||
#include "dbNetExtractor.h"
|
||||
#include "dbHierProcessor.h"
|
||||
#include "dbLayoutUtils.h"
|
||||
#include "dbCellMapping.h"
|
||||
#include "dbPolygonTools.h"
|
||||
|
|
@ -34,7 +35,7 @@ namespace db
|
|||
{
|
||||
|
||||
NetExtractor::NetExtractor()
|
||||
: mp_orig_layout (0), mp_layout (0)
|
||||
: mp_orig_layout (0), mp_layout (0), mp_top_cell (0)
|
||||
{
|
||||
|
||||
// @@@
|
||||
|
|
@ -45,21 +46,30 @@ NetExtractor::~NetExtractor ()
|
|||
{
|
||||
delete mp_layout;
|
||||
mp_layout = 0;
|
||||
mp_top_cell = 0;
|
||||
}
|
||||
|
||||
void
|
||||
NetExtractor::open (const db::Layout &orig_layout, cell_index_type orig_top_cell)
|
||||
{
|
||||
tl::SelfTimer timer (tl::verbosity () >= 31, tl::to_string (tr ("Open layout")));
|
||||
|
||||
delete mp_layout;
|
||||
mp_orig_layout = &orig_layout;
|
||||
|
||||
mp_layout = new db::Layout ();
|
||||
mp_layout->dbu (orig_layout.dbu ());
|
||||
db::cell_index_type top = mp_layout->add_cell (orig_layout.cell_name (orig_top_cell));
|
||||
mp_top_cell = &mp_layout->cell (mp_layout->add_cell (orig_layout.cell_name (orig_top_cell)));
|
||||
|
||||
// copy hierarchy
|
||||
m_cm.clear ();
|
||||
m_cm.create_from_names_full (*mp_layout, top, orig_layout, orig_top_cell);
|
||||
m_cm.create_from_names_full (*mp_layout, mp_top_cell->cell_index (), orig_layout, orig_top_cell);
|
||||
}
|
||||
|
||||
void
|
||||
NetExtractor::output (NetLayer a, const LayerProperties &lp)
|
||||
{
|
||||
mp_layout->set_properties (a.layer_index (), lp);
|
||||
}
|
||||
|
||||
static double area_ratio (const db::Polygon &poly)
|
||||
|
|
@ -92,6 +102,8 @@ static void split_polygon_into (const db::Polygon &poly, db::Shapes &dest, size_
|
|||
NetLayer
|
||||
NetExtractor::load (unsigned int layer_index)
|
||||
{
|
||||
tl::SelfTimer timer (tl::verbosity () >= 31, tl::to_string (tr ("Loading layer ")) + mp_orig_layout->get_properties (layer_index).to_string ());
|
||||
|
||||
const double max_area_ratio = 3.0;
|
||||
const size_t max_points = 16;
|
||||
|
||||
|
|
@ -126,13 +138,25 @@ NetExtractor::load (unsigned int layer_index)
|
|||
NetLayer
|
||||
NetExtractor::bool_and (NetLayer a, NetLayer b)
|
||||
{
|
||||
return NetLayer (mp_layout->insert_layer ()); // @@@
|
||||
return and_or_not (a, b, true);
|
||||
}
|
||||
|
||||
NetLayer
|
||||
NetExtractor::bool_not (NetLayer a, NetLayer b)
|
||||
{
|
||||
return NetLayer (mp_layout->insert_layer ()); // @@@
|
||||
return and_or_not (a, b, false);
|
||||
}
|
||||
|
||||
NetLayer
|
||||
NetExtractor::and_or_not (NetLayer a, NetLayer b, bool is_and)
|
||||
{
|
||||
unsigned int lout = mp_layout->insert_layer ();
|
||||
|
||||
db::BoolAndOrNotLocalOperation op (is_and);
|
||||
db::LocalProcessor proc (mp_layout, mp_top_cell, &op, a.layer_index (), b.layer_index (), lout);
|
||||
proc.run ();
|
||||
|
||||
return NetLayer (lout);
|
||||
}
|
||||
|
||||
db::Layout *
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ public:
|
|||
NetLayer load (unsigned int layer_index);
|
||||
NetLayer bool_and (NetLayer a, NetLayer b);
|
||||
NetLayer bool_not (NetLayer a, NetLayer b);
|
||||
void output (NetLayer a, const db::LayerProperties &lp);
|
||||
db::Layout *layout_copy () const;
|
||||
|
||||
private:
|
||||
|
|
@ -78,9 +79,12 @@ private:
|
|||
NetExtractor (const db::NetExtractor &);
|
||||
NetExtractor &operator= (const db::NetExtractor &);
|
||||
|
||||
NetLayer and_or_not (NetLayer a, NetLayer b, bool is_and);
|
||||
|
||||
// @@@
|
||||
const db::Layout *mp_orig_layout; // @@@ should be a smart pointer
|
||||
db::Layout *mp_layout;
|
||||
db::Cell *mp_top_cell;
|
||||
db::CellMapping m_cm;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -41,6 +41,16 @@ void open2 (db::NetExtractor *ex, const db::Layout *orig_layout, const db::Cell
|
|||
ex->open (*orig_layout, cell->cell_index ());
|
||||
}
|
||||
|
||||
void output1 (db::NetExtractor *ex, const db::NetLayer &nl, const db::LayerProperties &lp)
|
||||
{
|
||||
ex->output (nl, lp);
|
||||
}
|
||||
|
||||
void output2 (db::NetExtractor *ex, const db::NetLayer &nl, int layer, int datatype, const std::string &name)
|
||||
{
|
||||
ex->output (nl, db::LayerProperties (layer, datatype, name));
|
||||
}
|
||||
|
||||
gsi::Class<db::NetExtractor> decl_NetNetExtractor ("db", "NetExtractor",
|
||||
gsi::method ("open", &db::NetExtractor::open, gsi::arg ("orig_layout"), gsi::arg ("orig_top_cell_index"),
|
||||
"@@@"
|
||||
|
|
@ -48,6 +58,12 @@ gsi::Class<db::NetExtractor> decl_NetNetExtractor ("db", "NetExtractor",
|
|||
gsi::method_ext ("open", &open2, gsi::arg ("orig_layout"), gsi::arg ("orig_top_cell"),
|
||||
"@@@"
|
||||
) +
|
||||
gsi::method_ext ("output", &output1, gsi::arg ("net_layer"), gsi::arg ("layer"),
|
||||
"@@@"
|
||||
) +
|
||||
gsi::method_ext ("output", &output2, gsi::arg ("net_layer"), gsi::arg ("layer"), gsi::arg ("datatype"), gsi::arg ("name", std::string ()),
|
||||
"@@@"
|
||||
) +
|
||||
gsi::method ("load", &db::NetExtractor::load, gsi::arg ("layer_index"),
|
||||
"@@@"
|
||||
) +
|
||||
|
|
|
|||
|
|
@ -186,6 +186,12 @@ Timer::take ()
|
|||
m_wall_ms = wall_ms;
|
||||
}
|
||||
|
||||
void
|
||||
SelfTimer::start_report () const
|
||||
{
|
||||
tl::info << m_desc << ": " << tl::to_string (tr ("started"));
|
||||
}
|
||||
|
||||
void
|
||||
SelfTimer::report () const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -118,6 +118,7 @@ public:
|
|||
{
|
||||
m_enabled = true;
|
||||
start ();
|
||||
start_report ();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -131,6 +132,7 @@ public:
|
|||
m_enabled = enabled;
|
||||
if (enabled) {
|
||||
start ();
|
||||
start_report ();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -144,6 +146,7 @@ public:
|
|||
|
||||
private:
|
||||
void report () const;
|
||||
void start_report () const;
|
||||
|
||||
std::string m_desc;
|
||||
bool m_enabled;
|
||||
|
|
|
|||
Loading…
Reference in New Issue