Commit 9d8aecdb authored by ISIP CS/NCTU's avatar ISIP CS/NCTU

Replace beamforming.c

parent c87e00c3
......@@ -40,6 +40,7 @@
* \note
* \warning
*/
#include "PHY/defs_common.h"
#include "PHY/defs_eNB.h"
......@@ -55,51 +56,49 @@ int beam_precoding(int32_t **txdataF,
int32_t **txdataF_BF,
LTE_DL_FRAME_PARMS *frame_parms,
int32_t ***beam_weights,
int slot,
int symbol,
int aa)
int aa,
int p)
{
uint8_t p;
//uint16_t re=0;
int slot_offset_F;
slot_offset_F = slot*(frame_parms->ofdm_symbol_size)*((frame_parms->Ncp==1) ? 6 : 7);
//LOG_I(PHY,"Starting precoding for symbol %d, physical antenna %d, logical port %d\n",symbol,aa,p);
int rb_offset_neg = frame_parms->ofdm_symbol_size - (6*frame_parms->N_RB_DL);
/* if(rb<(frame_parms->N_RB_DL/2)) {
rb_offset = rb*12;
}else if(rb>=(frame_parms->N_RB_DL/2)) {
rb_offset = 12*(rb-(frame_parms->N_RB_DL/2));
//rb_offset = 1+(12*(rb-(frame_parms->N_RB_DL>>1)));
}*/
//printf("aa = %d, p = %d, symbol = %d, rb = %d, rb_offset = %d, orisma = %d\n",aa,p,symbol,rb,rb_offset,rb_offset+symbol*12);
//printf("aa = %d, p = %d, symbol = %d\n",aa,p,symbol);
// clear txdata_BF[aa][re] for each call of ue_spec_beamforming
memset(txdataF_BF[aa],0,sizeof(int32_t)*(frame_parms->ofdm_symbol_size));
for (p=0; p<NB_ANTENNA_PORTS_ENB; p++) {
if (p<frame_parms->nb_antenna_ports_eNB || p==5) {
multadd_cpx_vector((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size],
(int16_t*)beam_weights[p][aa],
(int16_t*)&txdataF_BF[aa][symbol*frame_parms->ofdm_symbol_size],
0,
frame_parms->ofdm_symbol_size,
15);
//mult_cpx_conj_vector((int16_t*)beam_weights[p][aa], (int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size], (int16_t*)txdataF_BF[aa], frame_parms->ofdm_symbol_size, 15, 1);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_MULTADD,1);
// if check version
/*for (re=0;re<frame_parms->ofdm_symbol_size;re++) {
if (txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re]!=0) {
((int16_t*)&txdataF_BF[aa][re])[0] += (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[p][aa][re])[0])>>15);
((int16_t*)&txdataF_BF[aa][re])[0] -= (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[p][aa][re])[1])>>15);
((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[p][aa][re])[1])>>15);
((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[p][aa][re])[0])>>15);
multadd_cpx_vector((int16_t*)&txdataF[p][rb_offset_neg+(symbol*frame_parms->ofdm_symbol_size)],
(int16_t*)&beam_weights[p][aa][rb_offset_neg],
(int16_t*)&txdataF_BF[aa][rb_offset_neg+(symbol*frame_parms->ofdm_symbol_size)],
0,
6*frame_parms->N_RB_DL,
15);
multadd_cpx_vector((int16_t*)&txdataF[p][(symbol*frame_parms->ofdm_symbol_size)],
(int16_t*)&beam_weights[p][aa][0],
(int16_t*)&txdataF_BF[aa][(symbol*frame_parms->ofdm_symbol_size)],
0,
7*frame_parms->N_RB_DL, // to allow for extra RE at the end, 12 useless multipy-adds (first one at DC and 11 at end)
15);
/*
if (last_prb == 1 && rb>=(frame_parms->N_RB_DL/2)) {
// do extra complex multiplication for remaining RE
uint16_t re = frame_parms->ofdm_symbol_size-1;
((int16_t*)&txdataF_BF[aa][(rb_offset+1)+re])[0] += (int16_t)((((int16_t*)&txdataF[p][(rb_offset+1)+(symbol*frame_parms->ofdm_symbol_size)+re])[0]*((int16_t*)&beam_weights[p][aa][(rb_offset+1)+re])[0])>>15);
((int16_t*)&txdataF_BF[aa][(rb_offset+1)+re])[0] -= (int16_t)((((int16_t*)&txdataF[p][(rb_offset+1)+(symbol*frame_parms->ofdm_symbol_size)+re])[1]*((int16_t*)&beam_weights[p][aa][(rb_offset+1)+re])[1])>>15);
((int16_t*)&txdataF_BF[aa][(rb_offset+1)+re])[1] += (int16_t)((((int16_t*)&txdataF[p][(rb_offset+1)+(symbol*frame_parms->ofdm_symbol_size)+re])[0]*((int16_t*)&beam_weights[p][aa][(rb_offset+1)+re])[1])>>15);
((int16_t*)&txdataF_BF[aa][(rb_offset+1)+re])[1] += (int16_t)((((int16_t*)&txdataF[p][(rb_offset+1)+(symbol*frame_parms->ofdm_symbol_size)+re])[1]*((int16_t*)&beam_weights[p][aa][(rb_offset+1)+re])[0])>>15);
}
*/
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_MULTADD,0);
printf("beamforming.c:txdataF[%d][%d]=%d+j%d, beam_weights[%d][%d][%d]=%d+j%d,txdata_BF[%d][%d]=%d+j%d\n",
p,slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re,
((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0],
((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1],
p,aa,re,
((int16_t*)&beam_weights[p][aa][re])[0],((int16_t*)&beam_weights[p][aa][re])[1],
aa,re,
((int16_t*)&txdataF_BF[aa][re])[0],
((int16_t*)&txdataF_BF[aa][re])[1]);
}
}*/
}
}
return 0;
return 0;
}
......
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