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

Go to the source code of this file.

Classes

struct  Bac_Pair_t_
 

Typedefs

typedef typedefABC_NAMESPACE_IMPL_START struct Bac_Pair_t_ Bac_Pair_t
 DECLARATIONS ///.
 

Functions

void Bac_ManSetupTypes (char **pNames, char **pSymbs)
 
char * Bac_NtkGenerateName (Bac_Ntk_t *p, Bac_ObjType_t Type, Vec_Int_t *vBits)
 
Bac_ObjType_t Bac_NameToType (char *pName)
 
Vec_Int_tBac_NameToRanges (char *pName)
 
void Bac_NtkUpdateFanout (Bac_Ntk_t *p, int iOld, int iNew)
 FUNCTION DEFINITIONS ///.
 
void Bac_NtkDeriveFanout (Bac_Ntk_t *p)
 
void Bac_ManDeriveFanout (Bac_Man_t *p)
 
int Bac_ManAssignInternTwo (Bac_Ntk_t *p, int iNum, int nDigits, char *pPref, Vec_Int_t *vMap)
 
int Bac_ManAssignCountNames (Bac_Ntk_t *p)
 
void Bac_ManAssignInternWordNamesNtk (Bac_Ntk_t *p, Vec_Int_t *vMap)
 
void Bac_ManAssignInternWordNames (Bac_Man_t *p)
 
int Bac_ManClpObjNum_rec (Bac_Ntk_t *p)
 
int Bac_ManClpObjNum (Bac_Man_t *p)
 
void Bac_NtkDfs_rec (Bac_Ntk_t *p, int iObj, Vec_Int_t *vBoxes)
 
Vec_Int_tBac_NtkDfs (Bac_Ntk_t *p)
 
int Bac_NtkDfsUserBoxes_rec (Bac_Ntk_t *p, int iObj, Vec_Int_t *vBoxes)
 
int Bac_NtkDfsUserBoxes (Bac_Ntk_t *p)
 
void Bac_NtkCollapse_rec (Bac_Ntk_t *pNew, Bac_Ntk_t *p, Vec_Int_t *vSigs)
 
Bac_Man_tBac_ManCollapse (Bac_Man_t *p)
 

Typedef Documentation

◆ Bac_Pair_t

typedef typedefABC_NAMESPACE_IMPL_START struct Bac_Pair_t_ Bac_Pair_t

DECLARATIONS ///.

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

FileName [bacNtk.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Hierarchical word-level netlist.]

Synopsis [Netlist manipulation.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - November 29, 2014.]

Revision [

Id
bacNtk.c,v 1.00 2014/11/29 00:00:00 alanmi Exp

]

Definition at line 29 of file bacNtk.c.

Function Documentation

◆ Bac_ManAssignCountNames()

int Bac_ManAssignCountNames ( Bac_Ntk_t * p)

Definition at line 290 of file bacNtk.c.

291{
292 int i, iObj, iBox, Count = 0;
293 Bac_NtkForEachPiMain( p, iObj, i )
294 if ( !Bac_ObjNameInt(p, iObj) )
295 Count++;
296 Bac_NtkForEachBox( p, iBox )
297 Bac_BoxForEachBoMain( p, iBox, iObj, i )
298 if ( !Bac_ObjNameInt(p, iObj) )
299 Count++;
300 return Count;
301}
#define Bac_BoxForEachBoMain(p, iBox, iTerm, i)
Definition bac.h:384
#define Bac_NtkForEachBox(p, i)
Definition bac.h:354
#define Bac_NtkForEachPiMain(p, iObj, i)
Definition bac.h:344
Cube * p
Definition exorList.c:222
Here is the caller graph for this function:

◆ Bac_ManAssignInternTwo()

int Bac_ManAssignInternTwo ( Bac_Ntk_t * p,
int iNum,
int nDigits,
char * pPref,
Vec_Int_t * vMap )

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

Synopsis [Assigns word-level names.]

Description []

SideEffects []

SeeAlso []

Definition at line 276 of file bacNtk.c.

277{
278 char Buffer[16]; int i, NameId = 0;
279 for ( i = 0; !NameId || Vec_IntEntry(vMap, NameId); i++ )
280 {
281 if ( i == 0 )
282 sprintf( Buffer, "%s%0*d", pPref, nDigits, iNum );
283 else
284 sprintf( Buffer, "%s%0*d_%d", pPref, nDigits, iNum, i );
285 NameId = Abc_NamStrFindOrAdd( p->pDesign->pStrs, Buffer, NULL );
286 }
287 Vec_IntWriteEntry( vMap, NameId, 1 );
288 return NameId;
289}
int Abc_NamStrFindOrAdd(Abc_Nam_t *p, char *pStr, int *pfFound)
Definition utilNam.c:453
char * sprintf()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bac_ManAssignInternWordNames()

void Bac_ManAssignInternWordNames ( Bac_Man_t * p)

Definition at line 392 of file bacNtk.c.

393{
394 Vec_Int_t * vMap = Vec_IntStart( 2*Bac_ManObjNum(p) );
395 Bac_Ntk_t * pNtk; int i;
396 Bac_ManForEachNtk( p, pNtk, i )
398 assert( Vec_IntCountEntry(vMap, 0) == Vec_IntSize(vMap) );
399 Vec_IntFree( vMap );
400}
void Bac_ManAssignInternWordNamesNtk(Bac_Ntk_t *p, Vec_Int_t *vMap)
Definition bacNtk.c:302
struct Bac_Ntk_t_ Bac_Ntk_t
Definition bac.h:141
#define Bac_ManForEachNtk(p, pNtk, i)
MACRO DEFINITIONS ///.
Definition bac.h:334
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bac_ManAssignInternWordNamesNtk()

void Bac_ManAssignInternWordNamesNtk ( Bac_Ntk_t * p,
Vec_Int_t * vMap )

Definition at line 302 of file bacNtk.c.

303{
304 int k, iObj, iTerm, iName = -1, iBit = -1;
305 int nDigits, nPis = 0, nPos = 0, nNames = 1;
306 // start names
307 if ( !Bac_NtkHasNames(p) )
308 Bac_NtkStartNames(p);
309 nDigits = Abc_Base10Log( Bac_ManAssignCountNames(p) );
310 // populate map with the currently used names
311 Bac_NtkForEachCi( p, iObj )
312 if ( Bac_ObjNameInt(p, iObj) )
313 Vec_IntWriteEntry( vMap, Bac_ObjNameId(p, iObj), 1 );
314 Bac_NtkForEachBox( p, iObj )
315 if ( Bac_ObjNameInt(p, iObj) )
316 Vec_IntWriteEntry( vMap, Bac_ObjNameId(p, iObj), 1 );
317 // assign CI names
318 Bac_NtkForEachCi( p, iObj )
319 {
320 if ( Bac_ObjNameInt(p, iObj) )
321 {
322 iName = -1;
323 iBit = -1;
324 continue;
325 }
326 if ( Bac_ObjBit(p, iObj) )
327 {
328 assert( iBit > 0 );
329 Bac_ObjSetName( p, iObj, Abc_Var2Lit2(iBit++, BAC_NAME_INDEX) );
330 }
331 else
332 {
333 //int Type = Bac_ObjType(p, iObj);
334 int Range = Bac_ObjIsPi(p, iObj) ? Bac_ObjPiRange(p, iObj) : Bac_BoxBoRange(p, iObj);
335 iName = Bac_ManAssignInternTwo( p, nNames++, nDigits, (char*)(Bac_ObjIsPi(p, iObj) ? "i":"n"), vMap );
336 if ( Range == 1 )
337 Bac_ObjSetName( p, iObj, Abc_Var2Lit2(iName, BAC_NAME_BIN) );
338 else
339 Bac_ObjSetName( p, iObj, Abc_Var2Lit2(iName, BAC_NAME_WORD) );
340 iBit = 1;
341 }
342 }
343 // transfer names to the interface
344 if ( Bac_NtkInfoNum(p) )
345 {
346 for ( k = 0; k < Bac_NtkInfoNum(p); k++ )
347 {
348 //char * pName = Bac_NtkName(p);
349 if ( Bac_NtkInfoType(p, k) == 1 ) // PI
350 {
351 iObj = Bac_NtkPi(p, nPis);
352 assert( !Bac_ObjBit(p, iObj) );
353 assert( Bac_ObjNameType(p, iObj) <= BAC_NAME_WORD );
354 Bac_NtkSetInfoName( p, k, Abc_Var2Lit2(Bac_ObjNameId(p, iObj), 1) );
355 nPis += Bac_NtkInfoRange(p, k);
356 }
357 else if ( Bac_NtkInfoType(p, k) == 2 ) // PO
358 {
359 iObj = Bac_NtkPo(p, nPos);
360 assert( !Bac_ObjBit(p, iObj) );
361 iObj = Bac_ObjFanin(p, iObj);
362 assert( Bac_ObjNameType(p, iObj) <= BAC_NAME_WORD );
363 Bac_NtkSetInfoName( p, k, Abc_Var2Lit2(Bac_ObjNameId(p, iObj), 2) );
364 nPos += Bac_NtkInfoRange(p, k);
365 }
366 else assert( 0 );
367 }
368 assert( nPis == Bac_NtkPiNum(p) );
369 assert( nPos == Bac_NtkPoNum(p) );
370 }
371 // assign instance names
372 nDigits = Abc_Base10Log( Bac_NtkObjNum(p) );
373 Bac_NtkForEachBox( p, iObj )
374 if ( !Bac_ObjNameInt(p, iObj) )
375 {
376 iName = Bac_ManAssignInternTwo( p, iObj, nDigits, "g", vMap );
377 Bac_ObjSetName( p, iObj, Abc_Var2Lit2(iName, BAC_NAME_BIN) );
378 }
379 // unmark all names
380 Bac_NtkForEachPi( p, iObj, k )
381 if ( Bac_ObjNameType(p, iObj) <= BAC_NAME_WORD )
382 Vec_IntWriteEntry( vMap, Bac_ObjNameId(p, iObj), 0 );
383 Bac_NtkForEachBox( p, iObj )
384 {
385 Vec_IntWriteEntry( vMap, Bac_ObjNameId(p, iObj), 0 );
386 Bac_BoxForEachBo( p, iObj, iTerm, k )
387 if ( Bac_ObjNameType(p, iTerm) <= BAC_NAME_WORD )
388 Vec_IntWriteEntry( vMap, Bac_ObjNameId(p, iTerm), 0 );
389 }
390// printf( "Generated %d word-level names.\n", nNames-1 );
391}
int Bac_ManAssignInternTwo(Bac_Ntk_t *p, int iNum, int nDigits, char *pPref, Vec_Int_t *vMap)
Definition bacNtk.c:276
int Bac_ManAssignCountNames(Bac_Ntk_t *p)
Definition bacNtk.c:290
#define Bac_BoxForEachBo(p, iBox, iTerm, i)
Definition bac.h:377
#define Bac_NtkForEachPi(p, iObj, i)
Definition bac.h:337
#define Bac_NtkForEachCi(p, i)
Definition bac.h:361
@ BAC_NAME_WORD
Definition bac.h:135
@ BAC_NAME_INDEX
Definition bac.h:137
@ BAC_NAME_BIN
Definition bac.h:134
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bac_ManClpObjNum()

int Bac_ManClpObjNum ( Bac_Man_t * p)

Definition at line 423 of file bacNtk.c.

424{
425 Bac_Ntk_t * pNtk; int i;
426 Bac_ManForEachNtk( p, pNtk, i )
427 pNtk->Count = -1;
428 return Bac_NtkPioNum( Bac_ManRoot(p) ) + Bac_ManClpObjNum_rec( Bac_ManRoot(p) );
429}
int Bac_ManClpObjNum_rec(Bac_Ntk_t *p)
Definition bacNtk.c:414
int Count
Definition bac.h:152
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bac_ManClpObjNum_rec()

int Bac_ManClpObjNum_rec ( Bac_Ntk_t * p)

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

Synopsis [Count number of objects after collapsing.]

Description []

SideEffects []

SeeAlso []

Definition at line 414 of file bacNtk.c.

415{
416 int i, Counter = 0;
417 if ( p->Count >= 0 )
418 return p->Count;
419 Bac_NtkForEachBox( p, i )
420 Counter += Bac_ObjIsBoxUser(p, i) ? Bac_ManClpObjNum_rec( Bac_BoxNtk(p, i) ) + 3*Bac_BoxBoNum(p, i) : Bac_BoxSize(p, i);
421 return (p->Count = Counter);
422}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bac_ManCollapse()

Bac_Man_t * Bac_ManCollapse ( Bac_Man_t * p)

Definition at line 567 of file bacNtk.c.

568{
569 int i, iObj;
570 Vec_Int_t * vSigs = Vec_IntAlloc( 1000 );
571 Bac_Man_t * pNew = Bac_ManStart( p, 1 );
572 Bac_Ntk_t * pRoot = Bac_ManRoot( p );
573 Bac_Ntk_t * pRootNew = Bac_ManRoot( pNew );
574 Bac_NtkAlloc( pRootNew, Bac_NtkNameId(pRoot), Bac_NtkPiNum(pRoot), Bac_NtkPoNum(pRoot), Bac_ManClpObjNum(p) );
575 if ( Vec_IntSize(&pRoot->vInfo) )
576 Vec_IntAppend( &pRootNew->vInfo, &pRoot->vInfo );
577 Bac_NtkForEachPi( pRoot, iObj, i )
578 Vec_IntPush( vSigs, Bac_ObjAlloc(pRootNew, BAC_OBJ_PI, -1) );
579 Bac_NtkCollapse_rec( pRootNew, pRoot, vSigs );
580 assert( Vec_IntSize(vSigs) == Bac_NtkPoNum(pRoot) );
581 Bac_NtkForEachPo( pRoot, iObj, i )
582 Bac_ObjAlloc( pRootNew, BAC_OBJ_PO, Vec_IntEntry(vSigs, i) );
583 assert( Bac_NtkObjNum(pRootNew) == Bac_NtkObjNumAlloc(pRootNew) );
584 Vec_IntFree( vSigs );
585 // transfer PI/PO names
586 if ( Bac_NtkHasNames(pRoot) )
587 {
588 Bac_NtkStartNames( pRootNew );
589 Bac_NtkForEachPi( pRoot, iObj, i )
590 Bac_ObjSetName( pRootNew, Bac_NtkPi(pRootNew, i), Bac_ObjName(pRoot, iObj) );
591 Bac_NtkForEachPoDriver( pRoot, iObj, i )
592 if ( !Bac_ObjIsPi(pRoot, iObj) )
593 Bac_ObjSetName( pRootNew, Bac_ObjCopy(pRoot, iObj), Bac_ObjName(pRoot, iObj) );
594 }
595 return pNew;
596}
int Bac_ManClpObjNum(Bac_Man_t *p)
Definition bacNtk.c:423
void Bac_NtkCollapse_rec(Bac_Ntk_t *pNew, Bac_Ntk_t *p, Vec_Int_t *vSigs)
Definition bacNtk.c:523
struct Bac_Man_t_ Bac_Man_t
Definition bac.h:142
#define Bac_NtkForEachPo(p, iObj, i)
Definition bac.h:339
#define Bac_NtkForEachPoDriver(p, iObj, i)
Definition bac.h:341
@ BAC_OBJ_PO
Definition bac.h:46
@ BAC_OBJ_PI
Definition bac.h:45
Vec_Int_t vInfo
Definition bac.h:157
Here is the call graph for this function:

◆ Bac_ManDeriveFanout()

void Bac_ManDeriveFanout ( Bac_Man_t * p)

Definition at line 258 of file bacNtk.c.

259{
260 Bac_Ntk_t * pNtk; int i;
261 Bac_ManForEachNtk( p, pNtk, i )
262 Bac_NtkDeriveFanout( pNtk );
263}
void Bac_NtkDeriveFanout(Bac_Ntk_t *p)
Definition bacNtk.c:241
Here is the call graph for this function:

◆ Bac_ManSetupTypes()

void Bac_ManSetupTypes ( char ** pNames,
char ** pSymbs )

Definition at line 131 of file bacNtk.c.

132{
133 int Type;
134 for ( Type = 1; Type < BAC_BOX_UNKNOWN; Type++ )
135 {
136 int Id = Bac_GetTypeId( (Bac_ObjType_t)Type );
137 pNames[Type] = s_Types[Id].pName;
138 pSymbs[Type] = s_Types[Id].pSymb;
139 }
140}
Bac_ObjType_t
INCLUDES ///.
Definition bac.h:43
@ BAC_BOX_UNKNOWN
Definition bac.h:128

◆ Bac_NameToRanges()

Vec_Int_t * Bac_NameToRanges ( char * pName)

Definition at line 172 of file bacNtk.c.

173{
174 static Vec_Int_t Bits, * vBits = &Bits;
175 static int pArray[10];
176 char * pTemp;
177 int Num = 0, Count = 0;
178 // initialize array
179 vBits->pArray = pArray;
180 vBits->nSize = 0;
181 vBits->nCap = 10;
182 // check the name
183 assert( !strncmp(pName, s_Pref, strlen(s_Pref)) );
184 for ( pTemp = pName; *pTemp && !Bac_CharIsDigit(*pTemp); pTemp++ );
185 assert( Bac_CharIsDigit(*pTemp) );
186 for ( ; *pTemp; pTemp++ )
187 {
188 if ( Bac_CharIsDigit(*pTemp) )
189 Num = 10 * Num + *pTemp - '0';
190 else
191 Vec_IntPush( vBits, Num ), Count += Num, Num = 0;
192 }
193 assert( Num > 0 );
194 Vec_IntPush( vBits, Num ); Count += Num;
195 assert( Vec_IntSize(vBits) <= 10 );
196 return vBits;
197}
int strncmp()
int strlen()
Here is the call graph for this function:

◆ Bac_NameToType()

Bac_ObjType_t Bac_NameToType ( char * pName)

Definition at line 161 of file bacNtk.c.

162{
163 int i;
164 if ( strncmp(pName, s_Pref, strlen(s_Pref)) )
165 return BAC_OBJ_NONE;
166 pName += strlen(s_Pref);
167 for ( i = 1; i < BAC_BOX_UNKNOWN; i++ )
168 if ( !strncmp(pName, s_Types[i].pName, strlen(s_Types[i].pName)) )
169 return s_Types[i].Type;
170 return BAC_OBJ_NONE;
171}
@ BAC_OBJ_NONE
Definition bac.h:44
Here is the call graph for this function:

◆ Bac_NtkCollapse_rec()

void Bac_NtkCollapse_rec ( Bac_Ntk_t * pNew,
Bac_Ntk_t * p,
Vec_Int_t * vSigs )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 523 of file bacNtk.c.

524{
525 int i, iObj, iObjNew, iTerm;
526 Bac_NtkStartCopies( p );
527 // set PI copies
528 assert( Vec_IntSize(vSigs) == Bac_NtkPiNum(p) );
529 Bac_NtkForEachPi( p, iObj, i )
530 Bac_ObjSetCopy( p, iObj, Vec_IntEntry(vSigs, i) );
531 // duplicate internal objects and create buffers for hierarchy instances
532 Bac_NtkForEachBox( p, iObj )
533 if ( Bac_ObjIsBoxPrim( p, iObj ) )
534 Bac_BoxDup( pNew, p, iObj );
535 else
536 {
537 Bac_BoxForEachBo( p, iObj, iTerm, i )
538 {
539 iObjNew = Bac_ObjAlloc( pNew, BAC_OBJ_BI, -1 );
540 iObjNew = Bac_ObjAlloc( pNew, BAC_BOX_BUF, -1 ); // buffer
541 iObjNew = Bac_ObjAlloc( pNew, BAC_OBJ_BO, -1 );
542 Bac_ObjSetCopy( p, iTerm, iObjNew );
543 }
544 }
545 // duplicate user modules and connect objects
546 Bac_NtkForEachBox( p, iObj )
547 if ( Bac_ObjIsBoxPrim( p, iObj ) )
548 {
549 Bac_BoxForEachBi( p, iObj, iTerm, i )
550 Bac_ObjSetFanin( pNew, Bac_ObjCopy(p, iTerm), Bac_ObjCopy(p, Bac_ObjFanin(p, iTerm)) );
551 }
552 else
553 {
554 Vec_IntClear( vSigs );
555 Bac_BoxForEachBi( p, iObj, iTerm, i )
556 Vec_IntPush( vSigs, Bac_ObjCopy(p, Bac_ObjFanin(p, iTerm)) );
557 Bac_NtkCollapse_rec( pNew, Bac_BoxNtk(p, iObj), vSigs );
558 assert( Vec_IntSize(vSigs) == Bac_BoxBoNum(p, iObj) );
559 Bac_BoxForEachBo( p, iObj, iTerm, i )
560 Bac_ObjSetFanin( pNew, Bac_ObjCopy(p, iTerm)-2, Vec_IntEntry(vSigs, i) );
561 }
562 // collect POs
563 Vec_IntClear( vSigs );
564 Bac_NtkForEachPo( p, iObj, i )
565 Vec_IntPush( vSigs, Bac_ObjCopy(p, Bac_ObjFanin(p, iObj)) );
566}
#define Bac_BoxForEachBi(p, iBox, iTerm, i)
Definition bac.h:375
@ BAC_BOX_BUF
Definition bac.h:55
@ BAC_OBJ_BI
Definition bac.h:47
@ BAC_OBJ_BO
Definition bac.h:48
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bac_NtkDeriveFanout()

void Bac_NtkDeriveFanout ( Bac_Ntk_t * p)

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

Synopsis [Derives fanout.]

Description []

SideEffects []

SeeAlso []

Definition at line 241 of file bacNtk.c.

242{
243 int iCi, iCo;
244 assert( !Bac_NtkHasFanouts(p) );
245 Bac_NtkStartFanouts( p );
246 Bac_NtkForEachCo( p, iCo )
247 {
248 assert( !Bac_ObjNextFanout(p, iCo) );
249 iCi = Bac_ObjFanin(p, iCo);
250 if ( Bac_ObjFanout(p, iCi) )
251 Bac_ObjSetNextFanout( p, Bac_ObjFanout(p, iCi), iCo );
252 Bac_ObjSetFanout( p, iCi, iCo );
253 }
254 Bac_NtkForEachCo( p, iCo )
255 if ( !Bac_ObjNextFanout(p, iCo) )
256 Bac_ObjSetFanout( p, Bac_ObjFanin(p, iCo), iCo );
257}
#define Bac_NtkForEachCo(p, i)
Definition bac.h:363
Here is the caller graph for this function:

◆ Bac_NtkDfs()

Vec_Int_t * Bac_NtkDfs ( Bac_Ntk_t * p)

Definition at line 458 of file bacNtk.c.

459{
460 int i, iObj;
461 Vec_Int_t * vBoxes = Vec_IntAlloc( Bac_NtkBoxNum(p) );
462 Bac_NtkStartCopies( p ); // -1 = not visited; 1 = finished
463 Bac_NtkForEachPi( p, iObj, i )
464 Bac_ObjSetCopy( p, iObj, 1 );
465 Bac_NtkForEachPo( p, iObj, i )
466 Bac_NtkDfs_rec( p, Bac_ObjFanin(p, iObj), vBoxes );
467 return vBoxes;
468}
void Bac_NtkDfs_rec(Bac_Ntk_t *p, int iObj, Vec_Int_t *vBoxes)
Definition bacNtk.c:442
Here is the call graph for this function:

◆ Bac_NtkDfs_rec()

void Bac_NtkDfs_rec ( Bac_Ntk_t * p,
int iObj,
Vec_Int_t * vBoxes )

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

Synopsis [Collects boxes in the DFS order.]

Description []

SideEffects []

SeeAlso []

Definition at line 442 of file bacNtk.c.

443{
444 int k, iFanin;
445 if ( Bac_ObjIsBo(p, iObj) == 1 )
446 {
447 Bac_NtkDfs_rec( p, Bac_ObjFanin(p, iObj), vBoxes );
448 return;
449 }
450 assert( Bac_ObjIsPi(p, iObj) || Bac_ObjIsBox(p, iObj) );
451 if ( Bac_ObjCopy(p, iObj) > 0 ) // visited
452 return;
453 Bac_ObjSetCopy( p, iObj, 1 );
454 Bac_BoxForEachFanin( p, iObj, iFanin, k )
455 Bac_NtkDfs_rec( p, iFanin, vBoxes );
456 Vec_IntPush( vBoxes, iObj );
457}
#define Bac_BoxForEachFanin(p, iBox, iFanin, i)
Definition bac.h:387
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bac_NtkDfsUserBoxes()

int Bac_NtkDfsUserBoxes ( Bac_Ntk_t * p)

Definition at line 498 of file bacNtk.c.

499{
500 int iObj;
501 Bac_NtkStartCopies( p ); // -1 = not visited; 0 = on the path; 1 = finished
502 Vec_IntClear( &p->vArray );
503 Bac_NtkForEachBoxUser( p, iObj )
504 if ( !Bac_NtkDfsUserBoxes_rec( p, iObj, &p->vArray ) )
505 {
506 printf( "Cyclic dependency of user boxes is detected.\n" );
507 return 0;
508 }
509 return 1;
510}
int Bac_NtkDfsUserBoxes_rec(Bac_Ntk_t *p, int iObj, Vec_Int_t *vBoxes)
Definition bacNtk.c:481
#define Bac_NtkForEachBoxUser(p, i)
Definition bac.h:356
Here is the call graph for this function:

◆ Bac_NtkDfsUserBoxes_rec()

int Bac_NtkDfsUserBoxes_rec ( Bac_Ntk_t * p,
int iObj,
Vec_Int_t * vBoxes )

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

Synopsis [Collects user boxes in the DFS order.]

Description []

SideEffects []

SeeAlso []

Definition at line 481 of file bacNtk.c.

482{
483 int k, iFanin;
484 assert( Bac_ObjIsBoxUser(p, iObj) );
485 if ( Bac_ObjCopy(p, iObj) == 1 ) // visited
486 return 1;
487 if ( Bac_ObjCopy(p, iObj) == 0 ) // loop
488 return 0;
489 Bac_ObjSetCopy( p, iObj, 0 );
490 Bac_BoxForEachFanin( p, iObj, iFanin, k )
491 if ( Bac_ObjIsBo(p, iFanin) && Bac_ObjIsBoxUser(p, Bac_ObjFanin(p, iFanin)) )
492 if ( !Bac_NtkDfsUserBoxes_rec( p, Bac_ObjFanin(p, iFanin), vBoxes ) )
493 return 0;
494 Vec_IntPush( vBoxes, iObj );
495 Bac_ObjSetCopy( p, iObj, 1 );
496 return 1;
497}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bac_NtkGenerateName()

char * Bac_NtkGenerateName ( Bac_Ntk_t * p,
Bac_ObjType_t Type,
Vec_Int_t * vBits )

Definition at line 142 of file bacNtk.c.

143{
144 static char Buffer[100];
145 char * pTemp; int i, Bits;
146 char * pName = Bac_ManPrimName( p->pDesign, Type );
147 char * pSymb = Bac_ManPrimSymb( p->pDesign, Type );
148 assert( Vec_IntSize(vBits) == (int)strlen(pSymb) );
149 sprintf( Buffer, "%s%s_", s_Pref, pName );
150 pTemp = Buffer + strlen(Buffer);
151 Vec_IntForEachEntry( vBits, Bits, i )
152 {
153 sprintf( pTemp, "%c%d", pSymb[i], Bits );
154 pTemp += strlen(pTemp);
155 }
156 //Vec_IntPrint( vBits );
157 //printf( "%s\n", Buffer );
158 return Buffer;
159}
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bac_NtkUpdateFanout()

void Bac_NtkUpdateFanout ( Bac_Ntk_t * p,
int iOld,
int iNew )

FUNCTION DEFINITIONS ///.

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

Synopsis [Replaces fanin iOld by iNew in all fanouts.]

Description []

SideEffects []

SeeAlso []

Definition at line 215 of file bacNtk.c.

216{
217 int iCo;
218 assert( Bac_ObjIsCi(p, iOld) );
219 assert( Bac_ObjIsCi(p, iNew) );
220 Bac_ObjForEachFanout( p, iOld, iCo )
221 {
222 assert( Bac_ObjFanin(p, iCo) == iOld );
223 Bac_ObjCleanFanin( p, iCo );
224 Bac_ObjSetFanin( p, iCo, iNew );
225 }
226 Bac_ObjSetFanout( p, iNew, Bac_ObjFanout(p, iOld) );
227 Bac_ObjSetFanout( p, iOld, 0 );
228}
#define Bac_ObjForEachFanout(p, iCi, iCo)
Definition bac.h:392