ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
cgtInt.h File Reference
#include "aig/saig/saig.h"
#include "sat/bsat/satSolver.h"
#include "sat/cnf/cnf.h"
#include "cgt.h"
Include dependency graph for cgtInt.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Cgt_Man_t_
 

Typedefs

typedef typedefABC_NAMESPACE_HEADER_START struct Cgt_Man_t_ Cgt_Man_t
 INCLUDES ///.
 

Functions

void Cgt_ManDetectCandidates (Aig_Man_t *pAig, Vec_Int_t *vUseful, Aig_Obj_t *pObj, int nLevelMax, Vec_Ptr_t *vCands)
 MACRO DEFINITIONS ///.
 
Aig_Man_tCgt_ManDeriveAigForGating (Cgt_Man_t *p)
 
Aig_Man_tCgt_ManDupPartition (Aig_Man_t *pAig, int nVarsMin, int nFlopsMin, int iStart, Aig_Man_t *pCare, Vec_Vec_t *vSuppsInv, int *pnOutputs)
 
Aig_Man_tCgt_ManDeriveGatedAig (Aig_Man_t *pAig, Vec_Vec_t *vGates, int fReduce, int *pnUsedNodes)
 
Vec_Vec_tCgt_ManDecideSimple (Aig_Man_t *pAig, Vec_Vec_t *vGatesAll, int nOdcMax, int fVerbose)
 
Vec_Vec_tCgt_ManDecideArea (Aig_Man_t *pAig, Vec_Vec_t *vGatesAll, int nOdcMax, int fVerbose)
 
Cgt_Man_tCgt_ManCreate (Aig_Man_t *pAig, Aig_Man_t *pCare, Cgt_Par_t *pPars)
 DECLARATIONS ///.
 
void Cgt_ManClean (Cgt_Man_t *p)
 
void Cgt_ManStop (Cgt_Man_t *p)
 
int Cgt_CheckImplication (Cgt_Man_t *p, Aig_Obj_t *pGate, Aig_Obj_t *pFlop)
 DECLARATIONS ///.
 

Typedef Documentation

◆ Cgt_Man_t

typedef typedefABC_NAMESPACE_HEADER_START struct Cgt_Man_t_ Cgt_Man_t

INCLUDES ///.

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

FileName [cgtInt.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Clock gating package.]

Synopsis [Internal declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

Id
cgtInt.h,v 1.00 2005/06/20 00:00:00 alanmi Exp

] PARAMETERS /// BASIC TYPES ///

Definition at line 47 of file cgtInt.h.

Function Documentation

◆ Cgt_CheckImplication()

int Cgt_CheckImplication ( Cgt_Man_t * p,
Aig_Obj_t * pGate,
Aig_Obj_t * pMiter )
extern

DECLARATIONS ///.

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

FileName [cgtSat.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Clock gating package.]

Synopsis [Checking implications using SAT.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Runs equivalence test for the two nodes.]

Description [Both nodes should be regular and different from each other.]

SideEffects []

SeeAlso []

Definition at line 46 of file cgtSat.c.

47{
48 int nBTLimit = p->pPars->nConfMax;
49 int pLits[2], RetValue;
50 abctime clk;
51 p->nCalls++;
52
53 // sanity checks
54 assert( p->pSat && p->pCnf );
55 assert( !Aig_IsComplement(pMiter) );
56 assert( Aig_Regular(pGate) != pMiter );
57
58 // solve under assumptions
59 // G => !M -- true G & M -- false
60 pLits[0] = toLitCond( p->pCnf->pVarNums[Aig_Regular(pGate)->Id], Aig_IsComplement(pGate) );
61 pLits[1] = toLitCond( p->pCnf->pVarNums[pMiter->Id], 0 );
62
63clk = Abc_Clock();
64 RetValue = sat_solver_solve( p->pSat, pLits, pLits + 2, (ABC_INT64_T)nBTLimit, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
65p->timeSat += Abc_Clock() - clk;
66 if ( RetValue == l_False )
67 {
68p->timeSatUnsat += Abc_Clock() - clk;
69 pLits[0] = lit_neg( pLits[0] );
70 pLits[1] = lit_neg( pLits[1] );
71 RetValue = sat_solver_addclause( p->pSat, pLits, pLits + 2 );
72 assert( RetValue );
73 sat_solver_compress( p->pSat );
74 p->nCallsUnsat++;
75 return 1;
76 }
77 else if ( RetValue == l_True )
78 {
79p->timeSatSat += Abc_Clock() - clk;
80 p->nCallsSat++;
81 return 0;
82 }
83 else // if ( RetValue1 == l_Undef )
84 {
85p->timeSatUndec += Abc_Clock() - clk;
86 p->nCallsUndec++;
87 return -1;
88 }
89 return -2;
90}
ABC_INT64_T abctime
Definition abc_global.h:332
#define l_True
Definition bmcBmcS.c:35
#define l_False
Definition bmcBmcS.c:36
#define sat_solver_addclause
Definition cecSatG2.c:37
#define sat_solver_solve
Definition cecSatG2.c:45
Cube * p
Definition exorList.c:222
int Id
Definition aig.h:85
#define assert(ex)
Definition util_old.h:213
Here is the caller graph for this function:

◆ Cgt_ManClean()

void Cgt_ManClean ( Cgt_Man_t * p)
extern

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

Synopsis [Creates the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 86 of file cgtMan.c.

87{
88 if ( p->pPart )
89 {
90 Aig_ManStop( p->pPart );
91 p->pPart = NULL;
92 }
93 if ( p->pCnf )
94 {
95 Cnf_DataFree( p->pCnf );
96 p->pCnf = NULL;
97 }
98 if ( p->pSat )
99 {
100 sat_solver_delete( p->pSat );
101 p->pSat = NULL;
102 }
103 if ( p->vPatts )
104 {
105 Vec_PtrFree( p->vPatts );
106 p->vPatts = NULL;
107 }
108}
void Aig_ManStop(Aig_Man_t *p)
Definition aigMan.c:187
void Cnf_DataFree(Cnf_Dat_t *p)
Definition cnfMan.c:207
void sat_solver_delete(sat_solver *s)
Definition satSolver.c:1341
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Cgt_ManCreate()

Cgt_Man_t * Cgt_ManCreate ( Aig_Man_t * pAig,
Aig_Man_t * pCare,
Cgt_Par_t * pPars )
extern

DECLARATIONS ///.

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

FileName [cgtMan.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Clock gating package.]

Synopsis [Manipulation of clock gating manager.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Creates the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file cgtMan.c.

46{
47 Cgt_Man_t * p;
48 // prepare the sequential AIG
49 assert( Saig_ManRegNum(pAig) > 0 );
50 Aig_ManFanoutStart( pAig );
51 Aig_ManSetCioIds( pAig );
52 // create interpolation manager
53 p = ABC_ALLOC( Cgt_Man_t, 1 );
54 memset( p, 0, sizeof(Cgt_Man_t) );
55 p->pPars = pPars;
56 p->pAig = pAig;
57 p->vGatesAll = Vec_VecStart( Saig_ManRegNum(pAig) );
58 p->vFanout = Vec_PtrAlloc( 1000 );
59 p->vVisited = Vec_PtrAlloc( 1000 );
60 p->nPattWords = 16;
61 if ( pCare == NULL )
62 return p;
63 // check out the constraints
64 if ( Aig_ManCiNum(pCare) != Aig_ManCiNum(pAig) )
65 {
66 printf( "The PI count of care (%d) and AIG (%d) differ. Careset is not used.\n",
67 Aig_ManCiNum(pCare), Aig_ManCiNum(pAig) );
68 return p;
69 }
70 p->pCare = pCare;
71 p->vSuppsInv = (Vec_Vec_t *)Aig_ManSupportsInverse( p->pCare );
72 return p;
73}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
void Aig_ManFanoutStart(Aig_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition aigFanout.c:56
void Aig_ManSetCioIds(Aig_Man_t *p)
Definition aigUtil.c:978
Vec_Ptr_t * Aig_ManSupportsInverse(Aig_Man_t *p)
Definition aigPart.c:385
typedefABC_NAMESPACE_HEADER_START struct Cgt_Man_t_ Cgt_Man_t
INCLUDES ///.
Definition cgtInt.h:47
char * memset()
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition vecVec.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Cgt_ManDecideArea()

Vec_Vec_t * Cgt_ManDecideArea ( Aig_Man_t * pAig,
Vec_Vec_t * vGatesAll,
int nOdcMax,
int fVerbose )
extern

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

Synopsis [Computes the set of complete clock gates.]

Description []

SideEffects []

SeeAlso []

Definition at line 255 of file cgtDecide.c.

256{
257 Vec_Vec_t * vGates;
258 Vec_Ptr_t * vCompletes, * vOne;
259 Aig_Obj_t * pGate;
260 int i, k, Counter = 0;
261 abctime clk = Abc_Clock();
262 // derive and label complete gates
263 vCompletes = Cgt_ManCompleteGates( pAig, vGatesAll, nOdcMax, fVerbose );
264 // label complete gates
265 Vec_PtrForEachEntry( Aig_Obj_t *, vCompletes, pGate, i )
266 Aig_Regular(pGate)->fMarkA = 1;
267 // select only complete gates
268 vGates = Vec_VecStart( Saig_ManRegNum(pAig) );
269 Vec_VecForEachEntry( Aig_Obj_t *, vGatesAll, pGate, i, k )
270 if ( Aig_Regular(pGate)->fMarkA )
271 Vec_VecPush( vGates, i, pGate );
272 // unlabel complete gates
273 Vec_PtrForEachEntry( Aig_Obj_t *, vCompletes, pGate, i )
274 Aig_Regular(pGate)->fMarkA = 0;
275 // count the number of gated flops
276 Vec_VecForEachLevel( vGates, vOne, i )
277 {
278 Counter += (int)(Vec_PtrSize(vOne) > 0);
279// printf( "%d ", Vec_PtrSize(vOne) );
280 }
281// printf( "\n" );
282 if ( fVerbose )
283 {
284 printf( "Gating signals = %6d. Gated flops = %6d. (Total flops = %6d.)\n",
285 Vec_VecSizeSize(vGatesAll), Counter, Saig_ManRegNum(pAig) );
286 printf( "Complete gates = %6d. Gated transitions = %5.2f %%. ",
287 Vec_PtrSize(vCompletes), Cgt_ManComputeCoverage(pAig, vGates) );
288 ABC_PRT( "Time", Abc_Clock() - clk );
289 }
290 Vec_PtrFree( vCompletes );
291 return vGates;
292}
#define ABC_PRT(a, t)
Definition abc_global.h:255
struct Aig_Obj_t_ Aig_Obj_t
Definition aig.h:51
Vec_Ptr_t * Cgt_ManCompleteGates(Aig_Man_t *pAig, Vec_Vec_t *vGatesAll, int nOdcMax, int fVerbose)
Definition cgtDecide.c:124
float Cgt_ManComputeCoverage(Aig_Man_t *pAig, Vec_Vec_t *vGates)
Definition cgtDecide.c:158
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
#define Vec_VecForEachEntry(Type, vGlob, pEntry, i, k)
Definition vecVec.h:87
#define Vec_VecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
Definition vecVec.h:55
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Cgt_ManDecideSimple()

Vec_Vec_t * Cgt_ManDecideSimple ( Aig_Man_t * pAig,
Vec_Vec_t * vGatesAll,
int nOdcMax,
int fVerbose )
extern

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

Synopsis [Chooses what clock-gate to use for this register.]

Description [Currently uses the naive approach: For each register, choose the clock gate, which covers most of the transitions.]

SideEffects []

SeeAlso []

Definition at line 184 of file cgtDecide.c.

185{
186 int nFrames = 32;
187 int nWords = 1;
188 Ssw_Sml_t * pSml;
189 Vec_Vec_t * vGates;
190 Vec_Ptr_t * vCands;
191 Aig_Obj_t * pObjLi, * pObjLo, * pCand, * pCandBest;
192 int i, k, nHitsCur, nHitsMax, Counter = 0;
193 abctime clk = Abc_Clock();
194 int nTransTotal = 0, nTransSaved = 0;
195 vGates = Vec_VecStart( Saig_ManRegNum(pAig) );
196 pSml = Ssw_SmlSimulateSeq( pAig, 0, nFrames, nWords );
197 Saig_ManForEachLiLo( pAig, pObjLi, pObjLo, i )
198 {
199 nHitsMax = 0;
200 pCandBest = NULL;
201 vCands = Vec_VecEntry( vGatesAll, i );
202 Vec_PtrForEachEntry( Aig_Obj_t *, vCands, pCand, k )
203 {
204 // check if this is indeed a clock-gate
205 if ( nOdcMax == 0 && !Ssw_SmlCheckXorImplication( pSml, pObjLi, pObjLo, pCand ) )
206 printf( "Clock gate candidate is invalid!\n" );
207 // find its characteristic number
208 nHitsCur = Ssw_SmlNodeCountOnesReal( pSml, pCand );
209 if ( nHitsMax < nHitsCur )
210 {
211 nHitsMax = nHitsCur;
212 pCandBest = pCand;
213 }
214 }
215 if ( pCandBest != NULL )
216 {
217 Vec_VecPush( vGates, i, pCandBest );
218 Counter++;
219 nTransSaved += nHitsMax;
220 }
221 nTransTotal += 32 * nFrames * nWords;
222 }
223 Ssw_SmlStop( pSml );
224 if ( fVerbose )
225 {
226 printf( "Gating signals = %6d. Gated flops = %6d. (Total flops = %6d.)\n",
227 Vec_VecSizeSize(vGatesAll), Counter, Saig_ManRegNum(pAig) );
228// printf( "Gated transitions = %5.2f %%. (%5.2f %%.) ",
229// 100.0*nTransSaved/nTransTotal, Cgt_ManComputeCoverage(pAig, vGates) );
230 printf( "Gated transitions = %5.2f %%. ", Cgt_ManComputeCoverage(pAig, vGates) );
231 ABC_PRT( "Time", Abc_Clock() - clk );
232 }
233/*
234 {
235 Vec_Ptr_t * vCompletes;
236 vCompletes = Cgt_ManCompleteGates( pAig, vGatesAll, nOdcMax, fVerbose );
237 printf( "Complete gates = %d. \n", Vec_PtrSize(vCompletes) );
238 Vec_PtrFree( vCompletes );
239 }
240*/
241 return vGates;
242}
int nWords
Definition abcNpn.c:127
int Ssw_SmlNodeCountOnesReal(Ssw_Sml_t *p, Aig_Obj_t *pObj)
Definition sswSim.c:333
ABC_NAMESPACE_IMPL_START int Ssw_SmlCheckXorImplication(Ssw_Sml_t *p, Aig_Obj_t *pObjLi, Aig_Obj_t *pObjLo, Aig_Obj_t *pCand)
DECLARATIONS ///.
Definition sswSim.c:202
#define Saig_ManForEachLiLo(p, pObjLi, pObjLo, i)
Definition saig.h:101
struct Ssw_Sml_t_ Ssw_Sml_t
Definition ssw.h:120
Ssw_Sml_t * Ssw_SmlSimulateSeq(Aig_Man_t *pAig, int nPref, int nFrames, int nWords)
Definition sswSim.c:1248
void Ssw_SmlStop(Ssw_Sml_t *p)
Definition sswSim.c:1211
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Cgt_ManDeriveAigForGating()

Aig_Man_t * Cgt_ManDeriveAigForGating ( Cgt_Man_t * p)
extern

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

Synopsis [Derives AIG for clock-gating.]

Description []

SideEffects []

SeeAlso []

Definition at line 266 of file cgtAig.c.

267{
268 Aig_Man_t * pNew;
269 Aig_Obj_t * pObj, * pObjLi, * pObjLo, * pCare, * pMiter;
270 Vec_Ptr_t * vCopy0, * vCopy1;
271 int i;
272 assert( Aig_ManRegNum(p->pAig) );
273 pNew = Aig_ManStart( Aig_ManObjNumMax(p->pAig) );
274 pNew->pName = Abc_UtilStrsav( "CG_miter" );
275 // build the first frame
276 Aig_ManConst1(p->pAig)->pData = Aig_ManConst1(pNew);
277 Aig_ManForEachCi( p->pAig, pObj, i )
278 pObj->pData = Aig_ObjCreateCi( pNew );
279 Aig_ManForEachNode( p->pAig, pObj, i )
280 pObj->pData = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
281// Saig_ManForEachPo( p->pAig, pObj, i )
282// pObj->pData = Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
283 if ( p->pPars->nOdcMax > 0 )
284 {
285 // create storage for observability conditions
286 vCopy0 = Vec_PtrStart( Aig_ManObjNumMax(p->pAig) );
287 vCopy1 = Vec_PtrStart( Aig_ManObjNumMax(p->pAig) );
288 // initialize register outputs
289 Saig_ManForEachLiLo( p->pAig, pObjLi, pObjLo, i )
290 {
291 Vec_PtrWriteEntry( vCopy0, Aig_ObjId(pObjLo), Aig_ObjChild0Copy(pObjLi) );
292 Vec_PtrWriteEntry( vCopy1, Aig_ObjId(pObjLo), Aig_ObjChild0Copy(pObjLi) );
293 }
294 // compute observability condition for each latch output
295 Saig_ManForEachLiLo( p->pAig, pObjLi, pObjLo, i )
296 {
297 // set the constants
298 Vec_PtrWriteEntry( vCopy0, Aig_ObjId(pObjLo), Aig_ManConst0(pNew) );
299 Vec_PtrWriteEntry( vCopy1, Aig_ObjId(pObjLo), Aig_ManConst1(pNew) );
300 // compute condition
301 pCare = Cgt_ManConstructCareCondition( p, pNew, pObjLo, vCopy0, vCopy1 );
302 // restore the values
303 Vec_PtrWriteEntry( vCopy0, Aig_ObjId(pObjLo), Aig_ObjChild0Copy(pObjLi) );
304 Vec_PtrWriteEntry( vCopy1, Aig_ObjId(pObjLo), Aig_ObjChild0Copy(pObjLi) );
305 // compute the miter
306 pMiter = Aig_Exor( pNew, (Aig_Obj_t *)pObjLo->pData, Aig_ObjChild0Copy(pObjLi) );
307 pMiter = Aig_And( pNew, pMiter, pCare );
308 pObjLi->pData = Aig_ObjCreateCo( pNew, pMiter );
309 }
310 Vec_PtrFree( vCopy0 );
311 Vec_PtrFree( vCopy1 );
312 }
313 else
314 {
315 // construct clock-gating miters for each register input
316 Saig_ManForEachLiLo( p->pAig, pObjLi, pObjLo, i )
317 {
318 pMiter = Aig_Exor( pNew, (Aig_Obj_t *)pObjLo->pData, Aig_ObjChild0Copy(pObjLi) );
319 pObjLi->pData = Aig_ObjCreateCo( pNew, pMiter );
320 }
321 }
322 Aig_ManCleanup( pNew );
323 Aig_ManSetCioIds( pNew );
324 return pNew;
325}
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition aig.h:393
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition aigOper.c:104
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition aigObj.c:66
Aig_Obj_t * Aig_Exor(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition aigOper.c:220
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition aigMan.c:47
#define Aig_ManForEachNode(p, pObj, i)
Definition aig.h:413
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition aig.h:50
int Aig_ManCleanup(Aig_Man_t *p)
Definition aigMan.c:265
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition aigObj.c:45
Aig_Obj_t * Cgt_ManConstructCareCondition(Cgt_Man_t *p, Aig_Man_t *pNew, Aig_Obj_t *pObjLo, Vec_Ptr_t *vCopy0, Vec_Ptr_t *vCopy1)
Definition cgtAig.c:212
void * pData
Definition aig.h:87
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Cgt_ManDeriveGatedAig()

Aig_Man_t * Cgt_ManDeriveGatedAig ( Aig_Man_t * pAig,
Vec_Vec_t * vGates,
int fReduce,
int * pnUsedNodes )
extern

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

Synopsis [Derives AIG after clock-gating.]

Description [The array contains, for each flop, its gate if present.]

SideEffects []

SeeAlso []

Definition at line 524 of file cgtAig.c.

525{
526 Aig_Man_t * pNew;
527 Aig_Obj_t * pObj, * pObjNew, * pObjLi, * pObjLo, * pGateNew;
528 Vec_Ptr_t * vOne;
529 int i, k;
530 Aig_ManCleanNext( pAig );
531 // label nodes
532 Vec_VecForEachEntry( Aig_Obj_t *, vGates, pObj, i, k )
533 {
534 if ( Aig_IsComplement(pObj) )
535 Aig_Regular(pObj)->fMarkB = 1;
536 else
537 Aig_Regular(pObj)->fMarkA = 1;
538 }
539 // construct AIG
540 assert( Aig_ManRegNum(pAig) );
541 pNew = Aig_ManStart( Aig_ManObjNumMax(pAig) );
542 pNew->pName = Abc_UtilStrsav( pAig->pName );
543 pNew->pSpec = Abc_UtilStrsav( pAig->pSpec );
544 Aig_ManConst1(pAig)->pData = Aig_ManConst1(pNew);
545 Aig_ManForEachCi( pAig, pObj, i )
546 pObj->pData = Aig_ObjCreateCi( pNew );
547 if ( fReduce )
548 {
549 Aig_ManForEachNode( pAig, pObj, i )
550 {
551 assert( !(pObj->fMarkA && pObj->fMarkB) );
552 pObj->pData = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
553 if ( pObj->fMarkA )
554 {
555 pObj->pNext = (Aig_Obj_t *)pObj->pData;
556 pObj->pData = Aig_ManConst0(pNew);
557 }
558 else if ( pObj->fMarkB )
559 {
560 pObj->pNext = (Aig_Obj_t *)pObj->pData;
561 pObj->pData = Aig_ManConst1(pNew);
562 }
563 }
564 }
565 else
566 {
567 Aig_ManForEachNode( pAig, pObj, i )
568 pObj->pData = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
569 }
570 if ( pnUsedNodes != NULL )
571 *pnUsedNodes = Aig_ManNodeNum(pNew);
572 Saig_ManForEachPo( pAig, pObj, i )
573 pObj->pData = Aig_ObjCreateCo( pNew, Aig_ObjChild0Copy(pObj) );
574 Saig_ManForEachLiLo( pAig, pObjLi, pObjLo, i )
575 {
576 vOne = Vec_VecEntry( vGates, i );
577 if ( Vec_PtrSize(vOne) == 0 )
578 pObjNew = Aig_ObjChild0Copy(pObjLi);
579 else
580 {
581// pGateNew = Aig_NotCond( Aig_Regular(pGate)->pData, Aig_IsComplement(pGate) );
582 pGateNew = Cgt_ManBuildClockGate( pNew, vOne );
583 pObjNew = Aig_Mux( pNew, pGateNew, (Aig_Obj_t *)pObjLo->pData, Aig_ObjChild0Copy(pObjLi) );
584 }
585 pObjLi->pData = Aig_ObjCreateCo( pNew, pObjNew );
586 }
587 Aig_ManCleanup( pNew );
588 Aig_ManSetRegNum( pNew, Aig_ManRegNum(pAig) );
589 // unlabel nodes
590 Aig_ManCleanMarkAB( pAig );
591 Aig_ManCleanNext( pAig );
592 return pNew;
593}
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition aigMan.c:438
Aig_Obj_t * Aig_Mux(Aig_Man_t *p, Aig_Obj_t *pC, Aig_Obj_t *p1, Aig_Obj_t *p0)
Definition aigOper.c:317
void Aig_ManCleanNext(Aig_Man_t *p)
Definition aigUtil.c:224
void Aig_ManCleanMarkAB(Aig_Man_t *p)
Definition aigUtil.c:186
Aig_Obj_t * Cgt_ManBuildClockGate(Aig_Man_t *pNew, Vec_Ptr_t *vGates)
Definition cgtAig.c:496
#define Saig_ManForEachPo(p, pObj, i)
Definition saig.h:93
unsigned int fMarkB
Definition aig.h:80
Aig_Obj_t * pNext
Definition aig.h:72
unsigned int fMarkA
Definition aig.h:79
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Cgt_ManDetectCandidates()

void Cgt_ManDetectCandidates ( Aig_Man_t * pAig,
Vec_Int_t * vUseful,
Aig_Obj_t * pObj,
int nLevelMax,
Vec_Ptr_t * vCands )
extern

MACRO DEFINITIONS ///.

FUNCTION DECLARATIONS ///

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

Synopsis [Computes transitive fanout cone of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 70 of file cgtAig.c.

71{
72 Vec_PtrClear( vCands );
73 if ( !Aig_ObjIsNode(pObj) )
74 return;
76 Cgt_ManDetectCandidates_rec( pAig, vUseful, pObj, nLevelMax, vCands );
77}
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition aigUtil.c:44
ABC_NAMESPACE_IMPL_START void Cgt_ManDetectCandidates_rec(Aig_Man_t *pAig, Vec_Int_t *vUseful, Aig_Obj_t *pObj, int nLevelMax, Vec_Ptr_t *vCands)
DECLARATIONS ///.
Definition cgtAig.c:45
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Cgt_ManDupPartition()

Aig_Man_t * Cgt_ManDupPartition ( Aig_Man_t * pFrame,
int nVarsMin,
int nFlopsMin,
int iStart,
Aig_Man_t * pCare,
Vec_Vec_t * vSuppsInv,
int * pnOutputs )
extern

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

Synopsis [Duplicates register outputs starting from the given one.]

Description []

SideEffects []

SeeAlso []

Definition at line 441 of file cgtAig.c.

442{
443 Vec_Ptr_t * vRoots, * vLeaves, * vPos;
444 Aig_Man_t * pNew;
445 Aig_Obj_t * pObj;
446 int i;
447 assert( Aig_ManRegNum(pFrame) == 0 );
448 vRoots = Vec_PtrAlloc( 100 );
449 vLeaves = Vec_PtrAlloc( 100 );
450 vPos = Vec_PtrAlloc( 100 );
451 pNew = Aig_ManStart( nVarsMin );
452 pNew->pName = Abc_UtilStrsav( "partition" );
453 Aig_ManIncrementTravId( pFrame );
454 Aig_ManConst1(pFrame)->pData = Aig_ManConst1(pNew);
455 Aig_ObjSetTravIdCurrent( pFrame, Aig_ManConst1(pFrame) );
456 for ( i = iStart; i < iStart + nFlopsMin && i < Aig_ManCoNum(pFrame); i++ )
457 {
458 pObj = Aig_ManCo( pFrame, i );
459 Cgt_ManDupPartition_rec( pNew, pFrame, Aig_ObjFanin0(pObj), vLeaves );
460 Vec_PtrPush( vRoots, Aig_ObjChild0Copy(pObj) );
461 Vec_PtrPush( vPos, pObj );
462 }
463 for ( ; Aig_ManObjNum(pNew) < nVarsMin && i < Aig_ManCoNum(pFrame); i++ )
464 {
465 pObj = Aig_ManCo( pFrame, i );
466 Cgt_ManDupPartition_rec( pNew, pFrame, Aig_ObjFanin0(pObj), vLeaves );
467 Vec_PtrPush( vRoots, Aig_ObjChild0Copy(pObj) );
468 Vec_PtrPush( vPos, pObj );
469 }
470 assert( nFlopsMin >= Vec_PtrSize(vRoots) || Vec_PtrSize(vRoots) >= nFlopsMin );
471 // create constaints
472 if ( pCare )
473 Cgt_ManConstructCare( pNew, pCare, vSuppsInv, vLeaves );
474 // create POs
475 Vec_PtrForEachEntry( Aig_Obj_t *, vPos, pObj, i )
476 pObj->pData = (Aig_Obj_t *)Aig_ObjCreateCo( pNew, (Aig_Obj_t *)Vec_PtrEntry(vRoots, i) );
477 if ( pnOutputs != NULL )
478 *pnOutputs = Vec_PtrSize( vPos );
479 Vec_PtrFree( vRoots );
480 Vec_PtrFree( vLeaves );
481 Vec_PtrFree( vPos );
482 return pNew;
483}
Aig_Obj_t * Cgt_ManDupPartition_rec(Aig_Man_t *pNew, Aig_Man_t *pAig, Aig_Obj_t *pObj, Vec_Ptr_t *vLeaves)
Definition cgtAig.c:414
void Cgt_ManConstructCare(Aig_Man_t *pNew, Aig_Man_t *pCare, Vec_Vec_t *vSuppsInv, Vec_Ptr_t *vLeaves)
Definition cgtAig.c:368
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Cgt_ManStop()

void Cgt_ManStop ( Cgt_Man_t * p)
extern

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

Synopsis [Frees the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 154 of file cgtMan.c.

155{
156 if ( p->pPars->fVerbose )
158 if ( p->pFrame )
159 Aig_ManStop( p->pFrame );
160 Cgt_ManClean( p );
161 Vec_PtrFree( p->vFanout );
162 Vec_PtrFree( p->vVisited );
163 if ( p->vGates )
164 Vec_PtrFree( p->vGates );
165 if ( p->vGatesAll )
166 Vec_VecFree( p->vGatesAll );
167 if ( p->vSuppsInv )
168 Vec_VecFree( p->vSuppsInv );
169 ABC_FREE( p );
170}
#define ABC_FREE(obj)
Definition abc_global.h:267
void Cgt_ManClean(Cgt_Man_t *p)
Definition cgtMan.c:86
void Cgt_ManPrintStats(Cgt_Man_t *p)
Definition cgtMan.c:122
Here is the call graph for this function:
Here is the caller graph for this function: