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

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START int Gia_ManCombMarkUsed_rec (Gia_Man_t *p, Gia_Obj_t *pObj)
 DECLARATIONS ///.
 
int Gia_ManCombMarkUsed (Gia_Man_t *p)
 
Gia_Man_tGia_ManCleanup (Gia_Man_t *p)
 
Gia_Man_tGia_ManCleanupOutputs (Gia_Man_t *p, int nOutputs)
 
int Gia_ManSeqMarkUsed_rec (Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vRoots)
 
int Gia_ManSeqMarkUsed (Gia_Man_t *p)
 
Gia_Man_tGia_ManSeqCleanup (Gia_Man_t *p)
 
Gia_Man_tGia_ManReduceEquiv (Gia_Man_t *p, int fVerbose)
 
Gia_Man_tGia_ManSeqStructSweep (Gia_Man_t *p, int fConst, int fEquiv, int fVerbose)
 

Function Documentation

◆ Gia_ManCleanup()

Gia_Man_t * Gia_ManCleanup ( Gia_Man_t * p)

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

Synopsis [Performs combinational cleanup.]

Description []

SideEffects []

SeeAlso []

Definition at line 84 of file giaScl.c.

85{
87 return Gia_ManDupMarked( p );
88}
Cube * p
Definition exorList.c:222
int Gia_ManCombMarkUsed(Gia_Man_t *p)
Definition giaScl.c:60
Gia_Man_t * Gia_ManDupMarked(Gia_Man_t *p)
Definition giaDup.c:1444
Here is the call graph for this function:

◆ Gia_ManCleanupOutputs()

Gia_Man_t * Gia_ManCleanupOutputs ( Gia_Man_t * p,
int nOutputs )

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

Synopsis [Skip the first outputs during cleanup.]

Description []

SideEffects []

SeeAlso []

Definition at line 101 of file giaScl.c.

102{
103 Gia_Obj_t * pObj;
104 int i;
105 assert( Gia_ManRegNum(p) == 0 );
106 assert( nOutputs < Gia_ManCoNum(p) );
108 Gia_ManForEachCo( p, pObj, i )
109 if ( i < nOutputs )
110 pObj->fMark0 = 1;
111 else
112 break;
113 return Gia_ManDupMarked( p );
114}
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
#define Gia_ManForEachCo(p, pObj, i)
Definition gia.h:1236
unsigned fMark0
Definition gia.h:81
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManCombMarkUsed()

int Gia_ManCombMarkUsed ( Gia_Man_t * p)

Definition at line 60 of file giaScl.c.

61{
62 Gia_Obj_t * pObj;
63 int i, nNodes = 0;
64 Gia_ManForEachObj( p, pObj, i )
65 pObj->fMark0 = Gia_ObjIsAnd(pObj) && !Gia_ObjIsBuf(pObj);
66 Gia_ManForEachBuf( p, pObj, i )
67 nNodes += Gia_ManCombMarkUsed_rec( p, Gia_ObjFanin0(pObj) );
68 Gia_ManForEachCo( p, pObj, i )
69 nNodes += Gia_ManCombMarkUsed_rec( p, Gia_ObjFanin0(pObj) );
70 return nNodes;
71}
ABC_NAMESPACE_IMPL_START int Gia_ManCombMarkUsed_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
DECLARATIONS ///.
Definition giaScl.c:45
#define Gia_ManForEachBuf(p, pObj, i)
Definition gia.h:1210
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition gia.h:1190
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManCombMarkUsed_rec()

ABC_NAMESPACE_IMPL_START int Gia_ManCombMarkUsed_rec ( Gia_Man_t * p,
Gia_Obj_t * pObj )

DECLARATIONS ///.

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

FileName [giaScl.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis [Sequential cleanup.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Marks unreachable internal nodes and returns their number.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file giaScl.c.

46{
47 if ( pObj == NULL )
48 return 0;
49 if ( !pObj->fMark0 )
50 return 0;
51 pObj->fMark0 = 0;
52 assert( Gia_ObjIsAnd(pObj) );
53 assert( !Gia_ObjIsBuf(pObj) );
54 return 1 + Gia_ManCombMarkUsed_rec( p, Gia_ObjFanin0(pObj) )
55 + Gia_ManCombMarkUsed_rec( p, Gia_ObjFanin1(pObj) )
56 + (p->pNexts ? Gia_ManCombMarkUsed_rec( p, Gia_ObjNextObj(p, Gia_ObjId(p, pObj)) ) : 0)
57 + (p->pSibls ? Gia_ManCombMarkUsed_rec( p, Gia_ObjSiblObj(p, Gia_ObjId(p, pObj)) ) : 0)
58 + (p->pMuxes ? Gia_ManCombMarkUsed_rec( p, Gia_ObjFanin2(p, pObj) ) : 0);
59}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManReduceEquiv()

Gia_Man_t * Gia_ManReduceEquiv ( Gia_Man_t * p,
int fVerbose )

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

Synopsis [Find representatives due to identical fanins.]

Description [Returns the old manager if there is no changes.]

SideEffects []

SeeAlso []

Definition at line 200 of file giaScl.c.

201{
202 Gia_Man_t * pNew;
203 Gia_Obj_t * pObjRi, * pObjRo;
204 unsigned * pCi2Lit, * pMaps;
205 int i, iLit, nFanins = 1, Counter0 = 0, Counter = 0;
206 Gia_ManForEachRi( p, pObjRi, i )
207 Gia_ObjFanin0(pObjRi)->Value = 0;
208 Gia_ManForEachRi( p, pObjRi, i )
209 if ( Gia_ObjFanin0(pObjRi)->Value == 0 )
210 Gia_ObjFanin0(pObjRi)->Value = 2*nFanins++;
211 pCi2Lit = ABC_FALLOC( unsigned, Gia_ManCiNum(p) );
212 pMaps = ABC_FALLOC( unsigned, 2 * nFanins );
213 Gia_ManForEachRiRo( p, pObjRi, pObjRo, i )
214 {
215 iLit = Gia_ObjFanin0Copy( pObjRi );
216 if ( Gia_ObjFaninId0p(p, pObjRi) == 0 && Gia_ObjFaninC0(pObjRi) == 0 ) // const 0
217 pCi2Lit[Gia_ManPiNum(p)+i] = 0, Counter0++;
218 else if ( ~pMaps[iLit] ) // in this case, ID(pObj) > ID(pRepr)
219 pCi2Lit[Gia_ManPiNum(p)+i] = pMaps[iLit], Counter++;
220 else
221 pMaps[iLit] = Abc_Var2Lit( Gia_ObjId(p, pObjRo), 0 );
222 }
223/*
224 Gia_ManForEachCi( p, pObjRo, i )
225 {
226 if ( ~pCi2Lit[i] )
227 {
228 Gia_Obj_t * pObj0 = Gia_ObjRoToRi(p, pObjRo);
229 Gia_Obj_t * pObj1 = Gia_ObjRoToRi(p, Gia_ManObj(p, pCi2Lit[i]));
230 Gia_Obj_t * pFan0 = Gia_ObjChild0( p, Gia_ObjRoToRi(p, pObjRo) );
231 Gia_Obj_t * pFan1 = Gia_ObjChild0( p, Gia_ObjRoToRi(p, Gia_ManObj(p, pCi2Lit[i])) );
232 assert( pFan0 == pFan1 );
233 }
234 }
235*/
236// if ( fVerbose )
237// printf( "ReduceEquiv detected %d constant regs and %d equivalent regs.\n", Counter0, Counter );
238 ABC_FREE( pMaps );
239 if ( Counter0 || Counter )
240 pNew = Gia_ManDupDfsCiMap( p, (int *)pCi2Lit, NULL );
241 else
242 pNew = p;
243 ABC_FREE( pCi2Lit );
244 return pNew;
245}
#define ABC_FALLOC(type, num)
Definition abc_global.h:266
#define ABC_FREE(obj)
Definition abc_global.h:267
Gia_Man_t * Gia_ManDupDfsCiMap(Gia_Man_t *p, int *pCi2Lit, Vec_Int_t *vLits)
Definition giaDup.c:2708
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
#define Gia_ManForEachRiRo(p, pObjRi, pObjRo, i)
Definition gia.h:1256
#define Gia_ManForEachRi(p, pObj, i)
Definition gia.h:1254
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManSeqCleanup()

Gia_Man_t * Gia_ManSeqCleanup ( Gia_Man_t * p)

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

Synopsis [Performs sequential cleanup.]

Description []

SideEffects []

SeeAlso []

Definition at line 183 of file giaScl.c.

184{
186 return Gia_ManDupMarked( p );
187}
int Gia_ManSeqMarkUsed(Gia_Man_t *p)
Definition giaScl.c:156
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManSeqMarkUsed()

int Gia_ManSeqMarkUsed ( Gia_Man_t * p)

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

Synopsis [Marks CIs/COs/ANDs unreachable from POs.]

Description []

SideEffects []

SeeAlso []

Definition at line 156 of file giaScl.c.

157{
158 Vec_Int_t * vRoots;
159 Gia_Obj_t * pObj;
160 int i, nNodes = 0;
162 Gia_ManConst0(p)->fMark0 = 0;
163 Gia_ManForEachPi( p, pObj, i )
164 pObj->fMark0 = 0;
165 vRoots = Gia_ManCollectPoIds( p );
166 Gia_ManForEachObjVec( vRoots, p, pObj, i )
167 nNodes += Gia_ManSeqMarkUsed_rec( p, pObj, vRoots );
168 Vec_IntFree( vRoots );
169 return nNodes;
170}
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
int Gia_ManSeqMarkUsed_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vRoots)
Definition giaScl.c:128
Vec_Int_t * Gia_ManCollectPoIds(Gia_Man_t *p)
Definition giaUtil.c:960
#define Gia_ManForEachPi(p, pObj, i)
Definition gia.h:1248
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition gia.h:1194
void Gia_ManSetMark0(Gia_Man_t *p)
Definition giaUtil.c:237
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManSeqMarkUsed_rec()

int Gia_ManSeqMarkUsed_rec ( Gia_Man_t * p,
Gia_Obj_t * pObj,
Vec_Int_t * vRoots )

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

Synopsis [Marks CIs/COs/ANDs unreachable from POs.]

Description []

SideEffects []

SeeAlso []

Definition at line 128 of file giaScl.c.

129{
130 if ( !pObj->fMark0 )
131 return 0;
132 pObj->fMark0 = 0;
133 if ( Gia_ObjIsCo(pObj) )
134 return Gia_ManSeqMarkUsed_rec( p, Gia_ObjFanin0(pObj), vRoots );
135 if ( Gia_ObjIsRo(p, pObj) )
136 {
137 Vec_IntPush( vRoots, Gia_ObjId(p, Gia_ObjRoToRi(p, pObj)) );
138 return 0;
139 }
140 assert( Gia_ObjIsAnd(pObj) );
141 return 1 + Gia_ManSeqMarkUsed_rec( p, Gia_ObjFanin0(pObj), vRoots )
142 + Gia_ManSeqMarkUsed_rec( p, Gia_ObjFanin1(pObj), vRoots );
143}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManSeqStructSweep()

Gia_Man_t * Gia_ManSeqStructSweep ( Gia_Man_t * p,
int fConst,
int fEquiv,
int fVerbose )

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

Synopsis [Performs sequential cleanup.]

Description []

SideEffects []

SeeAlso []

Definition at line 258 of file giaScl.c.

259{
260 Gia_Man_t * pTemp;
261 if ( Gia_ManRegNum(p) == 0 )
262 return Gia_ManCleanup( p );
263 if ( fVerbose )
264 printf( "Performing sequential cleanup.\n" );
265 p = Gia_ManSeqCleanup( pTemp = p );
266 if ( fVerbose )
267 Gia_ManReportImprovement( pTemp, p );
268 if ( fConst && Gia_ManRegNum(p) )
269 {
270 p = Gia_ManReduceConst( pTemp = p, fVerbose );
271 if ( fVerbose )
272 Gia_ManReportImprovement( pTemp, p );
273 Gia_ManStop( pTemp );
274 }
275 if ( fVerbose && fEquiv )
276 printf( "Merging combinationally equivalent flops.\n" );
277 if ( fEquiv )
278 while ( 1 )
279 {
280 p = Gia_ManSeqCleanup( pTemp = p );
281 if ( fVerbose )
282 Gia_ManReportImprovement( pTemp, p );
283 Gia_ManStop( pTemp );
284 if ( Gia_ManRegNum(p) == 0 )
285 break;
286 p = Gia_ManReduceEquiv( pTemp = p, fVerbose );
287 if ( p == pTemp )
288 break;
289 Gia_ManStop( pTemp );
290 }
291 return p;
292}
Gia_Man_t * Gia_ManReduceEquiv(Gia_Man_t *p, int fVerbose)
Definition giaScl.c:200
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition giaScl.c:84
Gia_Man_t * Gia_ManSeqCleanup(Gia_Man_t *p)
Definition giaScl.c:183
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
void Gia_ManReportImprovement(Gia_Man_t *p, Gia_Man_t *pNew)
Definition giaMan.c:782
Gia_Man_t * Gia_ManReduceConst(Gia_Man_t *pAig, int fVerbose)
Definition giaTsim.c:737
Here is the call graph for this function:
Here is the caller graph for this function: