mirror of https://github.com/YosysHQ/abc.git
Making sure the CI/CO are not ordered by 'fraig_restore'.
This commit is contained in:
parent
b4d0abb77d
commit
819c0ccab2
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -364,6 +353,102 @@ void Abc_NtkOrderObjsByName( Abc_Ntk_t * pNtk, int fComb )
|
|||
pObj->pCopy = NULL;
|
||||
}
|
||||
|
||||
/**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.]
|
||||
|
|
|
|||
|
|
@ -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) )
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
Loading…
Reference in New Issue