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

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START void Aig_ManFindImplications_rec (Aig_Obj_t *pObj, Vec_Ptr_t *vImplics)
 DECLARATIONS ///. More...
 
Vec_Ptr_tAig_ManFindImplications (Aig_Man_t *p, Aig_Obj_t *pNode)
 
int Aig_ManFindConeOverlap_rec (Aig_Man_t *p, Aig_Obj_t *pNode)
 
int Aig_ManFindConeOverlap (Aig_Man_t *p, Vec_Ptr_t *vImplics, Aig_Obj_t *pNode)
 
Aig_Obj_tAig_ManDeriveNewCone_rec (Aig_Man_t *p, Aig_Obj_t *pNode)
 
Aig_Obj_tAig_ManDeriveNewCone (Aig_Man_t *p, Vec_Ptr_t *vImplics, Aig_Obj_t *pNode)
 
Aig_Obj_tAig_ManFactorAlgebraic_int (Aig_Man_t *p, Aig_Obj_t *pPoA, Aig_Obj_t *pPoB, int Value)
 
Aig_Obj_tAig_ManFactorAlgebraic (Aig_Man_t *p, int iPoA, int iPoB, int Value)
 
void Aig_ManFactorAlgebraicTest (Aig_Man_t *p)
 
Vec_Ptr_tAig_SuppMinPerform (Aig_Man_t *p, Vec_Ptr_t *vOrGate, Vec_Ptr_t *vNodes, Vec_Ptr_t *vSupp)
 
Aig_Obj_tAig_SuppMinReconstruct (Aig_Man_t *p, Vec_Ptr_t *vCofs, Vec_Ptr_t *vNodes, Vec_Ptr_t *vSupp)
 
int Aig_SuppMinGateIsInSupport (Aig_Man_t *p, Vec_Ptr_t *vOrGate, Vec_Ptr_t *vSupp)
 
Vec_Ptr_tAig_SuppMinCollectSupport (Aig_Man_t *p, Vec_Ptr_t *vNodes)
 
void Aig_SuppMinCollectCone_rec (Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vNodes)
 
Vec_Ptr_tAig_SuppMinCollectCone (Aig_Man_t *p, Aig_Obj_t *pRoot)
 
int Aig_SuppMinHighlightCone_rec (Aig_Man_t *p, Aig_Obj_t *pObj)
 
int Aig_SuppMinHighlightCone (Aig_Man_t *p, Aig_Obj_t *pRoot, Vec_Ptr_t *vOrGate)
 
void Aig_SuppMinCollectSuper_rec (Aig_Obj_t *pObj, Vec_Ptr_t *vSuper)
 
Vec_Ptr_tAig_SuppMinCollectSuper (Aig_Obj_t *pObj)
 
Aig_Obj_tAig_ManSupportMinimization (Aig_Man_t *p, Aig_Obj_t *pCond, Aig_Obj_t *pFunc, int *pStatus)
 
void Aig_ManSupportMinimizationTest ()
 
void Aig_ManSupportMinimizationTest2 ()
 

Function Documentation

Aig_Obj_t* Aig_ManDeriveNewCone ( Aig_Man_t p,
Vec_Ptr_t vImplics,
Aig_Obj_t pNode 
)

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

Synopsis [Returns 1 if the cone of the node overlaps with the vector.]

Description []

SideEffects []

SeeAlso []

Definition at line 163 of file aigFact.c.

164 {
165  Aig_Obj_t * pTemp;
166  int i;
167  assert( !Aig_IsComplement(pNode) );
168  assert( !Aig_ObjIsConst1(pNode) );
170  Vec_PtrForEachEntry( Aig_Obj_t *, vImplics, pTemp, i )
171  {
174  }
175  return Aig_ManDeriveNewCone_rec( p, pNode );
176 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void * pData
Definition: aig.h:87
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
Aig_Obj_t * Aig_ManDeriveNewCone_rec(Aig_Man_t *p, Aig_Obj_t *pNode)
Definition: aigFact.c:140
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
Definition: aig.h:69
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
#define assert(ex)
Definition: util_old.h:213
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
Aig_Obj_t* Aig_ManDeriveNewCone_rec ( Aig_Man_t p,
Aig_Obj_t pNode 
)

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

Synopsis [Returns 1 if the cone of the node overlaps with the vector.]

Description []

SideEffects []

SeeAlso []

Definition at line 140 of file aigFact.c.

141 {
142  if ( Aig_ObjIsTravIdCurrent( p, pNode ) )
143  return (Aig_Obj_t *)pNode->pData;
144  Aig_ObjSetTravIdCurrent( p, pNode );
145  if ( Aig_ObjIsCi(pNode) )
146  return (Aig_Obj_t *)(pNode->pData = pNode);
149  return (Aig_Obj_t *)(pNode->pData = Aig_And( p, Aig_ObjChild0Copy(pNode), Aig_ObjChild1Copy(pNode) ));
150 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
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
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
Aig_Obj_t * Aig_ManDeriveNewCone_rec(Aig_Man_t *p, Aig_Obj_t *pNode)
Definition: aigFact.c:140
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
Aig_Obj_t* Aig_ManFactorAlgebraic ( Aig_Man_t p,
int  iPoA,
int  iPoB,
int  Value 
)

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

Synopsis [Returns algebraic factoring of B in terms of A.]

Description [Returns internal node C (an AND gate) that is equal to B under assignment A = 'Value', or NULL if there is no such node C. ]

SideEffects []

SeeAlso []

Definition at line 230 of file aigFact.c.

231 {
232  assert( iPoA >= 0 && iPoA < Aig_ManCoNum(p) );
233  assert( iPoB >= 0 && iPoB < Aig_ManCoNum(p) );
234  assert( Value == 0 || Value == 1 );
235  return Aig_ManFactorAlgebraic_int( p, Aig_ManCo(p, iPoA), Aig_ManCo(p, iPoB), Value );
236 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
Aig_Obj_t * Aig_ManFactorAlgebraic_int(Aig_Man_t *p, Aig_Obj_t *pPoA, Aig_Obj_t *pPoB, int Value)
Definition: aigFact.c:190
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Definition: aig.h:267
#define assert(ex)
Definition: util_old.h:213
Aig_Obj_t* Aig_ManFactorAlgebraic_int ( Aig_Man_t p,
Aig_Obj_t pPoA,
Aig_Obj_t pPoB,
int  Value 
)

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

Synopsis [Returns algebraic factoring of B in terms of A.]

Description [Returns internal node C (an AND gate) that is equal to B under assignment A = 'Value', or NULL if there is no such node C. ]

SideEffects []

SeeAlso []

Definition at line 190 of file aigFact.c.

191 {
192  Aig_Obj_t * pNodeA, * pNodeC;
193  Vec_Ptr_t * vImplics;
194  int RetValue;
196  return NULL;
197  if ( Aig_ObjIsCi(Aig_ObjFanin0(pPoB)) )
198  return NULL;
199  // get the internal node representing function of A under assignment A = 'Value'
200  pNodeA = Aig_ObjChild0( pPoA );
201  pNodeA = Aig_NotCond( pNodeA, Value==0 );
202  // find implications of this signal (nodes whose value is fixed under assignment A = 'Value')
203  vImplics = Aig_ManFindImplications( p, pNodeA );
204  // check if the TFI cone of B overlaps with the implied nodes
205  RetValue = Aig_ManFindConeOverlap( p, vImplics, Aig_ObjFanin0(pPoB) );
206  if ( RetValue == 0 ) // no overlap
207  {
208  Vec_PtrFree( vImplics );
209  return NULL;
210  }
211  // there is overlap - derive node representing value of B under assignment A = 'Value'
212  pNodeC = Aig_ManDeriveNewCone( p, vImplics, Aig_ObjFanin0(pPoB) );
213  pNodeC = Aig_NotCond( pNodeC, Aig_ObjFaninC0(pPoB) );
214  Vec_PtrFree( vImplics );
215  return pNodeC;
216 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Aig_Obj_t * Aig_ObjChild0(Aig_Obj_t *pObj)
Definition: aig.h:310
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Aig_ManFindConeOverlap(Aig_Man_t *p, Vec_Ptr_t *vImplics, Aig_Obj_t *pNode)
Definition: aigFact.c:116
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
Vec_Ptr_t * Aig_ManFindImplications(Aig_Man_t *p, Aig_Obj_t *pNode)
Definition: aigFact.c:70
Aig_Obj_t * Aig_ManDeriveNewCone(Aig_Man_t *p, Vec_Ptr_t *vImplics, Aig_Obj_t *pNode)
Definition: aigFact.c:163
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
Definition: aig.h:69
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Aig_ManFactorAlgebraicTest ( Aig_Man_t p)

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

Synopsis [Testing procedure.]

Description []

SideEffects []

SeeAlso []

Definition at line 249 of file aigFact.c.

250 {
251  int iPoA = 0;
252  int iPoB = 1;
253  int Value = 0;
254  Aig_Obj_t * pRes;
255 // Aig_Obj_t * pObj;
256 // int i;
257  pRes = Aig_ManFactorAlgebraic( p, iPoA, iPoB, Value );
258  Aig_ManShow( p, 0, NULL );
259  Aig_ObjPrint( p, pRes );
260  printf( "\n" );
261 /*
262  printf( "Results:\n" );
263  Aig_ManForEachObj( p, pObj, i )
264  {
265  printf( "Object = %d.\n", i );
266  Aig_ObjPrint( p, pObj );
267  printf( "\n" );
268  Aig_ObjPrint( p, pObj->pData );
269  printf( "\n" );
270  }
271 */
272 }
void Aig_ManShow(Aig_Man_t *pMan, int fHaig, Vec_Ptr_t *vBold)
Definition: aigShow.c:340
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Aig_ObjPrint(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigObj.c:316
Definition: aig.h:69
Aig_Obj_t * Aig_ManFactorAlgebraic(Aig_Man_t *p, int iPoA, int iPoB, int Value)
Definition: aigFact.c:230
int Aig_ManFindConeOverlap ( Aig_Man_t p,
Vec_Ptr_t vImplics,
Aig_Obj_t pNode 
)

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

Synopsis [Returns 1 if the cone of the node overlaps with the vector.]

Description []

SideEffects []

SeeAlso []

Definition at line 116 of file aigFact.c.

117 {
118  Aig_Obj_t * pTemp;
119  int i;
120  assert( !Aig_IsComplement(pNode) );
121  assert( !Aig_ObjIsConst1(pNode) );
123  Vec_PtrForEachEntry( Aig_Obj_t *, vImplics, pTemp, i )
126  return Aig_ManFindConeOverlap_rec( p, pNode );
127 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
Definition: aig.h:69
int Aig_ManFindConeOverlap_rec(Aig_Man_t *p, Aig_Obj_t *pNode)
Definition: aigFact.c:89
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
int Aig_ManFindConeOverlap_rec ( Aig_Man_t p,
Aig_Obj_t pNode 
)

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

Synopsis [Returns 1 if the cone of the node overlaps with the vector.]

Description []

SideEffects []

SeeAlso []

Definition at line 89 of file aigFact.c.

90 {
91  if ( Aig_ObjIsTravIdPrevious( p, pNode ) )
92  return 1;
93  if ( Aig_ObjIsTravIdCurrent( p, pNode ) )
94  return 0;
95  Aig_ObjSetTravIdCurrent( p, pNode );
96  if ( Aig_ObjIsCi(pNode) )
97  return 0;
99  return 1;
100  if ( Aig_ManFindConeOverlap_rec( p, Aig_ObjFanin1(pNode) ) )
101  return 1;
102  return 0;
103 }
static int Aig_ObjIsTravIdPrevious(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:296
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
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
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
int Aig_ManFindConeOverlap_rec(Aig_Man_t *p, Aig_Obj_t *pNode)
Definition: aigFact.c:89
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
Vec_Ptr_t* Aig_ManFindImplications ( Aig_Man_t p,
Aig_Obj_t pNode 
)

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

Synopsis [Returns the nodes whose values are implied by pNode.]

Description [Attention! Both pNode and results can be complemented! Also important: Currently, this procedure only does backward propagation. In general, it may find more implications if forward propagation is enabled.]

SideEffects []

SeeAlso []

Definition at line 70 of file aigFact.c.

71 {
72  Vec_Ptr_t * vImplics;
73  vImplics = Vec_PtrAlloc( 100 );
74  Aig_ManFindImplications_rec( pNode, vImplics );
75  return vImplics;
76 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_NAMESPACE_IMPL_START void Aig_ManFindImplications_rec(Aig_Obj_t *pObj, Vec_Ptr_t *vImplics)
DECLARATIONS ///.
Definition: aigFact.c:46
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
ABC_NAMESPACE_IMPL_START void Aig_ManFindImplications_rec ( Aig_Obj_t pObj,
Vec_Ptr_t vImplics 
)

DECLARATIONS ///.

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

FileName [aigFactor.c]

SystemName []

PackageName []

Synopsis []

Author [Alan Mishchenko]

Affiliation []

Date [Ver. 1.0. Started - April 17, 2009.]

Revision [

Id:
aigFactor.c,v 1.00 2009/04/17 00:00:00 alanmi Exp

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

Synopsis [Detects multi-input AND gate rooted at this node.]

Description []

SideEffects []

SeeAlso []

Definition at line 46 of file aigFact.c.

47 {
48  if ( Aig_IsComplement(pObj) || Aig_ObjIsCi(pObj) )
49  {
50  Vec_PtrPushUnique( vImplics, pObj );
51  return;
52  }
53  Aig_ManFindImplications_rec( Aig_ObjChild0(pObj), vImplics );
54  Aig_ManFindImplications_rec( Aig_ObjChild1(pObj), vImplics );
55 }
static Aig_Obj_t * Aig_ObjChild0(Aig_Obj_t *pObj)
Definition: aig.h:310
static int Vec_PtrPushUnique(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:656
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
ABC_NAMESPACE_IMPL_START void Aig_ManFindImplications_rec(Aig_Obj_t *pObj, Vec_Ptr_t *vImplics)
DECLARATIONS ///.
Definition: aigFact.c:46
static Aig_Obj_t * Aig_ObjChild1(Aig_Obj_t *pObj)
Definition: aig.h:311
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
Aig_Obj_t* Aig_ManSupportMinimization ( Aig_Man_t p,
Aig_Obj_t pCond,
Aig_Obj_t pFunc,
int *  pStatus 
)

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

Synopsis [Returns the result of support minimization.]

Description [Returns internal AIG node that is equal to pFunc under assignment pCond == 1, or NULL if there is no such node. status is -1 if condition is not OR; -2 if cone is too large or no cone; -3 if no support reduction is possible.]

SideEffects []

SeeAlso []

Definition at line 592 of file aigFact.c.

593 {
594  int nSuppMax = 16;
595  Vec_Ptr_t * vOrGate, * vNodes, * vSupp, * vCofs;
596  Aig_Obj_t * pResult;
597  int RetValue;
598  *pStatus = 0;
599  // if pCond is not OR
600  if ( !Aig_IsComplement(pCond) || Aig_ObjIsCi(Aig_Regular(pCond)) || Aig_ObjIsConst1(Aig_Regular(pCond)) )
601  {
602  *pStatus = -1;
603  return NULL;
604  }
605  // if pFunc is not a node
606  if ( !Aig_ObjIsNode(Aig_Regular(pFunc)) )
607  {
608  *pStatus = -2;
609  return NULL;
610  }
611  // collect the multi-input OR gate rooted in the condition
612  vOrGate = Aig_SuppMinCollectSuper( Aig_Regular(pCond) );
613  if ( Vec_PtrSize(vOrGate) > nSuppMax )
614  {
615  Vec_PtrFree( vOrGate );
616  *pStatus = -2;
617  return NULL;
618  }
619  // highlight the cone limited by these gates
620  RetValue = Aig_SuppMinHighlightCone( p, Aig_Regular(pFunc), vOrGate );
621  if ( RetValue == 0 ) // no overlap
622  {
623  Vec_PtrFree( vOrGate );
624  *pStatus = -2;
625  return NULL;
626  }
627  // collect the cone rooted in pFunc limited by vOrGate
628  vNodes = Aig_SuppMinCollectCone( p, Aig_Regular(pFunc) );
629  // collect the support nodes reachable from the cone
630  vSupp = Aig_SuppMinCollectSupport( p, vNodes );
631  if ( Vec_PtrSize(vSupp) > nSuppMax )
632  {
633  Vec_PtrFree( vOrGate );
634  Vec_PtrFree( vNodes );
635  Vec_PtrFree( vSupp );
636  *pStatus = -2;
637  return NULL;
638  }
639  // check if all nodes belonging to OR gate are included in the support
640  // (if this is not the case, don't-care minimization is not possible)
641  if ( !Aig_SuppMinGateIsInSupport( p, vOrGate, vSupp ) )
642  {
643  Vec_PtrFree( vOrGate );
644  Vec_PtrFree( vNodes );
645  Vec_PtrFree( vSupp );
646  *pStatus = -3;
647  return NULL;
648  }
649  // create truth tables of all nodes and find the maximal number
650  // of support varialbles that can be replaced by constants
651  vCofs = Aig_SuppMinPerform( p, vOrGate, vNodes, vSupp );
652  if ( Vec_PtrSize(vCofs) == 0 )
653  {
654  Vec_PtrFree( vCofs );
655  Vec_PtrFree( vOrGate );
656  Vec_PtrFree( vNodes );
657  Vec_PtrFree( vSupp );
658  *pStatus = -3;
659  return NULL;
660  }
661  // reconstruct the cone
662  pResult = Aig_SuppMinReconstruct( p, vCofs, vNodes, vSupp );
663  pResult = Aig_NotCond( pResult, Aig_IsComplement(pFunc) );
664  Vec_PtrFree( vCofs );
665  Vec_PtrFree( vOrGate );
666  Vec_PtrFree( vNodes );
667  Vec_PtrFree( vSupp );
668  return pResult;
669 }
Vec_Ptr_t * Aig_SuppMinCollectSuper(Aig_Obj_t *pObj)
Definition: aigFact.c:566
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Vec_Ptr_t * Aig_SuppMinCollectCone(Aig_Man_t *p, Aig_Obj_t *pRoot)
Definition: aigFact.c:464
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int nSuppMax
Definition: llb3Image.c:83
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
int Aig_SuppMinHighlightCone(Aig_Man_t *p, Aig_Obj_t *pRoot, Vec_Ptr_t *vOrGate)
Definition: aigFact.c:515
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
Definition: aig.h:69
Vec_Ptr_t * Aig_SuppMinPerform(Aig_Man_t *p, Vec_Ptr_t *vOrGate, Vec_Ptr_t *vNodes, Vec_Ptr_t *vSupp)
Definition: aigFact.c:287
Vec_Ptr_t * Aig_SuppMinCollectSupport(Aig_Man_t *p, Vec_Ptr_t *vNodes)
Definition: aigFact.c:402
int Aig_SuppMinGateIsInSupport(Aig_Man_t *p, Vec_Ptr_t *vOrGate, Vec_Ptr_t *vSupp)
Definition: aigFact.c:377
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
Aig_Obj_t * Aig_SuppMinReconstruct(Aig_Man_t *p, Vec_Ptr_t *vCofs, Vec_Ptr_t *vNodes, Vec_Ptr_t *vSupp)
Definition: aigFact.c:348
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Aig_ManSupportMinimizationTest ( )

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

Synopsis [Testing procedure.]

Description []

SideEffects []

SeeAlso []

Definition at line 681 of file aigFact.c.

682 {
683  Aig_Man_t * p;
684  Aig_Obj_t * pFunc, * pCond, * pRes;
685  int i, Status;
686  p = Aig_ManStart( 100 );
687  for ( i = 0; i < 5; i++ )
688  Aig_IthVar(p,i);
689  pFunc = Aig_Mux( p, Aig_IthVar(p,3), Aig_IthVar(p,1), Aig_IthVar(p,0) );
690  pFunc = Aig_Mux( p, Aig_IthVar(p,4), Aig_IthVar(p,2), pFunc );
691  pCond = Aig_Or( p, Aig_IthVar(p,3), Aig_IthVar(p,4) );
692  pRes = Aig_ManSupportMinimization( p, pCond, pFunc, &Status );
693  assert( Status == 0 );
694 
695  Aig_ObjPrint( p, Aig_Regular(pRes) ); printf( "\n" );
696  Aig_ObjPrint( p, Aig_ObjFanin0(Aig_Regular(pRes)) ); printf( "\n" );
697  Aig_ObjPrint( p, Aig_ObjFanin1(Aig_Regular(pRes)) ); printf( "\n" );
698 
699  Aig_ManStop( p );
700 }
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
void Aig_ObjPrint(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigObj.c:316
Aig_Obj_t * Aig_ManSupportMinimization(Aig_Man_t *p, Aig_Obj_t *pCond, Aig_Obj_t *pFunc, int *pStatus)
Definition: aigFact.c:592
Aig_Obj_t * Aig_IthVar(Aig_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
Definition: aigOper.c:63
Aig_Obj_t * Aig_Or(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:259
Definition: aig.h:69
Aig_Obj_t * Aig_Mux(Aig_Man_t *p, Aig_Obj_t *pC, Aig_Obj_t *p1, Aig_Obj_t *p0)
Definition: aigOper.c:317
#define assert(ex)
Definition: util_old.h:213
void Aig_ManSupportMinimizationTest2 ( )

Definition at line 701 of file aigFact.c.

702 {
703  Aig_Man_t * p;
704  Aig_Obj_t * node09, * node10, * node11, * node12, * node13, * pRes;
705  int i, Status;
706  p = Aig_ManStart( 100 );
707  for ( i = 0; i < 3; i++ )
708  Aig_IthVar(p,i);
709 
710  node09 = Aig_And( p, Aig_IthVar(p,0), Aig_Not(Aig_IthVar(p,1)) );
711  node10 = Aig_And( p, Aig_Not(node09), Aig_Not(Aig_IthVar(p,2)) );
712  node11 = Aig_And( p, node10, Aig_IthVar(p,1) );
713 
714  node12 = Aig_Or( p, Aig_IthVar(p,1), Aig_IthVar(p,2) );
715  node13 = Aig_Or( p, node12, Aig_IthVar(p,0) );
716 
717  pRes = Aig_ManSupportMinimization( p, node13, node11, &Status );
718  assert( Status == 0 );
719 
720  printf( "Compl = %d ", Aig_IsComplement(pRes) );
721  Aig_ObjPrint( p, Aig_Regular(pRes) ); printf( "\n" );
722  if ( Aig_ObjIsNode(Aig_Regular(pRes)) )
723  {
724  Aig_ObjPrint( p, Aig_ObjFanin0(Aig_Regular(pRes)) ); printf( "\n" );
725  Aig_ObjPrint( p, Aig_ObjFanin1(Aig_Regular(pRes)) ); printf( "\n" );
726  }
727 
728  Aig_ManStop( p );
729 }
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static Aig_Obj_t * Aig_Not(Aig_Obj_t *p)
Definition: aig.h:247
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
void Aig_ObjPrint(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigObj.c:316
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
Aig_Obj_t * Aig_ManSupportMinimization(Aig_Man_t *p, Aig_Obj_t *pCond, Aig_Obj_t *pFunc, int *pStatus)
Definition: aigFact.c:592
Aig_Obj_t * Aig_IthVar(Aig_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
Definition: aigOper.c:63
Aig_Obj_t * Aig_Or(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:259
Definition: aig.h:69
#define assert(ex)
Definition: util_old.h:213
Vec_Ptr_t* Aig_SuppMinCollectCone ( Aig_Man_t p,
Aig_Obj_t pRoot 
)

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

Synopsis [Collects nodes with the current trav ID rooted in the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 464 of file aigFact.c.

465 {
466  Vec_Ptr_t * vNodes;
467  assert( !Aig_IsComplement(pRoot) );
468 // assert( Aig_ObjIsTravIdCurrent( p, pRoot ) );
469  vNodes = Vec_PtrAlloc( 4 );
471  Aig_SuppMinCollectCone_rec( p, Aig_Regular(pRoot), vNodes );
472  return vNodes;
473 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
void Aig_SuppMinCollectCone_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vNodes)
Definition: aigFact.c:439
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define assert(ex)
Definition: util_old.h:213
void Aig_SuppMinCollectCone_rec ( Aig_Man_t p,
Aig_Obj_t pObj,
Vec_Ptr_t vNodes 
)

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

Synopsis [Marks the nodes in the cone with current trav ID.]

Description []

SideEffects []

SeeAlso []

Definition at line 439 of file aigFact.c.

440 {
441  if ( Aig_ObjIsTravIdCurrent( p, pObj ) ) // visited
442  return;
443  if ( !Aig_ObjIsTravIdPrevious( p, pObj ) ) // not visited, but outside
444  return;
445  assert( Aig_ObjIsTravIdPrevious(p, pObj) ); // not visited, inside
446  assert( Aig_ObjIsNode(pObj) );
447  Aig_ObjSetTravIdCurrent( p, pObj );
448  Aig_SuppMinCollectCone_rec( p, Aig_ObjFanin0(pObj), vNodes );
449  Aig_SuppMinCollectCone_rec( p, Aig_ObjFanin1(pObj), vNodes );
450  Vec_PtrPush( vNodes, pObj );
451 }
static int Aig_ObjIsTravIdPrevious(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:296
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
void Aig_SuppMinCollectCone_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vNodes)
Definition: aigFact.c:439
#define assert(ex)
Definition: util_old.h:213
Vec_Ptr_t* Aig_SuppMinCollectSuper ( Aig_Obj_t pObj)

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

Synopsis [Collects the supergate.]

Description []

SideEffects []

SeeAlso []

Definition at line 566 of file aigFact.c.

567 {
568  Vec_Ptr_t * vSuper;
569  assert( !Aig_IsComplement(pObj) );
570  assert( !Aig_ObjIsCi(pObj) );
571  vSuper = Vec_PtrAlloc( 4 );
574  return vSuper;
575 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Aig_Obj_t * Aig_ObjChild0(Aig_Obj_t *pObj)
Definition: aig.h:310
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_ObjChild1(Aig_Obj_t *pObj)
Definition: aig.h:311
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
void Aig_SuppMinCollectSuper_rec(Aig_Obj_t *pObj, Vec_Ptr_t *vSuper)
Definition: aigFact.c:542
#define assert(ex)
Definition: util_old.h:213
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
void Aig_SuppMinCollectSuper_rec ( Aig_Obj_t pObj,
Vec_Ptr_t vSuper 
)

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

Synopsis [Collects the supergate.]

Description []

SideEffects []

SeeAlso []

Definition at line 542 of file aigFact.c.

543 {
544  // if the new node is complemented or a PI, another gate begins
545  if ( Aig_IsComplement(pObj) || Aig_ObjIsCi(pObj) ) // || (Aig_ObjRefs(pObj) > 1) )
546  {
547  Vec_PtrPushUnique( vSuper, Aig_Not(pObj) );
548  return;
549  }
550  // go through the branches
553 }
static Aig_Obj_t * Aig_ObjChild0(Aig_Obj_t *pObj)
Definition: aig.h:310
static int Vec_PtrPushUnique(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:656
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Not(Aig_Obj_t *p)
Definition: aig.h:247
static Aig_Obj_t * Aig_ObjChild1(Aig_Obj_t *pObj)
Definition: aig.h:311
void Aig_SuppMinCollectSuper_rec(Aig_Obj_t *pObj, Vec_Ptr_t *vSuper)
Definition: aigFact.c:542
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
Vec_Ptr_t* Aig_SuppMinCollectSupport ( Aig_Man_t p,
Vec_Ptr_t vNodes 
)

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

Synopsis [Collects fanins of the marked nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 402 of file aigFact.c.

403 {
404  Vec_Ptr_t * vSupp;
405  Aig_Obj_t * pObj, * pFanin;
406  int i;
407  vSupp = Vec_PtrAlloc( 4 );
408  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
409  {
410  assert( Aig_ObjIsTravIdCurrent(p, pObj) );
411  assert( Aig_ObjIsNode(pObj) );
412  pFanin = Aig_ObjFanin0( pObj );
413  if ( !Aig_ObjIsTravIdCurrent(p, pFanin) )
414  {
415  Aig_ObjSetTravIdCurrent( p, pFanin );
416  Vec_PtrPush( vSupp, pFanin );
417  }
418  pFanin = Aig_ObjFanin1( pObj );
419  if ( !Aig_ObjIsTravIdCurrent(p, pFanin) )
420  {
421  Aig_ObjSetTravIdCurrent( p, pFanin );
422  Vec_PtrPush( vSupp, pFanin );
423  }
424  }
425  return vSupp;
426 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
Definition: aig.h:69
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
int Aig_SuppMinGateIsInSupport ( Aig_Man_t p,
Vec_Ptr_t vOrGate,
Vec_Ptr_t vSupp 
)

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

Synopsis [Returns 1 if all nodes of vOrGate are in vSupp.]

Description []

SideEffects []

SeeAlso []

Definition at line 377 of file aigFact.c.

378 {
379  Aig_Obj_t * pObj;
380  int i;
382  Vec_PtrForEachEntry( Aig_Obj_t *, vSupp, pObj, i )
383  Aig_ObjSetTravIdCurrent( p, pObj );
384  Vec_PtrForEachEntry( Aig_Obj_t *, vOrGate, pObj, i )
385  if ( !Aig_ObjIsTravIdCurrent( p, Aig_Regular(pObj) ) )
386  return 0;
387  return 1;
388 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
int Aig_SuppMinHighlightCone ( Aig_Man_t p,
Aig_Obj_t pRoot,
Vec_Ptr_t vOrGate 
)

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

Synopsis [Marks the nodes in the cone with current trav ID.]

Description []

SideEffects []

SeeAlso []

Definition at line 515 of file aigFact.c.

516 {
517  Aig_Obj_t * pLeaf;
518  int i, RetValue;
519  assert( !Aig_IsComplement(pRoot) );
522  Vec_PtrForEachEntry( Aig_Obj_t *, vOrGate, pLeaf, i )
524  RetValue = Aig_SuppMinHighlightCone_rec( p, pRoot );
525  Vec_PtrForEachEntry( Aig_Obj_t *, vOrGate, pLeaf, i )
527  return RetValue;
528 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
Definition: aig.h:69
static void Aig_ObjSetTravIdPrevious(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:294
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
int Aig_SuppMinHighlightCone_rec(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigFact.c:486
int Aig_SuppMinHighlightCone_rec ( Aig_Man_t p,
Aig_Obj_t pObj 
)

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

Synopsis [Marks the nodes in the cone with current trav ID.]

Description []

SideEffects []

SeeAlso []

Definition at line 486 of file aigFact.c.

487 {
488  int RetValue;
489  if ( Aig_ObjIsTravIdCurrent( p, pObj ) ) // visited, marks there
490  return 1;
491  if ( Aig_ObjIsTravIdPrevious( p, pObj ) ) // visited, no marks there
492  return 0;
493  Aig_ObjSetTravIdPrevious( p, pObj );
494  if ( Aig_ObjIsCi(pObj) )
495  return 0;
496  RetValue = Aig_SuppMinHighlightCone_rec( p, Aig_ObjFanin0(pObj) ) |
498 // printf( "%d %d\n", Aig_ObjId(pObj), RetValue );
499  if ( RetValue )
500  Aig_ObjSetTravIdCurrent( p, pObj );
501  return RetValue;
502 }
static int Aig_ObjIsTravIdPrevious(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:296
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
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
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
static void Aig_ObjSetTravIdPrevious(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:294
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
int Aig_SuppMinHighlightCone_rec(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigFact.c:486
Vec_Ptr_t* Aig_SuppMinPerform ( Aig_Man_t p,
Vec_Ptr_t vOrGate,
Vec_Ptr_t vNodes,
Vec_Ptr_t vSupp 
)

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

Synopsis [Determines what support variables can be cofactored.]

Description []

SideEffects []

SeeAlso []

Definition at line 287 of file aigFact.c.

288 {
289  Aig_Obj_t * pObj;
290  Vec_Ptr_t * vTrSupp, * vTrNode, * vCofs;
291  unsigned * uFunc = NULL, * uCare, * uFunc0, * uFunc1;
292  unsigned * uCof0, * uCof1, * uCare0, * uCare1;
293  int i, nWords = Abc_TruthWordNum( Vec_PtrSize(vSupp) );
294  // assign support nodes
295  vTrSupp = Vec_PtrAllocTruthTables( Vec_PtrSize(vSupp) );
296  Vec_PtrForEachEntry( Aig_Obj_t *, vSupp, pObj, i )
297  pObj->pData = Vec_PtrEntry( vTrSupp, i );
298  // compute internal nodes
299  vTrNode = Vec_PtrAllocSimInfo( Vec_PtrSize(vNodes) + 5, nWords );
300  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
301  {
302  pObj->pData = uFunc = (unsigned *)Vec_PtrEntry( vTrNode, i );
303  uFunc0 = (unsigned *)Aig_ObjFanin0(pObj)->pData;
304  uFunc1 = (unsigned *)Aig_ObjFanin1(pObj)->pData;
305  Kit_TruthAndPhase( uFunc, uFunc0, uFunc1, Vec_PtrSize(vSupp), Aig_ObjFaninC0(pObj), Aig_ObjFaninC1(pObj) );
306  }
307  // uFunc contains the result of computation
308  // compute care set
309  uCare = (unsigned *)Vec_PtrEntry( vTrNode, Vec_PtrSize(vNodes) );
310  Kit_TruthClear( uCare, Vec_PtrSize(vSupp) );
311  Vec_PtrForEachEntry( Aig_Obj_t *, vOrGate, pObj, i )
312  Kit_TruthOrPhase( uCare, uCare, (unsigned *)Aig_Regular(pObj)->pData, Vec_PtrSize(vSupp), 0, Aig_IsComplement(pObj) );
313  // try cofactoring each variable in both polarities
314  vCofs = Vec_PtrAlloc( 10 );
315  uCof0 = (unsigned *)Vec_PtrEntry( vTrNode, Vec_PtrSize(vNodes)+1 );
316  uCof1 = (unsigned *)Vec_PtrEntry( vTrNode, Vec_PtrSize(vNodes)+2 );
317  uCare0 = (unsigned *)Vec_PtrEntry( vTrNode, Vec_PtrSize(vNodes)+3 );
318  uCare1 = (unsigned *)Vec_PtrEntry( vTrNode, Vec_PtrSize(vNodes)+4 );
319  Vec_PtrForEachEntry( Aig_Obj_t *, vSupp, pObj, i )
320  {
321  Kit_TruthCofactor0New( uCof0, uFunc, Vec_PtrSize(vSupp), i );
322  Kit_TruthCofactor1New( uCof1, uFunc, Vec_PtrSize(vSupp), i );
323  Kit_TruthCofactor0New( uCare0, uCare, Vec_PtrSize(vSupp), i );
324  Kit_TruthCofactor1New( uCare1, uCare, Vec_PtrSize(vSupp), i );
325  if ( Kit_TruthIsEqualWithCare( uCof0, uCof1, uCare1, Vec_PtrSize(vSupp) ) )
326  Vec_PtrPush( vCofs, Aig_Not(pObj) );
327  else if ( Kit_TruthIsEqualWithCare( uCof0, uCof1, uCare0, Vec_PtrSize(vSupp) ) )
328  Vec_PtrPush( vCofs, pObj );
329  }
330  Vec_PtrFree( vTrNode );
331  Vec_PtrFree( vTrSupp );
332  return vCofs;
333 }
static void Kit_TruthAndPhase(unsigned *pOut, unsigned *pIn0, unsigned *pIn1, int nVars, int fCompl0, int fCompl1)
Definition: kit.h:409
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void * pData
Definition: aig.h:87
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static Aig_Obj_t * Aig_Not(Aig_Obj_t *p)
Definition: aig.h:247
static int Abc_TruthWordNum(int nVars)
Definition: abc_global.h:256
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int nWords
Definition: abcNpn.c:127
void Kit_TruthCofactor0New(unsigned *pOut, unsigned *pIn, int nVars, int iVar)
Definition: kitTruth.c:521
static Vec_Ptr_t * Vec_PtrAllocTruthTables(int nVars)
Definition: vecPtr.h:1065
void Kit_TruthCofactor1New(unsigned *pOut, unsigned *pIn, int nVars, int iVar)
Definition: kitTruth.c:573
Definition: aig.h:69
static void Kit_TruthOrPhase(unsigned *pOut, unsigned *pIn0, unsigned *pIn1, int nVars, int fCompl0, int fCompl1)
Definition: kit.h:433
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static int Kit_TruthIsEqualWithCare(unsigned *pIn0, unsigned *pIn1, unsigned *pCare, int nVars)
Definition: kit.h:282
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void Kit_TruthClear(unsigned *pOut, int nVars)
Definition: kit.h:361
static Vec_Ptr_t * Vec_PtrAllocSimInfo(int nEntries, int nWords)
Definition: vecPtr.h:929
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Aig_Obj_t* Aig_SuppMinReconstruct ( Aig_Man_t p,
Vec_Ptr_t vCofs,
Vec_Ptr_t vNodes,
Vec_Ptr_t vSupp 
)

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

Synopsis [Returns the new node after cofactoring.]

Description []

SideEffects []

SeeAlso []

Definition at line 348 of file aigFact.c.

349 {
350  Aig_Obj_t * pObj = NULL;
351  int i;
352  // set the value of the support variables
353  Vec_PtrForEachEntry( Aig_Obj_t *, vSupp, pObj, i )
354  assert( !Aig_IsComplement(pObj) );
355  Vec_PtrForEachEntry( Aig_Obj_t *, vSupp, pObj, i )
356  pObj->pData = pObj;
357  // set the value of the cofactoring variables
358  Vec_PtrForEachEntry( Aig_Obj_t *, vCofs, pObj, i )
359  Aig_Regular(pObj)->pData = Aig_NotCond( Aig_ManConst1(p), Aig_IsComplement(pObj) );
360  // reconstruct the node
361  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
362  pObj->pData = Aig_And( p, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
363  return (Aig_Obj_t *)pObj->pData;
364 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
#define assert(ex)
Definition: util_old.h:213
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55