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

📄 simpsdc.c

📁 主要进行大规模的电路综合
💻 C
📖 第 1 页 / 共 2 页
字号:
   fanin_list : [pnode fanins][resub nodes]   resub_list :          [nodes]  Note:  explicit SDC computation should avoid non-deterministic part         (used to) onset SDC = [onset(0)][~0] + [onset(1)][~1]         (should)  onset SDC = [compl(0)][0]  + [compl(1)][1]   ]  SideEffects []     SeeAlso     []******************************************************************************/Mvc_Cover_t *SimpComputeSdcInternal(    Ntk_Node_t  *node,    Vm_VarMap_t *pVm,         /* var map of the new fanin list */    sarray_t    *fanin_list,  /* new fanin list, may not be same as node */    sarray_t    *resub_list) {    Mvc_Cover_t *pDomain, *pDef, *pSdcAll, *pSdc, *pTmp;    Mvc_Cover_t *pImage, *isetj, *isetj_adj, *isetj_new, **pIsets;    int         dvalue, iResubVar, nValues;    int         i,j,index;    int         *pnPos;    Ntk_Node_t  *pFanin, *pFinout;    Ntk_Pin_t   *pPin;    Cvr_Cover_t *pCvr;    Vm_VarMap_t *pVmTmp;        dvalue = -1;    iResubVar = -1;        pSdcAll = NULL;    pnPos = ALLOC(int, fanin_list->num);    memset(pnPos, 0, sizeof(int)*fanin_list->num);        for (i=0; i<sarray_n(resub_list); i++) {        pFinout = sarray_fetch(Ntk_Node_t *, resub_list, i);                dvalue = -1; iResubVar = -1;        iResubVar = SimpNodeArrayFindIndex(fanin_list, pFinout);        if (iResubVar<0) {            iResubVar = Ntk_NodeReadFaninNum(node)+i;        }                /* compute new column indices */        Ntk_NodeForEachFaninWithIndex(pFinout, pPin, pFanin, j) {            index = Ntk_NodeReadFaninIndex(node, pFanin);            if (index >= 0) {                pnPos[j] = index;            } else {                fail("SimpComputeSdcInternal: resub node is not subset support");            }        }                pImage = pDomain = NULL;                /* compute the complement of care set */        pCvr = Ntk_NodeGetFuncCvr(pFinout);        pVmTmp  = Cvr_CoverReadVm(pCvr);        nValues = Vm_VarMapReadValuesOutNum(pVmTmp);        pIsets  = Cvr_CoverReadIsets(pCvr);        for (j=0; j<nValues; ++j) {            if (pIsets[j]==NULL) {                dvalue = j;                continue;            }                        isetj = pIsets[j];            isetj_adj = Cvr_IsetAdjust(isetj, pVm, pVmTmp, pnPos);            if (isetj_adj==NULL) {                assert(0);                continue;            }                        if (!Mvc_CoverIsEmpty(isetj_adj)) {                if (pDomain) {                    isetj_new = Mvc_CoverBooleanOr(pDomain, isetj_adj);                    Mvc_CoverFree(pDomain);                    pDomain = isetj_new;                }                else {                    pDomain = Mvc_CoverDup(isetj_adj);                }                                /* set the output bit */                Mvc_CoverBitSet(isetj_adj, pVm, iResubVar, j);                                if (pImage) {                    isetj_new = Mvc_CoverBooleanOr(pImage, isetj_adj);                    Mvc_CoverFree(pImage);                    Mvc_CoverFree(isetj_adj);                    pImage = isetj_new;                }                else {                    pImage = isetj_adj;                }            }            else {                Mvc_CoverFree(isetj_adj);            }        }                /* compute SDC for the default cover as well */        if (dvalue >= 0) {            pDef = Cvr_CoverComplement( pVm, pDomain );            Mvc_CoverBitSet( pDef, pVm, iResubVar, dvalue );                        pTmp = Mvc_CoverBooleanOr( pImage, pDef );            Mvc_CoverFree( pImage );            Mvc_CoverFree( pDef );            pImage = pTmp;        }                pSdc = Cvr_CoverComplement(pVm, pImage);        Mvc_CoverFree(pDomain);        Mvc_CoverFree(pImage);                if (pSdcAll) {            pTmp = Mvc_CoverBooleanOr(pSdcAll, pSdc);            Mvc_CoverFree(pSdcAll);            Mvc_CoverFree(pSdc);            pSdcAll = pTmp;        } else {            pSdcAll = pSdc;        }    }        FREE(pnPos);    return pSdcAll;}/**Function********************************************************************  Synopsis    [Return true if all fanins of the node is contained in the set.]    Description [Return true if all fanins of the node is contained in the  set. Return false if the node is a combinational input, or the node has only  one fanin (will not contribute to resub).]    SideEffects []  SeeAlso     []******************************************************************************/boolSimpTestSubsetSupport(    Ntk_Node_t *node,    st_table   *support) {    Ntk_Node_t *fanin;    Ntk_Pin_t *pPin;    char *dummy;        if (Ntk_NodeIsCi(node)) return FALSE;    if (Ntk_NodeReadFaninNum(node) <= 1) return FALSE;        Ntk_NodeForEachFanin(node, pPin, fanin) {        if(!st_lookup(support, (char *)fanin, &dummy)) {            return FALSE;        }    }    return TRUE;}/**Function********************************************************************  Synopsis    [Find the index of a node in an array.]  Description [Find the index of a node in an array.]  SideEffects []  SeeAlso     []******************************************************************************/intSimpNodeArrayFindIndex(    sarray_t   *node_list,    Ntk_Node_t *keynode) {    int i;    Ntk_Node_t *node;    if (node_list==NULL) return -1;    sarrayForEachItem(Ntk_Node_t *, node_list, i, node) {        if (node == keynode) return i;    }    return -1;}/**Function********************************************************************  Synopsis    [Compute the array of internal subset support nodes.]  Description [Compute the array of internal subset support nodes, which are  already in the fanin list.]  SideEffects []  SeeAlso     []******************************************************************************/sarray_t *SimpComputeSubsetSupportIntern(    Ntk_Node_t *node) {    Ntk_Node_t  *pFanin;    Ntk_Pin_t   *pPin;    st_table    *fnin_st;    sarray_t    *subset_list;        /* hash table for fanin list */    fnin_st = st_init_table(st_ptrcmp, st_ptrhash);    Ntk_NodeForEachFanin(node, pPin, pFanin) {        st_insert(fnin_st, (char *)pFanin, (char *)1);    }        /* find the internal subset support nodes */    subset_list = sarray_alloc( Ntk_Node_t *, Ntk_NodeReadFaninNum( node ) );    Ntk_NodeForEachFanin( node, pPin, pFanin ) {                if (SimpTestSubsetSupport( pFanin, fnin_st )) {            sarray_insert_last( Ntk_Node_t *, subset_list, pFanin );        }    }        st_free_table(fnin_st);    return subset_list;}/**Function********************************************************************  Synopsis    []  Description []  SideEffects []  SeeAlso     []******************************************************************************/Ntk_Node_t *SimpNodeCreateFromFanins(Ntk_Network_t *pNet, sarray_t *lFanin) {    int i;    Ntk_Node_t  *pNodeNew, *pFanin;        pNodeNew = Ntk_NodeCreate( pNet, NULL, MV_NODE_INT, 2 );    sarrayForEachItem(Ntk_Node_t *, lFanin, i, pFanin) {                Ntk_NodeAddFanin(pNodeNew, pFanin);    }    Ntk_NodeSetValueNum(pNodeNew, 2);    Ntk_NodeAssignVm(pNodeNew);    return pNodeNew;}/**Function********************************************************************  Synopsis    []  Description []  SideEffects []  SeeAlso     []******************************************************************************/voidSimpNodeAssignMvc(Ntk_Node_t *pNode, Mvc_Cover_t *pMvc){    Cvr_Cover_t *pCvrNew;    Mvc_Cover_t **pIsets;        pIsets    = ALLOC(Mvc_Cover_t *, 2);    pIsets[0] = NULL;    pIsets[1] = pMvc;    pCvrNew   = Cvr_CoverCreate( Ntk_NodeReadFuncVm(pNode), pIsets );    Ntk_NodeWriteFuncCvr( pNode, pCvrNew );    return;}//assume all columns are filled; remove unnecessary ones.voidMvc_CoverBitSet(Mvc_Cover_t *pMvc, Vm_VarMap_t *pVm, int iVar, int iValue){    int iBase, iSize, i;    Mvc_Cube_t *pCube;        iSize = Vm_VarMapReadValues(pVm, iVar);    iBase = Vm_VarMapReadValuesFirst(pVm, iVar);    Mvc_CoverForEachCube(pMvc, pCube) {        for ( i = 0; i < iSize; ++i ) {            if ( i != iValue)                 Mvc_CubeBitRemove(pCube, iBase + i);        }    }    return;}

⌨️ 快捷键说明

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