ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
abcNames.c File Reference
#include "abc.h"
#include "misc/util/utilNam.h"
Include dependency graph for abcNames.c:

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START char * Abc_ObjName (Abc_Obj_t *pObj)
 DECLARATIONS ///.
 
char * Abc_ObjAssignName (Abc_Obj_t *pObj, char *pName, char *pSuffix)
 
char * Abc_ObjNamePrefix (Abc_Obj_t *pObj, char *pPrefix)
 
char * Abc_ObjNameSuffix (Abc_Obj_t *pObj, char *pSuffix)
 
char * Abc_ObjNameDummy (char *pPrefix, int Num, int nDigits)
 
char * Abc_ObjNameChar (int Num, int fCap)
 
void Abc_NtkTrasferNames (Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkNew)
 
void Abc_NtkTrasferNamesNoLatches (Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkNew)
 
Vec_Ptr_tAbc_NodeGetFaninNames (Abc_Obj_t *pNode)
 
Vec_Ptr_tAbc_NodeGetFakeNames (int nNames)
 
void Abc_NodeFreeNames (Vec_Ptr_t *vNames)
 
char ** Abc_NtkCollectCioNames (Abc_Ntk_t *pNtk, int fCollectCos)
 
int Abc_NodeCompareNames (Abc_Obj_t **pp1, Abc_Obj_t **pp2)
 
void Abc_NtkOrderObjsByName (Abc_Ntk_t *pNtk, int fComb)
 
Abc_Nam_tAbc_NtkNameMan (Abc_Ntk_t *p, int fOuts)
 
int Abc_NodeCompareIndexes (Abc_Obj_t **pp1, Abc_Obj_t **pp2)
 
void Abc_NtkTransferOrder (Abc_Ntk_t *pNtkOld, Abc_Ntk_t *pNtkNew)
 
int Abc_NodeCompareCiCo (Abc_Ntk_t *pNtkOld, Abc_Ntk_t *pNtkNew)
 
void Abc_NtkAddDummyPiNames (Abc_Ntk_t *pNtk)
 
void Abc_NtkAddCharPiNames (Abc_Ntk_t *pNtk)
 
void Abc_NtkAddDummyPoNames (Abc_Ntk_t *pNtk)
 
void Abc_NtkAddCharPoNames (Abc_Ntk_t *pNtk)
 
void Abc_NtkAddDummyBoxNames (Abc_Ntk_t *pNtk)
 
void Abc_NtkShortNames (Abc_Ntk_t *pNtk)
 
void Abc_NtkCharNames (Abc_Ntk_t *pNtk)
 
void Abc_NtkCleanNames (Abc_Ntk_t *pNtk)
 
void Abc_NtkRedirectCiCo (Abc_Ntk_t *pNtk)
 
void Abc_NtkMoveNames (Abc_Ntk_t *pNtk, Abc_Ntk_t *pOld)
 
void Abc_NtkStartNameIds (Abc_Ntk_t *p)
 
void Abc_NtkTransferNameIds (Abc_Ntk_t *p, Abc_Ntk_t *pNew)
 
void Abc_NtkUpdateNameIds (Abc_Ntk_t *p)
 

Function Documentation

◆ Abc_NodeCompareCiCo()

int Abc_NodeCompareCiCo ( Abc_Ntk_t * pNtkOld,
Abc_Ntk_t * pNtkNew )

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

Synopsis [Checks that the order and number of CI/CO is the same.]

Description []

SideEffects []

SeeAlso []

Definition at line 466 of file abcNames.c.

467{
468 int i;
469 if ( Abc_NtkPiNum(pNtkOld) != Abc_NtkPiNum(pNtkNew) )
470 return 0;
471 if ( Abc_NtkPoNum(pNtkOld) != Abc_NtkPoNum(pNtkNew) )
472 return 0;
473 if ( Abc_NtkLatchNum(pNtkOld) != Abc_NtkLatchNum(pNtkNew) )
474 return 0;
475 for ( i = 0; i < Abc_NtkCiNum(pNtkOld); i++ )
476 if ( strcmp(Abc_ObjName(Abc_NtkCi(pNtkOld, i)), Abc_ObjName(Abc_NtkCi(pNtkNew, i))) )
477 return 0;
478 for ( i = 0; i < Abc_NtkCoNum(pNtkOld); i++ )
479 if ( strcmp(Abc_ObjName(Abc_NtkCo(pNtkOld, i)), Abc_ObjName(Abc_NtkCo(pNtkNew, i))) )
480 return 0;
481 return 1;
482}
ABC_NAMESPACE_IMPL_START char * Abc_ObjName(Abc_Obj_t *pObj)
DECLARATIONS ///.
Definition abcNames.c:49
int strcmp()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NodeCompareIndexes()

int Abc_NodeCompareIndexes ( Abc_Obj_t ** pp1,
Abc_Obj_t ** pp2 )

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

Synopsis [Orders PIs/POs/latches alphabetically.]

Description []

SideEffects []

SeeAlso []

Definition at line 406 of file abcNames.c.

407{
408 int Diff = (*pp1)->iTemp - (*pp2)->iTemp;
409 if ( Diff < 0 )
410 return -1;
411 if ( Diff > 0 )
412 return 1;
413 return 0;
414}
Here is the caller graph for this function:

◆ Abc_NodeCompareNames()

int Abc_NodeCompareNames ( Abc_Obj_t ** pp1,
Abc_Obj_t ** pp2 )

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

Synopsis [Orders PIs/POs/latches alphabetically.]

Description []

SideEffects []

SeeAlso []

Definition at line 316 of file abcNames.c.

317{
318 int Diff = strcmp( (char *)(*pp1)->pCopy, (char *)(*pp2)->pCopy );
319 if ( Diff < 0 )
320 return -1;
321 if ( Diff > 0 )
322 return 1;
323 Diff = (*pp1)->Id - (*pp2)->Id;
324 if ( Diff < 0 )
325 return -1;
326 if ( Diff > 0 )
327 return 1;
328 return 0;
329}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NodeFreeNames()

void Abc_NodeFreeNames ( Vec_Ptr_t * vNames)

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

Synopsis [Gets fanin node names.]

Description []

SideEffects []

SeeAlso []

Definition at line 264 of file abcNames.c.

265{
266 int i;
267 if ( vNames == NULL )
268 return;
269 for ( i = 0; i < vNames->nSize; i++ )
270 ABC_FREE( vNames->pArray[i] );
271 Vec_PtrFree( vNames );
272}
#define ABC_FREE(obj)
Definition abc_global.h:267
Here is the caller graph for this function:

◆ Abc_NodeGetFakeNames()

Vec_Ptr_t * Abc_NodeGetFakeNames ( int nNames)

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

Synopsis [Gets fanin node names.]

Description []

SideEffects []

SeeAlso []

Definition at line 228 of file abcNames.c.

229{
230 Vec_Ptr_t * vNames;
231 char Buffer[5];
232 int i;
233
234 vNames = Vec_PtrAlloc( nNames );
235 for ( i = 0; i < nNames; i++ )
236 {
237 if ( nNames < 26 )
238 {
239 Buffer[0] = 'a' + i;
240 Buffer[1] = 0;
241 }
242 else
243 {
244 Buffer[0] = 'a' + i%26;
245 Buffer[1] = '0' + i/26;
246 Buffer[2] = 0;
247 }
248 Vec_PtrPush( vNames, Extra_UtilStrsav(Buffer) );
249 }
250 return vNames;
251}
char * Extra_UtilStrsav(const char *s)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NodeGetFaninNames()

Vec_Ptr_t * Abc_NodeGetFaninNames ( Abc_Obj_t * pNode)

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

Synopsis [Gets fanin node names.]

Description []

SideEffects []

SeeAlso []

Definition at line 206 of file abcNames.c.

207{
208 Vec_Ptr_t * vNodes;
209 Abc_Obj_t * pFanin;
210 int i;
211 vNodes = Vec_PtrAlloc( 100 );
212 Abc_ObjForEachFanin( pNode, pFanin, i )
213 Vec_PtrPush( vNodes, Abc_UtilStrsav(Abc_ObjName(pFanin)) );
214 return vNodes;
215}
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition abc.h:527
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkAddCharPiNames()

void Abc_NtkAddCharPiNames ( Abc_Ntk_t * pNtk)

Definition at line 503 of file abcNames.c.

504{
505 Abc_Obj_t * pObj; int i;
506 Abc_NtkForEachPi( pNtk, pObj, i )
507 Abc_ObjAssignName( pObj, Abc_ObjNameChar(i, 0), NULL );
508}
char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition abcNames.c:69
char * Abc_ObjNameChar(int Num, int fCap)
Definition abcNames.c:128
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition abc.h:516
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkAddCharPoNames()

void Abc_NtkAddCharPoNames ( Abc_Ntk_t * pNtk)

Definition at line 529 of file abcNames.c.

530{
531 Abc_Obj_t * pObj; int i;
532 Abc_NtkForEachPo( pNtk, pObj, i )
533 Abc_ObjAssignName( pObj, Abc_ObjNameChar(i, 1), NULL );
534}
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition abc.h:520
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkAddDummyBoxNames()

void Abc_NtkAddDummyBoxNames ( Abc_Ntk_t * pNtk)

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

Synopsis [Adds dummy names.]

Description []

SideEffects []

SeeAlso []

Definition at line 547 of file abcNames.c.

548{
549 char * pName, PrefLi[100], PrefLo[100];
550 Abc_Obj_t * pObj;
551 int nDigits, i, k, CountCur, CountMax = 0;
552 // if PIs/POs already have nodes with what looks like latch names
553 // we need to add different prefix for the new latches
554 Abc_NtkForEachPi( pNtk, pObj, i )
555 {
556 CountCur = 0;
557 pName = Abc_ObjName(pObj);
558 for ( k = 0; pName[k]; k++ )
559 if ( pName[k] == 'l' )
560 CountCur++;
561 else
562 break;
563 CountMax = Abc_MaxInt( CountMax, CountCur );
564 }
565 Abc_NtkForEachPo( pNtk, pObj, i )
566 {
567 CountCur = 0;
568 pName = Abc_ObjName(pObj);
569 for ( k = 0; pName[k]; k++ )
570 if ( pName[k] == 'l' )
571 CountCur++;
572 else
573 break;
574 CountMax = Abc_MaxInt( CountMax, CountCur );
575 }
576//printf( "CountMax = %d\n", CountMax );
577 assert( CountMax < 100-2 );
578 for ( i = 0; i <= CountMax; i++ )
579 PrefLi[i] = PrefLo[i] = 'l';
580 PrefLi[i] = 'i';
581 PrefLo[i] = 'o';
582 PrefLi[i+1] = 0;
583 PrefLo[i+1] = 0;
584 // create latch names
585 assert( !Abc_NtkIsNetlist(pNtk) );
586 nDigits = Abc_Base10Log( Abc_NtkLatchNum(pNtk) );
587 Abc_NtkForEachLatch( pNtk, pObj, i )
588 {
589 Abc_ObjAssignName( pObj, Abc_ObjNameDummy("l", i, nDigits), NULL );
590 Abc_ObjAssignName( Abc_ObjFanin0(pObj), Abc_ObjNameDummy(PrefLi, i, nDigits), NULL );
591 Abc_ObjAssignName( Abc_ObjFanout0(pObj), Abc_ObjNameDummy(PrefLo, i, nDigits), NULL );
592 }
593/*
594 nDigits = Abc_Base10Log( Abc_NtkBlackboxNum(pNtk) );
595 Abc_NtkForEachBlackbox( pNtk, pObj, i )
596 {
597 pName = Abc_ObjAssignName( pObj, Abc_ObjNameDummy("B", i, nDigits), NULL );
598 nDigitsF = Abc_Base10Log( Abc_ObjFaninNum(pObj) );
599 Abc_ObjForEachFanin( pObj, pTerm, k )
600 Abc_ObjAssignName( Abc_ObjFanin0(pObj), pName, Abc_ObjNameDummy("i", k, nDigitsF) );
601 nDigitsF = Abc_Base10Log( Abc_ObjFanoutNum(pObj) );
602 Abc_ObjForEachFanout( pObj, pTerm, k )
603 Abc_ObjAssignName( Abc_ObjFanin0(pObj), pName, Abc_ObjNameDummy("o", k, nDigitsF) );
604 }
605*/
606}
char * Abc_ObjNameDummy(char *pPrefix, int Num, int nDigits)
Definition abcNames.c:122
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition abc.h:500
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkAddDummyPiNames()

void Abc_NtkAddDummyPiNames ( Abc_Ntk_t * pNtk)

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

Synopsis [Adds dummy names.]

Description []

SideEffects []

SeeAlso []

Definition at line 495 of file abcNames.c.

496{
497 Abc_Obj_t * pObj;
498 int nDigits, i;
499 nDigits = Abc_Base10Log( Abc_NtkPiNum(pNtk) );
500 Abc_NtkForEachPi( pNtk, pObj, i )
501 Abc_ObjAssignName( pObj, Abc_ObjNameDummy("pi", i, nDigits), NULL );
502}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkAddDummyPoNames()

void Abc_NtkAddDummyPoNames ( Abc_Ntk_t * pNtk)

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

Synopsis [Adds dummy names.]

Description []

SideEffects []

SeeAlso []

Definition at line 521 of file abcNames.c.

522{
523 Abc_Obj_t * pObj;
524 int nDigits, i;
525 nDigits = Abc_Base10Log( Abc_NtkPoNum(pNtk) );
526 Abc_NtkForEachPo( pNtk, pObj, i )
527 Abc_ObjAssignName( pObj, Abc_ObjNameDummy("po", i, nDigits), NULL );
528}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkCharNames()

void Abc_NtkCharNames ( Abc_Ntk_t * pNtk)

Definition at line 627 of file abcNames.c.

628{
629 Nm_ManFree( pNtk->pManName );
630 pNtk->pManName = Nm_ManCreate( Abc_NtkCiNum(pNtk) + Abc_NtkCoNum(pNtk) + Abc_NtkBoxNum(pNtk) );
631 Abc_NtkAddCharPiNames( pNtk );
632 Abc_NtkAddCharPoNames( pNtk );
634}
void Abc_NtkAddCharPiNames(Abc_Ntk_t *pNtk)
Definition abcNames.c:503
void Abc_NtkAddCharPoNames(Abc_Ntk_t *pNtk)
Definition abcNames.c:529
void Abc_NtkAddDummyBoxNames(Abc_Ntk_t *pNtk)
Definition abcNames.c:547
void Nm_ManFree(Nm_Man_t *p)
Definition nmApi.c:76
Nm_Man_t * Nm_ManCreate(int nSize)
MACRO DEFINITIONS ///.
Definition nmApi.c:45
Nm_Man_t * pManName
Definition abc.h:160
Here is the call graph for this function:

◆ Abc_NtkCleanNames()

void Abc_NtkCleanNames ( Abc_Ntk_t * pNtk)

Definition at line 635 of file abcNames.c.

636{
637 Abc_Obj_t * pObj; int i;
638 Nm_Man_t * pManName = Nm_ManCreate( Abc_NtkCiNum(pNtk) + Abc_NtkCoNum(pNtk) + Abc_NtkBoxNum(pNtk) );
639 Abc_NtkForEachCi( pNtk, pObj, i )
640 Nm_ManStoreIdName( pManName, pObj->Id, pObj->Type, Abc_ObjName(pObj), NULL );
641 Abc_NtkForEachCo( pNtk, pObj, i )
642 Nm_ManStoreIdName( pManName, pObj->Id, pObj->Type, Abc_ObjName(pObj), NULL );
643 Nm_ManFree( pNtk->pManName );
644 pNtk->pManName = pManName;
645}
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition abc.h:522
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition abcNames.c:49
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition abc.h:518
typedefABC_NAMESPACE_HEADER_START struct Nm_Man_t_ Nm_Man_t
INCLUDES ///.
Definition nm.h:63
char * Nm_ManStoreIdName(Nm_Man_t *p, int ObjId, int Type, char *pName, char *pSuffix)
Definition nmApi.c:112
int Id
Definition abc.h:132
unsigned Type
Definition abc.h:133
Here is the call graph for this function:

◆ Abc_NtkCollectCioNames()

char ** Abc_NtkCollectCioNames ( Abc_Ntk_t * pNtk,
int fCollectCos )

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

Synopsis [Collects the CI or CO names.]

Description []

SideEffects []

SeeAlso []

Definition at line 285 of file abcNames.c.

286{
287 Abc_Obj_t * pObj;
288 char ** ppNames;
289 int i;
290 if ( fCollectCos )
291 {
292 ppNames = ABC_ALLOC( char *, Abc_NtkCoNum(pNtk) );
293 Abc_NtkForEachCo( pNtk, pObj, i )
294 ppNames[i] = Abc_ObjName(pObj);
295 }
296 else
297 {
298 ppNames = ABC_ALLOC( char *, Abc_NtkCiNum(pNtk) );
299 Abc_NtkForEachCi( pNtk, pObj, i )
300 ppNames[i] = Abc_ObjName(pObj);
301 }
302 return ppNames;
303}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkMoveNames()

void Abc_NtkMoveNames ( Abc_Ntk_t * pNtk,
Abc_Ntk_t * pOld )

Definition at line 682 of file abcNames.c.

683{
684 Abc_Obj_t * pObj; int i;
685 Nm_ManFree( pNtk->pManName );
686 pNtk->pManName = Nm_ManCreate( Abc_NtkCiNum(pNtk) + Abc_NtkCoNum(pNtk) + Abc_NtkBoxNum(pNtk) );
687 Abc_NtkForEachPi( pNtk, pObj, i )
688 Abc_ObjAssignName( pObj, Abc_ObjName(Abc_NtkPi(pOld, i)), NULL );
689 Abc_NtkForEachPo( pNtk, pObj, i )
690 Abc_ObjAssignName( pObj, Abc_ObjName(Abc_NtkPo(pOld, i)), NULL );
691 Abc_NtkForEachLatch( pNtk, pObj, i )
692 {
693 Abc_ObjAssignName( Abc_ObjFanin0(pObj), Abc_ObjName(Abc_ObjFanin0(Abc_NtkBox(pOld, i))), NULL );
694 Abc_ObjAssignName( Abc_ObjFanout0(pObj), Abc_ObjName(Abc_ObjFanout0(Abc_NtkBox(pOld, i))), NULL );
695 }
696 Abc_NtkRedirectCiCo( pNtk );
697}
void Abc_NtkRedirectCiCo(Abc_Ntk_t *pNtk)
Definition abcNames.c:658
Here is the call graph for this function:

◆ Abc_NtkNameMan()

Abc_Nam_t * Abc_NtkNameMan ( Abc_Ntk_t * p,
int fOuts )

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

Synopsis [Creates name manager storing input/output names.]

Description []

SideEffects []

SeeAlso []

Definition at line 373 of file abcNames.c.

374{
375 if ( fOuts )
376 {
377 Abc_Obj_t * pObj; int i;
378 Abc_Nam_t * pStrsCo = Abc_NamStart( Abc_NtkCoNum(p), 24 );
379 Abc_NtkForEachCo( p, pObj, i )
380 Abc_NamStrFindOrAdd( pStrsCo, Abc_ObjName(pObj), NULL );
381 assert( Abc_NamObjNumMax(pStrsCo) == i + 1 );
382 return pStrsCo;
383 }
384 else
385 {
386 Abc_Obj_t * pObj; int i;
387 Abc_Nam_t * pStrsCi = Abc_NamStart( Abc_NtkCiNum(p), 24 );
388 Abc_NtkForEachCi( p, pObj, i )
389 Abc_NamStrFindOrAdd( pStrsCi, Abc_ObjName(pObj), NULL );
390 assert( Abc_NamObjNumMax(pStrsCi) == i + 1 );
391 return pStrsCi;
392 }
393}
Cube * p
Definition exorList.c:222
int Abc_NamStrFindOrAdd(Abc_Nam_t *p, char *pStr, int *pfFound)
Definition utilNam.c:453
int Abc_NamObjNumMax(Abc_Nam_t *p)
Definition utilNam.c:231
Abc_Nam_t * Abc_NamStart(int nObjs, int nAveSize)
FUNCTION DEFINITIONS ///.
Definition utilNam.c:80
typedefABC_NAMESPACE_HEADER_START struct Abc_Nam_t_ Abc_Nam_t
INCLUDES ///.
Definition utilNam.h:39
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkOrderObjsByName()

void Abc_NtkOrderObjsByName ( Abc_Ntk_t * pNtk,
int fComb )

Definition at line 330 of file abcNames.c.

331{
332 Abc_Obj_t * pObj;
333 int i;
334 assert( Abc_NtkHasOnlyLatchBoxes(pNtk) );
335 // temporarily store the names in the copy field
336 Abc_NtkForEachPi( pNtk, pObj, i )
337 pObj->pCopy = (Abc_Obj_t *)Abc_ObjName(pObj);
338 Abc_NtkForEachPo( pNtk, pObj, i )
339 pObj->pCopy = (Abc_Obj_t *)Abc_ObjName(pObj);
340 Abc_NtkForEachBox( pNtk, pObj, i )
341 pObj->pCopy = (Abc_Obj_t *)Abc_ObjName(Abc_ObjFanout0(pObj));
342 // order objects alphabetically
343 qsort( (void *)Vec_PtrArray(pNtk->vPis), (size_t)Vec_PtrSize(pNtk->vPis), sizeof(Abc_Obj_t *),
344 (int (*)(const void *, const void *)) Abc_NodeCompareNames );
345 qsort( (void *)Vec_PtrArray(pNtk->vPos), (size_t)Vec_PtrSize(pNtk->vPos), sizeof(Abc_Obj_t *),
346 (int (*)(const void *, const void *)) Abc_NodeCompareNames );
347 // if the comparison if combinational (latches as PIs/POs), order them too
348 if ( fComb )
349 qsort( (void *)Vec_PtrArray(pNtk->vBoxes), (size_t)Vec_PtrSize(pNtk->vBoxes), sizeof(Abc_Obj_t *),
350 (int (*)(const void *, const void *)) Abc_NodeCompareNames );
351 // order CIs/COs first PIs/POs(Asserts) then latches
352 Abc_NtkOrderCisCos( pNtk );
353 // clean the copy fields
354 Abc_NtkForEachPi( pNtk, pObj, i )
355 pObj->pCopy = NULL;
356 Abc_NtkForEachPo( pNtk, pObj, i )
357 pObj->pCopy = NULL;
358 Abc_NtkForEachBox( pNtk, pObj, i )
359 pObj->pCopy = NULL;
360}
ABC_DLL int Abc_NodeCompareNames(Abc_Obj_t **pp1, Abc_Obj_t **pp2)
Definition abcNames.c:316
#define Abc_NtkForEachBox(pNtk, pObj, i)
Definition abc.h:498
ABC_DLL void Abc_NtkOrderCisCos(Abc_Ntk_t *pNtk)
Definition abcUtil.c:76
Vec_Ptr_t * vPos
Definition abc.h:164
Vec_Ptr_t * vBoxes
Definition abc.h:168
Vec_Ptr_t * vPis
Definition abc.h:163
Abc_Obj_t * pCopy
Definition abc.h:148
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkRedirectCiCo()

void Abc_NtkRedirectCiCo ( Abc_Ntk_t * pNtk)

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

Synopsis [Moves names from the other network.]

Description []

SideEffects []

SeeAlso []

Definition at line 658 of file abcNames.c.

659{
660 Abc_Obj_t * pObj, * pObjCi, * pFanin;
661 int i, Count = 0;
662 // if CO points to CI with the same name, remove buffer between them
663 Abc_NtkForEachCo( pNtk, pObj, i )
664 {
666 if ( nCiId == -1 )
667 continue;
668 pObjCi = Abc_NtkObj( pNtk, nCiId );
669 assert( !strcmp( Abc_ObjName(pObj), Abc_ObjName(pObjCi) ) );
670 pFanin = Abc_ObjFanin0(pObj);
671 if ( pFanin == pObjCi )
672 continue;
673 assert( Abc_NodeIsBuf(pFanin) );
674 Abc_ObjPatchFanin( pObj, pFanin, pObjCi );
675 if ( Abc_ObjFanoutNum(pFanin) == 0 )
676 Abc_NtkDeleteObj( pFanin );
677 Count++;
678 }
679 if ( Count )
680 printf( "Redirected %d POs from buffers to PIs with the same name.\n", Count );
681}
ABC_DLL void Abc_NtkDeleteObj(Abc_Obj_t *pObj)
Definition abcObj.c:170
ABC_DLL int Abc_NodeIsBuf(Abc_Obj_t *pNode)
Definition abcObj.c:948
@ ABC_OBJ_BO
Definition abc.h:92
@ ABC_OBJ_PI
Definition abc.h:89
ABC_DLL void Abc_ObjPatchFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFaninOld, Abc_Obj_t *pFaninNew)
Definition abcFanio.c:172
int Nm_ManFindIdByNameTwoTypes(Nm_Man_t *p, char *pName, int Type1, int Type2)
Definition nmApi.c:239
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkShortNames()

void Abc_NtkShortNames ( Abc_Ntk_t * pNtk)

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

Synopsis [Replaces names by short names.]

Description []

SideEffects []

SeeAlso []

Definition at line 619 of file abcNames.c.

620{
621 Nm_ManFree( pNtk->pManName );
622 pNtk->pManName = Nm_ManCreate( Abc_NtkCiNum(pNtk) + Abc_NtkCoNum(pNtk) + Abc_NtkBoxNum(pNtk) );
626}
void Abc_NtkAddDummyPoNames(Abc_Ntk_t *pNtk)
Definition abcNames.c:521
void Abc_NtkAddDummyPiNames(Abc_Ntk_t *pNtk)
Definition abcNames.c:495
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkStartNameIds()

void Abc_NtkStartNameIds ( Abc_Ntk_t * p)

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

Synopsis [Saves name IDs into a file.]

Description []

SideEffects []

SeeAlso []

Definition at line 711 of file abcNames.c.

712{
713 char pFileName[1000];
714 FILE * pFile;
715 Abc_Obj_t * pObj, * pFanin;
716 Vec_Ptr_t * vNodes;
717 int i, Counter = 1;
718 assert( Abc_NtkIsNetlist(p) );
719 assert( p->vNameIds == NULL );
720 assert( strlen(p->pSpec) < 1000 );
721 sprintf( pFileName, "%s_%s_names.txt", Extra_FileNameGenericAppend(p->pSpec,""), Extra_FileNameExtension(p->pSpec) );
722 pFile = fopen( pFileName, "wb" );
723 p->vNameIds = Vec_IntStart( Abc_NtkObjNumMax(p) );
724 // add inputs
725 Abc_NtkForEachCi( p, pObj, i )
726 fprintf( pFile, "%s \n", Abc_ObjName(Abc_ObjFanout0(pObj)) ), Vec_IntWriteEntry(p->vNameIds, Abc_ObjId(pObj), 2*Counter++);
727 // add outputs
728 Abc_NtkForEachCo( p, pObj, i )
729 {
730 pFanin = Abc_ObjFanin0(Abc_ObjFanin0(pObj));
731 if ( !Vec_IntEntry(p->vNameIds, Abc_ObjId(pFanin)) )
732 fprintf( pFile, "%s \n", Abc_ObjName(Abc_ObjFanout0(pFanin)) ), Vec_IntWriteEntry(p->vNameIds, Abc_ObjId(pFanin), 2*Counter++);
733 }
734 // add nodes in a topo order
735 vNodes = Abc_NtkDfs( p, 1 );
736 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
737 if ( !Vec_IntEntry(p->vNameIds, Abc_ObjId(pObj)) )
738 fprintf( pFile, "%s \n", Abc_ObjName(Abc_ObjFanout0(pObj)) ), Vec_IntWriteEntry(p->vNameIds, Abc_ObjId(pObj), 2*Counter++);
739 Vec_PtrFree( vNodes );
740 fclose( pFile );
741 // transfer driver node names to COs
742 Abc_NtkForEachCo( p, pObj, i )
743 {
744 pFanin = Abc_ObjFanin0(Abc_ObjFanin0(pObj));
745 Vec_IntWriteEntry( p->vNameIds, Abc_ObjId(pObj), Vec_IntEntry(p->vNameIds, Abc_ObjId(pFanin)) );
746 Vec_IntWriteEntry( p->vNameIds, Abc_ObjId(pFanin), 0 );
747 }
748}
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
Definition abcDfs.c:82
char * Extra_FileNameGenericAppend(char *pBase, char *pSuffix)
char * Extra_FileNameExtension(char *FileName)
int strlen()
char * sprintf()
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
Here is the call graph for this function:

◆ Abc_NtkTransferNameIds()

void Abc_NtkTransferNameIds ( Abc_Ntk_t * p,
Abc_Ntk_t * pNew )

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

Synopsis [Remaps the AIG from the old manager into the new manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 761 of file abcNames.c.

762{
763 Abc_Obj_t * pObj, * pObjNew;
764 int i;
765 assert( p->vNameIds != NULL );
766 assert( pNew->vNameIds == NULL );
767 pNew->vNameIds = Vec_IntStart( Abc_NtkObjNumMax(pNew) );
768// Abc_NtkForEachCi( p, pObj, i )
769// printf( "%d ", Vec_IntEntry(p->vNameIds, Abc_ObjId(pObj)) );
770// printf( "\n" );
771 Abc_NtkForEachObj( p, pObj, i )
772 if ( pObj->pCopy && i < Vec_IntSize(p->vNameIds) && Vec_IntEntry(p->vNameIds, i) )
773 {
774 pObjNew = Abc_ObjRegular(pObj->pCopy);
775 assert( Abc_ObjNtk(pObjNew) == pNew );
776 if ( Abc_ObjIsCi(pObjNew) && !Abc_ObjIsCi(pObj) ) // do not overwrite CI name by internal node name
777 continue;
778 Vec_IntWriteEntry( pNew->vNameIds, Abc_ObjId(pObjNew), Vec_IntEntry(p->vNameIds, i) ^ Abc_ObjIsComplement(pObj->pCopy) );
779 }
780}
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition abc.h:449
Vec_Int_t * vNameIds
Definition abc.h:215
Here is the caller graph for this function:

◆ Abc_NtkTransferOrder()

void Abc_NtkTransferOrder ( Abc_Ntk_t * pNtkOld,
Abc_Ntk_t * pNtkNew )

Definition at line 415 of file abcNames.c.

416{
417 Abc_Obj_t * pObj; int i;
418 Abc_Nam_t * pStrsCi = Abc_NtkNameMan( pNtkOld, 0 );
419 Abc_Nam_t * pStrsCo = Abc_NtkNameMan( pNtkOld, 1 );
420 assert( Abc_NtkPiNum(pNtkOld) == Abc_NtkPiNum(pNtkNew) );
421 assert( Abc_NtkPoNum(pNtkOld) == Abc_NtkPoNum(pNtkNew) );
422 assert( Abc_NtkLatchNum(pNtkOld) == Abc_NtkLatchNum(pNtkNew) );
423 // transfer to the new network
424 Abc_NtkForEachCi( pNtkNew, pObj, i )
425 {
426 pObj->iTemp = Abc_NamStrFind(pStrsCi, Abc_ObjName(pObj));
427 assert( pObj->iTemp > 0 && pObj->iTemp <= Abc_NtkCiNum(pNtkNew) );
428 }
429 Abc_NtkForEachCo( pNtkNew, pObj, i )
430 {
431 pObj->iTemp = Abc_NamStrFind(pStrsCo, Abc_ObjName(pObj));
432 assert( pObj->iTemp > 0 && pObj->iTemp <= Abc_NtkCoNum(pNtkNew) );
433 }
434 Abc_NamDeref( pStrsCi );
435 Abc_NamDeref( pStrsCo );
436 // order PI/PO
437 qsort( (void *)Vec_PtrArray(pNtkNew->vPis), (size_t)Vec_PtrSize(pNtkNew->vPis), sizeof(Abc_Obj_t *),
438 (int (*)(const void *, const void *)) Abc_NodeCompareIndexes );
439 qsort( (void *)Vec_PtrArray(pNtkNew->vPos), (size_t)Vec_PtrSize(pNtkNew->vPos), sizeof(Abc_Obj_t *),
440 (int (*)(const void *, const void *)) Abc_NodeCompareIndexes );
441 // order CI/CO
442 qsort( (void *)Vec_PtrArray(pNtkNew->vCis), (size_t)Vec_PtrSize(pNtkNew->vCis), sizeof(Abc_Obj_t *),
443 (int (*)(const void *, const void *)) Abc_NodeCompareIndexes );
444 qsort( (void *)Vec_PtrArray(pNtkNew->vCos), (size_t)Vec_PtrSize(pNtkNew->vCos), sizeof(Abc_Obj_t *),
445 (int (*)(const void *, const void *)) Abc_NodeCompareIndexes );
446 // order CIs/COs first PIs/POs(Asserts) then latches
447 //Abc_NtkOrderCisCos( pNtk );
448 // clean the copy fields
449 Abc_NtkForEachCi( pNtkNew, pObj, i )
450 pObj->iTemp = 0;
451 Abc_NtkForEachCo( pNtkNew, pObj, i )
452 pObj->iTemp = 0;
453}
Abc_Nam_t * Abc_NtkNameMan(Abc_Ntk_t *p, int fOuts)
Definition abcNames.c:373
int Abc_NodeCompareIndexes(Abc_Obj_t **pp1, Abc_Obj_t **pp2)
Definition abcNames.c:406
Vec_Ptr_t * vCis
Definition abc.h:165
Vec_Ptr_t * vCos
Definition abc.h:166
int iTemp
Definition abc.h:149
int Abc_NamStrFind(Abc_Nam_t *p, char *pStr)
Definition utilNam.c:433
void Abc_NamDeref(Abc_Nam_t *p)
Definition utilNam.c:212
Here is the call graph for this function:

◆ Abc_NtkTrasferNames()

void Abc_NtkTrasferNames ( Abc_Ntk_t * pNtk,
Abc_Ntk_t * pNtkNew )

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

Synopsis [Tranfers names to the old network.]

Description [Assumes that the new nodes are attached using pObj->pCopy.]

SideEffects []

SeeAlso []

Definition at line 146 of file abcNames.c.

147{
148 Abc_Obj_t * pObj;
149 int i;
150 assert( Abc_NtkPiNum(pNtk) == Abc_NtkPiNum(pNtkNew) );
151 assert( Abc_NtkPoNum(pNtk) == Abc_NtkPoNum(pNtkNew) );
152 assert( Abc_NtkBoxNum(pNtk) == Abc_NtkBoxNum(pNtkNew) );
153 assert( Nm_ManNumEntries(pNtk->pManName) > 0 );
154 assert( Nm_ManNumEntries(pNtkNew->pManName) == 0 );
155 // copy the CI/CO/box names
156 Abc_NtkForEachCi( pNtk, pObj, i )
157 Abc_ObjAssignName( pObj->pCopy, Abc_ObjName(Abc_ObjFanout0Ntk(pObj)), NULL );
158 Abc_NtkForEachCo( pNtk, pObj, i )
159 Abc_ObjAssignName( pObj->pCopy, Abc_ObjName(Abc_ObjFanin0Ntk(pObj)), NULL );
160 Abc_NtkForEachBox( pNtk, pObj, i )
161 Abc_ObjAssignName( pObj->pCopy, Abc_ObjName(pObj), NULL );
162}
int Nm_ManNumEntries(Nm_Man_t *p)
Definition nmApi.c:95
Here is the call graph for this function:

◆ Abc_NtkTrasferNamesNoLatches()

void Abc_NtkTrasferNamesNoLatches ( Abc_Ntk_t * pNtk,
Abc_Ntk_t * pNtkNew )

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

Synopsis [Tranfers names to the old network.]

Description [Assumes that the new nodes are attached using pObj->pCopy.]

SideEffects []

SeeAlso []

Definition at line 175 of file abcNames.c.

176{
177 Abc_Obj_t * pObj;
178 int i;
179 assert( Abc_NtkPiNum(pNtk) == Abc_NtkPiNum(pNtkNew) );
180 assert( Abc_NtkPoNum(pNtk) == Abc_NtkPoNum(pNtkNew) );
181 assert( Nm_ManNumEntries(pNtk->pManName) > 0 );
182 assert( Nm_ManNumEntries(pNtkNew->pManName) == 0 );
183 // copy the CI/CO/box name and skip latches and theirs inputs/outputs
184 Abc_NtkForEachCi( pNtk, pObj, i )
185 if ( Abc_ObjFaninNum(pObj) == 0 || !Abc_ObjIsLatch(Abc_ObjFanin0(pObj)) )
186 Abc_ObjAssignName( pObj->pCopy, Abc_ObjName(Abc_ObjFanout0Ntk(pObj)), NULL );
187 Abc_NtkForEachCo( pNtk, pObj, i )
188 if ( Abc_ObjFanoutNum(pObj) == 0 || !Abc_ObjIsLatch(Abc_ObjFanout0(pObj)) )
189 Abc_ObjAssignName( pObj->pCopy, Abc_ObjName(Abc_ObjFanin0Ntk(pObj)), NULL );
190 Abc_NtkForEachBox( pNtk, pObj, i )
191 if ( !Abc_ObjIsLatch(pObj) )
192 Abc_ObjAssignName( pObj->pCopy, Abc_ObjName(pObj), NULL );
193}
Here is the call graph for this function:

◆ Abc_NtkUpdateNameIds()

void Abc_NtkUpdateNameIds ( Abc_Ntk_t * p)

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

Synopsis [Updates file with name IDs.]

Description []

SideEffects []

SeeAlso []

Definition at line 793 of file abcNames.c.

794{
795 char pFileName[1000];
796 Vec_Int_t * vStarts;
797 Abc_Obj_t * pObj;
798 FILE * pFile;
799 int i, c, iVar, fCompl, fSeenSpace, Counter = 0;
800 assert( !Abc_NtkIsNetlist(p) );
801 assert( strlen(p->pSpec) < 1000 );
802 assert( p->vNameIds != NULL );
803 sprintf( pFileName, "%s_%s_names.txt", Extra_FileNameGenericAppend(p->pSpec,""), Extra_FileNameExtension(p->pSpec) );
804 pFile = fopen( pFileName, "r+" );
805 // collect info about lines
806 fSeenSpace = 0;
807 vStarts = Vec_IntAlloc( 1000 );
808 Vec_IntPush( vStarts, -1 );
809 while ( (c = fgetc(pFile)) != EOF && ++Counter )
810 if ( c == ' ' && !fSeenSpace )
811 Vec_IntPush(vStarts, Counter), fSeenSpace = 1;
812 else if ( c == '\n' )
813 fSeenSpace = 0;
814 // add info about names
815 Abc_NtkForEachObj( p, pObj, i )
816 {
817 if ( i == 0 || i >= Vec_IntSize(p->vNameIds) || !Vec_IntEntry(p->vNameIds, i) )
818 continue;
819 iVar = Abc_Lit2Var( Vec_IntEntry(p->vNameIds, i) );
820 fCompl = Abc_LitIsCompl( Vec_IntEntry(p->vNameIds, i) );
821 assert( iVar < Vec_IntSize(vStarts) );
822 fseek( pFile, Vec_IntEntry(vStarts, iVar), SEEK_SET );
823 fprintf( pFile, "%s%d", fCompl? "-":"", i );
824 }
825 printf( "Saved %d names into file \"%s\".\n", Vec_IntSize(vStarts)-1, pFileName );
826 fclose( pFile );
827 Vec_IntFree( vStarts );
828 Vec_IntFreeP( &p->vNameIds );
829// Abc_NtkForEachObj( p, pObj, i )
830// Abc_ObjPrint( stdout, pObj );
831}
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
#define SEEK_SET
Definition zconf.h:390
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_ObjAssignName()

char * Abc_ObjAssignName ( Abc_Obj_t * pObj,
char * pName,
char * pSuffix )

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

Synopsis [Assigns the given name to the object.]

Description [The object should not have a name assigned. The same name may be used for several objects, which they share the same net in the original netlist. (For example, latch output and primary output may have the same name.) This procedure returns the pointer to the internally stored representation of the given name.]

SideEffects []

SeeAlso []

Definition at line 69 of file abcNames.c.

70{
71 assert( pName != NULL );
72 return Nm_ManStoreIdName( pObj->pNtk->pManName, pObj->Id, pObj->Type, pName, pSuffix );
73}
Abc_Ntk_t * pNtk
Definition abc.h:130
Here is the call graph for this function:

◆ Abc_ObjName()

ABC_NAMESPACE_IMPL_START char * Abc_ObjName ( Abc_Obj_t * pObj)

DECLARATIONS ///.

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

FileName [abcNames.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [Procedures working with net and node names.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Returns the unique name for the object.]

Description [If the name previously did not exist, creates a new unique name but does not assign this name to the object. The temporary unique name is stored in a static buffer inside this procedure. It is important that the name is used before the function is called again!]

SideEffects []

SeeAlso []

Definition at line 49 of file abcNames.c.

50{
51 return Nm_ManCreateUniqueName( pObj->pNtk->pManName, pObj->Id );
52}
char * Nm_ManCreateUniqueName(Nm_Man_t *p, int ObjId)
Definition nmApi.c:175
Here is the call graph for this function:

◆ Abc_ObjNameChar()

char * Abc_ObjNameChar ( int Num,
int fCap )

Definition at line 128 of file abcNames.c.

129{
130 static char Buffer[2000];
131 sprintf( Buffer, "%c", (fCap ? 'A':'a') + Num );
132 return Buffer;
133}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_ObjNameDummy()

char * Abc_ObjNameDummy ( char * pPrefix,
int Num,
int nDigits )

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

Synopsis [Returns the dummy PI name.]

Description []

SideEffects []

SeeAlso []

Definition at line 122 of file abcNames.c.

123{
124 static char Buffer[2000];
125 sprintf( Buffer, "%s%0*d", pPrefix, nDigits, Num );
126 return Buffer;
127}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_ObjNamePrefix()

char * Abc_ObjNamePrefix ( Abc_Obj_t * pObj,
char * pPrefix )

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

Synopsis [Appends name to the prefix]

Description []

SideEffects []

SeeAlso []

Definition at line 86 of file abcNames.c.

87{
88 static char Buffer[2000];
89 sprintf( Buffer, "%s%s", pPrefix, Abc_ObjName(pObj) );
90 return Buffer;
91}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_ObjNameSuffix()

char * Abc_ObjNameSuffix ( Abc_Obj_t * pObj,
char * pSuffix )

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

Synopsis [Appends suffic to the name.]

Description []

SideEffects []

SeeAlso []

Definition at line 104 of file abcNames.c.

105{
106 static char Buffer[2000];
107 sprintf( Buffer, "%s%s", Abc_ObjName(pObj), pSuffix );
108 return Buffer;
109}
Here is the call graph for this function:
Here is the caller graph for this function: