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

📄 simpimage.c

📁 主要进行大规模的电路综合
💻 C
📖 第 1 页 / 共 3 页
字号:
        }        else { /* Full set for lit2 */            temp = lit1;        }                Mva_FuncFree( pCof );        if (image) {            temp2 = Mvc_CoverBooleanOr(image, temp);            Mvc_CoverFree(image);            Mvc_CoverFree(temp);            image = temp2;        }        else {            image = temp;        }    }        return image;}/**Function********************************************************************  Synopsis    []  Description [Return the range of a list of functions by output cofacting.]  SideEffects []  SeeAlso     []******************************************************************************/Mvc_Cover_t *SimpRangeCofact(    Simp_Info_t *pInfo,    Vm_VarMap_t *pVm,    Mvc_Data_t  *pMvcData,     int         start_index,    var_set_t   *supset,    sarray_t    *listFuncs,    sarray_t    **base ){    int           i, k;    int           iStart, iFlag, iAccl, nComp;    Mvc_Cover_t  *pMvcImage, *pMvcPart, *pMvcTemp;    DdManager    *mg;    Mva_Func_t   *aMvfThis, *aMvfFunc, *aMvfConst, *aMvfCof;    sarray_t     **llRange;        mg = pInfo->ddmg;    iStart = iFlag = -1;    iAccl = 0;        /* compute output cofactoring */    for (i=start_index; i<sarray_n(listFuncs); ++i) {                aMvfThis = sarray_fetch( Mva_Func_t *, listFuncs, i);                if (!var_set_get_elt(supset,i) || aMvfThis == NULL) {            if (iFlag==-1) {                iAccl++;            }            else {                /* fill empty slots with NIL Mvf pointers                 *  nComp has already been set by now.                 */                for (k=0; k<nComp; ++k) {                    if (llRange[k]) {                        sarray_insert_last( Mva_Func_t *, llRange[k], NULL);                    }                }            }            continue;        }                /* 'i' is in this partition */        if (iFlag==-1) {            /* this is the first special one */            iFlag = i;            aMvfFunc = aMvfThis;            nComp = Mva_FuncReadIsetNum( aMvfThis );            llRange = ALLOC(sarray_t *, nComp);                        if (iStart == -1) {                iStart = start_index+iAccl;            }            for (k=0; k<nComp; ++k) {                                /* if this component is Null, it means this value is                   not reachable and no need to explore further (1/16/2002) */                if ( (aMvfFunc->pbFuncs[k] == NULL) ||                      aMvfFunc->pbFuncs[k] == Cudd_ReadLogicZero(mg) ) {                    llRange[k] = NULL;                }                else {                    llRange[k] = sarray_alloc( Mva_Func_t *, array_n(listFuncs));                    /* Hack some fake array elements */                    llRange[k]->num = iStart;                                        /* insert constant MDD's [0-k] */                    aMvfConst = Mva_FuncAllocConstant( mg, nComp, k );                    sarray_insert_last( Mva_Func_t *, llRange[k], aMvfConst );                }            }        }        else {            /* Cofactoring is done here (wrt. the first) */            for (k=0; k<nComp; ++k) {                                /* Check for only Non-Null components (1/16/2002) */                if ( llRange[k] ) {                                        aMvfCof = Mva_FuncCofactor( aMvfThis, aMvfFunc->pbFuncs[k] );                    sarray_insert_last( Mva_Func_t *, llRange[k], aMvfCof );                }            }        }    }        /* OR every thing together */    pMvcImage = NULL;    for (i=0; i<nComp; ++i) {                if (llRange[i]) {                        pMvcPart = SimpComputeRangeRecur(pInfo,&llRange[i],base,pVm,pMvcData,iStart);            if (pMvcPart) {                                if (pMvcImage) {                    pMvcTemp = Mvc_CoverBooleanOr(pMvcImage, pMvcPart);                    Mvc_CoverFree(pMvcPart);                    Mvc_CoverFree(pMvcImage);                    pMvcImage = pMvcTemp;                }                else {                    pMvcImage = pMvcPart;                }            }        }    }        SimpMvaArrayListFree( llRange, nComp, start_index);        return pMvcImage;}/**Function********************************************************************  Synopsis    [Returns a literal cube]  Description [Given a var map, find the variable/column with `index', and  return a single literal cover with a single value `value'.]  SideEffects []  SeeAlso     []******************************************************************************/Mvc_Cover_t *SimpCubeLiteral(    Mvc_Manager_t * pMem,    Vm_VarMap_t   * pVm,    int             index,    int             value) {    int  base,i,size;    Mvc_Cover_t * pMvcLit;    Mvc_Cube_t  * pMvcCube;        pMvcLit = Mvc_CoverAlloc( pMem, Vm_VarMapReadValuesInNum(pVm) );    pMvcCube = Mvc_CubeAlloc( pMvcLit );    base = Vm_VarMapReadValuesFirst( pVm,index );    size = Vm_VarMapReadValues( pVm,index );    Mvc_CubeBitFill( pMvcCube );        for (i=0; i<size; ++i) {        if (i != value)            Mvc_CubeBitRemove( pMvcCube, (base+i) );    }    Mvc_CoverAddCubeTail ( pMvcLit, pMvcCube );        return pMvcLit;}/**Function********************************************************************  Synopsis    [Returns a literal cube]  Description [Given a var map, find the variable/column with `index', and  return a single literal cover with a a range of values contained in the  array `value_range'.]  SideEffects []  SeeAlso     []******************************************************************************/Mvc_Cover_t *SimpCubeLiteralRange(    Mvc_Manager_t * pMem,    Vm_VarMap_t   * pVm,    int             index,    sarray_t      * aRange) {    int  base,i,size,val;    Mvc_Cover_t * pMvcLit;    Mvc_Cube_t  * pMvcCube;        /* empty range */    if (sarray_n(aRange)==0) {        pMvcLit = Mvc_CoverAlloc( pMem, Vm_VarMapReadValuesInNum(pVm) );        return pMvcLit;    }        pMvcLit = Mvc_CoverAlloc( pMem, Vm_VarMapReadValuesInNum(pVm) );    pMvcCube = Mvc_CubeAlloc( pMvcLit );    base = Vm_VarMapReadValuesFirst( pVm,index );    size = Vm_VarMapReadValues( pVm,index );    Mvc_CubeBitFill( pMvcCube );        for (i=0; i<size; ++i) {        Mvc_CubeBitRemove( pMvcCube, base+i );    }    for (i=0; i<sarray_n(aRange); ++i) {        val = sarray_fetch(int, aRange, i);        Mvc_CubeBitInsert( pMvcCube, (base+val) );    }    Mvc_CoverAddCubeTail ( pMvcLit, pMvcCube );        return pMvcLit;}/**Function********************************************************************  Synopsis    [Compute the literal cube from a Mvf MDD array.]  Description [The values in the literal cube corresponds to the non-empty  components (parts) in the Mvf MDD array. Returns Mvc_Cover_t * of the  literal if there is at least one empty part; returns NULL if no empty part  (full-set).]  SideEffects []  SeeAlso     []******************************************************************************/Mvc_Cover_t *SimpCubeLiteralImage(    Mvc_Manager_t * pMem,    Vm_VarMap_t   * pVm,    DdManager     * ddmg,    int             index,    Mva_Func_t    * pMva) {    int i, empty_flag;    sarray_t     * aRanges;    Mvc_Cover_t * pMvcLit;        empty_flag = 0;    aRanges = sarray_alloc( int, pMva->nIsets );        for (i=0; i < pMva->nIsets; ++i) {                if ( pMva->pbFuncs[i] &&             pMva->pbFuncs[i] != Cudd_ReadLogicZero(ddmg) ) {            sarray_insert_last( int, aRanges, i );        }        else {            empty_flag = 1;        }    }    if (empty_flag) {        pMvcLit = SimpCubeLiteralRange( pMem, pVm, index, aRanges );    }    else {        pMvcLit = NULL;    }        sarray_free(aRanges);    return pMvcLit;}/**Function********************************************************************  Synopsis    [Return TRUE if the direct fanins are all CI's.]  Description []  SideEffects []  SeeAlso     []******************************************************************************/boolSimpNodeCheckSupport (    Ntk_Node_t *node) {    Ntk_Node_t *pFanin;    Ntk_Pin_t  *pPin;    Ntk_NodeForEachFanin(node, pPin, pFanin) {        if (!Ntk_NodeIsCi(pFanin)) {            return FALSE;        }    }    return TRUE;}/**Function********************************************************************  Synopsis    []  Description []  SideEffects []  SeeAlso     []******************************************************************************/Mvc_Data_t *SimpAllocateMvcData( Ntk_Node_t *pNode ){    int           i, nVals;    Vm_VarMap_t  *pVm;    Cvr_Cover_t  *pCvr;    Mvc_Cover_t  **pIsets;        pVm   = Ntk_NodeReadFuncVm( pNode );    pCvr  = Ntk_NodeReadFuncCvr( pNode );    nVals = Vm_VarMapReadValuesOutNum( pVm );    pIsets = Cvr_CoverReadIsets( pCvr );        for ( i = 0; i < nVals; ++i ) {        if ( pIsets[i] )            return Mvc_CoverDataAlloc( pVm, pIsets[i] );    }        return NULL;}voidSimpFreeMvcData( Ntk_Node_t *pNode, Mvc_Data_t *pMvcData ){    int           i, nVals;    Vm_VarMap_t  *pVm;    Cvr_Cover_t  *pCvr;    Mvc_Cover_t  **pIsets;        pVm   = Ntk_NodeReadFuncVm( pNode );    pCvr  = Ntk_NodeReadFuncCvr( pNode );    nVals = Vm_VarMapReadValuesOutNum( pVm );    pIsets = Cvr_CoverReadIsets( pCvr );        for ( i = 0; i < nVals; ++i ) {        if ( pIsets[i] ) {            Mvc_CoverDataFree( pMvcData, pIsets[i] );            break;        }    }    return;}

⌨️ 快捷键说明

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