File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -74,9 +74,6 @@ ARCHFLAGS := $(ARCHFLAGS)
7474OPTFLAGS ?= -g -O
7575
7676CFLAGS += -Wall -Wno-unused-function -Wno-write-strings -Wno-sign-compare $(ARCHFLAGS )
77- ifneq ($(findstring arm,$(shell uname -m) ) ,)
78- CFLAGS += -DABC_MEMALIGN=4
79- endif
8077
8178# compile ABC using the C++ compiler and put everything in the namespace $(ABC_NAMESPACE)
8279ifdef ABC_USE_NAMESPACE
Original file line number Diff line number Diff line change @@ -135,7 +135,7 @@ Aig_Tsi_t * Aig_TsiStart( Aig_Man_t * pAig )
135135 p -> pAig = pAig ;
136136 p -> nWords = Abc_BitWordNum ( 2 * Aig_ManRegNum (pAig ) );
137137 p -> vStates = Vec_PtrAlloc ( 1000 );
138- p -> pMem = Aig_MmFixedStart ( sizeof (unsigned ) * p -> nWords + sizeof (unsigned * ), 10000 );
138+ p -> pMem = Aig_MmFixedStart ( alignPad ( sizeof (unsigned ) * p -> nWords + sizeof (unsigned * ) ), 10000 );
139139 p -> nBins = Abc_PrimeCudd (TSI_MAX_ROUNDS /2 );
140140 p -> pBins = ABC_ALLOC ( unsigned * , p -> nBins );
141141 memset ( p -> pBins , 0 , sizeof (unsigned * ) * p -> nBins );
Original file line number Diff line number Diff line change @@ -88,9 +88,10 @@ If_Man_t * If_ManStart( If_Par_t * pPars )
8888 }
8989 }
9090 p -> nPermWords = p -> pPars -> fUsePerm ? If_CutPermWords ( p -> pPars -> nLutSize ) : 0 ;
91- p -> nObjBytes = sizeof (If_Obj_t ) + sizeof (int ) * (p -> pPars -> nLutSize + p -> nPermWords );
92- p -> nCutBytes = sizeof (If_Cut_t ) + sizeof (int ) * (p -> pPars -> nLutSize + p -> nPermWords );
93- p -> nSetBytes = sizeof (If_Set_t ) + (sizeof (If_Cut_t * ) + p -> nCutBytes ) * (p -> pPars -> nCutsMax + 1 );
91+ p -> nObjBytes = alignPad (sizeof (If_Obj_t ) + sizeof (int ) * (p -> pPars -> nLutSize + p -> nPermWords ));
92+ p -> nCutBytes = alignPad (sizeof (If_Cut_t ) + sizeof (int ) * (p -> pPars -> nLutSize + p -> nPermWords ));
93+ p -> nSetBytes = alignPad (sizeof (If_Set_t ) + (sizeof (If_Cut_t * ) + p -> nCutBytes ) * (p -> pPars -> nCutsMax + 1 ));
94+
9495 p -> pMemObj = Mem_FixedStart ( p -> nObjBytes );
9596 // report expected memory usage
9697 if ( p -> pPars -> fVerbose )
Original file line number Diff line number Diff line change @@ -271,6 +271,27 @@ typedef ABC_INT64_T iword;
271271 ((obj) ? ((type *) realloc((char *)(obj), sizeof(type) * (size_t)(num))) : \
272272 ((type *) malloc(sizeof(type) * (size_t)(num))))
273273
274+ #ifndef ABC_MEMALIGN
275+ # if defined(__arm__ )
276+ # define ABC_MEMALIGN 4
277+ # elif defined(__hppa__ )
278+ # define ABC_MEMALIGN 8
279+ # elif defined(__sparc__ )
280+ # define ABC_MEMALIGN 8
281+ //# else
282+ //# warning unsupported platform
283+ # endif
284+ #endif // !ABC_MEMALIGN
285+
286+ static inline size_t alignPad (size_t objsize )
287+ {
288+ #ifdef ABC_MEMALIGN
289+ if (objsize % ABC_MEMALIGN )
290+ objsize += ABC_MEMALIGN - (objsize % ABC_MEMALIGN );
291+ #endif
292+ return objsize ;
293+ }
294+
274295static inline int Abc_AbsInt ( int a ) { return a < 0 ? - a : a ; }
275296static inline int Abc_MaxInt ( int a , int b ) { return a > b ? a : b ; }
276297static inline int Abc_MinInt ( int a , int b ) { return a < b ? a : b ; }
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ clk = Abc_Clock();
104104 p -> pTable = ABC_ALLOC ( Rwt_Node_t * , p -> nFuncs );
105105 memset ( p -> pTable , 0 , sizeof (Rwt_Node_t * ) * p -> nFuncs );
106106 // create the elementary nodes
107- p -> pMmNode = Mem_FixedStart ( sizeof (Rwt_Node_t ) );
107+ p -> pMmNode = Mem_FixedStart ( alignPad ( sizeof (Rwt_Node_t ) ) );
108108 p -> vForest = Vec_PtrAlloc ( 100 );
109109 Rwt_ManAddVar ( p , 0x0000 , fPrecompute ); // constant 0
110110 Rwt_ManAddVar ( p , 0xAAAA , fPrecompute ); // var A
You can’t perform that action at this time.
0 commit comments