src/aig/aig/aigCheck.c File Reference

#include "aig.h"
Include dependency graph for aigCheck.c:

Go to the source code of this file.

Functions

int Aig_ManCheck (Aig_Man_t *p)
void Aig_ManCheckMarkA (Aig_Man_t *p)
void Aig_ManCheckPhase (Aig_Man_t *p)

Function Documentation

int Aig_ManCheck ( Aig_Man_t p  ) 

CFile****************************************************************

FileName [aigCheck.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [AIG package.]

Synopsis [AIG checking procedures.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - April 28, 2007.]

Revision [

Id
aigCheck.c,v 1.00 2007/04/28 00:00:00 alanmi Exp

] DECLARATIONS /// FUNCTION DEFINITIONS ///Function*************************************************************

Synopsis [Checks the consistency of the AIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 42 of file aigCheck.c.

00043 {
00044     Aig_Obj_t * pObj, * pObj2;
00045     int i;
00046     // check primary inputs
00047     Aig_ManForEachPi( p, pObj, i )
00048     {
00049         if ( Aig_ObjFanin0(pObj) || Aig_ObjFanin1(pObj) )
00050         {
00051             printf( "Aig_ManCheck: The PI node \"%p\" has fanins.\n", pObj );
00052             return 0;
00053         }
00054     }
00055     // check primary outputs
00056     Aig_ManForEachPo( p, pObj, i )
00057     {
00058         if ( !Aig_ObjFanin0(pObj) )
00059         {
00060             printf( "Aig_ManCheck: The PO node \"%p\" has NULL fanin.\n", pObj );
00061             return 0;
00062         }
00063         if ( Aig_ObjFanin1(pObj) )
00064         {
00065             printf( "Aig_ManCheck: The PO node \"%p\" has second fanin.\n", pObj );
00066             return 0;
00067         }
00068     }
00069     // check internal nodes
00070     Aig_ManForEachObj( p, pObj, i )
00071     {
00072         if ( !Aig_ObjIsNode(pObj) )
00073             continue;
00074         if ( !Aig_ObjFanin0(pObj) || !Aig_ObjFanin1(pObj) )
00075         {
00076             printf( "Aig_ManCheck: The AIG has internal node \"%p\" with a NULL fanin.\n", pObj );
00077             return 0;
00078         }
00079         if ( Aig_ObjFanin0(pObj)->Id >= Aig_ObjFanin1(pObj)->Id )
00080         {
00081             printf( "Aig_ManCheck: The AIG has node \"%p\" with a wrong ordering of fanins.\n", pObj );
00082             return 0;
00083         }
00084         pObj2 = Aig_TableLookup( p, pObj );
00085         if ( pObj2 != pObj )
00086         {
00087             printf( "Aig_ManCheck: Node \"%p\" is not in the structural hashing table.\n", pObj );
00088             return 0;
00089         }
00090     }
00091     // count the total number of nodes
00092     if ( Aig_ManObjNum(p) != 1 + Aig_ManPiNum(p) + Aig_ManPoNum(p) + 
00093         Aig_ManBufNum(p) + Aig_ManAndNum(p) + Aig_ManExorNum(p) + Aig_ManLatchNum(p) )
00094     {
00095         printf( "Aig_ManCheck: The number of created nodes is wrong.\n" );
00096         printf( "C1 = %d. Pi = %d. Po = %d. Buf = %d. And = %d. Xor = %d. Lat = %d. Total = %d.\n",
00097             1, Aig_ManPiNum(p), Aig_ManPoNum(p), Aig_ManBufNum(p), Aig_ManAndNum(p), Aig_ManExorNum(p), Aig_ManLatchNum(p), 
00098             1 + Aig_ManPiNum(p) + Aig_ManPoNum(p) + Aig_ManBufNum(p) + Aig_ManAndNum(p) + Aig_ManExorNum(p) + Aig_ManLatchNum(p) );
00099         printf( "Created = %d. Deleted = %d. Existing = %d.\n",
00100             p->nCreated, p->nDeleted, p->nCreated - p->nDeleted );
00101         return 0;
00102     }
00103     // count the number of nodes in the table
00104     if ( Aig_TableCountEntries(p) != Aig_ManAndNum(p) + Aig_ManExorNum(p) + Aig_ManLatchNum(p) )
00105     {
00106         printf( "Aig_ManCheck: The number of nodes in the structural hashing table is wrong.\n" );
00107         printf( "Entries = %d. And = %d. Xor = %d. Lat = %d. Total = %d.\n", 
00108             Aig_TableCountEntries(p), Aig_ManAndNum(p), Aig_ManExorNum(p), Aig_ManLatchNum(p),
00109             Aig_ManAndNum(p) + Aig_ManExorNum(p) + Aig_ManLatchNum(p) );
00110 
00111         return 0;
00112     }
00113 //    if ( !Aig_ManIsAcyclic(p) )
00114 //        return 0;
00115     return 1; 
00116 }

void Aig_ManCheckMarkA ( Aig_Man_t p  ) 

Function*************************************************************

Synopsis [Checks if the markA is reset.]

Description []

SideEffects []

SeeAlso []

Definition at line 129 of file aigCheck.c.

00130 {
00131     Aig_Obj_t * pObj;
00132     int i;
00133     Aig_ManForEachObj( p, pObj, i )
00134         assert( pObj->fMarkA == 0 );
00135 }

void Aig_ManCheckPhase ( Aig_Man_t p  ) 

Function*************************************************************

Synopsis [Checks the consistency of phase assignment.]

Description []

SideEffects []

SeeAlso []

Definition at line 148 of file aigCheck.c.

00149 {
00150     Aig_Obj_t * pObj;
00151     int i;
00152     Aig_ManForEachObj( p, pObj, i )
00153         if ( Aig_ObjIsPi(pObj) )
00154             assert( (int)pObj->fPhase == 0 );
00155         else
00156             assert( (int)pObj->fPhase == (Aig_ObjPhaseReal(Aig_ObjChild0(pObj)) & Aig_ObjPhaseReal(Aig_ObjChild1(pObj))) );
00157 }


Generated on Tue Jan 5 12:18:11 2010 for abc70930 by  doxygen 1.6.1