Commit 8e5d771f by Alan Mishchenko

Deriving CEX after phase/tempor/reparam.

parent 5d74635f
...@@ -855,7 +855,7 @@ extern void Gia_ManSetIfParsDefault( void * pIfPars ); ...@@ -855,7 +855,7 @@ extern void Gia_ManSetIfParsDefault( void * pIfPars );
extern Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pIfPars ); extern Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pIfPars );
/*=== giaIso.c ===========================================================*/ /*=== giaIso.c ===========================================================*/
extern Gia_Man_t * Gia_ManIsoCanonicize( Gia_Man_t * p, int fVerbose ); extern Gia_Man_t * Gia_ManIsoCanonicize( Gia_Man_t * p, int fVerbose );
extern Gia_Man_t * Gia_ManIsoReduce( Gia_Man_t * p, Vec_Ptr_t ** pvPosEquivs, int fDualOut, int fVerbose ); extern Gia_Man_t * Gia_ManIsoReduce( Gia_Man_t * p, Vec_Ptr_t ** pvPosEquivs, Vec_Ptr_t ** pvPiPerms, int fDualOut, int fVerbose );
/*=== 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, Emb_Par_t * pPars ); extern void Gia_ManSolveProblem( Gia_Man_t * pGia, Emb_Par_t * pPars );
......
...@@ -876,7 +876,7 @@ void Gia_ManFindCaninicalOrder_rec( Gia_Man_t * p, Gia_Obj_t * pObj, Vec_Int_t * ...@@ -876,7 +876,7 @@ void Gia_ManFindCaninicalOrder_rec( Gia_Man_t * p, Gia_Obj_t * pObj, Vec_Int_t *
} }
Vec_IntPush( vAnds, Gia_ObjId(p, pObj) ); Vec_IntPush( vAnds, Gia_ObjId(p, pObj) );
} }
void Gia_ManFindCaninicalOrder( Gia_Man_t * p, Vec_Int_t * vCis, Vec_Int_t * vAnds, Vec_Int_t * vCos ) void Gia_ManFindCaninicalOrder( Gia_Man_t * p, Vec_Int_t * vCis, Vec_Int_t * vAnds, Vec_Int_t * vCos, Vec_Int_t ** pvPiPerm )
{ {
Vec_Ptr_t * vTemp; Vec_Ptr_t * vTemp;
Gia_Obj_t * pObj; Gia_Obj_t * pObj;
...@@ -895,6 +895,10 @@ void Gia_ManFindCaninicalOrder( Gia_Man_t * p, Vec_Int_t * vCis, Vec_Int_t * vAn ...@@ -895,6 +895,10 @@ void Gia_ManFindCaninicalOrder( Gia_Man_t * p, Vec_Int_t * vCis, Vec_Int_t * vAn
// create the result // create the result
Vec_PtrForEachEntry( Gia_Obj_t *, vTemp, pObj, i ) Vec_PtrForEachEntry( Gia_Obj_t *, vTemp, pObj, i )
Vec_IntPush( vCis, Gia_ObjId(p, pObj) ); Vec_IntPush( vCis, Gia_ObjId(p, pObj) );
// remember PI permutation
if ( pvPiPerm )
Vec_PtrForEachEntry( Gia_Obj_t *, vTemp, pObj, i )
Vec_IntPush( *pvPiPerm, Gia_ObjCioId(pObj) );
// assign unique IDs to POs // assign unique IDs to POs
if ( Gia_ManPoNum(p) == 1 ) if ( Gia_ManPoNum(p) == 1 )
...@@ -999,7 +1003,7 @@ Gia_Man_t * Gia_ManIsoCanonicize( Gia_Man_t * p, int fVerbose ) ...@@ -999,7 +1003,7 @@ Gia_Man_t * Gia_ManIsoCanonicize( Gia_Man_t * p, int fVerbose )
vCis = Vec_IntAlloc( Gia_ManCiNum(p) ); vCis = Vec_IntAlloc( Gia_ManCiNum(p) );
vAnds = Vec_IntAlloc( Gia_ManAndNum(p) ); vAnds = Vec_IntAlloc( Gia_ManAndNum(p) );
vCos = Vec_IntAlloc( Gia_ManCoNum(p) ); vCos = Vec_IntAlloc( Gia_ManCoNum(p) );
Gia_ManFindCaninicalOrder( p, vCis, vAnds, vCos ); Gia_ManFindCaninicalOrder( p, vCis, vAnds, vCos, NULL );
// derive the new AIG // derive the new AIG
vResult = Gia_ManDupFromVecs( p, vCis, vAnds, vCos, Gia_ManRegNum(p) ); vResult = Gia_ManDupFromVecs( p, vCis, vAnds, vCos, Gia_ManRegNum(p) );
// cleanup // cleanup
...@@ -1020,7 +1024,7 @@ Gia_Man_t * Gia_ManIsoCanonicize( Gia_Man_t * p, int fVerbose ) ...@@ -1020,7 +1024,7 @@ Gia_Man_t * Gia_ManIsoCanonicize( Gia_Man_t * p, int fVerbose )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
Vec_Str_t * Gia_ManIsoFindString( Gia_Man_t * p, int iPo, int fVerbose ) Vec_Str_t * Gia_ManIsoFindString( Gia_Man_t * p, int iPo, int fVerbose, Vec_Int_t ** pvPiPerm )
{ {
Gia_Man_t * pPart; Gia_Man_t * pPart;
Vec_Ptr_t * vEquiv; Vec_Ptr_t * vEquiv;
...@@ -1044,7 +1048,7 @@ Vec_Str_t * Gia_ManIsoFindString( Gia_Man_t * p, int iPo, int fVerbose ) ...@@ -1044,7 +1048,7 @@ Vec_Str_t * Gia_ManIsoFindString( Gia_Man_t * p, int iPo, int fVerbose )
vCis = Vec_IntAlloc( Gia_ManCiNum(pPart) ); vCis = Vec_IntAlloc( Gia_ManCiNum(pPart) );
vAnds = Vec_IntAlloc( Gia_ManAndNum(pPart) ); vAnds = Vec_IntAlloc( Gia_ManAndNum(pPart) );
vCos = Vec_IntAlloc( Gia_ManCoNum(pPart) ); vCos = Vec_IntAlloc( Gia_ManCoNum(pPart) );
Gia_ManFindCaninicalOrder( pPart, vCis, vAnds, vCos ); Gia_ManFindCaninicalOrder( pPart, vCis, vAnds, vCos, pvPiPerm );
// derive the AIGER string // derive the AIGER string
vStr = Gia_WriteAigerIntoMemoryStrPart( pPart, vCis, vAnds, vCos, Gia_ManRegNum(pPart) ); vStr = Gia_WriteAigerIntoMemoryStrPart( pPart, vCis, vAnds, vCos, Gia_ManRegNum(pPart) );
// cleanup // cleanup
...@@ -1066,17 +1070,19 @@ Vec_Str_t * Gia_ManIsoFindString( Gia_Man_t * p, int iPo, int fVerbose ) ...@@ -1066,17 +1070,19 @@ Vec_Str_t * Gia_ManIsoFindString( Gia_Man_t * p, int iPo, int fVerbose )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
Gia_Man_t * Gia_ManIsoReduce( Gia_Man_t * pInit, Vec_Ptr_t ** pvPosEquivs, int fDualOut, int fVerbose ) Gia_Man_t * Gia_ManIsoReduce( Gia_Man_t * pInit, Vec_Ptr_t ** pvPosEquivs, Vec_Ptr_t ** pvPiPerms, int fDualOut, int fVerbose )
{ {
int fVeryVerbose = 0; int fVeryVerbose = 0;
Gia_Man_t * p, * pPart; Gia_Man_t * p, * pPart;
Vec_Ptr_t * vEquivs, * vEquivs2, * vStrings; Vec_Ptr_t * vEquivs, * vEquivs2, * vStrings;
Vec_Int_t * vRemain, * vLevel, * vLevel2; Vec_Int_t * vRemain, * vLevel, * vLevel2;
Vec_Str_t * vStr, * vStr2; Vec_Str_t * vStr, * vStr2;
int i, k, s, sStart, Entry, Counter; int i, k, s, sStart, iPo, Counter;
clock_t clk = clock(); clock_t clk = clock();
if ( pvPosEquivs ) if ( pvPosEquivs )
*pvPosEquivs = NULL; *pvPosEquivs = NULL;
if ( pvPiPerms )
*pvPiPerms = Vec_PtrStart( Gia_ManPoNum(pInit) );
if ( fDualOut ) if ( fDualOut )
{ {
...@@ -1120,11 +1126,12 @@ Gia_Man_t * Gia_ManIsoReduce( Gia_Man_t * pInit, Vec_Ptr_t ** pvPosEquivs, int f ...@@ -1120,11 +1126,12 @@ Gia_Man_t * Gia_ManIsoReduce( Gia_Man_t * pInit, Vec_Ptr_t ** pvPosEquivs, int f
} }
sStart = Vec_PtrSize( vEquivs2 ); sStart = Vec_PtrSize( vEquivs2 );
vStrings = Vec_PtrAlloc( 100 ); vStrings = Vec_PtrAlloc( 100 );
Vec_IntForEachEntry( vLevel, Entry, k ) Vec_IntForEachEntry( vLevel, iPo, k )
{ {
if ( ++Counter % 100 == 0 ) if ( ++Counter % 100 == 0 )
printf( "%6d finished...\r", Counter ); printf( "%6d finished...\r", Counter );
vStr = Gia_ManIsoFindString( p, Entry, 0 ); assert( pvPiPerms == NULL || Vec_PtrArray(*pvPiPerms)[iPo] == NULL );
vStr = Gia_ManIsoFindString( p, iPo, 0, pvPiPerms ? (Vec_Int_t **)Vec_PtrArray(*pvPiPerms) + iPo : NULL );
// check if this string already exists // check if this string already exists
Vec_PtrForEachEntry( Vec_Str_t *, vStrings, vStr2, s ) Vec_PtrForEachEntry( Vec_Str_t *, vStrings, vStr2, s )
if ( Vec_StrCompareVec(vStr, vStr2) == 0 ) if ( Vec_StrCompareVec(vStr, vStr2) == 0 )
...@@ -1138,7 +1145,7 @@ Gia_Man_t * Gia_ManIsoReduce( Gia_Man_t * pInit, Vec_Ptr_t ** pvPosEquivs, int f ...@@ -1138,7 +1145,7 @@ Gia_Man_t * Gia_ManIsoReduce( Gia_Man_t * pInit, Vec_Ptr_t ** pvPosEquivs, int f
Vec_StrFree( vStr ); Vec_StrFree( vStr );
// add this entry to the corresponding level // add this entry to the corresponding level
vLevel2 = (Vec_Int_t *)Vec_PtrEntry( vEquivs2, sStart + s ); vLevel2 = (Vec_Int_t *)Vec_PtrEntry( vEquivs2, sStart + s );
Vec_IntPush( vLevel2, Entry ); Vec_IntPush( vLevel2, iPo );
} }
Vec_VecFree( (Vec_Vec_t *)vStrings ); Vec_VecFree( (Vec_Vec_t *)vStrings );
} }
......
...@@ -17888,11 +17888,11 @@ usage: ...@@ -17888,11 +17888,11 @@ usage:
int Abc_CommandDarPhase( Abc_Frame_t * pAbc, int argc, char ** argv ) int Abc_CommandDarPhase( Abc_Frame_t * pAbc, int argc, char ** argv )
{ {
Abc_Ntk_t * pNtk, * pNtkRes; Abc_Ntk_t * pNtk, * pNtkRes;
int c;
int nFrames, nPref; int nFrames, nPref;
int fIgnore; int fIgnore;
int fPrint; int fPrint;
int fVerbose; int fUpdateCex;
int c, fVerbose;
extern Abc_Ntk_t * Abc_NtkPhaseAbstract( Abc_Ntk_t * pNtk, int nFrames, int nPref, int fIgnore, int fPrint, int fVerbose ); extern Abc_Ntk_t * Abc_NtkPhaseAbstract( Abc_Ntk_t * pNtk, int nFrames, int nPref, int fIgnore, int fPrint, int fVerbose );
pNtk = Abc_FrameReadNtk(pAbc); pNtk = Abc_FrameReadNtk(pAbc);
...@@ -17901,9 +17901,10 @@ int Abc_CommandDarPhase( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -17901,9 +17901,10 @@ int Abc_CommandDarPhase( Abc_Frame_t * pAbc, int argc, char ** argv )
nPref = 0; nPref = 0;
fIgnore = 0; fIgnore = 0;
fPrint = 0; fPrint = 0;
fUpdateCex = 0;
fVerbose = 0; fVerbose = 0;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "FPipvh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "FPipcvh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
...@@ -17935,6 +17936,9 @@ int Abc_CommandDarPhase( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -17935,6 +17936,9 @@ int Abc_CommandDarPhase( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'p': case 'p':
fPrint ^= 1; fPrint ^= 1;
break; break;
case 'c':
fUpdateCex ^= 1;
break;
case 'v': case 'v':
fVerbose ^= 1; fVerbose ^= 1;
break; break;
...@@ -17954,6 +17958,24 @@ int Abc_CommandDarPhase( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -17954,6 +17958,24 @@ int Abc_CommandDarPhase( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( -1, "Only works for structrally hashed networks.\n" ); Abc_Print( -1, "Only works for structrally hashed networks.\n" );
return 1; return 1;
} }
if ( fUpdateCex )
{
Abc_Cex_t * pCexNew;
if ( pAbc->pCex == NULL )
{
Abc_Print( -1, "Counter-example is not available.\n" );
return 1;
}
if ( pAbc->pCex->nPis % Abc_NtkPiNum(pNtk) != 0 )
{
Abc_Print( -1, "PI count of the CEX is not a multiple of PI count of the current AIG.\n" );
return 1;
}
pCexNew = Abc_CexTransformPhase( pAbc->pCex, Abc_NtkPiNum(pNtk), Abc_NtkPoNum(pNtk), Abc_NtkLatchNum(pNtk) );
Abc_CexFree( pAbc->pCex );
pAbc->pCex = pCexNew;
return 0;
}
if ( !Abc_NtkLatchNum(pNtk) ) if ( !Abc_NtkLatchNum(pNtk) )
{ {
Abc_Print( -1, "The network is combinational.\n" ); Abc_Print( -1, "The network is combinational.\n" );
...@@ -17976,13 +17998,15 @@ int Abc_CommandDarPhase( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -17976,13 +17998,15 @@ int Abc_CommandDarPhase( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0; return 0;
usage: usage:
Abc_Print( -2, "usage: phase [-FP <num>] [-ipvh]\n" ); Abc_Print( -2, "usage: phase [-FP <num>] [-ipcvh]\n" );
Abc_Print( -2, "\t performs sequential cleanup of the current network\n" ); Abc_Print( -2, "\t performs sequential cleanup of the current network\n" );
Abc_Print( -2, "\t by removing nodes and latches that do not feed into POs\n" ); Abc_Print( -2, "\t by removing nodes and latches that do not feed into POs\n" );
Abc_Print( -2, "\t-F num : the number of frames to abstract [default = %d]\n", nFrames ); Abc_Print( -2, "\t-F num : the number of frames to abstract [default = %d]\n", nFrames );
Abc_Print( -2, "\t-P num : the number of prefix frames to skip [default = %d]\n", nPref ); Abc_Print( -2, "\t-P num : the number of prefix frames to skip [default = %d]\n", nPref );
Abc_Print( -2, "\t-i : toggle ignoring the initial state [default = %s]\n", fIgnore? "yes": "no" ); Abc_Print( -2, "\t-i : toggle ignoring the initial state [default = %s]\n", fIgnore? "yes": "no" );
Abc_Print( -2, "\t-p : toggle printing statistics about generators [default = %s]\n", fPrint? "yes": "no" ); Abc_Print( -2, "\t-p : toggle printing statistics about generators [default = %s]\n", fPrint? "yes": "no" );
Abc_Print( -2, "\t-c : update the current CEX derived for a new AIG after \"phase\"\n" );
Abc_Print( -2, "\t to match the current AIG (the one before \"phase\") [default = %s]\n", fUpdateCex? "yes": "no" );
Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n"); Abc_Print( -2, "\t-h : print the command usage\n");
return 1; return 1;
...@@ -21431,11 +21455,12 @@ int Abc_CommandTempor( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -21431,11 +21455,12 @@ int Abc_CommandTempor( Abc_Frame_t * pAbc, int argc, char ** argv )
int nConfMax = 100000; int nConfMax = 100000;
int fUseBmc = 1; int fUseBmc = 1;
int fUseTransSigs = 0; int fUseTransSigs = 0;
int fUpdateCex = 0;
int fVerbose = 0; int fVerbose = 0;
int fVeryVerbose = 0; int fVeryVerbose = 0;
int c; int c;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "FTCbsvwh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "FTCbscvwh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
...@@ -21478,6 +21503,9 @@ int Abc_CommandTempor( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -21478,6 +21503,9 @@ int Abc_CommandTempor( Abc_Frame_t * pAbc, int argc, char ** argv )
case 's': case 's':
fUseTransSigs ^= 1; fUseTransSigs ^= 1;
break; break;
case 'c':
fUpdateCex ^= 1;
break;
case 'v': case 'v':
fVerbose ^= 1; fVerbose ^= 1;
break; break;
...@@ -21494,14 +21522,32 @@ int Abc_CommandTempor( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -21494,14 +21522,32 @@ int Abc_CommandTempor( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( -2, "There is no current network.\n"); Abc_Print( -2, "There is no current network.\n");
return 0; return 0;
} }
if ( !Abc_NtkIsStrash(pNtk) )
{
Abc_Print( -2, "The current network is not an AIG (run \"strash\").\n");
return 0;
}
if ( Abc_NtkLatchNum(pNtk) == 0 ) if ( Abc_NtkLatchNum(pNtk) == 0 )
{ {
Abc_Print( -2, "The current network is combinational.\n"); Abc_Print( -2, "The current network is combinational.\n");
return 0; return 0;
} }
if ( !Abc_NtkIsStrash(pNtk) ) if ( fUpdateCex )
{ {
Abc_Print( -2, "The current network is not an AIG (run \"strash\").\n"); Abc_Cex_t * pCexNew;
if ( pAbc->pCex == NULL )
{
Abc_Print( -1, "Counter-example is not available.\n" );
return 1;
}
if ( pAbc->pCex->nPis % Abc_NtkPiNum(pNtk) != 0 )
{
Abc_Print( -1, "PI count of the CEX is not a multiple of PI count of the current AIG.\n" );
return 1;
}
pCexNew = Abc_CexTransformTempor( pAbc->pCex, Abc_NtkPiNum(pNtk), Abc_NtkPoNum(pNtk), Abc_NtkLatchNum(pNtk) );
Abc_CexFree( pAbc->pCex );
pAbc->pCex = pCexNew;
return 0; return 0;
} }
// modify the current network // modify the current network
...@@ -21516,13 +21562,15 @@ int Abc_CommandTempor( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -21516,13 +21562,15 @@ int Abc_CommandTempor( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0; return 0;
usage: usage:
Abc_Print( -2, "usage: tempor [-FTC <num>] [-bsvwh]\n" ); Abc_Print( -2, "usage: tempor [-FTC <num>] [-bscvwh]\n" );
Abc_Print( -2, "\t performs temporal decomposition\n" ); Abc_Print( -2, "\t performs temporal decomposition\n" );
Abc_Print( -2, "\t-F <num> : init logic timeframe count (0 = use leading length) [default = %d]\n", nFrames ); Abc_Print( -2, "\t-F <num> : init logic timeframe count (0 = use leading length) [default = %d]\n", nFrames );
Abc_Print( -2, "\t-T <num> : runtime limit in seconds for BMC (0=unused) [default = %d]\n", TimeOut ); Abc_Print( -2, "\t-T <num> : runtime limit in seconds for BMC (0=unused) [default = %d]\n", TimeOut );
Abc_Print( -2, "\t-C <num> : max number of SAT conflicts in BMC (0=unused) [default = %d]\n", nConfMax ); Abc_Print( -2, "\t-C <num> : max number of SAT conflicts in BMC (0=unused) [default = %d]\n", nConfMax );
Abc_Print( -2, "\t-b : toggle running BMC2 on the init frames [default = %s]\n", fUseBmc? "yes": "no" ); Abc_Print( -2, "\t-b : toggle running BMC2 on the init frames [default = %s]\n", fUseBmc? "yes": "no" );
Abc_Print( -2, "\t-s : toggle using transient signals [default = %s]\n", fUseTransSigs? "yes": "no" ); Abc_Print( -2, "\t-s : toggle using transient signals [default = %s]\n", fUseTransSigs? "yes": "no" );
Abc_Print( -2, "\t-c : update the current CEX derived for a new AIG after \"tempor\"\n" );
Abc_Print( -2, "\t to match the current AIG (the one before \"tempor\") [default = %s]\n", fUpdateCex? "yes": "no" );
Abc_Print( -2, "\t-v : toggle printing verbose output [default = %s]\n", fVerbose? "yes": "no" ); Abc_Print( -2, "\t-v : toggle printing verbose output [default = %s]\n", fVerbose? "yes": "no" );
Abc_Print( -2, "\t-w : toggle printing ternary state space [default = %s]\n", fVeryVerbose? "yes": "no" ); Abc_Print( -2, "\t-w : toggle printing ternary state space [default = %s]\n", fVeryVerbose? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n"); Abc_Print( -2, "\t-h : print the command usage\n");
...@@ -22459,7 +22507,8 @@ int Abc_CommandReconcile( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -22459,7 +22507,8 @@ int Abc_CommandReconcile( Abc_Frame_t * pAbc, int argc, char ** argv )
goto usage; goto usage;
} }
} }
if ( argc != globalUtilOptind + 2 )
if ( argc != globalUtilOptind + 2 && argc != globalUtilOptind )
{ {
Abc_Print( 1,"Does not seen to have two files names as arguments.\n" ); Abc_Print( 1,"Does not seen to have two files names as arguments.\n" );
return 1; return 1;
...@@ -22470,6 +22519,8 @@ int Abc_CommandReconcile( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -22470,6 +22519,8 @@ int Abc_CommandReconcile( Abc_Frame_t * pAbc, int argc, char ** argv )
return 1; return 1;
} }
if ( argc == globalUtilOptind + 2 )
{
// derive networks // derive networks
pNtk1 = Io_Read( argv[globalUtilOptind], Io_ReadFileType(argv[globalUtilOptind]), 1 ); pNtk1 = Io_Read( argv[globalUtilOptind], Io_ReadFileType(argv[globalUtilOptind]), 1 );
if ( pNtk1 == NULL ) if ( pNtk1 == NULL )
...@@ -22483,6 +22534,24 @@ int Abc_CommandReconcile( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -22483,6 +22534,24 @@ int Abc_CommandReconcile( Abc_Frame_t * pAbc, int argc, char ** argv )
// create counter-examples // create counter-examples
pAig1 = Abc_NtkToDar( pNtk1, 0, 0 ); pAig1 = Abc_NtkToDar( pNtk1, 0, 0 );
pAig2 = Abc_NtkToDar( pNtk2, 0, 0 ); pAig2 = Abc_NtkToDar( pNtk2, 0, 0 );
}
else if ( argc == globalUtilOptind )
{
if ( pAbc->pNtkCur == NULL )
{
Abc_Print( 1, "There is no AIG in the main-space.\n");
return 0;
}
if ( pAbc->pGia == NULL )
{
Abc_Print( 1, "There is no AIG in the &-space.\n");
return 0;
}
// create counter-examples
pAig1 = Abc_NtkToDar( pAbc->pNtkCur, 0, 0 );
pAig2 = Gia_ManToAigSimple( pAbc->pGia );
}
else assert( 0 );
pCex = Llb4_Nonlin4NormalizeCex( pAig1, pAig2, pAbc->pCex ); pCex = Llb4_Nonlin4NormalizeCex( pAig1, pAig2, pAbc->pCex );
Aig_ManStop( pAig1 ); Aig_ManStop( pAig1 );
Aig_ManStop( pAig2 ); Aig_ManStop( pAig2 );
...@@ -22512,6 +22581,8 @@ usage: ...@@ -22512,6 +22581,8 @@ usage:
Abc_Print( -2, "\t and <fileOrigin> to be current CEX and current network\n" ); Abc_Print( -2, "\t and <fileOrigin> to be current CEX and current network\n" );
Abc_Print( -2, "\t<fileOrigin> : file name with the original AIG\n"); Abc_Print( -2, "\t<fileOrigin> : file name with the original AIG\n");
Abc_Print( -2, "\t<fileReparam> : file name with the reparametrized AIG\n"); Abc_Print( -2, "\t<fileReparam> : file name with the reparametrized AIG\n");
Abc_Print( -2, "\t (if both file names are not given on the command line,\n");
Abc_Print( -2, "\t original/reparam AIG has to be in the main-space/&-space)\n");
Abc_Print( -2, "\t-h : print the command usage\n"); Abc_Print( -2, "\t-h : print the command usage\n");
return 1; return 1;
} }
...@@ -28911,7 +28982,7 @@ int Abc_CommandAbc9Iso( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -28911,7 +28982,7 @@ int Abc_CommandAbc9Iso( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( -1, "Abc_CommandAbc9Iso(): The AIG has only one PO. Isomorphism detection is not performed.\n" ); Abc_Print( -1, "Abc_CommandAbc9Iso(): The AIG has only one PO. Isomorphism detection is not performed.\n" );
return 1; return 1;
} }
pAig = Gia_ManIsoReduce( pAbc->pGia, &vPosEquivs, fDualOut, fVerbose ); pAig = Gia_ManIsoReduce( pAbc->pGia, &vPosEquivs, NULL, fDualOut, fVerbose );
if ( pAig == NULL ) if ( pAig == NULL )
{ {
Abc_Print( -1, "Abc_CommandAbc9Iso(): Transformation has failed.\n" ); Abc_Print( -1, "Abc_CommandAbc9Iso(): Transformation has failed.\n" );
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <assert.h> #include <assert.h>
#include "abc_global.h" #include "misc/vec/vec.h"
#include "utilCex.h" #include "utilCex.h"
ABC_NAMESPACE_IMPL_START ABC_NAMESPACE_IMPL_START
...@@ -353,6 +353,119 @@ void Abc_CexFree( Abc_Cex_t * p ) ...@@ -353,6 +353,119 @@ void Abc_CexFree( Abc_Cex_t * p )
} }
/**Function*************************************************************
Synopsis [Transform CEX after phase abstraction with nFrames frames.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Abc_Cex_t * Abc_CexTransformPhase( Abc_Cex_t * p, int nPisOld, int nPosOld, int nRegsOld )
{
Abc_Cex_t * pCex;
int nFrames = p->nPis / nPisOld;
int nPosNew = nPosOld * nFrames;
assert( p->nPis % nPisOld == 0 );
assert( p->iPo < nPosNew );
pCex = Abc_CexDup( p, nRegsOld );
pCex->nPis = nPisOld;
pCex->iPo = p->iPo % nPosOld;
pCex->iFrame = p->iFrame * nFrames + p->iPo / nPosOld;
pCex->nBits = pCex->nRegs + pCex->nPis * (pCex->iFrame + 1);
return pCex;
}
/**Function*************************************************************
Synopsis [Transform CEX after phase temporal decomposition with nFrames frames.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Abc_Cex_t * Abc_CexTransformTempor( Abc_Cex_t * p, int nPisOld, int nPosOld, int nRegsOld )
{
Abc_Cex_t * pCex;
int i, k, iBit = nRegsOld, nFrames = p->nPis / nPisOld - 1;
assert( p->iFrame > 0 ); // otherwise tempor did not properly check for failures in the prefix
assert( p->nPis % nPisOld == 0 );
pCex = Abc_CexAlloc( nRegsOld, nPisOld, nFrames + p->iFrame + 1 );
pCex->iPo = p->iPo;
pCex->iFrame = nFrames + p->iFrame;
for ( i = 0; i < nFrames; i++ )
for ( k = 0; k < nPisOld; k++, iBit++ )
if ( Abc_InfoHasBit(p->pData, p->nRegs + (i+1)*nPisOld + k) )
Abc_InfoSetBit( pCex->pData, iBit );
for ( i = 0; i <= p->iFrame; i++ )
for ( k = 0; k < nPisOld; k++, iBit++ )
if ( Abc_InfoHasBit(p->pData, p->nRegs + i*p->nPis + k) )
Abc_InfoSetBit( pCex->pData, iBit );
assert( iBit == pCex->nBits );
return pCex;
}
/**Function*************************************************************
Synopsis [Derives permuted CEX using permutation of its inputs.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Abc_Cex_t * Abc_CexPermute( Abc_Cex_t * p, Vec_Int_t * vMapOld2New )
{
Abc_Cex_t * pCex;
int i, iNew;
assert( Vec_IntSize(vMapOld2New) == p->nPis );
pCex = Abc_CexAlloc( p->nRegs, p->nPis, p->iFrame+1 );
pCex->iPo = p->iPo;
pCex->iFrame = p->iFrame;
for ( i = p->nRegs; i < p->nBits; i++ )
if ( Abc_InfoHasBit(p->pData, i) )
{
iNew = p->nRegs + p->nPis * ((i - p->nRegs) / p->nPis) + Vec_IntEntry( vMapOld2New, (i - p->nRegs) % p->nPis );
Abc_InfoSetBit( pCex->pData, iNew );
}
return pCex;
}
/**Function*************************************************************
Synopsis [Derives permuted CEX using two canonical permutations.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Abc_Cex_t * Abc_CexPermuteTwo( Abc_Cex_t * p, Vec_Int_t * vPermOld, Vec_Int_t * vPermNew )
{
Vec_Int_t * vPermInv = Vec_IntInvert( vPermNew, -1 );
Vec_Int_t * vPerm = Vec_IntAlloc( Vec_IntSize(vPermOld) );
Abc_Cex_t * pCex;
int i, Entry;
assert( Vec_IntSize(vPermOld) == p->nPis );
assert( Vec_IntSize(vPermNew) == p->nPis );
Vec_IntForEachEntry( vPerm, Entry, i )
Vec_IntEntry( vPerm, Vec_IntEntry(vPermInv, Vec_IntEntry(vPermOld, Entry)) );
pCex = Abc_CexPermute( p, vPerm );
Vec_IntFree( vPermInv );
Vec_IntFree( vPerm );
return pCex;
}
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
/// END OF FILE /// /// END OF FILE ///
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
......
...@@ -68,6 +68,10 @@ extern void Abc_CexPrintStatsInputs( Abc_Cex_t * p, int nInputs ); ...@@ -68,6 +68,10 @@ extern void Abc_CexPrintStatsInputs( Abc_Cex_t * p, int nInputs );
extern void Abc_CexPrint( Abc_Cex_t * p ); extern void Abc_CexPrint( Abc_Cex_t * p );
extern void Abc_CexFreeP( Abc_Cex_t ** p ); extern void Abc_CexFreeP( Abc_Cex_t ** p );
extern void Abc_CexFree( Abc_Cex_t * p ); extern void Abc_CexFree( Abc_Cex_t * p );
extern Abc_Cex_t * Abc_CexTransformPhase( Abc_Cex_t * p, int nPisOld, int nPosOld, int nRegsOld );
extern Abc_Cex_t * Abc_CexTransformTempor( Abc_Cex_t * p, int nPisOld, int nPosOld, int nRegsOld );
extern Abc_Cex_t * Abc_CexPermute( Abc_Cex_t * p, Vec_Int_t * vMapOld2New );
extern Abc_Cex_t * Abc_CexPermuteTwo( Abc_Cex_t * p, Vec_Int_t * vPermOld, Vec_Int_t * vPermNew );
ABC_NAMESPACE_HEADER_END ABC_NAMESPACE_HEADER_END
......
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