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

Go to the source code of this file.

Functions

Abc_Ntk_tAbc_NtkToLogic (Abc_Ntk_t *pNtk)
 FUNCTION DEFINITIONS ///.
 
Abc_Ntk_tAbc_NtkToNetlist (Abc_Ntk_t *pNtk)
 
Abc_Ntk_tAbc_NtkToNetlistBench (Abc_Ntk_t *pNtk)
 
Abc_Ntk_tAbc_NtkAigToLogicSopNand (Abc_Ntk_t *pNtk)
 

Function Documentation

◆ Abc_NtkAigToLogicSopNand()

Abc_Ntk_t * Abc_NtkAigToLogicSopNand ( Abc_Ntk_t * pNtk)

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

Synopsis [Converts the AIG into the logic network with SOPs for bench writing.]

Description [This procedure does not copy the choices.]

SideEffects []

SeeAlso []

Definition at line 413 of file abcNetlist.c.

414{
415 Abc_Ntk_t * pNtkNew;
416 Abc_Obj_t * pObj, * pFanin;
417 Vec_Ptr_t * vNodes;
418 int i, k;
419 assert( Abc_NtkIsStrash(pNtk) );
420 if ( Abc_NtkGetChoiceNum(pNtk) )
421 printf( "Warning: Choice nodes are skipped.\n" );
422 // convert complemented edges
423 Abc_NtkForEachObj( pNtk, pObj, i )
424 Abc_ObjForEachFanin( pObj, pFanin, k )
425 if ( Abc_ObjIsNode(pFanin) )
426 Abc_ObjXorFaninC( pObj, k );
427 // start the network
428 pNtkNew = Abc_NtkStartFrom( pNtk, ABC_NTK_LOGIC, ABC_FUNC_SOP );
429 // collect the nodes to be used (marks all nodes with current TravId)
430 vNodes = Abc_NtkDfs( pNtk, 0 );
431 // create inverters for the constant node
432 pObj = Abc_AigConst1(pNtk);
433 if ( Abc_ObjFanoutNum(pObj) > 0 )
434 pObj->pCopy = Abc_NtkCreateNodeConst1(pNtkNew);
436 pObj->pCopy->pCopy = Abc_NtkCreateNodeInv( pNtkNew, pObj->pCopy );
437 // create inverters for the CIs
438 Abc_NtkForEachCi( pNtk, pObj, i )
440 pObj->pCopy->pCopy = Abc_NtkCreateNodeInv( pNtkNew, pObj->pCopy );
441 // duplicate the nodes, create node functions, and inverters
442 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
443 {
444 Abc_NtkDupObj( pNtkNew, pObj, 0 );
445 pObj->pCopy->pData = Abc_SopCreateNand( (Mem_Flex_t *)pNtkNew->pManFunc, 2 );
447 pObj->pCopy->pCopy = Abc_NtkCreateNodeInv( pNtkNew, pObj->pCopy );
448 }
449 // connect the objects
450 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
451 Abc_ObjForEachFanin( pObj, pFanin, k )
452 {
453 if ( Abc_ObjFaninC( pObj, k ) )
454 Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy->pCopy );
455 else
456 Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy );
457 }
458 Vec_PtrFree( vNodes );
459 // connect the COs
460 Abc_NtkForEachCo( pNtk, pObj, i )
461 {
462 pFanin = Abc_ObjFanin0(pObj);
463 if ( Abc_ObjFaninC0( pObj ) )
464 Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy->pCopy );
465 else
466 Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy );
467 }
468 // fix the problem with complemented and duplicated CO edges
469 Abc_NtkLogicMakeSimpleCos( pNtkNew, 0 );
470 // convert complemented edges
471 Abc_NtkForEachObj( pNtk, pObj, i )
472 Abc_ObjForEachFanin( pObj, pFanin, k )
473 if ( Abc_ObjIsNode(pFanin) )
474 Abc_ObjXorFaninC( pObj, k );
475 // duplicate the EXDC Ntk
476 if ( pNtk->pExdc )
477 printf( "Warning: The EXDc network is skipped.\n" );
478 if ( !Abc_NtkCheck( pNtkNew ) )
479 fprintf( stdout, "Abc_NtkAigToLogicSopBench(): Network check has failed.\n" );
480 return pNtkNew;
481}
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition abc.h:522
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition abcFanio.c:84
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeConst1(Abc_Ntk_t *pNtk)
Definition abcObj.c:643
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition abcObj.c:342
ABC_DLL int Abc_NtkGetChoiceNum(Abc_Ntk_t *pNtk)
Definition abcUtil.c:463
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
Definition abcDfs.c:82
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition abcCheck.c:64
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition abc.h:449
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition abc.h:527
struct Abc_Ntk_t_ Abc_Ntk_t
Definition abc.h:115
ABC_DLL char * Abc_SopCreateNand(Mem_Flex_t *pMan, int nVars)
Definition abcSop.c:190
@ ABC_NTK_LOGIC
Definition abc.h:57
ABC_DLL int Abc_NtkLogicMakeSimpleCos(Abc_Ntk_t *pNtk, int fDuplicate)
Definition abcUtil.c:1080
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeInv(Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
Definition abcObj.c:674
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition abc.h:518
ABC_DLL int Abc_AigNodeHasComplFanoutEdgeTrav(Abc_Obj_t *pNode)
Definition abcAig.c:1268
@ ABC_FUNC_SOP
Definition abc.h:65
ABC_DLL Abc_Ntk_t * Abc_NtkStartFrom(Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func)
Definition abcNtk.c:157
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition abcAig.c:683
struct Mem_Flex_t_ Mem_Flex_t
Definition mem.h:34
Abc_Ntk_t * pExdc
Definition abc.h:201
void * pManFunc
Definition abc.h:191
void * pData
Definition abc.h:145
Abc_Obj_t * pCopy
Definition abc.h:148
#define assert(ex)
Definition util_old.h:213
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:

◆ Abc_NtkToLogic()

Abc_Ntk_t * Abc_NtkToLogic ( Abc_Ntk_t * pNtk)

FUNCTION DEFINITIONS ///.

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

Synopsis [Transform the netlist into a logic network.]

Description []

SideEffects []

SeeAlso []

Definition at line 52 of file abcNetlist.c.

53{
54 Abc_Ntk_t * pNtkNew;
55 Abc_Obj_t * pObj, * pFanin;
56 int i, k;
57 // consider the case of the AIG
58 if ( Abc_NtkIsStrash(pNtk) )
59 return Abc_NtkAigToLogicSop( pNtk );
60 assert( Abc_NtkIsNetlist(pNtk) );
61 // consider simple case when there is hierarchy
62// assert( pNtk->pDesign == NULL );
63 assert( Abc_NtkWhiteboxNum(pNtk) == 0 );
64 assert( Abc_NtkBlackboxNum(pNtk) == 0 );
65 // start the network
66 pNtkNew = Abc_NtkStartFrom( pNtk, ABC_NTK_LOGIC, pNtk->ntkFunc );
67 // duplicate the nodes
68 Abc_NtkForEachNode( pNtk, pObj, i )
69 {
70 Abc_NtkDupObj(pNtkNew, pObj, 0);
71 Abc_ObjAssignName( pObj->pCopy, Abc_ObjName(Abc_ObjFanout0(pObj)), NULL );
72 }
73 // reconnect the internal nodes in the new network
74 Abc_NtkForEachNode( pNtk, pObj, i )
75 Abc_ObjForEachFanin( pObj, pFanin, k )
76 Abc_ObjAddFanin( pObj->pCopy, Abc_ObjFanin0(pFanin)->pCopy );
77 // collect the CO nodes
78 Abc_NtkFinalize( pNtk, pNtkNew );
79 // fix the problem with CO pointing directly to CIs
80 Abc_NtkLogicMakeSimpleCos( pNtkNew, 0 );
81 // duplicate EXDC
82 if ( pNtk->pExdc )
83 pNtkNew->pExdc = Abc_NtkToLogic( pNtk->pExdc );
84 if ( !Abc_NtkCheck( pNtkNew ) )
85 fprintf( stdout, "Abc_NtkToLogic(): Network check has failed.\n" );
86 return pNtkNew;
87}
Abc_Ntk_t * Abc_NtkToLogic(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition abcNetlist.c:52
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition abcNames.c:49
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition abcNames.c:69
ABC_DLL void Abc_NtkFinalize(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkNew)
Definition abcNtk.c:355
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition abc.h:464
Abc_NtkFunc_t ntkFunc
Definition abc.h:157
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkToNetlist()

Abc_Ntk_t * Abc_NtkToNetlist ( Abc_Ntk_t * pNtk)

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

Synopsis [Transform the logic network into a netlist.]

Description []

SideEffects []

SeeAlso []

Definition at line 100 of file abcNetlist.c.

101{
102 Abc_Ntk_t * pNtkNew, * pNtkTemp;
103 assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsStrash(pNtk) );
104 if ( Abc_NtkIsStrash(pNtk) )
105 {
106 pNtkTemp = Abc_NtkAigToLogicSop(pNtk);
107 pNtkNew = Abc_NtkLogicToNetlist( pNtkTemp );
108 Abc_NtkDelete( pNtkTemp );
109 return pNtkNew;
110 }
111 return Abc_NtkLogicToNetlist( pNtk );
112}
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition abcNtk.c:1421
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkToNetlistBench()

Abc_Ntk_t * Abc_NtkToNetlistBench ( Abc_Ntk_t * pNtk)

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

Synopsis [Converts the AIG into the netlist.]

Description [This procedure does not copy the choices.]

SideEffects []

SeeAlso []

Definition at line 125 of file abcNetlist.c.

126{
127 Abc_Ntk_t * pNtkNew, * pNtkTemp;
128 assert( Abc_NtkIsStrash(pNtk) );
129 pNtkTemp = Abc_NtkAigToLogicSopBench( pNtk );
130 pNtkNew = Abc_NtkLogicToNetlist( pNtkTemp );
131 Abc_NtkDelete( pNtkTemp );
132 return pNtkNew;
133}
Here is the call graph for this function:
Here is the caller graph for this function: