📄 wnnsc.c
字号:
/**CFile**************************************************************** FileName [wnNsc.c] PackageName [MVSIS 2.0: Multi-valued logic synthesis system.] Synopsis [Prepares the windows for NSC-flexibility computation.] Author [MVSIS Group] Affiliation [UC Berkeley] Date [Ver. 1.0. Started - February 1, 2003.] Revision [$Id: wnNsc.c,v 1.2 2003/05/27 23:14:54 alanmi Exp $]***********************************************************************/#include "wnInt.h"/////////////////////////////////////////////////////////////////////////// DECLARATIONS ///////////////////////////////////////////////////////////////////////////static bool Wn_WindowPrepareHasReconv( Wn_Window_t * pWnd, Ntk_Node_t * pNode );static void Wn_WindowPrepareHasReconv_rec( Ntk_Node_t * pNode );/////////////////////////////////////////////////////////////////////////// FUNCTION DEFITIONS ////////////////////////////////////////////////////////////////////////////**Function************************************************************* Synopsis [Prepares the special nodes for NSC flexibility computation.] Description [Detects all the ND nodes that have reconvergent fanout for at least one root of the window. The nodes are collected by level from outputs.] SideEffects [] SeeAlso []***********************************************************************/void Wn_WindowPrepareNsc( Wn_Window_t * pWnd ){ Mvr_Relation_t * pMvr; Ntk_Node_t * pNode; int Level; // levelize the window nodes starting from the leaves Wn_WindowLevelizeNodes( pWnd, 0 ); // go through the nodes and add special nodes them to the special list Ntk_NetworkStartSpecial( pWnd->pNet ); for ( Level = 0; Level <= pWnd->pNet->nLevels; Level++ ) Ntk_NetworkForEachNodeSpecialByLevel( pWnd->pNet, Level, pNode ) { pMvr = Ntk_NodeReadFuncMvr( pNode ); if ( Mvr_RelationIsND( pMvr ) && Wn_WindowPrepareHasReconv(pWnd,pNode) ) Ntk_NetworkAddToSpecial( pNode ); } // move the nodes from the special list to the special array pWnd->nSpecials = Ntk_NetworkCountSpecial( pWnd->pNet ); pWnd->ppSpecials = ALLOC( Ntk_Node_t *, pWnd->nSpecials ); Ntk_NetworkCreateArrayFromSpecial( pWnd->pNet, pWnd->ppSpecials );}/**Function************************************************************* Synopsis [Returns 1 if the node has reconvergence to at least one root.] Description [] SideEffects [] SeeAlso []***********************************************************************/bool Wn_WindowPrepareHasReconv( Wn_Window_t * pWnd, Ntk_Node_t * pStart ){ Ntk_Node_t * pNode; int i; // set the traversal ID for this traversal Ntk_NetworkIncrementTravId( pWnd->pNet ); // mark the leaves and set their visit counters to 0 for ( i = 0; i < pWnd->nRoots; i++ ) { pNode = pWnd->ppRoots[i]; Ntk_NodeSetTravIdCurrent( pNode ); pNode->pData = NULL; } // mark the currently selected special nodes Ntk_NetworkForEachNodeSpecial( pWnd->pNet, pNode ) { Ntk_NodeSetTravIdCurrent( pNode ); pNode->pData = NULL; } // recursively visit the fanouts of the node Wn_WindowPrepareHasReconv_rec( pStart ); // check if at least one of the nodes has the counter larger than 1 for ( i = 0; i < pWnd->nRoots; i++ ) { pNode = pWnd->ppRoots[i]; if ( ((int)pNode->pData) > 1 ) return 1; } Ntk_NetworkForEachNodeSpecial( pWnd->pNet, pNode ) { if ( ((int)pNode->pData) > 1 ) return 1; } // otherwise, the node has no reconvergence return 0;}/**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso []***********************************************************************/void Wn_WindowPrepareHasReconv_rec( Ntk_Node_t * pNode ){ Ntk_Node_t * pFanout; Ntk_Pin_t * pLink; if ( Ntk_NodeIsTravIdCurrent(pNode) ) // visited node { pNode->pData = (char *)( ((int)pNode->pData) + 1 ); return; } assert( !Ntk_NodeIsCo(pNode) ); // otherwise, the window is wrong // visit the transitive fanout Ntk_NodeForEachFanout( pNode, pLink, pFanout ) Wn_WindowPrepareHasReconv_rec( pFanout );}/////////////////////////////////////////////////////////////////////////// END OF FILE ///////////////////////////////////////////////////////////////////////////
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -