//{{{ CellSet Cell::getPortCells() CellSet Cell::getPortCells(const size_t &i) const { CellSet cells; if (i >= ports_.size()) return cells; Net *n = ports_[i]->inNet_; if (!n) return cells; NetSet eqv = getEqvNets(n->id_); for (NetSet::iterator it = eqv.begin() ; it != eqv.end(); ++it) { Net *n = *it; for (size_t i = 0; i < n->getNPort(); ++i) { Port *p = n->getPort(i); if (p->top_ != this) cells.insert(p->top_); } } return cells; } //}}}
//{{{ CellSet Cell::getFanin() CellSet Cell::getFanin(const size_t &i) const { CellSet fi; if (i >= cells_.size()) return fi; Cell *c = cells_[i]; NetSet eqvs; for (size_t i = 0; i < c->getNPort(); ++i) { if (c->getPort(i)->type_ != Port::INPUT || !c->getPort(i)->exNet_) continue; NetSet eqv = getEqvNets(c->getPort(i)->exNet_->id_); eqvs.insert(eqv.begin(), eqv.end()); } NetSet::iterator it = eqvs.begin(); for ( ; it != eqvs.end(); ++it) { Net *n = *it; for (size_t j = 0; j < n->getNPort(); ++j) { Port *p = n->getPort(j); if (p->top_ != this && p->type_ == Port::OUTPUT) fi.insert(p->top_); } } return fi; } //}}}