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

Go to the source code of this file.

Functions

int GetQCost (int nVars, int nNegs)
 EXTERNAL FUNCTIONS ///.
 
void GetQCostTest ()
 
int ComputeQCost (Vec_Int_t *vCube)
 
int ComputeQCostBits (Cube *p)
 
int ToffoliGateCount (int controls, int lines)
 
int ComputeQCostTcount (Vec_Int_t *vCube)
 
int ComputeQCostTcountBits (Cube *p)
 
int ReduceEsopCover ()
 
void AddCubesToStartingCover (Vec_Wec_t *vEsop)
 
int Exorcism (Vec_Wec_t *vEsop, int nIns, int nOuts, char *pFileNameOut)
 
int Abc_ExorcismMain (Vec_Wec_t *vEsop, int nIns, int nOuts, char *pFileNameOut, int Quality, int Verbosity, int nCubesMax, int fUseQCost)
 
Vec_Wec_tAbc_ExorcismNtk2Esop (Abc_Ntk_t *pNtk)
 

Variables

ABC_NAMESPACE_IMPL_START cinfo g_CoverInfo
 GLOBAL VARIABLES ///.
 
int s_fDecreaseLiterals
 

Function Documentation

◆ Abc_ExorcismMain()

int Abc_ExorcismMain ( Vec_Wec_t * vEsop,
int nIns,
int nOuts,
char * pFileNameOut,
int Quality,
int Verbosity,
int nCubesMax,
int fUseQCost )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 927 of file exor.c.

928{
929 memset( &g_CoverInfo, 0, sizeof(cinfo) );
930 g_CoverInfo.Quality = Quality;
931 g_CoverInfo.Verbosity = Verbosity;
932 g_CoverInfo.nCubesMax = nCubesMax;
933 g_CoverInfo.fUseQCost = fUseQCost;
934 if ( fUseQCost )
936 if ( g_CoverInfo.Verbosity )
937 {
938 printf( "\nEXORCISM, Ver.4.7: Exclusive Sum-of-Product Minimizer\n" );
939 printf( "by Alan Mishchenko, Portland State University, July-September 2000\n\n" );
940 printf( "Incoming ESOP has %d inputs, %d outputs, and %d cubes.\n", nIns, nOuts, Vec_WecSize(vEsop) );
941 }
943 if ( Exorcism( vEsop, nIns, nOuts, pFileNameOut ) == 0 )
944 {
945 printf( "Something went wrong when minimizing the cover\n" );
946 return 0;
947 }
948 return 1;
949}
int Exorcism(Vec_Wec_t *vEsop, int nIns, int nOuts, char *pFileNameOut)
Definition exor.c:779
int s_fDecreaseLiterals
Definition exorList.c:247
ABC_NAMESPACE_IMPL_START cinfo g_CoverInfo
GLOBAL VARIABLES ///.
Definition exor.c:58
void PrepareBitSetModule()
FUNCTION DEFINITIONS ///.
Definition exorBits.c:144
struct cinfo_tag cinfo
char * memset()
Here is the call graph for this function:

◆ Abc_ExorcismNtk2Esop()

Vec_Wec_t * Abc_ExorcismNtk2Esop ( Abc_Ntk_t * pNtk)

Definition at line 951 of file exor.c.

952{
953 Vec_Wec_t * vEsop = NULL;
954 Abc_Obj_t * pNode, * pFanin, * pDriver;
955 char * pCube;
956 int nIns, nOuts, nProducts, nFanins, i, k;
957
958 nIns = Abc_NtkCiNum( pNtk );
959 nOuts = Abc_NtkCoNum( pNtk );
960
961 nProducts = 0;
962 Abc_NtkForEachCo( pNtk, pNode, i )
963 {
964 pDriver = Abc_ObjFanin0Ntk( Abc_ObjFanin0(pNode) );
965 if ( !Abc_ObjIsNode(pDriver) )
966 {
967 nProducts++;
968 continue;
969 }
970 if ( Abc_NodeIsConst(pDriver) )
971 {
972 if ( Abc_NodeIsConst1(pDriver) )
973 nProducts++;
974 continue;
975 }
976 nProducts += Abc_SopGetCubeNum((char *)pDriver->pData);
977 }
978
979 Abc_NtkForEachCi( pNtk, pNode, i )
980 pNode->pCopy = (Abc_Obj_t *)(ABC_PTRUINT_T)i;
981
982 vEsop = Vec_WecAlloc( nProducts+1 );
983
984 Abc_NtkForEachCo( pNtk, pNode, i )
985 {
986 pDriver = Abc_ObjFanin0Ntk( Abc_ObjFanin0(pNode) );
987 if ( Abc_NodeIsConst(pDriver) ) continue;
988
989 nFanins = Abc_ObjFaninNum(pDriver);
990 Abc_SopForEachCube( (char *)pDriver->pData, nFanins, pCube )
991 {
992 Vec_Int_t *vCubeIn = Vec_WecPushLevel( vEsop );
993 Vec_IntGrow( vCubeIn, nIns+2 );
994
995 Abc_ObjForEachFanin( pDriver, pFanin, k )
996 {
997 pFanin = Abc_ObjFanin0Ntk(pFanin);
998 assert( (int)(ABC_PTRUINT_T)pFanin->pCopy < nIns );
999 if ( pCube[k] == '0' )
1000 {
1001 Vec_IntPush( vCubeIn, 2*k + 1 );
1002 }
1003 else if ( pCube[k] == '1' )
1004 {
1005 Vec_IntPush( vCubeIn, 2*k );
1006 }
1007 }
1008 Vec_IntPush( vCubeIn, -( i + 1 ) );
1009 }
1010 }
1011
1012 return vEsop;
1013}
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition abc.h:522
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition abc.h:527
ABC_DLL int Abc_NodeIsConst(Abc_Obj_t *pNode)
Definition abcObj.c:867
#define Abc_SopForEachCube(pSop, nFanins, pCube)
Definition abc.h:538
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition abc.h:518
ABC_DLL int Abc_SopGetCubeNum(char *pSop)
Definition abcSop.c:537
ABC_DLL int Abc_NodeIsConst1(Abc_Obj_t *pNode)
Definition abcObj.c:916
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
void * pData
Definition abc.h:145
Abc_Obj_t * pCopy
Definition abc.h:148
#define assert(ex)
Definition util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
Definition vecWec.h:42
Here is the call graph for this function:

◆ AddCubesToStartingCover()

void AddCubesToStartingCover ( Vec_Wec_t * vEsop)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 702 of file exor.c.

703{
704 Vec_Int_t * vCube;
705 Cube * pNew;
706 int * s_Level2Var;
707 int * s_LevelValues;
708 int c, i, k, Lit, Out;
709
710 s_Level2Var = ABC_ALLOC( int, g_CoverInfo.nVarsIn );
711 s_LevelValues = ABC_ALLOC( int, g_CoverInfo.nVarsIn );
712
713 for ( i = 0; i < g_CoverInfo.nVarsIn; i++ )
714 s_Level2Var[i] = i;
715
716 g_CoverInfo.nLiteralsBefore = 0;
717 g_CoverInfo.QCostBefore = 0;
718 Vec_WecForEachLevel( vEsop, vCube, c )
719 {
720 // get the output of this cube
721 Out = -Vec_IntPop(vCube) - 1;
722
723 // fill in the cube with blanks
724 for ( i = 0; i < g_CoverInfo.nVarsIn; i++ )
725 s_LevelValues[i] = VAR_ABS;
726 Vec_IntForEachEntry( vCube, Lit, k )
727 {
728 if ( Abc_LitIsCompl(Lit) )
729 s_LevelValues[Abc_Lit2Var(Lit)] = VAR_NEG;
730 else
731 s_LevelValues[Abc_Lit2Var(Lit)] = VAR_POS;
732 }
733
734 // get the new cube
735 pNew = GetFreeCube();
736 // consider the need to clear the cube
737 if ( pNew->pCubeDataIn[0] ) // this is a recycled cube
738 {
739 for ( i = 0; i < g_CoverInfo.nWordsIn; i++ )
740 pNew->pCubeDataIn[i] = 0;
741 for ( i = 0; i < g_CoverInfo.nWordsOut; i++ )
742 pNew->pCubeDataOut[i] = 0;
743 }
744
745 InsertVarsWithoutClearing( pNew, s_Level2Var, g_CoverInfo.nVarsIn, s_LevelValues, Out );
746 // set literal counts
747 pNew->a = Vec_IntSize(vCube);
748 pNew->z = 1;
749 pNew->q = ComputeQCost(vCube);
750 // set the ID
751 pNew->ID = g_CoverInfo.cIDs++;
752 // skip through zero-ID
753 if ( g_CoverInfo.cIDs == 256 )
754 g_CoverInfo.cIDs = 1;
755
756 // add this cube to storage
757 CheckForCloseCubes( pNew, 1 );
758
759 g_CoverInfo.nLiteralsBefore += Vec_IntSize(vCube);
760 g_CoverInfo.QCostBefore += ComputeQCost(vCube);
761 }
762 ABC_FREE( s_Level2Var );
763 ABC_FREE( s_LevelValues );
764
765 assert ( g_CoverInfo.nCubesInUse + g_CoverInfo.nCubesFree == g_CoverInfo.nCubesAlloc );
766}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define ABC_FREE(obj)
Definition abc_global.h:267
int ComputeQCost(Vec_Int_t *vCube)
Definition exor.c:132
void InsertVarsWithoutClearing(Cube *pC, int *pVars, int nVarsIn, int *pVarValues, int Output)
Definition exorBits.c:388
struct cube Cube
Cube * GetFreeCube()
Definition exorCubes.c:174
int CheckForCloseCubes(Cube *p, int fAddCube)
Definition exorList.c:643
@ VAR_POS
Definition exor.h:178
@ VAR_NEG
Definition exor.h:178
@ VAR_ABS
Definition exor.h:178
short a
Definition exor.h:126
short z
Definition exor.h:127
short q
Definition exor.h:128
byte ID
Definition exor.h:125
drow * pCubeDataOut
Definition exor.h:130
drow * pCubeDataIn
Definition exor.h:129
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
#define Vec_WecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
Definition vecWec.h:55
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ComputeQCost()

int ComputeQCost ( Vec_Int_t * vCube)

Definition at line 132 of file exor.c.

133{
134 int i, Entry, nLitsN = 0;
135 Vec_IntForEachEntry( vCube, Entry, i )
136 nLitsN += Abc_LitIsCompl(Entry);
137 return GetQCost( Vec_IntSize(vCube), nLitsN );
138}
int GetQCost(int nVars, int nNegs)
EXTERNAL FUNCTIONS ///.
Definition exor.c:96
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ComputeQCostBits()

int ComputeQCostBits ( Cube * p)

Definition at line 139 of file exor.c.

140{
141 extern varvalue GetVar( Cube* pC, int Var );
142 int v, nLits = 0, nLitsN = 0;
143 for ( v = 0; v < g_CoverInfo.nVarsIn; v++ )
144 {
145 int Value = GetVar( p, v );
146 if ( Value == VAR_NEG )
147 nLitsN++;
148 else if ( Value == VAR_POS )
149 nLits++;
150 }
151 nLits += nLitsN;
152 return GetQCost( nLits, nLitsN );
153}
varvalue GetVar(Cube *pC, int Var)
INLINE FUNCTION DEFINITIONS ///.
Definition exorBits.c:188
Cube * p
Definition exorList.c:222
int Var
Definition exorList.c:228
varvalue
VARVALUE and CUBEDIST enum typedefs ///.
Definition exor.h:178
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ComputeQCostTcount()

int ComputeQCostTcount ( Vec_Int_t * vCube)

Definition at line 175 of file exor.c.

176{
177 return 7 * ToffoliGateCount( Vec_IntSize( vCube ), g_CoverInfo.nVarsIn + 1 );
178}
int ToffoliGateCount(int controls, int lines)
Definition exor.c:154
Here is the call graph for this function:

◆ ComputeQCostTcountBits()

int ComputeQCostTcountBits ( Cube * p)

Definition at line 179 of file exor.c.

180{
181 extern varvalue GetVar( Cube* pC, int Var );
182 int v, nLits = 0;
183 for ( v = 0; v < g_CoverInfo.nVarsIn; v++ )
184 if ( GetVar( p, v ) != VAR_ABS )
185 nLits++;
186 return 7 * ToffoliGateCount( nLits, g_CoverInfo.nVarsIn + 1 );
187
188 /* maybe just: 7 * ToffoliGateCount( p->a, g_CoverInfo.nVarsIn + 1 ); */
189}
Here is the call graph for this function:

◆ Exorcism()

int Exorcism ( Vec_Wec_t * vEsop,
int nIns,
int nOuts,
char * pFileNameOut )

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

Synopsis [Performs heuristic minimization of ESOPs.]

Description [Returns 1 on success, 0 on failure.]

SideEffects []

SeeAlso []

Definition at line 779 of file exor.c.

780{
781 abctime clk1;
782 int RemainderBits;
783 int TotalWords;
784 int MemTemp, MemTotal;
785
787 // STEPS of HEURISTIC ESOP MINIMIZATION
790 // STEP 1: determine the size of the starting cover
792 assert( nIns > 0 );
793 // inputs
794 RemainderBits = (nIns*2)%(sizeof(unsigned)*8);
795 TotalWords = (nIns*2)/(sizeof(unsigned)*8) + (RemainderBits > 0);
796 g_CoverInfo.nVarsIn = nIns;
797 g_CoverInfo.nWordsIn = TotalWords;
798 // outputs
799 RemainderBits = (nOuts)%(sizeof(unsigned)*8);
800 TotalWords = (nOuts)/(sizeof(unsigned)*8) + (RemainderBits > 0);
801 g_CoverInfo.nVarsOut = nOuts;
802 g_CoverInfo.nWordsOut = TotalWords;
803 g_CoverInfo.cIDs = 1;
804
805 // cubes
806 clk1 = Abc_Clock();
807// g_CoverInfo.nCubesBefore = CountTermsInPseudoKroneckerCover( g_Func.dd, nOuts );
808 g_CoverInfo.nCubesBefore = Vec_WecSize(vEsop);
809 g_CoverInfo.TimeStart = Abc_Clock() - clk1;
810
811 if ( g_CoverInfo.Verbosity )
812 {
813 printf( "Starting cover generation time is %.2f sec\n", TICKS_TO_SECONDS(g_CoverInfo.TimeStart) );
814 printf( "The number of cubes in the starting cover is %d\n", g_CoverInfo.nCubesBefore );
815 }
816
817 if ( g_CoverInfo.nCubesBefore > g_CoverInfo.nCubesMax )
818 {
819 printf( "\nThe size of the starting cover is more than %d cubes. Quitting...\n", g_CoverInfo.nCubesMax );
820 return 0;
821 }
822
824 // STEP 2: prepare internal data structures
826 g_CoverInfo.nCubesAlloc = g_CoverInfo.nCubesBefore + ADDITIONAL_CUBES;
827
828 // allocate cube cover
829 MemTotal = 0;
830 MemTemp = AllocateCover( g_CoverInfo.nCubesAlloc, g_CoverInfo.nWordsIn, g_CoverInfo.nWordsOut );
831 if ( MemTemp == 0 )
832 {
833 printf( "Unexpected memory allocation problem. Quitting...\n" );
834 return 0;
835 }
836 else
837 MemTotal += MemTemp;
838
839 // allocate cube sets
840 MemTemp = AllocateCubeSets( g_CoverInfo.nVarsIn, g_CoverInfo.nVarsOut );
841 if ( MemTemp == 0 )
842 {
843 printf( "Unexpected memory allocation problem. Quitting...\n" );
844 return 0;
845 }
846 else
847 MemTotal += MemTemp;
848
849 // allocate adjacency queques
850 MemTemp = AllocateQueques( g_CoverInfo.nCubesAlloc*g_CoverInfo.nCubesAlloc/CUBE_PAIR_FACTOR );
851 if ( MemTemp == 0 )
852 {
853 printf( "Unexpected memory allocation problem. Quitting...\n" );
854 return 0;
855 }
856 else
857 MemTotal += MemTemp;
858
859 if ( g_CoverInfo.Verbosity )
860 printf( "Dynamically allocated memory is %dK\n", MemTotal/1000 );
861
863 // STEP 3: write the cube cover into the allocated storage
866 clk1 = Abc_Clock();
867 if ( g_CoverInfo.Verbosity )
868 printf( "Generating the starting cover...\n" );
871
873 // STEP 4: iteratively improve the cover
875 if ( g_CoverInfo.Verbosity )
876 printf( "Performing minimization...\n" );
877 clk1 = Abc_Clock();
879 g_CoverInfo.TimeMin = Abc_Clock() - clk1;
880// g_Func.TimeMin = (float)(Abc_Clock() - clk1)/(float)(CLOCKS_PER_SEC);
881 if ( g_CoverInfo.Verbosity )
882 {
883 printf( "\nMinimization time is %.2f sec\n", TICKS_TO_SECONDS(g_CoverInfo.TimeMin) );
884 printf( "\nThe number of cubes after minimization is %d\n", g_CoverInfo.nCubesInUse );
885 }
886
888 // STEP 5: save the cover into file
890 // if option is MULTI_OUTPUT, the output is written into the output file;
891 // if option is SINGLE_NODE, the output is added to the input file
892 // and written into the output file; in this case, the minimized nodes is
893 // also stored in the temporary file "temp.blif" for verification
894
895 // create the file name and write the output
896 {
897 char Buffer[1000];
898 sprintf( Buffer, "%s", pFileNameOut ? pFileNameOut : "temp.esop" );
899 WriteResultIntoFile( Buffer );
900 if ( g_CoverInfo.Verbosity )
901 printf( "Minimized cover has been written into file <%s>\n", Buffer );
902 }
903
905 // STEP 6: delocate memory
910
911 // return success
912 return 1;
913}
ABC_INT64_T abctime
Definition abc_global.h:332
void AddCubesToStartingCover(Vec_Wec_t *vEsop)
Definition exor.c:702
int ReduceEsopCover()
Definition exor.c:203
int AllocateCover(int nCubes, int nWordsIn, int nWordsOut)
CUBE COVER MEMORY MANAGEMENT //.
Definition exorCubes.c:90
void DelocateQueques()
Definition exorList.c:1139
int AllocateCubeSets(int nVarsIn, int nVarsOut)
CUBE SET MANIPULATION PROCEDURES ///.
Definition exorList.c:792
int AllocateQueques(int nPlaces)
Definition exorList.c:1112
void DelocateCubeSets()
Definition exorList.c:816
int WriteResultIntoFile(char *pFileName)
Definition exorUtil.c:182
@ ADDITIONAL_CUBES
Definition exor.h:67
@ CUBE_PAIR_FACTOR
Definition exor.h:70
void DelocateCover()
Definition exorCubes.c:147
char * sprintf()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetQCost()

int GetQCost ( int nVars,
int nNegs )

EXTERNAL FUNCTIONS ///.

FUNCTION main() /// Function*************************************************************

Synopsis [Number of negative literals.]

Description []

SideEffects []

SeeAlso []

Definition at line 96 of file exor.c.

97{
98 int Extra;
99 assert( nVars >= nNegs );
100 if ( nVars == 0 )
101 return 1;
102 if ( nVars == 1 )
103 {
104 if ( nNegs == 0 ) return 1;
105 if ( nNegs == 1 ) return 2;
106 }
107 if ( nVars == 2 )
108 {
109 if ( nNegs <= 1 ) return 5;
110 if ( nNegs == 2 ) return 6;
111 }
112 if ( nVars == 3 )
113 {
114 if ( nNegs <= 1 ) return 14;
115 if ( nNegs == 2 ) return 16;
116 if ( nNegs == 3 ) return 18;
117 }
118 Extra = nNegs - nVars/2;
119 return 20 + 12 * (nVars - 4) + (Extra > 0 ? 2 * Extra : 0);
120
121}
Here is the caller graph for this function:

◆ GetQCostTest()

void GetQCostTest ( )

Definition at line 122 of file exor.c.

123{
124 int i, k, Limit = 10;
125 for ( i = 0; i < Limit; i++ )
126 {
127 for ( k = 0; k <= i; k++ )
128 printf( "%4d ", GetQCost(i, k) );
129 printf( "\n" );
130 }
131}
Here is the call graph for this function:

◆ ReduceEsopCover()

int ReduceEsopCover ( )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 203 of file exor.c.

204{
206 // SIMPLIFICATION
208
209 int nIterWithoutImprovement = 0;
210 int nIterCount = 0;
211 int GainTotal;
212 int z;
213
214 do
215 {
216//START:
217 if ( g_CoverInfo.Verbosity == 2 )
218 printf( "\nITERATION #%d\n\n", ++nIterCount );
219 else if ( g_CoverInfo.Verbosity == 1 )
220 printf( "." );
221
222 GainTotal = 0;
223 GainTotal += IterativelyApplyExorLink2( 1|2|0 );
224 GainTotal += IterativelyApplyExorLink3( 1|2|0 );
225
226 GainTotal += IterativelyApplyExorLink2( 1|2|0 );
227 GainTotal += IterativelyApplyExorLink3( 1|2|0 );
228
229 GainTotal += IterativelyApplyExorLink2( 1|2|0 );
230 GainTotal += IterativelyApplyExorLink3( 1|2|0 );
231
232 GainTotal += IterativelyApplyExorLink2( 1|2|0 );
233 GainTotal += IterativelyApplyExorLink3( 1|2|0 );
234
235 GainTotal += IterativelyApplyExorLink2( 1|2|0 );
236 GainTotal += IterativelyApplyExorLink3( 1|2|0 );
237
238 GainTotal += IterativelyApplyExorLink2( 1|2|0 );
239 GainTotal += IterativelyApplyExorLink3( 1|2|0 );
240
241 if ( nIterWithoutImprovement > (int)(g_CoverInfo.Quality>0) )
242 {
243 GainTotal += IterativelyApplyExorLink2( 1|2|0 );
244 GainTotal += IterativelyApplyExorLink3( 1|2|0 );
245 GainTotal += IterativelyApplyExorLink2( 1|2|4 );
246 GainTotal += IterativelyApplyExorLink3( 1|2|4 );
247 GainTotal += IterativelyApplyExorLink2( 1|2|4 );
248 GainTotal += IterativelyApplyExorLink4( 1|2|4 );
249 GainTotal += IterativelyApplyExorLink2( 1|2|4 );
250 GainTotal += IterativelyApplyExorLink4( 1|2|0 );
251
252 GainTotal += IterativelyApplyExorLink2( 1|2|0 );
253 GainTotal += IterativelyApplyExorLink3( 1|2|0 );
254 GainTotal += IterativelyApplyExorLink2( 1|2|4 );
255 GainTotal += IterativelyApplyExorLink3( 1|2|4 );
256 GainTotal += IterativelyApplyExorLink2( 1|2|4 );
257 GainTotal += IterativelyApplyExorLink4( 1|2|4 );
258 GainTotal += IterativelyApplyExorLink2( 1|2|4 );
259 GainTotal += IterativelyApplyExorLink4( 1|2|0 );
260 }
261
262 if ( GainTotal )
263 nIterWithoutImprovement = 0;
264 else
265 nIterWithoutImprovement++;
266
267// if ( g_CoverInfo.Quality >= 2 && nIterWithoutImprovement == 2 )
268// s_fDecreaseLiterals = 1;
269 }
270 while ( nIterWithoutImprovement < 1 + g_CoverInfo.Quality );
271
272
273 // improve the literal count
275 for ( z = 0; z < 1; z++ )
276 {
277 if ( g_CoverInfo.Verbosity == 2 )
278 printf( "\nITERATION #%d\n\n", ++nIterCount );
279 else if ( g_CoverInfo.Verbosity == 1 )
280 printf( "." );
281
282 GainTotal = 0;
283 GainTotal += IterativelyApplyExorLink2( 1|2|0 );
284 GainTotal += IterativelyApplyExorLink3( 1|2|0 );
285
286 GainTotal += IterativelyApplyExorLink2( 1|2|0 );
287 GainTotal += IterativelyApplyExorLink3( 1|2|0 );
288
289 GainTotal += IterativelyApplyExorLink2( 1|2|0 );
290 GainTotal += IterativelyApplyExorLink3( 1|2|0 );
291
292 GainTotal += IterativelyApplyExorLink2( 1|2|0 );
293 GainTotal += IterativelyApplyExorLink3( 1|2|0 );
294
295 GainTotal += IterativelyApplyExorLink2( 1|2|0 );
296 GainTotal += IterativelyApplyExorLink3( 1|2|0 );
297
298// if ( GainTotal )
299// {
300// nIterWithoutImprovement = 0;
301// goto START;
302// }
303 }
304
305
306/* ////////////////////////////////////////////////////////////////////
307 // Print statistics
308 printf( "\nShallow simplification time is ";
309 cout << (float)(clk2 - clk1)/(float)(CLOCKS_PER_SEC) << " sec\n" );
310 printf( "Deep simplification time is ";
311 cout << (float)(Abc_Clock() - clk2)/(float)(CLOCKS_PER_SEC) << " sec\n" );
312 printf( "Cover after iterative simplification = " << s_nCubesInUse << endl;
313 printf( "Reduced by initial cube writing = " << g_CoverInfo.nCubesBefore-nCubesAfterWriting << endl;
314 printf( "Reduced by shallow simplification = " << nCubesAfterWriting-nCubesAfterShallow << endl;
315 printf( "Reduced by deep simplification = " << nCubesAfterWriting-s_nCubesInUse << endl;
316
317// printf( "\nThe total number of cubes created = " << g_CoverInfo.cIDs << endl;
318// printf( "Total number of places in a queque = " << s_nPosAlloc << endl;
319// printf( "Minimum free places in queque-2 = " << s_nPosMax[0] << endl;
320// printf( "Minimum free places in queque-3 = " << s_nPosMax[1] << endl;
321// printf( "Minimum free places in queque-4 = " << s_nPosMax[2] << endl;
322*/
323
324 // write the number of cubes into cover information
325 assert ( g_CoverInfo.nCubesInUse + g_CoverInfo.nCubesFree == g_CoverInfo.nCubesAlloc );
326
327// printf( "\nThe output cover is\n" );
328// PrintCoverDebug( cout );
329
330 return 0;
331}
int IterativelyApplyExorLink4(char fDistEnable)
Definition exorList.c:524
int IterativelyApplyExorLink3(char fDistEnable)
Definition exorList.c:405
int IterativelyApplyExorLink2(char fDistEnable)
FUNCTIONS OF THIS MODULE ///.
Definition exorList.c:277
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ToffoliGateCount()

int ToffoliGateCount ( int controls,
int lines )

Definition at line 154 of file exor.c.

155{
156 switch ( controls )
157 {
158 case 0u:
159 case 1u:
160 return 0;
161 break;
162 case 2u:
163 return 1;
164 break;
165 case 3u:
166 return 4;
167 break;
168 case 4u:
169 return ( ( ( lines + 1 ) / 2 ) >= controls ) ? 8 : 10;
170 break;
171 default:
172 return ( ( ( lines + 1 ) / 2 ) >= controls ) ? 4 * ( controls - 2 ) : 8 * ( controls - 3 );
173 }
174}
Here is the caller graph for this function:

Variable Documentation

◆ g_CoverInfo

GLOBAL VARIABLES ///.

EXTERNAL VARIABLES ////.

EXTERNAL VARIABLES ///.

EXTERNAL FUNCTIONS ///.

MACRO DEFINITIONS ///.

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

FileName [exor.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Exclusive sum-of-product minimization.]

Synopsis [Main procedure.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

Id
exor.c,v 1.0 2005/06/20 00:00:00 alanmi Exp

]

                                                            ///
            Implementation of EXORCISM - 4                  ///
        An Exclusive Sum-of-Product Minimizer               ///
         Alan Mishchenko  <alanmi@ee.pdx.edu>               ///
                                                            ///

                                                            ///
                   Main Module                              ///
          ESOP Minimization Task Coordinator                ///
                                                            ///
    1) interprets command line                              ///  
    2) calls the approapriate reading procedure             ///
    3) calls the minimization module                        ///
                                                            ///

Ver. 1.0. Started - July 18, 2000. Last update - July 20, 2000 /// Ver. 1.1. Started - July 24, 2000. Last update - July 29, 2000 /// Ver. 1.4. Started - Aug 10, 2000. Last update - Aug 26, 2000 /// Ver. 1.6. Started - Sep 11, 2000. Last update - Sep 15, 2000 /// Ver. 1.7. Started - Sep 20, 2000. Last update - Sep 23, 2000 /// ///

This software was tested with the BDD package "CUDD", v.2.3.0 /// by Fabio Somenzi /// http://vlsi.colorado.edu/~fabio/ ///

Definition at line 58 of file exor.c.

◆ s_fDecreaseLiterals

int s_fDecreaseLiterals
extern

Definition at line 247 of file exorList.c.