Commit 30d5f151 authored by Eurecom's avatar Eurecom

specified modulation for QPSK

parent dea85884
......@@ -1274,6 +1274,7 @@ void init_lte_top(LTE_DL_FRAME_PARMS *frame_parms)
generate_64qam_table();
generate_16qam_table();
generate_qpsk_table();
generate_RIV_tables();
init_unscrambling_lut();
......
......@@ -121,6 +121,16 @@ void generate_16qam_table(void)
}
}
void generate_qpsk_table(void)
{
int a,index;
for (a=-1; a<=1; a+=2)
index = (1+a)/2;
qpsk_table[index] = -a*QPSK;
}
......@@ -158,6 +168,158 @@ void layer1prec2A(int32_t *antenna0_sample, int32_t *antenna1_sample, uint8_t pr
uint32_t FOUR[2]={0,4};
uint32_t TWO[2]={0,2};
int allocate_REs_in_RB_no_pilots_QPSK_siso(PHY_VARS_eNB* phy_vars_eNB,
int **txdataF,
uint32_t *jj,
uint32_t *jj2,
uint16_t re_offset,
uint32_t symbol_offset,
LTE_DL_eNB_HARQ_t *dlsch0_harq,
LTE_DL_eNB_HARQ_t *dlsch1_harq,
uint8_t pilots,
int16_t amp,
uint8_t precoder_index,
int16_t *qam_table_s0,
int16_t *qam_table_s1,
uint32_t *re_allocated,
uint8_t skip_dc,
uint8_t skip_half,
uint8_t lprime,
uint8_t mprime,
uint8_t Ns,
int *P1_SHIFT,
int *P2_SHIFT)
{
LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_eNB->frame_parms;
uint8_t *x0 = dlsch0_harq->e;
uint32_t qpsk_table_offset_re = 0;
uint32_t qpsk_table_offset_im = 0;
uint32_t tti_offset;
uint8_t re;
uint8_t *x0p;
if (skip_dc == 0) {
for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset,re=0;
re<12;
re++,x0p+=2,tti_offset++) {
qpsk_table_offset_re=x0p[0];
qpsk_table_offset_im=x0p[1];
((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qpsk_table_offset_re];
((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qpsk_table_offset_im];
}
}
else {
// 1st half of PRB
for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset,re=0;
re<6;
re++,x0p+=2,tti_offset++) {
qpsk_table_offset_re=x0p[0];
qpsk_table_offset_im=x0p[1];
((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qpsk_table_offset_re];
((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qpsk_table_offset_im];
}
// 2nd half of PRB
for (tti_offset=symbol_offset+re_offset-frame_parms->ofdm_symbol_size+7;
re<12;
re++,x0p+=2,tti_offset++) {
qpsk_table_offset_re=x0p[0];
qpsk_table_offset_im=x0p[1];
((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qpsk_table_offset_re];
((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qpsk_table_offset_im];
}
}
*re_allocated = *re_allocated + 12;
*jj=*jj + 24;
return(0);
}
int allocate_REs_in_RB_pilots_QPSK_siso(PHY_VARS_eNB* phy_vars_eNB,
int **txdataF,
uint32_t *jj,
uint32_t *jj2,
uint16_t re_offset,
uint32_t symbol_offset,
LTE_DL_eNB_HARQ_t *dlsch0_harq,
LTE_DL_eNB_HARQ_t *dlsch1_harq,
uint8_t pilots,
int16_t amp,
uint8_t precoder_index,
int16_t *qam_table_s0,
int16_t *qam_table_s1,
uint32_t *re_allocated,
uint8_t skip_dc,
uint8_t skip_half,
uint8_t lprime,
uint8_t mprime,
uint8_t Ns,
int *P1_SHIFT,
int *P2_SHIFT)
{
LTE_DL_FRAME_PARMS *frame_parms=&phy_vars_eNB->frame_parms;
uint8_t *x0 = dlsch0_harq->e;
uint32_t qpsk_table_offset_re = 0;
uint32_t qpsk_table_offset_im = 0;
uint32_t tti_offset;
uint8_t re;
uint8_t *x0p;
if (skip_dc == 0) {
// printf("pilots: P1_SHIFT[0] %d\n",P1_SHIFT[0]);
for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset+P1_SHIFT[0],re=P1_SHIFT[0];
re<12;
x0p+=2) {
qpsk_table_offset_re=x0p[0];
qpsk_table_offset_im=x0p[1];
((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qpsk_table_offset_re];
((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qpsk_table_offset_im];
// printf("pilots: re %d, tti_offset %d, P1_SHIFT %d\n",re,tti_offset,P1_SHIFT[re+1]);
tti_offset+=P1_SHIFT[re+1];
re+=P1_SHIFT[re+1];
}
}
else {
for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset+P1_SHIFT[0],re=P1_SHIFT[0];
re<6;
x0p+=2) {
qpsk_table_offset_re+=x0p[0];
qpsk_table_offset_im+=x0p[1];
((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qpsk_table_offset_re];
((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qpsk_table_offset_im];
tti_offset+=P1_SHIFT[re+1];
re+=P1_SHIFT[re+1];
}
for (tti_offset=symbol_offset+re_offset-frame_parms->ofdm_symbol_size+6+P1_SHIFT[6];
re<12;
x0p+=2) {
qpsk_table_offset_re+=x0p[0];
qpsk_table_offset_im+=x0p[1];
((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qpsk_table_offset_re];
((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qpsk_table_offset_im];
tti_offset+=P1_SHIFT[re+1];
re+=P1_SHIFT[re+1];
}
}
*re_allocated = *re_allocated + 10;
*jj=*jj + 20;
return(0);
}
int allocate_REs_in_RB_no_pilots_16QAM_siso(PHY_VARS_eNB* phy_vars_eNB,
int **txdataF,
uint32_t *jj,
......@@ -2012,8 +2174,8 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
uint8_t mod_order0 = 0;
uint8_t mod_order1 = 0;
int16_t amp_rho_a, amp_rho_b;
int16_t qam16_table_a0[4],qam64_table_a0[8],qam16_table_b0[4],qam64_table_b0[8];
int16_t qam16_table_a1[4],qam64_table_a1[8],qam16_table_b1[4],qam64_table_b1[8];
int16_t qpsk_table_a0[2],qam16_table_a0[4],qam64_table_a0[8],qpsk_table_b0[2],qam16_table_b0[4],qam64_table_b0[8];
int16_t qpsk_table_a1[2],qam16_table_a1[4],qam64_table_a1[8],qpsk_table_b1[2],qam16_table_b1[4],qam64_table_b1[8];
int16_t *qam_table_s0=NULL,*qam_table_s1=NULL;
#ifdef NEW_ALLOC_RE
......@@ -2126,7 +2288,15 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
amp_rho_b = (int16_t)(((int32_t)amp*dlsch1->sqrt_rho_b)>>13);
}
if (mod_order0 == 4)
if(mod_order0 == 2)
{
for(i=0;i<2;i++)
{
qpsk_table_a0[i] = (int16_t)(((int32_t)qpsk_table[i]*amp_rho_a)>>15);
qpsk_table_b0[i] = (int16_t)(((int32_t)qpsk_table[i]*amp_rho_b)>>15);
}
}
else if (mod_order0 == 4)
for (i=0;i<4; i++) {
qam16_table_a0[i] = (int16_t)(((int32_t)qam16_table[i]*amp_rho_a)>>15);
qam16_table_b0[i] = (int16_t)(((int32_t)qam16_table[i]*amp_rho_b)>>15);
......@@ -2137,7 +2307,14 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
qam64_table_b0[i] = (int16_t)(((int32_t)qam64_table[i]*amp_rho_b)>>15);
}
if (mod_order1 == 4)
if (mod_order1 == 2)
{
for (i=0; i<2; i++) {
qpsk_table_a1[i] = (int16_t)(((int32_t)qpsk_table[i]*amp_rho_a)>>15);
qpsk_table_b1[i] = (int16_t)(((int32_t)qpsk_table[i]*amp_rho_b)>>15);
}
}
else if (mod_order1 == 4)
for (i=0; i<4; i++) {
qam16_table_a1[i] = (int16_t)(((int32_t)qam16_table[i]*amp_rho_a)>>15);
qam16_table_b1[i] = (int16_t)(((int32_t)qam16_table[i]*amp_rho_b)>>15);
......@@ -2265,7 +2442,26 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
switch (mod_order0) {
case 2:
qam_table_s0 = NULL;
//qam_table_s0 = NULL;
if (pilots) {
qam_table_s0 = qpsk_table_b0;
#ifdef NEW_ALLOC_RE
/* TODO: remove this code? */
allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ?
allocate_REs_in_RB_pilots_QPSK_siso :
allocate_REs_in_RB;
#endif
}
else {
qam_table_s0 = qpsk_table_a0;
#ifdef NEW_ALLOC_RE
/* TODO: remove this code? */
allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ?
allocate_REs_in_RB_no_pilots_QPSK_siso :
allocate_REs_in_RB;
#endif
}
break;
case 4:
if (pilots) {
......
......@@ -30,7 +30,7 @@ extern short *ul_ref_sigs_rx[30][2][33];
extern unsigned short dftsizes[33];
extern unsigned short ref_primes[33];
extern int qam64_table[8],qam16_table[4];
extern int qam64_table[8],qam16_table[4],qpsk_table[2];
extern unsigned char cs_ri_normal[4];
extern unsigned char cs_ri_extended[4];
......
......@@ -62,7 +62,7 @@ unsigned char ue_power_offsets[25] = {14,11,9,8,7,6,6,5,4,4,4,3,3,3,2,2,2,1,1,1,
short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1};
short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1};
int qam64_table[8],qam16_table[4];
int qam64_table[8],qam16_table[4],qpsk_table[2];
unsigned char cs_ri_normal[4] = {1,4,7,10};
unsigned char cs_ri_extended[4] = {0,3,5,8};
......
......@@ -207,6 +207,9 @@
// QAM amplitude definitions
/// Amplitude for QPSK (\f$ 2^15 \times 1/\sqrt{2}\f$)
#define QPSK 23170
/// First Amplitude for QAM16 (\f$ 2^{15} \times 2/\sqrt{10}\f$)
#define QAM16_n1 20724
/// Second Amplitude for QAM16 (\f$ 2^{15} \times 1/\sqrt{10}\f$)
......
......@@ -71,7 +71,7 @@ schedule_ue_spec_phy_test(
uint16_t rnti = 0x1235;
uint32_t rb_alloc = 0x1FFFFFFF;
int32_t tpc = 1;
int32_t mcs = 28;
int32_t mcs = 0;
int32_t cqi = 15;
int32_t ndi = subframeP/5;
int32_t dai = 0;
......
......@@ -686,7 +686,7 @@ static void* emulatedRF_thread(void* param) {
int microsec = 500; // length of time to sleep, in miliseconds
struct timespec req = {0};
req.tv_sec = 0;
req.tv_nsec = ((microsec * 1000L)/numerology);
req.tv_nsec = (numerology>0)? ((microsec * 1000L)/numerology):(microsec * 1000L)*2;
cpu_set_t cpuset;
CPU_SET(1,&cpuset);
pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment