Commit 9c98ba17 by Alan Mishchenko

Version abc50901

parent ab7cb9c6
...@@ -10,7 +10,7 @@ MODULES := src/base/abc src/base/cmd src/base/io src/base/main \ ...@@ -10,7 +10,7 @@ MODULES := src/base/abc src/base/cmd src/base/io src/base/main \
src/bdd/cudd src/bdd/dsd src/bdd/epd src/bdd/mtr src/bdd/parse src/bdd/reo \ src/bdd/cudd src/bdd/dsd src/bdd/epd src/bdd/mtr src/bdd/parse src/bdd/reo \
src/map/fpga src/map/mapper src/map/mio src/map/super \ src/map/fpga src/map/mapper src/map/mio src/map/super \
src/misc/extra src/misc/st src/misc/util src/misc/vec \ src/misc/extra src/misc/st src/misc/util src/misc/vec \
src/opt/cut src/opt/fxu src/opt/rwr \ src/opt/cut src/opt/dec src/opt/fxu src/opt/rwr \
src/sat/asat src/sat/csat src/sat/msat src/sat/fraig src/sat/sim \ src/sat/asat src/sat/csat src/sat/msat src/sat/fraig src/sat/sim \
src/seq \ src/seq \
src/sop/ft src/sop/mvc src/sop/ft src/sop/mvc
......
...@@ -42,7 +42,7 @@ RSC=rc.exe ...@@ -42,7 +42,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0 # PROP Ignore_Export_Lib 0
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "src\base\abc" /I "src\base\cmd" /I "src\base\io" /I "src\base\main" /I "src\bdd\cudd" /I "src\bdd\epd" /I "src\bdd\mtr" /I "src\bdd\parse" /I "src\bdd\dsd" /I "src\bdd\reo" /I "src\sop\mvc" /I "src\sop\ft" /I "src\sat\asat" /I "src\sat\msat" /I "src\sat\fraig" /I "src\opt\fxa" /I "src\opt\fxu" /I "src\opt\rwr" /I "src\opt\cut" /I "src\map\fpga" /I "src\map\mapper" /I "src\map\mio" /I "src\map\super" /I "src\misc\extra" /I "src\misc\st" /I "src\misc\util" /I "src\misc\vec" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "__STDC__" /D "HAVE_ASSERT_H" /FR /YX /FD /c # ADD CPP /nologo /W3 /GX /O2 /I "src\base\abc" /I "src\base\cmd" /I "src\base\io" /I "src\base\main" /I "src\bdd\cudd" /I "src\bdd\epd" /I "src\bdd\mtr" /I "src\bdd\parse" /I "src\bdd\dsd" /I "src\bdd\reo" /I "src\sop\mvc" /I "src\sop\ft" /I "src\sat\asat" /I "src\sat\msat" /I "src\sat\fraig" /I "src\opt\cut" /I "src\opt\dec" /I "src\opt\fxu" /I "src\opt\rwr" /I "src\map\fpga" /I "src\map\mapper" /I "src\map\mio" /I "src\map\super" /I "src\misc\extra" /I "src\misc\st" /I "src\misc\util" /I "src\misc\vec" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "__STDC__" /D "HAVE_ASSERT_H" /FR /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe BSC32=bscmake.exe
...@@ -66,7 +66,8 @@ LINK32=link.exe ...@@ -66,7 +66,8 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0 # PROP Ignore_Export_Lib 0
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "src\base\abc" /I "src\base\cmd" /I "src\base\io" /I "src\base\main" /I "src\bdd\cudd" /I "src\bdd\epd" /I "src\bdd\mtr" /I "src\bdd\parse" /I "src\bdd\dsd" /I "src\bdd\reo" /I "src\sop\mvc" /I "src\sop\ft" /I "src\sat\asat" /I "src\sat\msat" /I "src\sat\fraig" /I "src\opt\fxa" /I "src\opt\fxu" /I "src\opt\rwr" /I "src\opt\cut" /I "src\map\fpga" /I "src\map\mapper" /I "src\map\mio" /I "src\map\super" /I "src\misc\extra" /I "src\misc\st" /I "src\misc\util" /I "src\misc\vec" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "__STDC__" /D "HAVE_ASSERT_H" /FR /YX /FD /GZ /c # ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "src\base\abc" /I "src\base\cmd" /I "src\base\io" /I "src\base\main" /I "src\bdd\cudd" /I "src\bdd\epd" /I "src\bdd\mtr" /I "src\bdd\parse" /I "src\bdd\dsd" /I "src\bdd\reo" /I "src\sop\mvc" /I "src\sop\ft" /I "src\sat\asat" /I "src\sat\msat" /I "src\sat\fraig" /I "src\opt\cut" /I "src\opt\dec" /I "src\opt\fxu" /I "src\opt\rwr" /I "src\map\fpga" /I "src\map\mapper" /I "src\map\mio" /I "src\map\super" /I "src\misc\extra" /I "src\misc\st" /I "src\misc\util" /I "src\misc\vec" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "__STDC__" /D "HAVE_ASSERT_H" /FR /YX /FD /GZ /c
# SUBTRACT CPP /X
# ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe BSC32=bscmake.exe
...@@ -185,6 +186,10 @@ SOURCE=.\src\base\abc\abcNetlist.c ...@@ -185,6 +186,10 @@ SOURCE=.\src\base\abc\abcNetlist.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\src\base\abc\abcNtbdd.c
# End Source File
# Begin Source File
SOURCE=.\src\base\abc\abcPrint.c SOURCE=.\src\base\abc\abcPrint.c
# End Source File # End Source File
# Begin Source File # Begin Source File
...@@ -1072,10 +1077,6 @@ SOURCE=.\src\sat\csat\csat_apis.h ...@@ -1072,10 +1077,6 @@ SOURCE=.\src\sat\csat\csat_apis.h
# Begin Group "opt" # Begin Group "opt"
# PROP Default_Filter "" # PROP Default_Filter ""
# Begin Group "fxa"
# PROP Default_Filter ""
# End Group
# Begin Group "fxu" # Begin Group "fxu"
# PROP Default_Filter "" # PROP Default_Filter ""
...@@ -1212,6 +1213,14 @@ SOURCE=.\src\opt\cut\cutTable.c ...@@ -1212,6 +1213,14 @@ SOURCE=.\src\opt\cut\cutTable.c
SOURCE=.\src\opt\cut\cutTruth.c SOURCE=.\src\opt\cut\cutTruth.c
# End Source File # End Source File
# End Group # End Group
# Begin Group "dec"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\src\opt\dec\dec.h
# End Source File
# End Group
# End Group # End Group
# Begin Group "map" # Begin Group "map"
......
No preview for this file type
alias b balance alias b balance
alias cl cleanup
alias clp collapse alias clp collapse
alias esd ext_seq_dcs alias esd ext_seq_dcs
alias f fraig alias f fraig
...@@ -14,6 +15,7 @@ alias psu print_supp ...@@ -14,6 +15,7 @@ alias psu print_supp
alias psy print_symm alias psy print_symm
alias q quit alias q quit
alias r read alias r read
alias ren renode
alias rl read_blif alias rl read_blif
alias rb read_bench alias rb read_bench
alias rp read_pla alias rp read_pla
...@@ -27,13 +29,16 @@ alias rfz refactor -z ...@@ -27,13 +29,16 @@ alias rfz refactor -z
alias sa set autoexec ps alias sa set autoexec ps
alias so source -x alias so source -x
alias st strash alias st strash
alias sw sweep
alias u undo alias u undo
alias wb write_blif alias wb write_blif
alias wl write_blif alias wl write_blif
alias wp write_pla alias wp write_pla
alias cnf "st; renode -c; write_cnf" alias cnf "st; renode -c; write_cnf"
alias prove "st; renode -c; sat" alias prove "st; renode -c; sat"
alias opt "b; renode; b" alias opt "b; renode; b"
alias share "b; renode -m; fx; b" alias share "b; renode; fx; b"
alias resyn "b; rw; rf; b; rw; rwz; b; rfz; rwz; b" alias sharem "b; renode -m; fx; b"
alias sharedsd "b; renode; dsd -g; sw; fx; b"
alias resyn "b; rw; rf; b; rw; rwz; b; rfz; rwz; b"
...@@ -415,8 +415,6 @@ extern bool Abc_NtkCheckObj( Abc_Ntk_t * pNtk, Abc_Obj_t * pObj ); ...@@ -415,8 +415,6 @@ extern bool Abc_NtkCheckObj( Abc_Ntk_t * pNtk, Abc_Obj_t * pObj );
extern bool Abc_NtkCompareSignals( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fComb ); extern bool Abc_NtkCompareSignals( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fComb );
/*=== abcCollapse.c ==========================================================*/ /*=== abcCollapse.c ==========================================================*/
extern Abc_Ntk_t * Abc_NtkCollapse( Abc_Ntk_t * pNtk, int fVerbose ); extern Abc_Ntk_t * Abc_NtkCollapse( Abc_Ntk_t * pNtk, int fVerbose );
extern DdManager * Abc_NtkGlobalBdds( Abc_Ntk_t * pNtk, int fLatchOnly );
extern void Abc_NtkFreeGlobalBdds( Abc_Ntk_t * pNtk );
/*=== abcCreate.c ==========================================================*/ /*=== abcCreate.c ==========================================================*/
extern Abc_Ntk_t * Abc_NtkAlloc( Abc_NtkType_t Type, Abc_NtkFunc_t Func ); extern Abc_Ntk_t * Abc_NtkAlloc( Abc_NtkType_t Type, Abc_NtkFunc_t Func );
extern Abc_Ntk_t * Abc_NtkStartFrom( Abc_Ntk_t * pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func ); extern Abc_Ntk_t * Abc_NtkStartFrom( Abc_Ntk_t * pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func );
...@@ -427,6 +425,7 @@ extern void Abc_NtkFinalizeRead( Abc_Ntk_t * pNtk ); ...@@ -427,6 +425,7 @@ extern void Abc_NtkFinalizeRead( Abc_Ntk_t * pNtk );
extern Abc_Ntk_t * Abc_NtkDup( Abc_Ntk_t * pNtk ); extern Abc_Ntk_t * Abc_NtkDup( Abc_Ntk_t * pNtk );
extern Abc_Ntk_t * Abc_NtkSplitOutput( Abc_Ntk_t * pNtk, Abc_Obj_t * pNode, int fUseAllCis ); extern Abc_Ntk_t * Abc_NtkSplitOutput( Abc_Ntk_t * pNtk, Abc_Obj_t * pNode, int fUseAllCis );
extern Abc_Ntk_t * Abc_NtkCreateCone( Abc_Ntk_t * pNtk, Vec_Ptr_t * vRoots, Vec_Int_t * vValues ); extern Abc_Ntk_t * Abc_NtkCreateCone( Abc_Ntk_t * pNtk, Vec_Ptr_t * vRoots, Vec_Int_t * vValues );
extern Abc_Ntk_t * Abc_NtkSplitNode( Abc_Ntk_t * pNtk, Abc_Obj_t * pNode );
extern void Abc_NtkDelete( Abc_Ntk_t * pNtk ); extern void Abc_NtkDelete( Abc_Ntk_t * pNtk );
extern void Abc_NtkFixNonDrivenNets( Abc_Ntk_t * pNtk ); extern void Abc_NtkFixNonDrivenNets( Abc_Ntk_t * pNtk );
extern Abc_Obj_t * Abc_NtkDupObj( Abc_Ntk_t * pNtkNew, Abc_Obj_t * pObj ); extern Abc_Obj_t * Abc_NtkDupObj( Abc_Ntk_t * pNtkNew, Abc_Obj_t * pObj );
...@@ -491,6 +490,8 @@ extern int Abc_NtkUnmap( Abc_Ntk_t * pNtk ); ...@@ -491,6 +490,8 @@ extern int Abc_NtkUnmap( Abc_Ntk_t * pNtk );
/*=== abcMiter.c ==========================================================*/ /*=== abcMiter.c ==========================================================*/
extern int Abc_NtkMinimumBase( Abc_Ntk_t * pNtk ); extern int Abc_NtkMinimumBase( Abc_Ntk_t * pNtk );
extern int Abc_NodeMinimumBase( Abc_Obj_t * pNode ); extern int Abc_NodeMinimumBase( Abc_Obj_t * pNode );
extern int Abc_NtkRemoveDupFanins( Abc_Ntk_t * pNtk );
extern int Abc_NodeRemoveDupFanins( Abc_Obj_t * pNode );
/*=== abcMiter.c ==========================================================*/ /*=== abcMiter.c ==========================================================*/
extern Abc_Ntk_t * Abc_NtkMiter( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fComb ); extern Abc_Ntk_t * Abc_NtkMiter( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fComb );
extern Abc_Ntk_t * Abc_NtkMiterOne( Abc_Ntk_t * pNtk, int Out, int In1, int In2 ); extern Abc_Ntk_t * Abc_NtkMiterOne( Abc_Ntk_t * pNtk, int Out, int In1, int In2 );
...@@ -515,14 +516,19 @@ extern Abc_Ntk_t * Abc_NtkLogicToNetlistBench( Abc_Ntk_t * pNtk ); ...@@ -515,14 +516,19 @@ extern Abc_Ntk_t * Abc_NtkLogicToNetlistBench( Abc_Ntk_t * pNtk );
extern Abc_Ntk_t * Abc_NtkLogicSopToNetlist( Abc_Ntk_t * pNtk ); extern Abc_Ntk_t * Abc_NtkLogicSopToNetlist( Abc_Ntk_t * pNtk );
extern Abc_Ntk_t * Abc_NtkAigToLogicSop( Abc_Ntk_t * pNtk ); extern Abc_Ntk_t * Abc_NtkAigToLogicSop( Abc_Ntk_t * pNtk );
extern Abc_Ntk_t * Abc_NtkAigToLogicSopBench( Abc_Ntk_t * pNtk ); extern Abc_Ntk_t * Abc_NtkAigToLogicSopBench( Abc_Ntk_t * pNtk );
/*=== abcNtbdd.c ==========================================================*/
extern Abc_Ntk_t * Abc_NtkDeriveFromBdd( DdManager * dd, DdNode * bFunc, char * pNamePo, Vec_Ptr_t * vNamesPi );
extern Abc_Ntk_t * Abc_NtkBddToMuxes( Abc_Ntk_t * pNtk );
extern DdManager * Abc_NtkGlobalBdds( Abc_Ntk_t * pNtk, int fLatchOnly );
extern void Abc_NtkFreeGlobalBdds( Abc_Ntk_t * pNtk );
/*=== abcPrint.c ==========================================================*/ /*=== abcPrint.c ==========================================================*/
extern void Abc_NtkPrintStats( FILE * pFile, Abc_Ntk_t * pNtk, int fFactored ); extern void Abc_NtkPrintStats( FILE * pFile, Abc_Ntk_t * pNtk, int fFactored );
extern void Abc_NtkPrintIo( FILE * pFile, Abc_Ntk_t * pNtk ); extern void Abc_NtkPrintIo( FILE * pFile, Abc_Ntk_t * pNtk );
extern void Abc_NtkPrintLatch( FILE * pFile, Abc_Ntk_t * pNtk ); extern void Abc_NtkPrintLatch( FILE * pFile, Abc_Ntk_t * pNtk );
extern void Abc_NtkPrintFanio( FILE * pFile, Abc_Ntk_t * pNtk ); extern void Abc_NtkPrintFanio( FILE * pFile, Abc_Ntk_t * pNtk );
extern void Abc_NodePrintFanio( FILE * pFile, Abc_Obj_t * pNode ); extern void Abc_NodePrintFanio( FILE * pFile, Abc_Obj_t * pNode );
extern void Abc_NtkPrintFactor( FILE * pFile, Abc_Ntk_t * pNtk ); extern void Abc_NtkPrintFactor( FILE * pFile, Abc_Ntk_t * pNtk, int fUseRealNames );
extern void Abc_NodePrintFactor( FILE * pFile, Abc_Obj_t * pNode ); extern void Abc_NodePrintFactor( FILE * pFile, Abc_Obj_t * pNode, int fUseRealNames );
extern void Abc_NtkPrintLevel( FILE * pFile, Abc_Ntk_t * pNtk, int fProfile ); extern void Abc_NtkPrintLevel( FILE * pFile, Abc_Ntk_t * pNtk, int fProfile );
extern void Abc_NodePrintLevel( FILE * pFile, Abc_Obj_t * pNode ); extern void Abc_NodePrintLevel( FILE * pFile, Abc_Obj_t * pNode );
/*=== abcReconv.c ==========================================================*/ /*=== abcReconv.c ==========================================================*/
...@@ -537,6 +543,7 @@ extern DdNode * Abc_NodeConeDcs( DdManager * dd, DdNode ** pbVarsX, Dd ...@@ -537,6 +543,7 @@ extern DdNode * Abc_NodeConeDcs( DdManager * dd, DdNode ** pbVarsX, Dd
extern Vec_Ptr_t * Abc_NodeCollectTfoCands( Abc_ManCut_t * p, Abc_Obj_t * pRoot, Vec_Ptr_t * vFanins, int LevelMax ); extern Vec_Ptr_t * Abc_NodeCollectTfoCands( Abc_ManCut_t * p, Abc_Obj_t * pRoot, Vec_Ptr_t * vFanins, int LevelMax );
/*=== abcRefs.c ==========================================================*/ /*=== abcRefs.c ==========================================================*/
extern int Abc_NodeMffcSize( Abc_Obj_t * pNode ); extern int Abc_NodeMffcSize( Abc_Obj_t * pNode );
extern int Abc_NodeMffcSizeStop( Abc_Obj_t * pNode );
extern int Abc_NodeMffcLabel( Abc_Obj_t * pNode ); extern int Abc_NodeMffcLabel( Abc_Obj_t * pNode );
extern Vec_Ptr_t * Abc_NodeMffcCollect( Abc_Obj_t * pNode ); extern Vec_Ptr_t * Abc_NodeMffcCollect( Abc_Obj_t * pNode );
extern void Abc_NodeUpdate( Abc_Obj_t * pNode, Vec_Ptr_t * vFanins, Vec_Int_t * vForm, int nGain ); extern void Abc_NodeUpdate( Abc_Obj_t * pNode, Vec_Ptr_t * vFanins, Vec_Int_t * vForm, int nGain );
...@@ -593,6 +600,7 @@ extern int Abc_NtkAppend( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2 ); ...@@ -593,6 +600,7 @@ extern int Abc_NtkAppend( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2 );
/*=== abcSweep.c ==========================================================*/ /*=== abcSweep.c ==========================================================*/
extern bool Abc_NtkFraigSweep( Abc_Ntk_t * pNtk, int fUseInv, int fVerbose ); extern bool Abc_NtkFraigSweep( Abc_Ntk_t * pNtk, int fUseInv, int fVerbose );
extern int Abc_NtkCleanup( Abc_Ntk_t * pNtk, int fVerbose ); extern int Abc_NtkCleanup( Abc_Ntk_t * pNtk, int fVerbose );
extern int Abc_NtkSweep( Abc_Ntk_t * pNtk, int fVerbose );
/*=== abcTiming.c ==========================================================*/ /*=== abcTiming.c ==========================================================*/
extern Abc_Time_t * Abc_NodeReadArrival( Abc_Obj_t * pNode ); extern Abc_Time_t * Abc_NodeReadArrival( Abc_Obj_t * pNode );
extern Abc_Time_t * Abc_NodeReadRequired( Abc_Obj_t * pNode ); extern Abc_Time_t * Abc_NodeReadRequired( Abc_Obj_t * pNode );
...@@ -646,7 +654,8 @@ extern void Abc_NodeCollectFanouts( Abc_Obj_t * pNode, Vec_Ptr_t * ...@@ -646,7 +654,8 @@ extern void Abc_NodeCollectFanouts( Abc_Obj_t * pNode, Vec_Ptr_t *
extern int Abc_NodeCompareLevelsIncrease( Abc_Obj_t ** pp1, Abc_Obj_t ** pp2 ); extern int Abc_NodeCompareLevelsIncrease( Abc_Obj_t ** pp1, Abc_Obj_t ** pp2 );
extern int Abc_NodeCompareLevelsDecrease( Abc_Obj_t ** pp1, Abc_Obj_t ** pp2 ); extern int Abc_NodeCompareLevelsDecrease( Abc_Obj_t ** pp1, Abc_Obj_t ** pp2 );
extern Vec_Ptr_t * Abc_NodeGetFaninNames( Abc_Obj_t * pNode ); extern Vec_Ptr_t * Abc_NodeGetFaninNames( Abc_Obj_t * pNode );
extern void Abc_NodeFreeFaninNames( Vec_Ptr_t * vNames ); extern Vec_Ptr_t * Abc_NodeGetFakeNames( int nNames );
extern void Abc_NodeFreeNames( Vec_Ptr_t * vNames );
extern char ** Abc_NtkCollectCioNames( Abc_Ntk_t * pNtk, int fCollectCos ); extern char ** Abc_NtkCollectCioNames( Abc_Ntk_t * pNtk, int fCollectCos );
extern void Abc_NtkAlphaOrderSignals( Abc_Ntk_t * pNtk, int fComb ); extern void Abc_NtkAlphaOrderSignals( Abc_Ntk_t * pNtk, int fComb );
extern void Abc_NtkShortNames( Abc_Ntk_t * pNtk ); extern void Abc_NtkShortNames( Abc_Ntk_t * pNtk );
......
...@@ -367,7 +367,7 @@ bool Abc_NtkCheckObj( Abc_Ntk_t * pNtk, Abc_Obj_t * pObj ) ...@@ -367,7 +367,7 @@ bool Abc_NtkCheckObj( Abc_Ntk_t * pNtk, Abc_Obj_t * pObj )
{ {
Abc_Obj_t * pFanin, * pFanout; Abc_Obj_t * pFanin, * pFanout;
int i, Value = 1; int i, Value = 1;
// int k; int k;
// check the network // check the network
if ( pObj->pNtk != pNtk ) if ( pObj->pNtk != pNtk )
...@@ -401,7 +401,7 @@ bool Abc_NtkCheckObj( Abc_Ntk_t * pNtk, Abc_Obj_t * pObj ) ...@@ -401,7 +401,7 @@ bool Abc_NtkCheckObj( Abc_Ntk_t * pNtk, Abc_Obj_t * pObj )
Value = 0; Value = 0;
} }
} }
/*
// make sure fanins are not duplicated // make sure fanins are not duplicated
for ( i = 0; i < pObj->vFanins.nSize; i++ ) for ( i = 0; i < pObj->vFanins.nSize; i++ )
for ( k = i + 1; k < pObj->vFanins.nSize; k++ ) for ( k = i + 1; k < pObj->vFanins.nSize; k++ )
...@@ -423,7 +423,7 @@ bool Abc_NtkCheckObj( Abc_Ntk_t * pNtk, Abc_Obj_t * pObj ) ...@@ -423,7 +423,7 @@ bool Abc_NtkCheckObj( Abc_Ntk_t * pNtk, Abc_Obj_t * pObj )
printf( "Warning: Node %s has", Abc_ObjName(pObj) ); printf( "Warning: Node %s has", Abc_ObjName(pObj) );
printf( " duplicated fanout %s.\n", Abc_ObjName(Abc_ObjFanout(pObj,k)) ); printf( " duplicated fanout %s.\n", Abc_ObjName(Abc_ObjFanout(pObj,k)) );
} }
*/
return Value; return Value;
} }
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
/// DECLARATIONS /// /// DECLARATIONS ///
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
static DdNode * Abc_NtkGlobalBdds_rec( DdManager * dd, Abc_Obj_t * pNode );
static Abc_Ntk_t * Abc_NtkFromGlobalBdds( Abc_Ntk_t * pNtk ); static Abc_Ntk_t * Abc_NtkFromGlobalBdds( Abc_Ntk_t * pNtk );
static Abc_Obj_t * Abc_NodeFromGlobalBdds( Abc_Ntk_t * pNtkNew, DdManager * dd, DdNode * bFunc ); static Abc_Obj_t * Abc_NodeFromGlobalBdds( Abc_Ntk_t * pNtkNew, DdManager * dd, DdNode * bFunc );
...@@ -83,142 +82,6 @@ Abc_Ntk_t * Abc_NtkCollapse( Abc_Ntk_t * pNtk, int fVerbose ) ...@@ -83,142 +82,6 @@ Abc_Ntk_t * Abc_NtkCollapse( Abc_Ntk_t * pNtk, int fVerbose )
/**Function************************************************************* /**Function*************************************************************
Synopsis [Derives global BDDs for the node function.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
DdManager * Abc_NtkGlobalBdds( Abc_Ntk_t * pNtk, int fLatchOnly )
{
int fReorder = 1;
ProgressBar * pProgress;
Vec_Ptr_t * vFuncsGlob;
Abc_Obj_t * pNode;
DdNode * bFunc;
DdManager * dd;
int i;
// start the manager
assert( pNtk->pManGlob == NULL );
dd = Cudd_Init( Abc_NtkCiNum(pNtk), 0, CUDD_UNIQUE_SLOTS, CUDD_CACHE_SLOTS, 0 );
if ( fReorder )
Cudd_AutodynEnable( dd, CUDD_REORDER_SYMM_SIFT );
// set the elementary variables
Abc_NtkCleanCopy( pNtk );
Abc_NtkForEachCi( pNtk, pNode, i )
pNode->pCopy = (Abc_Obj_t *)dd->vars[i];
// assign the constant node BDD
pNode = Abc_AigConst1( pNtk->pManFunc );
pNode->pCopy = (Abc_Obj_t *)dd->one; Cudd_Ref( dd->one );
vFuncsGlob = Vec_PtrAlloc( 100 );
if ( fLatchOnly )
{
// construct the BDDs
pProgress = Extra_ProgressBarStart( stdout, Abc_NtkLatchNum(pNtk) );
Abc_NtkForEachLatch( pNtk, pNode, i )
{
Extra_ProgressBarUpdate( pProgress, i, NULL );
bFunc = Abc_NtkGlobalBdds_rec( dd, Abc_ObjFanin0(pNode) );
if ( bFunc == NULL )
{
printf( "Constructing global BDDs timed out.\n" );
Extra_ProgressBarStop( pProgress );
Cudd_Quit( dd );
return NULL;
}
bFunc = Cudd_NotCond( bFunc, Abc_ObjFaninC0(pNode) ); Cudd_Ref( bFunc );
Vec_PtrPush( vFuncsGlob, bFunc );
}
Extra_ProgressBarStop( pProgress );
}
else
{
// construct the BDDs
pProgress = Extra_ProgressBarStart( stdout, Abc_NtkCoNum(pNtk) );
Abc_NtkForEachCo( pNtk, pNode, i )
{
Extra_ProgressBarUpdate( pProgress, i, NULL );
bFunc = Abc_NtkGlobalBdds_rec( dd, Abc_ObjFanin0(pNode) );
if ( bFunc == NULL )
{
printf( "Constructing global BDDs timed out.\n" );
Extra_ProgressBarStop( pProgress );
Cudd_Quit( dd );
return NULL;
}
bFunc = Cudd_NotCond( bFunc, Abc_ObjFaninC0(pNode) ); Cudd_Ref( bFunc );
Vec_PtrPush( vFuncsGlob, bFunc );
}
Extra_ProgressBarStop( pProgress );
}
// derefence the intermediate BDDs
Abc_NtkForEachNode( pNtk, pNode, i )
if ( pNode->pCopy )
{
Cudd_RecursiveDeref( dd, (DdNode *)pNode->pCopy );
pNode->pCopy = NULL;
}
// reorder one more time
if ( fReorder )
{
Cudd_ReduceHeap( dd, CUDD_REORDER_SYMM_SIFT, 1 );
Cudd_AutodynDisable( dd );
}
pNtk->pManGlob = dd;
pNtk->vFuncsGlob = vFuncsGlob;
return dd;
}
/**Function*************************************************************
Synopsis [Derives the global BDD of the node.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
DdNode * Abc_NtkGlobalBdds_rec( DdManager * dd, Abc_Obj_t * pNode )
{
DdNode * bFunc, * bFunc0, * bFunc1;
assert( !Abc_ObjIsComplement(pNode) );
if ( Cudd_ReadKeys(dd) > 500000 )
return NULL;
// if the result is available return
if ( pNode->pCopy )
return (DdNode *)pNode->pCopy;
// compute the result for both branches
bFunc0 = Abc_NtkGlobalBdds_rec( dd, Abc_ObjFanin(pNode,0) );
if ( bFunc0 == NULL )
return NULL;
Cudd_Ref( bFunc0 );
bFunc1 = Abc_NtkGlobalBdds_rec( dd, Abc_ObjFanin(pNode,1) );
if ( bFunc1 == NULL )
return NULL;
Cudd_Ref( bFunc1 );
bFunc0 = Cudd_NotCond( bFunc0, Abc_ObjFaninC0(pNode) );
bFunc1 = Cudd_NotCond( bFunc1, Abc_ObjFaninC1(pNode) );
// get the final result
bFunc = Cudd_bddAnd( dd, bFunc0, bFunc1 ); Cudd_Ref( bFunc );
Cudd_RecursiveDeref( dd, bFunc0 );
Cudd_RecursiveDeref( dd, bFunc1 );
// set the result
assert( pNode->pCopy == NULL );
pNode->pCopy = (Abc_Obj_t *)bFunc;
return bFunc;
}
/**Function*************************************************************
Synopsis [Derives the network with the given global BDD.] Synopsis [Derives the network with the given global BDD.]
Description [] Description []
...@@ -276,29 +139,6 @@ Abc_Obj_t * Abc_NodeFromGlobalBdds( Abc_Ntk_t * pNtkNew, DdManager * dd, DdNode ...@@ -276,29 +139,6 @@ Abc_Obj_t * Abc_NodeFromGlobalBdds( Abc_Ntk_t * pNtkNew, DdManager * dd, DdNode
return pNodeNew; return pNodeNew;
} }
/**Function*************************************************************
Synopsis [Dereferences global functions of the network.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Abc_NtkFreeGlobalBdds( Abc_Ntk_t * pNtk )
{
DdNode * bFunc;
int i;
assert( pNtk->pManGlob );
assert( pNtk->vFuncsGlob );
Vec_PtrForEachEntry( pNtk->vFuncsGlob, bFunc, i )
Cudd_RecursiveDeref( pNtk->pManGlob, bFunc );
Vec_PtrFree( pNtk->vFuncsGlob );
pNtk->vFuncsGlob = NULL;
}
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
/// END OF FILE /// /// END OF FILE ///
......
...@@ -406,6 +406,44 @@ Abc_Ntk_t * Abc_NtkCreateCone( Abc_Ntk_t * pNtk, Vec_Ptr_t * vRoots, Vec_Int_t * ...@@ -406,6 +406,44 @@ Abc_Ntk_t * Abc_NtkCreateCone( Abc_Ntk_t * pNtk, Vec_Ptr_t * vRoots, Vec_Int_t *
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
Abc_Ntk_t * Abc_NtkSplitNode( Abc_Ntk_t * pNtk, Abc_Obj_t * pNode )
{
Abc_Ntk_t * pNtkNew;
Abc_Obj_t * pFanin, * pNodePo;
int i;
// start the network
pNtkNew = Abc_NtkAlloc( pNtk->ntkType, pNtk->ntkFunc );
pNtkNew->pName = util_strsav(Abc_ObjName(pNode));
// add the PIs corresponding to the fanins of the node
Abc_ObjForEachFanin( pNode, pFanin, i )
{
pFanin->pCopy = Abc_NtkCreatePi( pNtkNew );
Abc_NtkLogicStoreName( pFanin->pCopy, Abc_ObjName(pFanin) );
}
// duplicate and connect the node
pNode->pCopy = Abc_NtkDupObj( pNtkNew, pNode );
Abc_ObjForEachFanin( pNode, pFanin, i )
Abc_ObjAddFanin( pNode->pCopy, pFanin->pCopy );
// create the only PO
pNodePo = Abc_NtkCreatePo( pNtkNew );
Abc_ObjAddFanin( pNodePo, pNode->pCopy );
Abc_NtkLogicStoreName( pNodePo, Abc_ObjName(pNode) );
if ( !Abc_NtkCheck( pNtkNew ) )
fprintf( stdout, "Abc_NtkSplitNode(): Network check has failed.\n" );
return pNtkNew;
}
/**Function*************************************************************
Synopsis [Deletes the Ntk.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Abc_NtkDelete( Abc_Ntk_t * pNtk ) void Abc_NtkDelete( Abc_Ntk_t * pNtk )
{ {
Abc_Obj_t * pObj; Abc_Obj_t * pObj;
...@@ -758,6 +796,8 @@ void Abc_NtkDeleteObj( Abc_Obj_t * pObj ) ...@@ -758,6 +796,8 @@ void Abc_NtkDeleteObj( Abc_Obj_t * pObj )
} }
else if ( Abc_ObjIsNode(pObj) ) else if ( Abc_ObjIsNode(pObj) )
{ {
if ( Abc_NtkHasBdd(pNtk) )
Cudd_RecursiveDeref( pNtk->pManFunc, pObj->pData );
pNtk->nNodes--; pNtk->nNodes--;
} }
else if ( Abc_ObjIsLatch(pObj) ) else if ( Abc_ObjIsLatch(pObj) )
......
...@@ -30,7 +30,7 @@ static void Abc_NtkDsdConstruct( Dsd_Manager_t * pManDsd, Abc_Ntk_t * ...@@ -30,7 +30,7 @@ static void Abc_NtkDsdConstruct( Dsd_Manager_t * pManDsd, Abc_Ntk_t *
static Abc_Obj_t * Abc_NtkDsdConstructNode( Dsd_Manager_t * pManDsd, Dsd_Node_t * pNodeDsd, Abc_Ntk_t * pNtkNew ); static Abc_Obj_t * Abc_NtkDsdConstructNode( Dsd_Manager_t * pManDsd, Dsd_Node_t * pNodeDsd, Abc_Ntk_t * pNtkNew );
static Vec_Ptr_t * Abc_NtkCollectNodesForDsd( Abc_Ntk_t * pNtk ); static Vec_Ptr_t * Abc_NtkCollectNodesForDsd( Abc_Ntk_t * pNtk );
static void Abc_NodeDecompDsdAndMux( Abc_Obj_t * pNode, Vec_Ptr_t * vNodes, Dsd_Manager_t * pManDsd ); static void Abc_NodeDecompDsdAndMux( Abc_Obj_t * pNode, Vec_Ptr_t * vNodes, Dsd_Manager_t * pManDsd, bool fRecursive );
static bool Abc_NodeIsForDsd( Abc_Obj_t * pNode ); static bool Abc_NodeIsForDsd( Abc_Obj_t * pNode );
static int Abc_NodeFindMuxVar( DdManager * dd, DdNode * bFunc, int nVars ); static int Abc_NodeFindMuxVar( DdManager * dd, DdNode * bFunc, int nVars );
...@@ -192,6 +192,8 @@ void Abc_NtkDsdConstruct( Dsd_Manager_t * pManDsd, Abc_Ntk_t * pNtk, Abc_Ntk_t * ...@@ -192,6 +192,8 @@ void Abc_NtkDsdConstruct( Dsd_Manager_t * pManDsd, Abc_Ntk_t * pNtk, Abc_Ntk_t *
pDriver = Abc_ObjFanin0( pNode ); pDriver = Abc_ObjFanin0( pNode );
if ( !Abc_ObjIsNode(pDriver) ) if ( !Abc_ObjIsNode(pDriver) )
continue; continue;
if ( !Abc_NodeIsAigAnd(pDriver) )
continue;
pNodeDsd = Dsd_ManagerReadRoot( pManDsd, i ); pNodeDsd = Dsd_ManagerReadRoot( pManDsd, i );
pNodeNew = (Abc_Obj_t *)Dsd_NodeReadMark( Dsd_Regular(pNodeDsd) ); pNodeNew = (Abc_Obj_t *)Dsd_NodeReadMark( Dsd_Regular(pNodeDsd) );
assert( !Abc_ObjIsComplement(pNodeNew) ); assert( !Abc_ObjIsComplement(pNodeNew) );
...@@ -300,7 +302,7 @@ Abc_Obj_t * Abc_NtkDsdConstructNode( Dsd_Manager_t * pManDsd, Dsd_Node_t * pNode ...@@ -300,7 +302,7 @@ Abc_Obj_t * Abc_NtkDsdConstructNode( Dsd_Manager_t * pManDsd, Dsd_Node_t * pNode
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
int Abc_NtkDsdRecursive( Abc_Ntk_t * pNtk, bool fVerbose ) int Abc_NtkDsdLocal( Abc_Ntk_t * pNtk, bool fVerbose, bool fRecursive )
{ {
int fCheck = 1; int fCheck = 1;
Dsd_Manager_t * pManDsd; Dsd_Manager_t * pManDsd;
...@@ -319,7 +321,7 @@ int Abc_NtkDsdRecursive( Abc_Ntk_t * pNtk, bool fVerbose ) ...@@ -319,7 +321,7 @@ int Abc_NtkDsdRecursive( Abc_Ntk_t * pNtk, bool fVerbose )
// collect nodes for decomposition // collect nodes for decomposition
vNodes = Abc_NtkCollectNodesForDsd( pNtk ); vNodes = Abc_NtkCollectNodesForDsd( pNtk );
for ( i = 0; i < vNodes->nSize; i++ ) for ( i = 0; i < vNodes->nSize; i++ )
Abc_NodeDecompDsdAndMux( vNodes->pArray[i], vNodes, pManDsd ); Abc_NodeDecompDsdAndMux( vNodes->pArray[i], vNodes, pManDsd, fRecursive );
Vec_PtrFree( vNodes ); Vec_PtrFree( vNodes );
// stop the DSD manager // stop the DSD manager
...@@ -371,7 +373,7 @@ Vec_Ptr_t * Abc_NtkCollectNodesForDsd( Abc_Ntk_t * pNtk ) ...@@ -371,7 +373,7 @@ Vec_Ptr_t * Abc_NtkCollectNodesForDsd( Abc_Ntk_t * pNtk )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
void Abc_NodeDecompDsdAndMux( Abc_Obj_t * pNode, Vec_Ptr_t * vNodes, Dsd_Manager_t * pManDsd ) void Abc_NodeDecompDsdAndMux( Abc_Obj_t * pNode, Vec_Ptr_t * vNodes, Dsd_Manager_t * pManDsd, bool fRecursive )
{ {
DdManager * dd = pNode->pNtk->pManFunc; DdManager * dd = pNode->pNtk->pManFunc;
Abc_Obj_t * pRoot, * pFanin, * pNode1, * pNode2, * pNodeC; Abc_Obj_t * pRoot, * pFanin, * pNode1, * pNode2, * pNodeC;
...@@ -384,7 +386,7 @@ void Abc_NodeDecompDsdAndMux( Abc_Obj_t * pNode, Vec_Ptr_t * vNodes, Dsd_Manager ...@@ -384,7 +386,7 @@ void Abc_NodeDecompDsdAndMux( Abc_Obj_t * pNode, Vec_Ptr_t * vNodes, Dsd_Manager
pNodeDsd = Dsd_Regular( pNodeDsd ); pNodeDsd = Dsd_Regular( pNodeDsd );
// determine what decomposition to use // determine what decomposition to use
if ( Dsd_NodeReadDecsNum(pNodeDsd) != Abc_ObjFaninNum(pNode) ) if ( !fRecursive || Dsd_NodeReadDecsNum(pNodeDsd) != Abc_ObjFaninNum(pNode) )
{ // perform DSD { // perform DSD
// set the inputs // set the inputs
...@@ -399,7 +401,7 @@ void Abc_NodeDecompDsdAndMux( Abc_Obj_t * pNode, Vec_Ptr_t * vNodes, Dsd_Manager ...@@ -399,7 +401,7 @@ void Abc_NodeDecompDsdAndMux( Abc_Obj_t * pNode, Vec_Ptr_t * vNodes, Dsd_Manager
for ( i = 0; i < nNodesDsd; i++ ) for ( i = 0; i < nNodesDsd; i++ )
{ {
pRoot = Abc_NtkDsdConstructNode( pManDsd, ppNodesDsd[i], pNode->pNtk ); pRoot = Abc_NtkDsdConstructNode( pManDsd, ppNodesDsd[i], pNode->pNtk );
if ( Abc_NodeIsForDsd(pRoot) ) if ( Abc_NodeIsForDsd(pRoot) && fRecursive )
Vec_PtrPush( vNodes, pRoot ); Vec_PtrPush( vNodes, pRoot );
} }
free( ppNodesDsd ); free( ppNodesDsd );
...@@ -457,9 +459,24 @@ void Abc_NodeDecompDsdAndMux( Abc_Obj_t * pNode, Vec_Ptr_t * vNodes, Dsd_Manager ...@@ -457,9 +459,24 @@ void Abc_NodeDecompDsdAndMux( Abc_Obj_t * pNode, Vec_Ptr_t * vNodes, Dsd_Manager
***********************************************************************/ ***********************************************************************/
bool Abc_NodeIsForDsd( Abc_Obj_t * pNode ) bool Abc_NodeIsForDsd( Abc_Obj_t * pNode )
{ {
DdManager * dd = pNode->pNtk->pManFunc;
DdNode * bFunc, * bFunc0, * bFunc1;
assert( Abc_ObjIsNode(pNode) ); assert( Abc_ObjIsNode(pNode) );
if ( Cudd_DagSize(pNode->pData)-1 > Abc_ObjFaninNum(pNode) ) // if ( Cudd_DagSize(pNode->pData)-1 > Abc_ObjFaninNum(pNode) )
return 1; // return 1;
// return 0;
for ( bFunc = Cudd_Regular(pNode->pData); !cuddIsConstant(bFunc); )
{
bFunc0 = Cudd_Regular( cuddE(bFunc) );
bFunc1 = cuddT(bFunc);
if ( bFunc0 == b1 )
bFunc = bFunc1;
else if ( bFunc1 == b1 || bFunc0 == bFunc1 )
bFunc = bFunc0;
else
return 1;
}
return 0; return 0;
} }
...@@ -514,6 +531,7 @@ int Abc_NodeFindMuxVar( DdManager * dd, DdNode * bFunc, int nVars ) ...@@ -514,6 +531,7 @@ int Abc_NodeFindMuxVar( DdManager * dd, DdNode * bFunc, int nVars )
return iVar; return iVar;
} }
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
/// END OF FILE /// /// END OF FILE ///
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
......
...@@ -93,6 +93,71 @@ int Abc_NodeMinimumBase( Abc_Obj_t * pNode ) ...@@ -93,6 +93,71 @@ int Abc_NodeMinimumBase( Abc_Obj_t * pNode )
/**Function************************************************************* /**Function*************************************************************
Synopsis [Makes nodes of the network fanin-dup-free.]
Description [Returns the number of pairs of duplicated fanins.]
SideEffects []
SeeAlso []
***********************************************************************/
int Abc_NtkRemoveDupFanins( Abc_Ntk_t * pNtk )
{
Abc_Obj_t * pNode;
int i, Counter, fChanged;
assert( Abc_NtkIsBddLogic(pNtk) );
Counter = 0;
Abc_NtkForEachNode( pNtk, pNode, i )
while ( fChanged = Abc_NodeRemoveDupFanins(pNode) )
Counter += fChanged;
return Counter;
}
/**Function*************************************************************
Synopsis [Removes one pair of duplicated fanins if present.]
Description [Returns 1 if the node is changed.]
SideEffects []
SeeAlso []
***********************************************************************/
int Abc_NodeRemoveDupFanins( Abc_Obj_t * pNode )
{
Abc_Obj_t * pFanin1, * pFanin2;
int i, k;
assert( Abc_NtkIsBddLogic(pNode->pNtk) );
assert( Abc_ObjIsNode(pNode) );
// make sure fanins are not duplicated
Abc_ObjForEachFanin( pNode, pFanin2, i )
{
Abc_ObjForEachFanin( pNode, pFanin1, k )
{
if ( k >= i )
break;
if ( pFanin1 == pFanin2 )
{
DdManager * dd = pNode->pNtk->pManFunc;
DdNode * bVar1 = Cudd_bddIthVar( dd, i );
DdNode * bVar2 = Cudd_bddIthVar( dd, k );
DdNode * bTrans, * bTemp;
bTrans = Cudd_bddXnor( dd, bVar1, bVar2 ); Cudd_Ref( bTrans );
pNode->pData = Cudd_bddAndAbstract( dd, bTemp = pNode->pData, bTrans, bVar2 ); Cudd_Ref( pNode->pData );
Cudd_RecursiveDeref( dd, bTemp );
Cudd_RecursiveDeref( dd, bTrans );
Abc_NodeMinimumBase( pNode );
return 1;
}
}
}
return 0;
}
/**Function*************************************************************
Synopsis [Computes support of the node.] Synopsis [Computes support of the node.]
Description [] Description []
......
...@@ -310,13 +310,13 @@ void Abc_NodePrintFanio( FILE * pFile, Abc_Obj_t * pNode ) ...@@ -310,13 +310,13 @@ void Abc_NodePrintFanio( FILE * pFile, Abc_Obj_t * pNode )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
void Abc_NtkPrintFactor( FILE * pFile, Abc_Ntk_t * pNtk ) void Abc_NtkPrintFactor( FILE * pFile, Abc_Ntk_t * pNtk, int fUseRealNames )
{ {
Abc_Obj_t * pNode; Abc_Obj_t * pNode;
int i; int i;
assert( Abc_NtkIsSopLogic(pNtk) ); assert( Abc_NtkIsSopLogic(pNtk) );
Abc_NtkForEachNode( pNtk, pNode, i ) Abc_NtkForEachNode( pNtk, pNode, i )
Abc_NodePrintFactor( pFile, pNode ); Abc_NodePrintFactor( pFile, pNode, fUseRealNames );
} }
/**Function************************************************************* /**Function*************************************************************
...@@ -330,9 +330,10 @@ void Abc_NtkPrintFactor( FILE * pFile, Abc_Ntk_t * pNtk ) ...@@ -330,9 +330,10 @@ void Abc_NtkPrintFactor( FILE * pFile, Abc_Ntk_t * pNtk )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
void Abc_NodePrintFactor( FILE * pFile, Abc_Obj_t * pNode ) void Abc_NodePrintFactor( FILE * pFile, Abc_Obj_t * pNode, int fUseRealNames )
{ {
Vec_Int_t * vFactor; Vec_Int_t * vFactor;
Vec_Ptr_t * vNamesIn;
if ( Abc_ObjIsCo(pNode) ) if ( Abc_ObjIsCo(pNode) )
pNode = Abc_ObjFanin0(pNode); pNode = Abc_ObjFanin0(pNode);
if ( Abc_ObjIsPi(pNode) ) if ( Abc_ObjIsPi(pNode) )
...@@ -347,7 +348,14 @@ void Abc_NodePrintFactor( FILE * pFile, Abc_Obj_t * pNode ) ...@@ -347,7 +348,14 @@ void Abc_NodePrintFactor( FILE * pFile, Abc_Obj_t * pNode )
} }
assert( Abc_ObjIsNode(pNode) ); assert( Abc_ObjIsNode(pNode) );
vFactor = Ft_Factor( pNode->pData ); vFactor = Ft_Factor( pNode->pData );
Ft_FactorPrint( stdout, vFactor, NULL, Abc_ObjName(pNode) ); if ( fUseRealNames )
{
vNamesIn = Abc_NodeGetFaninNames(pNode);
Ft_FactorPrint( stdout, vFactor, (char **)vNamesIn->pArray, Abc_ObjName(pNode) );
Abc_NodeFreeNames( vNamesIn );
}
else
Ft_FactorPrint( stdout, vFactor, (char **)NULL, Abc_ObjName(pNode) );
Vec_IntFree( vFactor ); Vec_IntFree( vFactor );
} }
......
...@@ -95,6 +95,8 @@ int Abc_NtkRefactor( Abc_Ntk_t * pNtk, int nNodeSizeMax, int nConeSizeMax, bool ...@@ -95,6 +95,8 @@ int Abc_NtkRefactor( Abc_Ntk_t * pNtk, int nNodeSizeMax, int nConeSizeMax, bool
int clk, clkStart = clock(); int clk, clkStart = clock();
assert( Abc_NtkIsStrash(pNtk) ); assert( Abc_NtkIsStrash(pNtk) );
// cleanup the AIG
Abc_AigCleanup(pNtk->pManFunc);
// start the managers // start the managers
pManCut = Abc_NtkManCutStart( nNodeSizeMax, nConeSizeMax, 2, 1000 ); pManCut = Abc_NtkManCutStart( nNodeSizeMax, nConeSizeMax, 2, 1000 );
pManRef = Abc_NtkManRefStart( nNodeSizeMax, nConeSizeMax, fUseDcs, fVerbose ); pManRef = Abc_NtkManRefStart( nNodeSizeMax, nConeSizeMax, fUseDcs, fVerbose );
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
PackageName [Network and node package.] PackageName [Network and node package.]
Synopsis [Reference counting of the nodes.] Synopsis [Procedures using reference counting of the AIG nodes.]
Author [Alan Mishchenko] Author [Alan Mishchenko]
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
static int Abc_NodeRefDeref( Abc_Obj_t * pNode, bool fReference, bool fLabel, Vec_Ptr_t * vNodes ); static int Abc_NodeRefDeref( Abc_Obj_t * pNode, bool fReference, bool fLabel, Vec_Ptr_t * vNodes );
static int Abc_NodeRefDerefStop( Abc_Obj_t * pNode, bool fReference );
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFITIONS /// /// FUNCTION DEFITIONS ///
...@@ -32,7 +33,7 @@ static int Abc_NodeRefDeref( Abc_Obj_t * pNode, bool fReference, bool fLabel, Ve ...@@ -32,7 +33,7 @@ static int Abc_NodeRefDeref( Abc_Obj_t * pNode, bool fReference, bool fLabel, Ve
/**Function************************************************************* /**Function*************************************************************
Synopsis [Procedure returns the size of the MFFC of the node.] Synopsis [Returns the MFFC size.]
Description [] Description []
...@@ -57,6 +58,31 @@ int Abc_NodeMffcSize( Abc_Obj_t * pNode ) ...@@ -57,6 +58,31 @@ int Abc_NodeMffcSize( Abc_Obj_t * pNode )
/**Function************************************************************* /**Function*************************************************************
Synopsis [Returns the MFFC size while stopping at the complemented edges.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int Abc_NodeMffcSizeStop( Abc_Obj_t * pNode )
{
int nConeSize1, nConeSize2;
assert( !Abc_ObjIsComplement( pNode ) );
assert( Abc_ObjIsNode( pNode ) );
if ( Abc_ObjFaninNum(pNode) == 0 )
return 0;
nConeSize1 = Abc_NodeRefDerefStop( pNode, 0 ); // dereference
nConeSize2 = Abc_NodeRefDerefStop( pNode, 1 ); // reference
assert( nConeSize1 == nConeSize2 );
assert( nConeSize1 > 0 );
return nConeSize1;
}
/**Function*************************************************************
Synopsis [Labels MFFC with the current traversal ID.] Synopsis [Labels MFFC with the current traversal ID.]
Description [] Description []
...@@ -132,8 +158,8 @@ int Abc_NodeRefDeref( Abc_Obj_t * pNode, bool fReference, bool fLabel, Vec_Ptr_t ...@@ -132,8 +158,8 @@ int Abc_NodeRefDeref( Abc_Obj_t * pNode, bool fReference, bool fLabel, Vec_Ptr_t
if ( Abc_ObjIsCi(pNode) ) if ( Abc_ObjIsCi(pNode) )
return 0; return 0;
// process the internal node // process the internal node
pNode0 = Abc_ObjFanin( pNode, 0 ); pNode0 = Abc_ObjFanin0(pNode);
pNode1 = Abc_ObjFanin( pNode, 1 ); pNode1 = Abc_ObjFanin1(pNode);
Counter = 1; Counter = 1;
if ( fReference ) if ( fReference )
{ {
...@@ -156,6 +182,47 @@ int Abc_NodeRefDeref( Abc_Obj_t * pNode, bool fReference, bool fLabel, Vec_Ptr_t ...@@ -156,6 +182,47 @@ int Abc_NodeRefDeref( Abc_Obj_t * pNode, bool fReference, bool fLabel, Vec_Ptr_t
/**Function************************************************************* /**Function*************************************************************
Synopsis [References/references the node and returns MFFC size.]
Description [Stops at the complemented edges.]
SideEffects []
SeeAlso []
***********************************************************************/
int Abc_NodeRefDerefStop( Abc_Obj_t * pNode, bool fReference )
{
Abc_Obj_t * pNode0, * pNode1;
int Counter;
// skip the CI
if ( Abc_ObjIsCi(pNode) )
return 0;
// process the internal node
pNode0 = Abc_ObjFanin0(pNode);
pNode1 = Abc_ObjFanin1(pNode);
Counter = 1;
if ( fReference )
{
if ( pNode0->vFanouts.nSize++ == 0 && !Abc_ObjFaninC0(pNode) )
Counter += Abc_NodeRefDerefStop( pNode0, fReference );
if ( pNode1->vFanouts.nSize++ == 0 && !Abc_ObjFaninC1(pNode) )
Counter += Abc_NodeRefDerefStop( pNode1, fReference );
}
else
{
assert( pNode0->vFanouts.nSize > 0 );
assert( pNode1->vFanouts.nSize > 0 );
if ( --pNode0->vFanouts.nSize == 0 && !Abc_ObjFaninC0(pNode) )
Counter += Abc_NodeRefDerefStop( pNode0, fReference );
if ( --pNode1->vFanouts.nSize == 0 && !Abc_ObjFaninC1(pNode) )
Counter += Abc_NodeRefDerefStop( pNode1, fReference );
}
return Counter;
}
/**Function*************************************************************
Synopsis [Replaces MFFC of the node by the new factored form.] Synopsis [Replaces MFFC of the node by the new factored form.]
Description [] Description []
......
...@@ -31,7 +31,7 @@ static DdNode * Abc_NtkRenodeDeriveBdd_rec( DdManager * dd, Abc_Obj_t * pNode ...@@ -31,7 +31,7 @@ static DdNode * Abc_NtkRenodeDeriveBdd_rec( DdManager * dd, Abc_Obj_t * pNode
static void Abc_NtkRenodeSetBounds( Abc_Ntk_t * pNtk, int nThresh, int nFaninMax ); static void Abc_NtkRenodeSetBounds( Abc_Ntk_t * pNtk, int nThresh, int nFaninMax );
static void Abc_NtkRenodeSetBoundsCnf( Abc_Ntk_t * pNtk ); static void Abc_NtkRenodeSetBoundsCnf( Abc_Ntk_t * pNtk );
static void Abc_NtkRenodeSetBoundsMulti( Abc_Ntk_t * pNtk ); static void Abc_NtkRenodeSetBoundsMulti( Abc_Ntk_t * pNtk, int nThresh );
static void Abc_NtkRenodeSetBoundsSimple( Abc_Ntk_t * pNtk ); static void Abc_NtkRenodeSetBoundsSimple( Abc_Ntk_t * pNtk );
static void Abc_NtkRenodeCone( Abc_Obj_t * pNode, Vec_Ptr_t * vCone ); static void Abc_NtkRenodeCone( Abc_Obj_t * pNode, Vec_Ptr_t * vCone );
...@@ -67,7 +67,7 @@ Abc_Ntk_t * Abc_NtkRenode( Abc_Ntk_t * pNtk, int nThresh, int nFaninMax, int fCn ...@@ -67,7 +67,7 @@ Abc_Ntk_t * Abc_NtkRenode( Abc_Ntk_t * pNtk, int nThresh, int nFaninMax, int fCn
if ( fCnf ) if ( fCnf )
Abc_NtkRenodeSetBoundsCnf( pNtk ); Abc_NtkRenodeSetBoundsCnf( pNtk );
else if ( fMulti ) else if ( fMulti )
Abc_NtkRenodeSetBoundsMulti( pNtk ); Abc_NtkRenodeSetBoundsMulti( pNtk, nThresh );
else if ( fSimple ) else if ( fSimple )
Abc_NtkRenodeSetBoundsSimple( pNtk ); Abc_NtkRenodeSetBoundsSimple( pNtk );
else else
...@@ -393,9 +393,7 @@ void Abc_NtkRenodeSetBounds( Abc_Ntk_t * pNtk, int nThresh, int nFaninMax ) ...@@ -393,9 +393,7 @@ void Abc_NtkRenodeSetBounds( Abc_Ntk_t * pNtk, int nThresh, int nFaninMax )
} }
// mark the PO drivers // mark the PO drivers
Abc_NtkForEachPo( pNtk, pNode, i ) Abc_NtkForEachCo( pNtk, pNode, i )
Abc_ObjFanin0(pNode)->fMarkA = 1;
Abc_NtkForEachLatch( pNtk, pNode, i )
Abc_ObjFanin0(pNode)->fMarkA = 1; Abc_ObjFanin0(pNode)->fMarkA = 1;
// make sure the fanin limit is met // make sure the fanin limit is met
...@@ -474,9 +472,7 @@ void Abc_NtkRenodeSetBoundsCnf( Abc_Ntk_t * pNtk ) ...@@ -474,9 +472,7 @@ void Abc_NtkRenodeSetBoundsCnf( Abc_Ntk_t * pNtk )
} }
// mark the PO drivers // mark the PO drivers
Abc_NtkForEachPo( pNtk, pNode, i ) Abc_NtkForEachCo( pNtk, pNode, i )
Abc_ObjFanin0(pNode)->fMarkA = 1;
Abc_NtkForEachLatch( pNtk, pNode, i )
Abc_ObjFanin0(pNode)->fMarkA = 1; Abc_ObjFanin0(pNode)->fMarkA = 1;
// count the number of MUXes // count the number of MUXes
...@@ -505,10 +501,10 @@ void Abc_NtkRenodeSetBoundsCnf( Abc_Ntk_t * pNtk ) ...@@ -505,10 +501,10 @@ void Abc_NtkRenodeSetBoundsCnf( Abc_Ntk_t * pNtk )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
void Abc_NtkRenodeSetBoundsMulti( Abc_Ntk_t * pNtk ) void Abc_NtkRenodeSetBoundsMulti( Abc_Ntk_t * pNtk, int nThresh )
{ {
Abc_Obj_t * pNode; Abc_Obj_t * pNode;
int i; int i, nFanouts, nConeSize;
// make sure the mark is not set // make sure the mark is not set
Abc_NtkForEachObj( pNtk, pNode, i ) Abc_NtkForEachObj( pNtk, pNode, i )
...@@ -521,7 +517,12 @@ void Abc_NtkRenodeSetBoundsMulti( Abc_Ntk_t * pNtk ) ...@@ -521,7 +517,12 @@ void Abc_NtkRenodeSetBoundsMulti( Abc_Ntk_t * pNtk )
if ( Abc_NodeIsConst(pNode) ) if ( Abc_NodeIsConst(pNode) )
continue; continue;
// mark the nodes with multiple fanouts // mark the nodes with multiple fanouts
if ( Abc_ObjFanoutNum(pNode) > 1 ) // if ( Abc_ObjFanoutNum(pNode) > 1 )
// pNode->fMarkA = 1;
// mark the nodes with multiple fanouts
nFanouts = Abc_ObjFanoutNum(pNode);
nConeSize = Abc_NodeMffcSizeStop(pNode);
if ( (nFanouts - 1) * nConeSize > nThresh )
pNode->fMarkA = 1; pNode->fMarkA = 1;
// mark the children if they are pointed by the complemented edges // mark the children if they are pointed by the complemented edges
if ( Abc_ObjFaninC0(pNode) ) if ( Abc_ObjFaninC0(pNode) )
...@@ -531,9 +532,7 @@ void Abc_NtkRenodeSetBoundsMulti( Abc_Ntk_t * pNtk ) ...@@ -531,9 +532,7 @@ void Abc_NtkRenodeSetBoundsMulti( Abc_Ntk_t * pNtk )
} }
// mark the PO drivers // mark the PO drivers
Abc_NtkForEachPo( pNtk, pNode, i ) Abc_NtkForEachCo( pNtk, pNode, i )
Abc_ObjFanin0(pNode)->fMarkA = 1;
Abc_NtkForEachLatch( pNtk, pNode, i )
Abc_ObjFanin0(pNode)->fMarkA = 1; Abc_ObjFanin0(pNode)->fMarkA = 1;
} }
......
...@@ -56,6 +56,8 @@ int Abc_NtkRewrite( Abc_Ntk_t * pNtk, int fUseZeros, int fVerbose ) ...@@ -56,6 +56,8 @@ int Abc_NtkRewrite( Abc_Ntk_t * pNtk, int fUseZeros, int fVerbose )
int clk, clkStart = clock(); int clk, clkStart = clock();
assert( Abc_NtkIsStrash(pNtk) ); assert( Abc_NtkIsStrash(pNtk) );
// cleanup the AIG
Abc_AigCleanup(pNtk->pManFunc);
// start the rewriting manager // start the rewriting manager
pManRwr = Rwr_ManStart( 0 ); pManRwr = Rwr_ManStart( 0 );
if ( pManRwr == NULL ) if ( pManRwr == NULL )
......
...@@ -68,7 +68,7 @@ void Abc_NodeShowBdd( Abc_Obj_t * pNode ) ...@@ -68,7 +68,7 @@ void Abc_NodeShowBdd( Abc_Obj_t * pNode )
vNamesIn = Abc_NodeGetFaninNames( pNode ); vNamesIn = Abc_NodeGetFaninNames( pNode );
pNameOut = Abc_ObjName(pNode); pNameOut = Abc_ObjName(pNode);
Cudd_DumpDot( pNode->pNtk->pManFunc, 1, (DdNode **)&pNode->pData, (char **)vNamesIn->pArray, &pNameOut, pFile ); Cudd_DumpDot( pNode->pNtk->pManFunc, 1, (DdNode **)&pNode->pData, (char **)vNamesIn->pArray, &pNameOut, pFile );
Abc_NodeFreeFaninNames( vNamesIn ); Abc_NodeFreeNames( vNamesIn );
Abc_NtkCleanCopy( pNode->pNtk ); Abc_NtkCleanCopy( pNode->pNtk );
fclose( pFile ); fclose( pFile );
......
...@@ -25,13 +25,17 @@ ...@@ -25,13 +25,17 @@
/// DECLARATIONS /// /// DECLARATIONS ///
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
extern Fraig_Man_t * Abc_NtkToFraig( Abc_Ntk_t * pNtk, Fraig_Params_t * pParams, int fAllNodes );
static stmm_table * Abc_NtkFraigEquiv( Fraig_Man_t * p, Abc_Ntk_t * pNtk, int fUseInv, bool fVerbose ); static stmm_table * Abc_NtkFraigEquiv( Fraig_Man_t * p, Abc_Ntk_t * pNtk, int fUseInv, bool fVerbose );
static void Abc_NtkFraigTransform( Abc_Ntk_t * pNtk, stmm_table * tEquiv, int fUseInv, bool fVerbose ); static void Abc_NtkFraigTransform( Abc_Ntk_t * pNtk, stmm_table * tEquiv, int fUseInv, bool fVerbose );
static void Abc_NtkFraigMergeClassMapped( Abc_Ntk_t * pNtk, Abc_Obj_t * pChain, int fVerbose, int fUseInv ); static void Abc_NtkFraigMergeClassMapped( Abc_Ntk_t * pNtk, Abc_Obj_t * pChain, int fVerbose, int fUseInv );
static void Abc_NtkFraigMergeClass( Abc_Ntk_t * pNtk, Abc_Obj_t * pChain, int fVerbose, int fUseInv ); static void Abc_NtkFraigMergeClass( Abc_Ntk_t * pNtk, Abc_Obj_t * pChain, int fVerbose, int fUseInv );
static int Abc_NodeDroppingCost( Abc_Obj_t * pNode ); static int Abc_NodeDroppingCost( Abc_Obj_t * pNode );
extern Fraig_Man_t * Abc_NtkToFraig( Abc_Ntk_t * pNtk, Fraig_Params_t * pParams, int fAllNodes ); static void Abc_NodeSweep( Abc_Obj_t * pNode, int fVerbose );
static void Abc_NodeConstantInput( Abc_Obj_t * pNode, Abc_Obj_t * pFanin, bool fConst0 );
static void Abc_NodeComplementInput( Abc_Obj_t * pNode, Abc_Obj_t * pFanin );
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFITIONS /// /// FUNCTION DEFITIONS ///
...@@ -427,6 +431,175 @@ int Abc_NtkCleanup( Abc_Ntk_t * pNtk, int fVerbose ) ...@@ -427,6 +431,175 @@ int Abc_NtkCleanup( Abc_Ntk_t * pNtk, int fVerbose )
return Counter; return Counter;
} }
/**Function*************************************************************
Synopsis [Tranditional sweep of the network.]
Description [Propagates constant and single-input node, removes dangling nodes.]
SideEffects []
SeeAlso []
***********************************************************************/
int Abc_NtkSweep( Abc_Ntk_t * pNtk, int fVerbose )
{
int fCheck = 1;
Abc_Obj_t * pNode;
int i, fConvert, nSwept, nSweptNew;
assert( Abc_NtkIsSopLogic(pNtk) || Abc_NtkIsBddLogic(pNtk) );
// convert to the BDD representation
fConvert = 0;
if ( Abc_NtkIsSopLogic(pNtk) )
Abc_NtkSopToBdd(pNtk), fConvert = 1;
// perform cleanup to get rid of dangling nodes
nSwept = Abc_NtkCleanup( pNtk, 0 );
// make the network minimum base
Abc_NtkRemoveDupFanins(pNtk);
Abc_NtkMinimumBase(pNtk);
do
{
// sweep constants and single-input nodes
Abc_NtkForEachNode( pNtk, pNode, i )
if ( Abc_ObjFaninNum(pNode) < 2 )
Abc_NodeSweep( pNode, fVerbose );
// make the network minimum base
Abc_NtkRemoveDupFanins(pNtk);
Abc_NtkMinimumBase(pNtk);
// perform final clean up (in case new danglies are created)
nSweptNew = Abc_NtkCleanup( pNtk, 0 );
nSwept += nSweptNew;
}
while ( nSweptNew );
// conver back to BDD
if ( fConvert )
Abc_NtkBddToSop(pNtk);
// report
if ( fVerbose )
printf( "Sweep removed %d nodes.\n", nSwept );
// check
if ( fCheck && !Abc_NtkCheck( pNtk ) )
{
printf( "Abc_NtkSweep: The network check has failed.\n" );
return -1;
}
return nSwept;
}
/**Function*************************************************************
Synopsis [Tranditional sweep of the network.]
Description [Propagates constant and single-input node, removes dangling nodes.]
SideEffects []
SeeAlso []
***********************************************************************/
void Abc_NodeSweep( Abc_Obj_t * pNode, int fVerbose )
{
Vec_Ptr_t * vFanout = pNode->pNtk->vPtrTemp;
Abc_Obj_t * pFanout, * pDriver;
int i;
assert( Abc_ObjFaninNum(pNode) < 2 );
assert( Abc_ObjFanoutNum(pNode) > 0 );
// iterate through the fanouts
Abc_NodeCollectFanouts( pNode, vFanout );
Vec_PtrForEachEntry( vFanout, pFanout, i )
{
if ( Abc_ObjIsCo(pFanout) )
{
if ( Abc_ObjFaninNum(pNode) == 1 )
{
pDriver = Abc_ObjFanin0(pNode);
if ( Abc_ObjIsCi(pDriver) || Abc_ObjFanoutNum(pDriver) > 1 || Abc_ObjFanoutNum(pNode) > 1 )
continue;
// the driver is a node and its only fanout is this node
if ( Abc_NodeIsInv(pNode) )
pDriver->pData = Cudd_Not(pDriver->pData);
// replace the fanin of the fanout
Abc_ObjPatchFanin( pFanout, pNode, pDriver );
}
continue;
}
// the fanout is a regular node
if ( Abc_ObjFaninNum(pNode) == 0 )
Abc_NodeConstantInput( pFanout, pNode, Abc_NodeIsConst0(pNode) );
else
{
assert( Abc_ObjFaninNum(pNode) == 1 );
pDriver = Abc_ObjFanin0(pNode);
if ( Abc_NodeIsInv(pNode) )
Abc_NodeComplementInput( pFanout, pNode );
Abc_ObjPatchFanin( pFanout, pNode, pDriver );
}
}
}
/**Function*************************************************************
Synopsis [Replaces the local function by its cofactor.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Abc_NodeConstantInput( Abc_Obj_t * pNode, Abc_Obj_t * pFanin, bool fConst0 )
{
DdManager * dd = pNode->pNtk->pManFunc;
DdNode * bVar, * bTemp;
int iFanin;
assert( Abc_NtkIsBddLogic(pNode->pNtk) );
if ( (iFanin = Vec_FanFindEntry( &pNode->vFanins, pFanin->Id )) == -1 )
{
printf( "Node %s should be among", Abc_ObjName(pFanin) );
printf( " the fanins of node %s...\n", Abc_ObjName(pNode) );
return;
}
bVar = Cudd_NotCond( Cudd_bddIthVar(dd, iFanin), fConst0 );
pNode->pData = Cudd_Cofactor( dd, bTemp = pNode->pData, bVar ); Cudd_Ref( pNode->pData );
Cudd_RecursiveDeref( dd, bTemp );
}
/**Function*************************************************************
Synopsis [Changes the polarity of one fanin.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Abc_NodeComplementInput( Abc_Obj_t * pNode, Abc_Obj_t * pFanin )
{
DdManager * dd = pNode->pNtk->pManFunc;
DdNode * bVar, * bCof0, * bCof1;
int iFanin;
assert( Abc_NtkIsBddLogic(pNode->pNtk) );
if ( (iFanin = Vec_FanFindEntry( &pNode->vFanins, pFanin->Id )) == -1 )
{
printf( "Node %s should be among", Abc_ObjName(pFanin) );
printf( " the fanins of node %s...\n", Abc_ObjName(pNode) );
return;
}
bVar = Cudd_bddIthVar( dd, iFanin );
bCof0 = Cudd_Cofactor( dd, pNode->pData, Cudd_Not(bVar) ); Cudd_Ref( bCof0 );
bCof1 = Cudd_Cofactor( dd, pNode->pData, bVar ); Cudd_Ref( bCof1 );
Cudd_RecursiveDeref( dd, pNode->pData );
pNode->pData = Cudd_bddIte( dd, bVar, bCof0, bCof1 ); Cudd_Ref( pNode->pData );
Cudd_RecursiveDeref( dd, bCof0 );
Cudd_RecursiveDeref( dd, bCof1 );
}
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
/// END OF FILE /// /// END OF FILE ///
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
......
/**CFile**************************************************************** /**CFile****************************************************************
FileName [abcUtils.c] FileName [abcUtil.c]
SystemName [ABC: Logic synthesis and verification system.] SystemName [ABC: Logic synthesis and verification system.]
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
Date [Ver. 1.0. Started - June 20, 2005.] Date [Ver. 1.0. Started - June 20, 2005.]
Revision [$Id: abcUtils.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $] Revision [$Id: abcUtil.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
***********************************************************************/ ***********************************************************************/
...@@ -410,6 +410,9 @@ int Abc_NtkLogicMakeSimpleCos( Abc_Ntk_t * pNtk, bool fDuplicate ) ...@@ -410,6 +410,9 @@ int Abc_NtkLogicMakeSimpleCos( Abc_Ntk_t * pNtk, bool fDuplicate )
Abc_ObjPatchFanin( pNode, pDriver, pDriverNew ); Abc_ObjPatchFanin( pNode, pDriver, pDriverNew );
assert( Abc_ObjFanoutNum(pDriverNew) == 1 ); assert( Abc_ObjFanoutNum(pDriverNew) == 1 );
nDupGates++; nDupGates++;
// remove the old driver if it dangles
if ( Abc_ObjFanoutNum(pDriver) == 0 )
Abc_NtkDeleteObj( pDriver );
} }
assert( Abc_NtkLogicHasSimpleCos(pNtk) ); assert( Abc_NtkLogicHasSimpleCos(pNtk) );
return nDupGates; return nDupGates;
...@@ -887,9 +890,47 @@ Vec_Ptr_t * Abc_NodeGetFaninNames( Abc_Obj_t * pNode ) ...@@ -887,9 +890,47 @@ Vec_Ptr_t * Abc_NodeGetFaninNames( Abc_Obj_t * pNode )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
void Abc_NodeFreeFaninNames( Vec_Ptr_t * vNames ) Vec_Ptr_t * Abc_NodeGetFakeNames( int nNames )
{ {
Vec_Ptr_t * vNames;
char Buffer[5];
int i; int i;
vNames = Vec_PtrAlloc( nNames );
for ( i = 0; i < nNames; i++ )
{
if ( nNames < 26 )
{
Buffer[0] = 'a' + i;
Buffer[1] = 0;
}
else
{
Buffer[0] = 'a' + i%26;
Buffer[1] = '0' + i/26;
Buffer[2] = 0;
}
Vec_PtrPush( vNames, util_strsav(Buffer) );
}
return vNames;
}
/**Function*************************************************************
Synopsis [Gets fanin node names.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Abc_NodeFreeNames( Vec_Ptr_t * vNames )
{
int i;
if ( vNames == NULL )
return;
for ( i = 0; i < vNames->nSize; i++ ) for ( i = 0; i < vNames->nSize; i++ )
free( vNames->pArray[i] ); free( vNames->pArray[i] );
Vec_PtrFree( vNames ); Vec_PtrFree( vNames );
......
...@@ -19,6 +19,7 @@ SRC += src/base/abc/abc.c \ ...@@ -19,6 +19,7 @@ SRC += src/base/abc/abc.c \
src/base/abc/abcMiter.c \ src/base/abc/abcMiter.c \
src/base/abc/abcNames.c \ src/base/abc/abcNames.c \
src/base/abc/abcNetlist.c \ src/base/abc/abcNetlist.c \
src/base/abc/abcNtbdd.c \
src/base/abc/abcPrint.c \ src/base/abc/abcPrint.c \
src/base/abc/abcReconv.c \ src/base/abc/abcReconv.c \
src/base/abc/abcRefactor.c \ src/base/abc/abcRefactor.c \
......
...@@ -83,7 +83,7 @@ void Fraig_ManProveMiter( Fraig_Man_t * p ) ...@@ -83,7 +83,7 @@ void Fraig_ManProveMiter( Fraig_Man_t * p )
if ( !p->fTryProve ) if ( !p->fTryProve )
return; return;
clk = clock(); clk = clock();
// consider all outputs of the multi-output miter // consider all outputs of the multi-output miter
for ( i = 0; i < p->vOutputs->nSize; i++ ) for ( i = 0; i < p->vOutputs->nSize; i++ )
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "abc.h" #include "abc.h"
#include "mvc.h" #include "mvc.h"
#include "ft.h" #include "ft.h"
#include "dec.h"
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
/// DECLARATIONS /// /// DECLARATIONS ///
......
...@@ -46,9 +46,8 @@ static int Ft_FactorPrintOutputName( FILE * pFile, char * pNameOut, int fComp ...@@ -46,9 +46,8 @@ static int Ft_FactorPrintOutputName( FILE * pFile, char * pNameOut, int fComp
void Ft_FactorPrint( FILE * pFile, Vec_Int_t * vForm, char * pNamesIn[], char * pNameOut ) void Ft_FactorPrint( FILE * pFile, Vec_Int_t * vForm, char * pNamesIn[], char * pNameOut )
{ {
Ft_Node_t * pNode; Ft_Node_t * pNode;
char Buffer[5]; Vec_Ptr_t * vNamesIn = NULL;
int Pos, i, LitSizeMax, LitSizeCur, nVars; int LitSizeMax, LitSizeCur, nVars, Pos, i;
int fMadeupNames;
// sanity checks // sanity checks
nVars = Ft_FactorGetNumVars( vForm ); nVars = Ft_FactorGetNumVars( vForm );
...@@ -56,27 +55,13 @@ void Ft_FactorPrint( FILE * pFile, Vec_Int_t * vForm, char * pNamesIn[], char * ...@@ -56,27 +55,13 @@ void Ft_FactorPrint( FILE * pFile, Vec_Int_t * vForm, char * pNamesIn[], char *
assert( vForm->nSize > nVars ); assert( vForm->nSize > nVars );
// create the names if not given by the user // create the names if not given by the user
fMadeupNames = 0;
if ( pNamesIn == NULL ) if ( pNamesIn == NULL )
{ {
fMadeupNames = 1; vNamesIn = Abc_NodeGetFakeNames( nVars );
pNamesIn = ALLOC( char *, nVars ); pNamesIn = (char **)vNamesIn->pArray;
for ( i = 0; i < nVars; i++ )
{
if ( nVars < 26 )
{
Buffer[0] = 'a' + i;
Buffer[1] = 0;
}
else
{
Buffer[0] = 'a' + i%26;
Buffer[1] = '0' + i/26;
Buffer[2] = 0;
}
pNamesIn[i] = util_strsav( Buffer );
}
} }
if ( pNameOut == NULL )
pNameOut = "F";
// get the size of the longest literal // get the size of the longest literal
LitSizeMax = 0; LitSizeMax = 0;
...@@ -103,12 +88,8 @@ void Ft_FactorPrint( FILE * pFile, Vec_Int_t * vForm, char * pNamesIn[], char * ...@@ -103,12 +88,8 @@ void Ft_FactorPrint( FILE * pFile, Vec_Int_t * vForm, char * pNamesIn[], char *
} }
fprintf( pFile, "\n" ); fprintf( pFile, "\n" );
if ( fMadeupNames ) if ( vNamesIn )
{ Abc_NodeFreeNames( vNamesIn );
for ( i = 0; i < nVars; i++ )
free( pNamesIn[i] );
free( pNamesIn );
}
} }
/**Function************************************************************* /**Function*************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment