00001
00021 #include "aig.h"
00022
00026
00030
00042 unsigned * Aig_ManCutTruthOne( Aig_Obj_t * pNode, unsigned * pTruth, int nWords )
00043 {
00044 unsigned * pTruth0, * pTruth1;
00045 int i;
00046 pTruth0 = Aig_ObjFanin0(pNode)->pData;
00047 pTruth1 = Aig_ObjFanin1(pNode)->pData;
00048 if ( Aig_ObjIsExor(pNode) )
00049 for ( i = 0; i < nWords; i++ )
00050 pTruth[i] = pTruth0[i] ^ pTruth1[i];
00051 else if ( !Aig_ObjFaninC0(pNode) && !Aig_ObjFaninC1(pNode) )
00052 for ( i = 0; i < nWords; i++ )
00053 pTruth[i] = pTruth0[i] & pTruth1[i];
00054 else if ( !Aig_ObjFaninC0(pNode) && Aig_ObjFaninC1(pNode) )
00055 for ( i = 0; i < nWords; i++ )
00056 pTruth[i] = pTruth0[i] & ~pTruth1[i];
00057 else if ( Aig_ObjFaninC0(pNode) && !Aig_ObjFaninC1(pNode) )
00058 for ( i = 0; i < nWords; i++ )
00059 pTruth[i] = ~pTruth0[i] & pTruth1[i];
00060 else
00061 for ( i = 0; i < nWords; i++ )
00062 pTruth[i] = ~pTruth0[i] & ~pTruth1[i];
00063 return pTruth;
00064 }
00065
00077 unsigned * Aig_ManCutTruth( Aig_Obj_t * pRoot, Vec_Ptr_t * vLeaves, Vec_Ptr_t * vNodes, Vec_Ptr_t * vTruthElem, Vec_Ptr_t * vTruthStore )
00078 {
00079 Aig_Obj_t * pObj;
00080 int i, nWords;
00081 assert( Vec_PtrSize(vLeaves) <= Vec_PtrSize(vTruthElem) );
00082 assert( Vec_PtrSize(vNodes) <= Vec_PtrSize(vTruthStore) );
00083 assert( Vec_PtrSize(vNodes) == 0 || pRoot == Vec_PtrEntryLast(vNodes) );
00084
00085 Vec_PtrForEachEntry( vLeaves, pObj, i )
00086 pObj->pData = Vec_PtrEntry( vTruthElem, i );
00087
00088 nWords = Aig_TruthWordNum( Vec_PtrSize(vLeaves) );
00089 Vec_PtrForEachEntry( vNodes, pObj, i )
00090 pObj->pData = Aig_ManCutTruthOne( pObj, Vec_PtrEntry(vTruthStore, i), nWords );
00091 return pRoot->pData;
00092 }
00093
00097
00098