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

Go to the source code of this file.

Functions

int If_ManCutReach_rec (If_Obj_t *pPath, If_Obj_t *pLeaf)
 FUNCTION DEFINITIONS ///. More...
 
int If_ManCutReach (If_Man_t *p, If_Cut_t *pCut, If_Obj_t *pPath, If_Obj_t *pLeaf)
 
int If_ManCutTruthCheck_rec (If_Obj_t *pObj, word *pTruths)
 
int If_ManCutTruthCheck (If_Man_t *p, If_Obj_t *pObj, If_Cut_t *pCut, If_Obj_t *pLeaf, int Cof, word *pTruths)
 
void If_ManCutCheck (If_Man_t *p, If_Obj_t *pObj, If_Cut_t *pCut)
 

Variables

ABC_NAMESPACE_IMPL_START
typedef unsigned long long 
word
 DECLARATIONS ///. More...
 
static word Truths6 [6]
 

Function Documentation

void If_ManCutCheck ( If_Man_t p,
If_Obj_t pObj,
If_Cut_t pCut 
)

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

Synopsis [Checks if cut can be structurally/functionally decomposed.]

Description [The decomposition is Fn(a,b,c,...) = F2(a, Fn-1(b,c,...)).]

SideEffects []

SeeAlso []

Definition at line 144 of file ifCheck.c.

145 {
146  static int nDecCalls = 0;
147  static int nDecStruct = 0;
148  static int nDecStruct2 = 0;
149  static int nDecFunction = 0;
150  word * pTruths;
151  If_Obj_t * pLeaf, * pPath;
152  int i;
153  if ( pCut == NULL )
154  {
155  printf( "DecStr = %9d (%6.2f %%).\n", nDecStruct, 100.0*nDecStruct/nDecCalls );
156  printf( "DecStr2 = %9d (%6.2f %%).\n", nDecStruct2, 100.0*nDecStruct2/nDecCalls );
157  printf( "DecFunc = %9d (%6.2f %%).\n", nDecFunction, 100.0*nDecFunction/nDecCalls );
158  printf( "Total = %9d (%6.2f %%).\n", nDecCalls, 100.0*nDecCalls/nDecCalls );
159  return;
160  }
161  assert( If_ObjIsAnd(pObj) );
162  assert( pCut->nLeaves <= 7 );
163  nDecCalls++;
164  // check structural decomposition
165  If_CutForEachLeaf( p, pCut, pLeaf, i )
166  if ( pLeaf == If_ObjFanin0(pObj) || pLeaf == If_ObjFanin1(pObj) )
167  break;
168  if ( i < If_CutLeaveNum(pCut) )
169  {
170  pPath = (pLeaf == If_ObjFanin0(pObj)) ? If_ObjFanin1(pObj) : If_ObjFanin0(pObj);
171  if ( !If_ManCutReach( p, pCut, pPath, pLeaf ) )
172  {
173  nDecStruct++;
174 // nDecFunction++;
175 // return;
176  }
177  else
178  nDecStruct2++;
179  }
180  // check functional decomposition
181  pTruths = malloc( sizeof(word) * If_ManObjNum(p) );
182  If_CutForEachLeaf( p, pCut, pLeaf, i )
183  {
184  if ( If_ManCutTruthCheck( p, pObj, pCut, pLeaf, 0, pTruths ) )
185  {
186  nDecFunction++;
187  break;
188  }
189  if ( If_ManCutTruthCheck( p, pObj, pCut, pLeaf, 1, pTruths ) )
190  {
191  nDecFunction++;
192  break;
193  }
194  }
195  free( pTruths );
196 }
static ABC_NAMESPACE_IMPL_START int pTruths[13719]
DECLARATIONS ///.
Definition: rwrTemp.c:30
char * malloc()
unsigned nLeaves
Definition: if.h:289
VOID_HACK free()
Definition: if.h:303
static int If_ObjIsAnd(If_Obj_t *pObj)
Definition: if.h:377
#define If_CutForEachLeaf(p, pCut, pLeaf, i)
Definition: if.h:474
static int If_CutLeaveNum(If_Cut_t *pCut)
Definition: if.h:390
static If_Obj_t * If_ObjFanin0(If_Obj_t *pObj)
Definition: if.h:380
int If_ManCutTruthCheck(If_Man_t *p, If_Obj_t *pObj, If_Cut_t *pCut, If_Obj_t *pLeaf, int Cof, word *pTruths)
Definition: ifCheck.c:109
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
if(last==0)
Definition: sparse_int.h:34
static If_Obj_t * If_ObjFanin1(If_Obj_t *pObj)
Definition: if.h:381
static int If_ManObjNum(If_Man_t *p)
Definition: if.h:363
#define assert(ex)
Definition: util_old.h:213
int If_ManCutReach(If_Man_t *p, If_Cut_t *pCut, If_Obj_t *pPath, If_Obj_t *pLeaf)
Definition: ifCheck.c:74
int If_ManCutReach ( If_Man_t p,
If_Cut_t pCut,
If_Obj_t pPath,
If_Obj_t pLeaf 
)

Definition at line 74 of file ifCheck.c.

75 {
76  If_Obj_t * pTemp;
77  int i, RetValue;
78  If_CutForEachLeaf( p, pCut, pTemp, i )
79  pTemp->fMark = 1;
80  RetValue = If_ManCutReach_rec( pPath, pLeaf );
81  If_CutForEachLeaf( p, pCut, pTemp, i )
82  pTemp->fMark = 0;
83  return RetValue;
84 }
Definition: if.h:303
#define If_CutForEachLeaf(p, pCut, pLeaf, i)
Definition: if.h:474
int If_ManCutReach_rec(If_Obj_t *pPath, If_Obj_t *pLeaf)
FUNCTION DEFINITIONS ///.
Definition: ifCheck.c:61
int If_ManCutReach_rec ( If_Obj_t pPath,
If_Obj_t pLeaf 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Returns 1 if the node Leaf is reachable on the path.]

Description []

SideEffects []

SeeAlso []

Definition at line 61 of file ifCheck.c.

62 {
63  if ( pPath == pLeaf )
64  return 1;
65  if ( pPath->fMark )
66  return 0;
67  assert( If_ObjIsAnd(pPath) );
68  if ( If_ManCutReach_rec( If_ObjFanin0(pPath), pLeaf ) )
69  return 1;
70  if ( If_ManCutReach_rec( If_ObjFanin1(pPath), pLeaf ) )
71  return 1;
72  return 0;
73 }
static int If_ObjIsAnd(If_Obj_t *pObj)
Definition: if.h:377
static If_Obj_t * If_ObjFanin0(If_Obj_t *pObj)
Definition: if.h:380
int If_ManCutReach_rec(If_Obj_t *pPath, If_Obj_t *pLeaf)
FUNCTION DEFINITIONS ///.
Definition: ifCheck.c:61
static If_Obj_t * If_ObjFanin1(If_Obj_t *pObj)
Definition: if.h:381
#define assert(ex)
Definition: util_old.h:213
unsigned fMark
Definition: if.h:310
int If_ManCutTruthCheck ( If_Man_t p,
If_Obj_t pObj,
If_Cut_t pCut,
If_Obj_t pLeaf,
int  Cof,
word pTruths 
)

Definition at line 109 of file ifCheck.c.

110 {
111  word Truth;
112  If_Obj_t * pTemp;
113  int i, k = 0;
114  assert( Cof == 0 || Cof == 1 );
115  If_CutForEachLeaf( p, pCut, pTemp, i )
116  {
117  assert( pTemp->fMark == 0 );
118  pTemp->fMark = 1;
119  if ( pLeaf == pTemp )
120  pTruths[If_ObjId(pTemp)] = (Cof ? ~((word)0) : 0);
121  else
122  pTruths[If_ObjId(pTemp)] = Truths6[k++] ;
123  }
124  assert( k + 1 == If_CutLeaveNum(pCut) );
125  // compute truth table
126  Truth = If_ManCutTruthCheck_rec( pObj, pTruths );
127  If_CutForEachLeaf( p, pCut, pTemp, i )
128  pTemp->fMark = 0;
129  return Truth == 0 || Truth == ~((word)0);
130 }
static ABC_NAMESPACE_IMPL_START int pTruths[13719]
DECLARATIONS ///.
Definition: rwrTemp.c:30
static int If_ObjId(If_Obj_t *pObj)
Definition: if.h:379
Definition: if.h:303
#define If_CutForEachLeaf(p, pCut, pLeaf, i)
Definition: if.h:474
static int If_CutLeaveNum(If_Cut_t *pCut)
Definition: if.h:390
int If_ManCutTruthCheck_rec(If_Obj_t *pObj, word *pTruths)
Definition: ifCheck.c:97
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static word Truths6[6]
Definition: ifCheck.c:37
static ABC_NAMESPACE_IMPL_START word Truth[8]
DECLARATIONS ///.
Definition: giaShrink6.c:32
#define assert(ex)
Definition: util_old.h:213
ABC_NAMESPACE_IMPL_START typedef unsigned long long word
DECLARATIONS ///.
Definition: ifCheck.c:33
unsigned fMark
Definition: if.h:310
int If_ManCutTruthCheck_rec ( If_Obj_t pObj,
word pTruths 
)

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

Synopsis [Derive truth table for each cofactor.]

Description []

SideEffects []

SeeAlso []

Definition at line 97 of file ifCheck.c.

98 {
99  word T0, T1;
100  if ( pObj->fMark )
101  return pTruths[If_ObjId(pObj)];
102  assert( If_ObjIsAnd(pObj) );
105  T0 = If_ObjFaninC0(pObj) ? ~T0 : T0;
106  T1 = If_ObjFaninC1(pObj) ? ~T1 : T1;
107  return T0 & T1;
108 }
static ABC_NAMESPACE_IMPL_START int pTruths[13719]
DECLARATIONS ///.
Definition: rwrTemp.c:30
static int If_ObjId(If_Obj_t *pObj)
Definition: if.h:379
static int If_ObjIsAnd(If_Obj_t *pObj)
Definition: if.h:377
static int If_ObjFaninC0(If_Obj_t *pObj)
Definition: if.h:382
static If_Obj_t * If_ObjFanin0(If_Obj_t *pObj)
Definition: if.h:380
static int If_ObjFaninC1(If_Obj_t *pObj)
Definition: if.h:383
int If_ManCutTruthCheck_rec(If_Obj_t *pObj, word *pTruths)
Definition: ifCheck.c:97
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static If_Obj_t * If_ObjFanin1(If_Obj_t *pObj)
Definition: if.h:381
#define assert(ex)
Definition: util_old.h:213
unsigned fMark
Definition: if.h:310

Variable Documentation

word Truths6[6]
static
Initial value:
= {
0xAAAAAAAAAAAAAAAA,
0xCCCCCCCCCCCCCCCC,
0xF0F0F0F0F0F0F0F0,
0xFF00FF00FF00FF00,
0xFFFF0000FFFF0000,
0xFFFFFFFF00000000
}

Definition at line 37 of file ifCheck.c.

ABC_NAMESPACE_IMPL_START typedef unsigned long long word

DECLARATIONS ///.

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

FileName [ifCheck.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [FPGA mapping based on priority cuts.]

Synopsis [Sequential mapping.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - November 21, 2006.]

Revision [

Id:
ifCheck.c,v 1.00 2006/11/21 00:00:00 alanmi Exp

]

Definition at line 33 of file ifCheck.c.