00001
00021 #include "hop.h"
00022
00026
00030
00042 int Hop_ManCheck( Hop_Man_t * p )
00043 {
00044 Hop_Obj_t * pObj, * pObj2;
00045 int i;
00046
00047 Hop_ManForEachPi( p, pObj, i )
00048 {
00049 if ( Hop_ObjFanin0(pObj) || Hop_ObjFanin1(pObj) )
00050 {
00051 printf( "Hop_ManCheck: The PI node \"%p\" has fanins.\n", pObj );
00052 return 0;
00053 }
00054 }
00055
00056 Hop_ManForEachPo( p, pObj, i )
00057 {
00058 if ( !Hop_ObjFanin0(pObj) )
00059 {
00060 printf( "Hop_ManCheck: The PO node \"%p\" has NULL fanin.\n", pObj );
00061 return 0;
00062 }
00063 if ( Hop_ObjFanin1(pObj) )
00064 {
00065 printf( "Hop_ManCheck: The PO node \"%p\" has second fanin.\n", pObj );
00066 return 0;
00067 }
00068 }
00069
00070 Hop_ManForEachNode( p, pObj, i )
00071 {
00072 if ( !Hop_ObjFanin0(pObj) || !Hop_ObjFanin1(pObj) )
00073 {
00074 printf( "Hop_ManCheck: The AIG has internal node \"%p\" with a NULL fanin.\n", pObj );
00075 return 0;
00076 }
00077 if ( Hop_ObjFanin0(pObj)->Id >= Hop_ObjFanin1(pObj)->Id )
00078 {
00079 printf( "Hop_ManCheck: The AIG has node \"%p\" with a wrong ordering of fanins.\n", pObj );
00080 return 0;
00081 }
00082 pObj2 = Hop_TableLookup( p, pObj );
00083 if ( pObj2 != pObj )
00084 {
00085 printf( "Hop_ManCheck: Node \"%p\" is not in the structural hashing table.\n", pObj );
00086 return 0;
00087 }
00088 }
00089
00090 if ( Hop_ManObjNum(p) != 1 + Hop_ManPiNum(p) + Hop_ManPoNum(p) + Hop_ManAndNum(p) + Hop_ManExorNum(p) )
00091 {
00092 printf( "Hop_ManCheck: The number of created nodes is wrong.\n" );
00093 return 0;
00094 }
00095
00096 if ( Hop_TableCountEntries(p) != Hop_ManAndNum(p) + Hop_ManExorNum(p) )
00097 {
00098 printf( "Hop_ManCheck: The number of nodes in the structural hashing table is wrong.\n" );
00099 return 0;
00100 }
00101
00102
00103 return 1;
00104 }
00105
00109
00110