Commit b8c12705 authored by Florian Kaltenberger's avatar Florian Kaltenberger

Merge remote-tracking branch 'origin/develop-nr' into nr_pdcch_updates

Conflicts:
	openair1/PHY/MODULATION/slot_fep_nr.c
	openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c
	targets/RT/USER/nr-ue.c
parents a0473b4d b4d7c62d
...@@ -212,7 +212,7 @@ pipeline { ...@@ -212,7 +212,7 @@ pipeline {
steps { steps {
gitlabCommitStatus(name: "Build eNb-ethernet") { gitlabCommitStatus(name: "Build eNb-ethernet") {
timeout (time: 20, unit: 'MINUTES') { timeout (time: 20, unit: 'MINUTES') {
sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
} }
} }
} }
...@@ -221,7 +221,7 @@ pipeline { ...@@ -221,7 +221,7 @@ pipeline {
steps { steps {
gitlabCommitStatus(name: "Build UE-ethernet") { gitlabCommitStatus(name: "Build UE-ethernet") {
timeout (time: 20, unit: 'MINUTES') { timeout (time: 20, unit: 'MINUTES') {
sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
} }
} }
} }
......
...@@ -252,8 +252,9 @@ case $key in ...@@ -252,8 +252,9 @@ case $key in
VM_NAME=ci-phy-sim VM_NAME=ci-phy-sim
ARCHIVES_LOC=phy_sim ARCHIVES_LOC=phy_sim
LOG_PATTERN=.Rel15.txt LOG_PATTERN=.Rel15.txt
NB_PATTERN_FILES=7 NB_PATTERN_FILES=8
BUILD_OPTIONS="--phy_simulators" BUILD_OPTIONS="--phy_simulators"
VM_MEMORY=4096
RUN_OPTIONS="./run_exec_autotests.bash -g \"01510*\" -q -np -b" RUN_OPTIONS="./run_exec_autotests.bash -g \"01510*\" -q -np -b"
NBARGS=$[$NBARGS+256] NBARGS=$[$NBARGS+256]
shift shift
...@@ -330,8 +331,9 @@ case $key in ...@@ -330,8 +331,9 @@ case $key in
VM_NAME=ci-phy-sim VM_NAME=ci-phy-sim
ARCHIVES_LOC=phy_sim ARCHIVES_LOC=phy_sim
LOG_PATTERN=.Rel15.txt LOG_PATTERN=.Rel15.txt
NB_PATTERN_FILES=7 NB_PATTERN_FILES=8
BUILD_OPTIONS="--phy_simulators" BUILD_OPTIONS="--phy_simulators"
VM_MEMORY=4096
RUN_OPTIONS="./run_exec_autotests.bash -g \"01510*\" -q -np -b" RUN_OPTIONS="./run_exec_autotests.bash -g \"01510*\" -q -np -b"
NBARGS=$[$NBARGS+256] NBARGS=$[$NBARGS+256]
;; ;;
......
...@@ -165,6 +165,10 @@ function check_on_vm_build { ...@@ -165,6 +165,10 @@ function check_on_vm_build {
fi fi
done done
if [ $NB_PATTERN_FILES -ne $NB_FOUND_FILES ]; then STATUS=-1; fi if [ $NB_PATTERN_FILES -ne $NB_FOUND_FILES ]
then
echo "Expecting $NB_PATTERN_FILES log files and found $NB_FOUND_FILES"
STATUS=-1
fi
} }
...@@ -1065,12 +1065,12 @@ ...@@ -1065,12 +1065,12 @@
<pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</pre_exec> <pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</pre_exec>
<pre_exec_args></pre_exec_args> <pre_exec_args></pre_exec_args>
<main_exec> $OPENAIR_DIR/targets/bin/nr_pbchsim.Rel15</main_exec> <main_exec> $OPENAIR_DIR/targets/bin/nr_pbchsim.Rel15</main_exec>
<main_exec_args>-s-11 -S-10 -n1000 -R106 <main_exec_args>-s0 -S1 -n1000 -R106
-s-11 -S-10 -n10 -I -R106 -s0 -S1 -n10 -I -R106
-s-11 -S-10 -n1000 -R217 -N10 -s0 -S1 -n1000 -R217
-s-11 -S-10 -n10 -I -R217 -N10 -s0 -S1 -n10 -I -R217
-s-11 -S-10 -n1000 -R273 -N20 -s0 -S1 -n1000 -R273
-s-11 -S-10 -n10 -I -R273 -N20</main_exec_args> -s0 -S1 -n10 -I -R273</main_exec_args>
<tags>nr_pbchsim.test1 nr_pbchsim.test2</tags> <tags>nr_pbchsim.test1 nr_pbchsim.test2</tags>
<search_expr_true>PBCH test OK</search_expr_true> <search_expr_true>PBCH test OK</search_expr_true>
<search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false> <search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
......
...@@ -696,7 +696,7 @@ function main() { ...@@ -696,7 +696,7 @@ function main() {
echo_info "Compiling unitary tests simulators" echo_info "Compiling unitary tests simulators"
# TODO: fix: dlsim_tm4 pucchsim prachsim pdcchsim pbchsim mbmssim # TODO: fix: dlsim_tm4 pucchsim prachsim pdcchsim pbchsim mbmssim
#simlist="dlsim_tm4 dlsim ulsim pucchsim prachsim pdcchsim pbchsim mbmssim" #simlist="dlsim_tm4 dlsim ulsim pucchsim prachsim pdcchsim pbchsim mbmssim"
simlist="dlsim ulsim polartest ldpctest nr_pbchsim nr_dlschsim" simlist="dlsim ulsim polartest ldpctest nr_pbchsim nr_dlschsim nr_dlsim"
for f in $simlist ; do for f in $simlist ; do
compilations \ compilations \
phy_simulators $f \ phy_simulators $f \
......
...@@ -467,33 +467,26 @@ void nr_interleaving_ldpc(uint32_t E, uint8_t Qm, uint8_t *e,uint8_t *f); ...@@ -467,33 +467,26 @@ void nr_interleaving_ldpc(uint32_t E, uint8_t Qm, uint8_t *e,uint8_t *f);
void nr_deinterleaving_ldpc(uint32_t E, uint8_t Qm, int16_t *e,int16_t *f); void nr_deinterleaving_ldpc(uint32_t E, uint8_t Qm, int16_t *e,int16_t *f);
uint32_t nr_rate_matching_ldpc(uint8_t Ilbrm, int nr_rate_matching_ldpc(uint8_t Ilbrm,
uint32_t Tbslbrm, uint32_t Tbslbrm,
uint8_t BG, uint8_t BG,
uint16_t Z, uint16_t Z,
uint32_t G, uint8_t *w,
uint8_t *w, uint8_t *e,
uint8_t *e, uint8_t C,
uint8_t C, uint8_t rvidx,
uint8_t rvidx, uint32_t E);
uint8_t Qm,
uint8_t Nl,
uint8_t r);
int nr_rate_matching_ldpc_rx(uint8_t Ilbrm, int nr_rate_matching_ldpc_rx(uint8_t Ilbrm,
uint32_t Tbslbrm, uint32_t Tbslbrm,
uint8_t BG, uint8_t BG,
uint16_t Z, uint16_t Z,
uint32_t G,
int16_t *w, int16_t *w,
int16_t *soft_input, int16_t *soft_input,
uint8_t C, uint8_t C,
uint8_t rvidx, uint8_t rvidx,
uint8_t clear, uint8_t clear,
uint8_t Qm, uint32_t E);
uint8_t Nl,
uint8_t r,
uint32_t *E_out);
decoder_if_t phy_threegpplte_turbo_decoder; decoder_if_t phy_threegpplte_turbo_decoder;
decoder_if_t phy_threegpplte_turbo_decoder8; decoder_if_t phy_threegpplte_turbo_decoder8;
......
...@@ -63,55 +63,39 @@ void nr_deinterleaving_ldpc(uint32_t E, uint8_t Qm, int16_t *e,int16_t *f) ...@@ -63,55 +63,39 @@ void nr_deinterleaving_ldpc(uint32_t E, uint8_t Qm, int16_t *e,int16_t *f)
} }
uint32_t nr_rate_matching_ldpc(uint8_t Ilbrm, int nr_rate_matching_ldpc(uint8_t Ilbrm,
uint32_t Tbslbrm, uint32_t Tbslbrm,
uint8_t BG, uint8_t BG,
uint16_t Z, uint16_t Z,
uint32_t G, uint8_t *w,
uint8_t *w, uint8_t *e,
uint8_t *e, uint8_t C,
uint8_t C, uint8_t rvidx,
uint8_t rvidx, uint32_t E)
uint8_t Qm,
uint8_t Nl,
uint8_t r)
{ {
uint8_t Cprime; uint32_t Ncb,ind,k,Nref,N;
uint32_t Ncb,E,ind,k,Nref,N;
//uint8_t *e2;
AssertFatal(Nl>0,"Nl is 0\n"); if (C==0) {
AssertFatal(Qm>0,"Qm is 0\n"); printf("nr_rate_matching: invalid parameters (C %d\n",C);
return -1;
}
//Bit selection //Bit selection
N = (BG==1)?(66*Z):(50*Z); N = (BG==1)?(66*Z):(50*Z);
if (Ilbrm == 0) if (Ilbrm == 0)
Ncb = N; Ncb = N;
else { else {
Nref = 3*Tbslbrm/(2*C); //R_LBRM = 2/3 Nref = 3*Tbslbrm/(2*C); //R_LBRM = 2/3
Ncb = min(N, Nref); Ncb = min(N, Nref);
} }
#ifdef RM_DEBUG
printf("nr_rate_matching: Ncb %d, rvidx %d, G %d, Qm %d, Nl%d, r %d\n",Ncb,rvidx, G, Qm,Nl,r);
#endif
Cprime = C; //assume CBGTI not present
if (r <= Cprime - ((G/(Nl*Qm))%Cprime) - 1)
E = Nl*Qm*(G/(Nl*Qm*Cprime));
else
E = Nl*Qm*((G/(Nl*Qm*Cprime))+1);
ind = (index_k0[BG-1][rvidx]*Ncb/N)*Z; ind = (index_k0[BG-1][rvidx]*Ncb/N)*Z;
#ifdef RM_DEBUG #ifdef RM_DEBUG
printf("nr_rate_matching: E %d, k0 %d Cprime %d modcprime %d\n",E,ind, Cprime,((G/(Nl*Qm))%Cprime)); printf("nr_rate_matching_ldpc: E %d, k0 %d, Ncb %d, rvidx %d\n", E, ind, Ncb, rvidx);
#endif #endif
//e2 = e;
k=0; k=0;
for (; (ind<Ncb)&&(k<E); ind++) { for (; (ind<Ncb)&&(k<E); ind++) {
...@@ -120,7 +104,6 @@ uint32_t nr_rate_matching_ldpc(uint8_t Ilbrm, ...@@ -120,7 +104,6 @@ uint32_t nr_rate_matching_ldpc(uint8_t Ilbrm,
printf("RM_TX k%d Ind: %d (%d)\n",k,ind,w[ind]); printf("RM_TX k%d Ind: %d (%d)\n",k,ind,w[ind]);
#endif #endif
//if (w[ind] != NR_NULL) e2[k++]=w[ind];
if (w[ind] != NR_NULL) e[k++]=w[ind]; if (w[ind] != NR_NULL) e[k++]=w[ind];
} }
...@@ -131,79 +114,60 @@ uint32_t nr_rate_matching_ldpc(uint8_t Ilbrm, ...@@ -131,79 +114,60 @@ uint32_t nr_rate_matching_ldpc(uint8_t Ilbrm,
printf("RM_TX k%d Ind: %d (%d)\n",k,ind,w[ind]); printf("RM_TX k%d Ind: %d (%d)\n",k,ind,w[ind]);
#endif #endif
//if (w[ind] != NR_NULL) e2[k++]=w[ind];
if (w[ind] != NR_NULL) e[k++]=w[ind]; if (w[ind] != NR_NULL) e[k++]=w[ind];
} }
} }
return(E); return 0;
} }
int nr_rate_matching_ldpc_rx(uint8_t Ilbrm, int nr_rate_matching_ldpc_rx(uint8_t Ilbrm,
uint32_t Tbslbrm, uint32_t Tbslbrm,
uint8_t BG, uint8_t BG,
uint16_t Z, uint16_t Z,
uint32_t G,
int16_t *w, int16_t *w,
int16_t *soft_input, int16_t *soft_input,
uint8_t C, uint8_t C,
uint8_t rvidx, uint8_t rvidx,
uint8_t clear, uint8_t clear,
uint8_t Qm, uint32_t E)
uint8_t Nl,
uint8_t r,
uint32_t *E_out)
{ {
uint8_t Cprime; uint32_t Ncb,ind,k,Nref,N;
uint32_t Ncb,E,ind,k,Nref,N;
int16_t *soft_input2;
#ifdef RM_DEBUG #ifdef RM_DEBUG
int nulled=0; int nulled=0;
#endif #endif
if (C==0 || Qm==0 || Nl==0) { if (C==0) {
printf("nr_rate_matching: invalid parameters (C %d, Qm %d, Nl %d\n",C,Qm,Nl); printf("nr_rate_matching: invalid parameters (C %d\n",C);
return(-1); return -1;
} }
AssertFatal(Nl>0,"Nl is 0\n");
AssertFatal(Qm>0,"Qm is 0\n");
//Bit selection //Bit selection
N = (BG==1)?(66*Z):(50*Z); N = (BG==1)?(66*Z):(50*Z);
if (Ilbrm == 0) if (Ilbrm == 0)
Ncb = N; Ncb = N;
else { else {
Nref = (3*Tbslbrm/(2*C)); //R_LBRM = 2/3 Nref = (3*Tbslbrm/(2*C)); //R_LBRM = 2/3
Ncb = min(N, Nref); Ncb = min(N, Nref);
} }
Cprime = C; //assume CBGTI not present
if (r <= Cprime - ((G/(Nl*Qm))%Cprime) - 1)
E = Nl*Qm*(G/(Nl*Qm*Cprime));
else
E = Nl*Qm*((G/(Nl*Qm*Cprime))+1);
ind = (index_k0[BG-1][rvidx]*Ncb/N)*Z; ind = (index_k0[BG-1][rvidx]*Ncb/N)*Z;
#ifdef RM_DEBUG #ifdef RM_DEBUG
printf("nr_rate_matching_ldpc_rx: Clear %d, E %d, Ncb %d,rvidx %d, G %d, Qm %d, Nl%d, r %d\n",clear,E,Ncb,rvidx, G, Qm,Nl,r); printf("nr_rate_matching_ldpc_rx: Clear %d, E %d, k0 %d, Ncb %d, rvidx %d\n", clear, E, ind, Ncb, rvidx);
#endif #endif
if (clear==1) if (clear==1)
memset(w,0,Ncb*sizeof(int16_t)); memset(w,0,Ncb*sizeof(int16_t));
soft_input2 = soft_input;
k=0; k=0;
for (; (ind<Ncb)&&(k<E); ind++) { for (; (ind<Ncb)&&(k<E); ind++) {
if (soft_input2[ind] != NR_NULL) { if (soft_input[ind] != NR_NULL) {
w[ind] += soft_input2[k++]; w[ind] += soft_input[k++];
#ifdef RM_DEBUG #ifdef RM_DEBUG
printf("RM_RX k%d Ind: %d (%d)\n",k-1,ind,w[ind]); printf("RM_RX k%d Ind: %d (%d)\n",k-1,ind,w[ind]);
#endif #endif
...@@ -220,10 +184,10 @@ int nr_rate_matching_ldpc_rx(uint8_t Ilbrm, ...@@ -220,10 +184,10 @@ int nr_rate_matching_ldpc_rx(uint8_t Ilbrm,
while(k<E) { while(k<E) {
for (ind=0; (ind<Ncb)&&(k<E); ind++) { for (ind=0; (ind<Ncb)&&(k<E); ind++) {
if (soft_input2[ind] != NR_NULL) { if (soft_input[ind] != NR_NULL) {
w[ind] += soft_input2[k++]; w[ind] += soft_input[k++];
#ifdef RM_DEBUG #ifdef RM_DEBUG
printf("RM_RX k%d Ind: %d (%d)(soft in %d)\n",k-1,ind,w[ind],soft_input2[k-1]); printf("RM_RX k%d Ind: %d (%d)(soft in %d)\n",k-1,ind,w[ind],soft_input[k-1]);
#endif #endif
} }
...@@ -237,7 +201,5 @@ int nr_rate_matching_ldpc_rx(uint8_t Ilbrm, ...@@ -237,7 +201,5 @@ int nr_rate_matching_ldpc_rx(uint8_t Ilbrm,
} }
} }
*E_out = E; return 0;
return(0);
} }
...@@ -137,7 +137,9 @@ int set_pss_nr(int ofdm_symbol_size); ...@@ -137,7 +137,9 @@ int set_pss_nr(int ofdm_symbol_size);
int pss_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int rate_change); int pss_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int rate_change);
int pss_search_time_nr(int **rxdata, ///rx data in time domain int pss_search_time_nr(int **rxdata, ///rx data in time domain
NR_DL_FRAME_PARMS *frame_parms, NR_DL_FRAME_PARMS *frame_parms,
int *eNB_id); int fo_flag,
int *eNB_id,
int *f_off);
#endif #endif
#undef EXTERN #undef EXTERN
......
...@@ -90,6 +90,8 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t dlsch, ...@@ -90,6 +90,8 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t dlsch,
@param nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs */ @param nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs */
uint32_t nr_get_G(uint16_t nb_rb, uint16_t nb_symb_sch,uint8_t nb_re_dmrs,uint16_t length_dmrs,uint8_t Qm, uint8_t Nl); uint32_t nr_get_G(uint16_t nb_rb, uint16_t nb_symb_sch,uint8_t nb_re_dmrs,uint16_t length_dmrs,uint8_t Qm, uint8_t Nl);
uint32_t nr_get_E(uint32_t G, uint8_t C, uint8_t Qm, uint8_t Nl, uint8_t r);
void free_gNB_dlsch(NR_gNB_DLSCH_t *dlsch); void free_gNB_dlsch(NR_gNB_DLSCH_t *dlsch);
void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch); void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch);
......
...@@ -280,7 +280,7 @@ int nr_dlsch_encoding(unsigned char *a, ...@@ -280,7 +280,7 @@ int nr_dlsch_encoding(unsigned char *a,
uint32_t A, Z; uint32_t A, Z;
uint32_t *pz = &Z; uint32_t *pz = &Z;
uint8_t mod_order = rel15.modulation_order; uint8_t mod_order = rel15.modulation_order;
uint16_t Kr=0,r,r_offset=0;//Kr_bytes uint16_t Kr=0,r,r_offset=0,Kr_bytes;
uint8_t *d_tmp[MAX_NUM_DLSCH_SEGMENTS]; uint8_t *d_tmp[MAX_NUM_DLSCH_SEGMENTS];
uint8_t kb,BG=1; uint8_t kb,BG=1;
uint32_t E; uint32_t E;
...@@ -346,7 +346,7 @@ int nr_dlsch_encoding(unsigned char *a, ...@@ -346,7 +346,7 @@ int nr_dlsch_encoding(unsigned char *a,
} }
Kr = dlsch->harq_processes[harq_pid]->K; Kr = dlsch->harq_processes[harq_pid]->K;
//Kr_bytes = Kr>>3; Kr_bytes = Kr>>3;
//printf("segment Z %d kb %d k %d Kr %d BG %d\n", *pz,kb,dlsch->harq_processes[harq_pid]->K,Kr,BG); //printf("segment Z %d kb %d k %d Kr %d BG %d\n", *pz,kb,dlsch->harq_processes[harq_pid]->K,Kr,BG);
...@@ -403,25 +403,24 @@ int nr_dlsch_encoding(unsigned char *a, ...@@ -403,25 +403,24 @@ int nr_dlsch_encoding(unsigned char *a,
//start_meas(rm_stats); //start_meas(rm_stats);
#ifdef DEBUG_DLSCH_CODING #ifdef DEBUG_DLSCH_CODING
printf("rvidx in encoding = %d\n", dlsch->harq_processes[harq_pid]->rvidx); printf("rvidx in encoding = %d\n", rel15.redundancy_version);
#endif #endif
E = nr_rate_matching_ldpc(Ilbrm, E = nr_get_E(G, dlsch->harq_processes[harq_pid]->C, mod_order, rel15.nb_layers, r);
Tbslbrm,
BG, nr_rate_matching_ldpc(Ilbrm,
*pz, Tbslbrm,
G, BG,
dlsch->harq_processes[harq_pid]->d[r], *pz,
dlsch->harq_processes[harq_pid]->e+r_offset, dlsch->harq_processes[harq_pid]->d[r],
dlsch->harq_processes[harq_pid]->C, dlsch->harq_processes[harq_pid]->e+r_offset,
rel15.redundancy_version, dlsch->harq_processes[harq_pid]->C,
mod_order, rel15.redundancy_version,
rel15.nb_layers, E);
r);
#ifdef DEBUG_DLSCH_CODING #ifdef DEBUG_DLSCH_CODING
for (int i =0; i<16; i++) for (int i =0; i<16; i++)
printf("output ratematching e[%d]= %d r_offset %d\n", i,dlsch->harq_processes[harq_pid]->e[i], r_offset); printf("output ratematching e[%d]= %d r_offset %d\n", i,dlsch->harq_processes[harq_pid]->e[i+r_offset], r_offset);
#endif #endif
//stop_meas(rm_stats); //stop_meas(rm_stats);
...@@ -432,18 +431,15 @@ int nr_dlsch_encoding(unsigned char *a, ...@@ -432,18 +431,15 @@ int nr_dlsch_encoding(unsigned char *a,
dlsch->harq_processes[harq_pid]->f+r_offset); dlsch->harq_processes[harq_pid]->f+r_offset);
//stop_meas(i_stats); //stop_meas(i_stats);
r_offset += E;
#ifdef DEBUG_DLSCH_CODING #ifdef DEBUG_DLSCH_CODING
for (int i =0; i<16; i++) for (int i =0; i<16; i++)
printf("output interleaving f[%d]= %d r_offset %d\n", i,dlsch->harq_processes[harq_pid]->f[i+r*r_offset], r_offset); printf("output interleaving f[%d]= %d r_offset %d\n", i,dlsch->harq_processes[harq_pid]->f[i+r_offset], r_offset);
#endif
#ifdef DEBUG_DLSCH_CODING
if (r==dlsch->harq_processes[harq_pid]->C-1) if (r==dlsch->harq_processes[harq_pid]->C-1)
write_output("enc_output.m","enc",dlsch->harq_processes[harq_pid]->f,r_offset,1,4); write_output("enc_output.m","enc",dlsch->harq_processes[harq_pid]->f,G,1,4);
#endif #endif
r_offset += E;
} }
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_OUT);
......
...@@ -176,3 +176,18 @@ uint32_t nr_get_G(uint16_t nb_rb, uint16_t nb_symb_sch,uint8_t nb_re_dmrs,uint16 ...@@ -176,3 +176,18 @@ uint32_t nr_get_G(uint16_t nb_rb, uint16_t nb_symb_sch,uint8_t nb_re_dmrs,uint16
G = ((NR_NB_SC_PER_RB*nb_symb_sch)-(nb_re_dmrs*length_dmrs))*nb_rb*Qm*Nl; G = ((NR_NB_SC_PER_RB*nb_symb_sch)-(nb_re_dmrs*length_dmrs))*nb_rb*Qm*Nl;
return(G); return(G);
} }
uint32_t nr_get_E(uint32_t G, uint8_t C, uint8_t Qm, uint8_t Nl, uint8_t r) {
uint32_t E;
uint8_t Cprime = C; //assume CBGTI not present
AssertFatal(Nl>0,"Nl is 0\n");
AssertFatal(Qm>0,"Qm is 0\n");
if (r <= Cprime - ((G/(Nl*Qm))%Cprime) - 1)
E = Nl*Qm*(G/(Nl*Qm*Cprime));
else
E = Nl*Qm*((G/(Nl*Qm*Cprime))+1);
return E;
}
...@@ -298,7 +298,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -298,7 +298,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
// generate pilot // generate pilot
nr_pdcch_dmrs_rx(ue,eNB_offset,Ns,ue->nr_gold_pdcch[eNB_offset][Ns][symbol], &pilot[0],2000,nb_rb_coreset); nr_pdcch_dmrs_rx(ue,eNB_offset,Ns,ue->nr_gold_pdcch[eNB_offset][Ns>>1][symbol], &pilot[0],2000,nb_rb_coreset);
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) { for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
......
...@@ -821,8 +821,8 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, ...@@ -821,8 +821,8 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue,
#ifdef NR_PDCCH_DCI_DEBUG #ifdef NR_PDCCH_DCI_DEBUG
printf("\t<-NR_PDCCH_DCI_DEBUG (nr_rx_pdcch)-> symbol_mon=(%d) and start_symbol=(%d)\n",symbol_mon,start_symbol); printf("\t<-NR_PDCCH_DCI_DEBUG (nr_rx_pdcch)-> symbol_mon=(%d) and start_symbol=(%d)\n",symbol_mon,start_symbol);
printf("\t<-NR_PDCCH_DCI_DEBUG (nr_rx_pdcch)-> coreset_freq_dom=(%ld) n_rb_offset=(%d) coreset_time_dur=(%d) n_shift=(%d) reg_bundle_size_L=(%d) coreset_interleaver_size_R=(%d) \n", printf("\t<-NR_PDCCH_DCI_DEBUG (nr_rx_pdcch)-> coreset_freq_dom=(%ld) n_rb_offset=(%d) coreset_time_dur=(%d) n_shift=(%d) reg_bundle_size_L=(%d) coreset_interleaver_size_R=(%d) scrambling_ID=(%d) \n",
coreset_freq_dom,n_rb_offset,coreset_time_dur,n_shift,reg_bundle_size_L,coreset_interleaver_size_R); coreset_freq_dom,n_rb_offset,coreset_time_dur,n_shift,reg_bundle_size_L,coreset_interleaver_size_R,pdcch_DMRS_scrambling_id);
#endif #endif
// //
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
//#include "SCHED/extern.h" //#include "SCHED/extern.h"
#include "common_lib.h" #include "common_lib.h"
#include <math.h>
#include "PHY/NR_REFSIG/pss_nr.h" #include "PHY/NR_REFSIG/pss_nr.h"
#include "PHY/NR_REFSIG/sss_nr.h" #include "PHY/NR_REFSIG/sss_nr.h"
...@@ -56,6 +57,7 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode) ...@@ -56,6 +57,7 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode)
NR_DL_FRAME_PARMS *frame_parms=&ue->frame_parms; NR_DL_FRAME_PARMS *frame_parms=&ue->frame_parms;
int ret =-1; int ret =-1;
#ifdef DEBUG_INITIAL_SYNCH #ifdef DEBUG_INITIAL_SYNCH
LOG_I(PHY,"[UE%d] Initial sync: starting PBCH detection (rx_offset %d)\n",ue->Mod_id, LOG_I(PHY,"[UE%d] Initial sync: starting PBCH detection (rx_offset %d)\n",ue->Mod_id,
ue->rx_offset); ue->rx_offset);
...@@ -65,6 +67,7 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode) ...@@ -65,6 +67,7 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode)
int nb_prefix_samples0 = frame_parms->nb_prefix_samples0; int nb_prefix_samples0 = frame_parms->nb_prefix_samples0;
frame_parms->nb_prefix_samples0 = frame_parms->nb_prefix_samples; frame_parms->nb_prefix_samples0 = frame_parms->nb_prefix_samples;
//symbol 1 //symbol 1
nr_slot_fep(ue, nr_slot_fep(ue,
1, 1,
...@@ -143,6 +146,7 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode) ...@@ -143,6 +146,7 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode)
int32_t sync_pos, sync_pos_slot; // k_ssb, N_ssb_crb, sync_pos2, int32_t sync_pos, sync_pos_slot; // k_ssb, N_ssb_crb, sync_pos2,
int32_t metric_tdd_ncp=0; int32_t metric_tdd_ncp=0;
uint8_t phase_tdd_ncp; uint8_t phase_tdd_ncp;
double im, re;
NR_DL_FRAME_PARMS *fp = &ue->frame_parms; NR_DL_FRAME_PARMS *fp = &ue->frame_parms;
int ret=-1; int ret=-1;
...@@ -183,14 +187,14 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode) ...@@ -183,14 +187,14 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode)
sync_pos = pss_synchro_nr(ue, NO_RATE_CHANGE); sync_pos = pss_synchro_nr(ue, NO_RATE_CHANGE);
sync_pos_slot = (fp->samples_per_subframe/fp->slots_per_subframe) - 10*(fp->ofdm_symbol_size + fp->nb_prefix_samples); sync_pos_slot = (fp->samples_per_subframe/fp->slots_per_subframe) - 10*(fp->ofdm_symbol_size + fp->nb_prefix_samples);
if (sync_pos >= fp->nb_prefix_samples){ if (sync_pos >= fp->nb_prefix_samples){
ue->ssb_offset = sync_pos - fp->nb_prefix_samples;} ue->ssb_offset = sync_pos - fp->nb_prefix_samples;}
else{ else{
ue->ssb_offset = sync_pos + (fp->samples_per_subframe * 10) - fp->nb_prefix_samples;} ue->ssb_offset = sync_pos + (fp->samples_per_subframe * 10) - fp->nb_prefix_samples;}
ue->rx_offset = ue->ssb_offset - sync_pos_slot; ue->rx_offset = ue->ssb_offset - sync_pos_slot;
//write_output("rxdata1.m","rxd1",ue->common_vars.rxdata[0],10*fp->samples_per_subframe,1,1); //write_output("rxdata1.m","rxd1",ue->common_vars.rxdata[0],10*fp->samples_per_subframe,1,1);
#ifdef DEBUG_INITIAL_SYNCH #ifdef DEBUG_INITIAL_SYNCH
...@@ -198,6 +202,25 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode) ...@@ -198,6 +202,25 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode)
LOG_I(PHY,"sync_pos %d ssb_offset %d sync_pos_slot %d \n",sync_pos,ue->ssb_offset,sync_pos_slot); LOG_I(PHY,"sync_pos %d ssb_offset %d sync_pos_slot %d \n",sync_pos,ue->ssb_offset,sync_pos_slot);
#endif #endif
// digital compensation of FFO for SSB symbols
if (ue->UE_fo_compensation){
double s_time = 1/(1.0e3*fp->samples_per_subframe); // sampling time
double off_angle = -2*M_PI*s_time*(ue->common_vars.freq_offset); // offset rotation angle compensation per sample
int start = ue->ssb_offset; // start for offset correction is at ssb_offset (pss time position)
int end = start + 4*(fp->ofdm_symbol_size + fp->nb_prefix_samples); // loop over samples in 4 symbols (ssb size), including prefix