#include "fra.h"
Go to the source code of this file.
Functions | |
void | Fra_ParamsDefault (Fra_Par_t *pPars) |
void | Fra_ParamsDefaultSeq (Fra_Par_t *pPars) |
Fra_Man_t * | Fra_ManStart (Aig_Man_t *pManAig, Fra_Par_t *pPars) |
void | Fra_ManClean (Fra_Man_t *p, int nNodesMax) |
Aig_Man_t * | Fra_ManPrepareComb (Fra_Man_t *p) |
void | Fra_ManFinalizeComb (Fra_Man_t *p) |
void | Fra_ManStop (Fra_Man_t *p) |
void | Fra_ManPrint (Fra_Man_t *p) |
void Fra_ManClean | ( | Fra_Man_t * | p, | |
int | nNodesMax | |||
) |
Function*************************************************************
Synopsis [Starts the fraiging manager.]
Description []
SideEffects []
SeeAlso []
Definition at line 141 of file fraMan.c.
00142 { 00143 int i; 00144 // remove old arrays 00145 for ( i = 0; i < p->nMemAlloc; i++ ) 00146 if ( p->pMemFanins[i] && p->pMemFanins[i] != (void *)1 ) 00147 Vec_PtrFree( p->pMemFanins[i] ); 00148 // realloc for the new size 00149 if ( p->nMemAlloc < nNodesMax ) 00150 { 00151 int nMemAllocNew = nNodesMax + 5000; 00152 p->pMemFanins = REALLOC( Vec_Ptr_t *, p->pMemFanins, nMemAllocNew ); 00153 p->pMemSatNums = REALLOC( int, p->pMemSatNums, nMemAllocNew ); 00154 p->nMemAlloc = nMemAllocNew; 00155 } 00156 // prepare for the new run 00157 memset( p->pMemFanins, 0, sizeof(Vec_Ptr_t *) * p->nMemAlloc ); 00158 memset( p->pMemSatNums, 0, sizeof(int) * p->nMemAlloc ); 00159 }
void Fra_ManFinalizeComb | ( | Fra_Man_t * | p | ) |
Function*************************************************************
Synopsis [Finalizes the combinational miter after fraiging.]
Description []
SideEffects []
SeeAlso []
Definition at line 212 of file fraMan.c.
00213 { 00214 Aig_Obj_t * pObj; 00215 int i; 00216 // add the POs 00217 Aig_ManForEachPo( p->pManAig, pObj, i ) 00218 Aig_ObjCreatePo( p->pManFraig, Fra_ObjChild0Fra(pObj,0) ); 00219 // postprocess 00220 Aig_ManCleanMarkB( p->pManFraig ); 00221 }
Function*************************************************************
Synopsis [Prepares the new manager to begin fraiging.]
Description []
SideEffects []
SeeAlso []
Definition at line 172 of file fraMan.c.
00173 { 00174 Aig_Man_t * pManFraig; 00175 Aig_Obj_t * pObj; 00176 int i; 00177 assert( p->pManFraig == NULL ); 00178 // start the fraig package 00179 pManFraig = Aig_ManStart( Aig_ManObjNumMax(p->pManAig) ); 00180 pManFraig->pName = Aig_UtilStrsav( p->pManAig->pName ); 00181 pManFraig->nRegs = p->pManAig->nRegs; 00182 pManFraig->nAsserts = p->pManAig->nAsserts; 00183 // set the pointers to the available fraig nodes 00184 Fra_ObjSetFraig( Aig_ManConst1(p->pManAig), 0, Aig_ManConst1(pManFraig) ); 00185 Aig_ManForEachPi( p->pManAig, pObj, i ) 00186 Fra_ObjSetFraig( pObj, 0, Aig_ObjCreatePi(pManFraig) ); 00187 // set the pointers to the manager 00188 Aig_ManForEachObj( pManFraig, pObj, i ) 00189 pObj->pData = p; 00190 // allocate memory for mapping FRAIG nodes into SAT numbers and fanins 00191 p->nMemAlloc = p->nSizeAlloc; 00192 p->pMemFanins = ALLOC( Vec_Ptr_t *, p->nMemAlloc ); 00193 memset( p->pMemFanins, 0, sizeof(Vec_Ptr_t *) * p->nMemAlloc ); 00194 p->pMemSatNums = ALLOC( int, p->nMemAlloc ); 00195 memset( p->pMemSatNums, 0, sizeof(int) * p->nMemAlloc ); 00196 // make sure the satisfying assignment is node assigned 00197 assert( pManFraig->pData == NULL ); 00198 return pManFraig; 00199 }
void Fra_ManPrint | ( | Fra_Man_t * | p | ) |
Function*************************************************************
Synopsis [Prints stats for the fraiging manager.]
Description []
SideEffects []
SeeAlso []
Definition at line 272 of file fraMan.c.
00273 { 00274 double nMemory = 1.0*Aig_ManObjNumMax(p->pManAig)*(p->pSml->nWordsTotal*sizeof(unsigned)+6*sizeof(void*))/(1<<20); 00275 printf( "SimWord = %d. Round = %d. Mem = %0.2f Mb. LitBeg = %d. LitEnd = %d. (%6.2f %%).\n", 00276 p->pPars->nSimWords, p->pSml->nSimRounds, nMemory, p->nLitsBeg, p->nLitsEnd, 100.0*p->nLitsEnd/(p->nLitsBeg?p->nLitsBeg:1) ); 00277 printf( "Proof = %d. Cex = %d. Fail = %d. FailReal = %d. C-lim = %d. ImpRatio = %6.2f %%\n", 00278 p->nSatProof, p->nSatCallsSat, p->nSatFails, p->nSatFailsReal, p->pPars->nBTLimitNode, Fra_ImpComputeStateSpaceRatio(p) ); 00279 printf( "NBeg = %d. NEnd = %d. (Gain = %6.2f %%). RBeg = %d. REnd = %d. (Gain = %6.2f %%).\n", 00280 p->nNodesBeg, p->nNodesEnd, 100.0*(p->nNodesBeg-p->nNodesEnd)/(p->nNodesBeg?p->nNodesBeg:1), 00281 p->nRegsBeg, p->nRegsEnd, 100.0*(p->nRegsBeg-p->nRegsEnd)/(p->nRegsBeg?p->nRegsBeg:1) ); 00282 if ( p->pSat ) Sat_SolverPrintStats( stdout, p->pSat ); 00283 PRT( "AIG simulation ", p->pSml->timeSim ); 00284 PRT( "AIG traversal ", p->timeTrav ); 00285 if ( p->timeRwr ) 00286 { 00287 PRT( "AIG rewriting ", p->timeRwr ); 00288 } 00289 PRT( "SAT solving ", p->timeSat ); 00290 PRT( " Unsat ", p->timeSatUnsat ); 00291 PRT( " Sat ", p->timeSatSat ); 00292 PRT( " Fail ", p->timeSatFail ); 00293 PRT( "Class refining ", p->timeRef ); 00294 PRT( "TOTAL RUNTIME ", p->timeTotal ); 00295 if ( p->time1 ) { PRT( "time1 ", p->time1 ); } 00296 if ( p->nSpeculs ) 00297 printf( "Speculations = %d.\n", p->nSpeculs ); 00298 }
Function*************************************************************
Synopsis [Starts the fraiging manager.]
Description []
SideEffects []
SeeAlso []
Definition at line 101 of file fraMan.c.
00102 { 00103 Fra_Man_t * p; 00104 Aig_Obj_t * pObj; 00105 int i; 00106 // allocate the fraiging manager 00107 p = ALLOC( Fra_Man_t, 1 ); 00108 memset( p, 0, sizeof(Fra_Man_t) ); 00109 p->pPars = pPars; 00110 p->pManAig = pManAig; 00111 p->nSizeAlloc = Aig_ManObjNumMax( pManAig ); 00112 p->nFramesAll = pPars->nFramesK + 1; 00113 // allocate storage for sim pattern 00114 p->nPatWords = Aig_BitWordNum( (Aig_ManPiNum(pManAig) - Aig_ManRegNum(pManAig)) * p->nFramesAll + Aig_ManRegNum(pManAig) ); 00115 p->pPatWords = ALLOC( unsigned, p->nPatWords ); 00116 p->vPiVars = Vec_PtrAlloc( 100 ); 00117 // equivalence classes 00118 p->pCla = Fra_ClassesStart( pManAig ); 00119 // allocate other members 00120 p->pMemFraig = ALLOC( Aig_Obj_t *, p->nSizeAlloc * p->nFramesAll ); 00121 memset( p->pMemFraig, 0, sizeof(Aig_Obj_t *) * p->nSizeAlloc * p->nFramesAll ); 00122 // set random number generator 00123 srand( 0xABCABC ); 00124 // set the pointer to the manager 00125 Aig_ManForEachObj( p->pManAig, pObj, i ) 00126 pObj->pData = p; 00127 return p; 00128 }
void Fra_ManStop | ( | Fra_Man_t * | p | ) |
Function*************************************************************
Synopsis [Stops the fraiging manager.]
Description []
SideEffects []
SeeAlso []
Definition at line 235 of file fraMan.c.
00236 { 00237 if ( p->pPars->fVerbose ) 00238 Fra_ManPrint( p ); 00239 // save mapping from original nodes into FRAIG nodes 00240 if ( p->pManAig ) 00241 { 00242 if ( p->pManAig->pObjCopies ) 00243 free( p->pManAig->pObjCopies ); 00244 p->pManAig->pObjCopies = p->pMemFraig; 00245 p->pMemFraig = NULL; 00246 } 00247 Fra_ManClean( p, 0 ); 00248 if ( p->vTimeouts ) Vec_PtrFree( p->vTimeouts ); 00249 if ( p->vPiVars ) Vec_PtrFree( p->vPiVars ); 00250 if ( p->pSat ) sat_solver_delete( p->pSat ); 00251 if ( p->pCla ) Fra_ClassesStop( p->pCla ); 00252 if ( p->pSml ) Fra_SmlStop( p->pSml ); 00253 if ( p->vCex ) Vec_IntFree( p->vCex ); 00254 FREE( p->pMemFraig ); 00255 FREE( p->pMemFanins ); 00256 FREE( p->pMemSatNums ); 00257 FREE( p->pPatWords ); 00258 free( p ); 00259 }
void Fra_ParamsDefault | ( | Fra_Par_t * | pPars | ) |
CFile****************************************************************
FileName [fraMan.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [New FRAIG package.]
Synopsis [Starts the FRAIG manager.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - June 30, 2007.]
Revision [
] DECLARATIONS /// FUNCTION DEFINITIONS ///Function*************************************************************
Synopsis [Sets the default solving parameters.]
Description []
SideEffects []
SeeAlso []
Definition at line 42 of file fraMan.c.
00043 { 00044 memset( pPars, 0, sizeof(Fra_Par_t) ); 00045 pPars->nSimWords = 32; // the number of words in the simulation info 00046 pPars->dSimSatur = 0.005; // the ratio of refined classes when saturation is reached 00047 pPars->fPatScores = 0; // enables simulation pattern scoring 00048 pPars->MaxScore = 25; // max score after which resimulation is used 00049 pPars->fDoSparse = 1; // skips sparse functions 00050 // pPars->dActConeRatio = 0.05; // the ratio of cone to be bumped 00051 // pPars->dActConeBumpMax = 5.0; // the largest bump of activity 00052 pPars->dActConeRatio = 0.3; // the ratio of cone to be bumped 00053 pPars->dActConeBumpMax = 10.0; // the largest bump of activity 00054 pPars->nBTLimitNode = 100; // conflict limit at a node 00055 pPars->nBTLimitMiter = 500000; // conflict limit at an output 00056 pPars->nFramesK = 0; // the number of timeframes to unroll 00057 pPars->fConeBias = 1; 00058 pPars->fRewrite = 0; 00059 }
void Fra_ParamsDefaultSeq | ( | Fra_Par_t * | pPars | ) |
Function*************************************************************
Synopsis [Sets the default solving parameters.]
Description []
SideEffects []
SeeAlso []
Definition at line 72 of file fraMan.c.
00073 { 00074 memset( pPars, 0, sizeof(Fra_Par_t) ); 00075 pPars->nSimWords = 1; // the number of words in the simulation info 00076 pPars->dSimSatur = 0.005; // the ratio of refined classes when saturation is reached 00077 pPars->fPatScores = 0; // enables simulation pattern scoring 00078 pPars->MaxScore = 25; // max score after which resimulation is used 00079 pPars->fDoSparse = 1; // skips sparse functions 00080 pPars->dActConeRatio = 0.3; // the ratio of cone to be bumped 00081 pPars->dActConeBumpMax = 10.0; // the largest bump of activity 00082 pPars->nBTLimitNode = 10000000; // conflict limit at a node 00083 pPars->nBTLimitMiter = 500000; // conflict limit at an output 00084 pPars->nFramesK = 1; // the number of timeframes to unroll 00085 pPars->fConeBias = 0; 00086 pPars->fRewrite = 0; 00087 pPars->fLatchCorr = 0; 00088 }