WIP: netlist browser - allow switching between L2N and LVSDB view

This commit is contained in:
Matthias Koefferlein 2019-06-28 11:27:43 +02:00
parent 910a36b83d
commit 80d86cc425
4 changed files with 61 additions and 2 deletions

View File

@ -535,7 +535,7 @@ void std_writer_impl<Keys>::write (const db::DCplxTrans &tr)
if (! first) {
*mp_stream << " ";
}
*mp_stream << Keys::location_key << "(" << tr.disp ().x () / m_dbu << " " << tr.disp ().y () / m_dbu << ")";
*mp_stream << Keys::location_key << "(" << floor (0.5 + tr.disp ().x () / m_dbu) << " " << floor (0.5 + tr.disp ().y () / m_dbu) << ")";
}
template <class Keys>

View File

@ -132,6 +132,36 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>32</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QRadioButton" name="show_netlist">
<property name="text">
<string>Netlist</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="show_xref">
<property name="text">
<string>Cross-Ref</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">

View File

@ -192,6 +192,9 @@ NetlistBrowserPage::NetlistBrowserPage (QWidget * /*parent*/)
connect (forward, SIGNAL (clicked ()), this, SLOT (navigate_forward ()));
connect (backward, SIGNAL (clicked ()), this, SLOT (navigate_back ()));
connect (show_netlist, SIGNAL (clicked ()), this, SLOT (mode_changed ()));
connect (show_xref, SIGNAL (clicked ()), this, SLOT (mode_changed ()));
connect (actionExportAll, SIGNAL (triggered ()), this, SLOT (export_all ()));
connect (actionExportSelected, SIGNAL (triggered ()), this, SLOT (export_selected ()));
@ -582,6 +585,12 @@ NetlistBrowserPage::info_button_pressed ()
mp_info_dialog->show ();
}
void
NetlistBrowserPage::mode_changed ()
{
setup_trees ();
}
static QModelIndex find_next (QTreeView *view, QAbstractItemModel *model, const QRegExp &to_find, const QModelIndex &from)
{
QModelIndex index = from;
@ -721,9 +730,26 @@ NetlistBrowserPage::set_db (db::LayoutToNetlist *l2ndb)
db::LayoutVsSchematic *lvsdb = dynamic_cast<db::LayoutVsSchematic *> (l2ndb);
mp_database.reset (l2ndb);
show_netlist->setVisible (lvsdb != 0);
show_xref->setVisible (lvsdb != 0);
bool se = m_signals_enabled;
m_signals_enabled = false;
show_netlist->setChecked (lvsdb == 0);
show_xref->setChecked (lvsdb != 0);
m_signals_enabled = se;
clear_markers ();
highlight (std::vector<const db::Net *> (), std::vector<const db::Device *> (), std::vector<const db::SubCircuit *> (), std::vector<const db::Circuit *> ());
m_cell_context_cache = db::ContextCache (mp_database->internal_layout ());
setup_trees ();
}
void
NetlistBrowserPage::setup_trees ()
{
if (! mp_database.get ()) {
delete directory_tree->model ();
directory_tree->setModel (0);
@ -732,7 +758,8 @@ NetlistBrowserPage::set_db (db::LayoutToNetlist *l2ndb)
return;
}
m_cell_context_cache = db::ContextCache (mp_database->internal_layout ());
db::LayoutToNetlist *l2ndb = mp_database.get ();
db::LayoutVsSchematic *lvsdb = show_netlist->isChecked () ? 0 : dynamic_cast<db::LayoutVsSchematic *> (l2ndb);
{
// NOTE: with the tree as the parent, the tree will take over ownership of the model

View File

@ -173,6 +173,7 @@ private slots:
void selection_changed ();
void browse_color_for_net ();
void select_color_for_net ();
void mode_changed ();
protected:
bool eventFilter (QObject *watched, QEvent *event);
@ -209,6 +210,7 @@ private:
db::ContextCache m_cell_context_cache;
void set_db (db::LayoutToNetlist *l2ndb);
void setup_trees ();
void add_to_history (void *id, bool fwd);
void navigate_to (void *id, bool forward = true);
void adjust_view ();