ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
ifCheck.c File Reference
#include "if.h"
Include dependency graph for ifCheck.c:

Go to the source code of this file.

Functions

int If_ManCutReach_rec (If_Obj_t *pPath, If_Obj_t *pLeaf)
 FUNCTION DEFINITIONS ///.
 
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 ///.
 

Function Documentation

◆ If_ManCutCheck()

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}
Cube * p
Definition exorList.c:222
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_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
#define If_CutForEachLeaf(p, pCut, pLeaf, i)
Definition if.h:503
struct If_Obj_t_ If_Obj_t
Definition if.h:79
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
unsigned nLeaves
Definition if.h:316
#define assert(ex)
Definition util_old.h:213
VOID_HACK free()
char * malloc()
Here is the call graph for this function:

◆ If_ManCutReach()

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}
int If_ManCutReach_rec(If_Obj_t *pPath, If_Obj_t *pLeaf)
FUNCTION DEFINITIONS ///.
Definition ifCheck.c:61
unsigned fMark
Definition if.h:338
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_ManCutReach_rec()

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}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_ManCutTruthCheck()

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}
int If_ManCutTruthCheck_rec(If_Obj_t *pObj, word *pTruths)
Definition ifCheck.c:97
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_ManCutTruthCheck_rec()

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) );
103 T0 = If_ManCutTruthCheck_rec( If_ObjFanin0(pObj), pTruths );
104 T1 = If_ManCutTruthCheck_rec( If_ObjFanin1(pObj), pTruths );
105 T0 = If_ObjFaninC0(pObj) ? ~T0 : T0;
106 T1 = If_ObjFaninC1(pObj) ? ~T1 : T1;
107 return T0 & T1;
108}
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ word

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.