#include "abc.h"
#include "abcInt.h"
#include "main.h"
#include "mio.h"
Go to the source code of this file.
Abc_Ntk_t* Abc_NtkAlloc | ( | Abc_NtkType_t | Type, | |
Abc_NtkFunc_t | Func, | |||
int | fUseMemMan | |||
) |
CFile****************************************************************
FileName [abcNtk.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Network and node package.]
Synopsis [Network creation/duplication/deletion procedures.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [
] DECLARATIONS /// FUNCTION DEFINITIONS ///Function*************************************************************
Synopsis [Creates a new Ntk.]
Description []
SideEffects []
SeeAlso []
Definition at line 45 of file abcNtk.c.
00046 { 00047 Abc_Ntk_t * pNtk; 00048 pNtk = ALLOC( Abc_Ntk_t, 1 ); 00049 memset( pNtk, 0, sizeof(Abc_Ntk_t) ); 00050 pNtk->ntkType = Type; 00051 pNtk->ntkFunc = Func; 00052 // start the object storage 00053 pNtk->vObjs = Vec_PtrAlloc( 100 ); 00054 pNtk->vAsserts = Vec_PtrAlloc( 100 ); 00055 pNtk->vPios = Vec_PtrAlloc( 100 ); 00056 pNtk->vPis = Vec_PtrAlloc( 100 ); 00057 pNtk->vPos = Vec_PtrAlloc( 100 ); 00058 pNtk->vCis = Vec_PtrAlloc( 100 ); 00059 pNtk->vCos = Vec_PtrAlloc( 100 ); 00060 pNtk->vBoxes = Vec_PtrAlloc( 100 ); 00061 // start the memory managers 00062 pNtk->pMmObj = fUseMemMan? Extra_MmFixedStart( sizeof(Abc_Obj_t) ) : NULL; 00063 pNtk->pMmStep = fUseMemMan? Extra_MmStepStart( ABC_NUM_STEPS ) : NULL; 00064 // get ready to assign the first Obj ID 00065 pNtk->nTravIds = 1; 00066 // start the functionality manager 00067 if ( Abc_NtkIsStrash(pNtk) ) 00068 pNtk->pManFunc = Abc_AigAlloc( pNtk ); 00069 else if ( Abc_NtkHasSop(pNtk) || Abc_NtkHasBlifMv(pNtk) ) 00070 pNtk->pManFunc = Extra_MmFlexStart(); 00071 else if ( Abc_NtkHasBdd(pNtk) ) 00072 pNtk->pManFunc = Cudd_Init( 20, 0, CUDD_UNIQUE_SLOTS, CUDD_CACHE_SLOTS, 0 ); 00073 else if ( Abc_NtkHasAig(pNtk) ) 00074 pNtk->pManFunc = Hop_ManStart(); 00075 else if ( Abc_NtkHasMapping(pNtk) ) 00076 pNtk->pManFunc = Abc_FrameReadLibGen(); 00077 else if ( !Abc_NtkHasBlackbox(pNtk) ) 00078 assert( 0 ); 00079 // name manager 00080 pNtk->pManName = Nm_ManCreate( 200 ); 00081 // attribute manager 00082 pNtk->vAttrs = Vec_PtrStart( VEC_ATTR_TOTAL_NUM ); 00083 return pNtk; 00084 }
Function*************************************************************
Synopsis [Adds new nodes to the cone.]
Description []
SideEffects []
SeeAlso []
Definition at line 661 of file abcNtk.c.
00662 { 00663 Vec_Ptr_t * vNodes; 00664 Abc_Obj_t * pObj; 00665 int i, iNodeId; 00666 00667 assert( Abc_NtkIsStrash(pNtkNew) ); 00668 assert( Abc_NtkIsStrash(pNtk) ); 00669 00670 // collect the nodes in the TFI of the output (mark the TFI) 00671 vNodes = Abc_NtkDfsNodes( pNtk, (Abc_Obj_t **)Vec_PtrArray(vRoots), Vec_PtrSize(vRoots) ); 00672 00673 // establish connection between the constant nodes 00674 Abc_AigConst1(pNtk)->pCopy = Abc_AigConst1(pNtkNew); 00675 00676 // create the PIs 00677 Abc_NtkForEachCi( pNtk, pObj, i ) 00678 { 00679 // skip CIs that are not used 00680 if ( !Abc_NodeIsTravIdCurrent(pObj) ) 00681 continue; 00682 // find the corresponding CI in the new network 00683 iNodeId = Nm_ManFindIdByNameTwoTypes( pNtkNew->pManName, Abc_ObjName(pObj), ABC_OBJ_PI, ABC_OBJ_BO ); 00684 if ( iNodeId == -1 ) 00685 { 00686 pObj->pCopy = Abc_NtkCreatePi(pNtkNew); 00687 Abc_ObjAssignName( pObj->pCopy, Abc_ObjName(pObj), NULL ); 00688 } 00689 else 00690 pObj->pCopy = Abc_NtkObj( pNtkNew, iNodeId ); 00691 } 00692 00693 // copy the nodes 00694 Vec_PtrForEachEntry( vNodes, pObj, i ) 00695 pObj->pCopy = Abc_AigAnd( pNtkNew->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild1Copy(pObj) ); 00696 Vec_PtrFree( vNodes ); 00697 00698 // do not add the COs 00699 if ( !Abc_NtkCheck( pNtkNew ) ) 00700 fprintf( stdout, "Abc_NtkAppendToCone(): Network check has failed.\n" ); 00701 }
Function*************************************************************
Synopsis [Attaches the second network at the bottom of the first.]
Description [Returns the first network. Deletes the second network.]
SideEffects []
SeeAlso []
Definition at line 452 of file abcNtk.c.
00453 { 00454 Abc_Obj_t * pObj, * pFanin, * pBuffer; 00455 Vec_Ptr_t * vNodes; 00456 int i, k; 00457 assert( pNtkBottom != NULL ); 00458 if ( pNtkTop == NULL ) 00459 return pNtkBottom; 00460 // make sure the networks are combinational 00461 assert( Abc_NtkPiNum(pNtkTop) == Abc_NtkCiNum(pNtkTop) ); 00462 assert( Abc_NtkPiNum(pNtkBottom) == Abc_NtkCiNum(pNtkBottom) ); 00463 // make sure the POs of the bottom correspond to the PIs of the top 00464 assert( Abc_NtkPoNum(pNtkBottom) == Abc_NtkPiNum(pNtkTop) ); 00465 assert( Abc_NtkPiNum(pNtkBottom) < Abc_NtkPiNum(pNtkTop) ); 00466 // add buffers for the PIs of the top - save results in the POs of the bottom 00467 Abc_NtkForEachPi( pNtkTop, pObj, i ) 00468 { 00469 pBuffer = Abc_NtkCreateNodeBuf( pNtkTop, NULL ); 00470 Abc_ObjTransferFanout( pObj, pBuffer ); 00471 Abc_NtkPo(pNtkBottom, i)->pCopy = pBuffer; 00472 } 00473 // remove useless PIs of the top 00474 for ( i = Abc_NtkPiNum(pNtkTop) - 1; i >= Abc_NtkPiNum(pNtkBottom); i-- ) 00475 Abc_NtkDeleteObj( Abc_NtkPi(pNtkTop, i) ); 00476 assert( Abc_NtkPiNum(pNtkBottom) == Abc_NtkPiNum(pNtkTop) ); 00477 // copy the bottom network 00478 Abc_NtkForEachPi( pNtkBottom, pObj, i ) 00479 Abc_NtkPi(pNtkBottom, i)->pCopy = Abc_NtkPi(pNtkTop, i); 00480 // construct all nodes 00481 vNodes = Abc_NtkDfs( pNtkBottom, 0 ); 00482 Vec_PtrForEachEntry( vNodes, pObj, i ) 00483 { 00484 Abc_NtkDupObj(pNtkTop, pObj, 0); 00485 Abc_ObjForEachFanin( pObj, pFanin, k ) 00486 Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy ); 00487 } 00488 Vec_PtrFree( vNodes ); 00489 // connect the POs 00490 Abc_NtkForEachPo( pNtkBottom, pObj, i ) 00491 Abc_ObjAddFanin( pObj->pCopy, Abc_ObjFanin0(pObj)->pCopy ); 00492 // delete old network 00493 Abc_NtkDelete( pNtkBottom ); 00494 // return the network 00495 if ( !Abc_NtkCheck( pNtkTop ) ) 00496 fprintf( stdout, "Abc_NtkAttachBottom(): Network check has failed.\n" ); 00497 return pNtkTop; 00498 }
Abc_Ntk_t* Abc_NtkCreateCone | ( | Abc_Ntk_t * | pNtk, | |
Abc_Obj_t * | pNode, | |||
char * | pNodeName, | |||
int | fUseAllCis | |||
) |
Function*************************************************************
Synopsis [Creates the network composed of one logic cone.]
Description []
SideEffects []
SeeAlso []
Definition at line 511 of file abcNtk.c.
00512 { 00513 Abc_Ntk_t * pNtkNew; 00514 Vec_Ptr_t * vNodes; 00515 Abc_Obj_t * pObj, * pFanin, * pNodeCoNew; 00516 char Buffer[1000]; 00517 int i, k; 00518 00519 assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsStrash(pNtk) ); 00520 assert( Abc_ObjIsNode(pNode) ); 00521 00522 // start the network 00523 pNtkNew = Abc_NtkAlloc( pNtk->ntkType, pNtk->ntkFunc, 1 ); 00524 // set the name 00525 sprintf( Buffer, "%s_%s", pNtk->pName, pNodeName ); 00526 pNtkNew->pName = Extra_UtilStrsav(Buffer); 00527 00528 // establish connection between the constant nodes 00529 if ( Abc_NtkIsStrash(pNtk) ) 00530 Abc_AigConst1(pNtk)->pCopy = Abc_AigConst1(pNtkNew); 00531 00532 // collect the nodes in the TFI of the output (mark the TFI) 00533 vNodes = Abc_NtkDfsNodes( pNtk, &pNode, 1 ); 00534 // create the PIs 00535 Abc_NtkForEachCi( pNtk, pObj, i ) 00536 { 00537 if ( fUseAllCis || Abc_NodeIsTravIdCurrent(pObj) ) // TravId is set by DFS 00538 { 00539 pObj->pCopy = Abc_NtkCreatePi(pNtkNew); 00540 Abc_ObjAssignName( pObj->pCopy, Abc_ObjName(pObj), NULL ); 00541 } 00542 } 00543 // add the PO corresponding to this output 00544 pNodeCoNew = Abc_NtkCreatePo( pNtkNew ); 00545 Abc_ObjAssignName( pNodeCoNew, pNodeName, NULL ); 00546 // copy the nodes 00547 Vec_PtrForEachEntry( vNodes, pObj, i ) 00548 { 00549 // if it is an AIG, add to the hash table 00550 if ( Abc_NtkIsStrash(pNtk) ) 00551 { 00552 pObj->pCopy = Abc_AigAnd( pNtkNew->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild1Copy(pObj) ); 00553 } 00554 else 00555 { 00556 Abc_NtkDupObj( pNtkNew, pObj, 0 ); 00557 Abc_ObjForEachFanin( pObj, pFanin, k ) 00558 Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy ); 00559 } 00560 } 00561 // connect the internal nodes to the new CO 00562 Abc_ObjAddFanin( pNodeCoNew, pNode->pCopy ); 00563 Vec_PtrFree( vNodes ); 00564 00565 if ( !Abc_NtkCheck( pNtkNew ) ) 00566 fprintf( stdout, "Abc_NtkCreateCone(): Network check has failed.\n" ); 00567 return pNtkNew; 00568 }
Function*************************************************************
Synopsis [Creates the network composed of several logic cones.]
Description []
SideEffects []
SeeAlso []
Definition at line 581 of file abcNtk.c.
00582 { 00583 Abc_Ntk_t * pNtkNew; 00584 Vec_Ptr_t * vNodes; 00585 Abc_Obj_t * pObj, * pFanin, * pNodeCoNew; 00586 char Buffer[1000]; 00587 int i, k; 00588 00589 assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsStrash(pNtk) ); 00590 00591 // start the network 00592 pNtkNew = Abc_NtkAlloc( pNtk->ntkType, pNtk->ntkFunc, 1 ); 00593 // set the name 00594 sprintf( Buffer, "%s_part", pNtk->pName ); 00595 pNtkNew->pName = Extra_UtilStrsav(Buffer); 00596 00597 // establish connection between the constant nodes 00598 if ( Abc_NtkIsStrash(pNtk) ) 00599 Abc_AigConst1(pNtk)->pCopy = Abc_AigConst1(pNtkNew); 00600 00601 // collect the nodes in the TFI of the output (mark the TFI) 00602 vNodes = Abc_NtkDfsNodes( pNtk, (Abc_Obj_t **)Vec_PtrArray(vRoots), Vec_PtrSize(vRoots) ); 00603 00604 // create the PIs 00605 Abc_NtkForEachCi( pNtk, pObj, i ) 00606 { 00607 if ( fUseAllCis || Abc_NodeIsTravIdCurrent(pObj) ) // TravId is set by DFS 00608 { 00609 pObj->pCopy = Abc_NtkCreatePi(pNtkNew); 00610 Abc_ObjAssignName( pObj->pCopy, Abc_ObjName(pObj), NULL ); 00611 } 00612 } 00613 00614 // copy the nodes 00615 Vec_PtrForEachEntry( vNodes, pObj, i ) 00616 { 00617 // if it is an AIG, add to the hash table 00618 if ( Abc_NtkIsStrash(pNtk) ) 00619 { 00620 pObj->pCopy = Abc_AigAnd( pNtkNew->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild1Copy(pObj) ); 00621 } 00622 else 00623 { 00624 Abc_NtkDupObj( pNtkNew, pObj, 0 ); 00625 Abc_ObjForEachFanin( pObj, pFanin, k ) 00626 Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy ); 00627 } 00628 } 00629 Vec_PtrFree( vNodes ); 00630 00631 // add the POs corresponding to the root nodes 00632 Vec_PtrForEachEntry( vRoots, pObj, i ) 00633 { 00634 // create the PO node 00635 pNodeCoNew = Abc_NtkCreatePo( pNtkNew ); 00636 // connect the internal nodes to the new CO 00637 if ( Abc_ObjIsCo(pObj) ) 00638 Abc_ObjAddFanin( pNodeCoNew, Abc_ObjChild0Copy(pObj) ); 00639 else 00640 Abc_ObjAddFanin( pNodeCoNew, pObj->pCopy ); 00641 // assign the name 00642 Abc_ObjAssignName( pNodeCoNew, Abc_ObjName(pObj), NULL ); 00643 } 00644 00645 if ( !Abc_NtkCheck( pNtkNew ) ) 00646 fprintf( stdout, "Abc_NtkCreateConeArray(): Network check has failed.\n" ); 00647 return pNtkNew; 00648 }
Function*************************************************************
Synopsis [Creates the network composed of one node.]
Description []
SideEffects []
SeeAlso []
Definition at line 846 of file abcNtk.c.
00847 { 00848 Abc_Ntk_t * pNtkNew; 00849 Abc_Obj_t * pFanin, * pNodePo; 00850 int i; 00851 // start the network 00852 pNtkNew = Abc_NtkAlloc( pNtk->ntkType, pNtk->ntkFunc, 1 ); 00853 pNtkNew->pName = Extra_UtilStrsav(Abc_ObjName(pNode)); 00854 // add the PIs corresponding to the fanins of the node 00855 Abc_ObjForEachFanin( pNode, pFanin, i ) 00856 { 00857 pFanin->pCopy = Abc_NtkCreatePi( pNtkNew ); 00858 Abc_ObjAssignName( pFanin->pCopy, Abc_ObjName(pFanin), NULL ); 00859 } 00860 // duplicate and connect the node 00861 pNode->pCopy = Abc_NtkDupObj( pNtkNew, pNode, 0 ); 00862 Abc_ObjForEachFanin( pNode, pFanin, i ) 00863 Abc_ObjAddFanin( pNode->pCopy, pFanin->pCopy ); 00864 // create the only PO 00865 pNodePo = Abc_NtkCreatePo( pNtkNew ); 00866 Abc_ObjAddFanin( pNodePo, pNode->pCopy ); 00867 Abc_ObjAssignName( pNodePo, Abc_ObjName(pNode), NULL ); 00868 if ( !Abc_NtkCheck( pNtkNew ) ) 00869 fprintf( stdout, "Abc_NtkCreateFromNode(): Network check has failed.\n" ); 00870 return pNtkNew; 00871 }
Function*************************************************************
Synopsis [Creates the network composed of MFFC of one node.]
Description []
SideEffects []
SeeAlso []
Definition at line 714 of file abcNtk.c.
00715 { 00716 Abc_Ntk_t * pNtkNew; 00717 Abc_Obj_t * pObj, * pFanin, * pNodeCoNew; 00718 Vec_Ptr_t * vCone, * vSupp; 00719 char Buffer[1000]; 00720 int i, k; 00721 00722 assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsStrash(pNtk) ); 00723 assert( Abc_ObjIsNode(pNode) ); 00724 00725 // start the network 00726 pNtkNew = Abc_NtkAlloc( pNtk->ntkType, pNtk->ntkFunc, 1 ); 00727 // set the name 00728 sprintf( Buffer, "%s_%s", pNtk->pName, pNodeName ); 00729 pNtkNew->pName = Extra_UtilStrsav(Buffer); 00730 00731 // establish connection between the constant nodes 00732 if ( Abc_NtkIsStrash(pNtk) ) 00733 Abc_AigConst1(pNtk)->pCopy = Abc_AigConst1(pNtkNew); 00734 00735 // collect the nodes in MFFC 00736 vCone = Vec_PtrAlloc( 100 ); 00737 vSupp = Vec_PtrAlloc( 100 ); 00738 Abc_NodeDeref_rec( pNode ); 00739 Abc_NodeMffsConeSupp( pNode, vCone, vSupp ); 00740 Abc_NodeRef_rec( pNode ); 00741 // create the PIs 00742 Vec_PtrForEachEntry( vSupp, pObj, i ) 00743 { 00744 pObj->pCopy = Abc_NtkCreatePi(pNtkNew); 00745 Abc_ObjAssignName( pObj->pCopy, Abc_ObjName(pObj), NULL ); 00746 } 00747 // create the PO 00748 pNodeCoNew = Abc_NtkCreatePo( pNtkNew ); 00749 Abc_ObjAssignName( pNodeCoNew, pNodeName, NULL ); 00750 // copy the nodes 00751 Vec_PtrForEachEntry( vCone, pObj, i ) 00752 { 00753 // if it is an AIG, add to the hash table 00754 if ( Abc_NtkIsStrash(pNtk) ) 00755 { 00756 pObj->pCopy = Abc_AigAnd( pNtkNew->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild1Copy(pObj) ); 00757 } 00758 else 00759 { 00760 Abc_NtkDupObj( pNtkNew, pObj, 0 ); 00761 Abc_ObjForEachFanin( pObj, pFanin, k ) 00762 Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy ); 00763 } 00764 } 00765 // connect the topmost node 00766 Abc_ObjAddFanin( pNodeCoNew, pNode->pCopy ); 00767 Vec_PtrFree( vCone ); 00768 Vec_PtrFree( vSupp ); 00769 00770 if ( !Abc_NtkCheck( pNtkNew ) ) 00771 fprintf( stdout, "Abc_NtkCreateMffc(): Network check has failed.\n" ); 00772 return pNtkNew; 00773 }
Function*************************************************************
Synopsis [Creates the miter composed of one multi-output cone.]
Description []
SideEffects []
SeeAlso []
Definition at line 786 of file abcNtk.c.
00787 { 00788 Vec_Ptr_t * vNodes; 00789 Abc_Ntk_t * pNtkNew; 00790 Abc_Obj_t * pObj, * pFinal, * pOther, * pNodePo; 00791 int i; 00792 00793 assert( Abc_NtkIsLogic(pNtk) ); 00794 00795 // start the network 00796 Abc_NtkCleanCopy( pNtk ); 00797 pNtkNew = Abc_NtkAlloc( ABC_NTK_STRASH, ABC_FUNC_AIG, 1 ); 00798 pNtkNew->pName = Extra_UtilStrsav(pNtk->pName); 00799 00800 // collect the nodes in the TFI of the output 00801 vNodes = Abc_NtkDfsNodes( pNtk, (Abc_Obj_t **)vRoots->pArray, vRoots->nSize ); 00802 // create the PIs 00803 Abc_NtkForEachCi( pNtk, pObj, i ) 00804 { 00805 pObj->pCopy = Abc_NtkCreatePi(pNtkNew); 00806 Abc_ObjAssignName( pObj->pCopy, Abc_ObjName(pObj), NULL ); 00807 } 00808 // copy the nodes 00809 Vec_PtrForEachEntry( vNodes, pObj, i ) 00810 pObj->pCopy = Abc_NodeStrash( pNtkNew, pObj, 0 ); 00811 Vec_PtrFree( vNodes ); 00812 00813 // add the PO 00814 pFinal = Abc_AigConst1( pNtkNew ); 00815 Vec_PtrForEachEntry( vRoots, pObj, i ) 00816 { 00817 if ( Abc_ObjIsCo(pObj) ) 00818 pOther = Abc_ObjFanin0(pObj)->pCopy; 00819 else 00820 pOther = pObj->pCopy; 00821 if ( Vec_IntEntry(vValues, i) == 0 ) 00822 pOther = Abc_ObjNot(pOther); 00823 pFinal = Abc_AigAnd( pNtkNew->pManFunc, pFinal, pOther ); 00824 } 00825 00826 // add the PO corresponding to this output 00827 pNodePo = Abc_NtkCreatePo( pNtkNew ); 00828 Abc_ObjAddFanin( pNodePo, pFinal ); 00829 Abc_ObjAssignName( pNodePo, "miter", NULL ); 00830 if ( !Abc_NtkCheck( pNtkNew ) ) 00831 fprintf( stdout, "Abc_NtkCreateTarget(): Network check has failed.\n" ); 00832 return pNtkNew; 00833 }
Abc_Ntk_t* Abc_NtkCreateWithNode | ( | char * | pSop | ) |
Function*************************************************************
Synopsis [Creates the network composed of one node with the given SOP.]
Description []
SideEffects []
SeeAlso []
Definition at line 884 of file abcNtk.c.
00885 { 00886 Abc_Ntk_t * pNtkNew; 00887 Abc_Obj_t * pFanin, * pNode, * pNodePo; 00888 Vec_Ptr_t * vNames; 00889 int i, nVars; 00890 // start the network 00891 pNtkNew = Abc_NtkAlloc( ABC_NTK_LOGIC, ABC_FUNC_SOP, 1 ); 00892 pNtkNew->pName = Extra_UtilStrsav("ex"); 00893 // create PIs 00894 Vec_PtrPush( pNtkNew->vObjs, NULL ); 00895 nVars = Abc_SopGetVarNum( pSop ); 00896 vNames = Abc_NodeGetFakeNames( nVars ); 00897 for ( i = 0; i < nVars; i++ ) 00898 Abc_ObjAssignName( Abc_NtkCreatePi(pNtkNew), Vec_PtrEntry(vNames, i), NULL ); 00899 Abc_NodeFreeNames( vNames ); 00900 // create the node, add PIs as fanins, set the function 00901 pNode = Abc_NtkCreateNode( pNtkNew ); 00902 Abc_NtkForEachPi( pNtkNew, pFanin, i ) 00903 Abc_ObjAddFanin( pNode, pFanin ); 00904 pNode->pData = Abc_SopRegister( pNtkNew->pManFunc, pSop ); 00905 // create the only PO 00906 pNodePo = Abc_NtkCreatePo(pNtkNew); 00907 Abc_ObjAddFanin( pNodePo, pNode ); 00908 Abc_ObjAssignName( pNodePo, "F", NULL ); 00909 if ( !Abc_NtkCheck( pNtkNew ) ) 00910 fprintf( stdout, "Abc_NtkCreateWithNode(): Network check has failed.\n" ); 00911 return pNtkNew; 00912 }
void Abc_NtkDelete | ( | Abc_Ntk_t * | pNtk | ) |
Function*************************************************************
Synopsis [Deletes the Ntk.]
Description []
SideEffects []
SeeAlso []
Definition at line 925 of file abcNtk.c.
00926 { 00927 Abc_Obj_t * pObj; 00928 void * pAttrMan; 00929 int TotalMemory, i; 00930 int LargePiece = (4 << ABC_NUM_STEPS); 00931 if ( pNtk == NULL ) 00932 return; 00933 // free the HAIG 00934 if ( pNtk->pHaig ) 00935 Abc_NtkHaigStop( pNtk ); 00936 // free EXDC Ntk 00937 if ( pNtk->pExdc ) 00938 Abc_NtkDelete( pNtk->pExdc ); 00939 // dereference the BDDs 00940 if ( Abc_NtkHasBdd(pNtk) ) 00941 { 00942 Abc_NtkForEachNode( pNtk, pObj, i ) 00943 Cudd_RecursiveDeref( pNtk->pManFunc, pObj->pData ); 00944 } 00945 // make sure all the marks are clean 00946 Abc_NtkForEachObj( pNtk, pObj, i ) 00947 { 00948 // free large fanout arrays 00949 if ( pNtk->pMmObj && pObj->vFanouts.nCap * 4 > LargePiece ) 00950 FREE( pObj->vFanouts.pArray ); 00951 // these flags should be always zero 00952 // if this is not true, something is wrong somewhere 00953 assert( pObj->fMarkA == 0 ); 00954 assert( pObj->fMarkB == 0 ); 00955 assert( pObj->fMarkC == 0 ); 00956 } 00957 // free the nodes 00958 if ( pNtk->pMmStep == NULL ) 00959 { 00960 Abc_NtkForEachObj( pNtk, pObj, i ) 00961 { 00962 FREE( pObj->vFanouts.pArray ); 00963 FREE( pObj->vFanins.pArray ); 00964 } 00965 } 00966 if ( pNtk->pMmObj == NULL ) 00967 { 00968 Abc_NtkForEachObj( pNtk, pObj, i ) 00969 free( pObj ); 00970 } 00971 00972 // free the arrays 00973 Vec_PtrFree( pNtk->vPios ); 00974 Vec_PtrFree( pNtk->vPis ); 00975 Vec_PtrFree( pNtk->vPos ); 00976 Vec_PtrFree( pNtk->vCis ); 00977 Vec_PtrFree( pNtk->vCos ); 00978 Vec_PtrFree( pNtk->vAsserts ); 00979 Vec_PtrFree( pNtk->vObjs ); 00980 Vec_PtrFree( pNtk->vBoxes ); 00981 if ( pNtk->vLevelsR ) Vec_IntFree( pNtk->vLevelsR ); 00982 if ( pNtk->pModel ) free( pNtk->pModel ); 00983 TotalMemory = 0; 00984 TotalMemory += pNtk->pMmObj? Extra_MmFixedReadMemUsage(pNtk->pMmObj) : 0; 00985 TotalMemory += pNtk->pMmStep? Extra_MmStepReadMemUsage(pNtk->pMmStep) : 0; 00986 // fprintf( stdout, "The total memory allocated internally by the network = %0.2f Mb.\n", ((double)TotalMemory)/(1<<20) ); 00987 // free the storage 00988 if ( pNtk->pMmObj ) 00989 Extra_MmFixedStop( pNtk->pMmObj ); 00990 if ( pNtk->pMmStep ) 00991 Extra_MmStepStop ( pNtk->pMmStep ); 00992 // name manager 00993 Nm_ManFree( pNtk->pManName ); 00994 // free the timing manager 00995 if ( pNtk->pManTime ) 00996 Abc_ManTimeStop( pNtk->pManTime ); 00997 // start the functionality manager 00998 if ( Abc_NtkIsStrash(pNtk) ) 00999 Abc_AigFree( pNtk->pManFunc ); 01000 else if ( Abc_NtkHasSop(pNtk) || Abc_NtkHasBlifMv(pNtk) ) 01001 Extra_MmFlexStop( pNtk->pManFunc ); 01002 else if ( Abc_NtkHasBdd(pNtk) ) 01003 Extra_StopManager( pNtk->pManFunc ); 01004 else if ( Abc_NtkHasAig(pNtk) ) 01005 { if ( pNtk->pManFunc ) Hop_ManStop( pNtk->pManFunc ); } 01006 else if ( Abc_NtkHasMapping(pNtk) ) 01007 pNtk->pManFunc = NULL; 01008 else if ( !Abc_NtkHasBlackbox(pNtk) ) 01009 assert( 0 ); 01010 // free the hierarchy 01011 if ( pNtk->pDesign ) 01012 { 01013 Abc_LibFree( pNtk->pDesign, pNtk ); 01014 pNtk->pDesign = NULL; 01015 } 01016 // if ( pNtk->pBlackBoxes ) 01017 // Vec_IntFree( pNtk->pBlackBoxes ); 01018 // free node attributes 01019 Vec_PtrForEachEntry( pNtk->vAttrs, pAttrMan, i ) 01020 if ( pAttrMan ) 01021 { 01022 //printf( "deleting attr\n" ); 01023 Vec_AttFree( pAttrMan, 1 ); 01024 } 01025 Vec_PtrFree( pNtk->vAttrs ); 01026 FREE( pNtk->pName ); 01027 FREE( pNtk->pSpec ); 01028 free( pNtk ); 01029 }
Function*************************************************************
Synopsis [Duplicate the network.]
Description []
SideEffects []
SeeAlso []
Definition at line 366 of file abcNtk.c.
00367 { 00368 char Buffer[500]; 00369 Abc_Ntk_t * pNtkNew; 00370 Abc_Obj_t * pObj, * pFanin; 00371 int i, k; 00372 assert( Abc_NtkIsLogic(pNtk) ); 00373 00374 // start the network 00375 pNtkNew = Abc_NtkAlloc( pNtk->ntkType, pNtk->ntkFunc, 1 ); 00376 sprintf( Buffer, "%s%s", pNtk->pName, "_2x" ); 00377 pNtkNew->pName = Extra_UtilStrsav(Buffer); 00378 00379 // clean the node copy fields 00380 Abc_NtkCleanCopy( pNtk ); 00381 // clone CIs/CIs/boxes 00382 Abc_NtkForEachPi( pNtk, pObj, i ) 00383 Abc_NtkDupObj( pNtkNew, pObj, 0 ); 00384 Abc_NtkForEachPo( pNtk, pObj, i ) 00385 Abc_NtkDupObj( pNtkNew, pObj, 0 ); 00386 Abc_NtkForEachAssert( pNtk, pObj, i ) 00387 Abc_NtkDupObj( pNtkNew, pObj, 0 ); 00388 Abc_NtkForEachBox( pNtk, pObj, i ) 00389 Abc_NtkDupBox( pNtkNew, pObj, 0 ); 00390 // copy the internal nodes 00391 // duplicate the nets and nodes (CIs/COs/latches already dupped) 00392 Abc_NtkForEachObj( pNtk, pObj, i ) 00393 if ( pObj->pCopy == NULL ) 00394 Abc_NtkDupObj(pNtkNew, pObj, 0); 00395 // reconnect all objects (no need to transfer attributes on edges) 00396 Abc_NtkForEachObj( pNtk, pObj, i ) 00397 if ( !Abc_ObjIsBox(pObj) && !Abc_ObjIsBo(pObj) ) 00398 Abc_ObjForEachFanin( pObj, pFanin, k ) 00399 Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy ); 00400 00401 // clean the node copy fields 00402 Abc_NtkCleanCopy( pNtk ); 00403 // clone CIs/CIs/boxes 00404 Abc_NtkForEachPi( pNtk, pObj, i ) 00405 Abc_NtkDupObj( pNtkNew, pObj, 0 ); 00406 Abc_NtkForEachPo( pNtk, pObj, i ) 00407 Abc_NtkDupObj( pNtkNew, pObj, 0 ); 00408 Abc_NtkForEachAssert( pNtk, pObj, i ) 00409 Abc_NtkDupObj( pNtkNew, pObj, 0 ); 00410 Abc_NtkForEachBox( pNtk, pObj, i ) 00411 Abc_NtkDupBox( pNtkNew, pObj, 0 ); 00412 // copy the internal nodes 00413 // duplicate the nets and nodes (CIs/COs/latches already dupped) 00414 Abc_NtkForEachObj( pNtk, pObj, i ) 00415 if ( pObj->pCopy == NULL ) 00416 Abc_NtkDupObj(pNtkNew, pObj, 0); 00417 // reconnect all objects (no need to transfer attributes on edges) 00418 Abc_NtkForEachObj( pNtk, pObj, i ) 00419 if ( !Abc_ObjIsBox(pObj) && !Abc_ObjIsBo(pObj) ) 00420 Abc_ObjForEachFanin( pObj, pFanin, k ) 00421 Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy ); 00422 00423 // assign names 00424 Abc_NtkForEachCi( pNtk, pObj, i ) 00425 { 00426 Abc_ObjAssignName( Abc_NtkCi(pNtkNew, i), "1_", Abc_ObjName(pObj) ); 00427 Abc_ObjAssignName( Abc_NtkCi(pNtkNew, Abc_NtkCiNum(pNtk) + i), "2_", Abc_ObjName(pObj) ); 00428 } 00429 Abc_NtkForEachCo( pNtk, pObj, i ) 00430 { 00431 Abc_ObjAssignName( Abc_NtkCo(pNtkNew, i), "1_", Abc_ObjName(pObj) ); 00432 Abc_ObjAssignName( Abc_NtkCo(pNtkNew, Abc_NtkCoNum(pNtk) + i), "2_", Abc_ObjName(pObj) ); 00433 } 00434 00435 // perform the final check 00436 if ( !Abc_NtkCheck( pNtkNew ) ) 00437 fprintf( stdout, "Abc_NtkDup(): Network check has failed.\n" ); 00438 return pNtkNew; 00439 }
Function*************************************************************
Synopsis [Duplicate the network.]
Description []
SideEffects []
SeeAlso []
Definition at line 307 of file abcNtk.c.
00308 { 00309 Abc_Ntk_t * pNtkNew; 00310 Abc_Obj_t * pObj, * pFanin; 00311 int i, k; 00312 if ( pNtk == NULL ) 00313 return NULL; 00314 // start the network 00315 pNtkNew = Abc_NtkStartFrom( pNtk, pNtk->ntkType, pNtk->ntkFunc ); 00316 // copy the internal nodes 00317 if ( Abc_NtkIsStrash(pNtk) ) 00318 { 00319 // copy the AND gates 00320 Abc_AigForEachAnd( pNtk, pObj, i ) 00321 pObj->pCopy = Abc_AigAnd( pNtkNew->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild1Copy(pObj) ); 00322 // relink the choice nodes 00323 Abc_AigForEachAnd( pNtk, pObj, i ) 00324 if ( pObj->pData ) 00325 pObj->pCopy->pData = ((Abc_Obj_t *)pObj->pData)->pCopy; 00326 // relink the CO nodes 00327 Abc_NtkForEachCo( pNtk, pObj, i ) 00328 Abc_ObjAddFanin( pObj->pCopy, Abc_ObjChild0Copy(pObj) ); 00329 // get the number of nodes before and after 00330 if ( Abc_NtkNodeNum(pNtk) != Abc_NtkNodeNum(pNtkNew) ) 00331 printf( "Warning: Structural hashing during duplication reduced %d nodes (this is a minor bug).\n", 00332 Abc_NtkNodeNum(pNtk) - Abc_NtkNodeNum(pNtkNew) ); 00333 } 00334 else 00335 { 00336 // duplicate the nets and nodes (CIs/COs/latches already dupped) 00337 Abc_NtkForEachObj( pNtk, pObj, i ) 00338 if ( pObj->pCopy == NULL ) 00339 Abc_NtkDupObj(pNtkNew, pObj, 0); 00340 // reconnect all objects (no need to transfer attributes on edges) 00341 Abc_NtkForEachObj( pNtk, pObj, i ) 00342 if ( !Abc_ObjIsBox(pObj) && !Abc_ObjIsBo(pObj) ) 00343 Abc_ObjForEachFanin( pObj, pFanin, k ) 00344 Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy ); 00345 } 00346 // duplicate the EXDC Ntk 00347 if ( pNtk->pExdc ) 00348 pNtkNew->pExdc = Abc_NtkDup( pNtk->pExdc ); 00349 if ( !Abc_NtkCheck( pNtkNew ) ) 00350 fprintf( stdout, "Abc_NtkDup(): Network check has failed.\n" ); 00351 pNtk->pCopy = pNtkNew; 00352 return pNtkNew; 00353 }
Function*************************************************************
Synopsis [Finalizes the network using the existing network as a model.]
Description []
SideEffects []
SeeAlso []
Definition at line 197 of file abcNtk.c.
00198 { 00199 Abc_Obj_t * pObj, * pDriver, * pDriverNew; 00200 int i; 00201 // set the COs of the strashed network 00202 Abc_NtkForEachCo( pNtk, pObj, i ) 00203 { 00204 pDriver = Abc_ObjFanin0Ntk( Abc_ObjFanin0(pObj) ); 00205 pDriverNew = Abc_ObjNotCond(pDriver->pCopy, Abc_ObjFaninC0(pObj)); 00206 Abc_ObjAddFanin( pObj->pCopy, pDriverNew ); 00207 } 00208 }
void Abc_NtkFinalizeRead | ( | Abc_Ntk_t * | pNtk | ) |
Function*************************************************************
Synopsis [Finalizes the network using the existing network as a model.]
Description []
SideEffects []
SeeAlso []
Definition at line 248 of file abcNtk.c.
00249 { 00250 Abc_Obj_t * pBox, * pObj, * pTerm, * pNet; 00251 int i; 00252 if ( Abc_NtkHasBlackbox(pNtk) && Abc_NtkBoxNum(pNtk) == 0 ) 00253 { 00254 pBox = Abc_NtkCreateBlackbox(pNtk); 00255 Abc_NtkForEachPi( pNtk, pObj, i ) 00256 { 00257 pTerm = Abc_NtkCreateBi(pNtk); 00258 Abc_ObjAddFanin( pTerm, Abc_ObjFanout0(pObj) ); 00259 Abc_ObjAddFanin( pBox, pTerm ); 00260 } 00261 Abc_NtkForEachPo( pNtk, pObj, i ) 00262 { 00263 pTerm = Abc_NtkCreateBo(pNtk); 00264 Abc_ObjAddFanin( pTerm, pBox ); 00265 Abc_ObjAddFanin( Abc_ObjFanin0(pObj), pTerm ); 00266 } 00267 return; 00268 } 00269 assert( Abc_NtkIsNetlist(pNtk) ); 00270 00271 // check if constant 0 net is used 00272 pNet = Abc_NtkFindNet( pNtk, "1\'b0" ); 00273 if ( pNet ) 00274 { 00275 if ( Abc_ObjFanoutNum(pNet) == 0 ) 00276 Abc_NtkDeleteObj(pNet); 00277 else if ( Abc_ObjFaninNum(pNet) == 0 ) 00278 Abc_ObjAddFanin( pNet, Abc_NtkCreateNodeConst0(pNtk) ); 00279 } 00280 // check if constant 1 net is used 00281 pNet = Abc_NtkFindNet( pNtk, "1\'b1" ); 00282 if ( pNet ) 00283 { 00284 if ( Abc_ObjFanoutNum(pNet) == 0 ) 00285 Abc_NtkDeleteObj(pNet); 00286 else if ( Abc_ObjFaninNum(pNet) == 0 ) 00287 Abc_ObjAddFanin( pNet, Abc_NtkCreateNodeConst1(pNtk) ); 00288 } 00289 // fix the net drivers 00290 Abc_NtkFixNonDrivenNets( pNtk ); 00291 00292 // reorder the CI/COs to PI/POs first 00293 Abc_NtkOrderCisCos( pNtk ); 00294 }
void Abc_NtkFixNonDrivenNets | ( | Abc_Ntk_t * | pNtk | ) |
Function*************************************************************
Synopsis [Reads the verilog file.]
Description []
SideEffects []
SeeAlso []
Definition at line 1042 of file abcNtk.c.
01043 { 01044 Vec_Ptr_t * vNets; 01045 Abc_Obj_t * pNet, * pNode; 01046 int i; 01047 01048 if ( Abc_NtkNodeNum(pNtk) == 0 && Abc_NtkBoxNum(pNtk) == 0 ) 01049 return; 01050 01051 // check for non-driven nets 01052 vNets = Vec_PtrAlloc( 100 ); 01053 Abc_NtkForEachNet( pNtk, pNet, i ) 01054 { 01055 if ( Abc_ObjFaninNum(pNet) > 0 ) 01056 continue; 01057 // add the constant 0 driver 01058 pNode = Abc_NtkCreateNodeConst0( pNtk ); 01059 // add the fanout net 01060 Abc_ObjAddFanin( pNet, pNode ); 01061 // add the net to those for which the warning will be printed 01062 Vec_PtrPush( vNets, pNet ); 01063 } 01064 01065 // print the warning 01066 if ( vNets->nSize > 0 ) 01067 { 01068 printf( "Warning: Constant-0 drivers added to %d non-driven nets in network \"%s\":\n", Vec_PtrSize(vNets), pNtk->pName ); 01069 Vec_PtrForEachEntry( vNets, pNet, i ) 01070 { 01071 printf( "%s%s", (i? ", ": ""), Abc_ObjName(pNet) ); 01072 if ( i == 3 ) 01073 { 01074 if ( Vec_PtrSize(vNets) > 3 ) 01075 printf( " ..." ); 01076 break; 01077 } 01078 } 01079 printf( "\n" ); 01080 } 01081 Vec_PtrFree( vNets ); 01082 }
void Abc_NtkMakeComb | ( | Abc_Ntk_t * | pNtk | ) |
Function*************************************************************
Synopsis [Converts the network to combinational.]
Description []
SideEffects []
SeeAlso []
Definition at line 1096 of file abcNtk.c.
01097 { 01098 Abc_Obj_t * pObj; 01099 int i; 01100 01101 if ( Abc_NtkIsComb(pNtk) ) 01102 return; 01103 01104 assert( !Abc_NtkIsNetlist(pNtk) ); 01105 assert( Abc_NtkHasOnlyLatchBoxes(pNtk) ); 01106 01107 // detach the latches 01108 // Abc_NtkForEachLatch( pNtk, pObj, i ) 01109 Vec_PtrForEachEntryReverse( pNtk->vBoxes, pObj, i ) 01110 Abc_NtkDeleteObj( pObj ); 01111 assert( Abc_NtkLatchNum(pNtk) == 0 ); 01112 assert( Abc_NtkBoxNum(pNtk) == 0 ); 01113 01114 // move CIs to become PIs 01115 Vec_PtrClear( pNtk->vPis ); 01116 Abc_NtkForEachCi( pNtk, pObj, i ) 01117 { 01118 if ( Abc_ObjIsBo(pObj) ) 01119 { 01120 pObj->Type = ABC_OBJ_PI; 01121 pNtk->nObjCounts[ABC_OBJ_PI]++; 01122 pNtk->nObjCounts[ABC_OBJ_BO]--; 01123 } 01124 Vec_PtrPush( pNtk->vPis, pObj ); 01125 } 01126 assert( Abc_NtkBoNum(pNtk) == 0 ); 01127 01128 // move COs to become POs 01129 Vec_PtrClear( pNtk->vPos ); 01130 Abc_NtkForEachCo( pNtk, pObj, i ) 01131 { 01132 if ( Abc_ObjIsBi(pObj) ) 01133 { 01134 pObj->Type = ABC_OBJ_PO; 01135 pNtk->nObjCounts[ABC_OBJ_PO]++; 01136 pNtk->nObjCounts[ABC_OBJ_BI]--; 01137 } 01138 Vec_PtrPush( pNtk->vPos, pObj ); 01139 } 01140 assert( Abc_NtkBiNum(pNtk) == 0 ); 01141 01142 if ( !Abc_NtkCheck( pNtk ) ) 01143 fprintf( stdout, "Abc_NtkMakeComb(): Network check has failed.\n" ); 01144 }
Abc_Ntk_t* Abc_NtkStartFrom | ( | Abc_Ntk_t * | pNtk, | |
Abc_NtkType_t | Type, | |||
Abc_NtkFunc_t | Func | |||
) |
Function*************************************************************
Synopsis [Starts a new network using existing network as a model.]
Description []
SideEffects []
SeeAlso []
Definition at line 97 of file abcNtk.c.
00098 { 00099 Abc_Ntk_t * pNtkNew; 00100 Abc_Obj_t * pObj; 00101 int fCopyNames, i; 00102 if ( pNtk == NULL ) 00103 return NULL; 00104 // decide whether to copy the names 00105 fCopyNames = ( Type != ABC_NTK_NETLIST ); 00106 // start the network 00107 pNtkNew = Abc_NtkAlloc( Type, Func, 1 ); 00108 // duplicate the name and the spec 00109 pNtkNew->pName = Extra_UtilStrsav(pNtk->pName); 00110 pNtkNew->pSpec = Extra_UtilStrsav(pNtk->pSpec); 00111 // clean the node copy fields 00112 Abc_NtkCleanCopy( pNtk ); 00113 // map the constant nodes 00114 if ( Abc_NtkIsStrash(pNtk) && Abc_NtkIsStrash(pNtkNew) ) 00115 Abc_AigConst1(pNtk)->pCopy = Abc_AigConst1(pNtkNew); 00116 // clone CIs/CIs/boxes 00117 Abc_NtkForEachPi( pNtk, pObj, i ) 00118 Abc_NtkDupObj( pNtkNew, pObj, fCopyNames ); 00119 Abc_NtkForEachPo( pNtk, pObj, i ) 00120 Abc_NtkDupObj( pNtkNew, pObj, fCopyNames ); 00121 Abc_NtkForEachAssert( pNtk, pObj, i ) 00122 Abc_NtkDupObj( pNtkNew, pObj, fCopyNames ); 00123 Abc_NtkForEachBox( pNtk, pObj, i ) 00124 Abc_NtkDupBox( pNtkNew, pObj, fCopyNames ); 00125 // transfer the names 00126 // Abc_NtkTrasferNames( pNtk, pNtkNew ); 00127 Abc_ManTimeDup( pNtk, pNtkNew ); 00128 // check that the CI/CO/latches are copied correctly 00129 assert( Abc_NtkCiNum(pNtk) == Abc_NtkCiNum(pNtkNew) ); 00130 assert( Abc_NtkCoNum(pNtk) == Abc_NtkCoNum(pNtkNew) ); 00131 assert( Abc_NtkLatchNum(pNtk) == Abc_NtkLatchNum(pNtkNew) ); 00132 return pNtkNew; 00133 }
Abc_Ntk_t* Abc_NtkStartFromNoLatches | ( | Abc_Ntk_t * | pNtk, | |
Abc_NtkType_t | Type, | |||
Abc_NtkFunc_t | Func | |||
) |
Function*************************************************************
Synopsis [Starts a new network using existing network as a model.]
Description []
SideEffects []
SeeAlso []
Definition at line 146 of file abcNtk.c.
00147 { 00148 Abc_Ntk_t * pNtkNew; 00149 Abc_Obj_t * pObj; 00150 int i; 00151 if ( pNtk == NULL ) 00152 return NULL; 00153 assert( Type != ABC_NTK_NETLIST ); 00154 // start the network 00155 pNtkNew = Abc_NtkAlloc( Type, Func, 1 ); 00156 // duplicate the name and the spec 00157 pNtkNew->pName = Extra_UtilStrsav(pNtk->pName); 00158 pNtkNew->pSpec = Extra_UtilStrsav(pNtk->pSpec); 00159 // clean the node copy fields 00160 Abc_NtkCleanCopy( pNtk ); 00161 // map the constant nodes 00162 if ( Abc_NtkIsStrash(pNtk) && Abc_NtkIsStrash(pNtkNew) ) 00163 Abc_AigConst1(pNtk)->pCopy = Abc_AigConst1(pNtkNew); 00164 // clone CIs/CIs/boxes 00165 Abc_NtkForEachPi( pNtk, pObj, i ) 00166 Abc_NtkDupObj( pNtkNew, pObj, 1 ); 00167 Abc_NtkForEachPo( pNtk, pObj, i ) 00168 Abc_NtkDupObj( pNtkNew, pObj, 1 ); 00169 Abc_NtkForEachAssert( pNtk, pObj, i ) 00170 Abc_NtkDupObj( pNtkNew, pObj, 1 ); 00171 Abc_NtkForEachBox( pNtk, pObj, i ) 00172 { 00173 if ( Abc_ObjIsLatch(pObj) ) 00174 continue; 00175 Abc_NtkDupBox(pNtkNew, pObj, 1); 00176 } 00177 // transfer the names 00178 // Abc_NtkTrasferNamesNoLatches( pNtk, pNtkNew ); 00179 Abc_ManTimeDup( pNtk, pNtkNew ); 00180 // check that the CI/CO/latches are copied correctly 00181 assert( Abc_NtkPiNum(pNtk) == Abc_NtkPiNum(pNtkNew) ); 00182 assert( Abc_NtkPoNum(pNtk) == Abc_NtkPoNum(pNtkNew) ); 00183 return pNtkNew; 00184 }
Abc_Ntk_t* Abc_NtkStartRead | ( | char * | pName | ) |
Function*************************************************************
Synopsis [Starts a new network using existing network as a model.]
Description []
SideEffects []
SeeAlso []
Definition at line 221 of file abcNtk.c.
00222 { 00223 Abc_Ntk_t * pNtkNew; 00224 // allocate the empty network 00225 pNtkNew = Abc_NtkAlloc( ABC_NTK_NETLIST, ABC_FUNC_SOP, 1 ); 00226 // set the specs 00227 pNtkNew->pName = Extra_FileNameGeneric(pName); 00228 pNtkNew->pSpec = Extra_UtilStrsav(pName); 00229 if ( pNtkNew->pName == NULL || strlen(pNtkNew->pName) == 0 ) 00230 { 00231 FREE( pNtkNew->pName ); 00232 pNtkNew->pName = Extra_UtilStrsav("unknown"); 00233 } 00234 return pNtkNew; 00235 }
Function*************************************************************
Synopsis [Removes POs with suppsize less than 2 and PIs without fanout.]
Description []
SideEffects []
SeeAlso []
Definition at line 1158 of file abcNtk.c.
01159 { 01160 Abc_Obj_t * pObj; 01161 int i, k, m; 01162 01163 // filter POs 01164 k = m = 0; 01165 Abc_NtkForEachCo( pNtk, pObj, i ) 01166 { 01167 if ( Abc_ObjIsPo(pObj) ) 01168 { 01169 // remove constant nodes and PI pointers 01170 if ( Abc_ObjFaninNum(Abc_ObjFanin0(pObj)) == 0 ) 01171 { 01172 Abc_ObjDeleteFanin( pObj, Abc_ObjFanin0(pObj) ); 01173 if ( Abc_ObjFanoutNum(Abc_ObjFanin0(pObj)) == 0 && !Abc_ObjIsPi(Abc_ObjFanin0(pObj)) ) 01174 Abc_NtkDeleteObj_rec( Abc_ObjFanin0(pObj), 1 ); 01175 pNtk->vObjs->pArray[pObj->Id] = NULL; 01176 pObj->Id = (1<<26)-1; 01177 pNtk->nObjCounts[pObj->Type]--; 01178 pNtk->nObjs--; 01179 Abc_ObjRecycle( pObj ); 01180 continue; 01181 } 01182 // remove buffers/inverters of PIs 01183 if ( Abc_ObjFaninNum(Abc_ObjFanin0(pObj)) == 1 ) 01184 { 01185 if ( Abc_ObjIsPi(Abc_ObjFanin0(Abc_ObjFanin0(pObj))) ) 01186 { 01187 Abc_ObjDeleteFanin( pObj, Abc_ObjFanin0(pObj) ); 01188 if ( Abc_ObjFanoutNum(Abc_ObjFanin0(pObj)) == 0 ) 01189 Abc_NtkDeleteObj_rec( Abc_ObjFanin0(pObj), 1 ); 01190 pNtk->vObjs->pArray[pObj->Id] = NULL; 01191 pObj->Id = (1<<26)-1; 01192 pNtk->nObjCounts[pObj->Type]--; 01193 pNtk->nObjs--; 01194 Abc_ObjRecycle( pObj ); 01195 continue; 01196 } 01197 } 01198 Vec_PtrWriteEntry( pNtk->vPos, m++, pObj ); 01199 } 01200 Vec_PtrWriteEntry( pNtk->vCos, k++, pObj ); 01201 } 01202 Vec_PtrShrink( pNtk->vPos, m ); 01203 Vec_PtrShrink( pNtk->vCos, k ); 01204 01205 // filter PIs 01206 k = m = 0; 01207 Abc_NtkForEachCi( pNtk, pObj, i ) 01208 { 01209 if ( Abc_ObjIsPi(pObj) ) 01210 { 01211 if ( Abc_ObjFanoutNum(pObj) == 0 ) 01212 { 01213 pNtk->vObjs->pArray[pObj->Id] = NULL; 01214 pObj->Id = (1<<26)-1; 01215 pNtk->nObjCounts[pObj->Type]--; 01216 pNtk->nObjs--; 01217 Abc_ObjRecycle( pObj ); 01218 continue; 01219 } 01220 Vec_PtrWriteEntry( pNtk->vPis, m++, pObj ); 01221 } 01222 Vec_PtrWriteEntry( pNtk->vCis, k++, pObj ); 01223 } 01224 Vec_PtrShrink( pNtk->vPis, m ); 01225 Vec_PtrShrink( pNtk->vCis, k ); 01226 01227 return Abc_NtkDup( pNtk ); 01228 }