Netlist browser: detailed info box.

This commit is contained in:
Matthias Koefferlein 2019-04-30 00:18:11 +02:00
parent e661bac0a7
commit 4e15b3df92
8 changed files with 1015 additions and 238 deletions

View File

@ -0,0 +1,180 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>NetInfoDialog</class>
<widget class="QDialog" name="NetInfoDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>490</width>
<height>394</height>
</rect>
</property>
<property name="windowTitle">
<string>Net Info</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QFrame" name="frame_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QFrame" name="frame_4">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="_2">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'DejaVu Sans'; font-size:12pt; font-weight:600; font-style:normal; text-decoration:none;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;Net Info&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="detailed_cb">
<property name="text">
<string>Detailed</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="net_info_text">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="lineWrapMode">
<enum>QTextEdit::NoWrap</enum>
</property>
<property name="lineWrapColumnOrWidth">
<number>0</number>
</property>
<property name="cursorWidth">
<number>1</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>NetInfoDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>439</x>
<y>373</y>
</hint>
<hint type="destinationlabel">
<x>398</x>
<y>389</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -49,7 +49,7 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
<number>5</number>
</property>
<property name="leftMargin">
<number>0</number>
@ -72,6 +72,9 @@
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>2</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
@ -112,6 +115,23 @@
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="info_button">
<property name="toolTip">
<string>Show more information about nets</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../lay/lay/layResources.qrc">
<normaloff>:/info_16.png</normaloff>:/info_16.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
@ -164,25 +184,32 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>6</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="probe_button">
<property name="text">
<string>Probe</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>6</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QTreeView" name="directory_tree">
<property name="sizePolicy">
@ -241,23 +268,6 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QToolButton" name="info_button">
<property name="toolTip">
<string>Show more information about nets</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../lay/lay/layResources.qrc">
<normaloff>:/info_16.png</normaloff>:/info_16.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="info_label">
<property name="text">
@ -268,42 +278,6 @@
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>

View File

@ -0,0 +1,492 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2019 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 "layNetInfoDialog.h"
#include "tlXMLWriter.h"
#include "ui_NetInfoDialog.h"
#include <sstream>
namespace lay
{
NetInfoDialog::NetInfoDialog (QWidget *parent)
: QDialog (parent), m_needs_update (false)
{
ui = new Ui::NetInfoDialog ();
ui->setupUi (this);
connect (ui->detailed_cb, SIGNAL (stateChanged (int)), this, SLOT (detailed_checkbox_clicked ()));
}
NetInfoDialog::~NetInfoDialog ()
{
delete ui;
ui = 0;
}
void NetInfoDialog::needs_update ()
{
if (! isVisible ()) {
m_needs_update = true;
} else {
update_info_text ();
m_needs_update = false;
}
}
void NetInfoDialog::set_nets (const db::LayoutToNetlist *l2ndb, const std::vector<const db::Net *> &nets)
{
mp_l2ndb = const_cast<db::LayoutToNetlist *> (l2ndb);
mp_nets.clear ();
for (std::vector<const db::Net *>::const_iterator n = nets.begin (); n != nets.end (); ++n) {
mp_nets.push_back (const_cast<db::Net *> (*n));
}
needs_update ();
}
void NetInfoDialog::detailed_checkbox_clicked ()
{
needs_update ();
}
void NetInfoDialog::showEvent (QShowEvent * /*event*/)
{
if (isVisible () && m_needs_update) {
needs_update ();
}
}
size_t count_shapes (db::LayoutToNetlist *l2ndb, db::Net *net, unsigned int layer)
{
if (! net || ! net->circuit ()) {
return 0;
}
db::cell_index_type cell_index = net->circuit ()->cell_index ();
size_t cluster_id = net->cluster_id ();
size_t n = 0;
for (db::recursive_cluster_shape_iterator<db::PolygonRef> shapes (l2ndb->net_clusters (), layer, cell_index, cluster_id); ! shapes.at_end (); ++shapes) {
++n;
}
return n;
}
size_t count_shapes (db::LayoutToNetlist *l2ndb, db::Net *net)
{
size_t n = 0;
const db::Connectivity &conn = l2ndb->connectivity ();
for (db::Connectivity::layer_iterator layer = conn.begin_layers (); layer != conn.end_layers (); ++layer) {
n += count_shapes (l2ndb, net, *layer);
}
return n;
}
static std::string layer_string (const db::LayoutToNetlist *l2ndb, unsigned int layer)
{
const db::Layout *ly = l2ndb->internal_layout ();
db::LayerProperties lp = ly->get_properties (layer);
std::string l = l2ndb->name (layer);
if (! lp.is_null ()) {
if (! l.empty ()) {
l += " ";
}
l += lp.to_string ();
}
if (l.empty ()) {
return "<anonymous>";
} else {
return l;
}
}
void NetInfoDialog::update_info_text ()
{
bool detailed = ui->detailed_cb->isChecked ();
std::ostringstream info_stream;
info_stream.imbue (std::locale ("C"));
tl::XMLWriter info (info_stream);
info.start_document ("");
info.start_element ("html");
info.start_element ("body");
if (! mp_l2ndb.get () || mp_nets.empty () || ! mp_l2ndb->internal_layout ()) {
info.start_element ("p");
info.cdata (tl::to_string (QObject::tr ("No net selected")));
info.end_element ("p");
} else {
info.start_element ("table");
info.write_attribute ("cellspacing", "6");
info.start_element ("tr");
info.start_element ("th");
info.cdata (tl::to_string (tr ("Net")));
info.end_element ("th");
info.start_element ("th");
info.cdata (tl::to_string (tr ("Shapes")));
info.end_element ("th");
info.start_element ("th");
info.cdata (tl::to_string (tr ("Device terminals")));
info.end_element ("th");
info.start_element ("th");
info.cdata (tl::to_string (tr ("Subcircuit pins")));
info.end_element ("th");
info.start_element ("th");
info.cdata (tl::to_string (tr ("Circuit pins")));
info.end_element ("th");
info.end_element ("tr");
size_t shapes = 0, terminals = 0, pins = 0, subcircuit_pins = 0;
for (tl::weak_collection<db::Net>::iterator net = mp_nets.begin (); net != mp_nets.end (); ++net) {
info.start_element ("tr");
info.start_element ("td");
info.cdata (net->expanded_name ());
info.end_element ("td");
size_t n;
info.start_element ("td");
n = count_shapes (mp_l2ndb.get (), net.operator-> ());
shapes += n;
info.cdata (tl::to_string (n));
info.end_element ("td");
info.start_element ("td");
n = net->terminal_count ();
terminals += n;
info.cdata (tl::to_string (n));
info.end_element ("td");
info.start_element ("td");
n = net->subcircuit_pin_count ();
subcircuit_pins += n;
info.cdata (tl::to_string (n));
info.end_element ("td");
info.start_element ("td");
n = net->pin_count ();
pins += n;
info.cdata (tl::to_string (n));
info.end_element ("td");
info.end_element ("tr");
}
if (mp_nets.size () > 1) {
info.start_element ("tr");
info.start_element ("td");
info.cdata (tl::to_string (tr ("(total)")));
info.end_element ("td");
info.start_element ("td");
info.cdata (tl::to_string (shapes));
info.end_element ("td");
info.start_element ("td");
info.cdata (tl::to_string (terminals));
info.end_element ("td");
info.start_element ("td");
info.cdata (tl::to_string (subcircuit_pins));
info.end_element ("td");
info.start_element ("td");
info.cdata (tl::to_string (pins));
info.end_element ("td");
info.end_element ("tr");
}
info.end_element ("table");
if (mp_nets.size () == 1 && detailed) {
const db::Net *net = mp_nets.front ();
const db::Layout *ly = mp_l2ndb->internal_layout ();
db::cell_index_type cell_index = net->circuit ()->cell_index ();
size_t cluster_id = net->cluster_id ();
double dbu_unidir = ly->dbu ();
db::CplxTrans dbu (ly->dbu ());
db::VCplxTrans dbuinv = dbu.inverted ();
size_t max_shapes = 2000;
info.start_element ("hr");
info.end_element ("hr");
info.start_element ("h3");
info.cdata (tl::to_string (QObject::tr ("Details:")));
info.end_element ("h3");
info.start_element ("p");
info.start_element ("b");
info.cdata (tl::to_string (QObject::tr ("Net name: ")));
info.end_element ("b");
info.cdata (net->expanded_name ());
info.start_element ("br");
info.end_element ("br");
info.start_element ("b");
info.cdata (tl::to_string (QObject::tr ("Circuit: ")));
info.end_element ("b");
info.cdata (net->circuit () ? net->circuit ()->name () : "(null)");
info.end_element ("p");
std::map<std::string, std::set<std::string> > shapes;
// map as (layernumber, group of shapes by layer):
std::map<unsigned int, std::vector<db::Polygon> > shapes_by_layer;
std::map<unsigned int, std::string> layer_names;
std::map<unsigned int, db::coord_traits<db::Coord>::area_type> statinfo_area;
std::map<unsigned int, db::coord_traits<db::Coord>::perimeter_type> statinfo_perimeter;
size_t tot_shapes = 0;
bool incomplete = false;
const db::Connectivity &conn = mp_l2ndb->connectivity ();
for (db::Connectivity::layer_iterator layer = conn.begin_layers (); layer != conn.end_layers (); ++layer) {
std::string l = layer_string (mp_l2ndb.get (), *layer);
for (db::recursive_cluster_shape_iterator<db::PolygonRef> si (mp_l2ndb->net_clusters (), *layer, cell_index, cluster_id); ! si.at_end (); ++si) {
if (tot_shapes++ >= max_shapes) {
incomplete = true;
break;
}
// Check if layer is already detected, otherwise create vector-of-Shape object to hold shapes
// plus initialize the perimeter and area sums
std::map<unsigned int, std::vector<db::Polygon> >::iterator s = shapes_by_layer.find (*layer);
if (s == shapes_by_layer.end ()) {
s = shapes_by_layer.insert (std::make_pair (*layer, std::vector<db::Polygon> ())).first;
layer_names.insert (std::make_pair (*layer, l));
statinfo_perimeter.insert (std::make_pair (*layer, db::coord_traits<db::Coord>::perimeter_type (0)));
statinfo_area.insert (std::make_pair (*layer, db::coord_traits<db::Coord>::area_type (0)));
}
s->second.push_back (si->instantiate ());
std::string c (ly->cell_name (si.cell_index ()));
c += " (with ";
c += (dbu * db::CplxTrans (si.trans ()) * dbuinv).to_string ();
c += ")";
std::string t;
if (s->second.back ().is_box ()) {
t = tl::to_string (QObject::tr ("box on ")) + l + ": " + (dbu * s->second.back ().box ()).to_string ();
} else {
t = tl::to_string (QObject::tr ("polygon on ")) + l + ": " + (dbu * s->second.back ()).to_string ();
}
shapes.insert (std::make_pair (c, std::set<std::string> ())).first->second.insert (t);
}
}
// Try to merge all shaped to polygons, use Map of (layernumber, group of polygons by layer)
std::map<unsigned int, std::vector<db::Polygon> > polygons_by_layer;
for (std::map<unsigned int, std::vector<db::Polygon> >::iterator i = shapes_by_layer.begin(); i != shapes_by_layer.end (); ++i) {
unsigned int l = i->first;
db::EdgeProcessor ep;
std::vector <db::Polygon> &merged = polygons_by_layer.insert (std::make_pair (l, std::vector <db::Polygon> ())).first->second;
ep.merge(i->second, merged, 0, true, true);
db::coord_traits<db::Coord>::area_type area = 0;
db::coord_traits<db::Coord>::perimeter_type perimeter = 0;
// Despite merging, a multitude of seperate non-touching polygons can exist.
for (std::vector <db::Polygon>::iterator j = merged.begin (); j != merged.end (); ++j) {
// Sum area
area += j->area ();
// Sum perimeter for the merged polygon
perimeter += j->perimeter ();
}
statinfo_area [l] += area;
statinfo_perimeter [l] += perimeter;
}
if (! shapes.empty ()) {
if (! incomplete) {
info.start_element ("h3");
info.cdata (tl::to_string (QObject::tr ("Geometry:")));
info.end_element ("h3");
db::coord_traits<db::Coord>::area_type total_area = 0;
db::coord_traits<db::Coord>::perimeter_type total_perimeter = 0;
size_t nshapes = 0;
// Print perimeter and area and sum up total
info.start_element ("table");
info.write_attribute ("cellspacing", "6");
info.start_element ("tr");
info.start_element ("td");
info.start_element ("b");
info.cdata (tl::to_string (QObject::tr ("Layer")));
info.end_element ("b");
info.end_element ("td");
info.start_element ("td");
info.start_element ("b");
info.cdata (tl::to_string (QObject::tr ("Shapes")));
info.end_element ("b");
info.end_element ("td");
info.start_element ("td");
info.start_element ("b");
info.cdata (tl::to_string (QObject::tr ("Perimeter")));
info.start_element ("br");
info.end_element ("br");
info.cdata (tl::to_string (QObject::tr ("(micron)")));
info.end_element ("b");
info.end_element ("td");
info.start_element ("td");
info.start_element ("b");
info.cdata (tl::to_string (QObject::tr ("Area")));
info.start_element ("br");
info.end_element ("br");
info.cdata (tl::to_string (QObject::tr ("(square micron)")));
info.end_element ("b");
info.end_element ("td");
info.end_element ("tr");
for (std::map<unsigned int, db::coord_traits<db::Coord>::area_type>::iterator i = statinfo_area.begin (); i != statinfo_area.end(); ++i) {
unsigned int l = i->first;
size_t n;
double v;
info.start_element ("tr");
info.start_element ("td");
info.cdata (layer_names [l]);
info.end_element ("td");
info.start_element ("td");
n = shapes_by_layer [l].size ();
nshapes += n;
info.cdata (tl::to_string (n));
info.end_element ("td");
info.start_element ("td");
v = statinfo_perimeter [l];
total_perimeter += v;
info.cdata (tl::micron_to_string (v * dbu_unidir));
info.end_element ("td");
info.start_element ("td");
v = statinfo_area[l];
total_area += v;
info.cdata (tl::to_string (v * dbu_unidir * dbu_unidir));
info.end_element ("td");
info.end_element ("tr");
}
// Only if more than one layer is involved, print summed values
if (statinfo_area.size () != 1) {
info.start_element ("tr");
info.start_element ("td");
info.cdata (tl::to_string (QObject::tr ("(total)")));
info.end_element ("td");
info.start_element ("td");
info.cdata (tl::to_string (nshapes));
info.end_element ("td");
info.start_element ("td");
info.cdata (tl::micron_to_string (total_perimeter * dbu_unidir));
info.end_element ("td");
info.start_element ("td");
info.cdata (tl::to_string (total_area * dbu_unidir * dbu_unidir));
info.end_element ("td");
info.end_element ("tr");
}
info.end_element ("table");
}
info.start_element ("h3");
info.cdata (tl::to_string (QObject::tr ("Shapes:")));
info.end_element ("h3");
for (std::map<std::string, std::set<std::string> >::const_iterator s = shapes.begin (); s != shapes.end (); ++s) {
info.start_element ("p");
info.start_element ("b");
info.cdata (tl::to_string (QObject::tr ("Cell ")));
info.cdata (s->first);
info.cdata (":");
info.end_element ("b");
for (std::set <std::string>::const_iterator l = s->second.begin (); l != s->second.end (); ++l) {
info.start_element ("br");
info.end_element ("br");
info.cdata (*l);
}
info.end_element ("p");
}
if (incomplete) {
info.start_element ("p");
info.cdata ("...");
info.end_element ("p");
}
}
}
}
info.end_element ("body");
info.end_element ("html");
ui->net_info_text->setHtml (tl::to_qstring (info_stream.str ()));
}
}

View File

@ -0,0 +1,75 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2019 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_layNetInfoDialog
#define HDR_layNetInfoDialog
#include "ui_NetInfoDialog.h"
#include "dbLayoutToNetlist.h"
#include "tlObjectCollection.h"
#include <QDialog>
namespace Ui
{
class NetInfoDialog;
}
namespace lay
{
/**
* @brief A dialog showing the details of a net
*/
class NetInfoDialog
: public QDialog
{
Q_OBJECT
public:
NetInfoDialog (QWidget *parent);
~NetInfoDialog ();
void set_nets (const db::LayoutToNetlist *l2ndb, const std::vector<const db::Net *> &nets);
private slots:
void detailed_checkbox_clicked ();
protected:
void showEvent (QShowEvent *);
private:
tl::weak_ptr<db::LayoutToNetlist> mp_l2ndb;
tl::weak_collection<db::Net> mp_nets;
bool m_needs_update;
Ui::NetInfoDialog *ui;
void update_info_text ();
void needs_update ();
};
}
#endif

View File

@ -26,6 +26,7 @@
#include "layCellView.h"
#include "layLayoutView.h"
#include "layMarker.h"
#include "layNetInfoDialog.h"
#include "dbLayoutToNetlist.h"
#include "dbNetlistDeviceClasses.h"
@ -1671,7 +1672,8 @@ NetlistBrowserPage::NetlistBrowserPage (QWidget * /*parent*/)
m_history_ptr (0),
m_signals_enabled (true),
m_enable_updates (true),
m_update_needed (true)
m_update_needed (true),
mp_info_dialog (0)
{
Ui::NetlistBrowserPage::setupUi (this);
@ -1826,9 +1828,11 @@ NetlistBrowserPage::selected_nets ()
QModelIndexList selection = directory_tree->selectionModel ()->selectedIndexes ();
for (QModelIndexList::const_iterator i = selection.begin (); i != selection.end (); ++i) {
const db::Net *net = model->net_from_index (*i);
if (net) {
nets.push_back (net);
if (i->column () == 0) {
const db::Net *net = model->net_from_index (*i);
if (net) {
nets.push_back (net);
}
}
}
@ -1838,7 +1842,11 @@ NetlistBrowserPage::selected_nets ()
void
NetlistBrowserPage::net_selection_changed ()
{
highlight_nets (selected_nets ());
std::vector<const db::Net *> nets = selected_nets ();
if (mp_info_dialog) {
mp_info_dialog->set_nets (mp_database.get (), nets);
}
highlight_nets (nets);
}
void
@ -1944,7 +1952,12 @@ NetlistBrowserPage::navigate_forward ()
void
NetlistBrowserPage::info_button_pressed ()
{
// @@@
if (! mp_info_dialog) {
mp_info_dialog = new lay::NetInfoDialog (this);
}
mp_info_dialog->set_nets (mp_database.get (), selected_nets ());
mp_info_dialog->show ();
}
static QModelIndex find_next (QAbstractItemModel *model, const QRegExp &to_find, const QModelIndex &from)
@ -2067,6 +2080,11 @@ NetlistBrowserPage::show_all (bool f)
void
NetlistBrowserPage::set_l2ndb (db::LayoutToNetlist *database)
{
if (mp_info_dialog) {
delete mp_info_dialog;
mp_info_dialog = 0;
}
mp_database.reset (database);
clear_markers ();
highlight_nets (std::vector<const db::Net *> ());
@ -2209,8 +2227,6 @@ NetlistBrowserPage::update_highlights ()
}
clear_markers ();
info_label->setText (QString ());
if (! mp_database.get () || ! mp_view) {
return;
}
@ -2321,6 +2337,9 @@ NetlistBrowserPage::update_highlights ()
info_label->setText (tl::to_qstring ("<html><p style=\"color:red; font-weight: bold\">" +
tl::to_string (QObject::tr ("Not all shapes are highlighted")) +
"</p></html>"));
info_label->show ();
} else {
info_label->hide ();
}
}

View File

@ -42,6 +42,7 @@ namespace lay
class LayoutView;
class PluginRoot;
class Marker;
class NetInfoDialog;
// ----------------------------------------------------------------------------------
// NetColorizer definition
@ -333,6 +334,7 @@ private:
bool m_enable_updates;
bool m_update_needed;
std::vector<const db::Net *> m_current_nets;
lay::NetInfoDialog *mp_info_dialog;
void add_to_history (void *id, bool fwd);
void navigate_to (void *id, bool forward = true);

View File

@ -69,7 +69,8 @@ FORMS = \
NetlistBrowserPage.ui \
NetlistBrowserConfigPage.ui \
NetlistBrowserConfigPage2.ui \
NetlistBrowserDialog.ui
NetlistBrowserDialog.ui \
NetInfoDialog.ui
RESOURCES = \
laybasicResources.qrc
@ -167,7 +168,8 @@ SOURCES = \
layNetlistBrowser.cc \
layNetlistBrowserDialog.cc \
layNetlistBrowserPage.cc \
layItemDelegates.cc
layItemDelegates.cc \
layNetInfoDialog.cc
HEADERS = \
gtf.h \
@ -257,7 +259,8 @@ HEADERS = \
layNetlistBrowser.h \
layNetlistBrowserDialog.h \
layNetlistBrowserPage.h \
layItemDelegates.h
layItemDelegates.h \
layNetInfoDialog.h
INCLUDEPATH += $$TL_INC $$GSI_INC $$DB_INC $$RDB_INC
DEPENDPATH += $$TL_INC $$GSI_INC $$DB_INC $$RDB_INC

View File

@ -1,7 +1,8 @@
<ui version="4.0" >
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>NetTracerDialog</class>
<widget class="QDialog" name="NetTracerDialog" >
<property name="geometry" >
<widget class="QDialog" name="NetTracerDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
@ -9,50 +10,55 @@
<height>504</height>
</rect>
</property>
<property name="windowTitle" >
<property name="windowTitle">
<string>Net Trace</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<layout class="QGridLayout">
<property name="leftMargin">
<number>9</number>
</property>
<property name="spacing" >
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="1" column="0" colspan="4" >
<widget class="QLabel" name="label_2" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>1</vsizetype>
<item row="1" column="0" colspan="4">
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Choose "Trace Net" and click at one point in the net to trace the net and add it to the list.
<property name="text">
<string>Choose &quot;Trace Net&quot; and click at one point in the net to trace the net and add it to the list.
Double-click the net entry to rename it.
Select one or multiple nets and choose "Export" to export the selected nets to a new layout or cell.</string>
Select one or multiple nets and choose &quot;Export&quot; to export the selected nets to a new layout or cell.</string>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap" >
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0" colspan="4" >
<widget class="QLabel" name="label_3" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>1</vsizetype>
<item row="0" column="0" colspan="4">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font" >
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>75</weight>
@ -60,130 +66,142 @@ Select one or multiple nets and choose "Export" to export the selected nets to a
<bold>true</bold>
</font>
</property>
<property name="text" >
<property name="text">
<string>Net Tracer</string>
</property>
</widget>
</item>
<item rowspan="2" row="3" column="0" colspan="4" >
<widget class="Line" name="line" >
<property name="orientation" >
<item row="3" column="0" rowspan="2" colspan="4">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item rowspan="2" row="5" column="0" >
<widget class="QPushButton" name="configure_pb" >
<property name="text" >
<item row="5" column="0" rowspan="2">
<widget class="QPushButton" name="configure_pb">
<property name="text">
<string>Configure</string>
</property>
<property name="autoDefault" >
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item rowspan="2" row="5" column="1" >
<widget class="QPushButton" name="stack_pb" >
<property name="text" >
<item row="5" column="1" rowspan="2">
<widget class="QPushButton" name="stack_pb">
<property name="text">
<string>Layer Stack</string>
</property>
<property name="autoDefault" >
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3" >
<widget class="QSplitter" name="splitter" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>5</vsizetype>
<item row="2" column="0" colspan="3">
<widget class="QSplitter" name="splitter">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QListWidget" name="net_list" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<widget class="QListWidget" name="net_list">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="selectionMode" >
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
<property name="uniformItemSizes" >
<property name="uniformItemSizes">
<bool>true</bool>
</property>
</widget>
<widget class="QFrame" name="frame_2" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>5</vsizetype>
<widget class="QFrame" name="frame_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape" >
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item>
<widget class="QFrame" name="frame_4" >
<property name="frameShape" >
<widget class="QFrame" name="frame_4">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow" >
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_4" >
<property name="font" >
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
<property name="text">
<string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'DejaVu Sans'; font-size:12pt; font-weight:600; font-style:normal; text-decoration:none;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-size:10pt;">Net Info&lt;/span>&lt;/p>&lt;/body>&lt;/html></string>
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'DejaVu Sans'; font-size:12pt; font-weight:600; font-style:normal; text-decoration:none;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;Net Info&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
@ -192,21 +210,21 @@ p, li { white-space: pre-wrap; }
</spacer>
</item>
<item>
<widget class="QCheckBox" name="detailed_cb" >
<property name="text" >
<widget class="QCheckBox" name="detailed_cb">
<property name="text">
<string>Detailed</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
@ -215,15 +233,15 @@ p, li { white-space: pre-wrap; }
</spacer>
</item>
<item>
<widget class="QLabel" name="label" >
<property name="text" >
<widget class="QLabel" name="label">
<property name="text">
<string>Color</string>
</property>
</widget>
</item>
<item>
<widget class="lay::ColorButton" name="net_color" >
<property name="text" >
<widget class="lay::ColorButton" name="net_color">
<property name="text">
<string>Color</string>
</property>
</widget>
@ -232,59 +250,68 @@ p, li { white-space: pre-wrap; }
</widget>
</item>
<item>
<widget class="QTextBrowser" name="net_info_text" >
<property name="autoFillBackground" >
<widget class="QTextBrowser" name="net_info_text">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="frameShape" >
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="lineWrapMode" >
<property name="lineWrapMode">
<enum>QTextEdit::NoWrap</enum>
</property>
<property name="lineWrapColumnOrWidth" >
<property name="lineWrapColumnOrWidth">
<number>0</number>
</property>
<property name="cursorWidth" >
<property name="cursorWidth">
<number>1</number>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_3" >
<property name="frameShape" >
<widget class="QFrame" name="frame_3">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow" >
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="export_pb" >
<property name="text" >
<widget class="QPushButton" name="export_pb">
<property name="text">
<string>Export</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="export_text_pb" >
<property name="text" >
<widget class="QPushButton" name="export_text_pb">
<property name="text">
<string>Export To Text</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
@ -299,59 +326,68 @@ p, li { white-space: pre-wrap; }
</widget>
</widget>
</item>
<item row="2" column="3" >
<widget class="QFrame" name="frame" >
<property name="minimumSize" >
<item row="2" column="3">
<widget class="QFrame" name="frame">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="frameShape" >
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow" >
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="add_pb" >
<property name="text" >
<widget class="QPushButton" name="add_pb">
<property name="text">
<string>Trace Net</string>
</property>
<property name="checkable" >
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked" >
<property name="checked">
<bool>false</bool>
</property>
<property name="default" >
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="sticky_cbx" >
<property name="text" >
<widget class="QCheckBox" name="sticky_cbx">
<property name="text">
<string>Lock</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
@ -360,21 +396,21 @@ p, li { white-space: pre-wrap; }
</spacer>
</item>
<item>
<widget class="QPushButton" name="add2_pb" >
<property name="text" >
<widget class="QPushButton" name="add2_pb">
<property name="text">
<string>Trace Path</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
@ -383,25 +419,25 @@ p, li { white-space: pre-wrap; }
</spacer>
</item>
<item>
<widget class="QPushButton" name="del_pb" >
<property name="text" >
<widget class="QPushButton" name="del_pb">
<property name="text">
<string>Delete</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="clear_all_pb" >
<property name="text" >
<widget class="QPushButton" name="clear_all_pb">
<property name="text">
<string>Clear All</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>11</width>
<height>261</height>
@ -410,8 +446,8 @@ p, li { white-space: pre-wrap; }
</spacer>
</item>
<item>
<widget class="QPushButton" name="redo_pb" >
<property name="text" >
<widget class="QPushButton" name="redo_pb">
<property name="text">
<string>Redo</string>
</property>
</widget>
@ -419,24 +455,22 @@ p, li { white-space: pre-wrap; }
</layout>
</widget>
</item>
<item rowspan="2" row="5" column="2" >
<widget class="QLabel" name="tech_info_label" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>5</vsizetype>
<item row="5" column="2" rowspan="2">
<widget class="QLabel" name="tech_info_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<property name="text">
<string/>
</property>
</widget>
</item>
<item rowspan="2" row="5" column="3" >
<widget class="QPushButton" name="close_pb" >
<property name="text" >
<item row="5" column="3" rowspan="2">
<widget class="QPushButton" name="close_pb">
<property name="text">
<string>Close</string>
</property>
</widget>
@ -466,9 +500,7 @@ p, li { white-space: pre-wrap; }
<tabstop>stack_pb</tabstop>
<tabstop>close_pb</tabstop>
</tabstops>
<resources>
<include location="layResources.qrc" />
</resources>
<resources/>
<connections>
<connection>
<sender>close_pb</sender>
@ -476,11 +508,11 @@ p, li { white-space: pre-wrap; }
<receiver>NetTracerDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<hint type="sourcelabel">
<x>512</x>
<y>458</y>
</hint>
<hint type="destinationlabel" >
<hint type="destinationlabel">
<x>422</x>
<y>472</y>
</hint>