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

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START void Gia_ManHighlight_rec (Gia_Man_t *p, int iObj)
 DECLARATIONS ///.
 
void Gia_ManPrepareWin (Gia_Man_t *p, Vec_Int_t *vOuts, Vec_Int_t **pvPis, Vec_Int_t **pvPos, Vec_Int_t **pvAnds, int fPoOnly)
 
Gia_Man_tGia_ManExtractWin (Gia_Man_t *p, Vec_Int_t *vOuts, int fPoOnly)
 
Gia_Man_tGia_ManInsertWin (Gia_Man_t *p, Vec_Int_t *vOuts, Gia_Man_t *pWin)
 
Vec_Int_tGia_ManFindLatest (Gia_Man_t *p, int LevelMax, int nTimeWindow)
 
Gia_Man_tGia_ManExtractWindow (Gia_Man_t *p, int LevelMax, int nTimeWindow, int fVerbose)
 
Gia_Man_tGia_ManPerformSopBalanceWin (Gia_Man_t *p, int LevelMax, int nTimeWindow, int nCutNum, int nRelaxRatio, int fVerbose)
 
Gia_Man_tGia_ManPerformDsdBalanceWin (Gia_Man_t *p, int LevelMax, int nTimeWindow, int nLutSize, int nCutNum, int nRelaxRatio, int fVerbose)
 

Function Documentation

◆ Gia_ManExtractWin()

Gia_Man_t * Gia_ManExtractWin ( Gia_Man_t * p,
Vec_Int_t * vOuts,
int fPoOnly )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 114 of file giaBalMap.c.

115{
116 Vec_Int_t * vPis, * vPos, * vAnds;
117 Gia_Man_t * pNew;
118 Gia_Obj_t * pObj;
119 int i;
120 Gia_ManPrepareWin( p, vOuts, &vPis, &vPos, &vAnds, fPoOnly );
121 // create AIG
122 pNew = Gia_ManStart( Vec_IntSize(vPis) + Vec_IntSize(vPos) + Vec_IntSize(vAnds) + 1 );
123 pNew->pName = Abc_UtilStrsav( p->pName );
124 Gia_ManConst0(p)->Value = 0;
125 Gia_ManForEachObjVec( vPis, p, pObj, i )
126 pObj->Value = Gia_ManAppendCi( pNew );
127 Gia_ManForEachObjVec( vAnds, p, pObj, i )
128 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
129 Gia_ManForEachObjVec( vPos, p, pObj, i )
130 Gia_ManAppendCo( pNew, pObj->Value );
131 Vec_IntFree( vPis );
132 Vec_IntFree( vPos );
133 Vec_IntFree( vAnds );
134 return pNew;
135}
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Cube * p
Definition exorList.c:222
void Gia_ManPrepareWin(Gia_Man_t *p, Vec_Int_t *vOuts, Vec_Int_t **pvPis, Vec_Int_t **pvPos, Vec_Int_t **pvAnds, int fPoOnly)
Definition giaBalMap.c:57
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
Definition giaMan.c:57
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition gia.h:1194
char * pName
Definition gia.h:99
unsigned Value
Definition gia.h:89
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManExtractWindow()

Gia_Man_t * Gia_ManExtractWindow ( Gia_Man_t * p,
int LevelMax,
int nTimeWindow,
int fVerbose )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 236 of file giaBalMap.c.

237{
238 Vec_Int_t * vOuts;
239 Gia_Man_t * pWin;
240 assert( !LevelMax != !nTimeWindow );
241 vOuts = Gia_ManFindLatest( p, LevelMax, nTimeWindow );
242 if ( fVerbose )
243 printf( "Collected %d outputs to extract.\n", Vec_IntSize(vOuts) );
244 if ( Vec_IntSize(vOuts) == 0 )
245 {
246 Vec_IntFree( vOuts );
247 return Gia_ManDup( p );
248 }
249 pWin = Gia_ManExtractWin( p, vOuts, 1 );
250 Vec_IntFree( vOuts );
251 return pWin;
252}
Vec_Int_t * Gia_ManFindLatest(Gia_Man_t *p, int LevelMax, int nTimeWindow)
Definition giaBalMap.c:186
Gia_Man_t * Gia_ManExtractWin(Gia_Man_t *p, Vec_Int_t *vOuts, int fPoOnly)
Definition giaBalMap.c:114
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition giaDup.c:720
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:

◆ Gia_ManFindLatest()

Vec_Int_t * Gia_ManFindLatest ( Gia_Man_t * p,
int LevelMax,
int nTimeWindow )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 186 of file giaBalMap.c.

187{
188 Gia_Obj_t * pObj;
189 Vec_Int_t * vOuts;
190 vOuts = Vec_IntAlloc( 1000 );
191 if ( Gia_ManHasMapping(p) )
192 {
193 int i, k, iFan, nLevels = 0;
194 int * pLevels = ABC_CALLOC( int, Gia_ManObjNum(p) );
195 Gia_ManForEachLut( p, i )
196 {
197 Gia_LutForEachFanin( p, i, iFan, k )
198 pLevels[i] = Abc_MaxInt( pLevels[i], pLevels[iFan] );
199 pLevels[i]++;
200 nLevels = Abc_MaxInt( nLevels, pLevels[i] );
201 }
202 if ( nTimeWindow )
203 LevelMax = (int)((1.0 - 0.01 * nTimeWindow) * nLevels);
204 if ( nLevels < LevelMax )
205 printf( "The maximum mapped level (%d) is less than the target level (%d).\n", nLevels, LevelMax );
206 Gia_ManForEachCo( p, pObj, i )
207 if ( pLevels[Gia_ObjFaninId0p(p, pObj)] >= LevelMax )
208 Vec_IntPush( vOuts, i );
209 ABC_FREE( pLevels );
210 }
211 else
212 {
213 int i, nLevels = Gia_ManLevelNum( p );
214 if ( nTimeWindow )
215 LevelMax = (int)((1.0 - 0.01 * nTimeWindow) * nLevels);
216 if ( nLevels < LevelMax )
217 printf( "The maximum AIG level (%d) is less than the target level (%d).\n", nLevels, LevelMax );
218 Gia_ManForEachCo( p, pObj, i )
219 if ( Gia_ObjLevel(p, pObj) >= LevelMax )
220 Vec_IntPush( vOuts, i );
221 }
222 return vOuts;
223}
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
#define ABC_FREE(obj)
Definition abc_global.h:267
#define Gia_ManForEachLut(p, i)
Definition gia.h:1157
#define Gia_LutForEachFanin(p, i, iFan, k)
Definition gia.h:1161
#define Gia_ManForEachCo(p, pObj, i)
Definition gia.h:1236
int Gia_ManLevelNum(Gia_Man_t *p)
Definition giaUtil.c:546
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManHighlight_rec()

ABC_NAMESPACE_IMPL_START void Gia_ManHighlight_rec ( Gia_Man_t * p,
int iObj )

DECLARATIONS ///.

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

FileName [giaSopb.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis [SOP balancing for a window.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id
giaSopb.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file giaBalMap.c.

46{
47 Gia_Obj_t * pObj;
48 if ( Gia_ObjIsTravIdCurrentId(p, iObj) )
49 return;
50 Gia_ObjSetTravIdCurrentId(p, iObj);
51 pObj = Gia_ManObj( p, iObj );
52 if ( Gia_ObjIsAnd(pObj) )
53 Gia_ManHighlight_rec( p, Gia_ObjFaninId0(pObj, iObj) );
54 if ( Gia_ObjIsAnd(pObj) )
55 Gia_ManHighlight_rec( p, Gia_ObjFaninId1(pObj, iObj) );
56}
ABC_NAMESPACE_IMPL_START void Gia_ManHighlight_rec(Gia_Man_t *p, int iObj)
DECLARATIONS ///.
Definition giaBalMap.c:45
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManInsertWin()

Gia_Man_t * Gia_ManInsertWin ( Gia_Man_t * p,
Vec_Int_t * vOuts,
Gia_Man_t * pWin )

Definition at line 136 of file giaBalMap.c.

137{
138 Vec_Int_t * vPos, * vPis, * vAnds;
139 Gia_Man_t * pNew, * pTemp;
140 Gia_Obj_t * pObj;
141 int i;
142 Gia_ManPrepareWin( p, vOuts, &vPis, &vPos, &vAnds, 0 );
143 // create AIG
144 pNew = Gia_ManStart( Gia_ManObjNum(p) - Vec_IntSize(vAnds) + Gia_ManAndNum(pWin) );
145 pNew->pName = Abc_UtilStrsav( p->pName );
146 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
147 // inputs
148 Gia_ManConst0(p)->Value = 0;
149 Gia_ManForEachCi( p, pObj, i )
150 pObj->Value = Gia_ManAppendCi( pNew );
151 Gia_ManConst0(pWin)->Value = 0;
152 Gia_ManForEachCi( pWin, pObj, i )
153 pObj->Value = Gia_ManObj(p, Vec_IntEntry(vPis, i))->Value;
154 // internal nodes
155 Gia_ManHashAlloc( pNew );
156 Gia_ManForEachAnd( pWin, pObj, i )
157 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
158 Gia_ManForEachCo( pWin, pObj, i )
159 Gia_ManObj( p, Vec_IntEntry(vPos, i) )->Value = Gia_ObjFanin0Copy(pObj);
160 Gia_ManForEachAnd( p, pObj, i )
161 if ( !Gia_ObjIsTravIdCurrentId(p, i) )
162 pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
163 Gia_ManForEachCo( p, pObj, i )
164 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
165 Gia_ManHashStop( pNew );
166 // cleanup
167 Vec_IntFree( vPis );
168 Vec_IntFree( vPos );
169 Vec_IntFree( vAnds );
170 pNew = Gia_ManCleanup( pTemp = pNew );
171 Gia_ManStop( pTemp );
172 return pNew;
173}
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
#define Gia_ManForEachAnd(p, pObj, i)
Definition gia.h:1214
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition giaHash.c:105
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition giaScl.c:84
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:576
#define Gia_ManForEachCi(p, pObj, i)
Definition gia.h:1228
void Gia_ManHashStop(Gia_Man_t *p)
Definition giaHash.c:149
char * pSpec
Definition gia.h:100
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManPerformDsdBalanceWin()

Gia_Man_t * Gia_ManPerformDsdBalanceWin ( Gia_Man_t * p,
int LevelMax,
int nTimeWindow,
int nLutSize,
int nCutNum,
int nRelaxRatio,
int fVerbose )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 298 of file giaBalMap.c.

299{
300 Vec_Int_t * vOuts;
301 Gia_Man_t * pNew, * pWin, * pWinNew;
302 assert( !LevelMax != !nTimeWindow );
303 vOuts = Gia_ManFindLatest( p, LevelMax, nTimeWindow );
304 if ( fVerbose )
305 printf( "Collected %d outputs to extract.\n", Vec_IntSize(vOuts) );
306 if ( Vec_IntSize(vOuts) == 0 )
307 {
308 Vec_IntFree( vOuts );
309 return Gia_ManDup( p );
310 }
311 pWin = Gia_ManExtractWin( p, vOuts, 0 );
312 pWinNew = Gia_ManPerformDsdBalance( pWin, nLutSize, nCutNum, nRelaxRatio, fVerbose );
313 Gia_ManStop( pWin );
314 pNew = Gia_ManInsertWin( p, vOuts, pWinNew );
315 Gia_ManStop( pWinNew );
316 Vec_IntFree( vOuts );
317 return pNew;
318}
Gia_Man_t * Gia_ManInsertWin(Gia_Man_t *p, Vec_Int_t *vOuts, Gia_Man_t *pWin)
Definition giaBalMap.c:136
Gia_Man_t * Gia_ManPerformDsdBalance(Gia_Man_t *p, int nLutSize, int nCutNum, int nRelaxRatio, int fVerbose)
Definition giaIf.c:2678
Here is the call graph for this function:

◆ Gia_ManPerformSopBalanceWin()

Gia_Man_t * Gia_ManPerformSopBalanceWin ( Gia_Man_t * p,
int LevelMax,
int nTimeWindow,
int nCutNum,
int nRelaxRatio,
int fVerbose )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 265 of file giaBalMap.c.

266{
267 Vec_Int_t * vOuts;
268 Gia_Man_t * pNew, * pWin, * pWinNew;
269 assert( !LevelMax != !nTimeWindow );
270 vOuts = Gia_ManFindLatest( p, LevelMax, nTimeWindow );
271 if ( fVerbose )
272 printf( "Collected %d outputs to extract.\n", Vec_IntSize(vOuts) );
273 if ( Vec_IntSize(vOuts) == 0 )
274 {
275 Vec_IntFree( vOuts );
276 return Gia_ManDup( p );
277 }
278 pWin = Gia_ManExtractWin( p, vOuts, 0 );
279 pWinNew = Gia_ManPerformSopBalance( pWin, nCutNum, nRelaxRatio, fVerbose );
280 Gia_ManStop( pWin );
281 pNew = Gia_ManInsertWin( p, vOuts, pWinNew );
282 Gia_ManStop( pWinNew );
283 Vec_IntFree( vOuts );
284 return pNew;
285}
Gia_Man_t * Gia_ManPerformSopBalance(Gia_Man_t *p, int nCutNum, int nRelaxRatio, int fVerbose)
Definition giaIf.c:2651
Here is the call graph for this function:

◆ Gia_ManPrepareWin()

void Gia_ManPrepareWin ( Gia_Man_t * p,
Vec_Int_t * vOuts,
Vec_Int_t ** pvPis,
Vec_Int_t ** pvPos,
Vec_Int_t ** pvAnds,
int fPoOnly )

Definition at line 57 of file giaBalMap.c.

58{
59 Gia_Obj_t * pObj;
60 int i;
61 // mark the section
63 Gia_ManForEachCoVec( vOuts, p, pObj, i )
64 Gia_ManHighlight_rec( p, Gia_ObjFaninId0p(p, pObj) );
65 // mark fanins of the outside area
67 if ( fPoOnly )
68 {
69 Gia_ManForEachCoVec( vOuts, p, pObj, i )
70 Gia_ObjFanin0(pObj)->fMark0 = 1;
71 }
72 else
73 {
74 Gia_ManForEachObj1( p, pObj, i )
75 {
76 if ( Gia_ObjIsCi(pObj) )
77 continue;
78 if ( Gia_ObjIsAnd(pObj) && !Gia_ObjIsTravIdCurrentId(p, i) )
79 continue;
80 Gia_ObjFanin0(pObj)->fMark0 = 1;
81 if ( Gia_ObjIsAnd(pObj) )
82 Gia_ObjFanin1(pObj)->fMark0 = 1;
83 }
84 }
85 // collect pointed nodes
86 *pvPis = Vec_IntAlloc( 1000 );
87 *pvPos = Vec_IntAlloc( 1000 );
88 *pvAnds = Vec_IntAlloc( 1000 );
89 Gia_ManForEachObj1( p, pObj, i )
90 {
91 if ( !Gia_ObjIsTravIdCurrentId(p, i) )
92 continue;
93 if ( Gia_ObjIsCi(pObj) )
94 Vec_IntPush( *pvPis, i );
95 else if ( pObj->fMark0 )
96 Vec_IntPush( *pvPos, i );
97 if ( Gia_ObjIsAnd(pObj) )
98 Vec_IntPush( *pvAnds, i );
99 }
101}
#define Gia_ManForEachCoVec(vVec, p, pObj, i)
Definition gia.h:1238
#define Gia_ManForEachObj1(p, pObj, i)
Definition gia.h:1192
void Gia_ManCleanMark0(Gia_Man_t *p)
Definition giaUtil.c:256
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition giaUtil.c:190
unsigned fMark0
Definition gia.h:81
Here is the call graph for this function:
Here is the caller graph for this function: