Commit 37b6c727 by Alan Mishchenko

Version abc80512_2

parent cb899ec8
...@@ -77,6 +77,12 @@ int Fra_FraigMiterStatus( Aig_Man_t * p ) ...@@ -77,6 +77,12 @@ int Fra_FraigMiterStatus( Aig_Man_t * p )
CountNonConst0++; CountNonConst0++;
continue; continue;
} }
// check if the output is a primary input
if ( p->nRegs == 0 && Aig_ObjIsPi(Aig_Regular(pChild)) )
{
CountNonConst0++;
continue;
}
// check if the output can be not constant 0 // check if the output can be not constant 0
if ( Aig_Regular(pChild)->fPhase != (unsigned)Aig_IsComplement(pChild) ) if ( Aig_Regular(pChild)->fPhase != (unsigned)Aig_IsComplement(pChild) )
{ {
......
...@@ -1815,6 +1815,12 @@ int Ivy_FraigMiterStatus( Ivy_Man_t * pMan ) ...@@ -1815,6 +1815,12 @@ int Ivy_FraigMiterStatus( Ivy_Man_t * pMan )
CountConst0++; CountConst0++;
continue; continue;
} }
// check if the output is a primary input
if ( Ivy_ObjIsPi(Ivy_Regular(pObjNew)) )
{
CountNonConst0++;
continue;
}
// check if the output can be constant 0 // check if the output can be constant 0
if ( Ivy_Regular(pObjNew)->fPhase != (unsigned)Ivy_IsComplement(pObjNew) ) if ( Ivy_Regular(pObjNew)->fPhase != (unsigned)Ivy_IsComplement(pObjNew) )
{ {
......
...@@ -648,7 +648,7 @@ extern int Abc_NodeMinimumBase( Abc_Obj_t * pNode ); ...@@ -648,7 +648,7 @@ extern int Abc_NodeMinimumBase( Abc_Obj_t * pNode );
extern int Abc_NtkRemoveDupFanins( Abc_Ntk_t * pNtk ); extern int Abc_NtkRemoveDupFanins( Abc_Ntk_t * pNtk );
extern int Abc_NodeRemoveDupFanins( Abc_Obj_t * pNode ); extern int Abc_NodeRemoveDupFanins( Abc_Obj_t * pNode );
/*=== abcMiter.c ==========================================================*/ /*=== abcMiter.c ==========================================================*/
extern Abc_Ntk_t * Abc_NtkMiter( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fComb, int nPartSize, int fImplic ); extern Abc_Ntk_t * Abc_NtkMiter( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fComb, int nPartSize, int fImplic, int fMulti );
extern void Abc_NtkMiterAddCone( Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtkMiter, Abc_Obj_t * pNode ); extern void Abc_NtkMiterAddCone( Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtkMiter, Abc_Obj_t * pNode );
extern Abc_Ntk_t * Abc_NtkMiterAnd( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fOr, int fCompl2 ); extern Abc_Ntk_t * Abc_NtkMiterAnd( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fOr, int fCompl2 );
extern Abc_Ntk_t * Abc_NtkMiterCofactor( Abc_Ntk_t * pNtk, Vec_Int_t * vPiValues ); extern Abc_Ntk_t * Abc_NtkMiterCofactor( Abc_Ntk_t * pNtk, Vec_Int_t * vPiValues );
......
...@@ -162,6 +162,10 @@ int Abc_NodeStrashBlifMv( Abc_Ntk_t * pNtkNew, Abc_Obj_t * pObj ) ...@@ -162,6 +162,10 @@ int Abc_NodeStrashBlifMv( Abc_Ntk_t * pNtkNew, Abc_Obj_t * pObj )
// skip space if present // skip space if present
if ( *pSop == ' ' ) if ( *pSop == ' ' )
pSop++; pSop++;
// assume don't-care constant to be zero
if ( *pSop == '-' )
Index = 0;
else
Index = Abc_StringGetNumber( &pSop ); Index = Abc_StringGetNumber( &pSop );
assert( Index < nValues ); assert( Index < nValues );
pValues[Index] = Abc_AigConst1(pNtkNew); pValues[Index] = Abc_AigConst1(pNtkNew);
...@@ -365,6 +369,7 @@ Abc_Ntk_t * Abc_NtkStrashBlifMv( Abc_Ntk_t * pNtk ) ...@@ -365,6 +369,7 @@ Abc_Ntk_t * Abc_NtkStrashBlifMv( Abc_Ntk_t * pNtk )
Abc_Ntk_t * pNtkNew; Abc_Ntk_t * pNtkNew;
Abc_Obj_t * pObj, * pTemp, * pBit, * pNet; Abc_Obj_t * pObj, * pTemp, * pBit, * pNet;
int i, k, v, nValues, nValuesMax, nBits; int i, k, v, nValues, nValuesMax, nBits;
int nCount1, nCount2;
assert( Abc_NtkIsNetlist(pNtk) ); assert( Abc_NtkIsNetlist(pNtk) );
assert( Abc_NtkHasBlifMv(pNtk) ); assert( Abc_NtkHasBlifMv(pNtk) );
...@@ -393,12 +398,15 @@ Abc_Ntk_t * Abc_NtkStrashBlifMv( Abc_Ntk_t * pNtk ) ...@@ -393,12 +398,15 @@ Abc_Ntk_t * Abc_NtkStrashBlifMv( Abc_Ntk_t * pNtk )
pNtkNew->pName = Extra_UtilStrsav( pNtk->pName ); pNtkNew->pName = Extra_UtilStrsav( pNtk->pName );
// pNtkNew->pSpec = Extra_UtilStrsav( pNtk->pName ); // pNtkNew->pSpec = Extra_UtilStrsav( pNtk->pName );
nCount1 = nCount2 = 0;
// encode the CI nets // encode the CI nets
Abc_NtkIncrementTravId( pNtk ); Abc_NtkIncrementTravId( pNtk );
if ( fUsePositional ) if ( fUsePositional )
{ {
Abc_NtkForEachCi( pNtk, pObj, i ) Abc_NtkForEachCi( pNtk, pObj, i )
{ {
if ( !Abc_ObjIsPi(pObj) )
continue;
pNet = Abc_ObjFanout0(pObj); pNet = Abc_ObjFanout0(pObj);
nValues = Abc_ObjMvVarNum(pNet); nValues = Abc_ObjMvVarNum(pNet);
pValues = ALLOC( Abc_Obj_t *, nValues ); pValues = ALLOC( Abc_Obj_t *, nValues );
...@@ -413,11 +421,32 @@ Abc_Ntk_t * Abc_NtkStrashBlifMv( Abc_Ntk_t * pNtk ) ...@@ -413,11 +421,32 @@ Abc_Ntk_t * Abc_NtkStrashBlifMv( Abc_Ntk_t * pNtk )
// mark the net // mark the net
Abc_NodeSetTravIdCurrent( pNet ); Abc_NodeSetTravIdCurrent( pNet );
} }
Abc_NtkForEachCi( pNtk, pObj, i )
{
if ( Abc_ObjIsPi(pObj) )
continue;
pNet = Abc_ObjFanout0(pObj);
nValues = Abc_ObjMvVarNum(pNet);
pValues = ALLOC( Abc_Obj_t *, nValues );
// create PIs for the values
for ( v = 0; v < nValues; v++ )
{
pValues[v] = Abc_NtkCreateBo( pNtkNew );
Abc_NtkConvertAssignName( pValues[v], pNet, v );
nCount1++;
}
// save the values in the fanout net
pNet->pCopy = (Abc_Obj_t *)pValues;
// mark the net
Abc_NodeSetTravIdCurrent( pNet );
}
} }
else else
{ {
Abc_NtkForEachCi( pNtk, pObj, i ) Abc_NtkForEachCi( pNtk, pObj, i )
{ {
if ( !Abc_ObjIsPi(pObj) )
continue;
pNet = Abc_ObjFanout0(pObj); pNet = Abc_ObjFanout0(pObj);
nValues = Abc_ObjMvVarNum(pNet); nValues = Abc_ObjMvVarNum(pNet);
pValues = ALLOC( Abc_Obj_t *, nValues ); pValues = ALLOC( Abc_Obj_t *, nValues );
...@@ -443,6 +472,36 @@ Abc_Ntk_t * Abc_NtkStrashBlifMv( Abc_Ntk_t * pNtk ) ...@@ -443,6 +472,36 @@ Abc_Ntk_t * Abc_NtkStrashBlifMv( Abc_Ntk_t * pNtk )
// mark the net // mark the net
Abc_NodeSetTravIdCurrent( pNet ); Abc_NodeSetTravIdCurrent( pNet );
} }
Abc_NtkForEachCi( pNtk, pObj, i )
{
if ( Abc_ObjIsPi(pObj) )
continue;
pNet = Abc_ObjFanout0(pObj);
nValues = Abc_ObjMvVarNum(pNet);
pValues = ALLOC( Abc_Obj_t *, nValues );
// create PIs for the encoding bits
nBits = Extra_Base2Log( nValues );
for ( k = 0; k < nBits; k++ )
{
pBits[k] = Abc_NtkCreateBo( pNtkNew );
Abc_NtkConvertAssignName( pBits[k], pNet, k );
nCount1++;
}
// encode the values
for ( v = 0; v < nValues; v++ )
{
pValues[v] = Abc_AigConst1(pNtkNew);
for ( k = 0; k < nBits; k++ )
{
pBit = Abc_ObjNotCond( pBits[k], (v&(1<<k)) == 0 );
pValues[v] = Abc_AigAnd( pNtkNew->pManFunc, pValues[v], pBit );
}
}
// save the values in the fanout net
pNet->pCopy = (Abc_Obj_t *)pValues;
// mark the net
Abc_NodeSetTravIdCurrent( pNet );
}
} }
// process nodes in the topological order // process nodes in the topological order
...@@ -459,6 +518,8 @@ Abc_Ntk_t * Abc_NtkStrashBlifMv( Abc_Ntk_t * pNtk ) ...@@ -459,6 +518,8 @@ Abc_Ntk_t * Abc_NtkStrashBlifMv( Abc_Ntk_t * pNtk )
{ {
Abc_NtkForEachCo( pNtk, pObj, i ) Abc_NtkForEachCo( pNtk, pObj, i )
{ {
if ( !Abc_ObjIsPo(pObj) )
continue;
pNet = Abc_ObjFanin0(pObj); pNet = Abc_ObjFanin0(pObj);
// skip marked nets // skip marked nets
if ( Abc_NodeIsTravIdCurrent(pNet) ) if ( Abc_NodeIsTravIdCurrent(pNet) )
...@@ -473,11 +534,32 @@ Abc_Ntk_t * Abc_NtkStrashBlifMv( Abc_Ntk_t * pNtk ) ...@@ -473,11 +534,32 @@ Abc_Ntk_t * Abc_NtkStrashBlifMv( Abc_Ntk_t * pNtk )
Abc_NtkConvertAssignName( pTemp, pNet, v ); Abc_NtkConvertAssignName( pTemp, pNet, v );
} }
} }
Abc_NtkForEachCo( pNtk, pObj, i )
{
if ( Abc_ObjIsPo(pObj) )
continue;
pNet = Abc_ObjFanin0(pObj);
// skip marked nets
if ( Abc_NodeIsTravIdCurrent(pNet) )
continue;
Abc_NodeSetTravIdCurrent( pNet );
nValues = Abc_ObjMvVarNum(pNet);
pValues = (Abc_Obj_t **)pNet->pCopy;
for ( v = 0; v < nValues; v++ )
{
pTemp = Abc_NtkCreateBi( pNtkNew );
Abc_ObjAddFanin( pTemp, pValues[v] );
Abc_NtkConvertAssignName( pTemp, pNet, v );
nCount2++;
}
}
} }
else else
{ {
Abc_NtkForEachCo( pNtk, pObj, i ) Abc_NtkForEachCo( pNtk, pObj, i )
{ {
if ( !Abc_ObjIsPo(pObj) )
continue;
pNet = Abc_ObjFanin0(pObj); pNet = Abc_ObjFanin0(pObj);
// skip marked nets // skip marked nets
if ( Abc_NodeIsTravIdCurrent(pNet) ) if ( Abc_NodeIsTravIdCurrent(pNet) )
...@@ -497,6 +579,49 @@ Abc_Ntk_t * Abc_NtkStrashBlifMv( Abc_Ntk_t * pNtk ) ...@@ -497,6 +579,49 @@ Abc_Ntk_t * Abc_NtkStrashBlifMv( Abc_Ntk_t * pNtk )
Abc_NtkConvertAssignName( pTemp, pNet, k ); Abc_NtkConvertAssignName( pTemp, pNet, k );
} }
} }
Abc_NtkForEachCo( pNtk, pObj, i )
{
if ( Abc_ObjIsPo(pObj) )
continue;
pNet = Abc_ObjFanin0(pObj);
// skip marked nets
if ( Abc_NodeIsTravIdCurrent(pNet) )
continue;
Abc_NodeSetTravIdCurrent( pNet );
nValues = Abc_ObjMvVarNum(pNet);
pValues = (Abc_Obj_t **)pNet->pCopy;
nBits = Extra_Base2Log( nValues );
for ( k = 0; k < nBits; k++ )
{
pBit = Abc_ObjNot( Abc_AigConst1(pNtkNew) );
for ( v = 0; v < nValues; v++ )
if ( v & (1<<k) )
pBit = Abc_AigOr( pNtkNew->pManFunc, pBit, pValues[v] );
pTemp = Abc_NtkCreateBi( pNtkNew );
Abc_ObjAddFanin( pTemp, pBit );
Abc_NtkConvertAssignName( pTemp, pNet, k );
nCount2++;
}
}
}
if ( Abc_NtkLatchNum(pNtk) )
{
Abc_Obj_t * pLatch, * pObjLi, * pObjLo;
int i;
assert( nCount1 == nCount2 );
for ( i = 0; i < nCount1; i++ )
{
// create latch
pLatch = Abc_NtkCreateLatch( pNtkNew );
Abc_LatchSetInit0( pLatch );
Abc_ObjAssignName( pLatch, Abc_ObjName(pLatch), NULL );
// connect
pObjLi = Abc_NtkCo( pNtkNew, Abc_NtkCoNum(pNtkNew)-nCount1+i );
pObjLo = Abc_NtkCi( pNtkNew, Abc_NtkCiNum(pNtkNew)-nCount1+i );
Abc_ObjAddFanin( pLatch, pObjLi );
Abc_ObjAddFanin( pObjLo, pLatch );
}
} }
// cleanup // cleanup
......
...@@ -4668,6 +4668,7 @@ int Abc_CommandMiter( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -4668,6 +4668,7 @@ int Abc_CommandMiter( Abc_Frame_t * pAbc, int argc, char ** argv )
int fCheck; int fCheck;
int fComb; int fComb;
int fImplic; int fImplic;
int fMulti;
int nPartSize; int nPartSize;
pNtk = Abc_FrameReadNtk(pAbc); pNtk = Abc_FrameReadNtk(pAbc);
...@@ -4678,9 +4679,10 @@ int Abc_CommandMiter( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -4678,9 +4679,10 @@ int Abc_CommandMiter( Abc_Frame_t * pAbc, int argc, char ** argv )
fComb = 1; fComb = 1;
fCheck = 1; fCheck = 1;
fImplic = 0; fImplic = 0;
fMulti = 0;
nPartSize = 0; nPartSize = 0;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "Pcih" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "Pcmih" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
...@@ -4698,6 +4700,9 @@ int Abc_CommandMiter( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -4698,6 +4700,9 @@ int Abc_CommandMiter( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'c': case 'c':
fComb ^= 1; fComb ^= 1;
break; break;
case 'm':
fMulti ^= 1;
break;
case 'i': case 'i':
fImplic ^= 1; fImplic ^= 1;
break; break;
...@@ -4712,7 +4717,7 @@ int Abc_CommandMiter( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -4712,7 +4717,7 @@ int Abc_CommandMiter( Abc_Frame_t * pAbc, int argc, char ** argv )
return 1; return 1;
// compute the miter // compute the miter
pNtkRes = Abc_NtkMiter( pNtk1, pNtk2, fComb, nPartSize, fImplic ); pNtkRes = Abc_NtkMiter( pNtk1, pNtk2, fComb, nPartSize, fImplic, fMulti );
if ( fDelete1 ) Abc_NtkDelete( pNtk1 ); if ( fDelete1 ) Abc_NtkDelete( pNtk1 );
if ( fDelete2 ) Abc_NtkDelete( pNtk2 ); if ( fDelete2 ) Abc_NtkDelete( pNtk2 );
...@@ -4731,11 +4736,12 @@ usage: ...@@ -4731,11 +4736,12 @@ usage:
strcpy( Buffer, "unused" ); strcpy( Buffer, "unused" );
else else
sprintf( Buffer, "%d", nPartSize ); sprintf( Buffer, "%d", nPartSize );
fprintf( pErr, "usage: miter [-P num] [-cih] <file1> <file2>\n" ); fprintf( pErr, "usage: miter [-P num] [-cimh] <file1> <file2>\n" );
fprintf( pErr, "\t computes the miter of the two circuits\n" ); fprintf( pErr, "\t computes the miter of the two circuits\n" );
fprintf( pErr, "\t-P num : output partition size [default = %s]\n", Buffer ); fprintf( pErr, "\t-P num : output partition size [default = %s]\n", Buffer );
fprintf( pErr, "\t-c : toggles deriving combinational miter (latches as POs) [default = %s]\n", fComb? "yes": "no" ); fprintf( pErr, "\t-c : toggles deriving combinational miter (latches as POs) [default = %s]\n", fComb? "yes": "no" );
fprintf( pErr, "\t-i : toggles deriving implication miter (file1 => file2) [default = %s]\n", fImplic? "yes": "no" ); fprintf( pErr, "\t-i : toggles deriving implication miter (file1 => file2) [default = %s]\n", fImplic? "yes": "no" );
fprintf( pErr, "\t-m : toggles creating multi-output miters [default = %s]\n", fMulti? "yes": "no" );
fprintf( pErr, "\t-h : print the command usage\n"); fprintf( pErr, "\t-h : print the command usage\n");
fprintf( pErr, "\tfile1 : (optional) the file with the first network\n"); fprintf( pErr, "\tfile1 : (optional) the file with the first network\n");
fprintf( pErr, "\tfile2 : (optional) the file with the second network\n"); fprintf( pErr, "\tfile2 : (optional) the file with the second network\n");
...@@ -14132,7 +14138,7 @@ int Abc_CommandDProve( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -14132,7 +14138,7 @@ int Abc_CommandDProve( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0; return 0;
usage: usage:
fprintf( pErr, "usage: dprove [-F num] [-T num] [-carmfwvh]\n" ); fprintf( pErr, "usage: dprove [-F num] [-T num] [-cbarmfwvh]\n" );
fprintf( pErr, "\t performs SEC on the sequential miter\n" ); fprintf( pErr, "\t performs SEC on the sequential miter\n" );
fprintf( pErr, "\t-F num : the limit on the depth of induction [default = %d]\n", nFrames ); fprintf( pErr, "\t-F num : the limit on the depth of induction [default = %d]\n", nFrames );
fprintf( pErr, "\t-T num : the approximate runtime limit (in seconds) [default = %d]\n", TimeLimit ); fprintf( pErr, "\t-T num : the approximate runtime limit (in seconds) [default = %d]\n", TimeLimit );
......
...@@ -1033,7 +1033,7 @@ int Abc_NtkDarCec( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fPartition, int fVe ...@@ -1033,7 +1033,7 @@ int Abc_NtkDarCec( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fPartition, int fVe
if ( pNtk2 != NULL ) if ( pNtk2 != NULL )
{ {
// get the miter of the two networks // get the miter of the two networks
pMiter = Abc_NtkMiter( pNtk1, pNtk2, 0, 0, 0 ); pMiter = Abc_NtkMiter( pNtk1, pNtk2, 0, 0, 0, 0 );
if ( pMiter == NULL ) if ( pMiter == NULL )
{ {
printf( "Miter computation has failed.\n" ); printf( "Miter computation has failed.\n" );
...@@ -1380,7 +1380,7 @@ int Abc_NtkDarSec( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nFrames, int fPhase ...@@ -1380,7 +1380,7 @@ int Abc_NtkDarSec( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nFrames, int fPhase
int RetValue; int RetValue;
// get the miter of the two networks // get the miter of the two networks
pMiter = Abc_NtkMiter( pNtk1, pNtk2, 0, 0, 0 ); pMiter = Abc_NtkMiter( pNtk1, pNtk2, 0, 0, 0, 0 );
if ( pMiter == NULL ) if ( pMiter == NULL )
{ {
printf( "Miter computation has failed.\n" ); printf( "Miter computation has failed.\n" );
......
...@@ -24,10 +24,10 @@ ...@@ -24,10 +24,10 @@
/// DECLARATIONS /// /// DECLARATIONS ///
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
static Abc_Ntk_t * Abc_NtkMiterInt( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fComb, int nPartSize, int fImplic ); static Abc_Ntk_t * Abc_NtkMiterInt( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fComb, int nPartSize, int fImplic, int fMulti );
static void Abc_NtkMiterPrepare( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, Abc_Ntk_t * pNtkMiter, int fComb, int nPartSize ); static void Abc_NtkMiterPrepare( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, Abc_Ntk_t * pNtkMiter, int fComb, int nPartSize, int fMulti );
static void Abc_NtkMiterAddOne( Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtkMiter ); static void Abc_NtkMiterAddOne( Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtkMiter );
static void Abc_NtkMiterFinalize( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, Abc_Ntk_t * pNtkMiter, int fComb, int nPartSize, int fImplic ); static void Abc_NtkMiterFinalize( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, Abc_Ntk_t * pNtkMiter, int fComb, int nPartSize, int fImplic, int fMulti );
static void Abc_NtkAddFrame( Abc_Ntk_t * pNetNew, Abc_Ntk_t * pNet, int iFrame ); static void Abc_NtkAddFrame( Abc_Ntk_t * pNetNew, Abc_Ntk_t * pNet, int iFrame );
// to be exported // to be exported
...@@ -50,7 +50,7 @@ static void Abc_NtkAddFrame2( Abc_Ntk_t * pNtkFrames, Abc_Ntk_t * pNtk, i ...@@ -50,7 +50,7 @@ static void Abc_NtkAddFrame2( Abc_Ntk_t * pNtkFrames, Abc_Ntk_t * pNtk, i
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
Abc_Ntk_t * Abc_NtkMiter( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fComb, int nPartSize, int fImplic ) Abc_Ntk_t * Abc_NtkMiter( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fComb, int nPartSize, int fImplic, int fMulti )
{ {
Abc_Ntk_t * pTemp = NULL; Abc_Ntk_t * pTemp = NULL;
int fRemove1, fRemove2; int fRemove1, fRemove2;
...@@ -63,7 +63,7 @@ Abc_Ntk_t * Abc_NtkMiter( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fComb, int n ...@@ -63,7 +63,7 @@ Abc_Ntk_t * Abc_NtkMiter( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fComb, int n
fRemove1 = (!Abc_NtkIsStrash(pNtk1)) && (pNtk1 = Abc_NtkStrash(pNtk1, 0, 0, 0)); fRemove1 = (!Abc_NtkIsStrash(pNtk1)) && (pNtk1 = Abc_NtkStrash(pNtk1, 0, 0, 0));
fRemove2 = (!Abc_NtkIsStrash(pNtk2)) && (pNtk2 = Abc_NtkStrash(pNtk2, 0, 0, 0)); fRemove2 = (!Abc_NtkIsStrash(pNtk2)) && (pNtk2 = Abc_NtkStrash(pNtk2, 0, 0, 0));
if ( pNtk1 && pNtk2 ) if ( pNtk1 && pNtk2 )
pTemp = Abc_NtkMiterInt( pNtk1, pNtk2, fComb, nPartSize, fImplic ); pTemp = Abc_NtkMiterInt( pNtk1, pNtk2, fComb, nPartSize, fImplic, fMulti );
if ( fRemove1 ) Abc_NtkDelete( pNtk1 ); if ( fRemove1 ) Abc_NtkDelete( pNtk1 );
if ( fRemove2 ) Abc_NtkDelete( pNtk2 ); if ( fRemove2 ) Abc_NtkDelete( pNtk2 );
return pTemp; return pTemp;
...@@ -80,7 +80,7 @@ Abc_Ntk_t * Abc_NtkMiter( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fComb, int n ...@@ -80,7 +80,7 @@ Abc_Ntk_t * Abc_NtkMiter( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fComb, int n
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
Abc_Ntk_t * Abc_NtkMiterInt( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fComb, int nPartSize, int fImplic ) Abc_Ntk_t * Abc_NtkMiterInt( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fComb, int nPartSize, int fImplic, int fMulti )
{ {
char Buffer[1000]; char Buffer[1000];
Abc_Ntk_t * pNtkMiter; Abc_Ntk_t * pNtkMiter;
...@@ -94,10 +94,10 @@ Abc_Ntk_t * Abc_NtkMiterInt( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fComb, in ...@@ -94,10 +94,10 @@ Abc_Ntk_t * Abc_NtkMiterInt( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fComb, in
pNtkMiter->pName = Extra_UtilStrsav(Buffer); pNtkMiter->pName = Extra_UtilStrsav(Buffer);
// perform strashing // perform strashing
Abc_NtkMiterPrepare( pNtk1, pNtk2, pNtkMiter, fComb, nPartSize ); Abc_NtkMiterPrepare( pNtk1, pNtk2, pNtkMiter, fComb, nPartSize, fMulti );
Abc_NtkMiterAddOne( pNtk1, pNtkMiter ); Abc_NtkMiterAddOne( pNtk1, pNtkMiter );
Abc_NtkMiterAddOne( pNtk2, pNtkMiter ); Abc_NtkMiterAddOne( pNtk2, pNtkMiter );
Abc_NtkMiterFinalize( pNtk1, pNtk2, pNtkMiter, fComb, nPartSize, fImplic ); Abc_NtkMiterFinalize( pNtk1, pNtk2, pNtkMiter, fComb, nPartSize, fImplic, fMulti );
Abc_AigCleanup(pNtkMiter->pManFunc); Abc_AigCleanup(pNtkMiter->pManFunc);
// make sure that everything is okay // make sure that everything is okay
...@@ -121,7 +121,7 @@ Abc_Ntk_t * Abc_NtkMiterInt( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fComb, in ...@@ -121,7 +121,7 @@ Abc_Ntk_t * Abc_NtkMiterInt( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fComb, in
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
void Abc_NtkMiterPrepare( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, Abc_Ntk_t * pNtkMiter, int fComb, int nPartSize ) void Abc_NtkMiterPrepare( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, Abc_Ntk_t * pNtkMiter, int fComb, int nPartSize, int fMulti )
{ {
Abc_Obj_t * pObj, * pObjNew; Abc_Obj_t * pObj, * pObjNew;
int i; int i;
...@@ -146,12 +146,23 @@ void Abc_NtkMiterPrepare( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, Abc_Ntk_t * pNtk ...@@ -146,12 +146,23 @@ void Abc_NtkMiterPrepare( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, Abc_Ntk_t * pNtk
} }
if ( nPartSize <= 0 ) if ( nPartSize <= 0 )
{ {
// create the only PO // create POs
if ( fMulti )
{
Abc_NtkForEachCo( pNtk1, pObj, i )
{
pObjNew = Abc_NtkCreatePo( pNtkMiter );
Abc_ObjAssignName( pObjNew, "miter", Abc_ObjName(pObjNew) );
}
}
else
{
pObjNew = Abc_NtkCreatePo( pNtkMiter ); pObjNew = Abc_NtkCreatePo( pNtkMiter );
// add the PO name
Abc_ObjAssignName( pObjNew, "miter", NULL ); Abc_ObjAssignName( pObjNew, "miter", NULL );
} }
} }
}
else else
{ {
// create new PIs and remember them in the old PIs // create new PIs and remember them in the old PIs
...@@ -167,11 +178,22 @@ void Abc_NtkMiterPrepare( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, Abc_Ntk_t * pNtk ...@@ -167,11 +178,22 @@ void Abc_NtkMiterPrepare( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, Abc_Ntk_t * pNtk
} }
if ( nPartSize <= 0 ) if ( nPartSize <= 0 )
{ {
// create the only PO // create POs
if ( fMulti )
{
Abc_NtkForEachPo( pNtk1, pObj, i )
{
pObjNew = Abc_NtkCreatePo( pNtkMiter );
Abc_ObjAssignName( pObjNew, "miter", Abc_ObjName(pObjNew) );
}
}
else
{
pObjNew = Abc_NtkCreatePo( pNtkMiter ); pObjNew = Abc_NtkCreatePo( pNtkMiter );
// add the PO name
Abc_ObjAssignName( pObjNew, "miter", NULL ); Abc_ObjAssignName( pObjNew, "miter", NULL );
} }
}
// create the latches // create the latches
Abc_NtkForEachLatch( pNtk1, pObj, i ) Abc_NtkForEachLatch( pNtk1, pObj, i )
{ {
...@@ -250,11 +272,12 @@ void Abc_NtkMiterAddCone( Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtkMiter, Abc_Obj_t * p ...@@ -250,11 +272,12 @@ void Abc_NtkMiterAddCone( Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtkMiter, Abc_Obj_t * p
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
void Abc_NtkMiterFinalize( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, Abc_Ntk_t * pNtkMiter, int fComb, int nPartSize, int fImplic ) void Abc_NtkMiterFinalize( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, Abc_Ntk_t * pNtkMiter, int fComb, int nPartSize, int fImplic, int fMulti )
{ {
Vec_Ptr_t * vPairs; Vec_Ptr_t * vPairs;
Abc_Obj_t * pMiter, * pNode; Abc_Obj_t * pMiter, * pNode;
int i; int i;
assert( nPartSize == 0 || fMulti == 0 );
// collect the PO pairs from both networks // collect the PO pairs from both networks
vPairs = Vec_PtrAlloc( 100 ); vPairs = Vec_PtrAlloc( 100 );
if ( fComb ) if ( fComb )
...@@ -262,20 +285,36 @@ void Abc_NtkMiterFinalize( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, Abc_Ntk_t * pNt ...@@ -262,20 +285,36 @@ void Abc_NtkMiterFinalize( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, Abc_Ntk_t * pNt
// collect the CO nodes for the miter // collect the CO nodes for the miter
Abc_NtkForEachCo( pNtk1, pNode, i ) Abc_NtkForEachCo( pNtk1, pNode, i )
{ {
if ( fMulti )
{
pMiter = Abc_AigXor( pNtkMiter->pManFunc, Abc_ObjChild0Copy(pNode), Abc_ObjChild0Copy(Abc_NtkCo(pNtk2, i)) );
Abc_ObjAddFanin( Abc_NtkPo(pNtkMiter,i), pMiter );
}
else
{
Vec_PtrPush( vPairs, Abc_ObjChild0Copy(pNode) ); Vec_PtrPush( vPairs, Abc_ObjChild0Copy(pNode) );
pNode = Abc_NtkCo( pNtk2, i ); pNode = Abc_NtkCo( pNtk2, i );
Vec_PtrPush( vPairs, Abc_ObjChild0Copy(pNode) ); Vec_PtrPush( vPairs, Abc_ObjChild0Copy(pNode) );
} }
} }
}
else else
{ {
// collect the PO nodes for the miter // collect the PO nodes for the miter
Abc_NtkForEachPo( pNtk1, pNode, i ) Abc_NtkForEachPo( pNtk1, pNode, i )
{ {
if ( fMulti )
{
pMiter = Abc_AigXor( pNtkMiter->pManFunc, Abc_ObjChild0Copy(pNode), Abc_ObjChild0Copy(Abc_NtkCo(pNtk2, i)) );
Abc_ObjAddFanin( Abc_NtkPo(pNtkMiter,i), pMiter );
}
else
{
Vec_PtrPush( vPairs, Abc_ObjChild0Copy(pNode) ); Vec_PtrPush( vPairs, Abc_ObjChild0Copy(pNode) );
pNode = Abc_NtkPo( pNtk2, i ); pNode = Abc_NtkPo( pNtk2, i );
Vec_PtrPush( vPairs, Abc_ObjChild0Copy(pNode) ); Vec_PtrPush( vPairs, Abc_ObjChild0Copy(pNode) );
} }
}
// connect new latches // connect new latches
Abc_NtkForEachLatch( pNtk1, pNode, i ) Abc_NtkForEachLatch( pNtk1, pNode, i )
Abc_ObjAddFanin( Abc_ObjFanin0(pNode)->pCopy, Abc_ObjChild0Copy(Abc_ObjFanin0(pNode)) ); Abc_ObjAddFanin( Abc_ObjFanin0(pNode)->pCopy, Abc_ObjChild0Copy(Abc_ObjFanin0(pNode)) );
...@@ -285,9 +324,11 @@ void Abc_NtkMiterFinalize( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, Abc_Ntk_t * pNt ...@@ -285,9 +324,11 @@ void Abc_NtkMiterFinalize( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, Abc_Ntk_t * pNt
// add the miter // add the miter
if ( nPartSize <= 0 ) if ( nPartSize <= 0 )
{ {
if ( !fMulti )
{
pMiter = Abc_AigMiter( pNtkMiter->pManFunc, vPairs, fImplic ); pMiter = Abc_AigMiter( pNtkMiter->pManFunc, vPairs, fImplic );
Abc_ObjAddFanin( Abc_NtkPo(pNtkMiter,0), pMiter ); Abc_ObjAddFanin( Abc_NtkPo(pNtkMiter,0), pMiter );
Vec_PtrFree( vPairs ); }
} }
else else
{ {
...@@ -320,8 +361,8 @@ void Abc_NtkMiterFinalize( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, Abc_Ntk_t * pNt ...@@ -320,8 +361,8 @@ void Abc_NtkMiterFinalize( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, Abc_Ntk_t * pNt
Abc_ObjAssignName( pNode, "miter_", Buffer ); Abc_ObjAssignName( pNode, "miter_", Buffer );
} }
Vec_PtrFree( vPairsPart ); Vec_PtrFree( vPairsPart );
Vec_PtrFree( vPairs );
} }
Vec_PtrFree( vPairs );
} }
...@@ -361,7 +402,7 @@ Abc_Ntk_t * Abc_NtkMiterAnd( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fOr, int ...@@ -361,7 +402,7 @@ Abc_Ntk_t * Abc_NtkMiterAnd( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fOr, int
pNtkMiter->pName = Extra_UtilStrsav(Buffer); pNtkMiter->pName = Extra_UtilStrsav(Buffer);
// perform strashing // perform strashing
Abc_NtkMiterPrepare( pNtk1, pNtk2, pNtkMiter, 1, -1 ); Abc_NtkMiterPrepare( pNtk1, pNtk2, pNtkMiter, 1, -1, 0 );
Abc_NtkMiterAddOne( pNtk1, pNtkMiter ); Abc_NtkMiterAddOne( pNtk1, pNtkMiter );
Abc_NtkMiterAddOne( pNtk2, pNtkMiter ); Abc_NtkMiterAddOne( pNtk2, pNtkMiter );
// Abc_NtkMiterFinalize( pNtk1, pNtk2, pNtkMiter, 1 ); // Abc_NtkMiterFinalize( pNtk1, pNtk2, pNtkMiter, 1 );
...@@ -420,7 +461,7 @@ Abc_Ntk_t * Abc_NtkMiterCofactor( Abc_Ntk_t * pNtk, Vec_Int_t * vPiValues ) ...@@ -420,7 +461,7 @@ Abc_Ntk_t * Abc_NtkMiterCofactor( Abc_Ntk_t * pNtk, Vec_Int_t * vPiValues )
pRoot = Abc_NtkCo( pNtk, 0 ); pRoot = Abc_NtkCo( pNtk, 0 );
// perform strashing // perform strashing
Abc_NtkMiterPrepare( pNtk, pNtk, pNtkMiter, 1, -1 ); Abc_NtkMiterPrepare( pNtk, pNtk, pNtkMiter, 1, -1, 0 );
// set the first cofactor // set the first cofactor
Vec_IntForEachEntry( vPiValues, Value, i ) Vec_IntForEachEntry( vPiValues, Value, i )
{ {
...@@ -488,7 +529,7 @@ Abc_Ntk_t * Abc_NtkMiterForCofactors( Abc_Ntk_t * pNtk, int Out, int In1, int In ...@@ -488,7 +529,7 @@ Abc_Ntk_t * Abc_NtkMiterForCofactors( Abc_Ntk_t * pNtk, int Out, int In1, int In
pRoot = Abc_NtkCo( pNtk, Out ); pRoot = Abc_NtkCo( pNtk, Out );
// perform strashing // perform strashing
Abc_NtkMiterPrepare( pNtk, pNtk, pNtkMiter, 1, -1 ); Abc_NtkMiterPrepare( pNtk, pNtk, pNtkMiter, 1, -1, 0 );
// set the first cofactor // set the first cofactor
Abc_NtkCi(pNtk, In1)->pCopy = Abc_ObjNot( Abc_AigConst1(pNtkMiter) ); Abc_NtkCi(pNtk, In1)->pCopy = Abc_ObjNot( Abc_AigConst1(pNtkMiter) );
if ( In2 >= 0 ) if ( In2 >= 0 )
...@@ -553,7 +594,7 @@ Abc_Ntk_t * Abc_NtkMiterQuantify( Abc_Ntk_t * pNtk, int In, int fExist ) ...@@ -553,7 +594,7 @@ Abc_Ntk_t * Abc_NtkMiterQuantify( Abc_Ntk_t * pNtk, int In, int fExist )
pRoot = Abc_NtkCo( pNtk, 0 ); pRoot = Abc_NtkCo( pNtk, 0 );
// perform strashing // perform strashing
Abc_NtkMiterPrepare( pNtk, pNtk, pNtkMiter, 1, -1 ); Abc_NtkMiterPrepare( pNtk, pNtk, pNtkMiter, 1, -1, 0 );
// set the first cofactor // set the first cofactor
Abc_NtkCi(pNtk, In)->pCopy = Abc_ObjNot( Abc_AigConst1(pNtkMiter) ); Abc_NtkCi(pNtk, In)->pCopy = Abc_ObjNot( Abc_AigConst1(pNtkMiter) );
// add the first cofactor // add the first cofactor
......
...@@ -354,7 +354,7 @@ int Abc_NtkRRProve( Abc_RRMan_t * p ) ...@@ -354,7 +354,7 @@ int Abc_NtkRRProve( Abc_RRMan_t * p )
Abc_NtkRRUpdate( pWndCopy, p->pNode->pCopy->pCopy, p->pFanin->pCopy->pCopy, p->pFanout? p->pFanout->pCopy->pCopy : NULL ); Abc_NtkRRUpdate( pWndCopy, p->pNode->pCopy->pCopy, p->pFanin->pCopy->pCopy, p->pFanout? p->pFanout->pCopy->pCopy : NULL );
if ( !Abc_NtkIsDfsOrdered(pWndCopy) ) if ( !Abc_NtkIsDfsOrdered(pWndCopy) )
Abc_NtkReassignIds(pWndCopy); Abc_NtkReassignIds(pWndCopy);
p->pMiter = Abc_NtkMiter( p->pWnd, pWndCopy, 1, 0, 0 ); p->pMiter = Abc_NtkMiter( p->pWnd, pWndCopy, 1, 0, 0, 0 );
Abc_NtkDelete( pWndCopy ); Abc_NtkDelete( pWndCopy );
clk = clock(); clk = clock();
RetValue = Abc_NtkMiterProve( &p->pMiter, p->pParams ); RetValue = Abc_NtkMiterProve( &p->pMiter, p->pParams );
......
...@@ -52,7 +52,7 @@ void Abc_NtkCecSat( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nConfLimit, int nI ...@@ -52,7 +52,7 @@ void Abc_NtkCecSat( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nConfLimit, int nI
int RetValue; int RetValue;
// get the miter of the two networks // get the miter of the two networks
pMiter = Abc_NtkMiter( pNtk1, pNtk2, 1, 0, 0 ); pMiter = Abc_NtkMiter( pNtk1, pNtk2, 1, 0, 0, 0 );
if ( pMiter == NULL ) if ( pMiter == NULL )
{ {
printf( "Miter computation has failed.\n" ); printf( "Miter computation has failed.\n" );
...@@ -120,7 +120,7 @@ void Abc_NtkCecFraig( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nSeconds, int fV ...@@ -120,7 +120,7 @@ void Abc_NtkCecFraig( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nSeconds, int fV
int RetValue; int RetValue;
// get the miter of the two networks // get the miter of the two networks
pMiter = Abc_NtkMiter( pNtk1, pNtk2, 1, 0, 0 ); pMiter = Abc_NtkMiter( pNtk1, pNtk2, 1, 0, 0, 0 );
if ( pMiter == NULL ) if ( pMiter == NULL )
{ {
printf( "Miter computation has failed.\n" ); printf( "Miter computation has failed.\n" );
...@@ -225,7 +225,7 @@ void Abc_NtkCecFraigPart( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nSeconds, in ...@@ -225,7 +225,7 @@ void Abc_NtkCecFraigPart( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nSeconds, in
assert( nPartSize > 0 ); assert( nPartSize > 0 );
// get the miter of the two networks // get the miter of the two networks
pMiter = Abc_NtkMiter( pNtk1, pNtk2, 1, nPartSize, 0 ); pMiter = Abc_NtkMiter( pNtk1, pNtk2, 1, nPartSize, 0, 0 );
if ( pMiter == NULL ) if ( pMiter == NULL )
{ {
printf( "Miter computation has failed.\n" ); printf( "Miter computation has failed.\n" );
...@@ -342,7 +342,7 @@ void Abc_NtkCecFraigPartAuto( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nSeconds ...@@ -342,7 +342,7 @@ void Abc_NtkCecFraigPartAuto( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nSeconds
// pParams->fVerbose = 1; // pParams->fVerbose = 1;
// get the miter of the two networks // get the miter of the two networks
pMiter = Abc_NtkMiter( pNtk1, pNtk2, 1, 1, 0 ); pMiter = Abc_NtkMiter( pNtk1, pNtk2, 1, 1, 0, 0 );
if ( pMiter == NULL ) if ( pMiter == NULL )
{ {
printf( "Miter computation has failed.\n" ); printf( "Miter computation has failed.\n" );
...@@ -457,7 +457,7 @@ void Abc_NtkSecSat( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nConfLimit, int nI ...@@ -457,7 +457,7 @@ void Abc_NtkSecSat( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nConfLimit, int nI
int RetValue; int RetValue;
// get the miter of the two networks // get the miter of the two networks
pMiter = Abc_NtkMiter( pNtk1, pNtk2, 0, 0, 0 ); pMiter = Abc_NtkMiter( pNtk1, pNtk2, 0, 0, 0, 0 );
if ( pMiter == NULL ) if ( pMiter == NULL )
{ {
printf( "Miter computation has failed.\n" ); printf( "Miter computation has failed.\n" );
...@@ -539,7 +539,7 @@ int Abc_NtkSecFraig( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nSeconds, int nFr ...@@ -539,7 +539,7 @@ int Abc_NtkSecFraig( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nSeconds, int nFr
int RetValue; int RetValue;
// get the miter of the two networks // get the miter of the two networks
pMiter = Abc_NtkMiter( pNtk1, pNtk2, 0, 0, 0 ); pMiter = Abc_NtkMiter( pNtk1, pNtk2, 0, 0, 0, 0 );
if ( pMiter == NULL ) if ( pMiter == NULL )
{ {
printf( "Miter computation has failed.\n" ); printf( "Miter computation has failed.\n" );
......
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