Hi,
I am a newbie in roccc therefore I apologize in advance for any trivial question I may ask.
I am working on a code for realize a 8 bit Discrete Cosine Tranform, thus I wrote the four modules of the butterfly and the system that calls them. I can compile with no errors all the four modules, however when compiling the system I get the follwoing error:
"
Lo Cirrf compilation failed
hi_cirrf.c: In function ‘DCT’:
hi_cirrf.c:71: warning: assignment from incompatible pointer type
hi_cirrf.c:72: warning: assignment from incompatible pointer type
INTERNAL ERROR - UndefDetectionPass.cpp: Detected undef in call void @ROCCCInvokeHardware0( i8* getelementptr ([5 x i8]* @.str, i32 0, i32 0), float %suifTmp0162250, float %suifTmp1163217, float %suifTmp3165211, float %suifTmp4166204, float %i6120206, float %i7121208, float undef, float %iw2127226, float %i2179321, float %i5180322, float %iw0129229, float %iw3126223, float %iw4125220, float %iw5124309, float %iw6123308, float %iw7122307 ) nounwind
opt: UndefDetectionPass.cpp:62: virtual bool llvm::UndefDetectionPass::runOnFunction(llvm::Function&): Assertion `0 and "Undef found!"' failed.
/home/davide/Desktop/roccc-0.4-distribution/Install/roccc-compiler/src/../bin/compile_llvmtovhdl.sh: line 4: 3515 Aborted /home/davide/Desktop/roccc-0.4-distribution/Install/roccc-compiler/src/llvm-2.3//Release/bin/opt -load /home/davide/Desktop/roccc-0.4-distribution/Install/roccc-compiler/src/llvm-2.3//Release/lib/FloatPass.so.0 -load /home/davide/Desktop/roccc-0.4-distribution/Install/roccc-compiler/src/llvm-2.3//Release/lib/PipelinePass.so.0 -load /home/davide/Desktop/roccc-0.4-distribution/Install/roccc-compiler/src/llvm-2.3//Release/lib/VHDLOutput.so.0 -load /home/davide/Desktop/roccc-0.4-distribution/Install/roccc-compiler/src/llvm-2.3//Release/lib/RocccIntrinsic.so.0 -renameMem -mem2reg -ROCCCfloat -undefDetect -rocccCFGtoDFG -pipeline -insertCopy -loadRemoval -arrayNorm -vhdl -f -o /dev/null < $1.bc
"
None of the optimization flags have been checked for any module nor the system.
I tried to compile the example that does the FFT and it works fine for both modules and system.
Below there are each of the four modules' code
DCT1.c :
"
typedef struct
{
//inputs
float i0_in ;
float i1_in ;
float i2_in ;
float i3_in ;
float i4_in ;
float i5_in ;
float i6_in ;
float i7_in ;
//outputs
float o0_out ;
float o1_out ;
float o2_out ;
float o3_out ;
float o4_out ;
float o5_out ;
float o6_out ;
float o7_out ;
} DCT1_t ;
DCT1_t DCT1(DCT1_t t)
{
t.o0_out = t.i0_in + t.i7_in ;
t.o1_out = t.i1_in + t.i6_in ;
t.o2_out = t.i2_in + t.i5_in ;
t.o3_out = t.i3_in + t.i4_in ;
t.o4_out = t.i3_in - t.i4_in ;
t.o5_out = t.i2_in - t.i5_in ;
t.o6_out = t.i1_in - t.i6_in ;
t.o7_out = t.i0_in - t.i7_in ;
return t ;
}
"
DCT2.c :
"
typedef struct
{
//inputs
float i0_in ;
float i1_in ;
float i2_in ;
float i3_in ;
float i4_in ;
float i5_in ;
float i6_in ;
float i7_in ;
//Coefficent
float w0_in;
float w1_in;
float w2_in;
float w3_in;
//outputs
float o0_out ;
float o1_out ;
float o2_out ;
float o3_out ;
float o4_out ;
float o5_out ;
float o6_out ;
float o7_out ;
} DCT2_t ;
DCT2_t DCT2(DCT2_t t)
{
t.o0_out = t.i0_in + t.i3_in ;
t.o1_out = t.i1_in + t.i2_in ;
t.o2_out = t.i1_in - t.i2_in ;
t.o3_out = t.i0_in - t.i3_in ;
t.o4_out = t.i4_in*t.w0_in + t.i7_in*t.w1_in ;
t.o5_out = t.i5_in*t.w2_in + t.i6_in*t.w3_in ;
t.o6_out = t.i6_in*t.w2_in - t.i5_in*t.w3_in ;
t.o7_out = t.i7_in*t.w0_in - t.i4_in*t.w1_in ;
return t ;
}
"
DCT3.c :
"
typedef struct
{
//inputs
float i0_in ;
float i1_in ;
float i2_in ;
float i3_in ;
float i4_in ;
float i5_in ;
float i6_in ;
float i7_in ;
//Coefficent
float w0_in;
float w1_in;
//outputs
float o0_out ;
float o1_out ;
float o2_out ;
float o3_out ;
float o4_out ;
float o5_out ;
float o6_out ;
float o7_out ;
} DCT3_t ;
DCT3_t DCT3(DCT3_t t)
{
t.o0_out = t.i0_in + t.i1_in ;
t.o1_out = t.i0_in - t.i1_in ;
t.o2_out = t.i2_in*t.w0_in + t.i3_in*t.w1_in ;
t.o3_out = t.i3_in*t.w0_in - t.i2_in*t.w1_in ;
t.o4_out = t.i4_in + t.i6_in ;
t.o5_out = t.i7_in - t.i5_in ;
t.o6_out = t.i6_in - t.i4_in ;
t.o7_out = t.i5_in + t.i7_in ;
return t ;
}
"
DCT4.c :
"
typedef struct
{
//inputs
float i0_in ;
float i1_in ;
float i2_in ;
float i3_in ;
float i4_in ;
float i5_in ;
float i6_in ;
float i7_in ;
//Coefficent
float w0_in;
//outputs
float o0_out ;
float o1_out ;
float o2_out ;
float o3_out ;
float o4_out ;
float o5_out ;
float o6_out ;
float o7_out ;
} DCT4_t ;
DCT4_t DCT4(DCT4_t t)
{
t.o0_out = t.i0_in ;
t.o1_out = t.i1_in ;
t.o2_out = t.i2_in ;
t.o3_out = t.i3_in ;
t.o4_out = t.i7_in - t.i4_in ;
t.o5_out = t.i5_in*t.w0_in ;
t.o6_out = t.i6_in*t.w0_in ;
t.o7_out = t.i4_in + t.i7_in ;
return t ;
}
"
And the system code:
DCT.c:
"
#include "roccc-library.h"
void DCT()
{
float A[100];
float B[100];
float i0;
float i1;
float i2;
float i3;
float i4;
float i5;
float i6;
float i7;
float iw0;
float iw1;
float iw2;
float iw3;
float iw4;
float iw5;
float iw6;
float iw7;
float iw8;
float iw9;
float iw10;
float iw11;
float iw12;
float iw13;
float iw14;
float iw15;
float iw16;
float iw17;
float iw18;
float iw19;
float iw20;
float iw21;
float iw22;
float iw23;
float o0;
float o1;
float o2;
float o3;
float o4;
float o5;
float o6;
float o7;
//constants
float w21= 0.83147;
float w22= 0.55557;
float w23= 0.98078;
float w24= 0.19509;
float w31= 1.3870;
float w32= 0.2759;
float w41= 1.4142;
int i;
for (i = 0 ; i < 100 ; i+=8)
{
i0=A[i];
i1=A[i+1];
i2=A[i+2];
i3=A[i+3];
i4=A[i+4];
i5=A[i+5];
i6=A[i+6];
i7=A[i+7];
// DCT<number> indicates the <number>-th stage of the DCT
DCT1(i0,i1,i2,i3,i4,i5,i6,i7, // inputs
iw0,iw1,iw2,iw3,iw4,iw5,iw6,iw7); // outputs
DCT2(iw0,iw1,iw2,iw3,iw4,iw5,iw6,iw7, // inputs
w21,w22,w23,w24, // coefficents
iw8,iw9,iw10,iw11,iw12,iw13,iw14,iw15); // outputs
DCT3(iw8,iw9,iw10,iw11,iw12,iw13,iw14,iw15, // inputs
w31,w32, // coefficents
iw16,iw17,iw18,iw19,iw20,iw21,iw22,iw23); // outputs
DCT4(iw16,iw17,iw18,iw19,iw20,iw21,iw22,iw23, // inputs
w41, // coefficents
o0,o1,o2,o3,o4,o5,o6,o7); // outputs
B[i] = o0;
B[i+1] = o1;
B[i+2] = o2;
B[i+3] = o3;
B[i+4] = o4;
B[i+5] = o5;
B[i+6] = o6;
B[i+7] = o7;
}
}
"
The ROCCC installation is under Ubutnu linux 9.10 OS.
Many thanks in advance for any answer.
Davide Barcelli