⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wnderive.c

📁 主要进行大规模的电路综合
💻 C
📖 第 1 页 / 共 2 页
字号:
  Description [Collects only those nodes in the TFI of the given set of   nodes that are marked by the current value of the traversal ID.]                 SideEffects []  SeeAlso     []***********************************************************************/int Wn_WindowComputeTfiMarked( Ntk_Network_t * pNet, Ntk_Node_t * pNodes[], int nNodes, int Depth, bool fExistPath ){    Ntk_Node_t * pNode, * pNode2;    int nNodesRes, DepthReal, i;    bool fFirst;    // set the new traversal ID    // (now the marked nodes are marked with the previous traversal ID)    Ntk_NetworkIncrementTravId( pNet );    // start the linked list    Ntk_NetworkStartSpecial( pNet );    // start DFS from the primary outputs    DepthReal = Depth + (!fExistPath) * 1000;    nNodesRes = 0;    for ( i = 0; i < nNodes; i++ )        nNodesRes += Wn_WindowComputeTfiMarked_rec( pNodes[i], DepthReal, fExistPath );    // finalize the linked list    Ntk_NetworkStopSpecial( pNet );    // remove from the list those nodes have the large real number of levels    if ( !fExistPath )    {        fFirst = 1;        nNodesRes = 0;        Ntk_NetworkForEachNodeSpecialSafe( pNet, pNode, pNode2 )        {            if ( fFirst )            { // restart the specialized list                Ntk_NetworkStartSpecial( pNet );                fFirst = 0;            }            if ( pNode->Level >= 1000 )            { // if the node satisfies the criteria, add it to the specialized list                Ntk_NetworkAddToSpecial( pNode );                pNode->Level -= 1000;                nNodesRes++;            }        }        // finalize the linked list        Ntk_NetworkStopSpecial( pNet );    }    return nNodesRes;}/**Function*************************************************************  Synopsis    [Performs the recursive step of Wn_WindowComputeTfiMarked().]  Description []                 SideEffects []  SeeAlso     []***********************************************************************/int Wn_WindowComputeTfiMarked_rec( Ntk_Node_t * pNode, int Depth, bool fExistPath ){    Ntk_Node_t * pFanin;    Ntk_Pin_t * pLink;    int nNodes;    // if the depth is out, skip    if ( Depth == -1 )        return 0;    // if the node is CI, skip    if ( Ntk_NodeIsCi(pNode) )        return 0;    // if this node is already visited, check the level    if ( Ntk_NodeIsTravIdCurrent( pNode ) )    {        nNodes = 0;        if ( fExistPath && pNode->Level < Depth || (!fExistPath) && pNode->Level > Depth )        { // we have found a shorter path to the same node            // update the level to be the shortest path            pNode->Level = Depth;            // visit the transitive fanin            Ntk_NodeForEachFanin( pNode, pLink, pFanin )                nNodes += Wn_WindowComputeTfiMarked_rec( pFanin, Depth - 1, fExistPath );        }        return nNodes;    }    // visit the transitive fanin    nNodes = 0;    Ntk_NodeForEachFanin( pNode, pLink, pFanin )        nNodes += Wn_WindowComputeTfiMarked_rec( pFanin, Depth - 1, fExistPath );    // add the node after the fanins are added    // if the node belongs to the set of marked nodes    if ( Ntk_NodeIsTravIdPrevious( pNode ) )    {        Ntk_NetworkAddToSpecial( pNode );        nNodes++;    }    // mark the node as visited (this should be done after we check it for being previous)    Ntk_NodeSetTravIdCurrent( pNode );    // set the depth    pNode->Level = Depth;    return nNodes;}/**Function*************************************************************  Synopsis    [Select nodes that have fanins outside the set.]  Description [The current set of nodes is linked in the internal list.]                 SideEffects []  SeeAlso     []***********************************************************************/int Wn_WindowComputeLeaves( Ntk_Network_t * pNet ){    Ntk_Node_t * pNode, * pFanin;    Ntk_Node_t * pList, ** ppTail;    Ntk_Pin_t * pPin;    int nNodes;    // mark the nodes currently in the list    Ntk_NetworkIncrementTravId( pNet );    Ntk_NetworkForEachNodeSpecial( pNet, pNode )        Ntk_NodeSetTravIdCurrent( pNode );    // start the linked list    ppTail = &pList;    nNodes = 0;    Ntk_NetworkForEachNodeSpecial( pNet, pNode )        Ntk_NodeForEachFanin( pNode, pPin, pFanin )        {            // make sure the fanin is not yet in the list            if ( !Ntk_NodeIsTravIdCurrent( pFanin ) )            { // add this node                *ppTail = pFanin;                ppTail = &pFanin->pOrder;                nNodes++;                // mark that the fanin has been added to the list                Ntk_NodeSetTravIdCurrent( pFanin );            }        }    // finalize the linked list    *ppTail = NULL;    // set this new list as a specialize internal list    pNet->pOrder = pList;    return nNodes;}/**Function*************************************************************  Synopsis    [Verifies the window.]  Description []                 SideEffects []  SeeAlso     []***********************************************************************/void Wn_WindowVerifyWindow( Wn_Window_t * pWnd ){    Ntk_Node_t * pNode;//    Ntk_Node_t * pFanout, * pFanin;//    Ntk_Pin_t * pPin;//    bool fHasFanoutInside;//    bool fHasFaninInside;//    int i;    int RetValue;    // connect the nodes in the DFS way    RetValue = Wn_WindowDfs( pWnd );    assert( RetValue );    if ( RetValue == 0 )        fail( "Wn_WindowVerifyWindow(): Serious windowing error.\n" );    // mark the internal nodes    Ntk_NetworkIncrementTravId( pWnd->pNet );    Ntk_NetworkForEachNodeSpecial( pWnd->pNet, pNode )        Ntk_NodeSetTravIdCurrent( pNode );/*    {    int i;    for ( i = 0; i < pWnd->nLeaves; i++ )    {        assert( pWnd->ppLeaves[i]->Type == MV_NODE_CI );    }    for ( i = 0; i < pWnd->nRoots; i++ )    {        assert( Ntk_NodeIsCoFanin(pWnd->ppRoots[i]) );    }    }*//*    // look at each leaf and make sure     // it has at least one fanout into internal nodes    for ( i = 0; i < pWnd->nLeaves; i++ )    {        fHasFanoutInside = 0;        Ntk_NodeForEachFanout( pWnd->ppLeaves[i], pPin, pFanout )            if ( Ntk_NodeIsTravIdCurrent(pFanout) )            {                fHasFanoutInside = 1;                break;            }        assert( fHasFanoutInside );    }*//*    // look at each root and make sure     // it has at least one fanin among the internal nodes    for ( i = 0; i < pWnd->nRoots; i++ )    {        fHasFaninInside = 0;        Ntk_NodeForEachFanin( pWnd->ppRoots[i], pPin, pFanin )            if ( Ntk_NodeIsTravIdCurrent(pFanin) )            {                fHasFaninInside = 1;                break;            }        assert( fHasFaninInside );    }*/}///////////////////////////////////////////////////////////////////////////                       END OF FILE                                ///////////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -