/**Function************************************************************* Synopsis [Deletes AIG.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Cec_ManPatStop( Cec_ManPat_t * p ) { Vec_StrFree( p->vStorage ); Vec_IntFree( p->vPattern1 ); Vec_IntFree( p->vPattern2 ); ABC_FREE( p ); }
/**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Abc_FrameDeallocate( Abc_Frame_t * p ) { extern void Rwt_ManGlobalStop(); extern void undefine_cube_size(); // extern void Ivy_TruthManStop(); // Abc_HManStop(); // undefine_cube_size(); Rwt_ManGlobalStop(); // Ivy_TruthManStop(); if ( p->vAbcObjIds) Vec_IntFree( p->vAbcObjIds ); if ( p->vCexVec ) Vec_PtrFreeFree( p->vCexVec ); if ( p->vPoEquivs ) Vec_VecFree( (Vec_Vec_t *)p->vPoEquivs ); if ( p->vStatuses ) Vec_IntFree( p->vStatuses ); if ( p->pLibVer ) Abc_LibFree( (Abc_Lib_t *)p->pLibVer, NULL ); if ( p->pManDec ) Dec_ManStop( (Dec_Man_t *)p->pManDec ); if ( p->dd ) Extra_StopManager( p->dd ); if ( p->vStore ) Vec_PtrFree( p->vStore ); if ( p->pSave1 ) Aig_ManStop( (Aig_Man_t *)p->pSave1 ); if ( p->pSave2 ) Aig_ManStop( (Aig_Man_t *)p->pSave2 ); if ( p->pSave3 ) Aig_ManStop( (Aig_Man_t *)p->pSave3 ); if ( p->pSave4 ) Aig_ManStop( (Aig_Man_t *)p->pSave4 ); if ( p->vPlugInComBinPairs ) { char * pTemp; int i; Vec_PtrForEachEntry( char *, p->vPlugInComBinPairs, pTemp, i ) ABC_FREE( pTemp ); Vec_PtrFree( p->vPlugInComBinPairs ); }
/**Function************************************************************* Synopsis [Stops the simulation manager.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Sym_ManStop( Sym_Man_t * p ) { int i; Sym_ManPrintStats( p ); if ( p->vSuppFun ) Sim_UtilInfoFree( p->vSuppFun ); if ( p->vSim ) Sim_UtilInfoFree( p->vSim ); if ( p->vNodes ) Vec_PtrFree( p->vNodes ); if ( p->vSupports ) Vec_VecFree( p->vSupports ); for ( i = 0; i < p->nOutputs; i++ ) { Extra_BitMatrixStop( p->vMatrSymms->pArray[i] ); Extra_BitMatrixStop( p->vMatrNonSymms->pArray[i] ); } Vec_IntFree( p->vVarsU ); Vec_IntFree( p->vVarsV ); Vec_PtrFree( p->vMatrSymms ); Vec_PtrFree( p->vMatrNonSymms ); Vec_IntFree( p->vPairsTotal ); Vec_IntFree( p->vPairsSym ); Vec_IntFree( p->vPairsNonSym ); FREE( p->uPatRand ); FREE( p->uPatCol ); FREE( p->uPatRow ); free( p ); }
/**Function************************************************************* Synopsis [Implements the retiming on the sequential AIG.] Description [Split the retiming into forward and backward.] SideEffects [] SeeAlso [] ***********************************************************************/ int Seq_NtkImplementRetiming( Abc_Ntk_t * pNtk, Vec_Str_t * vLags, int fVerbose ) { Vec_Int_t * vSteps; Vec_Ptr_t * vMoves; int RetValue; // forward retiming vSteps = Abc_NtkUtilRetimingSplit( vLags, 1 ); // translate each set of steps into moves if ( fVerbose ) printf( "The number of forward steps = %6d.\n", Vec_IntSize(vSteps) ); vMoves = Abc_NtkUtilRetimingGetMoves( pNtk, vSteps, 1 ); if ( fVerbose ) printf( "The number of forward moves = %6d.\n", Vec_PtrSize(vMoves) ); // implement this retiming Seq_NtkImplementRetimingForward( pNtk, vMoves ); Vec_IntFree( vSteps ); Vec_PtrFree( vMoves ); // backward retiming vSteps = Abc_NtkUtilRetimingSplit( vLags, 0 ); // translate each set of steps into moves if ( fVerbose ) printf( "The number of backward steps = %6d.\n", Vec_IntSize(vSteps) ); vMoves = Abc_NtkUtilRetimingGetMoves( pNtk, vSteps, 0 ); if ( fVerbose ) printf( "The number of backward moves = %6d.\n", Vec_PtrSize(vMoves) ); // implement this retiming RetValue = Seq_NtkImplementRetimingBackward( pNtk, vMoves, fVerbose ); Vec_IntFree( vSteps ); Vec_PtrFree( vMoves ); return RetValue; }
/**Function************************************************************* Synopsis [Stops the MVC maanager used in the factoring package.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Dec_ManStop( Dec_Man_t * p ) { Mvc_ManagerFree( p->pMvcMem ); Vec_IntFree( p->vCubes ); Vec_IntFree( p->vLits ); free( p->puCanons ); free( p->pPhases ); free( p->pPerms ); free( p->pMap ); free( p ); }
/**Function************************************************************* Synopsis [Frees the manager.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Cec_ManSatStop( Cec_ManSat_t * p ) { if ( p->pSat ) sat_solver_delete( p->pSat ); Vec_IntFree( p->vCex ); Vec_IntFree( p->vVisits ); Vec_PtrFree( p->vUsedNodes ); Vec_PtrFree( p->vFanins ); ABC_FREE( p->pSatVars ); ABC_FREE( p ); }
Vec_Wec_t * Gia_ManComputeMffcs( Gia_Man_t * p, int LimitMin, int LimitMax, int SuppMax, int RatioBest ) { Gia_Obj_t * pObj; Vec_Wec_t * vMffcs; Vec_Int_t * vNodes, * vLeaves, * vInners, * vMffc; int i, iPivot; assert( p->pMuxes ); vNodes = Vec_IntAlloc( 2 * LimitMax ); vLeaves = Vec_IntAlloc( 2 * LimitMax ); vInners = Vec_IntAlloc( 2 * LimitMax ); vMffcs = Vec_WecAlloc( 1000 ); Gia_ManCreateRefs( p ); Gia_ManForEachAnd( p, pObj, i ) { if ( !Gia_ObjRefNum(p, pObj) ) continue; if ( !Gia_ObjCheckMffc(p, pObj, LimitMax, vNodes, vLeaves, vInners) ) continue; if ( Vec_IntSize(vInners) < LimitMin ) continue; if ( Vec_IntSize(vLeaves) > SuppMax ) continue; // improve cut // collect cut vMffc = Vec_WecPushLevel( vMffcs ); Vec_IntGrow( vMffc, Vec_IntSize(vLeaves) + Vec_IntSize(vInners) + 20 ); Vec_IntPush( vMffc, i ); Vec_IntPush( vMffc, Vec_IntSize(vLeaves) ); Vec_IntPush( vMffc, Vec_IntSize(vInners) ); Vec_IntAppend( vMffc, vLeaves ); // Vec_IntAppend( vMffc, vInners ); // add last entry equal to the ratio Vec_IntPush( vMffc, 1000 * Vec_IntSize(vInners) / Vec_IntSize(vLeaves) ); } Vec_IntFree( vNodes ); Vec_IntFree( vLeaves ); Vec_IntFree( vInners ); // sort MFFCs by their inner/leaf ratio Vec_WecSortByLastInt( vMffcs, 1 ); Vec_WecForEachLevel( vMffcs, vMffc, i ) Vec_IntPop( vMffc ); // remove those whose ratio is not good iPivot = RatioBest * Vec_WecSize(vMffcs) / 100; Vec_WecForEachLevelStart( vMffcs, vMffc, i, iPivot ) Vec_IntErase( vMffc ); assert( iPivot <= Vec_WecSize(vMffcs) ); Vec_WecShrink( vMffcs, iPivot ); return vMffcs; }
/**Function************************************************************* Synopsis [Computes equivalence classes of objects in pNtk1 and pNtk2.] Description [Internal procedure.] SideEffects [] SeeAlso [] ***********************************************************************/ Vec_Ptr_t * Abc_NtkDressMapIds( Aig_Man_t * pMiter, Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2 ) { Vec_Ptr_t * vRes; Vec_Int_t * vId2Lit1, * vId2Lit2, * vCounts0, * vCounts1, * vClassC, * vClass2Num; int i, Class; // start the classes vRes = Vec_PtrAlloc( 1000 ); // set polarity of the nodes Abc_NtkDressMapSetPolarity( pNtk1 ); Abc_NtkDressMapSetPolarity( pNtk2 ); // create mapping of node IDs of pNtk1/pNtk2 into the IDs of equiv classes of pMiter vId2Lit1 = Abc_NtkDressMapClasses( pMiter, pNtk1 ); vId2Lit2 = Abc_NtkDressMapClasses( pMiter, pNtk2 ); // count the number of nodes in each equivalence class vCounts0 = Vec_IntStart( Aig_ManObjNumMax(pMiter) ); Vec_IntForEachEntry( vId2Lit1, Class, i ) if ( Class >= 0 ) Vec_IntAddToEntry( vCounts0, Class, 1 ); vCounts1 = Vec_IntStart( Aig_ManObjNumMax(pMiter) ); Vec_IntForEachEntry( vId2Lit2, Class, i ) if ( Class >= 0 ) Vec_IntAddToEntry( vCounts1, Class, 1 ); // get the costant class vClassC = Vec_IntAlloc( 100 ); Vec_IntForEachEntry( vId2Lit1, Class, i ) if ( Class == 0 ) Vec_IntPush( vClassC, Abc_ObjDressMakeId(pNtk1, i, 0) ); Vec_IntForEachEntry( vId2Lit2, Class, i ) if ( Class == 0 ) Vec_IntPush( vClassC, Abc_ObjDressMakeId(pNtk2, i, 1) ); Vec_PtrPush( vRes, vClassC ); // map repr node IDs into class numbers vClass2Num = Vec_IntAlloc( 0 ); Vec_IntFill( vClass2Num, Aig_ManObjNumMax(pMiter), -1 ); // keep classes having at least one element from pNtk1 and one from pNtk2 Vec_IntForEachEntry( vId2Lit1, Class, i ) if ( Class > 0 && Vec_IntEntry(vCounts0, Class) && Vec_IntEntry(vCounts1, Class) ) Vec_IntPush( Abc_ObjDressClass(vRes, vClass2Num, Class), Abc_ObjDressMakeId(pNtk1, i, 0) ); Vec_IntForEachEntry( vId2Lit2, Class, i ) if ( Class > 0 && Vec_IntEntry(vCounts0, Class) && Vec_IntEntry(vCounts1, Class) ) Vec_IntPush( Abc_ObjDressClass(vRes, vClass2Num, Class), Abc_ObjDressMakeId(pNtk2, i, 1) ); // package them accordingly Vec_IntFree( vClass2Num ); Vec_IntFree( vCounts0 ); Vec_IntFree( vCounts1 ); Vec_IntFree( vId2Lit1 ); Vec_IntFree( vId2Lit2 ); return vRes; }
/**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Cbs0_ManStop( Cbs0_Man_t * p ) { Vec_IntFree( p->vModel ); ABC_FREE( p->pProp.pData ); ABC_FREE( p->pJust.pData ); ABC_FREE( p ); }
/**Function************************************************************* Synopsis [Duplicates AIG according to the timing manager.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ Gia_Man_t * Gia_ManDupUnnormalize( Gia_Man_t * p ) { Vec_Int_t * vNodes; Gia_Man_t * pNew; Gia_Obj_t * pObj; int i; vNodes = Gia_ManOrderWithBoxes( p ); if ( vNodes == NULL ) return NULL; Gia_ManFillValue( p ); pNew = Gia_ManStart( Gia_ManObjNum(p) ); pNew->pName = Abc_UtilStrsav( p->pName ); pNew->pSpec = Abc_UtilStrsav( p->pSpec ); if ( p->pSibls ) pNew->pSibls = ABC_CALLOC( int, Gia_ManObjNum(p) ); Gia_ManForEachObjVec( vNodes, p, pObj, i ) { if ( Gia_ObjIsAnd(pObj) ) { pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) ); if ( Gia_ObjSibl(p, Gia_ObjId(p, pObj)) ) pNew->pSibls[Abc_Lit2Var(pObj->Value)] = Abc_Lit2Var(Gia_ObjSiblObj(p, Gia_ObjId(p, pObj))->Value); } else if ( Gia_ObjIsCi(pObj) ) pObj->Value = Gia_ManAppendCi( pNew ); else if ( Gia_ObjIsCo(pObj) ) pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) ); else if ( Gia_ObjIsConst0(pObj) ) pObj->Value = 0; else assert( 0 ); } Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) ); Vec_IntFree( vNodes ); return pNew; }
// pProgress = Bar_ProgressStart( stdout, Aig_ManCoNum(p) ); Aig_ManForEachCo( p, pObj, i ) { // Bar_ProgressUpdate( pProgress, i, NULL ); // get old supports vSup = Vec_VecEntryInt( vSupps, i ); if ( Vec_IntSize(vSup) < 2 ) continue; // compute new supports CountOver = CountQuant = 0; vSupNew = Vec_IntDup( vSup ); // go through the nodes where the first var appears Aig_ManForEachCo( p, pObj, k ) // iVar = Vec_IntEntry( vSup, 0 ); // vSupIn = Vec_VecEntry( vSuppsIn, iVar ); // Vec_IntForEachEntry( vSupIn, Entry, k ) { // pObj = Aig_ManObj( p, Entry ); // get support of this output // vSup2 = (Vec_Int_t *)pObj->pNext; vSup2 = Vec_VecEntryInt( vSupps, k ); // count the number of common vars nCommon = Vec_IntTwoCountCommon(vSup, vSup2); if ( nCommon < 2 ) continue; if ( nCommon > nComLim ) { vSupNew = Vec_IntTwoMerge( vTemp = vSupNew, vSup2 ); Vec_IntFree( vTemp ); CountOver++; } else CountQuant++; }
void Gia_ManPrintTents( Gia_Man_t * p ) { Vec_Int_t * vObjs; Gia_Obj_t * pObj; int t, i, iObjId, nSizePrev, nSizeCurr; assert( Gia_ManPoNum(p) > 0 ); vObjs = Vec_IntAlloc( 100 ); // save constant class Gia_ManIncrementTravId( p ); Gia_ObjSetTravIdCurrent( p, Gia_ManConst0(p) ); Vec_IntPush( vObjs, 0 ); // create starting root nSizePrev = Vec_IntSize(vObjs); Gia_ManForEachPo( p, pObj, i ) Gia_ManPrintTents_rec( p, pObj, vObjs ); // build tents printf( "Tents: " ); for ( t = 1; nSizePrev < Vec_IntSize(vObjs); t++ ) { nSizeCurr = Vec_IntSize(vObjs); Vec_IntForEachEntryStartStop( vObjs, iObjId, i, nSizePrev, nSizeCurr ) if ( Gia_ObjIsRo(p, Gia_ManObj(p, iObjId)) ) Gia_ManPrintTents_rec( p, Gia_ObjRoToRi(p, Gia_ManObj(p, iObjId)), vObjs ); printf( "%d=%d ", t, nSizeCurr - nSizePrev ); nSizePrev = nSizeCurr; } printf( " Unused=%d\n", Gia_ManObjNum(p) - Vec_IntSize(vObjs) ); Vec_IntFree( vObjs ); // the remaining objects are PIs without fanout // Gia_ManForEachObj( p, pObj, i ) // if ( !Gia_ObjIsTravIdCurrent(p, pObj) ) // Gia_ObjPrint( p, pObj ); }
/**Function************************************************************* Synopsis [Removes one variable.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Llb_NonlinRemoveVar( Llb_Mgr_t * p, Llb_Var_t * pVar ) { assert( p->pVars[pVar->iVar] == pVar ); p->pVars[pVar->iVar] = NULL; Vec_IntFree( pVar->vParts ); ABC_FREE( pVar ); }
/**Function************************************************************* Synopsis [Frees the interpolation manager.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Inter_ManStop( Inter_Man_t * p ) { if ( p->fVerbose ) { p->timeOther = p->timeTotal-p->timeRwr-p->timeCnf-p->timeSat-p->timeInt-p->timeEqu; printf( "Runtime statistics:\n" ); ABC_PRTP( "Rewriting ", p->timeRwr, p->timeTotal ); ABC_PRTP( "CNF mapping", p->timeCnf, p->timeTotal ); ABC_PRTP( "SAT solving", p->timeSat, p->timeTotal ); ABC_PRTP( "Interpol ", p->timeInt, p->timeTotal ); ABC_PRTP( "Containment", p->timeEqu, p->timeTotal ); ABC_PRTP( "Other ", p->timeOther, p->timeTotal ); ABC_PRTP( "TOTAL ", p->timeTotal, p->timeTotal ); } if ( p->pCnfAig ) Cnf_DataFree( p->pCnfAig ); if ( p->pCnfFrames ) Cnf_DataFree( p->pCnfFrames ); if ( p->pCnfInter ) Cnf_DataFree( p->pCnfInter ); Vec_IntFree( p->vVarsAB ); if ( p->pAigTrans ) Aig_ManStop( p->pAigTrans ); if ( p->pFrames ) Aig_ManStop( p->pFrames ); if ( p->pInter ) Aig_ManStop( p->pInter ); if ( p->pInterNew ) Aig_ManStop( p->pInterNew ); ABC_FREE( p ); }
/**Function************************************************************* Synopsis [Collects AND/EXOR nodes in the DFS order from CIs to COs.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ Vec_Int_t * Ivy_ManDfsSeq( Ivy_Man_t * p, Vec_Int_t ** pvLatches ) { Vec_Int_t * vNodes, * vLatches; Ivy_Obj_t * pObj; int i; // assert( Ivy_ManLatchNum(p) > 0 ); // make sure the nodes are not marked Ivy_ManForEachObj( p, pObj, i ) assert( !pObj->fMarkA && !pObj->fMarkB ); // collect the latches vLatches = Vec_IntAlloc( Ivy_ManLatchNum(p) ); Ivy_ManForEachLatch( p, pObj, i ) Vec_IntPush( vLatches, pObj->Id ); // collect the nodes vNodes = Vec_IntAlloc( Ivy_ManNodeNum(p) ); Ivy_ManForEachPo( p, pObj, i ) Ivy_ManDfs_rec( p, Ivy_ObjFanin0(pObj), vNodes ); Ivy_ManForEachNodeVec( p, vLatches, pObj, i ) Ivy_ManDfs_rec( p, Ivy_ObjFanin0(pObj), vNodes ); // unmark the collected nodes // Ivy_ManForEachNodeVec( p, vNodes, pObj, i ) // Ivy_ObjClearMarkA(pObj); Ivy_ManForEachObj( p, pObj, i ) Ivy_ObjClearMarkA(pObj); // make sure network does not have dangling nodes // assert( Vec_IntSize(vNodes) == Ivy_ManNodeNum(p) + Ivy_ManBufNum(p) ); // temporary!!! if ( pvLatches == NULL ) Vec_IntFree( vLatches ); else *pvLatches = vLatches; return vNodes; }
void Cnf_AddCardinConstrTest() { int i, status, nVars = 7; Vec_Int_t * vVars = Vec_IntStartNatural( nVars ); sat_solver * pSat = sat_solver_new(); sat_solver_setnvars( pSat, nVars ); Cnf_AddCardinConstr( pSat, vVars ); while ( 1 ) { status = sat_solver_solve( pSat, NULL, NULL, 0, 0, 0, 0 ); if ( status != l_True ) break; Vec_IntClear( vVars ); for ( i = 0; i < nVars; i++ ) { Vec_IntPush( vVars, Abc_Var2Lit(i, sat_solver_var_value(pSat, i)) ); printf( "%d", sat_solver_var_value(pSat, i) ); } printf( "\n" ); status = sat_solver_addclause( pSat, Vec_IntArray(vVars), Vec_IntArray(vVars) + Vec_IntSize(vVars) ); if ( status == 0 ) break; } sat_solver_delete( pSat ); Vec_IntFree( vVars ); }
Gia_Man_t * Gia_ManFromMiniAig( Mini_Aig_t * p ) { Gia_Man_t * pGia, * pTemp; Vec_Int_t * vCopies; int i, iGiaLit, nNodes; // get the number of nodes nNodes = Mini_AigNodeNum(p); // create ABC network pGia = Gia_ManStart( nNodes ); pGia->pName = Abc_UtilStrsav( "MiniAig" ); // create mapping from MiniAIG objects into ABC objects vCopies = Vec_IntAlloc( nNodes ); Vec_IntPush( vCopies, 0 ); // iterate through the objects Gia_ManHashAlloc( pGia ); for ( i = 1; i < nNodes; i++ ) { if ( Mini_AigNodeIsPi( p, i ) ) iGiaLit = Gia_ManAppendCi(pGia); else if ( Mini_AigNodeIsPo( p, i ) ) iGiaLit = Gia_ManAppendCo(pGia, Gia_ObjFromMiniFanin0Copy(pGia, vCopies, p, i)); else if ( Mini_AigNodeIsAnd( p, i ) ) iGiaLit = Gia_ManHashAnd(pGia, Gia_ObjFromMiniFanin0Copy(pGia, vCopies, p, i), Gia_ObjFromMiniFanin1Copy(pGia, vCopies, p, i)); else assert( 0 ); Vec_IntPush( vCopies, iGiaLit ); } Gia_ManHashStop( pGia ); assert( Vec_IntSize(vCopies) == nNodes ); Vec_IntFree( vCopies ); Gia_ManSetRegNum( pGia, Mini_AigRegNum(p) ); pGia = Gia_ManCleanup( pTemp = pGia ); Gia_ManStop( pTemp ); return pGia; }
/**Function************************************************************* Synopsis [Interface with the FPGA mapping package.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ Abc_Ntk_t * Abc_NtkFpga( Abc_Ntk_t * pNtk, float DelayTarget, int fRecovery, int fSwitching, int fLatchPaths, int fVerbose ) { int fShowSwitching = 1; Abc_Ntk_t * pNtkNew; Fpga_Man_t * pMan; Vec_Int_t * vSwitching; float * pSwitching = NULL; assert( Abc_NtkIsStrash(pNtk) ); // print a warning about choice nodes if ( Abc_NtkGetChoiceNum( pNtk ) ) printf( "Performing FPGA mapping with choices.\n" ); // compute switching activity fShowSwitching |= fSwitching; if ( fShowSwitching ) { extern Vec_Int_t * Sim_NtkComputeSwitching( Abc_Ntk_t * pNtk, int nPatterns ); vSwitching = Sim_NtkComputeSwitching( pNtk, 4096 ); pSwitching = (float *)vSwitching->pArray; } // perform FPGA mapping pMan = Abc_NtkToFpga( pNtk, fRecovery, pSwitching, fLatchPaths, fVerbose ); if ( pSwitching ) Vec_IntFree( vSwitching ); if ( pMan == NULL ) return NULL; Fpga_ManSetSwitching( pMan, fSwitching ); Fpga_ManSetLatchPaths( pMan, fLatchPaths ); Fpga_ManSetLatchNum( pMan, Abc_NtkLatchNum(pNtk) ); Fpga_ManSetDelayTarget( pMan, DelayTarget ); if ( !Fpga_Mapping( pMan ) ) { Fpga_ManFree( pMan ); return NULL; } // transform the result of mapping into a BDD network pNtkNew = Abc_NtkFromFpga( pMan, pNtk ); if ( pNtkNew == NULL ) return NULL; Fpga_ManFree( pMan ); // make the network minimum base Abc_NtkMinimumBase( pNtkNew ); if ( pNtk->pExdc ) pNtkNew->pExdc = Abc_NtkDup( pNtk->pExdc ); // make sure that everything is okay if ( !Abc_NtkCheck( pNtkNew ) ) { printf( "Abc_NtkFpga: The network check has failed.\n" ); Abc_NtkDelete( pNtkNew ); return NULL; } return pNtkNew; }
/**Function************************************************************* Synopsis [Deletes AIG.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Cec_ManSimStop( Cec_ManSim_t * p ) { Vec_IntFree( p->vClassOld ); Vec_IntFree( p->vClassNew ); Vec_IntFree( p->vClassTemp ); Vec_IntFree( p->vRefinedC ); if ( p->vCiSimInfo ) Vec_PtrFree( p->vCiSimInfo ); if ( p->vCoSimInfo ) Vec_PtrFree( p->vCoSimInfo ); ABC_FREE( p->pScores ); ABC_FREE( p->pCexComb ); ABC_FREE( p->pCexes ); ABC_FREE( p->pMems ); ABC_FREE( p->pSimInfo ); ABC_FREE( p ); }
/**Function************************************************************* Synopsis [Removes one partition.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Llb_NonlinRemovePart( Llb_Mgr_t * p, Llb_Prt_t * pPart ) { assert( p->pParts[pPart->iPart] == pPart ); p->pParts[pPart->iPart] = NULL; Vec_IntFree( pPart->vVars ); Cudd_RecursiveDeref( p->dd, pPart->bFunc ); ABC_FREE( pPart ); }
/**Function************************************************************* Synopsis [Deletes AIG.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Gia_ManStop( Gia_Man_t * p ) { Gia_ManStaticFanoutStop( p ); Tim_ManStopP( (Tim_Man_t **)&p->pManTime ); assert( p->pManTime == NULL ); Vec_PtrFreeFree( p->vNamesIn ); Vec_PtrFreeFree( p->vNamesOut ); Vec_FltFreeP( &p->vTiming ); Vec_VecFreeP( &p->vClockDoms ); Vec_IntFreeP( &p->vLutConfigs ); Vec_IntFreeP( &p->vUserPiIds ); Vec_IntFreeP( &p->vUserPoIds ); Vec_IntFreeP( &p->vUserFfIds ); Vec_IntFreeP( &p->vFlopClasses ); Vec_IntFreeP( &p->vGateClasses ); Vec_IntFreeP( &p->vObjClasses ); Vec_IntFreeP( &p->vLevels ); Vec_IntFreeP( &p->vTruths ); Vec_StrFreeP( &p->vTtNums ); Vec_IntFreeP( &p->vTtNodes ); Vec_WrdFreeP( &p->vTtMemory ); Vec_PtrFreeP( &p->vTtInputs ); Vec_IntFreeP( &p->vMapping ); Vec_IntFree( p->vCis ); Vec_IntFree( p->vCos ); ABC_FREE( p->pData2 ); ABC_FREE( p->pTravIds ); ABC_FREE( p->pPlacement ); ABC_FREE( p->pSwitching ); ABC_FREE( p->pCexSeq ); ABC_FREE( p->pCexComb ); ABC_FREE( p->pIso ); ABC_FREE( p->pMapping ); ABC_FREE( p->pFanData ); ABC_FREE( p->pReprsOld ); ABC_FREE( p->pReprs ); ABC_FREE( p->pNexts ); ABC_FREE( p->pRefs ); ABC_FREE( p->pNodeRefs ); ABC_FREE( p->pHTable ); ABC_FREE( p->pObjs ); ABC_FREE( p->pSpec ); ABC_FREE( p->pName ); ABC_FREE( p ); }
int Gia_Iso3Unique( Vec_Int_t * vSign ) { int nUnique; Vec_Int_t * vCopy = Vec_IntDup( vSign ); Vec_IntUniqify( vCopy ); nUnique = Vec_IntSize(vCopy); Vec_IntFree( vCopy ); return nUnique; }
/**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Mpm_ManStop( Mpm_Man_t * p ) { if ( p->pPars->fUseTruth && p->pPars->fVeryVerbose ) { char * pFileName = "truths.txt"; FILE * pFile = fopen( pFileName, "wb" ); Vec_MemDump( pFile, p->vTtMem ); fclose( pFile ); printf( "Dumped %d %d-var truth tables into file \"%s\" (%.2f MB).\n", Vec_MemEntryNum(p->vTtMem), p->nLutSize, pFileName, (16.0 * p->nTruWords + 1.0) * Vec_MemEntryNum(p->vTtMem) / (1 << 20) ); } if ( p->pPars->fUseDsd && p->pPars->fVerbose ) Mpm_ManPrintDsdStats( p ); if ( p->vTtMem ) { Vec_MemHashFree( p->vTtMem ); Vec_MemFree( p->vTtMem ); } if ( p->pHash ) { Vec_WrdFree( p->vPerm6 ); Vec_IntFree( p->vMap2Perm ); Vec_IntFree( p->vConfgRes ); Vec_IntFree( p->pHash->vData ); Hsh_IntManStop( p->pHash ); } Vec_WecFreeP( &p->vNpnConfigs ); Vec_PtrFree( p->vTemp ); Mmr_StepStop( p->pManCuts ); ABC_FREE( p->vFreeUnits.pArray ); // mapping attributes ABC_FREE( p->vCutBests.pArray ); ABC_FREE( p->vCutLists.pArray ); ABC_FREE( p->vMigRefs.pArray ); ABC_FREE( p->vMapRefs.pArray ); ABC_FREE( p->vEstRefs.pArray ); ABC_FREE( p->vRequireds.pArray ); ABC_FREE( p->vTimes.pArray ); ABC_FREE( p->vAreas.pArray ); ABC_FREE( p->vEdges.pArray ); ABC_FREE( p ); }
static inline void Swp_ManStop( Gia_Man_t * pGia ) { Swp_Man_t * p = (Swp_Man_t *)pGia->pData; sat_solver_delete( p->pSat ); Vec_IntFree( p->vFanins ); Vec_IntFree( p->vCexSwp ); Vec_IntFree( p->vId2Lit ); Vec_IntFree( p->vFront ); Vec_IntFree( p->vProbes ); Vec_IntFree( p->vProbRefs ); Vec_IntFree( p->vLit2Prob ); Vec_IntFree( p->vCondProbes ); Vec_IntFree( p->vCondAssump ); ABC_FREE( p ); pGia->pData = NULL; }
/**Function************************************************************* Synopsis [Stops the rewriting manager.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Dar_ManRefStop( Ref_Man_t * p ) { if ( p->pPars->fVerbose ) Dar_ManRefPrintStats( p ); Vec_VecFree( p->vCuts ); Vec_PtrFree( p->vTruthElem ); Vec_PtrFree( p->vTruthStore ); Vec_PtrFree( p->vLeavesBest ); Vec_IntFree( p->vMemory ); Vec_PtrFree( p->vCutNodes ); free( p ); }
/**Function************************************************************* Synopsis [Deletes the manager.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Fra_ClauStop( Cla_Man_t * p ) { ABC_FREE( p->pMapCsMainToCsTest ); ABC_FREE( p->pMapCsTestToCsMain ); ABC_FREE( p->pMapCsTestToNsTest ); ABC_FREE( p->pMapCsTestToNsBmc ); Vec_IntFree( p->vSatVarsMainCs ); Vec_IntFree( p->vSatVarsTestCs ); Vec_IntFree( p->vSatVarsTestNs ); Vec_IntFree( p->vSatVarsBmcNs ); Vec_IntFree( p->vCexMain0 ); Vec_IntFree( p->vCexMain ); Vec_IntFree( p->vCexTest ); Vec_IntFree( p->vCexBase ); Vec_IntFree( p->vCexAssm ); Vec_IntFree( p->vCexBmc ); if ( p->pSatMain ) sat_solver_delete( p->pSatMain ); if ( p->pSatTest ) sat_solver_delete( p->pSatTest ); if ( p->pSatBmc ) sat_solver_delete( p->pSatBmc ); ABC_FREE( p ); }
/**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Mfs_ManStop( Mfs_Man_t * p ) { if ( p->pPars->fVerbose ) Mfs_ManPrint( p ); if ( p->vTruth ) Vec_IntFree( p->vTruth ); if ( p->pManDec ) Bdc_ManFree( p->pManDec ); if ( p->pCare ) Aig_ManStop( p->pCare ); if ( p->vSuppsInv ) Vec_VecFree( (Vec_Vec_t *)p->vSuppsInv ); if ( p->vProbs ) Vec_IntFree( p->vProbs ); Mfs_ManClean( p ); Int_ManFree( p->pMan ); Vec_IntFree( p->vMem ); Vec_VecFree( p->vLevels ); Vec_PtrFree( p->vMfsFanins ); Vec_IntFree( p->vProjVarsCnf ); Vec_IntFree( p->vProjVarsSat ); Vec_IntFree( p->vDivLits ); Vec_PtrFree( p->vDivCexes ); ABC_FREE( p ); }
ABC_NAMESPACE_IMPL_START //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// /// FUNCTION DEFINITIONS /// //////////////////////////////////////////////////////////////////////// /**Function************************************************************* Synopsis [Specialized duplication.] Description [Replaces registers by PIs/POs and PIs by registers.] SideEffects [] SeeAlso [] ***********************************************************************/ Gia_Man_t * Gia_ManDupIn2Ff( Gia_Man_t * p ) { Vec_Int_t * vPiOuts; Gia_Man_t * pNew; Gia_Obj_t * pObj; int i; vPiOuts = Vec_IntAlloc( Gia_ManPiNum(p) ); pNew = Gia_ManStart( Gia_ManObjNum(p) + 2 * Gia_ManPiNum(p) ); pNew->pName = Abc_UtilStrsav( p->pName ); pNew->pSpec = Abc_UtilStrsav( p->pSpec ); Gia_ManFillValue( p ); Gia_ManConst0(p)->Value = 0; Gia_ManForEachPi( p, pObj, i ) Vec_IntPush( vPiOuts, Gia_ManAppendCi(pNew) ); Gia_ManForEachRo( p, pObj, i ) pObj->Value = Gia_ManAppendCi( pNew ); Gia_ManForEachPi( p, pObj, i ) pObj->Value = Gia_ManAppendCi( pNew ); Gia_ManForEachAnd( p, pObj, i ) pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) ); Gia_ManForEachPo( p, pObj, i ) pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) ); Gia_ManForEachRi( p, pObj, i ) pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) ); Gia_ManForEachPi( p, pObj, i ) Gia_ManAppendCo( pNew, Vec_IntEntry(vPiOuts, i) ); Gia_ManSetRegNum( pNew, Gia_ManPiNum(p) ); Vec_IntFree( vPiOuts ); return pNew; }
/**Function************************************************************* Synopsis [Solve the enumeration problem.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Bmc_EcoSolve( sat_solver * pSat, int Root, Vec_Int_t * vVars ) { int nBTLimit = 1000000; Vec_Int_t * vLits = Vec_IntAlloc( Vec_IntSize(vVars) ); int status, i, Div, iVar, nFinal, * pFinal, nIter = 0, RetValue = 0; int pLits[2], nVars = sat_solver_nvars( pSat ); sat_solver_setnvars( pSat, nVars + 1 ); pLits[0] = Abc_Var2Lit( Root, 0 ); // F = 1 pLits[1] = Abc_Var2Lit( nVars, 0 ); // iNewLit while ( 1 ) { // find onset minterm status = sat_solver_solve( pSat, pLits, pLits + 2, nBTLimit, 0, 0, 0 ); if ( status == l_Undef ) { RetValue = -1; break; } if ( status == l_False ) { RetValue = 1; break; } assert( status == l_True ); // collect divisor literals Vec_IntClear( vLits ); Vec_IntPush( vLits, Abc_LitNot(pLits[0]) ); // F = 0 Vec_IntForEachEntry( vVars, Div, i ) Vec_IntPush( vLits, sat_solver_var_literal(pSat, Div) ); // check against offset status = sat_solver_solve( pSat, Vec_IntArray(vLits), Vec_IntArray(vLits) + Vec_IntSize(vLits), nBTLimit, 0, 0, 0 ); if ( status == l_Undef ) { RetValue = -1; break; } if ( status == l_True ) break; assert( status == l_False ); // compute cube and add clause nFinal = sat_solver_final( pSat, &pFinal ); Vec_IntClear( vLits ); Vec_IntPush( vLits, Abc_LitNot(pLits[1]) ); // NOT(iNewLit) printf( "Cube %d : ", nIter ); for ( i = 0; i < nFinal; i++ ) { if ( pFinal[i] == pLits[0] ) continue; Vec_IntPush( vLits, pFinal[i] ); iVar = Vec_IntFind( vVars, Abc_Lit2Var(pFinal[i]) ); assert( iVar >= 0 ); printf( "%s%d ", Abc_LitIsCompl(pFinal[i]) ? "+":"-", iVar ); } printf( "\n" ); status = sat_solver_addclause( pSat, Vec_IntArray(vLits), Vec_IntArray(vLits) + Vec_IntSize(vLits) ); assert( status ); nIter++; } // assert( status == l_True ); Vec_IntFree( vLits ); return RetValue; }
/**Function************************************************************* Synopsis [Stops the simulation manager.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Sim_ManStop( Sim_Man_t * p ) { Sim_ManPrintStats( p ); if ( p->vSim0 ) Sim_UtilInfoFree( p->vSim0 ); if ( p->vSim1 ) Sim_UtilInfoFree( p->vSim1 ); if ( p->vSuppStr ) Sim_UtilInfoFree( p->vSuppStr ); // if ( p->vSuppFun ) Sim_UtilInfoFree( p->vSuppFun ); if ( p->vSuppTargs ) Vec_VecFree( p->vSuppTargs ); if ( p->pMmPat ) Extra_MmFixedStop( p->pMmPat ); if ( p->vFifo ) Vec_PtrFree( p->vFifo ); if ( p->vDiffs ) Vec_IntFree( p->vDiffs ); free( p ); }