Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ ARCHFLAGS := $(ARCHFLAGS)
OPTFLAGS ?= -g -O

CFLAGS += -Wall -Wno-unused-function -Wno-write-strings -Wno-sign-compare $(ARCHFLAGS)
ifneq ($(findstring arm,$(shell uname -m)),)
CFLAGS += -DABC_MEMALIGN=4
endif

# compile ABC using the C++ compiler and put everything in the namespace $(ABC_NAMESPACE)
ifdef ABC_USE_NAMESPACE
Expand Down
2 changes: 1 addition & 1 deletion src/aig/aig/aigTsim.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Aig_Tsi_t * Aig_TsiStart( Aig_Man_t * pAig )
p->pAig = pAig;
p->nWords = Abc_BitWordNum( 2*Aig_ManRegNum(pAig) );
p->vStates = Vec_PtrAlloc( 1000 );
p->pMem = Aig_MmFixedStart( sizeof(unsigned) * p->nWords + sizeof(unsigned *), 10000 );
p->pMem = Aig_MmFixedStart( alignPad(sizeof(unsigned) * p->nWords + sizeof(unsigned *)), 10000 );
p->nBins = Abc_PrimeCudd(TSI_MAX_ROUNDS/2);
p->pBins = ABC_ALLOC( unsigned *, p->nBins );
memset( p->pBins, 0, sizeof(unsigned *) * p->nBins );
Expand Down
7 changes: 4 additions & 3 deletions src/map/if/ifMan.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ If_Man_t * If_ManStart( If_Par_t * pPars )
}
}
p->nPermWords = p->pPars->fUsePerm? If_CutPermWords( p->pPars->nLutSize ) : 0;
p->nObjBytes = sizeof(If_Obj_t) + sizeof(int) * (p->pPars->nLutSize + p->nPermWords);
p->nCutBytes = sizeof(If_Cut_t) + sizeof(int) * (p->pPars->nLutSize + p->nPermWords);
p->nSetBytes = sizeof(If_Set_t) + (sizeof(If_Cut_t *) + p->nCutBytes) * (p->pPars->nCutsMax + 1);
p->nObjBytes = alignPad(sizeof(If_Obj_t) + sizeof(int) * (p->pPars->nLutSize + p->nPermWords));
p->nCutBytes = alignPad(sizeof(If_Cut_t) + sizeof(int) * (p->pPars->nLutSize + p->nPermWords));
p->nSetBytes = alignPad(sizeof(If_Set_t) + (sizeof(If_Cut_t *) + p->nCutBytes) * (p->pPars->nCutsMax + 1));

p->pMemObj = Mem_FixedStart( p->nObjBytes );
// report expected memory usage
if ( p->pPars->fVerbose )
Expand Down
21 changes: 21 additions & 0 deletions src/misc/util/abc_global.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,27 @@ typedef ABC_INT64_T iword;
((obj) ? ((type *) realloc((char *)(obj), sizeof(type) * (size_t)(num))) : \
((type *) malloc(sizeof(type) * (size_t)(num))))

#ifndef ABC_MEMALIGN
# if defined(__arm__)
# define ABC_MEMALIGN 4
# elif defined(__hppa__)
# define ABC_MEMALIGN 8
# elif defined(__sparc__)
# define ABC_MEMALIGN 8
//# else
//# warning unsupported platform
# endif
#endif // !ABC_MEMALIGN

static inline size_t alignPad(size_t objsize)
{
#ifdef ABC_MEMALIGN
if (objsize % ABC_MEMALIGN)
objsize += ABC_MEMALIGN - (objsize % ABC_MEMALIGN);
#endif
return objsize;
}

static inline int Abc_AbsInt( int a ) { return a < 0 ? -a : a; }
static inline int Abc_MaxInt( int a, int b ) { return a > b ? a : b; }
static inline int Abc_MinInt( int a, int b ) { return a < b ? a : b; }
Expand Down
2 changes: 1 addition & 1 deletion src/opt/rwt/rwtMan.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ clk = Abc_Clock();
p->pTable = ABC_ALLOC( Rwt_Node_t *, p->nFuncs );
memset( p->pTable, 0, sizeof(Rwt_Node_t *) * p->nFuncs );
// create the elementary nodes
p->pMmNode = Mem_FixedStart( sizeof(Rwt_Node_t) );
p->pMmNode = Mem_FixedStart( alignPad(sizeof(Rwt_Node_t)) );
p->vForest = Vec_PtrAlloc( 100 );
Rwt_ManAddVar( p, 0x0000, fPrecompute ); // constant 0
Rwt_ManAddVar( p, 0xAAAA, fPrecompute ); // var A
Expand Down
4 changes: 3 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
add_subdirectory(gia)
add_subdirectory(gia)
add_subdirectory(sparc-alignment)

6 changes: 6 additions & 0 deletions test/sparc-alignment/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#enable_testing()

add_test(NAME aligntest
COMMAND ./aligntest.sh
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
32 changes: 32 additions & 0 deletions test/sparc-alignment/abc.script
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
echo + read_lut "input.lut";
read_lut "input.lut";
echo + read_box "input.box";
read_box "input.box";
echo + &read input.xaig;
&read input.xaig;
echo + &ps;
&ps;
echo + &scorr;
&scorr;
echo + &sweep;
&sweep;
echo + &dc2;
&dc2;
echo + &dch -f -r;
&dch -f -r;
echo + &ps;
&ps;
echo + &if -W 300 -v;
&if -W 300 -v;
echo + &write -n output.aig;
&write -n output.aig;
echo + &mfs;
&mfs;
echo + &ps -l;
&ps -l;
echo + &write -n output.aig;
&write -n output.aig;
echo + &verify;
&verify;
echo + time;
time
10 changes: 10 additions & 0 deletions test/sparc-alignment/aligntest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

# Run test lifted from yosys demonstrating bus error on sparc64.

PATH=`pwd`/../..:$PATH
export PATH

cd $(dirname $0)

abc -s -f abc.script
40 changes: 40 additions & 0 deletions test/sparc-alignment/input.box
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
$__DFF_P__$abc9_flop 1 1 3 1
#C D Q
0 0 0 # $_DFF_[NP]_.D

$__DFF_N__$abc9_flop 2 1 3 1
#C D Q
0 0 0 # $_DFF_[NP]_.D

$__ABC9_DELAY 3 0 1 1
#I
0 # O

CCU2C 4 1 9 3
#A0 B0 C0 D0 A1 B1 C1 D1 CIN
379 379 275 141 - - - - 257 # S0
630 630 526 392 379 379 275 141 273 # S1
516 516 412 278 516 516 412 278 43 # COUT

DPR16X4C 5 1 14 4
#DI[0] DI[1] DI[2] DI[3] WCK WRE RAD[0] RAD[1] RAD[2] RAD[3] WAD[0] WAD[1] WAD[2] WAD[3]
- - - - - - 0 0 0 0 - - - - # DO[0]
- - - - - - 0 0 0 0 - - - - # DO[1]
- - - - - - 0 0 0 0 - - - - # DO[2]
- - - - - - 0 0 0 0 - - - - # DO[3]

TRELLIS_DPR16X4 6 1 14 4
#DI[0] DI[1] DI[2] DI[3] WAD[0] WAD[1] WAD[2] WAD[3] WRE WCK RAD[0] RAD[1] RAD[2] RAD[3]
- - - - - - - - - - 0 0 0 0 # DO[0]
- - - - - - - - - - 0 0 0 0 # DO[1]
- - - - - - - - - - 0 0 0 0 # DO[2]
- - - - - - - - - - 0 0 0 0 # DO[3]

PFUMX 7 1 3 1
#ALUT BLUT C0
98 98 151 # Z

L6MUX21 8 1 3 1
#D0 D1 SD
140 141 148 # Z

14 changes: 14 additions & 0 deletions test/sparc-alignment/input.lut
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# $__ABC9_LUT1
1 1 141
# $__ABC9_LUT2
2 1 141 275
# $__ABC9_LUT3
3 1 141 275 379
# LUT4
4 1 141 275 379 379
# \$__ABC9_LUT5
5 2 151 239 373 477 477
# \$__ABC9_LUT6
6 4 148 292 380 514 618 618
# \$__ABC9_LUT7
7 8 148 289 433 521 655 759 759
16 changes: 16 additions & 0 deletions test/sparc-alignment/input.sym
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
input 0 0 x
input 1 1 x
input 2 2 x
input 3 3 x
input 4 0 y
input 5 1 y
input 6 2 y
input 7 3 y
output 0 0 A
output 1 1 A
output 2 2 A
output 3 3 A
output 4 0 B
output 5 1 B
output 6 2 B
output 7 3 B
Binary file added test/sparc-alignment/input.xaig
Binary file not shown.
Loading