#include "hop.h"
Go to the source code of this file.
Functions | |
int | Hop_ManCheck (Hop_Man_t *p) |
int Hop_ManCheck | ( | Hop_Man_t * | p | ) |
CFile****************************************************************
FileName [hopCheck.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Minimalistic And-Inverter Graph package.]
Synopsis [AIG checking procedures.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - May 11, 2006.]
Revision [
] DECLARATIONS /// FUNCTION DEFINITIONS ///Function*************************************************************
Synopsis [Checks the consistency of the AIG manager.]
Description []
SideEffects []
SeeAlso []
Definition at line 42 of file hopCheck.c.
00043 { 00044 Hop_Obj_t * pObj, * pObj2; 00045 int i; 00046 // check primary inputs 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 // check primary outputs 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 // check internal nodes 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 // count the total number of nodes 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 // count the number of nodes in the table 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 // if ( !Hop_ManIsAcyclic(p) ) 00102 // return 0; 00103 return 1; 00104 }