Commit 28d4f869 by Alan Mishchenko

Version abc90217

parent 0871bffa
...@@ -3623,6 +3623,10 @@ SOURCE=.\src\aig\gia\giaDup.c ...@@ -3623,6 +3623,10 @@ SOURCE=.\src\aig\gia\giaDup.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\src\aig\gia\giaEmbed.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\gia\giaFanout.c SOURCE=.\src\aig\gia\giaFanout.c
# End Source File # End Source File
# Begin Source File # Begin Source File
...@@ -3647,10 +3651,6 @@ SOURCE=.\src\aig\gia\giaHash.c ...@@ -3647,10 +3651,6 @@ SOURCE=.\src\aig\gia\giaHash.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\src\aig\gia\giaLogic.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\gia\giaMan.c SOURCE=.\src\aig\gia\giaMan.c
# End Source File # End Source File
# Begin Source File # Begin Source File
...@@ -3667,6 +3667,10 @@ SOURCE=.\src\aig\gia\giaSolver.c ...@@ -3667,6 +3667,10 @@ SOURCE=.\src\aig\gia\giaSolver.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\src\aig\gia\giaSort.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\gia\giaSwitch.c SOURCE=.\src\aig\gia\giaSwitch.c
# End Source File # End Source File
# Begin Source File # Begin Source File
......
...@@ -359,6 +359,8 @@ extern void Gia_ObjAddFanout( Gia_Man_t * p, Gia_Obj_t * pObj, Gi ...@@ -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_ObjRemoveFanout( Gia_Man_t * p, Gia_Obj_t * pObj, Gia_Obj_t * pFanout );
extern void Gia_ManFanoutStart( Gia_Man_t * p ); extern void Gia_ManFanoutStart( Gia_Man_t * p );
extern void Gia_ManFanoutStop( Gia_Man_t * p ); extern void Gia_ManFanoutStop( Gia_Man_t * p );
/*=== giaForce.c =========================================================*/
extern void For_ManExperiment( Gia_Man_t * pGia );
/*=== giaFrames.c =========================================================*/ /*=== giaFrames.c =========================================================*/
extern void Gia_ManFraSetDefaultParams( Gia_ParFra_t * p ); extern void Gia_ManFraSetDefaultParams( Gia_ParFra_t * p );
extern Gia_Man_t * Gia_ManFrames( Gia_Man_t * pAig, Gia_ParFra_t * pPars ); 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 ...@@ -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 ); extern Gia_Man_t * Gia_ManRehash( Gia_Man_t * p );
/*=== giaLogic.c ===========================================================*/ /*=== giaLogic.c ===========================================================*/
extern void Gia_ManTestDistance( Gia_Man_t * p ); extern void Gia_ManTestDistance( Gia_Man_t * p );
extern void Gia_ManSolveProblem( Gia_Man_t * pGia, int nDims, int nSols );
/*=== giaMan.c ===========================================================*/ /*=== giaMan.c ===========================================================*/
extern Gia_Man_t * Gia_ManStart( int nObjsMax ); extern Gia_Man_t * Gia_ManStart( int nObjsMax );
extern void Gia_ManStop( Gia_Man_t * p ); extern void Gia_ManStop( Gia_Man_t * p );
...@@ -396,8 +399,10 @@ extern Gia_Man_t * Gia_ManReduceConst( Gia_Man_t * pAig, int fVerbose ); ...@@ -396,8 +399,10 @@ extern Gia_Man_t * Gia_ManReduceConst( Gia_Man_t * pAig, int fVerbose );
/*=== giaUtil.c ===========================================================*/ /*=== giaUtil.c ===========================================================*/
extern void Gia_ManSetMark0( Gia_Man_t * p ); extern void Gia_ManSetMark0( Gia_Man_t * p );
extern void Gia_ManCleanMark0( 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_ManSetMark1( Gia_Man_t * p );
extern void Gia_ManCleanMark1( 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_ManCleanValue( Gia_Man_t * p );
extern void Gia_ManFillValue( Gia_Man_t * p ); extern void Gia_ManFillValue( Gia_Man_t * p );
extern void Gia_ManSetPhase( Gia_Man_t * p ); extern void Gia_ManSetPhase( Gia_Man_t * p );
......
...@@ -615,7 +615,7 @@ static inline unsigned Gli_ManUpdateRandomInput( unsigned uInfo, float PiTransPr ...@@ -615,7 +615,7 @@ static inline unsigned Gli_ManUpdateRandomInput( unsigned uInfo, float PiTransPr
return Aig_ManRandom(0); return Aig_ManRandom(0);
for ( i = 0; i < 32; i++ ) for ( i = 0; i < 32; i++ )
if ( Multi * (Aig_ManRandom(0) & 0xffff) < PiTransProb ) if ( Multi * (Aig_ManRandom(0) & 0xffff) < PiTransProb )
uInfo ^= 1; uInfo ^= (1 << i);
return uInfo; return uInfo;
} }
......
/**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 ///
////////////////////////////////////////////////////////////////////////
...@@ -77,6 +77,25 @@ void Gia_ManCleanMark0( Gia_Man_t * p ) ...@@ -77,6 +77,25 @@ void Gia_ManCleanMark0( Gia_Man_t * p )
SeeAlso [] 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.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Gia_ManSetMark1( Gia_Man_t * p ) void Gia_ManSetMark1( Gia_Man_t * p )
{ {
Gia_Obj_t * pObj; Gia_Obj_t * pObj;
...@@ -106,6 +125,25 @@ void Gia_ManCleanMark1( Gia_Man_t * p ) ...@@ -106,6 +125,25 @@ void Gia_ManCleanMark1( Gia_Man_t * p )
/**Function************************************************************* /**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.] Synopsis [Cleans the value.]
Description [] Description []
......
...@@ -4,13 +4,13 @@ SRC += src/aig/gia/gia.c \ ...@@ -4,13 +4,13 @@ SRC += src/aig/gia/gia.c \
src/aig/gia/giaCof.c \ src/aig/gia/giaCof.c \
src/aig/gia/giaDfs.c \ src/aig/gia/giaDfs.c \
src/aig/gia/giaDup.c \ src/aig/gia/giaDup.c \
src/aig/gia/giaEmbed.c \
src/aig/gia/giaFanout.c \ src/aig/gia/giaFanout.c \
src/aig/gia/giaForce.c \ src/aig/gia/giaForce.c \
src/aig/gia/giaFrames.c \ src/aig/gia/giaFrames.c \
src/aig/gia/giaFront.c \ src/aig/gia/giaFront.c \
src/aig/gia/giaGlitch.c \ src/aig/gia/giaGlitch.c \
src/aig/gia/giaHash.c \ src/aig/gia/giaHash.c \
src/aig/gia/giaLogic.c \
src/aig/gia/giaMan.c \ src/aig/gia/giaMan.c \
src/aig/gia/giaScl.c \ src/aig/gia/giaScl.c \
src/aig/gia/giaSim.c \ src/aig/gia/giaSim.c \
......
...@@ -292,6 +292,8 @@ static int Abc_CommandAbc9Frames ( Abc_Frame_t * pAbc, int argc, char ** arg ...@@ -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_CommandAbc9Scl ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9Sat ( 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_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_CommandAbc9Test ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbcTestNew ( 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 ) ...@@ -593,6 +595,8 @@ void Abc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd( pAbc, "AIG", "&scl", Abc_CommandAbc9Scl, 0 ); Cmd_CommandAdd( pAbc, "AIG", "&scl", Abc_CommandAbc9Scl, 0 );
Cmd_CommandAdd( pAbc, "AIG", "&sat", Abc_CommandAbc9Sat, 0 ); Cmd_CommandAdd( pAbc, "AIG", "&sat", Abc_CommandAbc9Sat, 0 );
Cmd_CommandAdd( pAbc, "AIG", "&fraig", Abc_CommandAbc9Fraig, 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, "AIG", "&test", Abc_CommandAbc9Test, 0 );
Cmd_CommandAdd( pAbc, "Various", "testnew", Abc_CommandAbcTestNew, 0 ); Cmd_CommandAdd( pAbc, "Various", "testnew", Abc_CommandAbcTestNew, 0 );
...@@ -22970,6 +22974,89 @@ usage: ...@@ -22970,6 +22974,89 @@ usage:
SeeAlso [] 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 (GLSVLSI03).\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 []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int Abc_CommandAbc9Test( Abc_Frame_t * pAbc, int argc, char ** argv ) int Abc_CommandAbc9Test( Abc_Frame_t * pAbc, int argc, char ** argv )
{ {
int c; int c;
...@@ -22992,7 +23079,9 @@ int Abc_CommandAbc9Test( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -22992,7 +23079,9 @@ int Abc_CommandAbc9Test( Abc_Frame_t * pAbc, int argc, char ** argv )
// Gia_ManFrontTest( pAbc->pAig ); // Gia_ManFrontTest( pAbc->pAig );
// Gia_ManReduceConst( pAbc->pAig, 1 ); // Gia_ManReduceConst( pAbc->pAig, 1 );
// Sat_ManTest( pAbc->pAig, Gia_ManCo(pAbc->pAig, 0), 0 ); // 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; return 0;
usage: usage:
......
...@@ -576,14 +576,22 @@ int CmdCommandSource( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -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 * 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 * 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 * 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 * -t options on "source" were used in SIS) would actually be executed twice.
* twice.
*/ */
do 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 */ 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 ) if ( fp == NULL )
{ {
ABC_FREE( real_filename ); ABC_FREE( real_filename );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment