Commit b288bac6 by Alan Mishchenko

Version abc90807

committer: Baruch Sterin <baruchs@gmail.com>
parent da65e88e
...@@ -135,6 +135,7 @@ struct Cec_ParCor_t_ ...@@ -135,6 +135,7 @@ struct Cec_ParCor_t_
int fUseCSat; // use circuit-based solver int fUseCSat; // use circuit-based solver
// int fFirstStop; // stop on the first sat output // int fFirstStop; // stop on the first sat output
int fUseSmartCnf; // use smart CNF computation int fUseSmartCnf; // use smart CNF computation
int fVerboseFlops; // verbose stats
int fVeryVerbose; // verbose stats int fVeryVerbose; // verbose stats
int fVerbose; // verbose stats int fVerbose; // verbose stats
}; };
......
...@@ -990,6 +990,39 @@ unsigned * Cec_ManComputeInitState( Gia_Man_t * pAig, int nFrames ) ...@@ -990,6 +990,39 @@ unsigned * Cec_ManComputeInitState( Gia_Man_t * pAig, int nFrames )
/**Function************************************************************* /**Function*************************************************************
Synopsis [Prints flop equivalences.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Cec_ManPrintFlopEquivs( Gia_Man_t * p )
{
Gia_Obj_t * pObj, * pRepr;
int i;
assert( p->vNamesIn != NULL );
Gia_ManForEachRo( p, pObj, i )
{
if ( Gia_ObjIsConst(p, Gia_ObjId(p, pObj)) )
printf( "Flop \"%s\" is equivalent to constant 0.\n", Vec_PtrEntry(p->vNamesIn, Gia_ObjCioId(pObj)) );
else if ( (pRepr = Gia_ObjReprObj(p, Gia_ObjId(p, pObj))) )
{
if ( Gia_ObjIsCi(pRepr) )
printf( "Flop \"%s\" is equivalent to flop \"%s\".\n",
Vec_PtrEntry( p->vNamesIn, Gia_ObjCioId(pObj) ),
Vec_PtrEntry( p->vNamesIn, Gia_ObjCioId(pRepr) ) );
else
printf( "Flop \"%s\" is equivalent to internal node %d.\n",
Vec_PtrEntry( p->vNamesIn, Gia_ObjCioId(pObj) ), Gia_ObjId(p, pRepr) );
}
}
}
/**Function*************************************************************
Synopsis [Top-level procedure for register correspondence.] Synopsis [Top-level procedure for register correspondence.]
Description [] Description []
...@@ -1060,6 +1093,14 @@ Gia_Man_t * Cec_ManLSCorrespondence( Gia_Man_t * pAig, Cec_ParCor_t * pPars ) ...@@ -1060,6 +1093,14 @@ Gia_Man_t * Cec_ManLSCorrespondence( Gia_Man_t * pAig, Cec_ParCor_t * pPars )
} }
if ( pPars->nPrefix && (Gia_ManAndNum(pNew) < Gia_ManAndNum(pAig) || Gia_ManRegNum(pNew) < Gia_ManRegNum(pAig)) ) if ( pPars->nPrefix && (Gia_ManAndNum(pNew) < Gia_ManAndNum(pAig) || Gia_ManRegNum(pNew) < Gia_ManRegNum(pAig)) )
printf( "The reduced AIG was produced using %d-th invariants and will not verify.\n", pPars->nPrefix ); printf( "The reduced AIG was produced using %d-th invariants and will not verify.\n", pPars->nPrefix );
// print verbose info about equivalences
if ( pPars->fVerboseFlops )
{
if ( pAig->vNamesIn == NULL )
printf( "Flop output names are not available. Use command \"&get -n\".\n" );
else
Cec_ManPrintFlopEquivs( pAig );
}
return pNew; return pNew;
} }
......
...@@ -136,6 +136,8 @@ struct Gia_Man_t_ ...@@ -136,6 +136,8 @@ struct Gia_Man_t_
unsigned char* pSwitching; // switching activity for each object unsigned char* pSwitching; // switching activity for each object
Gia_Plc_t * pPlacement; // placement of the objects Gia_Plc_t * pPlacement; // placement of the objects
int * pTravIds; // separate traversal ID representation int * pTravIds; // separate traversal ID representation
Vec_Ptr_t * vNamesIn; // the input names
Vec_Ptr_t * vNamesOut; // the output names
}; };
......
...@@ -66,6 +66,8 @@ Gia_Man_t * Gia_ManStart( int nObjsMax ) ...@@ -66,6 +66,8 @@ Gia_Man_t * Gia_ManStart( int nObjsMax )
***********************************************************************/ ***********************************************************************/
void Gia_ManStop( Gia_Man_t * p ) void Gia_ManStop( Gia_Man_t * p )
{ {
Vec_PtrFreeFree( p->vNamesIn );
Vec_PtrFreeFree( p->vNamesOut );
if ( p->vFlopClasses ) if ( p->vFlopClasses )
Vec_IntFree( p->vFlopClasses ); Vec_IntFree( p->vFlopClasses );
Vec_IntFree( p->vCis ); Vec_IntFree( p->vCis );
......
...@@ -22299,14 +22299,20 @@ int Abc_CommandAbc9Get( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -22299,14 +22299,20 @@ int Abc_CommandAbc9Get( Abc_Frame_t * pAbc, int argc, char ** argv )
{ {
extern Aig_Man_t * Abc_NtkToDar( Abc_Ntk_t * pNtk, int fExors, int fRegisters ); extern Aig_Man_t * Abc_NtkToDar( Abc_Ntk_t * pNtk, int fExors, int fRegisters );
extern Aig_Man_t * Abc_NtkToDarChoices( Abc_Ntk_t * pNtk ); extern Aig_Man_t * Abc_NtkToDarChoices( Abc_Ntk_t * pNtk );
extern Vec_Ptr_t * Abc_NtkCollectCiNames( Abc_Ntk_t * pNtk );
extern Vec_Ptr_t * Abc_NtkCollectCoNames( Abc_Ntk_t * pNtk );
Gia_Man_t * pAig; Gia_Man_t * pAig;
Aig_Man_t * pMan; Aig_Man_t * pMan;
int c, fVerbose = 0; int c, fVerbose = 0;
int fNames = 0;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "nvh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
case 'n':
fNames ^= 1;
break;
case 'v': case 'v':
fVerbose ^= 1; fVerbose ^= 1;
break; break;
...@@ -22343,11 +22349,17 @@ int Abc_CommandAbc9Get( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -22343,11 +22349,17 @@ int Abc_CommandAbc9Get( Abc_Frame_t * pAbc, int argc, char ** argv )
if ( pAbc->pAig ) if ( pAbc->pAig )
Gia_ManStop( pAbc->pAig ); Gia_ManStop( pAbc->pAig );
pAbc->pAig = pAig; pAbc->pAig = pAig;
if ( fNames )
{
pAig->vNamesIn = Abc_NtkCollectCiNames( pAbc->pNtkCur );
pAig->vNamesOut = Abc_NtkCollectCoNames( pAbc->pNtkCur );
}
return 0; return 0;
usage: usage:
fprintf( stdout, "usage: &get [-vh] <file>\n" ); fprintf( stdout, "usage: &get [-nvh] <file>\n" );
fprintf( stdout, "\t transfer the current network from the old ABC\n" ); fprintf( stdout, "\t converts the network into an AIG and moves to the new ABC\n" );
fprintf( stdout, "\t-n : toggles saving CI/CO names of the AIG [default = %s]\n", fNames? "yes": "no" );
fprintf( stdout, "\t-v : toggles additional verbose output [default = %s]\n", fVerbose? "yes": "no" ); fprintf( stdout, "\t-v : toggles additional verbose output [default = %s]\n", fVerbose? "yes": "no" );
fprintf( stdout, "\t-h : print the command usage\n"); fprintf( stdout, "\t-h : print the command usage\n");
fprintf( stdout, "\t<file> : the file name\n"); fprintf( stdout, "\t<file> : the file name\n");
...@@ -24058,7 +24070,7 @@ int Abc_CommandAbc9Scorr( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -24058,7 +24070,7 @@ int Abc_CommandAbc9Scorr( Abc_Frame_t * pAbc, int argc, char ** argv )
int c; int c;
Cec_ManCorSetDefaultParams( pPars ); Cec_ManCorSetDefaultParams( pPars );
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "FCPrecvh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "FCPrecwvh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
...@@ -24104,6 +24116,9 @@ int Abc_CommandAbc9Scorr( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -24104,6 +24116,9 @@ int Abc_CommandAbc9Scorr( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'c': case 'c':
pPars->fUseCSat ^= 1; pPars->fUseCSat ^= 1;
break; break;
case 'w':
pPars->fVerboseFlops ^= 1;
break;
case 'v': case 'v':
pPars->fVerbose ^= 1; pPars->fVerbose ^= 1;
break; break;
...@@ -24127,7 +24142,7 @@ int Abc_CommandAbc9Scorr( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -24127,7 +24142,7 @@ int Abc_CommandAbc9Scorr( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0; return 0;
usage: usage:
fprintf( stdout, "usage: &scorr [-FCP num] [-recvh]\n" ); fprintf( stdout, "usage: &scorr [-FCP num] [-recwvh]\n" );
fprintf( stdout, "\t performs signal correpondence computation\n" ); fprintf( stdout, "\t performs signal correpondence computation\n" );
fprintf( stdout, "\t-C num : the max number of conflicts at a node [default = %d]\n", pPars->nBTLimit ); fprintf( stdout, "\t-C num : the max number of conflicts at a node [default = %d]\n", pPars->nBTLimit );
fprintf( stdout, "\t-F num : the number of timeframes in inductive case [default = %d]\n", pPars->nFrames ); fprintf( stdout, "\t-F num : the number of timeframes in inductive case [default = %d]\n", pPars->nFrames );
...@@ -24135,6 +24150,7 @@ usage: ...@@ -24135,6 +24150,7 @@ usage:
fprintf( stdout, "\t-r : toggle using implication rings during refinement [default = %s]\n", pPars->fUseRings? "yes": "no" ); fprintf( stdout, "\t-r : toggle using implication rings during refinement [default = %s]\n", pPars->fUseRings? "yes": "no" );
fprintf( stdout, "\t-e : toggle using equivalences as choices [default = %s]\n", pPars->fMakeChoices? "yes": "no" ); fprintf( stdout, "\t-e : toggle using equivalences as choices [default = %s]\n", pPars->fMakeChoices? "yes": "no" );
fprintf( stdout, "\t-c : toggle using circuit-based SAT solver [default = %s]\n", pPars->fUseCSat? "yes": "no" ); fprintf( stdout, "\t-c : toggle using circuit-based SAT solver [default = %s]\n", pPars->fUseCSat? "yes": "no" );
fprintf( stdout, "\t-w : toggle printing verbose info about equivalent flops [default = %s]\n", pPars->fVerboseFlops? "yes": "no" );
fprintf( stdout, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" ); fprintf( stdout, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" );
fprintf( stdout, "\t-h : print the command usage\n"); fprintf( stdout, "\t-h : print the command usage\n");
return 1; return 1;
......
...@@ -587,6 +587,50 @@ Abc_Ntk_t * Abc_NtkFromDarSeq( Abc_Ntk_t * pNtkOld, Aig_Man_t * pMan ) ...@@ -587,6 +587,50 @@ Abc_Ntk_t * Abc_NtkFromDarSeq( Abc_Ntk_t * pNtkOld, Aig_Man_t * pMan )
/**Function************************************************************* /**Function*************************************************************
Synopsis [Collects CI of the network.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Vec_Ptr_t * Abc_NtkCollectCiNames( Abc_Ntk_t * pNtk )
{
Abc_Obj_t * pObj;
int i;
Vec_Ptr_t * vNames;
vNames = Vec_PtrAlloc( 100 );
Abc_NtkForEachCi( pNtk, pObj, i )
Vec_PtrPush( vNames, Extra_UtilStrsav(Abc_ObjName(pObj)) );
return vNames;
}
/**Function*************************************************************
Synopsis [Collects CO of the network.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Vec_Ptr_t * Abc_NtkCollectCoNames( Abc_Ntk_t * pNtk )
{
Abc_Obj_t * pObj;
int i;
Vec_Ptr_t * vNames;
vNames = Vec_PtrAlloc( 100 );
Abc_NtkForEachCo( pNtk, pObj, i )
Vec_PtrPush( vNames, Extra_UtilStrsav(Abc_ObjName(pObj)) );
return vNames;
}
/**Function*************************************************************
Synopsis [Collect latch values.] Synopsis [Collect latch values.]
Description [] Description []
......
...@@ -263,7 +263,12 @@ Abc_Obj_t * Abc_NodeFromMap_rec( Abc_Ntk_t * pNtkNew, Map_Node_t * pNodeMap, int ...@@ -263,7 +263,12 @@ Abc_Obj_t * Abc_NodeFromMap_rec( Abc_Ntk_t * pNtkNew, Map_Node_t * pNodeMap, int
// check the case of constant node // check the case of constant node
if ( Map_NodeIsConst(pNodeMap) ) if ( Map_NodeIsConst(pNodeMap) )
return fPhase? Abc_NtkCreateNodeConst1(pNtkNew) : Abc_NtkCreateNodeConst0(pNtkNew); {
pNodeNew = fPhase? Abc_NtkCreateNodeConst1(pNtkNew) : Abc_NtkCreateNodeConst0(pNtkNew);
if ( pNodeNew->pData == NULL )
printf( "Error creating mapped network: Library does not have a constant %d gate.\n", fPhase );
return pNodeNew;
}
// check if the phase is already implemented // check if the phase is already implemented
pNodeNew = (Abc_Obj_t *)Map_NodeReadData( pNodeMap, fPhase ); pNodeNew = (Abc_Obj_t *)Map_NodeReadData( pNodeMap, fPhase );
......
...@@ -706,7 +706,7 @@ void Super_TranferGatesToArray( Super_Man_t * pMan ) ...@@ -706,7 +706,7 @@ void Super_TranferGatesToArray( Super_Man_t * pMan )
{ {
stmm_generator * gen; stmm_generator * gen;
Super_Gate_t * pGate, * pList; Super_Gate_t * pGate, * pList;
unsigned Key; ABC_PTRUINT_T Key;
// put the gates fron the table into the array // put the gates fron the table into the array
ABC_FREE( pMan->pGates ); ABC_FREE( pMan->pGates );
...@@ -734,10 +734,10 @@ void Super_TranferGatesToArray( Super_Man_t * pMan ) ...@@ -734,10 +734,10 @@ void Super_TranferGatesToArray( Super_Man_t * pMan )
void Super_AddGateToTable( Super_Man_t * pMan, Super_Gate_t * pGate ) void Super_AddGateToTable( Super_Man_t * pMan, Super_Gate_t * pGate )
{ {
Super_Gate_t ** ppList; Super_Gate_t ** ppList;
unsigned Key; ABC_PTRUINT_T Key;
// Key = pGate->uTruth[0] + 2003 * pGate->uTruth[1]; // Key = pGate->uTruth[0] + 2003 * pGate->uTruth[1];
Key = pGate->uTruth[0] ^ pGate->uTruth[1]; Key = pGate->uTruth[0] ^ pGate->uTruth[1];
if ( !stmm_find_or_add( pMan->tTable, (char *)(ABC_PTRUINT_T)Key, (char ***)&ppList ) ) if ( !stmm_find_or_add( pMan->tTable, (char *)Key, (char ***)&ppList ) )
*ppList = NULL; *ppList = NULL;
pGate->pNext = *ppList; pGate->pNext = *ppList;
*ppList = pGate; *ppList = pGate;
...@@ -761,7 +761,7 @@ bool Super_CompareGates( Super_Man_t * pMan, unsigned uTruth[], float Area, floa ...@@ -761,7 +761,7 @@ bool Super_CompareGates( Super_Man_t * pMan, unsigned uTruth[], float Area, floa
{ {
Super_Gate_t ** ppList, * pPrev, * pGate, * pGate2; Super_Gate_t ** ppList, * pPrev, * pGate, * pGate2;
int i, fNewIsBetter, fGateIsBetter; int i, fNewIsBetter, fGateIsBetter;
unsigned Key; ABC_PTRUINT_T Key;
// skip constant functions // skip constant functions
if ( pMan->nVarsMax < 6 ) if ( pMan->nVarsMax < 6 )
...@@ -778,7 +778,7 @@ bool Super_CompareGates( Super_Man_t * pMan, unsigned uTruth[], float Area, floa ...@@ -778,7 +778,7 @@ bool Super_CompareGates( Super_Man_t * pMan, unsigned uTruth[], float Area, floa
// get hold of the place where the entry is stored // get hold of the place where the entry is stored
// Key = uTruth[0] + 2003 * uTruth[1]; // Key = uTruth[0] + 2003 * uTruth[1];
Key = uTruth[0] ^ uTruth[1]; Key = uTruth[0] ^ uTruth[1];
if ( !stmm_find( pMan->tTable, (char *)(ABC_PTRUINT_T)Key, (char ***)&ppList ) ) if ( !stmm_find( pMan->tTable, (char *)Key, (char ***)&ppList ) )
return 1; return 1;
// the entry with this truth table is found // the entry with this truth table is found
pPrev = NULL; pPrev = NULL;
...@@ -918,7 +918,7 @@ void Super_Write( Super_Man_t * pMan ) ...@@ -918,7 +918,7 @@ void Super_Write( Super_Man_t * pMan )
Super_Gate_t * pGateRoot, * pGate; Super_Gate_t * pGateRoot, * pGate;
stmm_generator * gen; stmm_generator * gen;
int fZeroFound, clk, v; int fZeroFound, clk, v;
unsigned Key; ABC_PTRUINT_T Key;
if ( pMan->nGates < 1 ) if ( pMan->nGates < 1 )
{ {
......
...@@ -118,7 +118,8 @@ char * Nm_ManStoreIdName( Nm_Man_t * p, int ObjId, int Type, char * pName, char ...@@ -118,7 +118,8 @@ char * Nm_ManStoreIdName( Nm_Man_t * p, int ObjId, int Type, char * pName, char
} }
// create a new entry // create a new entry
nEntrySize = sizeof(Nm_Entry_t) + strlen(pName) + (pSuffix?strlen(pSuffix):0) + 1; nEntrySize = sizeof(Nm_Entry_t) + strlen(pName) + (pSuffix?strlen(pSuffix):0) + 1;
nEntrySize = (nEntrySize / 4 + ((nEntrySize % 4) > 0)) * 4; // nEntrySize = (nEntrySize / 4 + ((nEntrySize % 4) > 0)) * 4;
nEntrySize = (nEntrySize / 8 + ((nEntrySize % 8) > 0)) * 8;
pEntry = (Nm_Entry_t *)Extra_MmFlexEntryFetch( p->pMem, nEntrySize ); pEntry = (Nm_Entry_t *)Extra_MmFlexEntryFetch( p->pMem, nEntrySize );
pEntry->pNextI2N = pEntry->pNextN2I = pEntry->pNameSake = NULL; pEntry->pNextI2N = pEntry->pNextN2I = pEntry->pNameSake = NULL;
pEntry->ObjId = ObjId; pEntry->ObjId = ObjId;
......
...@@ -465,6 +465,27 @@ static inline void Vec_PtrClear( Vec_Ptr_t * p ) ...@@ -465,6 +465,27 @@ static inline void Vec_PtrClear( Vec_Ptr_t * p )
/**Function************************************************************* /**Function*************************************************************
Synopsis [Deallocates array of memory pointers.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static inline void Vec_PtrFreeFree( Vec_Ptr_t * p )
{
void * pTemp;
int i;
if ( p == NULL ) return;
Vec_PtrForEachEntry( p, pTemp, i )
ABC_FREE( pTemp );
Vec_PtrFree( p );
}
/**Function*************************************************************
Synopsis [Copies the interger array.] Synopsis [Copies the interger array.]
Description [] Description []
......
...@@ -266,7 +266,7 @@ clk = clock(); ...@@ -266,7 +266,7 @@ clk = clock();
return 1; return 1;
} }
clk = clock(); clk = clock();
Abc_NtkMfsConstructGia( p ); // Abc_NtkMfsConstructGia( p );
p->timeGia += clock() - clk; p->timeGia += clock() - clk;
// solve the SAT problem // solve the SAT problem
if ( p->pPars->fPower ) if ( p->pPars->fPower )
...@@ -280,7 +280,7 @@ p->timeGia += clock() - clk; ...@@ -280,7 +280,7 @@ p->timeGia += clock() - clk;
Abc_NtkMfsResubNode2( p, pNode ); Abc_NtkMfsResubNode2( p, pNode );
} }
p->timeSat += clock() - clk; p->timeSat += clock() - clk;
Abc_NtkMfsDeconstructGia( p ); // Abc_NtkMfsDeconstructGia( p );
return 1; return 1;
} }
......
...@@ -99,16 +99,17 @@ int Abc_NtkMfsTryResubOnce( Mfs_Man_t * p, int * pCands, int nCands ) ...@@ -99,16 +99,17 @@ int Abc_NtkMfsTryResubOnce( Mfs_Man_t * p, int * pCands, int nCands )
{ {
unsigned * pData; unsigned * pData;
int RetValue, iVar, i; int RetValue, iVar, i;
int clk = clock(), RetValue2 = Abc_NtkMfsTryResubOnceGia( p, pCands, nCands ); // int clk = clock(), RetValue2 = Abc_NtkMfsTryResubOnceGia( p, pCands, nCands );
p->timeGia += clock() - clk; //p->timeGia += clock() - clk;
p->nSatCalls++; p->nSatCalls++;
RetValue = sat_solver_solve( p->pSat, pCands, pCands + nCands, (ABC_INT64_T)p->pPars->nBTLimit, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 ); RetValue = sat_solver_solve( p->pSat, pCands, pCands + nCands, (ABC_INT64_T)p->pPars->nBTLimit, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
// assert( RetValue == l_False || RetValue == l_True ); // assert( RetValue == l_False || RetValue == l_True );
if ( RetValue != l_Undef && RetValue2 != -1 )
{ // if ( RetValue != l_Undef && RetValue2 != -1 )
assert( (RetValue == l_False) == (RetValue2 == 1) ); // {
} // assert( (RetValue == l_False) == (RetValue2 == 1) );
// }
if ( RetValue == l_False ) if ( RetValue == l_False )
return 1; return 1;
......
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