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

Go to the source code of this file.

Classes

struct  Abc_ManRes_t_
 

Macros

#define ABC_RS_DIV1_MAX   150
 DECLARATIONS ///.
 
#define ABC_RS_DIV2_MAX   500
 

Functions

int Abc_NtkResubstitute (Abc_Ntk_t *pNtk, int nCutMax, int nStepsMax, int nMinSaved, int nLevelsOdc, int fUpdateLevel, int fVerbose, int fVeryVerbose)
 FUNCTION DEFINITIONS ///.
 
void Abc_ManResubCollectDivs_rec (Abc_Obj_t *pNode, Vec_Ptr_t *vInternal)
 
void Abc_ManResubDumpInstance (Vec_Ptr_t *vDivs, int nLeaves, int nDivs, int nWords)
 
Dec_Graph_tAbc_ManResubQuit0 (Abc_Obj_t *pRoot, Abc_Obj_t *pObj)
 
Dec_Graph_tAbc_ManResubQuit1 (Abc_Obj_t *pRoot, Abc_Obj_t *pObj0, Abc_Obj_t *pObj1, int fOrGate)
 
Dec_Graph_tAbc_ManResubQuit21 (Abc_Obj_t *pRoot, Abc_Obj_t *pObj0, Abc_Obj_t *pObj1, Abc_Obj_t *pObj2, int fOrGate)
 
Dec_Graph_tAbc_ManResubQuit2 (Abc_Obj_t *pRoot, Abc_Obj_t *pObj0, Abc_Obj_t *pObj1, Abc_Obj_t *pObj2, int fOrGate)
 
Dec_Graph_tAbc_ManResubQuit3 (Abc_Obj_t *pRoot, Abc_Obj_t *pObj0, Abc_Obj_t *pObj1, Abc_Obj_t *pObj2, Abc_Obj_t *pObj3, int fOrGate)
 
int Abc_CutVolumeCheck_rec (Abc_Obj_t *pObj)
 
void Abc_CutFactor_rec (Abc_Obj_t *pObj, Vec_Ptr_t *vLeaves)
 
Vec_Ptr_tAbc_CutFactor (Abc_Obj_t *pNode)
 

Macro Definition Documentation

◆ ABC_RS_DIV1_MAX

#define ABC_RS_DIV1_MAX   150

DECLARATIONS ///.

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

FileName [abcResub.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [Resubstitution manager.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

Definition at line 31 of file abcResub.c.

◆ ABC_RS_DIV2_MAX

#define ABC_RS_DIV2_MAX   500

Definition at line 32 of file abcResub.c.

Function Documentation

◆ Abc_CutFactor()

Vec_Ptr_t * Abc_CutFactor ( Abc_Obj_t * pNode)

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

Synopsis [Computes the factor cut of the node.]

Description [Factor-cut is the cut at a node in terms of factor-nodes. Factor-nodes are roots of the node trees (MUXes/EXORs are counted as single nodes). Factor-cut is unique for the given node.]

SideEffects []

SeeAlso []

Definition at line 2116 of file abcResub.c.

2117{
2118 Vec_Ptr_t * vLeaves;
2119 Abc_Obj_t * pObj;
2120 int i;
2121 assert( !Abc_ObjIsCi(pNode) );
2122 vLeaves = Vec_PtrAlloc( 10 );
2123 Abc_CutFactor_rec( Abc_ObjFanin0(pNode), vLeaves );
2124 Abc_CutFactor_rec( Abc_ObjFanin1(pNode), vLeaves );
2125 Vec_PtrForEachEntry( Abc_Obj_t *, vLeaves, pObj, i )
2126 pObj->fMarkA = 0;
2127 return vLeaves;
2128}
void Abc_CutFactor_rec(Abc_Obj_t *pObj, Vec_Ptr_t *vLeaves)
Definition abcResub.c:2089
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
unsigned fMarkA
Definition abc.h:134
#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_CutFactor_rec()

void Abc_CutFactor_rec ( Abc_Obj_t * pObj,
Vec_Ptr_t * vLeaves )

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

Synopsis [Computes the factor cut of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 2089 of file abcResub.c.

2090{
2091 if ( pObj->fMarkA )
2092 return;
2093 if ( Abc_ObjIsCi(pObj) || (Abc_ObjFanoutNum(pObj) > 1 && !Abc_NodeIsMuxControlType(pObj)) )
2094 {
2095 Vec_PtrPush( vLeaves, pObj );
2096 pObj->fMarkA = 1;
2097 return;
2098 }
2099 Abc_CutFactor_rec( Abc_ObjFanin0(pObj), vLeaves );
2100 Abc_CutFactor_rec( Abc_ObjFanin1(pObj), vLeaves );
2101}
ABC_DLL int Abc_NodeIsMuxControlType(Abc_Obj_t *pNode)
Definition abcUtil.c:1398
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_CutVolumeCheck_rec()

int Abc_CutVolumeCheck_rec ( Abc_Obj_t * pObj)

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

Synopsis [Computes the volume and checks if the cut is feasible.]

Description []

SideEffects []

SeeAlso []

Definition at line 2041 of file abcResub.c.

2042{
2043 // quit if the node is visited (or if it is a leaf)
2044 if ( Abc_NodeIsTravIdCurrent(pObj) )
2045 return 0;
2046 Abc_NodeSetTravIdCurrent(pObj);
2047 // report the error
2048 if ( Abc_ObjIsCi(pObj) )
2049 printf( "Abc_CutVolumeCheck() ERROR: The set of nodes is not a cut!\n" );
2050 // count the number of nodes in the leaves
2051 return 1 + Abc_CutVolumeCheck_rec( Abc_ObjFanin0(pObj) ) +
2052 Abc_CutVolumeCheck_rec( Abc_ObjFanin1(pObj) );
2053}
int Abc_CutVolumeCheck_rec(Abc_Obj_t *pObj)
Definition abcResub.c:2041
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_ManResubCollectDivs_rec()

void Abc_ManResubCollectDivs_rec ( Abc_Obj_t * pNode,
Vec_Ptr_t * vInternal )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 415 of file abcResub.c.

416{
417 // skip visited nodes
418 if ( Abc_NodeIsTravIdCurrent(pNode) )
419 return;
420 Abc_NodeSetTravIdCurrent(pNode);
421 // collect the fanins
422 Abc_ManResubCollectDivs_rec( Abc_ObjFanin0(pNode), vInternal );
423 Abc_ManResubCollectDivs_rec( Abc_ObjFanin1(pNode), vInternal );
424 // collect the internal node
425 if ( pNode->fMarkA == 0 )
426 Vec_PtrPush( vInternal, pNode );
427}
void Abc_ManResubCollectDivs_rec(Abc_Obj_t *pNode, Vec_Ptr_t *vInternal)
Definition abcResub.c:415
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_ManResubDumpInstance()

void Abc_ManResubDumpInstance ( Vec_Ptr_t * vDivs,
int nLeaves,
int nDivs,
int nWords )

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

Synopsis [Dumps one resub instance.]

Description []

SideEffects []

SeeAlso []

Definition at line 574 of file abcResub.c.

575{
576 Abc_Obj_t * pRoot = (Abc_Obj_t *)Vec_PtrEntryLast(vDivs);
577 char pFileName[1000];
578 sprintf( pFileName, "%s_%05d.pla", pRoot->pNtk->pName, pRoot->Id );
579 FILE * pFile = fopen( pFileName, "wb" );
580 if ( pFile == NULL ) {
581 printf( "Cannot open file \"%s\" for writing.\n", pFileName );
582 return;
583 }
584 fprintf( pFile, "// Resub instance generated for node %d in network \"%s\" on %s\n", pRoot->Id, pRoot->pNtk->pName, Extra_TimeStamp() );
585 fprintf( pFile, ".i %d\n", nDivs );
586 fprintf( pFile, ".o %d\n", 1 );
587 fprintf( pFile, ".p %d\n", 1 << nLeaves );
588 Abc_Obj_t * pObj; int i, n;
589 for ( n = 0; n < (1 << nLeaves); n++ ) {
590 Vec_PtrForEachEntryStop( Abc_Obj_t *, vDivs, pObj, i, nDivs ) {
591 fprintf( pFile, "%d", Abc_InfoHasBit((unsigned *)pObj->pData, n) );
592 if ( i == nLeaves-1 )
593 fprintf( pFile, " " );
594 }
595 fprintf( pFile, " %d\n", Abc_InfoHasBit((unsigned *)pRoot->pData, n) );
596 }
597 fprintf( pFile, ".e\n" );
598 fclose( pFile );
599 printf( "Finished dumping file \"%s\" with %d divisors and %d patterns.\n", pFileName, nDivs, (1 << nLeaves) );
600}
char * Extra_TimeStamp()
char * pName
Definition abc.h:158
void * pData
Definition abc.h:145
Abc_Ntk_t * pNtk
Definition abc.h:130
int Id
Definition abc.h:132
char * sprintf()
#define Vec_PtrForEachEntryStop(Type, vVec, pEntry, i, Stop)
Definition vecPtr.h:59
Here is the call graph for this function:

◆ Abc_ManResubQuit0()

Dec_Graph_t * Abc_ManResubQuit0 ( Abc_Obj_t * pRoot,
Abc_Obj_t * pObj )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 670 of file abcResub.c.

671{
672 Dec_Graph_t * pGraph;
673 Dec_Edge_t eRoot;
674 pGraph = Dec_GraphCreate( 1 );
675 Dec_GraphNode( pGraph, 0 )->pFunc = pObj;
676 eRoot = Dec_EdgeCreate( 0, pObj->fPhase );
677 Dec_GraphSetRoot( pGraph, eRoot );
678 if ( pRoot->fPhase )
679 Dec_GraphComplement( pGraph );
680 return pGraph;
681}
typedefABC_NAMESPACE_HEADER_START struct Dec_Edge_t_ Dec_Edge_t
INCLUDES ///.
Definition dec.h:42
struct Dec_Graph_t_ Dec_Graph_t
Definition dec.h:68
unsigned fPhase
Definition abc.h:137

◆ Abc_ManResubQuit1()

Dec_Graph_t * Abc_ManResubQuit1 ( Abc_Obj_t * pRoot,
Abc_Obj_t * pObj0,
Abc_Obj_t * pObj1,
int fOrGate )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 694 of file abcResub.c.

695{
696 Dec_Graph_t * pGraph;
697 Dec_Edge_t eRoot, eNode0, eNode1;
698 assert( Abc_ObjRegular(pObj0) != Abc_ObjRegular(pObj1) );
699 pGraph = Dec_GraphCreate( 2 );
700 Dec_GraphNode( pGraph, 0 )->pFunc = Abc_ObjRegular(pObj0);
701 Dec_GraphNode( pGraph, 1 )->pFunc = Abc_ObjRegular(pObj1);
702 eNode0 = Dec_EdgeCreate( 0, Abc_ObjRegular(pObj0)->fPhase ^ Abc_ObjIsComplement(pObj0) );
703 eNode1 = Dec_EdgeCreate( 1, Abc_ObjRegular(pObj1)->fPhase ^ Abc_ObjIsComplement(pObj1) );
704 if ( fOrGate )
705 eRoot = Dec_GraphAddNodeOr( pGraph, eNode0, eNode1 );
706 else
707 eRoot = Dec_GraphAddNodeAnd( pGraph, eNode0, eNode1 );
708 Dec_GraphSetRoot( pGraph, eRoot );
709 if ( pRoot->fPhase )
710 Dec_GraphComplement( pGraph );
711 return pGraph;
712}

◆ Abc_ManResubQuit2()

Dec_Graph_t * Abc_ManResubQuit2 ( Abc_Obj_t * pRoot,
Abc_Obj_t * pObj0,
Abc_Obj_t * pObj1,
Abc_Obj_t * pObj2,
int fOrGate )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 766 of file abcResub.c.

767{
768 Dec_Graph_t * pGraph;
769 Dec_Edge_t eRoot, ePrev, eNode0, eNode1, eNode2;
770 assert( Abc_ObjRegular(pObj0) != Abc_ObjRegular(pObj1) );
771 assert( Abc_ObjRegular(pObj0) != Abc_ObjRegular(pObj2) );
772 assert( Abc_ObjRegular(pObj1) != Abc_ObjRegular(pObj2) );
773 pGraph = Dec_GraphCreate( 3 );
774 Dec_GraphNode( pGraph, 0 )->pFunc = Abc_ObjRegular(pObj0);
775 Dec_GraphNode( pGraph, 1 )->pFunc = Abc_ObjRegular(pObj1);
776 Dec_GraphNode( pGraph, 2 )->pFunc = Abc_ObjRegular(pObj2);
777 eNode0 = Dec_EdgeCreate( 0, Abc_ObjRegular(pObj0)->fPhase ^ Abc_ObjIsComplement(pObj0) );
778 if ( Abc_ObjIsComplement(pObj1) && Abc_ObjIsComplement(pObj2) )
779 {
780 eNode1 = Dec_EdgeCreate( 1, Abc_ObjRegular(pObj1)->fPhase );
781 eNode2 = Dec_EdgeCreate( 2, Abc_ObjRegular(pObj2)->fPhase );
782 ePrev = Dec_GraphAddNodeOr( pGraph, eNode1, eNode2 );
783 }
784 else
785 {
786 eNode1 = Dec_EdgeCreate( 1, Abc_ObjRegular(pObj1)->fPhase ^ Abc_ObjIsComplement(pObj1) );
787 eNode2 = Dec_EdgeCreate( 2, Abc_ObjRegular(pObj2)->fPhase ^ Abc_ObjIsComplement(pObj2) );
788 ePrev = Dec_GraphAddNodeAnd( pGraph, eNode1, eNode2 );
789 }
790 if ( fOrGate )
791 eRoot = Dec_GraphAddNodeOr( pGraph, eNode0, ePrev );
792 else
793 eRoot = Dec_GraphAddNodeAnd( pGraph, eNode0, ePrev );
794 Dec_GraphSetRoot( pGraph, eRoot );
795 if ( pRoot->fPhase )
796 Dec_GraphComplement( pGraph );
797 return pGraph;
798}

◆ Abc_ManResubQuit21()

Dec_Graph_t * Abc_ManResubQuit21 ( Abc_Obj_t * pRoot,
Abc_Obj_t * pObj0,
Abc_Obj_t * pObj1,
Abc_Obj_t * pObj2,
int fOrGate )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 725 of file abcResub.c.

726{
727 Dec_Graph_t * pGraph;
728 Dec_Edge_t eRoot, eNode0, eNode1, eNode2;
729 assert( Abc_ObjRegular(pObj0) != Abc_ObjRegular(pObj1) );
730 assert( Abc_ObjRegular(pObj0) != Abc_ObjRegular(pObj2) );
731 assert( Abc_ObjRegular(pObj1) != Abc_ObjRegular(pObj2) );
732 pGraph = Dec_GraphCreate( 3 );
733 Dec_GraphNode( pGraph, 0 )->pFunc = Abc_ObjRegular(pObj0);
734 Dec_GraphNode( pGraph, 1 )->pFunc = Abc_ObjRegular(pObj1);
735 Dec_GraphNode( pGraph, 2 )->pFunc = Abc_ObjRegular(pObj2);
736 eNode0 = Dec_EdgeCreate( 0, Abc_ObjRegular(pObj0)->fPhase ^ Abc_ObjIsComplement(pObj0) );
737 eNode1 = Dec_EdgeCreate( 1, Abc_ObjRegular(pObj1)->fPhase ^ Abc_ObjIsComplement(pObj1) );
738 eNode2 = Dec_EdgeCreate( 2, Abc_ObjRegular(pObj2)->fPhase ^ Abc_ObjIsComplement(pObj2) );
739 if ( fOrGate )
740 {
741 eRoot = Dec_GraphAddNodeOr( pGraph, eNode0, eNode1 );
742 eRoot = Dec_GraphAddNodeOr( pGraph, eNode2, eRoot );
743 }
744 else
745 {
746 eRoot = Dec_GraphAddNodeAnd( pGraph, eNode0, eNode1 );
747 eRoot = Dec_GraphAddNodeAnd( pGraph, eNode2, eRoot );
748 }
749 Dec_GraphSetRoot( pGraph, eRoot );
750 if ( pRoot->fPhase )
751 Dec_GraphComplement( pGraph );
752 return pGraph;
753}

◆ Abc_ManResubQuit3()

Dec_Graph_t * Abc_ManResubQuit3 ( Abc_Obj_t * pRoot,
Abc_Obj_t * pObj0,
Abc_Obj_t * pObj1,
Abc_Obj_t * pObj2,
Abc_Obj_t * pObj3,
int fOrGate )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 811 of file abcResub.c.

812{
813 Dec_Graph_t * pGraph;
814 Dec_Edge_t eRoot, ePrev0, ePrev1, eNode0, eNode1, eNode2, eNode3;
815 assert( Abc_ObjRegular(pObj0) != Abc_ObjRegular(pObj1) );
816 assert( Abc_ObjRegular(pObj2) != Abc_ObjRegular(pObj3) );
817 pGraph = Dec_GraphCreate( 4 );
818 Dec_GraphNode( pGraph, 0 )->pFunc = Abc_ObjRegular(pObj0);
819 Dec_GraphNode( pGraph, 1 )->pFunc = Abc_ObjRegular(pObj1);
820 Dec_GraphNode( pGraph, 2 )->pFunc = Abc_ObjRegular(pObj2);
821 Dec_GraphNode( pGraph, 3 )->pFunc = Abc_ObjRegular(pObj3);
822 if ( Abc_ObjIsComplement(pObj0) && Abc_ObjIsComplement(pObj1) )
823 {
824 eNode0 = Dec_EdgeCreate( 0, Abc_ObjRegular(pObj0)->fPhase );
825 eNode1 = Dec_EdgeCreate( 1, Abc_ObjRegular(pObj1)->fPhase );
826 ePrev0 = Dec_GraphAddNodeOr( pGraph, eNode0, eNode1 );
827 if ( Abc_ObjIsComplement(pObj2) && Abc_ObjIsComplement(pObj3) )
828 {
829 eNode2 = Dec_EdgeCreate( 2, Abc_ObjRegular(pObj2)->fPhase );
830 eNode3 = Dec_EdgeCreate( 3, Abc_ObjRegular(pObj3)->fPhase );
831 ePrev1 = Dec_GraphAddNodeOr( pGraph, eNode2, eNode3 );
832 }
833 else
834 {
835 eNode2 = Dec_EdgeCreate( 2, Abc_ObjRegular(pObj2)->fPhase ^ Abc_ObjIsComplement(pObj2) );
836 eNode3 = Dec_EdgeCreate( 3, Abc_ObjRegular(pObj3)->fPhase ^ Abc_ObjIsComplement(pObj3) );
837 ePrev1 = Dec_GraphAddNodeAnd( pGraph, eNode2, eNode3 );
838 }
839 }
840 else
841 {
842 eNode0 = Dec_EdgeCreate( 0, Abc_ObjRegular(pObj0)->fPhase ^ Abc_ObjIsComplement(pObj0) );
843 eNode1 = Dec_EdgeCreate( 1, Abc_ObjRegular(pObj1)->fPhase ^ Abc_ObjIsComplement(pObj1) );
844 ePrev0 = Dec_GraphAddNodeAnd( pGraph, eNode0, eNode1 );
845 if ( Abc_ObjIsComplement(pObj2) && Abc_ObjIsComplement(pObj3) )
846 {
847 eNode2 = Dec_EdgeCreate( 2, Abc_ObjRegular(pObj2)->fPhase );
848 eNode3 = Dec_EdgeCreate( 3, Abc_ObjRegular(pObj3)->fPhase );
849 ePrev1 = Dec_GraphAddNodeOr( pGraph, eNode2, eNode3 );
850 }
851 else
852 {
853 eNode2 = Dec_EdgeCreate( 2, Abc_ObjRegular(pObj2)->fPhase ^ Abc_ObjIsComplement(pObj2) );
854 eNode3 = Dec_EdgeCreate( 3, Abc_ObjRegular(pObj3)->fPhase ^ Abc_ObjIsComplement(pObj3) );
855 ePrev1 = Dec_GraphAddNodeAnd( pGraph, eNode2, eNode3 );
856 }
857 }
858 if ( fOrGate )
859 eRoot = Dec_GraphAddNodeOr( pGraph, ePrev0, ePrev1 );
860 else
861 eRoot = Dec_GraphAddNodeAnd( pGraph, ePrev0, ePrev1 );
862 Dec_GraphSetRoot( pGraph, eRoot );
863 if ( pRoot->fPhase )
864 Dec_GraphComplement( pGraph );
865 return pGraph;
866}

◆ Abc_NtkResubstitute()

int Abc_NtkResubstitute ( Abc_Ntk_t * pNtk,
int nCutMax,
int nStepsMax,
int nMinSaved,
int nLevelsOdc,
int fUpdateLevel,
int fVerbose,
int fVeryVerbose )

FUNCTION DEFINITIONS ///.

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

Synopsis [Performs incremental resynthesis of the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 137 of file abcResub.c.

138{
139 extern int Dec_GraphUpdateNetwork( Abc_Obj_t * pRoot, Dec_Graph_t * pGraph, int fUpdateLevel, int nGain );
140 ProgressBar * pProgress;
141 Abc_ManRes_t * pManRes;
142 Abc_ManCut_t * pManCut;
143 Odc_Man_t * pManOdc = NULL;
144 Dec_Graph_t * pFForm;
145 Vec_Ptr_t * vLeaves;
146 Abc_Obj_t * pNode;
147 abctime clk, clkStart = Abc_Clock();
148 int i, nNodes;
149
150 assert( Abc_NtkIsStrash(pNtk) );
151
152 // cleanup the AIG
154 // start the managers
155 pManCut = Abc_NtkManCutStart( nCutMax, 100000, 100000, 100000 );
156 pManRes = Abc_ManResubStart( nCutMax, ABC_RS_DIV1_MAX );
157 if ( nLevelsOdc > 0 )
158 pManOdc = Abc_NtkDontCareAlloc( nCutMax, nLevelsOdc, fVerbose, fVeryVerbose );
159
160 // compute the reverse levels if level update is requested
161 if ( fUpdateLevel )
162 Abc_NtkStartReverseLevels( pNtk, 0 );
163
164 if ( Abc_NtkLatchNum(pNtk) ) {
165 Abc_NtkForEachLatch(pNtk, pNode, i)
166 pNode->pNext = (Abc_Obj_t *)pNode->pData;
167 }
168
169 // resynthesize each node once
170 pManRes->nNodesBeg = Abc_NtkNodeNum(pNtk);
171 nNodes = Abc_NtkObjNumMax(pNtk);
172 pProgress = Extra_ProgressBarStart( stdout, nNodes );
173 //clear markAB at the beginning
174 Abc_NtkCleanMarkAB( pNtk );
175 Abc_NtkForEachNode( pNtk, pNode, i )
176 {
177 Extra_ProgressBarUpdate( pProgress, i, NULL );
178 // skip the constant node
179// if ( Abc_NodeIsConst(pNode) )
180// continue;
181 // skip persistant nodes
182 if ( Abc_NodeIsPersistant(pNode) )
183 continue;
184 // skip the nodes with many fanouts
185 if ( Abc_ObjFanoutNum(pNode) > 1000 )
186 continue;
187 // stop if all nodes have been tried once
188 if ( i >= nNodes )
189 break;
190
191 // compute a reconvergence-driven cut
192clk = Abc_Clock();
193 vLeaves = Abc_NodeFindCut( pManCut, pNode, 0 );
194// vLeaves = Abc_CutFactorLarge( pNode, nCutMax );
195pManRes->timeCut += Abc_Clock() - clk;
196/*
197 if ( fVerbose && vLeaves )
198 printf( "Node %6d : Leaves = %3d. Volume = %3d.\n", pNode->Id, Vec_PtrSize(vLeaves), Abc_CutVolumeCheck(pNode, vLeaves) );
199 if ( vLeaves == NULL )
200 continue;
201*/
202 // get the don't-cares
203 if ( pManOdc )
204 {
205clk = Abc_Clock();
206 Abc_NtkDontCareClear( pManOdc );
207 Abc_NtkDontCareCompute( pManOdc, pNode, vLeaves, pManRes->pCareSet );
208pManRes->timeTruth += Abc_Clock() - clk;
209 }
210
211 // evaluate this cut
212clk = Abc_Clock();
213 pFForm = Abc_ManResubEval( pManRes, pNode, vLeaves, nStepsMax, fUpdateLevel, fVerbose );
214// Vec_PtrFree( vLeaves );
215// Abc_ManResubCleanup( pManRes );
216pManRes->timeRes += Abc_Clock() - clk;
217 if ( pFForm == NULL )
218 continue;
219 if ( pManRes->nLastGain < nMinSaved )
220 {
221 Dec_GraphFree( pFForm );
222 continue;
223 }
224 pManRes->nTotalGain += pManRes->nLastGain;
225/*
226 if ( pManRes->nLeaves == 4 && pManRes->nMffc == 2 && pManRes->nLastGain == 1 )
227 {
228 printf( "%6d : L = %2d. V = %2d. Mffc = %2d. Divs = %3d. Up = %3d. Un = %3d. B = %3d.\n",
229 pNode->Id, pManRes->nLeaves, Abc_CutVolumeCheck(pNode, vLeaves), pManRes->nMffc, pManRes->nDivs,
230 pManRes->vDivs1UP->nSize, pManRes->vDivs1UN->nSize, pManRes->vDivs1B->nSize );
231 Abc_ManResubPrintDivs( pManRes, pNode, vLeaves );
232 }
233*/
234 // acceptable replacement found, update the graph
235clk = Abc_Clock();
236 Dec_GraphUpdateNetwork( pNode, pFForm, fUpdateLevel, pManRes->nLastGain );
237pManRes->timeNtk += Abc_Clock() - clk;
238 Dec_GraphFree( pFForm );
239 }
240 Extra_ProgressBarStop( pProgress );
241pManRes->timeTotal = Abc_Clock() - clkStart;
242 pManRes->nNodesEnd = Abc_NtkNodeNum(pNtk);
243
244 // print statistics
245 if ( fVerbose )
246 Abc_ManResubPrint( pManRes );
247
248 // delete the managers
249 Abc_ManResubStop( pManRes );
250 Abc_NtkManCutStop( pManCut );
251 if ( pManOdc ) Abc_NtkDontCareFree( pManOdc );
252
253 // clean the data field
254 Abc_NtkForEachObj( pNtk, pNode, i )
255 pNode->pData = NULL;
256
257 if ( Abc_NtkLatchNum(pNtk) ) {
258 Abc_NtkForEachLatch(pNtk, pNode, i)
259 pNode->pData = pNode->pNext, pNode->pNext = NULL;
260 }
261
262 // put the nodes into the DFS order and reassign their IDs
263 Abc_NtkReassignIds( pNtk );
264// Abc_AigCheckFaninOrder( pNtk->pManFunc );
265 // fix the levels
266 if ( fUpdateLevel )
268 else
269 Abc_NtkLevel( pNtk );
270 // check
271 if ( !Abc_NtkCheck( pNtk ) )
272 {
273 printf( "Abc_NtkRefactor: The network check has failed.\n" );
274 return 0;
275 }
276//s_ResubTime = Abc_Clock() - clkStart;
277 return 1;
278}
int Dec_GraphUpdateNetwork(Abc_Obj_t *pRoot, Dec_Graph_t *pGraph, int fUpdateLevel, int nGain)
Definition decAbc.c:240
struct Abc_ManRes_t_ Abc_ManRes_t
#define ABC_RS_DIV1_MAX
ABC_DLL Odc_Man_t * Abc_NtkDontCareAlloc(int nVarsMax, int nLevels, int fVerbose, int fVeryVerbose)
FUNCTION DEFINITIONS ///.
Definition abcOdc.c:163
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition abc.h:500
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
ABC_DLL int Abc_NtkDontCareCompute(Odc_Man_t *p, Abc_Obj_t *pNode, Vec_Ptr_t *vLeaves, unsigned *puTruth)
Definition abcOdc.c:1042
struct Abc_ManCut_t_ Abc_ManCut_t
Definition abc.h:119
struct Odc_Man_t_ Odc_Man_t
Definition abc.h:832
ABC_DLL void Abc_NtkDontCareClear(Odc_Man_t *p)
Definition abcOdc.c:244
struct Abc_Aig_t_ Abc_Aig_t
Definition abc.h:117
ABC_DLL void Abc_NtkManCutStop(Abc_ManCut_t *p)
Definition abcReconv.c:623
ABC_DLL void Abc_NtkStopReverseLevels(Abc_Ntk_t *pNtk)
Definition abcTiming.c:1302
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
Definition abcDfs.c:1449
ABC_DLL Vec_Ptr_t * Abc_NodeFindCut(Abc_ManCut_t *p, Abc_Obj_t *pRoot, int fContain)
Definition abcReconv.c:256
ABC_DLL int Abc_AigCleanup(Abc_Aig_t *pMan)
Definition abcAig.c:194
ABC_DLL void Abc_NtkStartReverseLevels(Abc_Ntk_t *pNtk, int nMaxLevelIncrease)
Definition abcTiming.c:1274
ABC_DLL void Abc_NtkDontCareFree(Odc_Man_t *p)
Definition abcOdc.c:276
ABC_DLL void Abc_NtkReassignIds(Abc_Ntk_t *pNtk)
Definition abcUtil.c:1809
ABC_DLL void Abc_NtkCleanMarkAB(Abc_Ntk_t *pNtk)
Definition abcUtil.c:753
ABC_DLL Abc_ManCut_t * Abc_NtkManCutStart(int nNodeSizeMax, int nConeSizeMax, int nNodeFanStop, int nConeFanStop)
Definition abcReconv.c:595
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition abc.h:464
ABC_INT64_T abctime
Definition abc_global.h:332
ABC_NAMESPACE_IMPL_START typedef char ProgressBar
Definition bbrNtbdd.c:27
void Extra_ProgressBarStop(ProgressBar *p)
ProgressBar * Extra_ProgressBarStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
unsigned * pCareSet
void * pManFunc
Definition abc.h:191
Abc_Obj_t * pNext
Definition abc.h:131
Here is the call graph for this function: