Skip to content

Commit 86de00d

Browse files
authored
Merge pull request #10682 from Logikable/dontuse
mbff: Move IsValidTray back to mbff.cpp.
2 parents b2d93ae + 9c41dd0 commit 86de00d

5 files changed

Lines changed: 44 additions & 44 deletions

File tree

src/dbSta/include/db_sta/dbNetwork.hh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,6 @@ class dbNetwork : public ConcreteNetwork
440440
// supply pin functions
441441
bool isSupplyPin(odb::dbITerm* iterm) const;
442442
bool isValidFlop(odb::dbInst* FF) const;
443-
bool isValidTray(odb::dbInst* tray) const;
444443

445444
////////////////////////////////////////////////////////////////
446445

src/dbSta/src/dbNetwork.cc

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5636,47 +5636,6 @@ bool dbNetwork::isValidFlop(odb::dbInst* FF) const
56365636
== FF->getITerms().size();
56375637
}
56385638

5639-
bool dbNetwork::isValidTray(odb::dbInst* tray) const
5640-
{
5641-
const Cell* cell = dbToSta(tray->getMaster());
5642-
if (cell == nullptr) {
5643-
return false;
5644-
}
5645-
const LibertyCell* lib_cell = testCell(cell);
5646-
if (lib_cell == nullptr || !lib_cell->hasSequentials()) {
5647-
return false;
5648-
}
5649-
5650-
// We don't want the test_cell which lacks global properties
5651-
const LibertyCell* base_cell = libertyCell(cell);
5652-
if (base_cell->isClockGate() || base_cell->dontUse()) {
5653-
return false;
5654-
}
5655-
5656-
int q = 0;
5657-
int qn = 0;
5658-
int scan = 0;
5659-
int supply = 0;
5660-
int preset = 0;
5661-
int clear = 0;
5662-
int clock = 0;
5663-
5664-
for (odb::dbITerm* iterm : tray->getITerms()) {
5665-
q += (isQPin(iterm) && !isInvertingQPin(iterm));
5666-
qn += (isQPin(iterm) && isInvertingQPin(iterm));
5667-
scan += (isScanIn(iterm) || isScanEnable(iterm));
5668-
supply += (isSupplyPin(iterm));
5669-
preset += (isPresetPin(iterm));
5670-
clear += (isClearPin(iterm));
5671-
clock += (isClockPin(iterm));
5672-
}
5673-
5674-
// #D = max(q, qn)
5675-
return std::max(q, qn) >= 2 && getNumD(tray) == std::max(q, qn)
5676-
&& clock + q + qn + scan + supply + preset + clear + std::max(q, qn)
5677-
== tray->getITerms().size();
5678-
}
5679-
56805639
sta::LibertyPort* dbNetwork::getLibertyScanEnable(
56815640
const LibertyCell* lib_cell) const
56825641
{

src/gpl/src/mbff.cpp

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2176,6 +2176,47 @@ Point MBFF::GetTrayCenter(const Mask& array_mask, const int idx)
21762176
return Point{tray_center_x, tray_center_y};
21772177
}
21782178

2179+
bool MBFF::IsValidTray(dbInst* tray)
2180+
{
2181+
const sta::Cell* cell = network_->dbToSta(tray->getMaster());
2182+
if (cell == nullptr) {
2183+
return false;
2184+
}
2185+
const sta::LibertyCell* lib_cell = network_->testCell(cell);
2186+
if (lib_cell == nullptr || !lib_cell->hasSequentials()) {
2187+
return false;
2188+
}
2189+
2190+
// We don't want the test_cell which lacks global properties
2191+
const sta::LibertyCell* base_cell = network_->libertyCell(cell);
2192+
if (base_cell->isClockGate() || resizer_->dontUse(base_cell)) {
2193+
return false;
2194+
}
2195+
2196+
int q = 0;
2197+
int qn = 0;
2198+
int scan = 0;
2199+
int supply = 0;
2200+
int preset = 0;
2201+
int clear = 0;
2202+
int clock = 0;
2203+
2204+
for (dbITerm* iterm : tray->getITerms()) {
2205+
q += (network_->isQPin(iterm) && !network_->isInvertingQPin(iterm));
2206+
qn += (network_->isQPin(iterm) && network_->isInvertingQPin(iterm));
2207+
scan += (network_->isScanIn(iterm) || network_->isScanEnable(iterm));
2208+
supply += (network_->isSupplyPin(iterm));
2209+
preset += (network_->isPresetPin(iterm));
2210+
clear += (network_->isClearPin(iterm));
2211+
clock += (network_->isClockPin(iterm));
2212+
}
2213+
2214+
// #D = max(q, qn)
2215+
return std::max(q, qn) >= 2 && network_->getNumD(tray) == std::max(q, qn)
2216+
&& clock + q + qn + scan + supply + preset + clear + std::max(q, qn)
2217+
== tray->getITerms().size();
2218+
}
2219+
21792220
void MBFF::ReadLibs()
21802221
{
21812222
test_idx_ = 0;
@@ -2184,7 +2225,7 @@ void MBFF::ReadLibs()
21842225
const std::string tray_name = "test_tray_" + std::to_string(test_idx_++);
21852226
dbInst* tmp_tray = dbInst::create(block_, master, tray_name.c_str());
21862227

2187-
if (!network_->isValidTray(tmp_tray)) {
2228+
if (!IsValidTray(tmp_tray)) {
21882229
dbInst::destroy(tmp_tray);
21892230
--test_idx_;
21902231
continue;

src/gpl/src/mbff.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class MBFF
5656

5757
~MBFF();
5858
void Run(int mx_sz, float alpha, float beta);
59+
bool IsValidTray(odb::dbInst* tray);
5960

6061
private:
6162
enum PortName

src/gpl/test/mbff_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class MBFFTestPeer
2929
public:
3030
static bool IsValidTray(MBFF* uut, odb::dbInst* tray)
3131
{
32-
return uut->network_->isValidTray(tray);
32+
return uut->IsValidTray(tray);
3333
}
3434
static void ReadLibs(MBFF* uut) { uut->ReadLibs(); }
3535
};

0 commit comments

Comments
 (0)