Netlist browser bugfix: show subcircuit nets in coordinate system of subcircuit

This commit is contained in:
Matthias Koefferlein 2019-05-01 21:42:10 +02:00
parent 60216ee3f6
commit 086ddeace7
2 changed files with 111 additions and 78 deletions

View File

@ -2206,6 +2206,8 @@ NetlistBrowserPage::adjust_view ()
continue; continue;
} }
db::ICplxTrans net_trans = trans_for_net (*net);
db::cell_index_type cell_index = (*net)->circuit ()->cell_index (); db::cell_index_type cell_index = (*net)->circuit ()->cell_index ();
size_t cluster_id = (*net)->cluster_id (); size_t cluster_id = (*net)->cluster_id ();
@ -2225,7 +2227,7 @@ NetlistBrowserPage::adjust_view ()
} }
for (std::vector<db::DCplxTrans>::const_iterator t = tv.begin (); t != tv.end (); ++t) { for (std::vector<db::DCplxTrans>::const_iterator t = tv.begin (); t != tv.end (); ++t) {
bbox += *t * db::CplxTrans (layout->dbu ()) * layer_bbox; bbox += *t * db::CplxTrans (layout->dbu ()) * net_trans * layer_bbox;
} }
} }
@ -2255,51 +2257,16 @@ NetlistBrowserPage::adjust_view ()
} }
} }
void bool
NetlistBrowserPage::update_highlights () NetlistBrowserPage::produce_highlights_for_net (const db::Net *net, size_t &n_markers, const std::map<db::LayerProperties, lay::LayerPropertiesConstIterator> &display_by_lp, const std::vector<db::DCplxTrans> &tv)
{ {
if (! m_enable_updates) { db::ICplxTrans net_trans = trans_for_net (net);
m_update_needed = true;
return;
}
clear_markers ();
if (! mp_database.get () || ! mp_view) {
return;
}
const db::Layout &original_layout = mp_view->cellview (m_cv_index)->layout ();
const db::Layout *layout = mp_database->internal_layout (); const db::Layout *layout = mp_database->internal_layout ();
if (! layout) {
return;
}
// a map of display properties vs. layer properties db::cell_index_type cell_index = net->circuit ()->cell_index ();
size_t cluster_id = net->cluster_id ();
std::map<db::LayerProperties, lay::LayerPropertiesConstIterator> display_by_lp; QColor net_color = m_colorizer.color_of_net (net);
for (lay::LayerPropertiesConstIterator lp = mp_view->begin_layers (); ! lp.at_end (); ++lp) {
if (! lp->has_children () && lp->cellview_index () == int (m_cv_index) && lp->layer_index () >= 0 && (unsigned int) lp->layer_index () < original_layout.layers ()) {
display_by_lp.insert (std::make_pair (original_layout.get_properties (lp->layer_index ()), lp));
}
}
// @@@std::map<unsigned int, std::vector<db::DCplxTrans> > tv_by_layer = mp_view->cv_transform_variants_by_layer (m_cv_index);
std::vector<db::DCplxTrans> tv = mp_view->cv_transform_variants (m_cv_index);
size_t n_markers = 0;
bool not_all_shapes_are_shown = false;
for (std::vector<const db::Net *>::const_iterator net = m_current_nets.begin (); net != m_current_nets.end (); ++net) {
if (! (*net)->circuit ()) {
continue;
}
db::cell_index_type cell_index = (*net)->circuit ()->cell_index ();
size_t cluster_id = (*net)->cluster_id ();
QColor net_color = m_colorizer.color_of_net (*net);
const db::Connectivity &conn = mp_database->connectivity (); const db::Connectivity &conn = mp_database->connectivity ();
for (db::Connectivity::layer_iterator layer = conn.begin_layers (); layer != conn.end_layers (); ++layer) { for (db::Connectivity::layer_iterator layer = conn.begin_layers (); layer != conn.end_layers (); ++layer) {
@ -2311,12 +2278,11 @@ NetlistBrowserPage::update_highlights ()
while (! shapes.at_end ()) { while (! shapes.at_end ()) {
if (n_markers == m_max_shape_count) { if (n_markers == m_max_shape_count) {
not_all_shapes_are_shown = true; return true;
break;
} }
mp_markers.push_back (new lay::Marker (mp_view, m_cv_index)); mp_markers.push_back (new lay::Marker (mp_view, m_cv_index));
mp_markers.back ()->set (*shapes, shapes.trans (), tv); mp_markers.back ()->set (*shapes, net_trans * shapes.trans (), tv);
if (net_color.isValid ()) { if (net_color.isValid ()) {
@ -2368,6 +2334,70 @@ NetlistBrowserPage::update_highlights ()
} }
return false;
}
db::ICplxTrans
NetlistBrowserPage::trans_for_net (const db::Net *net)
{
db::DCplxTrans t;
const db::Circuit *circuit = net->circuit ();
while (circuit) {
if (circuit->begin_refs () != circuit->end_refs ()) {
const db::SubCircuit &ref = *circuit->begin_refs ();
t = ref.trans () * t;
circuit = ref.circuit ();
} else {
break;
}
}
double dbu = mp_database->internal_layout ()->dbu ();
db::CplxTrans dbu_trans (dbu);
return dbu_trans.inverted () * t * dbu_trans;
}
void
NetlistBrowserPage::update_highlights ()
{
if (! m_enable_updates) {
m_update_needed = true;
return;
}
clear_markers ();
if (! mp_database.get () || ! mp_view) {
return;
}
const db::Layout &original_layout = mp_view->cellview (m_cv_index)->layout ();
const db::Layout *layout = mp_database->internal_layout ();
if (! layout) {
return;
}
// a map of display properties vs. layer properties
std::map<db::LayerProperties, lay::LayerPropertiesConstIterator> display_by_lp;
for (lay::LayerPropertiesConstIterator lp = mp_view->begin_layers (); ! lp.at_end (); ++lp) {
if (! lp->has_children () && lp->cellview_index () == int (m_cv_index) && lp->layer_index () >= 0 && (unsigned int) lp->layer_index () < original_layout.layers ()) {
display_by_lp.insert (std::make_pair (original_layout.get_properties (lp->layer_index ()), lp));
}
}
// @@@std::map<unsigned int, std::vector<db::DCplxTrans> > tv_by_layer = mp_view->cv_transform_variants_by_layer (m_cv_index);
std::vector<db::DCplxTrans> tv = mp_view->cv_transform_variants (m_cv_index);
size_t n_markers = 0;
bool not_all_shapes_are_shown = false;
for (std::vector<const db::Net *>::const_iterator net = m_current_nets.begin (); net != m_current_nets.end () && ! not_all_shapes_are_shown; ++net) {
if ((*net)->circuit ()) {
not_all_shapes_are_shown = produce_highlights_for_net (*net, n_markers, display_by_lp, tv);
}
} }
if (not_all_shapes_are_shown) { if (not_all_shapes_are_shown) {

View File

@ -43,6 +43,7 @@ class LayoutView;
class PluginRoot; class PluginRoot;
class Marker; class Marker;
class NetInfoDialog; class NetInfoDialog;
class LayerPropertiesConstIterator;
// ---------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------
// NetColorizer definition // NetColorizer definition
@ -349,6 +350,8 @@ private:
std::vector<const db::Net *> selected_nets (); std::vector<const db::Net *> selected_nets ();
void set_color_for_selected_nets (const QColor &color); void set_color_for_selected_nets (const QColor &color);
void layer_list_changed (int); void layer_list_changed (int);
bool produce_highlights_for_net(const db::Net *net, size_t &n_markers, const std::map<db::LayerProperties, lay::LayerPropertiesConstIterator> &display_by_lp, const std::vector<db::DCplxTrans> &tv);
db::ICplxTrans trans_for_net (const db::Net *net);
}; };
} // namespace lay } // namespace lay