mirror of https://github.com/YosysHQ/abc.git
Version abc90217
This commit is contained in:
parent
0871bffae3
commit
28d4f8696d
12
abclib.dsp
12
abclib.dsp
|
|
@ -3623,6 +3623,10 @@ SOURCE=.\src\aig\gia\giaDup.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\aig\gia\giaEmbed.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\aig\gia\giaFanout.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
@ -3647,10 +3651,6 @@ SOURCE=.\src\aig\gia\giaHash.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\aig\gia\giaLogic.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\aig\gia\giaMan.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
@ -3667,6 +3667,10 @@ SOURCE=.\src\aig\gia\giaSolver.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\aig\gia\giaSort.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\aig\gia\giaSwitch.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
|
|||
|
|
@ -359,6 +359,8 @@ extern void Gia_ObjAddFanout( Gia_Man_t * p, Gia_Obj_t * pObj, Gi
|
|||
extern void Gia_ObjRemoveFanout( Gia_Man_t * p, Gia_Obj_t * pObj, Gia_Obj_t * pFanout );
|
||||
extern void Gia_ManFanoutStart( Gia_Man_t * p );
|
||||
extern void Gia_ManFanoutStop( Gia_Man_t * p );
|
||||
/*=== giaForce.c =========================================================*/
|
||||
extern void For_ManExperiment( Gia_Man_t * pGia );
|
||||
/*=== giaFrames.c =========================================================*/
|
||||
extern void Gia_ManFraSetDefaultParams( Gia_ParFra_t * p );
|
||||
extern Gia_Man_t * Gia_ManFrames( Gia_Man_t * pAig, Gia_ParFra_t * pPars );
|
||||
|
|
@ -375,6 +377,7 @@ extern int Gia_ManHashAndTry( Gia_Man_t * p, int iLit0, int iLit
|
|||
extern Gia_Man_t * Gia_ManRehash( Gia_Man_t * p );
|
||||
/*=== giaLogic.c ===========================================================*/
|
||||
extern void Gia_ManTestDistance( Gia_Man_t * p );
|
||||
extern void Gia_ManSolveProblem( Gia_Man_t * pGia, int nDims, int nSols );
|
||||
/*=== giaMan.c ===========================================================*/
|
||||
extern Gia_Man_t * Gia_ManStart( int nObjsMax );
|
||||
extern void Gia_ManStop( Gia_Man_t * p );
|
||||
|
|
@ -396,8 +399,10 @@ extern Gia_Man_t * Gia_ManReduceConst( Gia_Man_t * pAig, int fVerbose );
|
|||
/*=== giaUtil.c ===========================================================*/
|
||||
extern void Gia_ManSetMark0( Gia_Man_t * p );
|
||||
extern void Gia_ManCleanMark0( Gia_Man_t * p );
|
||||
extern void Gia_ManCheckMark0( Gia_Man_t * p );
|
||||
extern void Gia_ManSetMark1( Gia_Man_t * p );
|
||||
extern void Gia_ManCleanMark1( Gia_Man_t * p );
|
||||
extern void Gia_ManCheckMark1( Gia_Man_t * p );
|
||||
extern void Gia_ManCleanValue( Gia_Man_t * p );
|
||||
extern void Gia_ManFillValue( Gia_Man_t * p );
|
||||
extern void Gia_ManSetPhase( Gia_Man_t * p );
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -20,17 +20,50 @@
|
|||
|
||||
#include "gia.h"
|
||||
|
||||
/*
|
||||
The code is based on the paper by F. A. Aloul, I. L. Markov, and K. A. Sakallah.
|
||||
"FORCE: A Fast and Easy-To-Implement Variable-Ordering Heuristic", Proc. GLSVLSI’03.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// DECLARATIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef struct For_Obj_t_ For_Obj_t;
|
||||
struct For_Obj_t_
|
||||
{
|
||||
int iObj;
|
||||
float lNode;
|
||||
};
|
||||
|
||||
typedef struct For_Man_t_ For_Man_t;
|
||||
struct For_Man_t_
|
||||
{
|
||||
Gia_Man_t * pGia; // the original AIG manager
|
||||
int nObjs; // the number of objects
|
||||
int iObj; // the last added object
|
||||
int * pPlace; // Placeing of objects
|
||||
int * piNext; // array of next pointers
|
||||
int * piRoot; // array of root pointers
|
||||
float * plEdge; // edge coordinates
|
||||
For_Obj_t * pNodes; // the array of nodes
|
||||
};
|
||||
|
||||
static inline int Gia_ObjPlace( For_Man_t * p, Gia_Obj_t * pObj ) { return p->pPlace[Gia_ObjId(p->pGia, pObj)]; }
|
||||
static inline int Gia_ObjPlaceFanin0( For_Man_t * p, Gia_Obj_t * pObj ) { return p->pPlace[Gia_ObjFaninId0p(p->pGia, pObj)]; }
|
||||
static inline int Gia_ObjPlaceFanin1( For_Man_t * p, Gia_Obj_t * pObj ) { return p->pPlace[Gia_ObjFaninId1p(p->pGia, pObj)]; }
|
||||
|
||||
static inline int Gia_ObjEdge( For_Man_t * p, Gia_Obj_t * pObj ) { return p->plEdge[Gia_ObjId(p->pGia, pObj)]; }
|
||||
static inline int Gia_ObjEdgeFanin0( For_Man_t * p, Gia_Obj_t * pObj ) { return p->plEdge[Gia_ObjFaninId0p(p->pGia, pObj)]; }
|
||||
static inline int Gia_ObjEdgeFanin1( For_Man_t * p, Gia_Obj_t * pObj ) { return p->plEdge[Gia_ObjFaninId1p(p->pGia, pObj)]; }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// FUNCTION DEFINITIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [This is implementation of qsort in MiniSat.]
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
|
|
@ -39,53 +72,18 @@
|
|||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
static int num_cmp ( int * x, int * y) { return ((*x) < (*y)) ? -1 : 1; }
|
||||
// Returns a random float 0 <= x < 1. Seed must never be 0.
|
||||
static inline double drand(double* seed) {
|
||||
int q;
|
||||
*seed *= 1389796;
|
||||
q = (int)(*seed / 2147483647);
|
||||
*seed -= (double)q * 2147483647;
|
||||
return *seed / 2147483647; }
|
||||
// Returns a random integer 0 <= x < size. Seed must never be 0.
|
||||
static inline int irand(double* seed, int size) {
|
||||
return (int)(drand(seed) * size); }
|
||||
static inline void selectionsort(int* array, int size, int(*comp)(const void *, const void *))
|
||||
For_Man_t * For_ManStart( Gia_Man_t * pGia )
|
||||
{
|
||||
int i, j, best_i;
|
||||
int tmp;
|
||||
for (i = 0; i < size-1; i++){
|
||||
best_i = i;
|
||||
for (j = i+1; j < size; j++){
|
||||
if (comp(array + j, array + best_i) < 0)
|
||||
best_i = j;
|
||||
}
|
||||
tmp = array[i]; array[i] = array[best_i]; array[best_i] = tmp;
|
||||
}
|
||||
}
|
||||
static void sortrnd(int* array, int size, int(*comp)(const void *, const void *), double* seed)
|
||||
{
|
||||
if (size <= 15)
|
||||
selectionsort(array, size, comp);
|
||||
else{
|
||||
int * pivot = array + irand(seed, size);
|
||||
int tmp;
|
||||
int i = -1;
|
||||
int j = size;
|
||||
for(;;){
|
||||
do i++; while(comp(array + i, pivot)<0);
|
||||
do j--; while(comp(pivot, array + j)<0);
|
||||
if (i >= j) break;
|
||||
tmp = array[i]; array[i] = array[j]; array[j] = tmp;
|
||||
}
|
||||
sortrnd(array , i , comp, seed);
|
||||
sortrnd(&array[i], size-i, comp, seed);
|
||||
}
|
||||
}
|
||||
void minisat_sort(int* array, int size, int(*comp)(const void *, const void *))
|
||||
{
|
||||
double seed = 91648253;
|
||||
sortrnd(array,size,comp,&seed);
|
||||
For_Man_t * p;
|
||||
p = ABC_CALLOC( For_Man_t, 1 );
|
||||
p->pGia = pGia;
|
||||
p->nObjs = Gia_ManObjNum(pGia);
|
||||
p->pPlace = ABC_ALLOC( int, p->nObjs );
|
||||
p->piNext = ABC_ALLOC( int, p->nObjs );
|
||||
p->piRoot = ABC_ALLOC( int, p->nObjs );
|
||||
p->plEdge = ABC_ALLOC( float, p->nObjs );
|
||||
p->pNodes = ABC_ALLOC( For_Obj_t, p->nObjs );
|
||||
return p;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
|
@ -99,14 +97,40 @@ void minisat_sort(int* array, int size, int(*comp)(const void *, const void *))
|
|||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
int * Gia_SortGetTest( int nSize )
|
||||
void For_ManStop( For_Man_t * p )
|
||||
{
|
||||
int i, * pArray;
|
||||
ABC_FREE( p->pPlace );
|
||||
ABC_FREE( p->piNext );
|
||||
ABC_FREE( p->piRoot );
|
||||
ABC_FREE( p->plEdge );
|
||||
ABC_FREE( p->pNodes );
|
||||
ABC_FREE( p );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Derives random ordering of nodes.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void For_ManSetInitPlaceRandom( For_Man_t * p )
|
||||
{
|
||||
int i, Temp, iNext;
|
||||
Aig_ManRandom( 1 );
|
||||
pArray = ABC_ALLOC( int, nSize );
|
||||
for ( i = 0; i < nSize; i++ )
|
||||
pArray[i] = (Aig_ManRandom( 0 ) >> 2);
|
||||
return pArray;
|
||||
for ( i = 0; i < p->nObjs; i++ )
|
||||
p->pPlace[i] = i;
|
||||
for ( i = 0; i < p->nObjs; i++ )
|
||||
{
|
||||
iNext = Aig_ManRandom( 0 ) % p->nObjs;
|
||||
Temp = p->pPlace[i];
|
||||
p->pPlace[i] = p->pPlace[iNext];
|
||||
p->pPlace[iNext] = Temp;
|
||||
}
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
|
@ -120,11 +144,294 @@ int * Gia_SortGetTest( int nSize )
|
|||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Gia_SortVerifySorted( int * pArray, int nSize )
|
||||
void For_ManSetInitPlaceDfs_rec( For_Man_t * p, Gia_Obj_t * pObj, int fRev )
|
||||
{
|
||||
if ( pObj->fMark0 )
|
||||
return;
|
||||
pObj->fMark0 = 1;
|
||||
if ( Gia_ObjIsCi(pObj) || Gia_ObjIsConst0(pObj) )
|
||||
{
|
||||
p->pPlace[ Gia_ObjId(p->pGia, pObj) ] = p->iObj++;
|
||||
return;
|
||||
}
|
||||
if ( Gia_ObjIsCo(pObj) )
|
||||
{
|
||||
For_ManSetInitPlaceDfs_rec( p, Gia_ObjFanin0(pObj), fRev );
|
||||
p->pPlace[ Gia_ObjId(p->pGia, pObj) ] = p->iObj++;
|
||||
return;
|
||||
}
|
||||
assert( Gia_ObjIsAnd(pObj) );
|
||||
if ( fRev )
|
||||
{
|
||||
For_ManSetInitPlaceDfs_rec( p, Gia_ObjFanin1(pObj), fRev );
|
||||
For_ManSetInitPlaceDfs_rec( p, Gia_ObjFanin0(pObj), fRev );
|
||||
}
|
||||
else
|
||||
{
|
||||
For_ManSetInitPlaceDfs_rec( p, Gia_ObjFanin0(pObj), fRev );
|
||||
For_ManSetInitPlaceDfs_rec( p, Gia_ObjFanin1(pObj), fRev );
|
||||
}
|
||||
p->pPlace[ Gia_ObjId(p->pGia, pObj) ] = p->iObj++;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Derives DFS ordering of nodes.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void For_ManSetInitPlaceDfs( For_Man_t * p, int fRev )
|
||||
{
|
||||
Gia_Obj_t * pObj;
|
||||
int i;
|
||||
for ( i = 1; i < nSize; i++ )
|
||||
assert( pArray[i-1] <= pArray[i] );
|
||||
p->iObj = 0;
|
||||
Gia_ManCleanMark0( p->pGia );
|
||||
For_ManSetInitPlaceDfs_rec( p, Gia_ManConst0(p->pGia), fRev );
|
||||
Gia_ManForEachCo( p->pGia, pObj, i )
|
||||
For_ManSetInitPlaceDfs_rec( p, pObj, fRev );
|
||||
Gia_ManForEachCi( p->pGia, pObj, i )
|
||||
if ( pObj->fMark0 == 0 )
|
||||
For_ManSetInitPlaceDfs_rec( p, pObj, fRev );
|
||||
assert( p->iObj == p->nObjs );
|
||||
Gia_ManCleanMark0( p->pGia );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Computes span for the given placement.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
double For_ManGetEdgeSpan( For_Man_t * p )
|
||||
{
|
||||
double Result = 0.0;
|
||||
Gia_Obj_t * pObj;
|
||||
int i, Diff;
|
||||
Gia_ManForEachAnd( p->pGia, pObj, i )
|
||||
{
|
||||
Diff = Gia_ObjPlace(p, pObj) - Gia_ObjPlaceFanin0(p, pObj);
|
||||
Result += (double)ABC_ABS(Diff);
|
||||
Diff = Gia_ObjPlace(p, pObj) - Gia_ObjPlaceFanin1(p, pObj);
|
||||
Result += (double)ABC_ABS(Diff);
|
||||
}
|
||||
Gia_ManForEachCo( p->pGia, pObj, i )
|
||||
{
|
||||
Diff = Gia_ObjPlace(p, pObj) - Gia_ObjPlaceFanin0(p, pObj);
|
||||
Result += (double)ABC_ABS(Diff);
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Computes max cut of the given placement.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
int For_ManGetMaxCut( For_Man_t * p )
|
||||
{
|
||||
Gia_Obj_t * pObj;
|
||||
int i, iObj, iFan, * pTemp;
|
||||
int nCutCut, nCutMax;
|
||||
pTemp = ABC_CALLOC( int, p->nObjs );
|
||||
Gia_ManForEachAnd( p->pGia, pObj, i )
|
||||
{
|
||||
iObj = Gia_ObjPlace(p, pObj);
|
||||
iFan = Gia_ObjPlaceFanin0(p, pObj);
|
||||
if ( iObj < iFan )
|
||||
{
|
||||
pTemp[iObj]++;
|
||||
pTemp[iFan]--;
|
||||
}
|
||||
else
|
||||
{
|
||||
pTemp[iObj]--;
|
||||
pTemp[iFan]++;
|
||||
}
|
||||
iObj = Gia_ObjPlace(p, pObj);
|
||||
iFan = Gia_ObjPlaceFanin1(p, pObj);
|
||||
if ( iObj < iFan )
|
||||
{
|
||||
pTemp[iObj]++;
|
||||
pTemp[iFan]--;
|
||||
}
|
||||
else
|
||||
{
|
||||
pTemp[iObj]--;
|
||||
pTemp[iFan]++;
|
||||
}
|
||||
}
|
||||
Gia_ManForEachCo( p->pGia, pObj, i )
|
||||
{
|
||||
iObj = Gia_ObjPlace(p, pObj);
|
||||
iFan = Gia_ObjPlaceFanin0(p, pObj);
|
||||
if ( iObj < iFan )
|
||||
{
|
||||
pTemp[iObj]++;
|
||||
pTemp[iFan]--;
|
||||
}
|
||||
else
|
||||
{
|
||||
pTemp[iObj]--;
|
||||
pTemp[iFan]++;
|
||||
}
|
||||
}
|
||||
nCutCut = nCutMax = 0;
|
||||
for ( i = 0; i < p->nObjs; i++ )
|
||||
{
|
||||
nCutCut += pTemp[i];
|
||||
nCutMax = ABC_MAX( nCutCut, nCutMax );
|
||||
}
|
||||
ABC_FREE( pTemp );
|
||||
assert( nCutCut == 0 );
|
||||
return nCutMax;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Computes hyper-edge centers.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void For_ManEdgeCenters( For_Man_t * p )
|
||||
{
|
||||
Gia_Obj_t * pObj;
|
||||
int i;
|
||||
memset( p->plEdge, 0, sizeof(float) * p->nObjs );
|
||||
Gia_ManForEachObj( p->pGia, pObj, i )
|
||||
{
|
||||
p->plEdge[i] = Gia_ObjPlace(p, pObj);
|
||||
if ( Gia_ObjIsAnd(pObj) )
|
||||
{
|
||||
p->plEdge[Gia_ObjFaninId0p(p->pGia, pObj)] += Gia_ObjPlace(p, pObj);
|
||||
p->plEdge[Gia_ObjFaninId1p(p->pGia, pObj)] += Gia_ObjPlace(p, pObj);
|
||||
}
|
||||
else if ( Gia_ObjIsCo(pObj) )
|
||||
{
|
||||
p->plEdge[Gia_ObjFaninId0p(p->pGia, pObj)] += Gia_ObjPlace(p, pObj);
|
||||
}
|
||||
}
|
||||
Gia_ManForEachObj( p->pGia, pObj, i )
|
||||
p->plEdge[i] /= 1.0 + Gia_ObjRefs( p->pGia, pObj );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Computes object centers.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void For_ManObjCenters( For_Man_t * p )
|
||||
{
|
||||
Gia_Obj_t * pObj;
|
||||
int i;
|
||||
Gia_ManForEachObj( p->pGia, pObj, i )
|
||||
{
|
||||
p->pNodes[i].lNode = Gia_ObjEdge(p, pObj);
|
||||
if ( Gia_ObjIsAnd(pObj) )
|
||||
{
|
||||
p->pNodes[i].lNode += Gia_ObjEdgeFanin0(p, pObj);
|
||||
p->pNodes[i].lNode += Gia_ObjEdgeFanin1(p, pObj);
|
||||
p->pNodes[i].lNode /= 3.0;
|
||||
}
|
||||
else if ( Gia_ObjIsCo(pObj) )
|
||||
{
|
||||
p->pNodes[i].lNode += Gia_ObjEdgeFanin0(p, pObj);
|
||||
p->pNodes[i].lNode /= 2.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Sorts objects by their new centers.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
int For_ObjCompare( For_Obj_t ** pp0, For_Obj_t ** pp1 )
|
||||
{
|
||||
if ( (*pp0)->lNode < (*pp1)->lNode )
|
||||
return -1;
|
||||
if ( (*pp0)->lNode > (*pp1)->lNode )
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Sorts objects by their new centers.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void For_ManSortObjects( For_Man_t * p )
|
||||
{
|
||||
For_Obj_t * pNode, * pPrev;
|
||||
Vec_Ptr_t * vArray;
|
||||
int i, k, iPlace;
|
||||
// link the nodes into lists by cost
|
||||
memset( p->piRoot, 0xff, sizeof(int) * p->nObjs );
|
||||
for ( i = 0; i < p->nObjs; i++ )
|
||||
{
|
||||
p->pNodes[i].iObj = i;
|
||||
iPlace = (int)p->pNodes[i].lNode;
|
||||
assert( iPlace >= 0 && iPlace < p->nObjs );
|
||||
p->piNext[i] = p->piRoot[iPlace];
|
||||
p->piRoot[iPlace] = i;
|
||||
}
|
||||
// recostruct the order
|
||||
p->iObj = 0;
|
||||
pPrev = NULL;
|
||||
vArray = Vec_PtrAlloc( 100 );
|
||||
for ( i = 0; i < p->nObjs; i++ )
|
||||
{
|
||||
Vec_PtrClear( vArray );
|
||||
for ( k = p->piRoot[i]; ~((unsigned)k); k = p->piNext[k] )
|
||||
Vec_PtrPush( vArray, p->pNodes + k );
|
||||
Vec_PtrSort( vArray, (int (*)())For_ObjCompare );
|
||||
Vec_PtrForEachEntry( vArray, pNode, k )
|
||||
{
|
||||
p->pPlace[ pNode->iObj ] = p->iObj++;
|
||||
assert( !pPrev || pPrev->lNode <= pNode->lNode );
|
||||
pPrev = pNode;
|
||||
}
|
||||
}
|
||||
Vec_PtrFree( vArray );
|
||||
assert( p->iObj == p->nObjs );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
|
@ -138,23 +445,82 @@ void Gia_SortVerifySorted( int * pArray, int nSize )
|
|||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Gia_SortTest()
|
||||
void For_ManPlaceByForce( For_Man_t * p )
|
||||
{
|
||||
int nSize = 1000000;
|
||||
int * pArray;
|
||||
int clk, Iter, fUseCut = 1;
|
||||
double iCostThis, iCostPrev;
|
||||
iCostThis = fUseCut? For_ManGetMaxCut(p) : For_ManGetEdgeSpan(p);
|
||||
printf( "Init = %12.0f. \n", iCostThis );
|
||||
Iter = 0;
|
||||
do {
|
||||
Iter++;
|
||||
iCostPrev = iCostThis;
|
||||
clk = clock();
|
||||
For_ManEdgeCenters( p );
|
||||
//ABC_PRT( "Time", clock() - clk );
|
||||
clk = clock();
|
||||
For_ManObjCenters( p );
|
||||
//ABC_PRT( "Time", clock() - clk );
|
||||
clk = clock();
|
||||
For_ManSortObjects( p );
|
||||
//ABC_PRT( "Time", clock() - clk );
|
||||
iCostThis = fUseCut? For_ManGetMaxCut(p) : For_ManGetEdgeSpan(p);
|
||||
printf( "%4d = %12.0f. \n", Iter, iCostThis );
|
||||
} while ( iCostPrev > iCostThis );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void For_ManExperiment( Gia_Man_t * pGia )
|
||||
{
|
||||
For_Man_t * p;
|
||||
int clk = clock();
|
||||
pArray = Gia_SortGetTest( nSize );
|
||||
p = For_ManStart( pGia );
|
||||
Gia_ManCreateRefs( pGia );
|
||||
|
||||
// use DSF order
|
||||
clk = clock();
|
||||
qsort( pArray, nSize, 4, (int (*)(const void *, const void *)) num_cmp );
|
||||
ABC_PRT( "qsort ", clock() - clk );
|
||||
Gia_SortVerifySorted( pArray, nSize );
|
||||
ABC_FREE( pArray );
|
||||
pArray = Gia_SortGetTest( nSize );
|
||||
For_ManSetInitPlaceDfs( p, 0 );
|
||||
printf( "Tot span = %12.0f ", For_ManGetEdgeSpan(p) );
|
||||
printf( "Max span = %8d ", For_ManGetMaxCut(p) );
|
||||
ABC_PRT( "Time", clock() - clk );
|
||||
|
||||
clk = clock();
|
||||
minisat_sort( pArray, nSize, (int (*)(const void *, const void *)) num_cmp );
|
||||
ABC_PRT( "minisat", clock() - clk );
|
||||
Gia_SortVerifySorted( pArray, nSize );
|
||||
ABC_FREE( pArray );
|
||||
For_ManPlaceByForce( p );
|
||||
ABC_PRT( "Time", clock() - clk );
|
||||
|
||||
// use modified DFS order
|
||||
clk = clock();
|
||||
For_ManSetInitPlaceDfs( p, 1 );
|
||||
printf( "Tot span = %12.0f ", For_ManGetEdgeSpan(p) );
|
||||
printf( "Max span = %8d ", For_ManGetMaxCut(p) );
|
||||
ABC_PRT( "Time", clock() - clk );
|
||||
|
||||
clk = clock();
|
||||
For_ManPlaceByForce( p );
|
||||
ABC_PRT( "Time", clock() - clk );
|
||||
|
||||
// use random order
|
||||
clk = clock();
|
||||
For_ManSetInitPlaceRandom( p );
|
||||
printf( "Tot span = %12.0f ", For_ManGetEdgeSpan(p) );
|
||||
printf( "Max span = %8d ", For_ManGetMaxCut(p) );
|
||||
ABC_PRT( "Time", clock() - clk );
|
||||
|
||||
clk = clock();
|
||||
For_ManPlaceByForce( p );
|
||||
ABC_PRT( "Time", clock() - clk );
|
||||
|
||||
For_ManStop( p );
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -615,7 +615,7 @@ static inline unsigned Gli_ManUpdateRandomInput( unsigned uInfo, float PiTransPr
|
|||
return Aig_ManRandom(0);
|
||||
for ( i = 0; i < 32; i++ )
|
||||
if ( Multi * (Aig_ManRandom(0) & 0xffff) < PiTransProb )
|
||||
uInfo ^= 1;
|
||||
uInfo ^= (1 << i);
|
||||
return uInfo;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,725 +0,0 @@
|
|||
/**CFile****************************************************************
|
||||
|
||||
FileName [giaLogic.c]
|
||||
|
||||
SystemName [ABC: Logic synthesis and verification system.]
|
||||
|
||||
PackageName [Scalable AIG package.]
|
||||
|
||||
Synopsis [Logic network derived from AIG.]
|
||||
|
||||
Author [Alan Mishchenko]
|
||||
|
||||
Affiliation [UC Berkeley]
|
||||
|
||||
Date [Ver. 1.0. Started - June 20, 2005.]
|
||||
|
||||
Revision [$Id: giaLogic.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
|
||||
|
||||
***********************************************************************/
|
||||
|
||||
#include <math.h>
|
||||
#include "gia.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// DECLARATIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef struct Log_Obj_t_ Log_Obj_t;
|
||||
struct Log_Obj_t_
|
||||
{
|
||||
unsigned fTerm : 1; // terminal node (CI/CO)
|
||||
unsigned fMark0 : 1; // first user-controlled mark
|
||||
unsigned fMark1 : 1; // second user-controlled mark
|
||||
unsigned nFanins : 28; // the number of fanins
|
||||
unsigned nFanouts; // the number of fanouts
|
||||
unsigned hHandle; // the handle of the node
|
||||
union {
|
||||
unsigned TravId; // user-specified value
|
||||
unsigned iFanin;
|
||||
};
|
||||
union {
|
||||
unsigned Value; // user-specified value
|
||||
unsigned iFanout;
|
||||
};
|
||||
int Fanios[0]; // the array of fanins/fanouts
|
||||
};
|
||||
|
||||
typedef struct Log_Man_t_ Log_Man_t;
|
||||
struct Log_Man_t_
|
||||
{
|
||||
Gia_Man_t * pGia; // the original AIG manager
|
||||
Vec_Int_t * vCis; // the vector of CIs (PIs + LOs)
|
||||
Vec_Int_t * vCos; // the vector of COs (POs + LIs)
|
||||
int nObjs; // the number of objects
|
||||
int nNodes; // the number of nodes
|
||||
int nTravIds; // traversal ID of the network
|
||||
int * pObjData; // the array containing data for objects
|
||||
int nObjData; // the size of array to store the logic network
|
||||
};
|
||||
|
||||
static inline int Log_ManCiNum( Log_Man_t * p ) { return Vec_IntSize(p->vCis); }
|
||||
static inline int Log_ManCoNum( Log_Man_t * p ) { return Vec_IntSize(p->vCos); }
|
||||
static inline int Log_ManObjNum( Log_Man_t * p ) { return p->nObjs; }
|
||||
static inline int Log_ManNodeNum( Log_Man_t * p ) { return p->nNodes; }
|
||||
|
||||
static inline Log_Obj_t * Log_ManObj( Log_Man_t * p, unsigned hHandle ) { return (Log_Obj_t *)(p->pObjData + hHandle); }
|
||||
static inline Log_Obj_t * Log_ManCi( Log_Man_t * p, int i ) { return Log_ManObj( p, Vec_IntEntry(p->vCis,i) ); }
|
||||
static inline Log_Obj_t * Log_ManCo( Log_Man_t * p, int i ) { return Log_ManObj( p, Vec_IntEntry(p->vCos,i) ); }
|
||||
|
||||
static inline int Log_ObjIsTerm( Log_Obj_t * pObj ) { return pObj->fTerm; }
|
||||
static inline int Log_ObjIsCi( Log_Obj_t * pObj ) { return pObj->fTerm && pObj->nFanins == 0; }
|
||||
static inline int Log_ObjIsCo( Log_Obj_t * pObj ) { return pObj->fTerm && pObj->nFanins == 1; }
|
||||
static inline int Log_ObjIsNode( Log_Obj_t * pObj ) { return!pObj->fTerm && pObj->nFanins > 0; }
|
||||
static inline int Log_ObjIsConst0( Log_Obj_t * pObj ) { return!pObj->fTerm && pObj->nFanins == 0; }
|
||||
|
||||
static inline int Log_ObjFaninNum( Log_Obj_t * pObj ) { return pObj->nFanins; }
|
||||
static inline int Log_ObjFanoutNum( Log_Obj_t * pObj ) { return pObj->nFanouts; }
|
||||
static inline int Log_ObjSize( Log_Obj_t * pObj ) { return sizeof(Log_Obj_t) / 4 + pObj->nFanins + pObj->nFanouts; }
|
||||
static inline Log_Obj_t * Log_ObjFanin( Log_Obj_t * pObj, int i ) { return (Log_Obj_t *)(((int *)pObj) - pObj->Fanios[i]); }
|
||||
static inline Log_Obj_t * Log_ObjFanout( Log_Obj_t * pObj, int i ) { return (Log_Obj_t *)(((int *)pObj) + pObj->Fanios[pObj->nFanins+i]); }
|
||||
|
||||
static inline void Log_ManResetTravId( Log_Man_t * p ) { extern void Log_ManCleanTravId( Log_Man_t * p ); Log_ManCleanTravId( p ); p->nTravIds = 1; }
|
||||
static inline void Log_ManIncrementTravId( Log_Man_t * p ) { p->nTravIds++; }
|
||||
static inline void Log_ObjSetTravId( Log_Obj_t * pObj, int TravId ) { pObj->TravId = TravId; }
|
||||
static inline void Log_ObjSetTravIdCurrent( Log_Man_t * p, Log_Obj_t * pObj ) { pObj->TravId = p->nTravIds; }
|
||||
static inline void Log_ObjSetTravIdPrevious( Log_Man_t * p, Log_Obj_t * pObj ) { pObj->TravId = p->nTravIds - 1; }
|
||||
static inline int Log_ObjIsTravIdCurrent( Log_Man_t * p, Log_Obj_t * pObj ) { return ((int)pObj->TravId == p->nTravIds); }
|
||||
static inline int Log_ObjIsTravIdPrevious( Log_Man_t * p, Log_Obj_t * pObj ) { return ((int)pObj->TravId == p->nTravIds - 1); }
|
||||
|
||||
#define Log_ManForEachObj( p, pObj, i ) \
|
||||
for ( i = 0; (i < p->nObjData) && (pObj = Log_ManObj(p,i)); i += Log_ObjSize(pObj) )
|
||||
#define Log_ManForEachNode( p, pObj, i ) \
|
||||
for ( i = 0; (i < p->nObjData) && (pObj = Log_ManObj(p,i)); i += Log_ObjSize(pObj) ) if ( Log_ObjIsTerm(pObj) ) {} else
|
||||
#define Log_ManForEachObjVec( vVec, p, pObj, i ) \
|
||||
for ( i = 0; (i < Vec_IntSize(vVec)) && ((pObj) = Log_ManObj(p, Vec_IntEntry(vVec,i))); i++ )
|
||||
#define Log_ObjForEachFanin( pObj, pNext, i ) \
|
||||
for ( i = 0; (i < (int)pObj->nFanins) && (pNext = Log_ObjFanin(pObj,i)); i++ )
|
||||
#define Log_ObjForEachFanout( pObj, pNext, i ) \
|
||||
for ( i = 0; (i < (int)pObj->nFanouts) && (pNext = Log_ObjFanout(pObj,i)); i++ )
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// FUNCTION DEFINITIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Collect the fanin IDs.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Log_ManCollectSuper( Gia_Man_t * p, Gia_Obj_t * pObj, Vec_Int_t * vSuper )
|
||||
{
|
||||
if ( pObj->fMark0 )
|
||||
{
|
||||
Vec_IntPushUnique( vSuper, Gia_ObjId(p, pObj) );
|
||||
return;
|
||||
}
|
||||
assert( Gia_ObjIsAnd(pObj) );
|
||||
Log_ManCollectSuper( p, Gia_ObjFanin0(pObj), vSuper );
|
||||
Log_ManCollectSuper( p, Gia_ObjFanin1(pObj), vSuper );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Assigns references while removing the MUX/XOR ones.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Log_ManCreateRefsSpecial( Gia_Man_t * p )
|
||||
{
|
||||
Gia_Obj_t * pObj, * pFan0, * pFan1;
|
||||
Gia_Obj_t * pObjC, * pObjD0, * pObjD1;
|
||||
int i;
|
||||
assert( p->pRefs == NULL );
|
||||
Gia_ManCleanMark0( p );
|
||||
Gia_ManCreateRefs( p );
|
||||
Gia_ManForEachAnd( p, pObj, i )
|
||||
{
|
||||
assert( pObj->fMark0 == 0 );
|
||||
pFan0 = Gia_ObjFanin0(pObj);
|
||||
pFan1 = Gia_ObjFanin1(pObj);
|
||||
// skip nodes whose fanins are PIs or are already marked
|
||||
if ( Gia_ObjIsCi(pFan0) || pFan0->fMark0 ||
|
||||
Gia_ObjIsCi(pFan1) || pFan1->fMark0 )
|
||||
continue;
|
||||
// skip nodes that are not MUX type
|
||||
if ( !Gia_ObjIsMuxType(pObj) )
|
||||
continue;
|
||||
// the node is MUX type, mark it and its fanins
|
||||
pObj->fMark0 = 1;
|
||||
pFan0->fMark0 = 1;
|
||||
pFan1->fMark0 = 1;
|
||||
// deref the control
|
||||
pObjC = Gia_ObjRecognizeMux( pObj, &pObjD1, &pObjD0 );
|
||||
Gia_ObjRefDec( p, Gia_Regular(pObjC) );
|
||||
if ( Gia_Regular(pObjD0) == Gia_Regular(pObjD1) )
|
||||
Gia_ObjRefDec( p, Gia_Regular(pObjD0) );
|
||||
}
|
||||
Gia_ManForEachAnd( p, pObj, i )
|
||||
assert( Gia_ObjRefs(p, pObj) > 0 );
|
||||
Gia_ManCleanMark0( p );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Assigns references while removing the MUX/XOR ones.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Log_ManTransformRefs( Gia_Man_t * p, int * pnObjs, int * pnFanios )
|
||||
{
|
||||
Vec_Int_t * vSuper;
|
||||
Gia_Obj_t * pObj, * pFanin;
|
||||
int i, k, Counter;
|
||||
assert( p->pRefs != NULL );
|
||||
|
||||
// mark nodes to be used in the logic network
|
||||
Gia_ManCleanMark0( p );
|
||||
Gia_ManConst0(p)->fMark0 = 1;
|
||||
// mark the inputs
|
||||
Gia_ManForEachCi( p, pObj, i )
|
||||
pObj->fMark0 = 1;
|
||||
// mark those nodes that have ref count more than 1
|
||||
Gia_ManForEachAnd( p, pObj, i )
|
||||
pObj->fMark0 = (Gia_ObjRefs(p, pObj) > 1);
|
||||
// mark the output drivers
|
||||
Gia_ManForEachCoDriver( p, pObj, i )
|
||||
pObj->fMark0 = 1;
|
||||
|
||||
// count the number of nodes
|
||||
Counter = 0;
|
||||
Gia_ManForEachObj( p, pObj, i )
|
||||
Counter += pObj->fMark0;
|
||||
*pnObjs = Counter + Gia_ManCoNum(p);
|
||||
|
||||
// reset the references
|
||||
ABC_FREE( p->pRefs );
|
||||
p->pRefs = ABC_CALLOC( int, Gia_ManObjNum(p) );
|
||||
// reference from internal nodes
|
||||
Counter = 0;
|
||||
vSuper = Vec_IntAlloc( 100 );
|
||||
Gia_ManForEachAnd( p, pObj, i )
|
||||
{
|
||||
if ( pObj->fMark0 == 0 )
|
||||
continue;
|
||||
Vec_IntClear( vSuper );
|
||||
pObj->fMark0 = 0;
|
||||
Log_ManCollectSuper( p, pObj, vSuper );
|
||||
pObj->fMark0 = 1;
|
||||
Gia_ManForEachObjVec( vSuper, p, pFanin, k )
|
||||
{
|
||||
assert( pFanin->fMark0 );
|
||||
Gia_ObjRefInc( p, pFanin );
|
||||
}
|
||||
Counter += Vec_IntSize( vSuper );
|
||||
}
|
||||
Vec_IntFree( vSuper );
|
||||
// reference from outputs
|
||||
Gia_ManForEachCoDriver( p, pObj, i )
|
||||
{
|
||||
assert( pObj->fMark0 );
|
||||
Gia_ObjRefInc( p, pObj );
|
||||
}
|
||||
*pnFanios = Counter + Gia_ManCoNum(p);
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Creates fanin/fanout pair.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Log_ObjAddFanin( Log_Obj_t * pObj, Log_Obj_t * pFanin )
|
||||
{
|
||||
assert( pObj->iFanin < pObj->nFanins );
|
||||
assert( pFanin->iFanout < pFanin->nFanouts );
|
||||
pFanin->Fanios[pFanin->nFanins + pFanin->iFanout++] =
|
||||
pObj->Fanios[pObj->iFanin++] = pObj->hHandle - pFanin->hHandle;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Creates logic network isomorphic to the given AIG.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Log_Man_t * Log_ManStart( Gia_Man_t * pGia )
|
||||
{
|
||||
Log_Man_t * p;
|
||||
Log_Obj_t * pObjLog, * pFanLog;
|
||||
Gia_Obj_t * pObj, * pFanin;
|
||||
Vec_Int_t * vSuper;
|
||||
int nObjs, nFanios;
|
||||
int i, k, hHandle = 0;
|
||||
// prepare the AIG
|
||||
// Gia_ManCreateRefs( pGia );
|
||||
Log_ManCreateRefsSpecial( pGia );
|
||||
Log_ManTransformRefs( pGia, &nObjs, &nFanios );
|
||||
Gia_ManFillValue( pGia );
|
||||
// create logic network
|
||||
p = ABC_CALLOC( Log_Man_t, 1 );
|
||||
p->pGia = pGia;
|
||||
p->vCis = Vec_IntAlloc( Gia_ManCiNum(pGia) );
|
||||
p->vCos = Vec_IntAlloc( Gia_ManCoNum(pGia) );
|
||||
p->nObjData = (sizeof(Log_Obj_t) / 4) * nObjs + 2 * nFanios;
|
||||
p->pObjData = ABC_CALLOC( int, p->nObjData );
|
||||
// create constant node
|
||||
Gia_ManConst0(pGia)->Value = hHandle;
|
||||
pObjLog = Log_ManObj( p, hHandle );
|
||||
pObjLog->hHandle = hHandle;
|
||||
pObjLog->nFanins = 0;
|
||||
pObjLog->nFanouts = Gia_ObjRefs( pGia, Gia_ManConst0(pGia) );
|
||||
// count objects
|
||||
hHandle += Log_ObjSize( pObjLog );
|
||||
p->nNodes++;
|
||||
p->nObjs++;
|
||||
// create the PIs
|
||||
Gia_ManForEachCi( pGia, pObj, i )
|
||||
{
|
||||
// create PI object
|
||||
pObj->Value = hHandle;
|
||||
Vec_IntPush( p->vCis, hHandle );
|
||||
pObjLog = Log_ManObj( p, hHandle );
|
||||
pObjLog->hHandle = hHandle;
|
||||
pObjLog->nFanins = 0;
|
||||
pObjLog->nFanouts = Gia_ObjRefs( pGia, pObj );
|
||||
pObjLog->fTerm = 1;
|
||||
// count objects
|
||||
hHandle += Log_ObjSize( pObjLog );
|
||||
p->nObjs++;
|
||||
}
|
||||
// create internal nodes
|
||||
vSuper = Vec_IntAlloc( 100 );
|
||||
Gia_ManForEachAnd( pGia, pObj, i )
|
||||
{
|
||||
if ( pObj->fMark0 == 0 )
|
||||
{
|
||||
assert( Gia_ObjRefs( pGia, pObj ) == 0 );
|
||||
continue;
|
||||
}
|
||||
assert( Gia_ObjRefs( pGia, pObj ) > 0 );
|
||||
// collect fanins
|
||||
Vec_IntClear( vSuper );
|
||||
pObj->fMark0 = 0;
|
||||
Log_ManCollectSuper( pGia, pObj, vSuper );
|
||||
pObj->fMark0 = 1;
|
||||
// create node object
|
||||
pObj->Value = hHandle;
|
||||
pObjLog = Log_ManObj( p, hHandle );
|
||||
pObjLog->hHandle = hHandle;
|
||||
pObjLog->nFanins = Vec_IntSize( vSuper );
|
||||
pObjLog->nFanouts = Gia_ObjRefs( pGia, pObj );
|
||||
// add fanins
|
||||
Gia_ManForEachObjVec( vSuper, pGia, pFanin, k )
|
||||
{
|
||||
pFanLog = Log_ManObj( p, Gia_ObjValue(pFanin) );
|
||||
Log_ObjAddFanin( pObjLog, pFanLog );
|
||||
}
|
||||
// count objects
|
||||
hHandle += Log_ObjSize( pObjLog );
|
||||
p->nNodes++;
|
||||
p->nObjs++;
|
||||
}
|
||||
Vec_IntFree( vSuper );
|
||||
// create the POs
|
||||
Gia_ManForEachCo( pGia, pObj, i )
|
||||
{
|
||||
// create PO object
|
||||
pObj->Value = hHandle;
|
||||
Vec_IntPush( p->vCos, hHandle );
|
||||
pObjLog = Log_ManObj( p, hHandle );
|
||||
pObjLog->hHandle = hHandle;
|
||||
pObjLog->nFanins = 1;
|
||||
pObjLog->nFanouts = 0;
|
||||
pObjLog->fTerm = 1;
|
||||
// add fanins
|
||||
pFanLog = Log_ManObj( p, Gia_ObjValue(Gia_ObjFanin0(pObj)) );
|
||||
Log_ObjAddFanin( pObjLog, pFanLog );
|
||||
// count objects
|
||||
hHandle += Log_ObjSize( pObjLog );
|
||||
p->nObjs++;
|
||||
}
|
||||
Gia_ManCleanMark0( pGia );
|
||||
assert( nObjs == p->nObjs );
|
||||
assert( hHandle == p->nObjData );
|
||||
// make sure the fanin/fanout counters are correct
|
||||
Gia_ManForEachObj( pGia, pObj, i )
|
||||
{
|
||||
if ( !~Gia_ObjValue(pObj) )
|
||||
continue;
|
||||
pObjLog = Log_ManObj( p, Gia_ObjValue(pObj) );
|
||||
assert( pObjLog->nFanins == pObjLog->iFanin );
|
||||
assert( pObjLog->nFanouts == pObjLog->iFanout );
|
||||
pObjLog->iFanin = pObjLog->iFanout = 0;
|
||||
}
|
||||
ABC_FREE( pGia->pRefs );
|
||||
return p;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Creates logic network isomorphic to the given AIG.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Log_ManPrintStats( Log_Man_t * p )
|
||||
{
|
||||
// if ( p->pName )
|
||||
// printf( "%8s : ", p->pName );
|
||||
printf( "i/o =%7d/%7d ", Log_ManCiNum(p), Log_ManCoNum(p) );
|
||||
// if ( Log_ManRegNum(p) )
|
||||
// printf( "ff =%7d ", Log_ManRegNum(p) );
|
||||
printf( "node =%8d ", Log_ManNodeNum(p) );
|
||||
// printf( "lev =%5d ", Log_ManLevelNum(p) );
|
||||
// printf( "cut =%5d ", Log_ManCrossCut(p) );
|
||||
printf( "mem =%5.2f Mb", 4.0*p->nObjData/(1<<20) );
|
||||
// printf( "obj =%5d ", Log_ManObjNum(p) );
|
||||
printf( "\n" );
|
||||
|
||||
// Log_ManSatExperiment( p );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Creates logic network isomorphic to the given AIG.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Log_ManStop( Log_Man_t * p )
|
||||
{
|
||||
Vec_IntFree( p->vCis );
|
||||
Vec_IntFree( p->vCos );
|
||||
ABC_FREE( p->pObjData );
|
||||
ABC_FREE( p );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Cleans the value.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Log_ManCleanTravId( Log_Man_t * p )
|
||||
{
|
||||
Log_Obj_t * pObj;
|
||||
int i;
|
||||
Log_ManForEachObj( p, pObj, i )
|
||||
pObj->TravId = 0;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Cleans the value.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Log_ManCleanValue( Log_Man_t * p )
|
||||
{
|
||||
Log_Obj_t * pObj;
|
||||
int i;
|
||||
Log_ManForEachObj( p, pObj, i )
|
||||
pObj->Value = 0;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Prints the distribution of fanins/fanouts in the network.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Log_ManPrintFanio( Log_Man_t * p )
|
||||
{
|
||||
char Buffer[100];
|
||||
Log_Obj_t * pNode;
|
||||
Vec_Int_t * vFanins, * vFanouts;
|
||||
int nFanins, nFanouts, nFaninsMax, nFanoutsMax, nFaninsAll, nFanoutsAll;
|
||||
int i, k, nSizeMax;
|
||||
|
||||
// determine the largest fanin and fanout
|
||||
nFaninsMax = nFanoutsMax = 0;
|
||||
nFaninsAll = nFanoutsAll = 0;
|
||||
Log_ManForEachNode( p, pNode, i )
|
||||
{
|
||||
if ( i == 0 ) continue; // skip const 0 obj
|
||||
nFanins = Log_ObjFaninNum(pNode);
|
||||
nFanouts = Log_ObjFanoutNum(pNode);
|
||||
nFaninsAll += nFanins;
|
||||
nFanoutsAll += nFanouts;
|
||||
nFaninsMax = ABC_MAX( nFaninsMax, nFanins );
|
||||
nFanoutsMax = ABC_MAX( nFanoutsMax, nFanouts );
|
||||
}
|
||||
|
||||
// allocate storage for fanin/fanout numbers
|
||||
nSizeMax = AIG_MAX( 10 * (Aig_Base10Log(nFaninsMax) + 1), 10 * (Aig_Base10Log(nFanoutsMax) + 1) );
|
||||
vFanins = Vec_IntStart( nSizeMax );
|
||||
vFanouts = Vec_IntStart( nSizeMax );
|
||||
|
||||
// count the number of fanins and fanouts
|
||||
Log_ManForEachNode( p, pNode, i )
|
||||
{
|
||||
if ( i == 0 ) continue; // skip const 0 obj
|
||||
nFanins = Log_ObjFaninNum(pNode);
|
||||
nFanouts = Log_ObjFanoutNum(pNode);
|
||||
|
||||
if ( nFanins < 10 )
|
||||
Vec_IntAddToEntry( vFanins, nFanins, 1 );
|
||||
else if ( nFanins < 100 )
|
||||
Vec_IntAddToEntry( vFanins, 10 + nFanins/10, 1 );
|
||||
else if ( nFanins < 1000 )
|
||||
Vec_IntAddToEntry( vFanins, 20 + nFanins/100, 1 );
|
||||
else if ( nFanins < 10000 )
|
||||
Vec_IntAddToEntry( vFanins, 30 + nFanins/1000, 1 );
|
||||
else if ( nFanins < 100000 )
|
||||
Vec_IntAddToEntry( vFanins, 40 + nFanins/10000, 1 );
|
||||
else if ( nFanins < 1000000 )
|
||||
Vec_IntAddToEntry( vFanins, 50 + nFanins/100000, 1 );
|
||||
else if ( nFanins < 10000000 )
|
||||
Vec_IntAddToEntry( vFanins, 60 + nFanins/1000000, 1 );
|
||||
|
||||
if ( nFanouts < 10 )
|
||||
Vec_IntAddToEntry( vFanouts, nFanouts, 1 );
|
||||
else if ( nFanouts < 100 )
|
||||
Vec_IntAddToEntry( vFanouts, 10 + nFanouts/10, 1 );
|
||||
else if ( nFanouts < 1000 )
|
||||
Vec_IntAddToEntry( vFanouts, 20 + nFanouts/100, 1 );
|
||||
else if ( nFanouts < 10000 )
|
||||
Vec_IntAddToEntry( vFanouts, 30 + nFanouts/1000, 1 );
|
||||
else if ( nFanouts < 100000 )
|
||||
Vec_IntAddToEntry( vFanouts, 40 + nFanouts/10000, 1 );
|
||||
else if ( nFanouts < 1000000 )
|
||||
Vec_IntAddToEntry( vFanouts, 50 + nFanouts/100000, 1 );
|
||||
else if ( nFanouts < 10000000 )
|
||||
Vec_IntAddToEntry( vFanouts, 60 + nFanouts/1000000, 1 );
|
||||
}
|
||||
|
||||
printf( "The distribution of fanins and fanouts in the network:\n" );
|
||||
printf( " Number Nodes with fanin Nodes with fanout\n" );
|
||||
for ( k = 0; k < nSizeMax; k++ )
|
||||
{
|
||||
if ( vFanins->pArray[k] == 0 && vFanouts->pArray[k] == 0 )
|
||||
continue;
|
||||
if ( k < 10 )
|
||||
printf( "%15d : ", k );
|
||||
else
|
||||
{
|
||||
sprintf( Buffer, "%d - %d", (int)pow(10, k/10) * (k%10), (int)pow(10, k/10) * (k%10+1) - 1 );
|
||||
printf( "%15s : ", Buffer );
|
||||
}
|
||||
if ( vFanins->pArray[k] == 0 )
|
||||
printf( " " );
|
||||
else
|
||||
printf( "%12d ", vFanins->pArray[k] );
|
||||
printf( " " );
|
||||
if ( vFanouts->pArray[k] == 0 )
|
||||
printf( " " );
|
||||
else
|
||||
printf( "%12d ", vFanouts->pArray[k] );
|
||||
printf( "\n" );
|
||||
}
|
||||
Vec_IntFree( vFanins );
|
||||
Vec_IntFree( vFanouts );
|
||||
|
||||
printf( "Fanins: Max = %d. Ave = %.2f. Fanouts: Max = %d. Ave = %.2f.\n",
|
||||
nFaninsMax, 1.0*nFaninsAll/Log_ManNodeNum(p),
|
||||
nFanoutsMax, 1.0*nFanoutsAll/Log_ManNodeNum(p) );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Computes the distance from the given object]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
int Log_ManComputeDistance( Log_Man_t * p, Log_Obj_t * pPivot )
|
||||
{
|
||||
Vec_Int_t * vThis, * vNext, * vTemp;
|
||||
Log_Obj_t * pThis, * pNext;
|
||||
int i, k, d, nVisited = 0;
|
||||
// assert( Log_ObjIsTerm(pPivot) );
|
||||
vThis = Vec_IntAlloc( 1000 );
|
||||
vNext = Vec_IntAlloc( 1000 );
|
||||
Log_ManIncrementTravId( p );
|
||||
Log_ObjSetTravIdCurrent( p, pPivot );
|
||||
Vec_IntPush( vThis, pPivot->hHandle );
|
||||
for ( d = 0; Vec_IntSize(vThis) > 0; d++ )
|
||||
{
|
||||
nVisited += Vec_IntSize(vThis);
|
||||
Vec_IntClear( vNext );
|
||||
Log_ManForEachObjVec( vThis, p, pThis, i )
|
||||
{
|
||||
Log_ObjForEachFanin( pThis, pNext, k )
|
||||
{
|
||||
if ( Log_ObjIsTravIdCurrent(p, pNext) )
|
||||
continue;
|
||||
Log_ObjSetTravIdCurrent(p, pNext);
|
||||
Vec_IntPush( vNext, pNext->hHandle );
|
||||
nVisited += !Log_ObjIsTerm(pNext);
|
||||
}
|
||||
Log_ObjForEachFanout( pThis, pNext, k )
|
||||
{
|
||||
if ( Log_ObjIsTravIdCurrent(p, pNext) )
|
||||
continue;
|
||||
Log_ObjSetTravIdCurrent(p, pNext);
|
||||
Vec_IntPush( vNext, pNext->hHandle );
|
||||
nVisited += !Log_ObjIsTerm(pNext);
|
||||
}
|
||||
}
|
||||
vTemp = vThis; vThis = vNext; vNext = vTemp;
|
||||
}
|
||||
Vec_IntFree( vThis );
|
||||
Vec_IntFree( vNext );
|
||||
// check if there are several strongly connected components
|
||||
// if ( nVisited < Log_ManNodeNum(p) )
|
||||
// printf( "Visited less nodes (%d) than present (%d).\n", nVisited, Log_ManNodeNum(p) );
|
||||
return d;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Traverses from the given node.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Gia_ManTestDistanceInternal( Log_Man_t * p )
|
||||
{
|
||||
int nAttempts = 20;
|
||||
int i, iNode, Dist, clk;
|
||||
Log_Obj_t * pPivot, * pNext;
|
||||
Aig_ManRandom( 1 );
|
||||
Log_ManResetTravId( p );
|
||||
// compute distances from several randomly selected PIs
|
||||
clk = clock();
|
||||
printf( "From inputs: " );
|
||||
for ( i = 0; i < nAttempts; i++ )
|
||||
{
|
||||
iNode = Aig_ManRandom( 0 ) % Log_ManCiNum(p);
|
||||
pPivot = Log_ManCi( p, iNode );
|
||||
if ( Log_ObjFanoutNum(pPivot) == 0 )
|
||||
{ i--; continue; }
|
||||
pNext = Log_ObjFanout( pPivot, 0 );
|
||||
if ( !Log_ObjIsNode(pNext) )
|
||||
{ i--; continue; }
|
||||
Dist = Log_ManComputeDistance( p, pPivot );
|
||||
printf( "%d ", Dist );
|
||||
}
|
||||
ABC_PRT( "Time", clock() - clk );
|
||||
// compute distances from several randomly selected POs
|
||||
clk = clock();
|
||||
printf( "From outputs: " );
|
||||
for ( i = 0; i < nAttempts; i++ )
|
||||
{
|
||||
iNode = Aig_ManRandom( 0 ) % Log_ManCoNum(p);
|
||||
pPivot = Log_ManCo( p, iNode );
|
||||
pNext = Log_ObjFanin( pPivot, 0 );
|
||||
if ( !Log_ObjIsNode(pNext) )
|
||||
{ i--; continue; }
|
||||
Dist = Log_ManComputeDistance( p, pPivot );
|
||||
printf( "%d ", Dist );
|
||||
}
|
||||
ABC_PRT( "Time", clock() - clk );
|
||||
// compute distances from several randomly selected nodes
|
||||
clk = clock();
|
||||
printf( "From nodes: " );
|
||||
for ( i = 0; i < nAttempts; i++ )
|
||||
{
|
||||
iNode = Aig_ManRandom( 0 ) % Gia_ManObjNum(p->pGia);
|
||||
if ( !~Gia_ManObj(p->pGia, iNode)->Value )
|
||||
{ i--; continue; }
|
||||
pPivot = Log_ManObj( p, Gia_ManObj(p->pGia, iNode)->Value );
|
||||
if ( !Log_ObjIsNode(pPivot) )
|
||||
{ i--; continue; }
|
||||
Dist = Log_ManComputeDistance( p, pPivot );
|
||||
printf( "%d ", Dist );
|
||||
}
|
||||
ABC_PRT( "Time", clock() - clk );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Returns sorted array of node handles with largest fanout.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Gia_ManTestDistance( Gia_Man_t * pGia )
|
||||
{
|
||||
Log_Man_t * p;
|
||||
int clk = clock();
|
||||
p = Log_ManStart( pGia );
|
||||
// Log_ManPrintFanio( p );
|
||||
Log_ManPrintStats( p );
|
||||
ABC_PRT( "Time", clock() - clk );
|
||||
Gia_ManTestDistanceInternal( p );
|
||||
Log_ManStop( p );
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// END OF FILE ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
/**CFile****************************************************************
|
||||
|
||||
FileName [gia.c]
|
||||
|
||||
SystemName [ABC: Logic synthesis and verification system.]
|
||||
|
||||
PackageName [Scalable AIG package.]
|
||||
|
||||
Synopsis []
|
||||
|
||||
Author [Alan Mishchenko]
|
||||
|
||||
Affiliation [UC Berkeley]
|
||||
|
||||
Date [Ver. 1.0. Started - June 20, 2005.]
|
||||
|
||||
Revision [$Id: gia.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
|
||||
|
||||
***********************************************************************/
|
||||
|
||||
#include "gia.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// DECLARATIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// FUNCTION DEFINITIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [This is implementation of qsort in MiniSat.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
static int num_cmp1( int * x, int * y) { return ((*x) < (*y)) ? -1 : (((*x) > (*y)) ? 1 : 0); }
|
||||
static int num_cmp2( int * x, int * y) { return (*x) < (*y); }
|
||||
static inline void selectionsort(int* array, int size, int(*comp)(const void *, const void *))
|
||||
{
|
||||
int i, j, best_i;
|
||||
int tmp;
|
||||
for (i = 0; i < size-1; i++){
|
||||
best_i = i;
|
||||
for (j = i+1; j < size; j++){
|
||||
if (comp(array + j, array + best_i))
|
||||
best_i = j;
|
||||
}
|
||||
tmp = array[i]; array[i] = array[best_i]; array[best_i] = tmp;
|
||||
}
|
||||
}
|
||||
static void sort_rec(int* array, int size, int(*comp)(const void *, const void *))
|
||||
{
|
||||
if (size <= 15)
|
||||
selectionsort(array, size, comp);
|
||||
else{
|
||||
int * pivot = array + size/2;
|
||||
int tmp;
|
||||
int i = -1;
|
||||
int j = size;
|
||||
for(;;){
|
||||
do i++; while(comp(array + i, pivot));
|
||||
do j--; while(comp(pivot, array + j));
|
||||
if (i >= j) break;
|
||||
tmp = array[i]; array[i] = array[j]; array[j] = tmp;
|
||||
}
|
||||
sort_rec(array , i , comp);
|
||||
sort_rec(&array[i], size-i, comp);
|
||||
}
|
||||
}
|
||||
void minisat_sort(int* array, int size, int(*comp)(const void *, const void *))
|
||||
{
|
||||
sort_rec(array,size,comp);
|
||||
}
|
||||
|
||||
|
||||
int * Gia_SortGetTest( int nSize )
|
||||
{
|
||||
int i, * pArray;
|
||||
srand( 0 );
|
||||
pArray = ABC_ALLOC( int, nSize );
|
||||
for ( i = 0; i < nSize; i++ )
|
||||
pArray[i] = rand();
|
||||
return pArray;
|
||||
}
|
||||
void Gia_SortVerifySorted( int * pArray, int nSize )
|
||||
{
|
||||
int i;
|
||||
for ( i = 1; i < nSize; i++ )
|
||||
assert( pArray[i-1] <= pArray[i] );
|
||||
}
|
||||
void Gia_SortTest()
|
||||
{
|
||||
int nSize = 1000000;
|
||||
int * pArray;
|
||||
int clk = clock();
|
||||
|
||||
pArray = Gia_SortGetTest( nSize );
|
||||
clk = clock();
|
||||
qsort( pArray, nSize, 4, (int (*)(const void *, const void *)) num_cmp1 );
|
||||
ABC_PRT( "qsort ", clock() - clk );
|
||||
Gia_SortVerifySorted( pArray, nSize );
|
||||
ABC_FREE( pArray );
|
||||
|
||||
pArray = Gia_SortGetTest( nSize );
|
||||
clk = clock();
|
||||
minisat_sort( pArray, nSize, (int (*)(const void *, const void *)) num_cmp2 );
|
||||
ABC_PRT( "minisat", clock() - clk );
|
||||
Gia_SortVerifySorted( pArray, nSize );
|
||||
ABC_FREE( pArray );
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// END OF FILE ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
|
@ -66,6 +66,25 @@ void Gia_ManCleanMark0( Gia_Man_t * p )
|
|||
pObj->fMark0 = 0;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Sets phases of the internal nodes.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Gia_ManCheckMark0( Gia_Man_t * p )
|
||||
{
|
||||
Gia_Obj_t * pObj;
|
||||
int i;
|
||||
Gia_ManForEachObj( p, pObj, i )
|
||||
assert( pObj->fMark0 == 0 );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Sets phases of the internal nodes.]
|
||||
|
|
@ -104,6 +123,25 @@ void Gia_ManCleanMark1( Gia_Man_t * p )
|
|||
pObj->fMark1 = 0;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Sets phases of the internal nodes.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Gia_ManCheckMark1( Gia_Man_t * p )
|
||||
{
|
||||
Gia_Obj_t * pObj;
|
||||
int i;
|
||||
Gia_ManForEachObj( p, pObj, i )
|
||||
assert( pObj->fMark1 == 0 );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Cleans the value.]
|
||||
|
|
|
|||
|
|
@ -4,13 +4,13 @@ SRC += src/aig/gia/gia.c \
|
|||
src/aig/gia/giaCof.c \
|
||||
src/aig/gia/giaDfs.c \
|
||||
src/aig/gia/giaDup.c \
|
||||
src/aig/gia/giaEmbed.c \
|
||||
src/aig/gia/giaFanout.c \
|
||||
src/aig/gia/giaForce.c \
|
||||
src/aig/gia/giaFrames.c \
|
||||
src/aig/gia/giaFront.c \
|
||||
src/aig/gia/giaGlitch.c \
|
||||
src/aig/gia/giaHash.c \
|
||||
src/aig/gia/giaLogic.c \
|
||||
src/aig/gia/giaMan.c \
|
||||
src/aig/gia/giaScl.c \
|
||||
src/aig/gia/giaSim.c \
|
||||
|
|
|
|||
|
|
@ -292,6 +292,8 @@ static int Abc_CommandAbc9Frames ( Abc_Frame_t * pAbc, int argc, char ** arg
|
|||
static int Abc_CommandAbc9Scl ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
static int Abc_CommandAbc9Sat ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
static int Abc_CommandAbc9Fraig ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
static int Abc_CommandAbc9Force ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
static int Abc_CommandAbc9Embed ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
static int Abc_CommandAbc9Test ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
|
||||
static int Abc_CommandAbcTestNew ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
|
|
@ -593,6 +595,8 @@ void Abc_Init( Abc_Frame_t * pAbc )
|
|||
Cmd_CommandAdd( pAbc, "AIG", "&scl", Abc_CommandAbc9Scl, 0 );
|
||||
Cmd_CommandAdd( pAbc, "AIG", "&sat", Abc_CommandAbc9Sat, 0 );
|
||||
Cmd_CommandAdd( pAbc, "AIG", "&fraig", Abc_CommandAbc9Fraig, 0 );
|
||||
Cmd_CommandAdd( pAbc, "AIG", "&force", Abc_CommandAbc9Force, 0 );
|
||||
Cmd_CommandAdd( pAbc, "AIG", "&embed", Abc_CommandAbc9Embed, 0 );
|
||||
Cmd_CommandAdd( pAbc, "AIG", "&test", Abc_CommandAbc9Test, 0 );
|
||||
|
||||
Cmd_CommandAdd( pAbc, "Various", "testnew", Abc_CommandAbcTestNew, 0 );
|
||||
|
|
@ -22959,6 +22963,89 @@ usage:
|
|||
return 1;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
int Abc_CommandAbc9Force( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||
{
|
||||
int c;
|
||||
Extra_UtilGetoptReset();
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
|
||||
{
|
||||
switch ( c )
|
||||
{
|
||||
case 'h':
|
||||
goto usage;
|
||||
default:
|
||||
goto usage;
|
||||
}
|
||||
}
|
||||
if ( pAbc->pAig == NULL )
|
||||
{
|
||||
printf( "Abc_CommandAbc9Test(): There is no AIG.\n" );
|
||||
return 1;
|
||||
}
|
||||
For_ManExperiment( pAbc->pAig );
|
||||
return 0;
|
||||
|
||||
usage:
|
||||
fprintf( stdout, "usage: &force [-h]\n" );
|
||||
fprintf( stdout, "\t one-dimensional placement algorithm FORCE introduced by\n" );
|
||||
fprintf( stdout, "\t F. A. Aloul, I. L. Markov, and K. A. Sakallah (GLSVLSI’03).\n" );
|
||||
fprintf( stdout, "\t-h : print the command usage\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
int Abc_CommandAbc9Embed( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||
{
|
||||
int c;
|
||||
Extra_UtilGetoptReset();
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
|
||||
{
|
||||
switch ( c )
|
||||
{
|
||||
case 'h':
|
||||
goto usage;
|
||||
default:
|
||||
goto usage;
|
||||
}
|
||||
}
|
||||
if ( pAbc->pAig == NULL )
|
||||
{
|
||||
printf( "Abc_CommandAbc9Test(): There is no AIG.\n" );
|
||||
return 1;
|
||||
}
|
||||
Gia_ManSolveProblem( pAbc->pAig, 30, 2 );
|
||||
return 0;
|
||||
|
||||
usage:
|
||||
fprintf( stdout, "usage: &embed [-h]\n" );
|
||||
fprintf( stdout, "\t fast placement based on the technique introduced by\n" );
|
||||
fprintf( stdout, "\t D. Harel and Y. Koren, \"Graph drawing by high-dimensional\n" );
|
||||
fprintf( stdout, "\t embedding\", J. Graph Algs & Apps, Vol 8(2), pp. 195-217 (2004)\n" );
|
||||
fprintf( stdout, "\t-h : print the command usage\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
|
@ -22992,7 +23079,9 @@ int Abc_CommandAbc9Test( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
// Gia_ManFrontTest( pAbc->pAig );
|
||||
// Gia_ManReduceConst( pAbc->pAig, 1 );
|
||||
// Sat_ManTest( pAbc->pAig, Gia_ManCo(pAbc->pAig, 0), 0 );
|
||||
Gia_ManTestDistance( pAbc->pAig );
|
||||
// Gia_ManTestDistance( pAbc->pAig );
|
||||
// For_ManExperiment( pAbc->pAig );
|
||||
Gia_ManSolveProblem( pAbc->pAig, 30, 2 );
|
||||
return 0;
|
||||
|
||||
usage:
|
||||
|
|
|
|||
|
|
@ -576,14 +576,22 @@ int CmdCommandSource( Abc_Frame_t * pAbc, int argc, char **argv )
|
|||
* is. In particular, lp_file_index is never modified in the loop, so it
|
||||
* looks it would just read the same file over again. Also, SIS had
|
||||
* lp_count initialized to -1, and hence, any file sourced by SIS (if -l or
|
||||
* -t options on "source" were used in SIS) would actually be executed
|
||||
* twice.
|
||||
* -t options on "source" were used in SIS) would actually be executed twice.
|
||||
*/
|
||||
do
|
||||
{
|
||||
char * pFileName, * pTemp;
|
||||
|
||||
// get the input file name
|
||||
pFileName = argv[lp_file_index];
|
||||
// fix the wrong symbol
|
||||
for ( pTemp = pFileName; *pTemp; pTemp++ )
|
||||
if ( *pTemp == '>' )
|
||||
*pTemp = '\\';
|
||||
|
||||
lp_count++; /* increment the loop counter */
|
||||
|
||||
fp = CmdFileOpen( pAbc, argv[lp_file_index], "r", &real_filename, silent );
|
||||
fp = CmdFileOpen( pAbc, pFileName, "r", &real_filename, silent );
|
||||
if ( fp == NULL )
|
||||
{
|
||||
ABC_FREE( real_filename );
|
||||
|
|
|
|||
Loading…
Reference in New Issue