summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/base/abc/abcFunc.c6
-rw-r--r--src/base/abc/abcNames.c111
-rw-r--r--src/base/abci/abc.c14
-rw-r--r--src/base/abci/abcFraig.c14
4 files changed, 120 insertions, 25 deletions
diff --git a/src/base/abc/abcFunc.c b/src/base/abc/abcFunc.c
index 500be62a..b0862074 100644
--- a/src/base/abc/abcFunc.c
+++ b/src/base/abc/abcFunc.c
@@ -408,6 +408,12 @@ int Abc_NtkBddToSop( Abc_Ntk_t * pNtk, int fMode, int nCubeLimit )
Vec_StrFree( vCube );
return 0;
}
+ if ( Abc_ObjFaninNum(pNode) != Abc_SopGetVarNum((char *)pNode->pNext) )
+ {
+ printf( "Node %d with level %d has %d fanins but its SOP has support size %d.\n",
+ pNode->Id, pNode->Level, Abc_ObjFaninNum(pNode), Abc_SopGetVarNum((char *)pNode->pNext) );
+ fflush( stdout );
+ }
assert( Abc_ObjFaninNum(pNode) == Abc_SopGetVarNum((char *)pNode->pNext) );
}
Vec_IntFree( vGuide );
diff --git a/src/base/abc/abcNames.c b/src/base/abc/abcNames.c
index 636b1b95..27bd924a 100644
--- a/src/base/abc/abcNames.c
+++ b/src/base/abc/abcNames.c
@@ -19,6 +19,7 @@
***********************************************************************/
#include "abc.h"
+#include "misc/util/utilNam.h"
ABC_NAMESPACE_IMPL_START
@@ -297,7 +298,7 @@ char ** Abc_NtkCollectCioNames( Abc_Ntk_t * pNtk, int fCollectCos )
/**Function*************************************************************
- Synopsis [Procedure used for sorting the nodes in decreasing order of levels.]
+ Synopsis [Orders PIs/POs/latches alphabetically.]
Description []
@@ -320,18 +321,6 @@ int Abc_NodeCompareNames( Abc_Obj_t ** pp1, Abc_Obj_t ** pp2 )
return 1;
return 0;
}
-
-/**Function*************************************************************
-
- Synopsis [Orders PIs/POs/latches alphabetically.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
void Abc_NtkOrderObjsByName( Abc_Ntk_t * pNtk, int fComb )
{
Abc_Obj_t * pObj;
@@ -366,6 +355,102 @@ void Abc_NtkOrderObjsByName( Abc_Ntk_t * pNtk, int fComb )
/**Function*************************************************************
+ Synopsis [Orders PIs/POs/latches alphabetically.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+int Abc_NodeCompareIndexes( Abc_Obj_t ** pp1, Abc_Obj_t ** pp2 )
+{
+ int Diff = (*pp1)->iTemp - (*pp2)->iTemp;
+ if ( Diff < 0 )
+ return -1;
+ if ( Diff > 0 )
+ return 1;
+ return 0;
+}
+void Abc_NtkTransferOrder( Abc_Ntk_t * pNtkOld, Abc_Ntk_t * pNtkNew )
+{
+ Abc_Obj_t * pObj; int i;
+ Abc_Nam_t * pStrsCi = Abc_NamStart( Abc_NtkCiNum(pNtkOld), 24 );
+ Abc_Nam_t * pStrsCo = Abc_NamStart( Abc_NtkCoNum(pNtkOld), 24 );
+ assert( Abc_NtkPiNum(pNtkOld) == Abc_NtkPiNum(pNtkNew) );
+ assert( Abc_NtkPoNum(pNtkOld) == Abc_NtkPoNum(pNtkNew) );
+ assert( Abc_NtkLatchNum(pNtkOld) == Abc_NtkLatchNum(pNtkNew) );
+ // save IDs of the names
+ Abc_NtkForEachCi( pNtkOld, pObj, i )
+ Abc_NamStrFindOrAdd( pStrsCi, Abc_ObjName(pObj), NULL );
+ assert( Abc_NamObjNumMax(pStrsCi) == i + 1 );
+ Abc_NtkForEachCo( pNtkOld, pObj, i )
+ Abc_NamStrFindOrAdd( pStrsCo, Abc_ObjName(pObj), NULL );
+ assert( Abc_NamObjNumMax(pStrsCo) == i + 1 );
+ // transfer to the new network
+ Abc_NtkForEachCi( pNtkNew, pObj, i )
+ {
+ pObj->iTemp = Abc_NamStrFind(pStrsCi, Abc_ObjName(pObj));
+ assert( pObj->iTemp > 0 && pObj->iTemp <= Abc_NtkCiNum(pNtkNew) );
+ }
+ Abc_NtkForEachCo( pNtkNew, pObj, i )
+ {
+ pObj->iTemp = Abc_NamStrFind(pStrsCo, Abc_ObjName(pObj));
+ assert( pObj->iTemp > 0 && pObj->iTemp <= Abc_NtkCoNum(pNtkNew) );
+ }
+ Abc_NamDeref( pStrsCi );
+ Abc_NamDeref( pStrsCo );
+ // order PI/PO
+ qsort( (void *)Vec_PtrArray(pNtkNew->vPis), Vec_PtrSize(pNtkNew->vPis), sizeof(Abc_Obj_t *),
+ (int (*)(const void *, const void *)) Abc_NodeCompareIndexes );
+ qsort( (void *)Vec_PtrArray(pNtkNew->vPos), Vec_PtrSize(pNtkNew->vPos), sizeof(Abc_Obj_t *),
+ (int (*)(const void *, const void *)) Abc_NodeCompareIndexes );
+ // order CI/CO
+ qsort( (void *)Vec_PtrArray(pNtkNew->vCis), Vec_PtrSize(pNtkNew->vCis), sizeof(Abc_Obj_t *),
+ (int (*)(const void *, const void *)) Abc_NodeCompareIndexes );
+ qsort( (void *)Vec_PtrArray(pNtkNew->vCos), Vec_PtrSize(pNtkNew->vCos), sizeof(Abc_Obj_t *),
+ (int (*)(const void *, const void *)) Abc_NodeCompareIndexes );
+ // order CIs/COs first PIs/POs(Asserts) then latches
+ //Abc_NtkOrderCisCos( pNtk );
+ // clean the copy fields
+ Abc_NtkForEachCi( pNtkNew, pObj, i )
+ pObj->iTemp = 0;
+ Abc_NtkForEachCo( pNtkNew, pObj, i )
+ pObj->iTemp = 0;
+}
+
+/**Function*************************************************************
+
+ Synopsis [Checks that the order and number of CI/CO is the same.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+int Abc_NodeCompareCiCo( Abc_Ntk_t * pNtkOld, Abc_Ntk_t * pNtkNew )
+{
+ int i;
+ if ( Abc_NtkPiNum(pNtkOld) != Abc_NtkPiNum(pNtkNew) )
+ return 0;
+ if ( Abc_NtkPoNum(pNtkOld) != Abc_NtkPoNum(pNtkNew) )
+ return 0;
+ if ( Abc_NtkLatchNum(pNtkOld) != Abc_NtkLatchNum(pNtkNew) )
+ return 0;
+ for ( i = 0; i < Abc_NtkCiNum(pNtkOld); i++ )
+ if ( strcmp(Abc_ObjName(Abc_NtkCi(pNtkOld, i)), Abc_ObjName(Abc_NtkCi(pNtkNew, i))) )
+ return 0;
+ for ( i = 0; i < Abc_NtkCoNum(pNtkOld); i++ )
+ if ( strcmp(Abc_ObjName(Abc_NtkCo(pNtkOld, i)), Abc_ObjName(Abc_NtkCo(pNtkNew, i))) )
+ return 0;
+ return 1;
+}
+
+/**Function*************************************************************
+
Synopsis [Adds dummy names.]
Description []
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c
index c6e252a0..0cd325ab 100644
--- a/src/base/abci/abc.c
+++ b/src/base/abci/abc.c
@@ -16751,7 +16751,7 @@ int Abc_CommandInit( Abc_Frame_t * pAbc, int argc, char ** argv )
if ( Abc_NtkIsComb(pNtk) )
{
- Abc_Print( -1, "The current network is combinational.\n" );
+ Abc_Print( 0, "The current network is combinational.\n" );
return 0;
}
@@ -16882,7 +16882,7 @@ int Abc_CommandZero( Abc_Frame_t * pAbc, int argc, char ** argv )
if ( Abc_NtkIsComb(pNtk) )
{
- Abc_Print( -1, "The current network is combinational.\n" );
+ Abc_Print( 0, "The current network is combinational.\n" );
return 0;
}
@@ -16978,7 +16978,7 @@ int Abc_CommandUndc( Abc_Frame_t * pAbc, int argc, char ** argv )
if ( Abc_NtkIsComb(pNtk) )
{
- Abc_Print( -1, "The current network is combinational.\n" );
+ Abc_Print( 0, "The current network is combinational.\n" );
return 0;
}
@@ -17037,7 +17037,7 @@ int Abc_CommandOneHot( Abc_Frame_t * pAbc, int argc, char ** argv )
}
if ( Abc_NtkIsComb(pNtk) )
{
- Abc_Print( -1, "The current network is combinational.\n" );
+ Abc_Print( 0, "The current network is combinational.\n" );
return 0;
}
if ( !Abc_NtkIsLogic(pNtk) )
@@ -17113,7 +17113,7 @@ int Abc_CommandPipe( Abc_Frame_t * pAbc, int argc, char ** argv )
if ( Abc_NtkIsComb(pNtk) )
{
- Abc_Print( -1, "The current network is combinational.\n" );
+ Abc_Print( 0, "The current network is combinational.\n" );
return 0;
}
@@ -23404,7 +23404,7 @@ int Abc_CommandTempor( Abc_Frame_t * pAbc, int argc, char ** argv )
}
if ( Abc_NtkLatchNum(pNtk) == 0 )
{
- Abc_Print( -2, "The current network is combinational.\n");
+ Abc_Print( 0, "The current network is combinational.\n");
return 0;
}
if ( fUpdateCex )
@@ -24602,7 +24602,7 @@ int Abc_CommandPdr( Abc_Frame_t * pAbc, int argc, char ** argv )
}
if ( Abc_NtkLatchNum(pNtk) == 0 )
{
- Abc_Print( -2, "The current network is combinational.\n");
+ Abc_Print( 0, "The current network is combinational.\n");
return 0;
}
if ( !Abc_NtkIsStrash(pNtk) )
diff --git a/src/base/abci/abcFraig.c b/src/base/abci/abcFraig.c
index cbb675a3..2cfb46bb 100644
--- a/src/base/abci/abcFraig.c
+++ b/src/base/abci/abcFraig.c
@@ -667,12 +667,16 @@ int Abc_NtkFraigStore( Abc_Ntk_t * pNtkAdd )
if ( Vec_PtrSize(vStore) > 0 )
{
// check that the networks have the same PIs
- // reorder PIs of pNtk2 according to pNtk1
- if ( !Abc_NtkCompareSignals( pNtk, (Abc_Ntk_t *)Vec_PtrEntry(vStore, 0), 1, 1 ) )
+ extern int Abc_NodeCompareCiCo( Abc_Ntk_t * pNtkOld, Abc_Ntk_t * pNtkNew );
+ if ( !Abc_NodeCompareCiCo(pNtk, (Abc_Ntk_t *)Vec_PtrEntry(vStore, 0)) )
{
- printf( "Trying to store the network with different primary inputs.\n" );
- printf( "The previously stored networks are deleted and this one is added.\n" );
- Abc_NtkFraigStoreClean();
+ // reorder PIs of pNtk2 according to pNtk1
+ if ( !Abc_NtkCompareSignals( pNtk, (Abc_Ntk_t *)Vec_PtrEntry(vStore, 0), 1, 1 ) )
+ {
+ printf( "Trying to store the network with different primary inputs.\n" );
+ printf( "The previously stored networks are deleted and this one is added.\n" );
+ Abc_NtkFraigStoreClean();
+ }
}
}
Vec_PtrPush( vStore, pNtk );