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

Go to the source code of this file.

Macros

#define ABC_OBJ_VOID   ((Abc_Obj_t *)(ABC_PTRINT_T)1)
 DECLARATIONS ///.
 

Functions

int Abc_NtkCheckSingleInstance (Abc_Ntk_t *pNtk)
 FUNCTION DEFINITIONS ///.
 
int Abc_NtkCollectPiPos_rec (Abc_Obj_t *pNet, Vec_Ptr_t *vLiMaps, Vec_Ptr_t *vLoMaps)
 
int Abc_NtkCollectPiPos_int (Abc_Obj_t *pBox, Abc_Ntk_t *pNtk, Vec_Ptr_t *vLiMaps, Vec_Ptr_t *vLoMaps)
 
int Abc_NtkCollectPiPos (Abc_Ntk_t *pNtk, Vec_Ptr_t **pvLiMaps, Vec_Ptr_t **pvLoMaps)
 
Abc_Obj_tAbc_NtkToBarBufs_rec (Abc_Ntk_t *pNtkNew, Abc_Obj_t *pNet)
 
Abc_Ntk_tAbc_NtkToBarBufs (Abc_Ntk_t *pNtk)
 
Abc_Obj_tAbc_NtkFromBarBufs_rec (Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj)
 
Abc_Ntk_tAbc_NtkFromBarBufs (Abc_Ntk_t *pNtkBase, Abc_Ntk_t *pNtk)
 
void Abc_NtkToBarBufsCollect_rec (Abc_Obj_t *pObj, Vec_Ptr_t *vNodes)
 
Vec_Ptr_tAbc_NtkToBarBufsCollect (Abc_Ntk_t *pNtk)
 
int Abc_NtkCountBarBufs (Abc_Ntk_t *pNtk)
 
Abc_Ntk_tAbc_NtkBarBufsToBuffers (Abc_Ntk_t *pNtk)
 
Abc_Ntk_tAbc_NtkBarBufsFromBuffers (Abc_Ntk_t *pNtkBase, Abc_Ntk_t *pNtk)
 
Abc_Ntk_tAbc_NtkBarBufsOnOffTest (Abc_Ntk_t *pNtk)
 

Macro Definition Documentation

◆ ABC_OBJ_VOID

#define ABC_OBJ_VOID   ((Abc_Obj_t *)(ABC_PTRINT_T)1)

DECLARATIONS ///.

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

FileName [abcHie.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [Procedures to handle hierarchy.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

Definition at line 30 of file abcBarBuf.c.

Function Documentation

◆ Abc_NtkBarBufsFromBuffers()

Abc_Ntk_t * Abc_NtkBarBufsFromBuffers ( Abc_Ntk_t * pNtkBase,
Abc_Ntk_t * pNtk )

Definition at line 462 of file abcBarBuf.c.

463{
464 Abc_Ntk_t * pNtkNew;
465 Abc_Obj_t * pObj, * pFanin, * pLatch;
466 int i, k, nBarBufs;
467 assert( Abc_NtkIsLogic(pNtkBase) );
468 assert( Abc_NtkIsLogic(pNtk) );
469 assert( pNtkBase->nBarBufs == Abc_NtkLatchNum(pNtkBase) );
470 // start the network
471 pNtkNew = Abc_NtkStartFrom( pNtkBase, pNtk->ntkType, pNtk->ntkFunc );
472 // transfer PI pointers
473 Abc_NtkForEachPi( pNtk, pObj, i )
474 pObj->pCopy = Abc_NtkPi(pNtkNew, i);
475 // assuming that the order/number of barbufs remains the same
476 nBarBufs = 0;
477 Abc_NtkForEachNode( pNtk, pObj, i )
478 {
479 if ( Abc_ObjIsBarBuf(pObj) )
480 {
481 pLatch = Abc_NtkBox(pNtkNew, nBarBufs++);
482 Abc_ObjAddFanin( Abc_ObjFanin0(pLatch), Abc_ObjFanin0(pObj)->pCopy );
483 pObj->pCopy = Abc_ObjFanout0(pLatch);
484 }
485 else
486 {
487 Abc_NtkDupObj( pNtkNew, pObj, 1 );
488 Abc_ObjForEachFanin( pObj, pFanin, k )
489 Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy );
490 }
491 }
492 assert( nBarBufs == pNtkBase->nBarBufs );
493 // connect POs
494 Abc_NtkForEachPo( pNtk, pObj, i )
495 Abc_ObjAddFanin( Abc_NtkPo(pNtkNew, i), Abc_ObjFanin0(pObj)->pCopy );
496 return pNtkNew;
497}
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition abcFanio.c:84
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition abc.h:520
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition abcObj.c:342
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition abc.h:527
struct Abc_Ntk_t_ Abc_Ntk_t
Definition abc.h:115
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition abc.h:516
ABC_DLL Abc_Ntk_t * Abc_NtkStartFrom(Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func)
Definition abcNtk.c:157
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition abc.h:464
Abc_NtkType_t ntkType
Definition abc.h:156
int nBarBufs
Definition abc.h:174
Abc_NtkFunc_t ntkFunc
Definition abc.h:157
Abc_Obj_t * pCopy
Definition abc.h:148
#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_NtkBarBufsOnOffTest()

Abc_Ntk_t * Abc_NtkBarBufsOnOffTest ( Abc_Ntk_t * pNtk)

Definition at line 498 of file abcBarBuf.c.

499{
500 Abc_Ntk_t * pNtkNew, * pNtkNew2;
501 pNtkNew = Abc_NtkBarBufsToBuffers( pNtk );
502 pNtkNew2 = Abc_NtkBarBufsFromBuffers( pNtk, pNtkNew );
503 Abc_NtkDelete( pNtkNew );
504 return pNtkNew2;
505}
Abc_Ntk_t * Abc_NtkBarBufsFromBuffers(Abc_Ntk_t *pNtkBase, Abc_Ntk_t *pNtk)
Definition abcBarBuf.c:462
Abc_Ntk_t * Abc_NtkBarBufsToBuffers(Abc_Ntk_t *pNtk)
Definition abcBarBuf.c:424
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition abcNtk.c:1421
Here is the call graph for this function:

◆ Abc_NtkBarBufsToBuffers()

Abc_Ntk_t * Abc_NtkBarBufsToBuffers ( Abc_Ntk_t * pNtk)

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

Synopsis [Converts the network to dedicated barbufs and back.]

Description []

SideEffects []

SeeAlso []

Definition at line 424 of file abcBarBuf.c.

425{
426 Vec_Ptr_t * vNodes;
427 Abc_Ntk_t * pNtkNew;
428 Abc_Obj_t * pObj, * pFanin;
429 int i, k;
430 assert( Abc_NtkIsLogic(pNtk) );
431 assert( pNtk->pDesign == NULL );
432 assert( pNtk->nBarBufs > 0 );
433 assert( pNtk->nBarBufs == Abc_NtkLatchNum(pNtk) );
434 vNodes = Abc_NtkToBarBufsCollect( pNtk );
435 // start the network
436 pNtkNew = Abc_NtkAlloc( ABC_NTK_LOGIC, pNtk->ntkFunc, 1 );
437 pNtkNew->pName = Extra_UtilStrsav(pNtk->pName);
438 pNtkNew->pSpec = Extra_UtilStrsav(pNtk->pSpec);
439 // create objects
440 Abc_NtkCleanCopy( pNtk );
441 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
442 {
443 if ( Abc_ObjIsPi(pObj) )
444 Abc_NtkDupObj( pNtkNew, pObj, 1 );
445 else if ( Abc_ObjIsPo( pObj) )
446 Abc_ObjAddFanin( Abc_NtkDupObj(pNtkNew, pObj, 1), Abc_ObjFanin0(pObj)->pCopy );
447 else if ( Abc_ObjIsBi(pObj) || Abc_ObjIsBo(pObj) )
448 pObj->pCopy = Abc_ObjFanin0(pObj)->pCopy;
449 else if ( Abc_ObjIsLatch(pObj) )
450 Abc_ObjAddFanin( (pObj->pCopy = Abc_NtkCreateNode(pNtkNew)), Abc_ObjFanin0(pObj)->pCopy );
451 else if ( Abc_ObjIsNode(pObj) )
452 {
453 Abc_NtkDupObj( pNtkNew, pObj, 1 );
454 Abc_ObjForEachFanin( pObj, pFanin, k )
455 Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy );
456 }
457 else assert( 0 );
458 }
459 Vec_PtrFree( vNodes );
460 return pNtkNew;
461}
Vec_Ptr_t * Abc_NtkToBarBufsCollect(Abc_Ntk_t *pNtk)
Definition abcBarBuf.c:352
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition abcNtk.c:53
@ ABC_NTK_LOGIC
Definition abc.h:57
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition abcUtil.c:540
char * Extra_UtilStrsav(const char *s)
char * pName
Definition abc.h:158
Abc_Des_t * pDesign
Definition abc.h:180
char * pSpec
Definition abc.h:159
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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkCheckSingleInstance()

int Abc_NtkCheckSingleInstance ( Abc_Ntk_t * pNtk)

FUNCTION DEFINITIONS ///.

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

Synopsis [Checks the the hie design has no duplicated networks.]

Description []

SideEffects []

SeeAlso []

Definition at line 47 of file abcBarBuf.c.

48{
49 Abc_Ntk_t * pTemp, * pModel;
50 Abc_Obj_t * pBox;
51 int i, k, RetValue = 1;
52 if ( pNtk->pDesign == NULL )
53 return 1;
54 Vec_PtrForEachEntry( Abc_Ntk_t *, pNtk->pDesign->vModules, pTemp, i )
55 pTemp->fHieVisited = 0;
56 Vec_PtrForEachEntry( Abc_Ntk_t *, pNtk->pDesign->vModules, pTemp, i )
57 Abc_NtkForEachBox( pTemp, pBox, k )
58 {
59 pModel = (Abc_Ntk_t *)pBox->pData;
60 if ( pModel == NULL )
61 continue;
62 if ( Abc_NtkLatchNum(pModel) > 0 )
63 {
64 printf( "Network \"%s\" contains %d flops.\n",
65 Abc_NtkName(pNtk), Abc_NtkLatchNum(pModel) );
66 RetValue = 0;
67 }
68 if ( pModel->fHieVisited )
69 {
70 printf( "Network \"%s\" contains box \"%s\" whose model \"%s\" is instantiated more than once.\n",
71 Abc_NtkName(pNtk), Abc_ObjName(pBox), Abc_NtkName(pModel) );
72 RetValue = 0;
73 }
74 pModel->fHieVisited = 1;
75 }
76 Vec_PtrForEachEntry( Abc_Ntk_t *, pNtk->pDesign->vModules, pTemp, i )
77 pTemp->fHieVisited = 0;
78 return RetValue;
79}
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition abcNames.c:49
#define Abc_NtkForEachBox(pNtk, pObj, i)
Definition abc.h:498
Vec_Ptr_t * vModules
Definition abc.h:225
int fHieVisited
Definition abc.h:182
void * pData
Definition abc.h:145
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkCollectPiPos()

int Abc_NtkCollectPiPos ( Abc_Ntk_t * pNtk,
Vec_Ptr_t ** pvLiMaps,
Vec_Ptr_t ** pvLoMaps )

Definition at line 147 of file abcBarBuf.c.

148{
149 assert( Abc_NtkIsNetlist(pNtk) );
150 *pvLiMaps = Vec_PtrAlloc( 1000 );
151 *pvLoMaps = Vec_PtrAlloc( 1000 );
152 return Abc_NtkCollectPiPos_int( NULL, pNtk, *pvLiMaps, *pvLoMaps );
153}
int Abc_NtkCollectPiPos_int(Abc_Obj_t *pBox, Abc_Ntk_t *pNtk, Vec_Ptr_t *vLiMaps, Vec_Ptr_t *vLoMaps)
Definition abcBarBuf.c:117
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkCollectPiPos_int()

int Abc_NtkCollectPiPos_int ( Abc_Obj_t * pBox,
Abc_Ntk_t * pNtk,
Vec_Ptr_t * vLiMaps,
Vec_Ptr_t * vLoMaps )

Definition at line 117 of file abcBarBuf.c.

118{
119 Abc_Obj_t * pObj;
120 int i, Counter = 0;
121 // mark primary inputs
122 Abc_NtkIncrementTravId( pNtk );
123 Abc_NtkForEachPi( pNtk, pObj, i )
124 Abc_NodeSetTravIdCurrent( Abc_ObjFanout0(pObj) );
125 // add primary inputs
126 if ( pBox )
127 {
128 Abc_ObjForEachFanin( pBox, pObj, i )
129 Vec_PtrPush( vLiMaps, pObj );
130 Abc_NtkForEachPi( pNtk, pObj, i )
131 Vec_PtrPush( vLoMaps, pObj );
132 }
133 // visit primary outputs
134 Abc_NtkForEachPo( pNtk, pObj, i )
135 Counter += Abc_NtkCollectPiPos_rec( Abc_ObjFanin0(pObj), vLiMaps, vLoMaps );
136 // add primary outputs
137 if ( pBox )
138 {
139 Abc_NtkForEachPo( pNtk, pObj, i )
140 Vec_PtrPush( vLiMaps, pObj );
141 Abc_ObjForEachFanout( pBox, pObj, i )
142 Vec_PtrPush( vLoMaps, pObj );
143 Counter++;
144 }
145 return Counter;
146}
int Abc_NtkCollectPiPos_rec(Abc_Obj_t *pNet, Vec_Ptr_t *vLiMaps, Vec_Ptr_t *vLoMaps)
Definition abcBarBuf.c:92
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition abc.h:529
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkCollectPiPos_rec()

int Abc_NtkCollectPiPos_rec ( Abc_Obj_t * pNet,
Vec_Ptr_t * vLiMaps,
Vec_Ptr_t * vLoMaps )

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

Synopsis [Collect PIs and POs of internal networks in the topo order.]

Description []

SideEffects []

SeeAlso []

Definition at line 92 of file abcBarBuf.c.

93{
94 extern int Abc_NtkCollectPiPos_int( Abc_Obj_t * pBox, Abc_Ntk_t * pNtk, Vec_Ptr_t * vLiMaps, Vec_Ptr_t * vLoMaps );
95 Abc_Obj_t * pObj, * pFanin;
96 int i, Counter = 0;
97 assert( Abc_ObjIsNet(pNet) );
98 if ( Abc_NodeIsTravIdCurrent( pNet ) )
99 return 0;
100 Abc_NodeSetTravIdCurrent( pNet );
101 pObj = Abc_ObjFanin0(pNet);
102 if ( Abc_ObjIsNode(pObj) )
103 Abc_ObjForEachFanin( pObj, pFanin, i )
104 Counter += Abc_NtkCollectPiPos_rec( pFanin, vLiMaps, vLoMaps );
105 if ( Abc_ObjIsNode(pObj) )
106 return Counter;
107 if ( Abc_ObjIsBo(pObj) )
108 pObj = Abc_ObjFanin0(pObj);
109 assert( Abc_ObjIsBox(pObj) );
110 Abc_ObjForEachFanout( pObj, pFanin, i )
111 Abc_NodeSetTravIdCurrent( Abc_ObjFanout0(pFanin) );
112 Abc_ObjForEachFanin( pObj, pFanin, i )
113 Counter += Abc_NtkCollectPiPos_rec( Abc_ObjFanin0(pFanin), vLiMaps, vLoMaps );
114 Counter += Abc_NtkCollectPiPos_int( pObj, Abc_ObjModel(pObj), vLiMaps, vLoMaps );
115 return Counter;
116}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkCountBarBufs()

int Abc_NtkCountBarBufs ( Abc_Ntk_t * pNtk)

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

Synopsis [Count barrier buffers.]

Description []

SideEffects []

SeeAlso []

Definition at line 404 of file abcBarBuf.c.

405{
406 Abc_Obj_t * pObj;
407 int i, Counter = 0;
408 Abc_NtkForEachNode( pNtk, pObj, i )
409 Counter += Abc_ObjIsBarBuf( pObj );
410 return Counter;
411}

◆ Abc_NtkFromBarBufs()

Abc_Ntk_t * Abc_NtkFromBarBufs ( Abc_Ntk_t * pNtkBase,
Abc_Ntk_t * pNtk )

Definition at line 263 of file abcBarBuf.c.

264{
265 Abc_Ntk_t * pNtkNew, * pTemp;
266 Vec_Ptr_t * vLiMaps, * vLoMaps;
267 Abc_Obj_t * pObj, * pLiMap, * pLoMap;
268 int i, k;
269 assert( pNtkBase->pDesign != NULL );
270 assert( Abc_NtkIsNetlist(pNtk) );
271 assert( Abc_NtkIsNetlist(pNtkBase) );
272 assert( Abc_NtkLatchNum(pNtkBase) == 0 );
273 assert( Abc_NtkLatchNum(pNtk) == pNtk->nBarBufs );
274 assert( Abc_NtkWhiteboxNum(pNtk) == 0 );
275 assert( Abc_NtkBlackboxNum(pNtk) == 0 );
276 assert( Abc_NtkPiNum(pNtk) == Abc_NtkPiNum(pNtkBase) );
277 assert( Abc_NtkPoNum(pNtk) == Abc_NtkPoNum(pNtkBase) );
278 // start networks
279 Abc_NtkCleanCopy_rec( pNtkBase );
280 Vec_PtrForEachEntry( Abc_Ntk_t *, pNtkBase->pDesign->vModules, pTemp, i )
281 pTemp->pCopy = Abc_NtkStartFrom( pTemp, pNtk->ntkType, pNtk->ntkFunc );
282 Vec_PtrForEachEntry( Abc_Ntk_t *, pNtkBase->pDesign->vModules, pTemp, i )
283 pTemp->pCopy->pAltView = pTemp->pAltView ? pTemp->pAltView->pCopy : NULL;
284 // update box models
285 Vec_PtrForEachEntry( Abc_Ntk_t *, pNtkBase->pDesign->vModules, pTemp, i )
286 Abc_NtkForEachBox( pTemp, pObj, k )
287 if ( Abc_ObjIsWhitebox(pObj) || Abc_ObjIsBlackbox(pObj) )
288 pObj->pCopy->pData = Abc_ObjModel(pObj)->pCopy;
289 // create the design
290 pNtkNew = pNtkBase->pCopy;
291 pNtkNew->pDesign = Abc_DesCreate( pNtkBase->pDesign->pName );
292 Vec_PtrForEachEntry( Abc_Ntk_t *, pNtkBase->pDesign->vModules, pTemp, i )
293 Abc_DesAddModel( pNtkNew->pDesign, pTemp->pCopy );
294 Vec_PtrForEachEntry( Abc_Ntk_t *, pNtkBase->pDesign->vTops, pTemp, i )
295 Vec_PtrPush( pNtkNew->pDesign->vTops, pTemp->pCopy );
296 assert( Vec_PtrEntry(pNtkNew->pDesign->vTops, 0) == pNtkNew );
297 // transfer copy attributes to pNtk
298 Abc_NtkCleanCopy( pNtk );
299 Abc_NtkForEachPi( pNtk, pObj, i )
300 pObj->pCopy = Abc_NtkPi(pNtkNew, i);
301 Abc_NtkForEachPo( pNtk, pObj, i )
302 pObj->pCopy = Abc_NtkPo(pNtkNew, i);
303 Abc_NtkCollectPiPos( pNtkBase, &vLiMaps, &vLoMaps );
304 assert( Vec_PtrSize(vLiMaps) == Abc_NtkLatchNum(pNtk) );
305 assert( Vec_PtrSize(vLoMaps) == Abc_NtkLatchNum(pNtk) );
306 Vec_PtrForEachEntryTwo( Abc_Obj_t *, vLiMaps, Abc_Obj_t *, vLoMaps, pLiMap, pLoMap, i )
307 {
308 pObj = Abc_NtkBox( pNtk, i );
309 Abc_ObjFanin0(pObj)->pCopy = pLiMap->pCopy;
310 Abc_ObjFanout0(pObj)->pCopy = pLoMap->pCopy;
311 }
312 Vec_PtrFree( vLiMaps );
313 Vec_PtrFree( vLoMaps );
314 // create internal nodes
315 Abc_NtkForEachCo( pNtk, pObj, i )
316 Abc_ObjAddFanin( pObj->pCopy, Abc_NtkFromBarBufs_rec(pObj->pCopy->pNtk, Abc_ObjFanin0(pObj)) );
317 // transfer net names
318 Abc_NtkForEachCi( pNtk, pObj, i )
319 {
320 if ( Abc_ObjFanoutNum(pObj->pCopy) == 0 ) // handle PI without fanout
321 Abc_ObjAddFanin( Abc_NtkCreateNet(pObj->pCopy->pNtk), pObj->pCopy );
322 Nm_ManStoreIdName( pObj->pCopy->pNtk->pManName, Abc_ObjFanout0(pObj->pCopy)->Id, Abc_ObjFanout0(pObj->pCopy)->Type, Abc_ObjName(Abc_ObjFanout0(pObj)), NULL );
323 }
324 Abc_NtkForEachCo( pNtk, pObj, i )
325 Nm_ManStoreIdName( pObj->pCopy->pNtk->pManName, Abc_ObjFanin0(pObj->pCopy)->Id, Abc_ObjFanin0(pObj->pCopy)->Type, Abc_ObjName(Abc_ObjFanin0(pObj)), NULL );
326 return pNtkNew;
327}
Abc_Obj_t * Abc_NtkFromBarBufs_rec(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj)
Definition abcBarBuf.c:252
int Abc_NtkCollectPiPos(Abc_Ntk_t *pNtk, Vec_Ptr_t **pvLiMaps, Vec_Ptr_t **pvLoMaps)
Definition abcBarBuf.c:147
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition abc.h:522
ABC_DLL void Abc_NtkCleanCopy_rec(Abc_Ntk_t *pNtk)
Definition abcUtil.c:547
ABC_DLL Abc_Des_t * Abc_DesCreate(char *pName)
DECLARATIONS ///.
Definition abcLib.c:45
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition abc.h:518
ABC_DLL int Abc_DesAddModel(Abc_Des_t *p, Abc_Ntk_t *pNtk)
Definition abcLib.c:226
char * Nm_ManStoreIdName(Nm_Man_t *p, int ObjId, int Type, char *pName, char *pSuffix)
Definition nmApi.c:112
Vec_Ptr_t * vTops
Definition abc.h:224
char * pName
Definition abc.h:222
Nm_Man_t * pManName
Definition abc.h:160
Abc_Ntk_t * pCopy
Definition abc.h:204
Abc_Ntk_t * pAltView
Definition abc.h:181
Abc_Ntk_t * pNtk
Definition abc.h:130
#define Vec_PtrForEachEntryTwo(Type1, vVec1, Type2, vVec2, pEntry1, pEntry2, i)
Definition vecPtr.h:65
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkFromBarBufs_rec()

Abc_Obj_t * Abc_NtkFromBarBufs_rec ( Abc_Ntk_t * pNtkNew,
Abc_Obj_t * pObj )

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

Synopsis [Converts the logic with barbufs into a hierarchical network.]

Description [The base network is the original hierarchical network. The second argument is the optimized network with barbufs. This procedure reconstructs the original hierarcical network which adding logic from the optimized network. It is assumed that the PIs/POs of the original network one-to-one mapping with the flops of the optimized network.]

SideEffects []

SeeAlso []

Definition at line 252 of file abcBarBuf.c.

253{
254 Abc_Obj_t * pFanin;
255 int i;
256 if ( pObj->pCopy )
257 return pObj->pCopy;
258 Abc_NtkDupObj( pNtkNew, pObj, 0 );
259 Abc_ObjForEachFanin( pObj, pFanin, i )
260 Abc_ObjAddFanin( pObj->pCopy, Abc_NtkFromBarBufs_rec(pNtkNew, pFanin) );
261 return pObj->pCopy;
262}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkToBarBufs()

Abc_Ntk_t * Abc_NtkToBarBufs ( Abc_Ntk_t * pNtk)

Definition at line 180 of file abcBarBuf.c.

181{
182 char Buffer[1000];
183 Vec_Ptr_t * vLiMaps, * vLoMaps;
184 Abc_Ntk_t * pNtkNew, * pTemp;
185 Abc_Obj_t * pLatch, * pObjLi, * pObjLo;
186 Abc_Obj_t * pObj, * pLiMap, * pLoMap;
187 int i, k, nBoxes;
188 assert( Abc_NtkIsNetlist(pNtk) );
189 if ( !Abc_NtkCheckSingleInstance(pNtk) )
190 return NULL;
191 assert( pNtk->pDesign != NULL );
192 // start the network
193 pNtkNew = Abc_NtkAlloc( ABC_NTK_LOGIC, pNtk->ntkFunc, 1 );
194 pNtkNew->pName = Extra_UtilStrsav(pNtk->pName);
195 pNtkNew->pSpec = Extra_UtilStrsav(pNtk->pSpec);
196 // clone CIs/CIs/boxes
197 Abc_NtkCleanCopy_rec( pNtk );
198 Abc_NtkForEachPi( pNtk, pObj, i )
199 Abc_ObjFanout0(pObj)->pCopy = Abc_NtkDupObj( pNtkNew, pObj, 1 );
200 Abc_NtkForEachPo( pNtk, pObj, i )
201 Abc_NtkDupObj( pNtkNew, pObj, 1 );
202 // create latches and transfer copy labels
203 nBoxes = Abc_NtkCollectPiPos( pNtk, &vLiMaps, &vLoMaps );
204 Vec_PtrForEachEntryTwo( Abc_Obj_t *, vLiMaps, Abc_Obj_t *, vLoMaps, pLiMap, pLoMap, i )
205 {
206 pObjLi = Abc_NtkCreateBi(pNtkNew);
207 pLatch = Abc_NtkCreateLatch(pNtkNew);
208 pObjLo = Abc_NtkCreateBo(pNtkNew);
209 Abc_ObjAddFanin( pLatch, pObjLi );
210 Abc_ObjAddFanin( pObjLo, pLatch );
211 pLatch->pData = (void *)ABC_INIT_ZERO;
212 pTemp = NULL;
213 if ( Abc_ObjFanin0(pLiMap)->pNtk != pNtk )
214 pTemp = Abc_ObjFanin0(pLiMap)->pNtk;
215 else if ( Abc_ObjFanout0(pLoMap)->pNtk != pNtk )
216 pTemp = Abc_ObjFanout0(pLoMap)->pNtk;
217 else assert( 0 );
218 sprintf( Buffer, "_%s_in", Abc_NtkName(pTemp) );
219 Abc_ObjAssignName( pObjLi, Abc_ObjName(Abc_ObjFanin0(pLiMap)), Buffer );
220 sprintf( Buffer, "_%s_out", Abc_NtkName(pTemp) );
221 Abc_ObjAssignName( pObjLo, Abc_ObjName(Abc_ObjFanout0(pLoMap)), Buffer );
222 pLiMap->pCopy = pObjLi;
223 Abc_ObjFanout0(pLoMap)->pCopy = pObjLo;
224 assert( Abc_ObjIsNet(Abc_ObjFanout0(pLoMap)) );
225 }
226 Vec_PtrFree( vLiMaps );
227 Vec_PtrFree( vLoMaps );
228 // rebuild networks
229 Vec_PtrForEachEntry( Abc_Ntk_t *, pNtk->pDesign->vModules, pTemp, i )
230 Abc_NtkForEachCo( pTemp, pObj, k )
231 Abc_ObjAddFanin( pObj->pCopy, Abc_NtkToBarBufs_rec(pNtkNew, Abc_ObjFanin0(pObj)) );
232 pNtkNew->nBarBufs = Abc_NtkLatchNum(pNtkNew);
233 printf( "Hierarchy reader flattened %d instances of logic boxes and introduced %d barbufs.\n", nBoxes, pNtkNew->nBarBufs );
234 return pNtkNew;
235}
int Abc_NtkCheckSingleInstance(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition abcBarBuf.c:47
Abc_Obj_t * Abc_NtkToBarBufs_rec(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pNet)
Definition abcBarBuf.c:166
@ ABC_INIT_ZERO
Definition abc.h:104
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition abcNames.c:69
char * sprintf()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkToBarBufs_rec()

Abc_Obj_t * Abc_NtkToBarBufs_rec ( Abc_Ntk_t * pNtkNew,
Abc_Obj_t * pNet )

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

Synopsis [Derives logic network with barbufs from the netlist.]

Description []

SideEffects []

SeeAlso []

Definition at line 166 of file abcBarBuf.c.

167{
168 Abc_Obj_t * pObj, * pFanin;
169 int i;
170 assert( Abc_ObjIsNet(pNet) );
171 if ( pNet->pCopy )
172 return pNet->pCopy;
173 pObj = Abc_ObjFanin0(pNet);
174 assert( Abc_ObjIsNode(pObj) );
175 pNet->pCopy = Abc_NtkDupObj( pNtkNew, pObj, 0 );
176 Abc_ObjForEachFanin( pObj, pFanin, i )
177 Abc_ObjAddFanin( pObj->pCopy, Abc_NtkToBarBufs_rec(pNtkNew, pFanin) );
178 return pNet->pCopy;
179}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkToBarBufsCollect()

Vec_Ptr_t * Abc_NtkToBarBufsCollect ( Abc_Ntk_t * pNtk)

Definition at line 352 of file abcBarBuf.c.

353{
354 Vec_Ptr_t * vNodes;
355 Abc_Obj_t * pObj;
356 int i;
357 assert( Abc_NtkIsLogic(pNtk) );
358 assert( pNtk->nBarBufs > 0 );
359 assert( pNtk->nBarBufs == Abc_NtkLatchNum(pNtk) );
360 vNodes = Vec_PtrAlloc( Abc_NtkObjNum(pNtk) );
361 Abc_NtkIncrementTravId( pNtk );
362 Abc_NtkForEachCi( pNtk, pObj, i )
363 {
364 if ( i >= Abc_NtkCiNum(pNtk) - pNtk->nBarBufs )
365 break;
366 Vec_PtrPush( vNodes, pObj );
367 Abc_NodeSetTravIdCurrent( pObj );
368 }
369 Abc_NtkForEachCo( pNtk, pObj, i )
370 {
371 if ( i < Abc_NtkCoNum(pNtk) - pNtk->nBarBufs )
372 continue;
373 Abc_NtkToBarBufsCollect_rec( Abc_ObjFanin0(pObj), vNodes );
374 Vec_PtrPush( vNodes, pObj );
375 Vec_PtrPush( vNodes, Abc_ObjFanout0(pObj) );
376 Vec_PtrPush( vNodes, Abc_ObjFanout0(Abc_ObjFanout0(pObj)) );
377 Abc_NodeSetTravIdCurrent( pObj );
378 Abc_NodeSetTravIdCurrent( Abc_ObjFanout0(pObj) );
379 Abc_NodeSetTravIdCurrent( Abc_ObjFanout0(Abc_ObjFanout0(pObj)) );
380 }
381 Abc_NtkForEachCo( pNtk, pObj, i )
382 {
383 if ( i >= Abc_NtkCoNum(pNtk) - pNtk->nBarBufs )
384 break;
385 Abc_NtkToBarBufsCollect_rec( Abc_ObjFanin0(pObj), vNodes );
386 Vec_PtrPush( vNodes, pObj );
387 Abc_NodeSetTravIdCurrent( pObj );
388 }
389 assert( Vec_PtrSize(vNodes) == Abc_NtkObjNum(pNtk) );
390 return vNodes;
391}
void Abc_NtkToBarBufsCollect_rec(Abc_Obj_t *pObj, Vec_Ptr_t *vNodes)
Definition abcBarBuf.c:340
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkToBarBufsCollect_rec()

void Abc_NtkToBarBufsCollect_rec ( Abc_Obj_t * pObj,
Vec_Ptr_t * vNodes )

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

Synopsis [Collect nodes in the barbuf-friendly order.]

Description []

SideEffects []

SeeAlso []

Definition at line 340 of file abcBarBuf.c.

341{
342 Abc_Obj_t * pFanin;
343 int i;
344 if ( Abc_NodeIsTravIdCurrent( pObj ) )
345 return;
346 Abc_NodeSetTravIdCurrent( pObj );
347 assert( Abc_ObjIsNode(pObj) );
348 Abc_ObjForEachFanin( pObj, pFanin, i )
349 Abc_NtkToBarBufsCollect_rec( pFanin, vNodes );
350 Vec_PtrPush( vNodes, pObj );
351}
Here is the call graph for this function:
Here is the caller graph for this function: