Add ability to "filter out" buried net in TabEquipotentials.

Definition: A buried net is a net that has no components at the top
Cell level. Typically example is a wire internal to a standard cell.
Those nets, while part of the complete design (flat) are not part
of the top netlist, and we may want not to see it.
  A buried net is slighly different from a deep net. While a deepnet
is also not reaching the top level cell, we created it at top level
to be processed by the router (virtual flatten).
This commit is contained in:
Jean-Paul Chaput 2023-04-14 01:07:40 +02:00
parent d928a3c7a5
commit 4c7cf227be
6 changed files with 116 additions and 30 deletions

View File

@ -202,6 +202,7 @@ namespace Tramontana {
, _type (Net::Type::UNDEFINED)
, _direction (Net::Direction::DirUndefined)
, _netCount (0)
, _isBuried (false)
, _isExternal (false)
, _isGlobal (false)
, _isAutomatic(false)
@ -354,6 +355,7 @@ namespace Tramontana {
for ( Occurrence childEqui : _childs ) {
childEqui.put( relation );
}
if (_components.empty() and _nets.empty()) _isBuried = true;
// if (_name == "abc_11873_auto_rtlil_cc_2560_muxgate_11612")
// show();
@ -388,6 +390,7 @@ namespace Tramontana {
sflags += ((_isExternal ) ? "e" : "-");
sflags += ((_isGlobal ) ? "g" : "-");
sflags += ((_isAutomatic) ? "a" : "-");
sflags += ((_isBuried ) ? "B" : "-");
sflags += " [N:" + getString( _netCount - ((_hasFused) ? 1 : 0) );
sflags += "+E:" + getString( _childs.size() );
if (_hasFused)

View File

@ -39,12 +39,42 @@ namespace Tramontana {
using Hurricane::Graphics;
// -------------------------------------------------------------------
// Class : "BuriedFilterProxymodel".
EquiFilterProxyModel::EquiFilterProxyModel ( QObject* parent )
: Super (parent)
, _filter(NoFilter)
{ }
void EquiFilterProxyModel::setFilter ( uint32_t filter )
{ _filter = filter; invalidateFilter(); }
bool EquiFilterProxyModel::filterAcceptsRow ( int row, const QModelIndex& index ) const
{
EquipotentialsModel* model = dynamic_cast<EquipotentialsModel*>( sourceModel() );
if (not model) return true;
const Equipotential* equi = model->getEqui( row );
if (not (_filter & ShowBuried) and equi->isBuried()) return false;
return true;
}
// -------------------------------------------------------------------
// Class : "EquipotentialsWidget".
EquipotentialsWidget::EquipotentialsWidget ( QWidget* parent )
: QWidget (parent)
, _cellWidget (NULL)
, _cell (NULL)
, _baseModel (new EquipotentialsModel(this))
, _sortModel (new QSortFilterProxyModel(this))
, _filterModel (new EquiFilterProxyModel(this))
, _view (new QTableView(this))
, _rowHeight (20)
, _selecteds ()
@ -56,7 +86,9 @@ namespace Tramontana {
_rowHeight = QFontMetrics( Graphics::getFixedFont() ).height() + 4;
_sortModel->setSourceModel ( _baseModel );
_filterModel->setSourceModel ( _baseModel );
//_filterModel->setFilter ( EquiFilterProxyModel::ShowBuried );
_sortModel->setSourceModel ( _filterModel );
_sortModel->setDynamicSortFilter( true );
_sortModel->setFilterKeyColumn ( 0 );
@ -110,6 +142,17 @@ namespace Tramontana {
}
QModelIndex EquipotentialsWidget::mapToSource ( QModelIndex viewIndex ) const
{ return _filterModel->mapToSource( _sortModel->mapToSource( viewIndex )); }
void EquipotentialsWidget::setShowBuried ( bool state )
{
_filterModel->setFilter( (state) ? EquiFilterProxyModel::ShowBuried
: EquiFilterProxyModel::NoFilter );
}
void EquipotentialsWidget::goTo ( int delta )
{
if ( delta == 0 ) return;
@ -138,7 +181,7 @@ namespace Tramontana {
const Equipotential* equi = nullptr;
QModelIndexList iList = _view->selectionModel()->selectedRows();
for ( int i=0 ; i<iList.size() ; i++ ) {
equi = _baseModel->getEqui( _sortModel->mapToSource(iList[i]).row() );
equi = _baseModel->getEqui( mapToSource(iList[i]).row() );
if ( equi )
_selecteds.insert( equi );
}
@ -182,7 +225,7 @@ namespace Tramontana {
void EquipotentialsWidget::fitToEqui ()
{
const Equipotential* equi = _baseModel->getEqui( _sortModel->mapToSource(_view->currentIndex()).row() );
const Equipotential* equi = _baseModel->getEqui( mapToSource(_view->currentIndex()).row() );
if (equi) emit reframe ( equi->getBoundingBox() );
}

View File

@ -27,6 +27,8 @@
namespace Tramontana {
using std::cerr;
using std::endl;
using Hurricane::Graphics;
@ -39,6 +41,7 @@ namespace Tramontana {
, _browser (new EquipotentialsWidget())
, _syncEquipotentials (new QCheckBox())
, _syncSelection (new QCheckBox())
, _showBuried (new QCheckBox())
, _cwCumulativeSelection(false)
{
_browser->setObjectName ( "controller.tabEquipotentials.browser" );
@ -57,11 +60,18 @@ namespace Tramontana {
_syncSelection->setFont ( Graphics::getFixedFont(QFont::Bold,false,false) );
connect( _syncSelection, SIGNAL(toggled(bool)), this, SLOT(setSyncSelection(bool)) );
_showBuried->setText ( tr("Show Buried") );
_showBuried->setChecked( false );
_showBuried->setFont ( Graphics::getFixedFont(QFont::Bold,false,false) );
connect( _showBuried, SIGNAL(toggled(bool)), this, SLOT(setShowBuried(bool)) );
QHBoxLayout* commands = new QHBoxLayout ();
commands->setContentsMargins( 0, 0, 0, 0 );
commands->addStretch();
commands->addWidget ( _syncEquipotentials );
commands->addStretch();
commands->addWidget ( _showBuried );
commands->addStretch();
commands->addWidget ( _syncSelection );
commands->addStretch();
wLayout->addLayout ( commands );
@ -108,6 +118,13 @@ namespace Tramontana {
}
void TabEquipotentials::setShowBuried ( bool state )
{
if (not getCellWidget()) return;
_browser->setShowBuried( state );
}
void TabEquipotentials::setCell ( Cell* cell )
{
setSyncEquipotentials( _syncEquipotentials->isChecked() );

View File

@ -57,6 +57,7 @@ namespace Tramontana {
public:
static Equipotential* create ( Cell* );
inline bool isEmpty () const;
inline bool isBuried () const;
virtual Cell* getCell () const;
virtual Box getBoundingBox () const;
inline std::string getName () const;
@ -95,6 +96,7 @@ namespace Tramontana {
Net::Type _type;
Net::Direction _direction;
uint32_t _netCount;
bool _isBuried;
bool _isExternal;
bool _isGlobal;
bool _isAutomatic;
@ -103,7 +105,8 @@ namespace Tramontana {
inline bool Equipotential::isEmpty () const { return _components.empty() and _childs.empty(); }
inline bool Equipotential::isEmpty () const { return _components.empty() and _childs.empty(); }
inline bool Equipotential::isBuried () const { return _isBuried; }
inline const OccurrenceSet& Equipotential::getComponents () const { return _components; }
inline const OccurrenceSet& Equipotential::getChilds () const { return _childs; }
inline const NetSet& Equipotential::getNets () const { return _nets; }

View File

@ -47,6 +47,25 @@ namespace Tramontana {
using Hurricane::OccurrenceSet;
// -------------------------------------------------------------------
// Class : EquiFilterProxyModel".
class EquiFilterProxyModel : public QSortFilterProxyModel {
Q_OBJECT;
public:
typedef QSortFilterProxyModel Super;
static const uint32_t NoFilter = 0;
static const uint32_t ShowBuried = (1<<0);
public:
EquiFilterProxyModel ( QObject* );
void setFilter ( uint32_t );
virtual bool filterAcceptsRow ( int row, const QModelIndex& ) const;
private:
uint32_t _filter;
};
// -------------------------------------------------------------------
// Class : "SelectedEqui".
@ -130,31 +149,34 @@ namespace Tramontana {
Q_OBJECT;
public:
EquipotentialsWidget ( QWidget* parent=nullptr );
inline Cell* getCell ();
void setCellWidget ( CellWidget* );
void setCell ( Cell* );
void goTo ( int );
void updateSelecteds ();
EquipotentialsWidget ( QWidget* parent=nullptr );
inline Cell* getCell ();
void setShowBuried ( bool );
void setCellWidget ( CellWidget* );
void setCell ( Cell* );
void goTo ( int );
void updateSelecteds ();
QModelIndex mapToSource ( QModelIndex ) const;
signals:
void equipotentialSelect ( Occurrences );
void equipotentialUnselect ( Occurrences );
void reframe ( const Box& );
void equipotentialSelect ( Occurrences );
void equipotentialUnselect ( Occurrences );
void reframe ( const Box& );
private slots:
void textFilterChanged ();
void updateSelecteds ( const QItemSelection& , const QItemSelection& );
void fitToEqui ();
void textFilterChanged ();
void updateSelecteds ( const QItemSelection& , const QItemSelection& );
void fitToEqui ();
private:
CellWidget* _cellWidget;
Cell* _cell;
EquipotentialsModel* _baseModel;
QSortFilterProxyModel* _sortModel;
QTableView* _view;
QLineEdit* _filterPatternLineEdit;
int _rowHeight;
SelectedEquiSet _selecteds;
bool _forceReselect;
CellWidget* _cellWidget;
Cell* _cell;
EquipotentialsModel* _baseModel;
QSortFilterProxyModel* _sortModel;
EquiFilterProxyModel* _filterModel;
QTableView* _view;
QLineEdit* _filterPatternLineEdit;
int _rowHeight;
SelectedEquiSet _selecteds;
bool _forceReselect;
};

View File

@ -35,8 +35,6 @@ namespace Tramontana {
public:
TabEquipotentials ( QWidget* parent=NULL );
inline QCheckBox* getSyncEquipotentials ();
inline QCheckBox* getSyncSelection ();
inline EquipotentialsWidget* getBrowser ();
virtual void cellPreModificate ();
virtual void cellPostModificate ();
@ -45,18 +43,18 @@ namespace Tramontana {
virtual void setCellWidget ( CellWidget* );
virtual void setSyncEquipotentials ( bool );
virtual void setSyncSelection ( bool );
virtual void setShowBuried ( bool );
protected:
EquipotentialsWidget* _browser;
QCheckBox* _syncEquipotentials;
QCheckBox* _syncSelection;
QCheckBox* _showBuried;
bool _cwCumulativeSelection;
};
inline EquipotentialsWidget* TabEquipotentials::getBrowser () { return _browser; }
inline QCheckBox* TabEquipotentials::getSyncEquipotentials () { return _syncEquipotentials; }
inline QCheckBox* TabEquipotentials::getSyncSelection () { return _syncSelection; }
inline EquipotentialsWidget* TabEquipotentials::getBrowser () { return _browser; }
}