WIP: netlist browser

This commit is contained in:
Matthias Koefferlein 2019-05-04 19:24:17 +02:00
parent bc26e32a68
commit 7e9e0dd5e6
7 changed files with 123 additions and 65 deletions

View File

@ -159,6 +159,13 @@ brightness of the color used.</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="brightness_cb">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="brightness_sb">
<property name="minimum">
@ -173,7 +180,7 @@ brightness of the color used.</string>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="brightness_label">
<property name="text">
<string>% intensity increase</string>
</property>
@ -524,5 +531,38 @@ brightness of the color used.</string>
</customwidget>
</customwidgets>
<resources/>
<connections/>
<connections>
<connection>
<sender>brightness_cb</sender>
<signal>clicked(bool)</signal>
<receiver>brightness_sb</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>114</x>
<y>246</y>
</hint>
<hint type="destinationlabel">
<x>140</x>
<y>248</y>
</hint>
</hints>
</connection>
<connection>
<sender>brightness_cb</sender>
<signal>clicked(bool)</signal>
<receiver>brightness_label</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>119</x>
<y>251</y>
</hint>
<hint type="destinationlabel">
<x>272</x>
<y>258</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -33,13 +33,13 @@
namespace lay
{
extern std::string cfg_l2ndb_net_cell_prefix;
extern std::string cfg_l2ndb_net_propname;
extern std::string cfg_l2ndb_circuit_cell_prefix;
extern std::string cfg_l2ndb_produce_circuit_cells;
extern std::string cfg_l2ndb_device_cell_prefix;
extern std::string cfg_l2ndb_produce_device_cells;
extern std::string cfg_l2ndb_start_layer_number;
extern std::string cfg_l2ndb_export_net_cell_prefix;
extern std::string cfg_l2ndb_export_net_propname;
extern std::string cfg_l2ndb_export_circuit_cell_prefix;
extern std::string cfg_l2ndb_export_produce_circuit_cells;
extern std::string cfg_l2ndb_export_device_cell_prefix;
extern std::string cfg_l2ndb_export_produce_device_cells;
extern std::string cfg_l2ndb_export_start_layer_number;
NetExportDialog::NetExportDialog (QWidget *parent)
@ -168,43 +168,43 @@ int
NetExportDialog::exec (lay::PluginRoot *plugin_root)
{
std::string v;
plugin_root->config_get (cfg_l2ndb_net_cell_prefix, v);
plugin_root->config_get (cfg_l2ndb_export_net_cell_prefix, v);
set_net_prefix (v);
tl::Variant var;
plugin_root->config_get (cfg_l2ndb_net_propname, var);
plugin_root->config_get (cfg_l2ndb_export_net_propname, var);
set_net_propname (var);
bool f = false;
plugin_root->config_get (cfg_l2ndb_produce_circuit_cells, f);
plugin_root->config_get (cfg_l2ndb_export_produce_circuit_cells, f);
set_produce_circuit_cells (f);
v.clear ();
plugin_root->config_get (cfg_l2ndb_circuit_cell_prefix, v);
plugin_root->config_get (cfg_l2ndb_export_circuit_cell_prefix, v);
set_circuit_cell_prefix (v);
f = false;
plugin_root->config_get (cfg_l2ndb_produce_device_cells, f);
plugin_root->config_get (cfg_l2ndb_export_produce_device_cells, f);
set_produce_device_cells (f);
v.clear ();
plugin_root->config_get (cfg_l2ndb_device_cell_prefix, v);
plugin_root->config_get (cfg_l2ndb_export_device_cell_prefix, v);
set_device_cell_prefix (v);
int ln = 0;
plugin_root->config_get (cfg_l2ndb_start_layer_number, ln);
plugin_root->config_get (cfg_l2ndb_export_start_layer_number, ln);
set_start_layer_number (ln);
int ret = QDialog::exec ();
if (ret) {
plugin_root->config_set (cfg_l2ndb_net_cell_prefix, net_prefix ());
plugin_root->config_set (cfg_l2ndb_net_propname, net_propname ());
plugin_root->config_set (cfg_l2ndb_start_layer_number, tl::to_string (start_layer_number ()));
plugin_root->config_set (cfg_l2ndb_produce_circuit_cells, tl::to_string (produce_circuit_cells ()));
plugin_root->config_set (cfg_l2ndb_circuit_cell_prefix, circuit_cell_prefix ());
plugin_root->config_set (cfg_l2ndb_produce_device_cells, tl::to_string (produce_device_cells ()));
plugin_root->config_set (cfg_l2ndb_device_cell_prefix, device_cell_prefix ());
plugin_root->config_set (cfg_l2ndb_export_net_cell_prefix, net_prefix ());
plugin_root->config_set (cfg_l2ndb_export_net_propname, net_propname ());
plugin_root->config_set (cfg_l2ndb_export_start_layer_number, tl::to_string (start_layer_number ()));
plugin_root->config_set (cfg_l2ndb_export_produce_circuit_cells, tl::to_string (produce_circuit_cells ()));
plugin_root->config_set (cfg_l2ndb_export_circuit_cell_prefix, circuit_cell_prefix ());
plugin_root->config_set (cfg_l2ndb_export_produce_device_cells, tl::to_string (produce_device_cells ()));
plugin_root->config_set (cfg_l2ndb_export_device_cell_prefix, device_cell_prefix ());
}

View File

@ -45,18 +45,19 @@ extern const std::string cfg_l2ndb_marker_line_width ("l2ndb-marker-line-width")
extern const std::string cfg_l2ndb_marker_vertex_size ("l2ndb-marker-vertex-size");
extern const std::string cfg_l2ndb_marker_halo ("l2ndb-marker-halo");
extern const std::string cfg_l2ndb_marker_intensity ("l2ndb-marker-intensity");
extern const std::string cfg_l2ndb_marker_use_original_colors ("l2ndb-marker-use-original-colors");
extern const std::string cfg_l2ndb_window_mode ("l2ndb-window-mode");
extern const std::string cfg_l2ndb_window_dim ("l2ndb-window-dim");
extern const std::string cfg_l2ndb_max_shapes_highlighted ("l2ndb-max-shapes-highlighted");
extern const std::string cfg_l2ndb_show_all ("l2ndb-show-all");
extern const std::string cfg_l2ndb_window_state ("l2ndb-window-state");
extern const std::string cfg_l2ndb_net_cell_prefix ("l2ndb-net-cell-prefix");
extern const std::string cfg_l2ndb_net_propname ("l2ndb-net-propname");
extern const std::string cfg_l2ndb_start_layer_number ("l2ndb-start-layer-number");
extern const std::string cfg_l2ndb_circuit_cell_prefix ("l2ndb-circuit-cell-prefix");
extern const std::string cfg_l2ndb_produce_circuit_cells ("l2ndb-produce-circuit-cells");
extern const std::string cfg_l2ndb_device_cell_prefix ("l2ndb-device-cell-prefix");
extern const std::string cfg_l2ndb_produce_device_cells ("l2ndb-produce-device-cells");
extern const std::string cfg_l2ndb_export_net_cell_prefix ("l2ndb-export-net-cell-prefix");
extern const std::string cfg_l2ndb_export_net_propname ("l2ndb-export-net-propname");
extern const std::string cfg_l2ndb_export_start_layer_number ("l2ndb-export-start-layer-number");
extern const std::string cfg_l2ndb_export_circuit_cell_prefix ("l2ndb-export-circuit-cell-prefix");
extern const std::string cfg_l2ndb_export_produce_circuit_cells ("l2ndb-export-produce-circuit-cells");
extern const std::string cfg_l2ndb_export_device_cell_prefix ("l2ndb-export-device-cell-prefix");
extern const std::string cfg_l2ndb_export_produce_device_cells ("l2ndb-export-produce-device-cells");
// ------------------------------------------------------------
@ -218,6 +219,13 @@ NetlistBrowserConfigPage2::setup (lay::PluginRoot *root)
root->config_get (cfg_l2ndb_marker_color, color, lay::ColorConverter ());
color_pb->set_color (color);
// use original color
bool original_colors = false;
root->config_get (cfg_l2ndb_marker_use_original_colors, original_colors);
brightness_cb->setChecked (original_colors);
brightness_sb->setEnabled (original_colors);
brightness_label->setEnabled (original_colors);
// brightness offset
int brightness = 0;
root->config_get (cfg_l2ndb_marker_intensity, brightness);
@ -318,6 +326,8 @@ NetlistBrowserConfigPage2::commit (lay::PluginRoot *root)
}
root->config_set (cfg_l2ndb_marker_intensity, brightness_sb->value ());
root->config_set (cfg_l2ndb_marker_use_original_colors, brightness_cb->isChecked ());
}
// ------------------------------------------------------------
@ -338,17 +348,18 @@ public:
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_marker_line_width, "-1"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_marker_vertex_size, "-1"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_marker_halo, "-1"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_marker_use_original_colors, "false"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_marker_dither_pattern, "-1"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_marker_intensity, "50"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_show_all, "true"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_window_state, ""));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_net_propname, ""));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_net_cell_prefix, "NET_"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_start_layer_number, "1000"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_produce_circuit_cells, "false"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_circuit_cell_prefix, "CIRCUIT_"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_produce_device_cells, "false"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_device_cell_prefix, "DEVICE_"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_export_net_propname, ""));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_export_net_cell_prefix, "NET_"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_export_start_layer_number, "1000"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_export_produce_circuit_cells, "false"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_export_circuit_cell_prefix, "CIRCUIT_"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_export_produce_device_cells, "false"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_export_device_cell_prefix, "DEVICE_"));
}
virtual std::vector<std::pair <std::string, lay::ConfigPage *> > config_pages (QWidget *parent) const

View File

@ -49,6 +49,7 @@ extern const std::string cfg_l2ndb_marker_line_width;
extern const std::string cfg_l2ndb_marker_vertex_size;
extern const std::string cfg_l2ndb_marker_halo;
extern const std::string cfg_l2ndb_marker_intensity;
extern const std::string cfg_l2ndb_marker_use_original_colors;
extern const std::string cfg_l2ndb_window_mode;
extern const std::string cfg_l2ndb_window_dim;
extern const std::string cfg_l2ndb_max_shapes_highlighted;
@ -68,6 +69,7 @@ NetlistBrowserDialog::NetlistBrowserDialog (lay::PluginRoot *root, lay::LayoutVi
m_marker_halo (-1),
m_marker_dither_pattern (-1),
m_marker_intensity (0),
m_use_original_colors (false),
m_cv_index (-1),
m_l2n_index (-1),
m_mouse_state (0)
@ -557,6 +559,13 @@ NetlistBrowserDialog::configure (const std::string &name, const std::string &val
need_update = lay::test_and_set (m_marker_intensity, bo);
} else if (name == cfg_l2ndb_marker_use_original_colors) {
bool oc = false;
tl::from_string (value, oc);
need_update = lay::test_and_set (m_use_original_colors, oc);
} else {
taken = false;
}
@ -564,7 +573,7 @@ NetlistBrowserDialog::configure (const std::string &name, const std::string &val
if (active () && need_update) {
browser_frame->set_max_shape_count (m_max_shape_count);
browser_frame->set_window (m_window, m_window_dim);
browser_frame->set_highlight_style (m_marker_color, m_marker_line_width, m_marker_vertex_size, m_marker_halo, m_marker_dither_pattern, m_marker_intensity, m_auto_color_enabled ? &m_auto_colors : 0);
browser_frame->set_highlight_style (m_marker_color, m_marker_line_width, m_marker_vertex_size, m_marker_halo, m_marker_dither_pattern, m_marker_intensity, m_use_original_colors, m_auto_color_enabled ? &m_auto_colors : 0);
}
browser_frame->show_all (show_all);
@ -713,7 +722,7 @@ NetlistBrowserDialog::update_content ()
browser_frame->enable_updates (false); // Avoid building the internal lists several times ...
browser_frame->set_l2ndb (l2ndb);
browser_frame->set_max_shape_count (m_max_shape_count);
browser_frame->set_highlight_style (m_marker_color, m_marker_line_width, m_marker_vertex_size, m_marker_halo, m_marker_dither_pattern, m_marker_intensity, m_auto_color_enabled ? &m_auto_colors : 0);
browser_frame->set_highlight_style (m_marker_color, m_marker_line_width, m_marker_vertex_size, m_marker_halo, m_marker_dither_pattern, m_marker_intensity, m_use_original_colors, m_auto_color_enabled ? &m_auto_colors : 0);
browser_frame->set_window (m_window, m_window_dim);
browser_frame->set_view (view (), m_cv_index);
browser_frame->enable_updates (true);
@ -739,6 +748,12 @@ NetlistBrowserDialog::update_content ()
}
}
void
NetlistBrowserDialog::hideEvent (QHideEvent *)
{
deactivated ();
}
void
NetlistBrowserDialog::deactivated ()
{

View File

@ -60,6 +60,9 @@ private:
// implementation of the lay::Plugin interface
virtual void menu_activated (const std::string &symbol);
// QWidget
virtual void hideEvent (QHideEvent *);
void cellviews_changed ();
void cellview_changed (int index);
void l2ndbs_changed ();
@ -89,6 +92,7 @@ private:
int m_marker_halo;
int m_marker_dither_pattern;
int m_marker_intensity;
bool m_use_original_colors;
std::string m_layout_name;
int m_cv_index;
std::string m_l2ndb_name;

View File

@ -773,12 +773,12 @@ NetlistBrowserModel::text (const QModelIndex &index) const
const db::Net *net = net_from_id (id);
if (net) {
if (index.column () == 0) {
return tl::to_qstring ("(" + tl::to_string (net->pin_count () + net->terminal_count () + net->subcircuit_pin_count ()) + ")");
} else {
return tl::to_qstring (net->expanded_name ());
} else {
return tl::to_qstring (net->expanded_name () + " (" + tl::to_string (net->pin_count () + net->terminal_count () + net->subcircuit_pin_count ()) + ")");
}
}
// TODO: in case of compare, column 1 is (size), 2 is net name(a) and 3 is net name(b)
// TODO: in case of compare, column 1 is name(a):name(b), 2 is name(a)(size(a)) and 3 is name(b)(size(b))
} else if (is_id_circuit_net_pin (id)) {
@ -1741,6 +1741,7 @@ NetlistBrowserPage::NetlistBrowserPage (QWidget * /*parent*/)
m_marker_halo (-1),
m_marker_dither_pattern (-1),
m_marker_intensity (0),
m_use_original_colors (false),
mp_view (0),
m_cv_index (0),
mp_plugin_root (0),
@ -1752,7 +1753,7 @@ NetlistBrowserPage::NetlistBrowserPage (QWidget * /*parent*/)
{
Ui::NetlistBrowserPage::setupUi (this);
// @@@ insert into menu
// TODO: insert into menu
m_show_all_action = new QAction (QObject::tr ("Show All"), this);
m_show_all_action->setCheckable (true);
m_show_all_action->setChecked (m_show_all);
@ -1825,7 +1826,7 @@ NetlistBrowserPage::set_plugin_root (lay::PluginRoot *pr)
}
void
NetlistBrowserPage::set_highlight_style (QColor color, int line_width, int vertex_size, int halo, int dither_pattern, int marker_intensity, const lay::ColorPalette *auto_colors)
NetlistBrowserPage::set_highlight_style (QColor color, int line_width, int vertex_size, int halo, int dither_pattern, int marker_intensity, bool use_original_colors, const lay::ColorPalette *auto_colors)
{
m_colorizer.configure (color, auto_colors);
m_marker_line_width = line_width;
@ -1833,6 +1834,7 @@ NetlistBrowserPage::set_highlight_style (QColor color, int line_width, int verte
m_marker_halo = halo;
m_marker_dither_pattern = dither_pattern;
m_marker_intensity = marker_intensity;
m_use_original_colors = use_original_colors;
update_highlights ();
}
@ -2170,13 +2172,6 @@ NetlistBrowserPage::show_all (bool f)
m_show_all = f;
m_show_all_action->setChecked (f);
#if 0 // @@@
MarkerBrowserTreeViewModel *tree_model = dynamic_cast<MarkerBrowserTreeViewModel *> (directory_tree->model ());
if (tree_model) {
set_hidden_rec (tree_model, directory_tree, QModelIndex (), m_show_all, cat_filter->text (), cell_filter->text ());
}
#endif
}
}
@ -2236,7 +2231,6 @@ NetlistBrowserPage::enable_updates (bool f)
if (f && m_update_needed) {
update_highlights ();
// @@@ update_info_text ();
}
m_update_needed = false;
@ -2278,14 +2272,11 @@ NetlistBrowserPage::adjust_view ()
db::cell_index_type cell_index = (*net)->circuit ()->cell_index ();
size_t cluster_id = (*net)->cluster_id ();
// @@@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);
const db::Connectivity &conn = mp_database->connectivity ();
for (db::Connectivity::layer_iterator layer = conn.begin_layers (); layer != conn.end_layers (); ++layer) {
// @@@ TODO: how to get the original layer?
db::Box layer_bbox;
db::recursive_cluster_shape_iterator<db::PolygonRef> shapes (mp_database->net_clusters (), *layer, cell_index, cluster_id);
while (! shapes.at_end ()) {
@ -2334,6 +2325,10 @@ NetlistBrowserPage::produce_highlights_for_net (const db::Net *net, size_t &n_ma
size_t cluster_id = net->cluster_id ();
QColor net_color = m_colorizer.color_of_net (net);
if (! net_color.isValid ()) {
// fallback color
net_color = mp_view->background_color ().green () < 128 ? QColor (Qt::white) : QColor (Qt::black);
}
const db::Connectivity &conn = mp_database->connectivity ();
for (db::Connectivity::layer_iterator layer = conn.begin_layers (); layer != conn.end_layers (); ++layer) {
@ -2351,7 +2346,7 @@ NetlistBrowserPage::produce_highlights_for_net (const db::Net *net, size_t &n_ma
mp_markers.push_back (new lay::Marker (mp_view, m_cv_index));
mp_markers.back ()->set (*shapes, net_trans * shapes.trans (), tv);
if (net_color.isValid ()) {
if (! m_use_original_colors || display == display_by_lp.end ()) {
mp_markers.back ()->set_color (net_color);
mp_markers.back ()->set_frame_color (net_color);
@ -2369,13 +2364,6 @@ NetlistBrowserPage::produce_highlights_for_net (const db::Net *net, size_t &n_ma
mp_markers.back ()->set_frame_color (display->second->eff_frame_color_brighter (true, (-m_marker_intensity * 255) / 100));
}
} else {
// fallback color
QColor net_color = mp_view->background_color ().green () < 128 ? QColor (Qt::white) : QColor (Qt::black);
mp_markers.back ()->set_color (net_color);
mp_markers.back ()->set_frame_color (net_color);
}
if (m_marker_line_width >= 0) {
@ -2455,7 +2443,6 @@ NetlistBrowserPage::update_highlights ()
}
}
// @@@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);
// correct DBU differences between the storage layout and the original layout

View File

@ -280,7 +280,7 @@ public:
* @param halo The halo flag or -1 for default
* @param dither_pattern The dither pattern index of -1 to take the default
*/
void set_highlight_style (QColor color, int line_width, int vertex_size, int halo, int dither_pattern, int marker_intensity, const lay::ColorPalette *auto_colors);
void set_highlight_style (QColor color, int line_width, int vertex_size, int halo, int dither_pattern, int marker_intensity, bool use_original_colors, const lay::ColorPalette *auto_colors);
/**
* @brief Gets a value indicating whether all items in the netlist tree are shown (specifically for cross-reference DBs)
@ -335,6 +335,7 @@ private:
int m_marker_halo;
int m_marker_dither_pattern;
int m_marker_intensity;
bool m_use_original_colors;
lay::LayoutView *mp_view;
unsigned int m_cv_index;
lay::PluginRoot *mp_plugin_root;