abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
aigTruth.c File Reference
#include "aig.h"

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START unsigned * Aig_ManCutTruthOne (Aig_Obj_t *pNode, unsigned *pTruth, int nWords)
 DECLARATIONS ///. More...
 
unsigned * Aig_ManCutTruth (Aig_Obj_t *pRoot, Vec_Ptr_t *vLeaves, Vec_Ptr_t *vNodes, Vec_Ptr_t *vTruthElem, Vec_Ptr_t *vTruthStore)
 

Function Documentation

unsigned* Aig_ManCutTruth ( Aig_Obj_t pRoot,
Vec_Ptr_t vLeaves,
Vec_Ptr_t vNodes,
Vec_Ptr_t vTruthElem,
Vec_Ptr_t vTruthStore 
)

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

Synopsis [Computes truth table of the cut.]

Description [The returned pointer should be used immediately.]

SideEffects []

SeeAlso []

Definition at line 80 of file aigTruth.c.

81 {
82  Aig_Obj_t * pObj;
83  int i, nWords;
84  assert( Vec_PtrSize(vLeaves) <= Vec_PtrSize(vTruthElem) );
85  assert( Vec_PtrSize(vNodes) <= Vec_PtrSize(vTruthStore) );
86  assert( Vec_PtrSize(vNodes) == 0 || pRoot == Vec_PtrEntryLast(vNodes) );
87  // assign elementary truth tables
88  Vec_PtrForEachEntry( Aig_Obj_t *, vLeaves, pObj, i )
89  pObj->pData = Vec_PtrEntry( vTruthElem, i );
90  // compute truths for other nodes
91  nWords = Abc_TruthWordNum( Vec_PtrSize(vLeaves) );
92  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
93  pObj->pData = Aig_ManCutTruthOne( pObj, (unsigned *)Vec_PtrEntry(vTruthStore, i), nWords );
94  return (unsigned *)pRoot->pData;
95 }
static int Abc_TruthWordNum(int nVars)
Definition: abc_global.h:256
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int nWords
Definition: abcNpn.c:127
ABC_NAMESPACE_IMPL_START unsigned * Aig_ManCutTruthOne(Aig_Obj_t *pNode, unsigned *pTruth, int nWords)
DECLARATIONS ///.
Definition: aigTruth.c:45
static void * Vec_PtrEntryLast(Vec_Ptr_t *p)
Definition: vecPtr.h:413
Definition: aig.h:69
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_NAMESPACE_IMPL_START unsigned* Aig_ManCutTruthOne ( Aig_Obj_t pNode,
unsigned *  pTruth,
int  nWords 
)

DECLARATIONS ///.

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

FileName [aigTruth.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [AIG package.]

Synopsis [Computes truth table for the cut.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Computes truth table of the cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file aigTruth.c.

46 {
47  unsigned * pTruth0, * pTruth1;
48  int i;
49  pTruth0 = (unsigned *)Aig_ObjFanin0(pNode)->pData;
50  pTruth1 = (unsigned *)Aig_ObjFanin1(pNode)->pData;
51  if ( Aig_ObjIsExor(pNode) )
52  for ( i = 0; i < nWords; i++ )
53  pTruth[i] = pTruth0[i] ^ pTruth1[i];
54  else if ( !Aig_ObjFaninC0(pNode) && !Aig_ObjFaninC1(pNode) )
55  for ( i = 0; i < nWords; i++ )
56  pTruth[i] = pTruth0[i] & pTruth1[i];
57  else if ( !Aig_ObjFaninC0(pNode) && Aig_ObjFaninC1(pNode) )
58  for ( i = 0; i < nWords; i++ )
59  pTruth[i] = pTruth0[i] & ~pTruth1[i];
60  else if ( Aig_ObjFaninC0(pNode) && !Aig_ObjFaninC1(pNode) )
61  for ( i = 0; i < nWords; i++ )
62  pTruth[i] = ~pTruth0[i] & pTruth1[i];
63  else // if ( Aig_ObjFaninC0(pNode) && Aig_ObjFaninC1(pNode) )
64  for ( i = 0; i < nWords; i++ )
65  pTruth[i] = ~pTruth0[i] & ~pTruth1[i];
66  return pTruth;
67 }
void * pData
Definition: aig.h:87
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
int nWords
Definition: abcNpn.c:127
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static int Aig_ObjIsExor(Aig_Obj_t *pObj)
Definition: aig.h:279
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307