/**Function************************************************************* Synopsis [Starts the simulation manager.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ Sim_Man_t * Sim_ManStart( Abc_Ntk_t * pNtk, int fLightweight ) { Sim_Man_t * p; // start the manager p = ALLOC( Sim_Man_t, 1 ); memset( p, 0, sizeof(Sim_Man_t) ); p->pNtk = pNtk; p->nInputs = Abc_NtkCiNum(p->pNtk); p->nOutputs = Abc_NtkCoNum(p->pNtk); // internal simulation information p->nSimBits = 2048; p->nSimWords = SIM_NUM_WORDS(p->nSimBits); p->vSim0 = Sim_UtilInfoAlloc( Abc_NtkObjNumMax(pNtk), p->nSimWords, 0 ); p->fLightweight = fLightweight; if (!p->fLightweight) { p->vSim1 = Sim_UtilInfoAlloc( Abc_NtkObjNumMax(pNtk), p->nSimWords, 0 ); // support information p->nSuppBits = Abc_NtkCiNum(pNtk); p->nSuppWords = SIM_NUM_WORDS(p->nSuppBits); p->vSuppStr = Sim_ComputeStrSupp( pNtk ); p->vSuppFun = Sim_UtilInfoAlloc( Abc_NtkCoNum(p->pNtk), p->nSuppWords, 1 ); // other data p->pMmPat = Extra_MmFixedStart( sizeof(Sim_Pat_t) + p->nSuppWords * sizeof(unsigned) ); p->vFifo = Vec_PtrAlloc( 100 ); p->vDiffs = Vec_IntAlloc( 100 ); // allocate support targets (array of unresolved outputs for each input) p->vSuppTargs = Vec_VecStart( p->nInputs ); } return p; }
/**Function************************************************************* Synopsis [Starts the rewriting manager.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ Ref_Man_t * Dar_ManRefStart( Aig_Man_t * pAig, Dar_RefPar_t * pPars ) { Ref_Man_t * p; // start the manager p = ALLOC( Ref_Man_t, 1 ); memset( p, 0, sizeof(Ref_Man_t) ); p->pAig = pAig; p->pPars = pPars; // other data p->vCuts = Vec_VecStart( pPars->nCutsMax ); p->vTruthElem = Vec_PtrAllocTruthTables( pPars->nLeafMax ); p->vTruthStore = Vec_PtrAllocSimInfo( 256, Kit_TruthWordNum(pPars->nLeafMax) ); p->vMemory = Vec_IntAlloc( 1 << 16 ); p->vCutNodes = Vec_PtrAlloc( 256 ); p->vLeavesBest = Vec_PtrAlloc( pPars->nLeafMax ); return p; }
/**Function************************************************************* Synopsis [Starts the simulation manager.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ Sym_Man_t * Sym_ManStart( Abc_Ntk_t * pNtk, int fVerbose ) { Sym_Man_t * p; int i, v; // start the manager p = ALLOC( Sym_Man_t, 1 ); memset( p, 0, sizeof(Sym_Man_t) ); p->pNtk = pNtk; p->vNodes = Abc_NtkDfs( pNtk, 0 ); p->nInputs = Abc_NtkCiNum(p->pNtk); p->nOutputs = Abc_NtkCoNum(p->pNtk); // internal simulation information p->nSimWords = SIM_NUM_WORDS(p->nInputs); p->vSim = Sim_UtilInfoAlloc( Abc_NtkObjNumMax(pNtk), p->nSimWords, 0 ); // symmetry info for each output p->vMatrSymms = Vec_PtrStart( p->nOutputs ); p->vMatrNonSymms = Vec_PtrStart( p->nOutputs ); p->vPairsTotal = Vec_IntStart( p->nOutputs ); p->vPairsSym = Vec_IntStart( p->nOutputs ); p->vPairsNonSym = Vec_IntStart( p->nOutputs ); for ( i = 0; i < p->nOutputs; i++ ) { p->vMatrSymms->pArray[i] = Extra_BitMatrixStart( p->nInputs ); p->vMatrNonSymms->pArray[i] = Extra_BitMatrixStart( p->nInputs ); } // temporary patterns p->uPatRand = ALLOC( unsigned, p->nSimWords ); p->uPatCol = ALLOC( unsigned, p->nSimWords ); p->uPatRow = ALLOC( unsigned, p->nSimWords ); p->vVarsU = Vec_IntStart( 100 ); p->vVarsV = Vec_IntStart( 100 ); // compute supports p->vSuppFun = Sim_ComputeFunSupp( pNtk, fVerbose ); p->vSupports = Vec_VecStart( p->nOutputs ); for ( i = 0; i < p->nOutputs; i++ ) for ( v = 0; v < p->nInputs; v++ ) if ( Sim_SuppFunHasVar( p->vSuppFun, i, v ) ) Vec_VecPush( p->vSupports, i, (void *)v ); return p; }
ABC_NAMESPACE_IMPL_START //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// /// FUNCTION DEFINITIONS /// //////////////////////////////////////////////////////////////////////// /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ Mfs_Man_t * Mfs_ManAlloc( Mfs_Par_t * pPars ) { Mfs_Man_t * p; // start the manager p = ABC_ALLOC( Mfs_Man_t, 1 ); memset( p, 0, sizeof(Mfs_Man_t) ); p->pPars = pPars; p->vProjVarsCnf = Vec_IntAlloc( 100 ); p->vProjVarsSat = Vec_IntAlloc( 100 ); p->vDivLits = Vec_IntAlloc( 100 ); p->nDivWords = Abc_BitWordNum(p->pPars->nDivMax + MFS_FANIN_MAX); p->vDivCexes = Vec_PtrAllocSimInfo( p->pPars->nDivMax+MFS_FANIN_MAX+1, p->nDivWords ); p->pMan = Int_ManAlloc(); p->vMem = Vec_IntAlloc( 0 ); p->vLevels = Vec_VecStart( 32 ); p->vMfsFanins= Vec_PtrAlloc( 32 ); return p; }
/**Function************************************************************* Synopsis [Starts the rewriting manager.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ Ref_Man_t * Dar_ManRefStart( Aig_Man_t * pAig, Dar_RefPar_t * pPars ) { Ref_Man_t * p; // start the manager p = ABC_ALLOC( Ref_Man_t, 1 ); memset( p, 0, sizeof(Ref_Man_t) ); p->pAig = pAig; p->pPars = pPars; // other data p->vCuts = Vec_VecStart( pPars->nCutsMax ); p->vTruthElem = Vec_PtrAllocTruthTables( pPars->nLeafMax ); p->vTruthStore = Vec_PtrAllocSimInfo( 1024, Kit_TruthWordNum(pPars->nLeafMax) ); p->vMemory = Vec_IntAlloc( 1 << 16 ); p->vCutNodes = Vec_PtrAlloc( 256 ); p->vLeavesBest = Vec_PtrAlloc( pPars->nLeafMax ); // alloc bi-decomposition manager p->DecPars.nVarsMax = pPars->nLeafMax; p->DecPars.fVerbose = pPars->fVerbose; p->DecPars.fVeryVerbose = 0; // p->pManDec = Bdc_ManAlloc( &p->DecPars ); return p; }
// compute supports clk = clock(); vSupps = (Vec_Vec_t *)Aig_ManSupports( p ); ABC_PRT( "Supports", clock() - clk ); // remove last entry Aig_ManForEachCo( p, pObj, i ) { vSup = Vec_VecEntryInt( vSupps, i ); Vec_IntPop( vSup ); // remember support // pObj->pNext = (Aig_Obj_t *)vSup; } // create reverse supports clk = clock(); vSuppsIn = Vec_VecStart( Aig_ManCiNum(p) ); Aig_ManForEachCo( p, pObj, i ) { vSup = Vec_VecEntryInt( vSupps, i ); Vec_IntForEachEntry( vSup, Entry, k ) Vec_VecPush( vSuppsIn, Entry, (void *)(ABC_PTRUINT_T)i ); } ABC_PRT( "Inverse ", clock() - clk ); clk = clock(); // compute extended supports Largest = 0; vSuppsNew = Vec_PtrAlloc( Aig_ManCoNum(p) ); vOverNew = Vec_IntAlloc( Aig_ManCoNum(p) ); vQuantNew = Vec_IntAlloc( Aig_ManCoNum(p) ); // pProgress = Bar_ProgressStart( stdout, Aig_ManCoNum(p) );
/**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Sat_ProofChecker( char * pFileName ) { FILE * pFile; Vec_Vec_t * vClauses; int c, i, Num, RetValue, Counter, Counter2, Clause1, Clause2; int RetValue; // open the file pFile = fopen( pFileName, "r" ); if ( pFile == NULL ) return; // count the number of clauses Counter = Counter2 = 0; while ( (c = fgetc(pFile)) != EOF ) { Counter += (c == '\n'); Counter2 += (c == '*'); } vClauses = Vec_VecStart( Counter+1 ); printf( "The proof contains %d roots and %d resolution steps.\n", Counter-Counter2, Counter2 ); // read the clauses rewind( pFile ); for ( i = 1 ; ; i++ ) { RetValue = RetValue = fscanf( pFile, "%d", &Num ); if ( RetValue != 1 ) break; assert( Num == i ); while ( (c = fgetc( pFile )) == ' ' ); if ( c == '*' ) { RetValue = fscanf( pFile, "%d %d", &Clause1, &Clause2 ); assert( RetValue == 2 ); RetValue = fscanf( pFile, "%d", &Num ); assert( RetValue == 1 ); assert( Num == 0 ); if ( !Sat_ProofResolve( vClauses, i, Clause1, Clause2 ) ) { printf( "Error detected in the resolution proof.\n" ); Vec_VecFree( vClauses ); fclose( pFile ); return; } } else { ungetc( c, pFile ); while ( 1 ) { RetValue = fscanf( pFile, "%d", &Num ); assert( RetValue == 1 ); if ( Num == 0 ) break; Vec_VecPush( vClauses, i, (void *)Num ); } RetValue = fscanf( pFile, "%d", &Num ); assert( RetValue == 1 ); assert( Num == 0 ); } } assert( i-1 == Counter ); if ( Vec_IntSize( Vec_VecEntry(vClauses, Counter) ) != 0 ) printf( "The last clause is not empty.\n" ); else printf( "The empty clause is derived.\n" ); Vec_VecFree( vClauses ); fclose( pFile ); }
ABC_NAMESPACE_IMPL_START //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// /// FUNCTION DEFINITIONS /// //////////////////////////////////////////////////////////////////////// /**Function************************************************************* Synopsis [Starts the simulation manager.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ Sym_Man_t * Sym_ManStart( Abc_Ntk_t * pNtk, int fVerbose ) { Sym_Man_t * p; int i, v; // start the manager p = ABC_ALLOC( Sym_Man_t, 1 ); memset( p, 0, sizeof(Sym_Man_t) ); p->pNtk = pNtk; p->vNodes = Abc_NtkDfs( pNtk, 0 ); p->nInputs = Abc_NtkCiNum(p->pNtk); p->nOutputs = Abc_NtkCoNum(p->pNtk); // internal simulation information p->nSimWords = SIM_NUM_WORDS(p->nInputs); p->vSim = Sim_UtilInfoAlloc( Abc_NtkObjNumMax(pNtk), p->nSimWords, 0 ); // symmetry info for each output p->vMatrSymms = Vec_PtrStart( p->nOutputs ); p->vMatrNonSymms = Vec_PtrStart( p->nOutputs ); p->vPairsTotal = Vec_IntStart( p->nOutputs ); p->vPairsSym = Vec_IntStart( p->nOutputs ); p->vPairsNonSym = Vec_IntStart( p->nOutputs ); for ( i = 0; i < p->nOutputs; i++ ) { p->vMatrSymms->pArray[i] = Extra_BitMatrixStart( p->nInputs ); p->vMatrNonSymms->pArray[i] = Extra_BitMatrixStart( p->nInputs ); } // temporary patterns p->uPatRand = ABC_ALLOC( unsigned, p->nSimWords ); p->uPatCol = ABC_ALLOC( unsigned, p->nSimWords ); p->uPatRow = ABC_ALLOC( unsigned, p->nSimWords ); p->vVarsU = Vec_IntStart( 100 ); p->vVarsV = Vec_IntStart( 100 ); // compute supports p->vSuppFun = Sim_ComputeFunSupp( pNtk, fVerbose ); p->vSupports = Vec_VecStart( p->nOutputs ); for ( i = 0; i < p->nOutputs; i++ ) for ( v = 0; v < p->nInputs; v++ ) if ( Sim_SuppFunHasVar( p->vSuppFun, i, v ) ) Vec_VecPush( p->vSupports, i, (void *)(ABC_PTRUINT_T)v ); return p; }