@@ -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+
21792220void 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 ;
0 commit comments