Example #1
0
void
V3Handler::setLastHandler() {
   assert (getHandlerCount()); if (_curHandlerId == _lastHandlerId) return;
   const uint32_t curHandlerId = _curHandlerId; assert (getHandler(curHandlerId));
   V3UI32Vec curRefIdVec = _curRefIdVec; assert (curRefIdVec.size());
   _curHandlerId = _lastHandlerId; _curRefIdVec = _lastRefIdVec;
   _lastHandlerId = curHandlerId; _lastRefIdVec = curRefIdVec;
}
Example #2
0
void
V3Handler::setRootHandler() {
   assert (getHandlerCount());
   const V3NtkHandler* const handler = getCurHandler()->getPrimitive(); assert (handler);
   if (getCurHandler() == handler) return;
   // Compute NtkID of Root
   uint32_t i = 0; for (; i < _ntkHandlerList.size(); ++i) if (handler == _ntkHandlerList[i]) break;
   assert (i < _ntkHandlerList.size()); _lastHandlerId = _curHandlerId; _lastRefIdVec = _curRefIdVec;
   _curHandlerId = i; _curRefIdVec.clear(); _curRefIdVec.push_back(_curHandlerId);
}
Example #3
0
void SyberGraphRect::paintActiveState(QPainter *painter)
{
    painter->save();
    QPen pen;
    pen.setColor(Qt::red);
//    painter->setRenderHint(Q);
    painter->setPen(pen);
    for(int i = 0; i<=getHandlerCount(); i++)
    {
        QRect rect = getPointRect();
        rect.moveCenter(getHandle(i));
        painter->drawRect(rect);
    }
    painter->restore();
}
Example #4
0
void
V3Handler::setPrevHandler() {
   assert (getHandlerCount()); if (_curRefIdVec.size() == 1) return;
   if (_curRefIdVec.size() == 2) return setBaseHandler();
   _lastHandlerId = _curHandlerId; _lastRefIdVec = _curRefIdVec;
   _curRefIdVec.pop_back(); assert (_curRefIdVec.size());
   V3NtkHandler* handler = getHandler(_curRefIdVec[0]); assert (handler);
   for (uint32_t i = 1; i < _curRefIdVec.size(); ++i) {
      assert (_curRefIdVec[i] < handler->getNtk()->getModuleSize());
      handler = handler->getNtk()->getModule(i)->getNtkRef(); assert (handler);
   }
   // Compute NtkID of Prev
   uint32_t i = 0; for (; i < _ntkHandlerList.size(); ++i) if (handler == _ntkHandlerList[i]) break;
   assert (i < _ntkHandlerList.size()); _curHandlerId = i;
}
Example #5
0
// Print Functions
void
V3Handler::printNtkInAncestry() const {
   if (!getHandlerCount()) return;
   V3HandlerVec ancestry; ancestry.clear();
   V3NtkHandler* handler = getCurHandler(); assert (handler);
   while (true) {
      ancestry.push_back(handler); if (handler == handler->getPrimitive()) break;
      handler = const_cast<V3NtkHandler*>(handler->getPrimitive());
   }
   uint32_t i = ancestry.size(), j;
   while (i--) {
      for (j = 0; j < _ntkHandlerList.size(); ++j) if (ancestry[i] == _ntkHandlerList[j]) break;
      assert (j < _ntkHandlerList.size()); Msg(MSG_IFO) << "/" << j;
   }
   Msg(MSG_IFO) << endl;
}
Example #6
0
void
V3Handler::setBaseHandler() {
   assert (getHandlerCount()); if (_curRefIdVec.size() == 1) return;
   _lastHandlerId = _curHandlerId; _lastRefIdVec = _curRefIdVec;
   _curHandlerId = _curRefIdVec[0]; _curRefIdVec.clear(); _curRefIdVec.push_back(_curHandlerId);
}
Example #7
0
void
V3Handler::setCurHandlerFromPath(const string& path) {
   assert (path.size());
   string curPath = path;
   uint32_t i;
   // Split Path by '/'
   V3Vec<string>::Vec idStr; idStr.clear();
   while (curPath.size()) {
      for (i = 0; i < curPath.size(); ++i) if ('/' == curPath[i]) break;
      if (!i) idStr.push_back("");
      else idStr.push_back(curPath.substr(0, i));
      if ((i + 1) >= curPath.size()) break;
      else curPath = curPath.substr(i + 1);
   }
   // Copy Current Handler and RefId
   const uint32_t curHandlerId = _curHandlerId; assert (getHandler(curHandlerId));
   V3UI32Vec curRefIdVec = _curRefIdVec; assert (curRefIdVec.size());
   V3NtkHandler* handler = 0;
   bool isRoot = false; int temp;
   for (i = 0; i < idStr.size(); ++i) {
      if (handler) {  // Expecting Sub-Module Index
         if (!idStr[i].size()) continue;
         if (v3Str2Int(idStr[i], temp)) {
            const uint32_t id = (uint32_t)temp;
            if (id < handler->getNtk()->getModuleSize()) {
               handler = handler->getNtk()->getModule(id)->getNtkRef();
               uint32_t j = 0; for (; j < _ntkHandlerList.size(); ++j) if (handler == _ntkHandlerList[j]) break;
               _curHandlerId = j; _curRefIdVec.push_back(id);
            }
            else {
               string recoverPath = "";
               for (uint32_t j = 0; j < _curRefIdVec.size(); ++j) recoverPath += ("/" + v3Int2Str(_curRefIdVec[j]));
               Msg(MSG_ERR) << "Sub-Module of " << recoverPath << " with Index = " 
                            << idStr[i] << " Does NOT Exist !!" << endl; return;
            }
         }
      }
      else {  // Expecting NtkID or Location Symbols (/, ./, ~/, .)
         if (!idStr[i].size()) isRoot = true;
         else {
            // Lex if current token is a SubModule Index
            if (v3Str2Int(idStr[i], temp)) {
               const uint32_t id = (uint32_t)temp;
               if (isRoot) {
                  if (id < getHandlerCount()) {
                     handler = getHandler(id); _curHandlerId = id;
                     _curRefIdVec.clear(); _curRefIdVec.push_back(id);
                  }
                  else {
                     Msg(MSG_ERR) << "Ntk with ID = " << idStr[i] << " Does NOT Exist !!" << endl; return;
                  }
               }
               else {
                  if (id < getCurHandler()->getNtk()->getModuleSize()) {
                     handler = getCurHandler()->getNtk()->getModule(id)->getNtkRef();
                     uint32_t j = 0; for (; j < _ntkHandlerList.size(); ++j) if (handler == _ntkHandlerList[j]) break;
                     _curHandlerId = j; _curRefIdVec.push_back(id);
                  }
                  else {
                     string recoverPath = "";
                     for (uint32_t j = 0; j < _curRefIdVec.size(); ++j) recoverPath += ("/" + v3Int2Str(_curRefIdVec[j]));
                     Msg(MSG_ERR) << "Sub-Module of " << recoverPath << " with Index = " 
                                  << idStr[i] << " Does NOT Exist !!" << endl; return;
                  }
               }
            }
            else if (idStr[i].size() > 1) {
               Msg(MSG_ERR) << "Unexpected Symbol \"" << idStr[i] << "\" in the Path !!" << endl; return;
            }
            else if ('~' == idStr[i][0]) {
               const uint32_t baseId = _curHandlerId = _curRefIdVec[0]; handler = getHandler(baseId);
               _curRefIdVec.clear(); _curRefIdVec.push_back(baseId);
            }
            else if ('.' == idStr[i][0]) handler = getCurHandler(); assert (handler);
         }
      }
   }
   // Copy Data for Last if Valid, Or Resume Data for Current
   if (_curHandlerId < _ntkHandlerList.size()) {
      _lastHandlerId = curHandlerId; _lastRefIdVec = curRefIdVec;
   }
   else {
      _curHandlerId = curHandlerId; _curRefIdVec = curRefIdVec;
      Msg(MSG_ERR) << "Network " << path << " was Implicitly Created and it is Currently Untraceable !!" << endl;
   }
}
Example #8
0
void
V3Handler::setCurHandlerFromId(const uint32_t& ntkId) {
   assert (ntkId < getHandlerCount());
   _lastHandlerId = _curHandlerId; _curHandlerId = ntkId;
   _lastRefIdVec = _curRefIdVec; _curRefIdVec.clear(); _curRefIdVec.push_back(ntkId);
}
Example #9
0
void
V3Handler::pushAndSetCurHandler(V3NtkHandler* const handler) {
   assert (handler); _ntkHandlerList.push_back(handler);
   setCurHandlerFromId(getHandlerCount() - 1); assert (handler == getCurHandler());
}
Example #10
0
// Ntk Ancestry and Hierarchy Maintanence Functions
V3NtkHandler* const
V3Handler::getHandler(const uint32_t& ntkId) const {
   return (ntkId < getHandlerCount()) ? _ntkHandlerList[ntkId] : 0;
}