ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
hopCheck.c
Go to the documentation of this file.
1
20
21#include "hop.h"
22
24
25
29
33
46{
47 Hop_Obj_t * pObj, * pObj2;
48 int i;
49 // check primary inputs
50 Hop_ManForEachPi( p, pObj, i )
51 {
52 if ( Hop_ObjFanin0(pObj) || Hop_ObjFanin1(pObj) )
53 {
54 printf( "Hop_ManCheck: The PI node \"%p\" has fanins.\n", pObj );
55 return 0;
56 }
57 }
58 // check primary outputs
59 Hop_ManForEachPo( p, pObj, i )
60 {
61 if ( !Hop_ObjFanin0(pObj) )
62 {
63 printf( "Hop_ManCheck: The PO node \"%p\" has NULL fanin.\n", pObj );
64 return 0;
65 }
66 if ( Hop_ObjFanin1(pObj) )
67 {
68 printf( "Hop_ManCheck: The PO node \"%p\" has second fanin.\n", pObj );
69 return 0;
70 }
71 }
72 // check internal nodes
73 Hop_ManForEachNode( p, pObj, i )
74 {
75 if ( !Hop_ObjFanin0(pObj) || !Hop_ObjFanin1(pObj) )
76 {
77 printf( "Hop_ManCheck: The AIG has internal node \"%p\" with a NULL fanin.\n", pObj );
78 return 0;
79 }
80 if ( Hop_ObjFanin0(pObj)->Id >= Hop_ObjFanin1(pObj)->Id )
81 {
82 printf( "Hop_ManCheck: The AIG has node \"%p\" with a wrong ordering of fanins.\n", pObj );
83 return 0;
84 }
85 pObj2 = Hop_TableLookup( p, pObj );
86 if ( pObj2 != pObj )
87 {
88 printf( "Hop_ManCheck: Node \"%p\" is not in the structural hashing table.\n", pObj );
89 return 0;
90 }
91 }
92 // count the total number of nodes
93 if ( Hop_ManObjNum(p) != 1 + Hop_ManPiNum(p) + Hop_ManPoNum(p) + Hop_ManAndNum(p) + Hop_ManExorNum(p) )
94 {
95 printf( "Hop_ManCheck: The number of created nodes is wrong.\n" );
96 return 0;
97 }
98 // count the number of nodes in the table
99 if ( Hop_TableCountEntries(p) != Hop_ManAndNum(p) + Hop_ManExorNum(p) )
100 {
101 printf( "Hop_ManCheck: The number of nodes in the structural hashing table is wrong.\n" );
102 return 0;
103 }
104// if ( !Hop_ManIsAcyclic(p) )
105// return 0;
106 return 1;
107}
108
112
113
115
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
Cube * p
Definition exorList.c:222
ABC_NAMESPACE_IMPL_START int Hop_ManCheck(Hop_Man_t *p)
DECLARATIONS ///.
Definition hopCheck.c:45
int Hop_TableCountEntries(Hop_Man_t *p)
Definition hopTable.c:145
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition hop.h:49
#define Hop_ManForEachPi(p, pObj, i)
ITERATORS ///.
Definition hop.h:259
#define Hop_ManForEachNode(p, pObj, i)
Definition hop.h:265
Hop_Obj_t * Hop_TableLookup(Hop_Man_t *p, Hop_Obj_t *pGhost)
FUNCTION DEFINITIONS ///.
Definition hopTable.c:71
#define Hop_ManForEachPo(p, pObj, i)
Definition hop.h:262
struct Hop_Obj_t_ Hop_Obj_t
Definition hop.h:50