Hi,
I'm writing a code in CC Studio. After compiling i'm getting the error "expression must have a constant value".
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
here i'm attaching the code please find it
#include <stdio.h>
#include <complex.h>
#include <math.h>
#include "../inc/dsplib.h"
#include "SC_FDMA_Params.h"
#include "modulo_fun.h"
#include "dec2bin.h"
#include "Gold_31_seq.h"
#include "Phi_NSC_RB.h"
#include "PUCCH_orthogf1.h"
#include "RB_selection_F1.h"
#include "BPSK_modulat.h"
#include "QPSK_modulat.h"
#include "Circular_shift.h"
#include "cyclic_shift_values_f1.h"
#include "SC_FDMA_SC_Mapping.h"
//#include "Tx_IFFT.h"
#include "Tx_Add_CP.h"
#define PI 3.141592653589793238
#define EXP 2.71828182845904523
#define subframes 10
#define slots_per_frame 20
#define N 2048
// For IFFT
/* Function for generating Specialized sequence of twiddle factors */
/* Align the tables that we have to use */
#pragma DATA_ALIGN(x_ref, 8);
float x_ref [2*N];
#pragma DATA_ALIGN(x_sp, 8);
float x_sp [2*N];
#pragma DATA_ALIGN(y_sp, 8);
float y_sp [2*N];
#pragma DATA_ALIGN(w_sp, 8);
float w_sp [2*N];
#pragma DATA_ALIGN(w1_sp, 8);
float w1_sp [2*N];
unsigned char brev[64] = {
0x0, 0x20, 0x10, 0x30, 0x8, 0x28, 0x18, 0x38,
0x4, 0x24, 0x14, 0x34, 0xc, 0x2c, 0x1c, 0x3c,
0x2, 0x22, 0x12, 0x32, 0xa, 0x2a, 0x1a, 0x3a,
0x6, 0x26, 0x16, 0x36, 0xe, 0x2e, 0x1e, 0x3e,
0x1, 0x21, 0x11, 0x31, 0x9, 0x29, 0x19, 0x39,
0x5, 0x25, 0x15, 0x35, 0xd, 0x2d, 0x1d, 0x3d,
0x3, 0x23, 0x13, 0x33, 0xb, 0x2b, 0x1b, 0x3b,
0x7, 0x27, 0x17, 0x37, 0xf, 0x2f, 0x1f, 0x3f
};
void tw_gen (float *w, int n)
{
int i, j, k;
// const double PI = 3.141592654;
for (j = 1, k = 0; j <= n >> 2; j = j << 2)
{
for (i = 0; i < n >> 2; i += j)
{
#ifdef _LITTLE_ENDIAN
w[k] = (float) -sin (2 * PI * i / n);
w[k + 1] = (float) cos (2 * PI * i / n);
w[k + 2] = (float) -sin (4 * PI * i / n);
w[k + 3] = (float) cos (4 * PI * i / n);
w[k + 4] = (float) -sin (6 * PI * i / n);
w[k + 5] = (float) cos (6 * PI * i / n);
#else
w[k] = (float) cos (2 * PI * i / n);
w[k + 1] = (float) sin (2 * PI * i / n);
w[k + 2] = (float) cos (4 * PI * i / n);
w[k + 3] = (float) sin (4 * PI * i / n);
w[k + 4] = (float) cos (6 * PI * i / n);
w[k + 5] = (float) sin (6 * PI * i / n);
#endif
k += 6;
}
}
}
float y_real_sp [N];
float y_imag_sp [N];
seperateRealImg () {
int i, j;
for (i = 0, j = 0; j < N; i+=2, j++) {
y_real_sp[j] = y_sp[i];
y_imag_sp[j] = y_sp[i + 1];
}
}
int main()
{
int iter=5;
int no_users=1;
int no_frames=1;
int NTx=1;
int NRx=1;
int Cell_ID=100;
int PUCCH_BW_input =6;
int PUCCH_format =2;
int N_cs_1 = 0;
int n_RNTI = 0;
int CP_input = 1; /* Cyclic Prefix: Normal =1, Extended =2 */
int GHop_In =1; /* No Group Hopping =1, Group Hopping Enable =2*/
int SC_Mapping =1; /*Localized Mapping =1, Distibuted Mapping =2 */
int delta_Pucch_shift = 1; /* can be 1,2,3 */
int delta_Pucch_offet = 0; /*can be 0,1,2 */
int P=12/delta_Pucch_shift;
int input_frame_struct =1;
int C_pucch;
int d_pucch;
double complex ref_sig_00[36][20][12],ref_sig_01[36][20][12],ref_sig_02[36][20][12],ref_sig_03[36][20][12];
double complex ref_sig_04[36][20][12],ref_sig_05[36][20][12],ref_sig_06[36][20][12];
double complex r_u_v_0[36][20][12],r_u_v_1[36][20][12],r_u_v_2[36][20][12],r_u_v_3[36][20][12],r_u_v_4[36][20][12],r_u_v_5[36][20][12],r_u_v_6[36][20][12];
double complex temp_ruv[12],W_orth[36][7];
double complex *temp_orthog,*temp_circ_ruv;
double complex symbols_00[36][20][1200],symbols_01[36][20][1200],symbols_02[36][20][1200],symbols_03[36][20][1200];
double complex symbols_04[36][20][1200],symbols_05[36][20][1200],symbols_06[36][20][1200];
double complex Tx_SC_Map_00[2048],Tx_SC_Map_01[2048],Tx_SC_Map_02[2048],Tx_SC_Map_03[2048],Tx_SC_Map_04[2048],Tx_SC_Map_05[2048],Tx_SC_Map_06[2048];
double complex user_symbols_0[36][20][2220],user_symbols_1[36][20][2220],user_symbols_2[36][20][2220],user_symbols_3[36][20][2220];
double complex user_symbols_4[36][20][2220],user_symbols_5[36][20][2220],user_symbols_6[36][20][2220];
double complex temp_SC_Map_0[1024],temp_SC_Map_1[1024],temp_SC_Map_2[1024],temp_SC_Map_3[1024];
double complex temp_SC_Map_4[1024],temp_SC_Map_5[1024],temp_SC_Map_6[1024];
double complex *temp_ifft_0,*temp_ifft_1,*temp_ifft_2,*temp_ifft_3;
double complex *temp_ifft_4,*temp_ifft_5,*temp_ifft_6;
double complex *temp_ifft_shift0,*temp_ifft_shift1,*temp_ifft_shift2,*temp_ifft_shift3;
double complex *temp_ifft_shift4,*temp_ifft_shift5,*temp_ifft_shift6;
double complex *Tx_SC_Map_0,*Tx_SC_Map_1,*Tx_SC_Map_2,*Tx_SC_Map_3,*Tx_SC_Map_4,*Tx_SC_Map_5,*Tx_SC_Map_6;
double complex *temp_add_CP_0,*temp_add_CP_1,*temp_add_CP_2,*temp_add_CP_3,*temp_add_CP_4,*temp_add_CP_5,*temp_add_CP_6;
if (CP_input==1)
{
C_pucch=3;
d_pucch =2;
}
else
{
C_pucch=2;
d_pucch=0;
}
int N_1_pucch_RB = C_pucch*P;
struct PUCCH_Parameter Param_PUCCH=SC_FDMA_Params(PUCCH_BW_input);
int N_RB;
int PUCCH_M;
int PUCCH_N;
double PUCCH_BW;
int N_SC;
int N_IFFT;
double PUCCH_BW_EFF;
int N_ZC;
int PUCCH_RB_pairs;
float FS;
N_RB=Param_PUCCH.N_RB;
PUCCH_M=Param_PUCCH.PUCCH_M;
PUCCH_N=Param_PUCCH.PUCCH_N;
PUCCH_BW=Param_PUCCH.PUCCH_BW;
N_SC=Param_PUCCH.N_SC;
N_IFFT=Param_PUCCH.N_IFFT;
PUCCH_BW_EFF=Param_PUCCH.PUCCH_BW_EFF;
N_ZC=Param_PUCCH.N_ZC;
PUCCH_RB_pairs=Param_PUCCH.PUCCH_RB_pairs;
FS=Param_PUCCH.FS;
printf("hii\n");
if ((PUCCH_format==1)||(PUCCH_format==2)||(PUCCH_format==3))
{
int n_1_pucch = 11;
int N_2_RB = 0,k1;
static int n_PRB[2],uplink_subframe_no[10];
int no_slots=slots_per_frame*no_frames;
n_PRB[0] = RB_selection_F1(n_1_pucch,C_pucch,N_cs_1,delta_Pucch_shift,N_2_RB,N_RB,0);
n_PRB[1] = RB_selection_F1(n_1_pucch,C_pucch,N_cs_1,delta_Pucch_shift,N_2_RB,N_RB,1);
int *u_pucch,k2,k3,i=0;;
double** alpha;
double** alpha_DMRS;
double complex *S_pucch;
u_pucch=cyclic_val_f1_u_pucch(Cell_ID,no_frames,GHop_In);
S_pucch=cyclic_val_f1_S_pucch(N_cs_1,no_frames,delta_Pucch_shift,C_pucch,n_1_pucch,d_pucch);
alpha_DMRS=cyclic_val_f1_alpha_DMRS(Cell_ID,N_cs_1,no_frames,delta_Pucch_shift,C_pucch,n_1_pucch,d_pucch);
alpha=cyclic_val_f1_alpha (Cell_ID,N_cs_1,no_frames,delta_Pucch_shift,C_pucch,n_1_pucch,d_pucch);
printf("hii2\n");
if (input_frame_struct ==1)
{
int uplink_subframe_no[10]={0,1,2,3,4,5,6,7,8,9};
}
int N_RB_PUCCH = 1;
int M_SC_RS =12*N_RB_PUCCH;// M_SC_RS =m*N_SC_RB = 1*12
printf("hii3\n");
// Generation of Base reference signals
int *phi_data;
static double complex r_u_v_bar[100][12];
if (N_RB_PUCCH == 1)
{
for (k1=0;k1<20;k1++)
{
phi_data=Phi_NSC_RB_1(u_pucch[k1]);
for (k2=0;k2<12;k2++)
{
r_u_v_bar[k1][k2]=(cos(phi_data[k2]*PI/4) +I*sin(phi_data[k2]*PI/4));
}
}
}
int ACK_NACK_data[10]={1,0,1,0,1,1,0,0,1,0};
int ACK_len=10;
double complex *data;
if (PUCCH_format == 2) // Format 1A
{
data = BPSK_modulat(ACK_NACK_data,ACK_len);
}
if (PUCCH_format == 3) // Format 1A
{
data = QPSK_modulat(ACK_NACK_data,ACK_len);
}
printf("hii4\n");
double complex ref_sig_00[36][20][12],ref_sig_01[36][20][12],ref_sig_02[36][20][12],ref_sig_03[36][20][12];
double complex ref_sig_04[36][20][12],ref_sig_05[36][20][12],ref_sig_06[36][20][12];
double complex r_u_v_0[36][20][12],r_u_v_1[36][20][12],r_u_v_2[36][20][12],r_u_v_3[36][20][12],r_u_v_4[36][20][12],r_u_v_5[36][20][12],r_u_v_6[36][20][12];
double complex temp_ruv[12],W_orth[36][7];
double complex *temp_orthog,*temp_circ_ruv;
double complex symbols_00[36][20][1200],symbols_01[36][20][1200],symbols_02[36][20][1200],symbols_03[36][20][1200];
double complex symbols_04[36][20][1200],symbols_05[36][20][1200],symbols_06[36][20][1200];
double complex Tx_SC_Map_00[2048],Tx_SC_Map_01[2048],Tx_SC_Map_02[2048],Tx_SC_Map_03[2048],Tx_SC_Map_04[2048],Tx_SC_Map_05[2048],Tx_SC_Map_06[2048];
double complex user_symbols_0[36][20][2220],user_symbols_1[36][20][2220],user_symbols_2[36][20][2220],user_symbols_3[36][20][2220];
double complex user_symbols_4[36][20][2220],user_symbols_5[36][20][2220],user_symbols_6[36][20][2220];
double complex temp_SC_Map_0[2*1024],temp_SC_Map_1[2*1024],temp_SC_Map_2[2*1024],temp_SC_Map_3[2*1024];
double complex temp_SC_Map_4[2*1024],temp_SC_Map_5[2*1024],temp_SC_Map_6[2*1024];
double complex *temp_ifft_0,*temp_ifft_1,*temp_ifft_2,*temp_ifft_3;
double complex *temp_ifft_4,*temp_ifft_5,*temp_ifft_6;
double complex *temp_ifft_shift0,*temp_ifft_shift1,*temp_ifft_shift2,*temp_ifft_shift3;
double complex *temp_ifft_shift4,*temp_ifft_shift5,*temp_ifft_shift6;
double complex *Tx_SC_Map_0,*Tx_SC_Map_1,*Tx_SC_Map_2,*Tx_SC_Map_3,*Tx_SC_Map_4,*Tx_SC_Map_5,*Tx_SC_Map_6;
double complex *temp_add_CP_0,*temp_add_CP_1,*temp_add_CP_2,*temp_add_CP_3,*temp_add_CP_4,*temp_add_CP_5,*temp_add_CP_6;
printf("hii5\n");
int lk,lk1,lk2;
int j,k,shift;
if (CP_input==1)
{
for (k2=0;k2<no_users;k2++)
{
shift=modulo_fun(k2,12/delta_Pucch_shift);
for(k1=0;k1<20;k1++)
{
for (i=0;i<12;i++)
{
temp_ruv[i]=r_u_v_bar[k1][i];
}
Circular_shift(temp_ruv,0,12);
for (k3=0;k3<12;k3++)
{
r_u_v_0[k2][k1][k3] =temp_circ_ruv[k3]*(cos(alpha[k1][0])+I*sin(alpha[k1][0]));
r_u_v_1[k2][k1][k3] =temp_circ_ruv[k3]*(cos(alpha[k1][1])+I*sin(alpha[k1][1]));
r_u_v_2[k2][k1][k3] =temp_circ_ruv[k3]*(cos(alpha_DMRS[k1][2])+I*sin(alpha_DMRS[k1][2]));
r_u_v_3[k2][k1][k3] =temp_circ_ruv[k3]*(cos(alpha_DMRS[k1][3])+I*sin(alpha_DMRS[k1][3]));
r_u_v_4[k2][k1][k3] =temp_circ_ruv[k3]*(cos(alpha_DMRS[k1][4])+I*sin(alpha_DMRS[k1][4]));
r_u_v_5[k2][k1][k3] =temp_circ_ruv[k3]*(cos(alpha[k1][5])+I*sin(alpha[k1][5]));
r_u_v_6[k2][k1][k3] =temp_circ_ruv[k3]*(cos(alpha[k1][6])+I*sin(alpha[k1][6]));
// printf(" %.15g %+.15gi\n",creal(r_u_v_6[k2][k1][k3]),cimag(r_u_v_6[k2][k1][k3]));
}
}
}// End Base reference signal Generation
printf("hii6\n");
int N_CP_symb[7];
static int k_orth[36];
N_CP_symb[0]=160*N_IFFT/2048;
for (k2=1;k2<7;k2++)
{
N_CP_symb[k2]=144*N_IFFT/2048;
}
for(k2=0;k2<no_users;k2++)
{
k_orth[k2]=floor(k2/12);
temp_orthog =PUCCH_orthogf1_CP1(k_orth[k2]);
for(k1=0;k1<7;k1++)
{
W_orth[k2][k1]=temp_orthog[k1];
}
}
for (k2=0;k2<no_users;k2++)
{
for (k1=0;k1<20;k1++)
{
for (k3=0;k3<12;k3++)
{
ref_sig_00[k2][k1][k3]=r_u_v_0[k2][k1][k3]*W_orth[k2][0]*S_pucch[k1];
ref_sig_01[k2][k1][k3]=r_u_v_1[k2][k1][k3]*W_orth[k2][1]*S_pucch[k1];
ref_sig_02[k2][k1][k3]=r_u_v_2[k2][k1][k3]*W_orth[k2][2]*S_pucch[k1];
ref_sig_03[k2][k1][k3]=r_u_v_3[k2][k1][k3]*W_orth[k2][3]*S_pucch[k1];
ref_sig_04[k2][k1][k3]=r_u_v_4[k2][k1][k3]*W_orth[k2][4]*S_pucch[k1];
ref_sig_05[k2][k1][k3]=r_u_v_5[k2][k1][k3]*W_orth[k2][5]*S_pucch[k1];
ref_sig_06[k2][k1][k3]=r_u_v_6[k2][k1][k3]*W_orth[k2][6]*S_pucch[k1];
printf("ref_sig_06[%d]: %.15g %+.15gi\n",k3,creal(ref_sig_06[k2][k1][k3]),cimag(ref_sig_06[k2][k1][k3]));
}
}
}
for (k2=0;k2<no_users;k2++)
{
for (k1=0;k1<20;k1++)
{
for(k3=0;k3<1200;k3++)
{
symbols_00[k2][k1][k3]=0;
symbols_01[k2][k1][k3]=0;
symbols_02[k2][k1][k3]=0;
symbols_03[k2][k1][k3]=0;
symbols_04[k2][k1][k3]=0;
symbols_05[k2][k1][k3]=0;
symbols_06[k2][k1][k3]=0;
}
}
}
for (k2=0;k2<no_users;k2++)
{
for (k1=0;k1<20;k1++)
{
lk=modulo_fun(k1,2);
for(k3=0;k3<12;k3++)
{
lk1=n_PRB[lk]*12+k3;
lk2=10*k2+floor(k1/2);
symbols_00[k2][k1][lk1]=ref_sig_00[k2][k1][k3]*data[lk2];
symbols_01[k2][k1][lk1]=ref_sig_01[k2][k1][k3]*data[lk2];
symbols_02[k2][k1][lk1]=ref_sig_02[k2][k1][k3]*1;
symbols_03[k2][k1][lk1]=ref_sig_03[k2][k1][k3]*1;
symbols_04[k2][k1][lk1]=ref_sig_04[k2][k1][k3]*1;
symbols_05[k2][k1][lk1]=ref_sig_05[k2][k1][k3]*data[lk2];
symbols_06[k2][k1][lk1]=ref_sig_06[k2][k1][k3]*data[lk2];
printf("symbols_00[%d]: %.15g %+.15gi\n",lk1,creal(symbols_00[k2][k1][lk1]),cimag(symbols_00[k2][k1][lk1]));
}
}
}
printf("%d\n",N_IFFT);
for (k2=0;k2<no_users;k2++)
{
for (k1=0;k1<20;k1++)
{
for(k3=0;k3<N_SC;k3++)
{
temp_SC_Map_0[k3]=symbols_00[k2][k1][k3];
}
Tx_SC_Map_0=SC_FDMA_SC_Mapping(temp_SC_Map_0,SC_Mapping,N_IFFT,N_SC);
ifft_shift(Tx_SC_Map_0,N_IFFT);
for (k3=0;k3<N_IFFT;k3++)
{
Tx_SC_Map_00[k3]=temp_ifft_shift0[k3];
printf("Tx_SC_Map_00[%d]: %.15g %+.15gi\n",k3,creal(Tx_SC_Map_00[k3]),cimag(Tx_SC_Map_00[k3]));
}
/* Generate the input data */
for(i=0; i<N_IFFT; i++)
{
/* real part */
x_ref[2 * i] = creal(Tx_SC_Map_00[i]);
/* img part */
x_ref[2 * i + 1] = cimag(Tx_SC_Map_00[i]);
}
/* Copy the reference input data to the various input arrays */
for (i = 0; i <N_IFFT; i++) {
x_sp [2*i] = x_ref[2*i];
x_sp [2*i+1] = x_ref[2*i+1];
// printf("\n x_sp[%d]: %.15g %+.15gi\n",i,x_sp [2*i],x_sp [2*i+1]);
}
/* Genarate twiddle factors */
tw_gen(w_sp, N_IFFT);
/* Call FFT routine */
// DSPF_sp_fftSPxSP(N, x_sp, w_sp, y_sp, brev, 4, 0, N);
DSPF_sp_fftSPxSP(N_IFFT, x_sp, w_sp, y_sp, brev, 2, 0, N_IFFT);
/* Call the test code to seperate the real and imaginary data */
seperateRealImg ();
// for(j=0;j<N;j++)
// printf("\n y_sp[%d]: %.15g %+.15gi\n",j,y_sp [2*j],y_sp [2*j+1]);
//temp_ifft_0=ifft_fun(Tx_SC_Map_00,N_IFFT);
// temp_add_CP_0=Tx_Add_CP(temp_ifft_0,N_CP_symb[0],N_IFFT);
// for(k3=0;k3<N_IFFT+N_CP_symb[0];k3++)
// {
// user_symbols_0[k2][k1][k3]=(N_IFFT/(pow(N_SC,0.5)))*temp_add_CP_0[k3];
// }
}
}
printf("hii7");
}
}
}
The Problems view says the error is coming from line 13 of Gold_31_seq.h, so take a look at the code there carefully. There should be several references on the internet as well as this forum (search in the Compiler forum) about what could cause that error.