#include "fra.h"
Go to the source code of this file.
Functions | |
void | Fra_ManPartitionTest (Aig_Man_t *p, int nComLim) |
void | Fra_ManPartitionTest2 (Aig_Man_t *p) |
void Fra_ManPartitionTest | ( | Aig_Man_t * | p, | |
int | nComLim | |||
) |
CFile****************************************************************
FileName [fraPart.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [New FRAIG package.]
Synopsis [Partitioning for induction.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - June 30, 2007.]
Revision [
] DECLARATIONS /// FUNCTION DEFINITIONS ///Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 42 of file fraPart.c.
00043 { 00044 Bar_Progress_t * pProgress; 00045 Vec_Vec_t * vSupps, * vSuppsIn; 00046 Vec_Ptr_t * vSuppsNew; 00047 Vec_Int_t * vSupNew, * vSup, * vSup2, * vTemp;//, * vSupIn; 00048 Vec_Int_t * vOverNew, * vQuantNew; 00049 Aig_Obj_t * pObj; 00050 int i, k, nCommon, CountOver, CountQuant; 00051 int nTotalSupp, nTotalSupp2, Entry, Largest;//, iVar; 00052 double Ratio, R; 00053 int clk; 00054 00055 nTotalSupp = 0; 00056 nTotalSupp2 = 0; 00057 Ratio = 0.0; 00058 00059 // compute supports 00060 clk = clock(); 00061 vSupps = (Vec_Vec_t *)Aig_ManSupports( p ); 00062 PRT( "Supports", clock() - clk ); 00063 // remove last entry 00064 Aig_ManForEachPo( p, pObj, i ) 00065 { 00066 vSup = Vec_VecEntry( vSupps, i ); 00067 Vec_IntPop( vSup ); 00068 // remember support 00069 // pObj->pNext = (Aig_Obj_t *)vSup; 00070 } 00071 00072 // create reverse supports 00073 clk = clock(); 00074 vSuppsIn = Vec_VecStart( Aig_ManPiNum(p) ); 00075 Aig_ManForEachPo( p, pObj, i ) 00076 { 00077 vSup = Vec_VecEntry( vSupps, i ); 00078 Vec_IntForEachEntry( vSup, Entry, k ) 00079 Vec_VecPush( vSuppsIn, Entry, (void *)i ); 00080 } 00081 PRT( "Inverse ", clock() - clk ); 00082 00083 clk = clock(); 00084 // compute extended supports 00085 Largest = 0; 00086 vSuppsNew = Vec_PtrAlloc( Aig_ManPoNum(p) ); 00087 vOverNew = Vec_IntAlloc( Aig_ManPoNum(p) ); 00088 vQuantNew = Vec_IntAlloc( Aig_ManPoNum(p) ); 00089 pProgress = Bar_ProgressStart( stdout, Aig_ManPoNum(p) ); 00090 Aig_ManForEachPo( p, pObj, i ) 00091 { 00092 Bar_ProgressUpdate( pProgress, i, NULL ); 00093 // get old supports 00094 vSup = Vec_VecEntry( vSupps, i ); 00095 if ( Vec_IntSize(vSup) < 2 ) 00096 continue; 00097 // compute new supports 00098 CountOver = CountQuant = 0; 00099 vSupNew = Vec_IntDup( vSup ); 00100 // go through the nodes where the first var appears 00101 Aig_ManForEachPo( p, pObj, k ) 00102 // iVar = Vec_IntEntry( vSup, 0 ); 00103 // vSupIn = Vec_VecEntry( vSuppsIn, iVar ); 00104 // Vec_IntForEachEntry( vSupIn, Entry, k ) 00105 { 00106 // pObj = Aig_ManObj( p, Entry ); 00107 // get support of this output 00108 // vSup2 = (Vec_Int_t *)pObj->pNext; 00109 vSup2 = Vec_VecEntry( vSupps, k ); 00110 // count the number of common vars 00111 nCommon = Vec_IntTwoCountCommon(vSup, vSup2); 00112 if ( nCommon < 2 ) 00113 continue; 00114 if ( nCommon > nComLim ) 00115 { 00116 vSupNew = Vec_IntTwoMerge( vTemp = vSupNew, vSup2 ); 00117 Vec_IntFree( vTemp ); 00118 CountOver++; 00119 } 00120 else 00121 CountQuant++; 00122 } 00123 // save the results 00124 Vec_PtrPush( vSuppsNew, vSupNew ); 00125 Vec_IntPush( vOverNew, CountOver ); 00126 Vec_IntPush( vQuantNew, CountQuant ); 00127 00128 if ( Largest < Vec_IntSize(vSupNew) ) 00129 Largest = Vec_IntSize(vSupNew); 00130 00131 nTotalSupp += Vec_IntSize(vSup); 00132 nTotalSupp2 += Vec_IntSize(vSupNew); 00133 if ( Vec_IntSize(vSup) ) 00134 R = Vec_IntSize(vSupNew) / Vec_IntSize(vSup); 00135 else 00136 R = 0; 00137 Ratio += R; 00138 00139 if ( R < 5.0 ) 00140 continue; 00141 00142 printf( "%6d : ", i ); 00143 printf( "S = %5d. ", Vec_IntSize(vSup) ); 00144 printf( "SNew = %5d. ", Vec_IntSize(vSupNew) ); 00145 printf( "R = %7.2f. ", R ); 00146 printf( "Over = %5d. ", CountOver ); 00147 printf( "Quant = %5d. ", CountQuant ); 00148 printf( "\n" ); 00149 /* 00150 Vec_IntForEachEntry( vSupNew, Entry, k ) 00151 printf( "%d ", Entry ); 00152 printf( "\n" ); 00153 */ 00154 } 00155 Bar_ProgressStop( pProgress ); 00156 PRT( "Scanning", clock() - clk ); 00157 00158 // print cumulative statistics 00159 printf( "PIs = %6d. POs = %6d. Lim = %3d. AveS = %3d. SN = %3d. R = %4.2f Max = %5d.\n", 00160 Aig_ManPiNum(p), Aig_ManPoNum(p), nComLim, 00161 nTotalSupp/Aig_ManPoNum(p), nTotalSupp2/Aig_ManPoNum(p), 00162 Ratio/Aig_ManPoNum(p), Largest ); 00163 00164 Vec_VecFree( vSupps ); 00165 Vec_VecFree( vSuppsIn ); 00166 Vec_VecFree( (Vec_Vec_t *)vSuppsNew ); 00167 Vec_IntFree( vOverNew ); 00168 Vec_IntFree( vQuantNew ); 00169 }
void Fra_ManPartitionTest2 | ( | Aig_Man_t * | p | ) |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 184 of file fraPart.c.
00185 { 00186 Vec_Vec_t * vSupps, * vSuppsIn; 00187 Vec_Int_t * vSup, * vSup2, * vSup3; 00188 Aig_Obj_t * pObj; 00189 int Entry, Entry2, Entry3, Counter; 00190 int i, k, m, n, clk; 00191 char * pSupp; 00192 00193 // compute supports 00194 clk = clock(); 00195 vSupps = (Vec_Vec_t *)Aig_ManSupports( p ); 00196 PRT( "Supports", clock() - clk ); 00197 // remove last entry 00198 Aig_ManForEachPo( p, pObj, i ) 00199 { 00200 vSup = Vec_VecEntry( vSupps, i ); 00201 Vec_IntPop( vSup ); 00202 // remember support 00203 // pObj->pNext = (Aig_Obj_t *)vSup; 00204 } 00205 00206 // create reverse supports 00207 clk = clock(); 00208 vSuppsIn = Vec_VecStart( Aig_ManPiNum(p) ); 00209 Aig_ManForEachPo( p, pObj, i ) 00210 { 00211 if ( i == p->nAsserts ) 00212 break; 00213 vSup = Vec_VecEntry( vSupps, i ); 00214 Vec_IntForEachEntry( vSup, Entry, k ) 00215 Vec_VecPush( vSuppsIn, Entry, (void *)i ); 00216 } 00217 PRT( "Inverse ", clock() - clk ); 00218 00219 // create affective supports 00220 clk = clock(); 00221 pSupp = ALLOC( char, Aig_ManPiNum(p) ); 00222 Aig_ManForEachPo( p, pObj, i ) 00223 { 00224 if ( i % 50 != 0 ) 00225 continue; 00226 vSup = Vec_VecEntry( vSupps, i ); 00227 memset( pSupp, 0, sizeof(char) * Aig_ManPiNum(p) ); 00228 // go through each input of this output 00229 Vec_IntForEachEntry( vSup, Entry, k ) 00230 { 00231 pSupp[Entry] = 1; 00232 vSup2 = Vec_VecEntry( vSuppsIn, Entry ); 00233 // go though each assert of this input 00234 Vec_IntForEachEntry( vSup2, Entry2, m ) 00235 { 00236 vSup3 = Vec_VecEntry( vSupps, Entry2 ); 00237 // go through each input of this assert 00238 Vec_IntForEachEntry( vSup3, Entry3, n ) 00239 { 00240 pSupp[Entry3] = 1; 00241 } 00242 } 00243 } 00244 // count the entries 00245 Counter = 0; 00246 for ( m = 0; m < Aig_ManPiNum(p); m++ ) 00247 Counter += pSupp[m]; 00248 printf( "%d(%d) ", Vec_IntSize(vSup), Counter ); 00249 } 00250 printf( "\n" ); 00251 PRT( "Extension ", clock() - clk ); 00252 00253 free( pSupp ); 00254 Vec_VecFree( vSupps ); 00255 Vec_VecFree( vSuppsIn ); 00256 }