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

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START void Int2_ManJustify_rec (Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vSelect)
 DECLARATIONS ///. More...
 
Vec_Int_tInt2_ManRefineCube (Gia_Man_t *p, Vec_Int_t *vAssign, Vec_Int_t *vPrio)
 

Function Documentation

ABC_NAMESPACE_IMPL_START void Int2_ManJustify_rec ( Gia_Man_t p,
Gia_Obj_t pObj,
Vec_Int_t vSelect 
)

DECLARATIONS ///.

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

FileName [int2Refine.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Interpolation engine.]

Synopsis [Various utilities.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - Dec 1, 2013.]

Revision [

Id:
int2Refine.c,v 1.00 2013/12/01 00:00:00 alanmi Exp

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file int2Refine.c.

46 {
47  if ( pObj->fMark1 )
48  return;
49  pObj->fMark1 = 1;
50  if ( Gia_ObjIsPi(p, pObj) )
51  return;
52  if ( Gia_ObjIsCo(pObj) )
53  {
54  Vec_IntPush( vSelect, Gia_ObjCioId(pObj) );
55  return;
56  }
57  assert( Gia_ObjIsAnd(pObj) );
58  if ( pObj->Value == 1 )
59  {
60  if ( Gia_ObjFanin0(pObj)->Value < ABC_INFINITY )
61  Int2_ManJustify_rec( p, Gia_ObjFanin0(pObj), vSelect );
62  if ( Gia_ObjFanin1(pObj)->Value < ABC_INFINITY )
63  Int2_ManJustify_rec( p, Gia_ObjFanin1(pObj), vSelect );
64  return;
65  }
66  if ( (Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj)) == 0 && (Gia_ObjFanin1(pObj)->fMark0 ^ Gia_ObjFaninC1(pObj)) == 0 )
67  {
68  if ( Gia_ObjFanin0(pObj)->fMark0 <= Gia_ObjFanin1(pObj)->fMark0 ) // choice
69  {
70  if ( Gia_ObjFanin0(pObj)->Value < ABC_INFINITY )
71  Int2_ManJustify_rec( p, Gia_ObjFanin0(pObj), vSelect );
72  }
73  else
74  {
75  if ( Gia_ObjFanin1(pObj)->Value < ABC_INFINITY )
76  Int2_ManJustify_rec( p, Gia_ObjFanin1(pObj), vSelect );
77  }
78  }
79  else if ( (Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj)) == 0 )
80  {
81  if ( Gia_ObjFanin0(pObj)->Value < ABC_INFINITY )
82  Int2_ManJustify_rec( p, Gia_ObjFanin0(pObj), vSelect );
83  }
84  else if ( (Gia_ObjFanin1(pObj)->fMark0 ^ Gia_ObjFaninC1(pObj)) == 0 )
85  {
86  if ( Gia_ObjFanin1(pObj)->Value < ABC_INFINITY )
87  Int2_ManJustify_rec( p, Gia_ObjFanin1(pObj), vSelect );
88  }
89  else assert( 0 );
90  }
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
unsigned fMark1
Definition: gia.h:84
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
ABC_NAMESPACE_IMPL_START void Int2_ManJustify_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vSelect)
DECLARATIONS ///.
Definition: int2Refine.c:45
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static int Gia_ObjCioId(Gia_Obj_t *pObj)
Definition: gia.h:411
static int Gia_ObjIsPi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:441
Vec_Int_t* Int2_ManRefineCube ( Gia_Man_t p,
Vec_Int_t vAssign,
Vec_Int_t vPrio 
)

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

Synopsis [Computes the reduced set of flop variables.]

Description [Given is a single-output seq AIG manager and an assignment of its CIs. Returned is a subset of flops that justifies the output.]

SideEffects []

SeeAlso []

Definition at line 104 of file int2Refine.c.

105 {
106  Vec_Int_t * vSubset;
107  Gia_Obj_t * pObj;
108  int i;
109  // set values and prios
110  assert( Gia_ManRegNum(p) > 0 );
111  assert( Vec_IntSize(vAssign) == Vec_IntSize(vPrio) );
112  Gia_ManConst0(p)->fMark0 = 0;
113  Gia_ManConst0(p)->fMark1 = 0;
115  Gia_ManForEachCi( p, pObj, i )
116  {
117  pObj->fMark0 = Vec_IntEntry(vAssign, i);
118  pObj->fMark1 = 0;
119  pObj->Value = Vec_IntEntry(vPrio, i);
120  }
121  Gia_ManForEachAnd( p, pObj, i )
122  {
123  pObj->fMark0 = (Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj)) & (Gia_ObjFanin1(pObj)->fMark0 ^ Gia_ObjFaninC1(pObj));
124  pObj->fMark1 = 0;
125  if ( pObj->fMark0 == 1 )
126  pObj->Value = Abc_MaxInt( Gia_ObjFanin0(pObj)->Value, Gia_ObjFanin1(pObj)->Value );
127  else if ( (Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj)) == 0 && (Gia_ObjFanin1(pObj)->fMark0 ^ Gia_ObjFaninC1(pObj)) == 0 )
128  pObj->Value = Abc_MinInt( Gia_ObjFanin0(pObj)->Value, Gia_ObjFanin1(pObj)->Value ); // choice
129  else if ( (Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj)) == 0 )
130  pObj->Value = Gia_ObjFanin0(pObj)->Value;
131  else
132  pObj->Value = Gia_ObjFanin1(pObj)->Value;
133  }
134  pObj = Gia_ManPo( p, 0 );
135  pObj->fMark0 = (Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj));
136  pObj->fMark1 = 0;
137  pObj->Value = Gia_ObjFanin0(pObj)->Value;
138  assert( pObj->fMark0 == 1 );
139  assert( pObj->Value < ABC_INFINITY );
140  // select subset
141  vSubset = Vec_IntAlloc( 100 );
142  Int2_ManJustify_rec( p, Gia_ObjFanin0(pObj), vSubset );
143  return vSubset;
144 }
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
unsigned fMark1
Definition: gia.h:84
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
static int Abc_MinInt(int a, int b)
Definition: abc_global.h:239
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
ABC_NAMESPACE_IMPL_START void Int2_ManJustify_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vSelect)
DECLARATIONS ///.
Definition: int2Refine.c:45
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
unsigned fMark0
Definition: gia.h:79
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387