mirror of https://github.com/KLayout/klayout.git
WIP: some refactoring.
This commit is contained in:
parent
eb71121c38
commit
824888aaa6
|
|
@ -195,7 +195,7 @@ LocalProcessorCellContexts::create (const key_type &intruders)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
LocalProcessorCellContexts::compute_results (db::Cell *cell, LocalProcessor *proc)
|
LocalProcessorCellContexts::compute_results (LocalProcessorContexts &contexts, db::Cell *cell, const LocalOperation *op, unsigned int output_layer, LocalProcessor *proc)
|
||||||
{
|
{
|
||||||
bool first = true;
|
bool first = true;
|
||||||
std::set<db::PolygonRef> common;
|
std::set<db::PolygonRef> common;
|
||||||
|
|
@ -213,13 +213,13 @@ LocalProcessorCellContexts::compute_results (db::Cell *cell, LocalProcessor *pro
|
||||||
if (first) {
|
if (first) {
|
||||||
|
|
||||||
common = c->second.propagated ();
|
common = c->second.propagated ();
|
||||||
proc->compute_local_cell (cell, c->first, common);
|
proc->compute_local_cell (contexts, cell, op, c->first, common);
|
||||||
first = false;
|
first = false;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
std::set<db::PolygonRef> res = c->second.propagated ();
|
std::set<db::PolygonRef> res = c->second.propagated ();
|
||||||
proc->compute_local_cell (cell, c->first, res);
|
proc->compute_local_cell (contexts, cell, op, c->first, res);
|
||||||
|
|
||||||
if (common.empty ()) {
|
if (common.empty ()) {
|
||||||
|
|
||||||
|
|
@ -252,7 +252,7 @@ LocalProcessorCellContexts::compute_results (db::Cell *cell, LocalProcessor *pro
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
proc->push_results (cell, common);
|
proc->push_results (cell, output_layer, common);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------------------
|
||||||
|
|
@ -476,36 +476,40 @@ private:
|
||||||
// ---------------------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------------------
|
||||||
// LocalProcessor implementation
|
// LocalProcessor implementation
|
||||||
|
|
||||||
LocalProcessor::LocalProcessor (db::Layout *layout, db::Cell *top, LocalOperation *op, unsigned int subject_layer, unsigned int intruder_layer, unsigned int output_layer)
|
LocalProcessor::LocalProcessor (db::Layout *layout, db::Cell *top)
|
||||||
: mp_layout (layout), mp_top (top), m_subject_layer (subject_layer), m_intruder_layer (intruder_layer), m_output_layer (output_layer), mp_op (op)
|
: mp_layout (layout), mp_top (top)
|
||||||
{
|
{
|
||||||
set_description (op->description ());
|
// .. nothing yet ..
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalProcessor::run ()
|
void LocalProcessor::run (LocalOperation *op, unsigned int subject_layer, unsigned int intruder_layer, unsigned int output_layer, db::Coord dist)
|
||||||
{
|
{
|
||||||
compute_contexts ();
|
LocalProcessorContexts contexts;
|
||||||
compute_results ();
|
compute_contexts (contexts, op, subject_layer, intruder_layer, dist);
|
||||||
|
compute_results (contexts, op, output_layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalProcessor::push_results (db::Cell *cell, const std::set<db::PolygonRef> &result)
|
void LocalProcessor::push_results (db::Cell *cell, unsigned int output_layer, const std::set<db::PolygonRef> &result) const
|
||||||
{
|
{
|
||||||
if (! result.empty ()) {
|
if (! result.empty ()) {
|
||||||
cell->shapes (m_output_layer).insert (result.begin (), result.end ());
|
cell->shapes (output_layer).insert (result.begin (), result.end ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalProcessor::compute_contexts ()
|
void LocalProcessor::compute_contexts (LocalProcessorContexts &contexts, const LocalOperation *op, unsigned int subject_layer, unsigned int intruder_layer, db::Coord dist)
|
||||||
{
|
{
|
||||||
tl::SelfTimer timer (tl::verbosity () >= 21, tl::to_string (tr ("Computing contexts for ")) + description ());
|
tl::SelfTimer timer (tl::verbosity () >= 21, tl::to_string (tr ("Computing contexts for ")) + description ());
|
||||||
|
|
||||||
m_contexts_per_cell.clear ();
|
contexts.clear ();
|
||||||
|
contexts.set_intruder_layer (intruder_layer);
|
||||||
|
contexts.set_subject_layer (subject_layer);
|
||||||
|
contexts.set_description (op->description ());
|
||||||
|
|
||||||
std::pair<std::set<db::CellInstArray>, std::set<db::PolygonRef> > intruders;
|
std::pair<std::set<db::CellInstArray>, std::set<db::PolygonRef> > intruders;
|
||||||
compute_contexts (0, 0, mp_top, db::ICplxTrans (), intruders);
|
compute_contexts (contexts, 0, 0, mp_top, db::ICplxTrans (), dist, intruders);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalProcessor::compute_contexts (db::LocalProcessorCellContext *parent_context, db::Cell *parent, db::Cell *cell, const db::ICplxTrans &cell_inst, const std::pair<std::set<CellInstArray>, std::set<PolygonRef> > &intruders)
|
void LocalProcessor::compute_contexts (LocalProcessorContexts &contexts, db::LocalProcessorCellContext *parent_context, db::Cell *parent, db::Cell *cell, const db::ICplxTrans &cell_inst, db::Coord dist, const std::pair<std::set<CellInstArray>, std::set<PolygonRef> > &intruders)
|
||||||
{
|
{
|
||||||
if (tl::verbosity () >= 30) {
|
if (tl::verbosity () >= 30) {
|
||||||
if (! parent) {
|
if (! parent) {
|
||||||
|
|
@ -515,22 +519,22 @@ void LocalProcessor::compute_contexts (db::LocalProcessorCellContext *parent_con
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
db::LocalProcessorCellContexts &contexts = m_contexts_per_cell [cell];
|
db::LocalProcessorCellContexts &cell_contexts = contexts.contexts_per_cell (cell);
|
||||||
|
|
||||||
db::LocalProcessorCellContext *context = contexts.find_context (intruders);
|
db::LocalProcessorCellContext *context = cell_contexts.find_context (intruders);
|
||||||
if (context) {
|
if (context) {
|
||||||
context->add (parent_context, parent, cell_inst);
|
context->add (parent_context, parent, cell_inst);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
context = contexts.create (intruders);
|
context = cell_contexts.create (intruders);
|
||||||
context->add (parent_context, parent, cell_inst);
|
context->add (parent_context, parent, cell_inst);
|
||||||
|
|
||||||
const db::Shapes &shapes_intruders = cell->shapes (m_intruder_layer);
|
const db::Shapes &shapes_intruders = cell->shapes (contexts.intruder_layer ());
|
||||||
|
|
||||||
db::box_convert <db::CellInstArray, true> inst_bcs (*mp_layout, m_subject_layer);
|
db::box_convert <db::CellInstArray, true> inst_bcs (*mp_layout, contexts.subject_layer ());
|
||||||
db::box_convert <db::CellInstArray, true> inst_bci (*mp_layout, m_intruder_layer);
|
db::box_convert <db::CellInstArray, true> inst_bci (*mp_layout, contexts.intruder_layer ());
|
||||||
db::box_convert <db::CellInst, true> inst_bcii (*mp_layout, m_intruder_layer);
|
db::box_convert <db::CellInst, true> inst_bcii (*mp_layout, contexts.intruder_layer ());
|
||||||
|
|
||||||
if (! cell->begin ().at_end ()) {
|
if (! cell->begin ().at_end ()) {
|
||||||
|
|
||||||
|
|
@ -545,7 +549,7 @@ void LocalProcessor::compute_contexts (db::LocalProcessorCellContext *parent_con
|
||||||
|
|
||||||
{
|
{
|
||||||
db::box_scanner2<db::CellInstArray, int, db::CellInstArray, int> scanner;
|
db::box_scanner2<db::CellInstArray, int, db::CellInstArray, int> scanner;
|
||||||
InteractionRegistrationInst2Inst rec (mp_layout, m_subject_layer, mp_layout, m_intruder_layer, &interactions);
|
InteractionRegistrationInst2Inst rec (mp_layout, contexts.subject_layer (), mp_layout, contexts.intruder_layer (), &interactions);
|
||||||
|
|
||||||
for (db::Cell::const_iterator i = cell->begin (); !i.at_end (); ++i) {
|
for (db::Cell::const_iterator i = cell->begin (); !i.at_end (); ++i) {
|
||||||
if (! inst_bcs (i->cell_inst ()).empty ()) {
|
if (! inst_bcs (i->cell_inst ()).empty ()) {
|
||||||
|
|
@ -567,7 +571,7 @@ void LocalProcessor::compute_contexts (db::LocalProcessorCellContext *parent_con
|
||||||
|
|
||||||
{
|
{
|
||||||
db::box_scanner2<db::CellInstArray, int, db::PolygonRef, int> scanner;
|
db::box_scanner2<db::CellInstArray, int, db::PolygonRef, int> scanner;
|
||||||
InteractionRegistrationInst2Shape rec (mp_layout, m_subject_layer, &interactions);
|
InteractionRegistrationInst2Shape rec (mp_layout, contexts.subject_layer (), &interactions);
|
||||||
|
|
||||||
for (db::Cell::const_iterator i = cell->begin (); !i.at_end (); ++i) {
|
for (db::Cell::const_iterator i = cell->begin (); !i.at_end (); ++i) {
|
||||||
if (! inst_bcs (i->cell_inst ()).empty ()) {
|
if (! inst_bcs (i->cell_inst ()).empty ()) {
|
||||||
|
|
@ -593,7 +597,7 @@ void LocalProcessor::compute_contexts (db::LocalProcessorCellContext *parent_con
|
||||||
|
|
||||||
db::ICplxTrans tn = i->first->complex_trans (*n);
|
db::ICplxTrans tn = i->first->complex_trans (*n);
|
||||||
db::ICplxTrans tni = tn.inverted ();
|
db::ICplxTrans tni = tn.inverted ();
|
||||||
db::Box nbox = tn * child_cell.bbox (m_subject_layer);
|
db::Box nbox = tn * child_cell.bbox (contexts.subject_layer ());
|
||||||
|
|
||||||
if (! nbox.empty ()) {
|
if (! nbox.empty ()) {
|
||||||
|
|
||||||
|
|
@ -615,7 +619,7 @@ void LocalProcessor::compute_contexts (db::LocalProcessorCellContext *parent_con
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compute_contexts (context, cell, &child_cell, tn, intruders_below);
|
compute_contexts (contexts, context, cell, &child_cell, tn, dist, intruders_below);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -627,7 +631,7 @@ void LocalProcessor::compute_contexts (db::LocalProcessorCellContext *parent_con
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
LocalProcessor::compute_results ()
|
LocalProcessor::compute_results (LocalProcessorContexts &contexts, const LocalOperation *op, unsigned int output_layer)
|
||||||
{
|
{
|
||||||
tl::SelfTimer timer (tl::verbosity () >= 21, tl::to_string (tr ("Computing results for ")) + description ());
|
tl::SelfTimer timer (tl::verbosity () >= 21, tl::to_string (tr ("Computing results for ")) + description ());
|
||||||
|
|
||||||
|
|
@ -637,27 +641,27 @@ LocalProcessor::compute_results ()
|
||||||
|
|
||||||
for (db::Layout::bottom_up_const_iterator bu = mp_layout->begin_bottom_up (); bu != mp_layout->end_bottom_up (); ++bu) {
|
for (db::Layout::bottom_up_const_iterator bu = mp_layout->begin_bottom_up (); bu != mp_layout->end_bottom_up (); ++bu) {
|
||||||
|
|
||||||
contexts_per_cell_type::iterator cpc = m_contexts_per_cell.find (&mp_layout->cell (*bu));
|
LocalProcessorContexts::iterator cpc = contexts.context_map ().find (&mp_layout->cell (*bu));
|
||||||
if (cpc != m_contexts_per_cell.end ()) {
|
if (cpc != contexts.context_map ().end ()) {
|
||||||
cpc->second.compute_results (cpc->first, this);
|
cpc->second.compute_results (contexts, cpc->first, op, output_layer, this);
|
||||||
m_contexts_per_cell.erase (cpc);
|
contexts.context_map ().erase (cpc);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
LocalProcessor::compute_local_cell (db::Cell *cell, const std::pair<std::set<CellInstArray>, std::set<db::PolygonRef> > &intruders, std::set<db::PolygonRef> &result) const
|
LocalProcessor::compute_local_cell (LocalProcessorContexts &contexts, db::Cell *cell, const db::LocalOperation *op, const std::pair<std::set<CellInstArray>, std::set<db::PolygonRef> > &intruders, std::set<db::PolygonRef> &result)
|
||||||
{
|
{
|
||||||
const db::Shapes &shapes_subject = cell->shapes (m_subject_layer);
|
const db::Shapes &shapes_subject = cell->shapes (contexts.subject_layer ());
|
||||||
const db::Shapes &shapes_intruders = cell->shapes (m_intruder_layer);
|
const db::Shapes &shapes_intruders = cell->shapes (contexts.intruder_layer ());
|
||||||
|
|
||||||
// local shapes vs. child cell
|
// local shapes vs. child cell
|
||||||
|
|
||||||
std::map<db::PolygonRef, std::vector<db::PolygonRef> > interactions;
|
std::map<db::PolygonRef, std::vector<db::PolygonRef> > interactions;
|
||||||
db::box_convert <db::CellInstArray, true> inst_bci (*mp_layout, m_intruder_layer);
|
db::box_convert <db::CellInstArray, true> inst_bci (*mp_layout, contexts.intruder_layer ());
|
||||||
|
|
||||||
if (mp_op->on_empty_intruder_hint () != LocalOperation::Drop) {
|
if (op->on_empty_intruder_hint () != LocalOperation::Drop) {
|
||||||
// insert dummy interactions to accommodate subject vs. nothing
|
// insert dummy interactions to accommodate subject vs. nothing
|
||||||
for (db::Shapes::shape_iterator i = shapes_subject.begin (polygon_ref_flags ()); !i.at_end (); ++i) {
|
for (db::Shapes::shape_iterator i = shapes_subject.begin (polygon_ref_flags ()); !i.at_end (); ++i) {
|
||||||
interactions.insert (std::make_pair (*i->basic_ptr (db::PolygonRef::tag ()), std::vector<db::PolygonRef> ()));
|
interactions.insert (std::make_pair (*i->basic_ptr (db::PolygonRef::tag ()), std::vector<db::PolygonRef> ()));
|
||||||
|
|
@ -687,7 +691,7 @@ LocalProcessor::compute_local_cell (db::Cell *cell, const std::pair<std::set<Cel
|
||||||
if (! shapes_subject.empty () && ! (cell->begin ().at_end () && intruders.first.empty ())) {
|
if (! shapes_subject.empty () && ! (cell->begin ().at_end () && intruders.first.empty ())) {
|
||||||
|
|
||||||
db::box_scanner2<db::PolygonRef, int, db::CellInstArray, int> scanner;
|
db::box_scanner2<db::PolygonRef, int, db::CellInstArray, int> scanner;
|
||||||
InteractionRegistrationShape2Inst rec (mp_layout, m_intruder_layer, &interactions);
|
InteractionRegistrationShape2Inst rec (mp_layout, contexts.intruder_layer (), &interactions);
|
||||||
|
|
||||||
for (db::Shapes::shape_iterator i = shapes_subject.begin (polygon_ref_flags ()); !i.at_end (); ++i) {
|
for (db::Shapes::shape_iterator i = shapes_subject.begin (polygon_ref_flags ()); !i.at_end (); ++i) {
|
||||||
scanner.insert1 (i->basic_ptr (db::PolygonRef::tag ()), 0);
|
scanner.insert1 (i->basic_ptr (db::PolygonRef::tag ()), 0);
|
||||||
|
|
@ -708,7 +712,7 @@ LocalProcessor::compute_local_cell (db::Cell *cell, const std::pair<std::set<Cel
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mp_op->compute_local (mp_layout, interactions, result);
|
op->compute_local (mp_layout, interactions, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ namespace db
|
||||||
|
|
||||||
class LocalProcessor;
|
class LocalProcessor;
|
||||||
class LocalProcessorCellContext;
|
class LocalProcessorCellContext;
|
||||||
|
class LocalProcessorContexts;
|
||||||
|
|
||||||
class DB_PLUGIN_PUBLIC LocalOperation
|
class DB_PLUGIN_PUBLIC LocalOperation
|
||||||
{
|
{
|
||||||
|
|
@ -118,7 +119,7 @@ public:
|
||||||
|
|
||||||
db::LocalProcessorCellContext *find_context (const key_type &intruders);
|
db::LocalProcessorCellContext *find_context (const key_type &intruders);
|
||||||
db::LocalProcessorCellContext *create (const key_type &intruders);
|
db::LocalProcessorCellContext *create (const key_type &intruders);
|
||||||
void compute_results (db::Cell *cell, LocalProcessor *proc);
|
void compute_results (LocalProcessorContexts &contexts, db::Cell *cell, const LocalOperation *op, unsigned int output_layer, LocalProcessor *proc);
|
||||||
|
|
||||||
iterator begin () const
|
iterator begin () const
|
||||||
{
|
{
|
||||||
|
|
@ -134,21 +135,87 @@ private:
|
||||||
std::map<key_type, db::LocalProcessorCellContext> m_contexts;
|
std::map<key_type, db::LocalProcessorCellContext> m_contexts;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DB_PLUGIN_PUBLIC LocalProcessor
|
class DB_PLUGIN_PUBLIC LocalProcessorContexts
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef std::map<db::Cell *, LocalProcessorCellContexts> contexts_per_cell_type;
|
typedef std::map<db::Cell *, LocalProcessorCellContexts> contexts_per_cell_type;
|
||||||
|
typedef contexts_per_cell_type::iterator iterator;
|
||||||
|
|
||||||
LocalProcessor (db::Layout *layout, db::Cell *top, LocalOperation *op, unsigned int subject_layer, unsigned int intruder_layer, unsigned int output_layer);
|
LocalProcessorContexts ()
|
||||||
void run ();
|
: m_subject_layer (0), m_intruder_layer (0)
|
||||||
void compute_contexts ();
|
{
|
||||||
void compute_results ();
|
// .. nothing yet ..
|
||||||
|
}
|
||||||
|
|
||||||
const contexts_per_cell_type &contexts_per_cell () const
|
void clear ()
|
||||||
|
{
|
||||||
|
m_contexts_per_cell.clear ();
|
||||||
|
}
|
||||||
|
|
||||||
|
LocalProcessorCellContexts &contexts_per_cell (db::Cell *cell)
|
||||||
|
{
|
||||||
|
return m_contexts_per_cell [cell];
|
||||||
|
}
|
||||||
|
|
||||||
|
contexts_per_cell_type &context_map ()
|
||||||
{
|
{
|
||||||
return m_contexts_per_cell;
|
return m_contexts_per_cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
iterator begin ()
|
||||||
|
{
|
||||||
|
return m_contexts_per_cell.begin ();
|
||||||
|
}
|
||||||
|
|
||||||
|
iterator end ()
|
||||||
|
{
|
||||||
|
return m_contexts_per_cell.end ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_subject_layer (unsigned int l)
|
||||||
|
{
|
||||||
|
m_subject_layer = l;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int subject_layer () const
|
||||||
|
{
|
||||||
|
return m_subject_layer;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_intruder_layer (unsigned int l)
|
||||||
|
{
|
||||||
|
m_intruder_layer = l;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int intruder_layer () const
|
||||||
|
{
|
||||||
|
return m_intruder_layer;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_description (const std::string &desc)
|
||||||
|
{
|
||||||
|
m_description = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string &description () const
|
||||||
|
{
|
||||||
|
return m_description;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
contexts_per_cell_type m_contexts_per_cell;
|
||||||
|
unsigned int m_subject_layer, m_intruder_layer;
|
||||||
|
std::string m_description;
|
||||||
|
};
|
||||||
|
|
||||||
|
class DB_PLUGIN_PUBLIC LocalProcessor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LocalProcessor (db::Layout *layout, db::Cell *top);
|
||||||
|
void run (LocalOperation *op, unsigned int subject_layer, unsigned int intruder_layer, unsigned int output_layer, db::Coord dist = 0);
|
||||||
|
void compute_contexts (LocalProcessorContexts &contexts, const LocalOperation *op, unsigned int subject_layer, unsigned int intruder_layer, db::Coord dist = 0);
|
||||||
|
void compute_results (LocalProcessorContexts &contexts, const LocalOperation *op, unsigned int output_layer);
|
||||||
|
|
||||||
void set_description (const std::string &d)
|
void set_description (const std::string &d)
|
||||||
{
|
{
|
||||||
m_description = d;
|
m_description = d;
|
||||||
|
|
@ -164,14 +231,11 @@ private:
|
||||||
|
|
||||||
db::Layout *mp_layout;
|
db::Layout *mp_layout;
|
||||||
db::Cell *mp_top;
|
db::Cell *mp_top;
|
||||||
unsigned int m_subject_layer, m_intruder_layer, m_output_layer;
|
|
||||||
contexts_per_cell_type m_contexts_per_cell;
|
|
||||||
LocalOperation *mp_op;
|
|
||||||
std::string m_description;
|
std::string m_description;
|
||||||
|
|
||||||
void compute_contexts (db::LocalProcessorCellContext *parent_context, db::Cell *parent, db::Cell *cell, const db::ICplxTrans &cell_inst, const std::pair<std::set<CellInstArray>, std::set<PolygonRef> > &intruders);
|
void compute_contexts (LocalProcessorContexts &contexts, db::LocalProcessorCellContext *parent_context, db::Cell *parent, db::Cell *cell, const db::ICplxTrans &cell_inst, db::Coord dist, const std::pair<std::set<CellInstArray>, std::set<PolygonRef> > &intruders);
|
||||||
void push_results (db::Cell *cell, const std::set<db::PolygonRef> &result);
|
void push_results (db::Cell *cell, unsigned int output_layer, const std::set<db::PolygonRef> &result) const;
|
||||||
void compute_local_cell (db::Cell *cell, const std::pair<std::set<CellInstArray>, std::set<db::PolygonRef> > &intruders, std::set<db::PolygonRef> &result) const;
|
void compute_local_cell (LocalProcessorContexts &contexts, db::Cell *cell, const LocalOperation *op, const std::pair<std::set<CellInstArray>, std::set<db::PolygonRef> > &intruders, std::set<db::PolygonRef> &result);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -153,8 +153,8 @@ NetExtractor::and_or_not (NetLayer a, NetLayer b, bool is_and)
|
||||||
unsigned int lout = mp_layout->insert_layer ();
|
unsigned int lout = mp_layout->insert_layer ();
|
||||||
|
|
||||||
db::BoolAndOrNotLocalOperation op (is_and);
|
db::BoolAndOrNotLocalOperation op (is_and);
|
||||||
db::LocalProcessor proc (mp_layout, mp_top_cell, &op, a.layer_index (), b.layer_index (), lout);
|
db::LocalProcessor proc (mp_layout, mp_top_cell);
|
||||||
proc.run ();
|
proc.run (&op, a.layer_index (), b.layer_index (), lout);
|
||||||
|
|
||||||
return NetLayer (lout);
|
return NetLayer (lout);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -57,13 +57,13 @@ void normalize_layer (db::Layout &layout, unsigned int layer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string contexts_to_s (db::Layout *layout, const db::LocalProcessor::contexts_per_cell_type &contexts)
|
std::string contexts_to_s (db::Layout *layout, db::LocalProcessorContexts &contexts)
|
||||||
{
|
{
|
||||||
std::string res;
|
std::string res;
|
||||||
|
|
||||||
for (db::Layout::top_down_const_iterator i = layout->begin_top_down (); i != layout->end_top_down(); ++i) {
|
for (db::Layout::top_down_const_iterator i = layout->begin_top_down (); i != layout->end_top_down(); ++i) {
|
||||||
db::LocalProcessor::contexts_per_cell_type::const_iterator cc = contexts.find (&layout->cell (*i));
|
db::LocalProcessorContexts::iterator cc = contexts.context_map ().find (&layout->cell (*i));
|
||||||
if (cc != contexts.end ()) {
|
if (cc != contexts.context_map ().end ()) {
|
||||||
int index = 1;
|
int index = 1;
|
||||||
for (db::LocalProcessorCellContexts::iterator j = cc->second.begin (); j != cc->second.end (); ++j) {
|
for (db::LocalProcessorCellContexts::iterator j = cc->second.begin (); j != cc->second.end (); ++j) {
|
||||||
res += tl::sprintf ("%s[%d] %d insts, %d shapes (%d times)\n", layout->cell_name (*i), index, int (j->first.first.size ()), int (j->first.second.size ()), int (j->second.size ()));
|
res += tl::sprintf ("%s[%d] %d insts, %d shapes (%d times)\n", layout->cell_name (*i), index, int (j->first.first.size ()), int (j->first.second.size ()), int (j->second.size ()));
|
||||||
|
|
@ -75,7 +75,7 @@ std::string contexts_to_s (db::Layout *layout, const db::LocalProcessor::context
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void run_test_bool (tl::TestBase *_this, const char *file, TestMode mode, int out_layer_num, std::string *context_doc = 0)
|
void run_test_bool (tl::TestBase *_this, const char *file, TestMode mode, int out_layer_num, db::Coord enl = 0, std::string *context_doc = 0)
|
||||||
{
|
{
|
||||||
db::Layout layout_org;
|
db::Layout layout_org;
|
||||||
|
|
||||||
|
|
@ -114,14 +114,15 @@ void run_test_bool (tl::TestBase *_this, const char *file, TestMode mode, int ou
|
||||||
normalize_layer (layout_org, l2);
|
normalize_layer (layout_org, l2);
|
||||||
|
|
||||||
db::BoolAndOrNotLocalOperation op (mode == TMAnd);
|
db::BoolAndOrNotLocalOperation op (mode == TMAnd);
|
||||||
db::LocalProcessor proc (&layout_org, &layout_org.cell (*layout_org.begin_top_down ()), &op, l1, l2, lout);
|
db::LocalProcessor proc (&layout_org, &layout_org.cell (*layout_org.begin_top_down ()));
|
||||||
|
|
||||||
if (! context_doc) {
|
if (! context_doc) {
|
||||||
proc.run ();
|
proc.run (&op, l1, l2, lout);
|
||||||
} else {
|
} else {
|
||||||
proc.compute_contexts ();
|
db::LocalProcessorContexts contexts;
|
||||||
*context_doc = contexts_to_s (&layout_org, proc.contexts_per_cell ());
|
proc.compute_contexts (contexts, &op, l1, l2, enl);
|
||||||
proc.compute_results ();
|
*context_doc = contexts_to_s (&layout_org, contexts);
|
||||||
|
proc.compute_results (contexts, &op, lout);
|
||||||
}
|
}
|
||||||
|
|
||||||
db::compare_layouts (_this, layout_org, testdata (file), lmap, false /*skip other layers*/, db::AsPolygons);
|
db::compare_layouts (_this, layout_org, testdata (file), lmap, false /*skip other layers*/, db::AsPolygons);
|
||||||
|
|
@ -227,7 +228,7 @@ TEST(BasicAnd9)
|
||||||
{
|
{
|
||||||
// Top-level ring structure, AND
|
// Top-level ring structure, AND
|
||||||
std::string doc;
|
std::string doc;
|
||||||
run_test_bool (_this, "hlp9.oas", TMAnd, 100, &doc);
|
run_test_bool (_this, "hlp9.oas", TMAnd, 100, 0, &doc);
|
||||||
EXPECT_EQ (doc,
|
EXPECT_EQ (doc,
|
||||||
// This means: the interaction test is strong enough, so it does not see interactions between the
|
// This means: the interaction test is strong enough, so it does not see interactions between the
|
||||||
// ring and the cells embedded inside the ring. So there is only one cell context. Some shapes
|
// ring and the cells embedded inside the ring. So there is only one cell context. Some shapes
|
||||||
|
|
@ -243,7 +244,7 @@ TEST(BasicNot9)
|
||||||
{
|
{
|
||||||
// Top-level ring structure, NOT
|
// Top-level ring structure, NOT
|
||||||
std::string doc;
|
std::string doc;
|
||||||
run_test_bool (_this, "hlp9.oas", TMNot, 101, &doc);
|
run_test_bool (_this, "hlp9.oas", TMNot, 101, 0, &doc);
|
||||||
EXPECT_EQ (doc,
|
EXPECT_EQ (doc,
|
||||||
// This means: the interaction test is strong enough, so it does not see interactions between the
|
// This means: the interaction test is strong enough, so it does not see interactions between the
|
||||||
// ring and the cells embedded inside the ring. So there is only one cell context. Some shapes
|
// ring and the cells embedded inside the ring. So there is only one cell context. Some shapes
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue