optimization of NR ULSCH unscrambling
This commit is contained in:
@@ -55,5 +55,6 @@ void init_scrambling_luts(void);
|
|||||||
|
|
||||||
extern __m64 byte2m64_re[256];
|
extern __m64 byte2m64_re[256];
|
||||||
extern __m64 byte2m64_im[256];
|
extern __m64 byte2m64_im[256];
|
||||||
|
extern __m128i byte2m128i[256];
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -32,6 +32,8 @@
|
|||||||
__m64 byte2m64_re[256];
|
__m64 byte2m64_re[256];
|
||||||
__m64 byte2m64_im[256];
|
__m64 byte2m64_im[256];
|
||||||
|
|
||||||
|
__m128i byte2m128i[256];
|
||||||
|
|
||||||
void init_byte2m64(void) {
|
void init_byte2m64(void) {
|
||||||
|
|
||||||
for (int s=0;s<256;s++) {
|
for (int s=0;s<256;s++) {
|
||||||
@@ -54,10 +56,24 @@ void init_byte2m64(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void init_byte2m128i(void) {
|
||||||
|
|
||||||
|
for (int s=0;s<256;s++) {
|
||||||
|
byte2m128i[s] = _mm_insert_epi16(byte2m128i[s],(1-2*(s&1)),0);
|
||||||
|
byte2m128i[s] = _mm_insert_epi16(byte2m128i[s],(1-2*((s>>1)&1)),1);
|
||||||
|
byte2m128i[s] = _mm_insert_epi16(byte2m128i[s],(1-2*((s>>2)&1)),2);
|
||||||
|
byte2m128i[s] = _mm_insert_epi16(byte2m128i[s],(1-2*((s>>3)&1)),3);
|
||||||
|
byte2m128i[s] = _mm_insert_epi16(byte2m128i[s],(1-2*((s>>4)&1)),4);
|
||||||
|
byte2m128i[s] = _mm_insert_epi16(byte2m128i[s],(1-2*((s>>5)&1)),5);
|
||||||
|
byte2m128i[s] = _mm_insert_epi16(byte2m128i[s],(1-2*((s>>6)&1)),6);
|
||||||
|
byte2m128i[s] = _mm_insert_epi16(byte2m128i[s],(1-2*((s>>7)&1)),7);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void init_scrambling_luts(void) {
|
void init_scrambling_luts(void) {
|
||||||
|
|
||||||
init_byte2m64();
|
init_byte2m64();
|
||||||
|
init_byte2m128i();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h"
|
#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h"
|
||||||
#include "PHY/NR_TRANSPORT/nr_ulsch.h"
|
#include "PHY/NR_TRANSPORT/nr_ulsch.h"
|
||||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
#include "PHY/NR_REFSIG/nr_refsig.h"
|
||||||
|
|
||||||
int16_t find_nr_ulsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type) {
|
int16_t find_nr_ulsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type) {
|
||||||
|
|
||||||
@@ -103,3 +103,37 @@ void nr_ulsch_unscrambling(int16_t* llr,
|
|||||||
llr[i] = -llr[i];
|
llr[i] = -llr[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nr_ulsch_unscrambling_optim(int16_t* llr,
|
||||||
|
uint32_t size,
|
||||||
|
uint8_t q,
|
||||||
|
uint32_t Nid,
|
||||||
|
uint32_t n_RNTI) {
|
||||||
|
|
||||||
|
#if defined(__x86_64__) || defined(__i386__)
|
||||||
|
uint8_t reset;
|
||||||
|
uint32_t x1, x2, s=0;
|
||||||
|
|
||||||
|
x2 = (n_RNTI<<15) + Nid;
|
||||||
|
|
||||||
|
uint8_t *s8=(uint8_t *)&s;
|
||||||
|
__m128i *llr128 = (__m128i*)llr;
|
||||||
|
int j=0;
|
||||||
|
s = lte_gold_generic(&x1, &x2, 1);
|
||||||
|
|
||||||
|
for (int i=0; i<((size>>5)+((size&0x1f) > 0 ? 1 : 0)); i++,j+=4) {
|
||||||
|
llr128[j] = _mm_mullo_epi16(llr128[j],byte2m128i[s8[0]]);
|
||||||
|
llr128[j+1] = _mm_mullo_epi16(llr128[j+1],byte2m128i[s8[1]]);
|
||||||
|
llr128[j+2] = _mm_mullo_epi16(llr128[j+2],byte2m128i[s8[2]]);
|
||||||
|
llr128[j+3] = _mm_mullo_epi16(llr128[j+3],byte2m128i[s8[3]]);
|
||||||
|
s = lte_gold_generic(&x1, &x2, 0);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
|
nr_ulsch_unscrambling(llr,
|
||||||
|
size,
|
||||||
|
q,
|
||||||
|
Nid,
|
||||||
|
n_RNTI);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
|
|
||||||
#include "T.h"
|
#include "T.h"
|
||||||
|
|
||||||
//#define DEBUG_NR_PUCCH_RX 1
|
#define DEBUG_NR_PUCCH_RX 1
|
||||||
|
|
||||||
NR_gNB_PUCCH_t *new_gNB_pucch(void){
|
NR_gNB_PUCCH_t *new_gNB_pucch(void){
|
||||||
NR_gNB_PUCCH_t *pucch;
|
NR_gNB_PUCCH_t *pucch;
|
||||||
@@ -385,28 +385,28 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
|||||||
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
|
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
|
||||||
if (xrtmag_dB>(gNB->measurements.n0_power_tot_dB+gNB->pucch0_thres)) {
|
if (xrtmag_dB>(gNB->measurements.n0_power_tot_dB+gNB->pucch0_thres)) {
|
||||||
uci_pdu->sr->sr_indication = 1;
|
uci_pdu->sr->sr_indication = 1;
|
||||||
uci_pdu->sr->sr_confidence_level = xrtmag_dB-(gNB->measurements.n0_power_tot_dB+gNB->pucch0_thres);
|
uci_pdu->sr->sr_confidence_level = xrtmag_dB-(gNB->measurements.n0_power_tot_dB+11+gNB->pucch0_thres);
|
||||||
} else {
|
} else {
|
||||||
uci_pdu->sr->sr_indication = 0;
|
uci_pdu->sr->sr_indication = 0;
|
||||||
uci_pdu->sr->sr_confidence_level = (gNB->measurements.n0_power_tot_dB+gNB->pucch0_thres)-xrtmag_dB;
|
uci_pdu->sr->sr_confidence_level = (gNB->measurements.n0_power_tot_dB+11+gNB->pucch0_thres)-xrtmag_dB;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (pucch_pdu->bit_len_harq==1) {
|
else if (pucch_pdu->bit_len_harq==1) {
|
||||||
uci_pdu->harq = calloc(1,sizeof(*uci_pdu->harq));
|
uci_pdu->harq = calloc(1,sizeof(*uci_pdu->harq));
|
||||||
uci_pdu->harq->num_harq = 1;
|
uci_pdu->harq->num_harq = 1;
|
||||||
uci_pdu->harq->harq_confidence_level = xrtmag_dB-(gNB->measurements.n0_power_tot_dB+gNB->pucch0_thres);
|
uci_pdu->harq->harq_confidence_level = xrtmag_dB-(gNB->measurements.n0_power_tot_dB+11+gNB->pucch0_thres);
|
||||||
uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(1);
|
uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(1);
|
||||||
uci_pdu->harq->harq_list[0].harq_value = index&0x01;
|
uci_pdu->harq->harq_list[0].harq_value = index&0x01;
|
||||||
if (pucch_pdu->sr_flag == 1) {
|
if (pucch_pdu->sr_flag == 1) {
|
||||||
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
|
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
|
||||||
uci_pdu->sr->sr_indication = (index>1) ? 1 : 0;
|
uci_pdu->sr->sr_indication = (index>1) ? 1 : 0;
|
||||||
uci_pdu->sr->sr_confidence_level = xrtmag_dB-(gNB->measurements.n0_power_tot_dB+gNB->pucch0_thres);
|
uci_pdu->sr->sr_confidence_level = xrtmag_dB-(gNB->measurements.n0_power_tot_dB+11+gNB->pucch0_thres);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
uci_pdu->harq = calloc(1,sizeof(*uci_pdu->harq));
|
uci_pdu->harq = calloc(1,sizeof(*uci_pdu->harq));
|
||||||
uci_pdu->harq->num_harq = 2;
|
uci_pdu->harq->num_harq = 2;
|
||||||
uci_pdu->harq->harq_confidence_level = xrtmag_dB-(gNB->measurements.n0_power_tot_dB+gNB->pucch0_thres);
|
uci_pdu->harq->harq_confidence_level = xrtmag_dB-(gNB->measurements.n0_power_tot_dB+11+gNB->pucch0_thres);
|
||||||
uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(2);
|
uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(2);
|
||||||
|
|
||||||
uci_pdu->harq->harq_list[1].harq_value = index&0x01;
|
uci_pdu->harq->harq_list[1].harq_value = index&0x01;
|
||||||
@@ -415,7 +415,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
|||||||
if (pucch_pdu->sr_flag == 1) {
|
if (pucch_pdu->sr_flag == 1) {
|
||||||
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
|
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
|
||||||
uci_pdu->sr->sr_indication = (index>3) ? 1 : 0;
|
uci_pdu->sr->sr_indication = (index>3) ? 1 : 0;
|
||||||
uci_pdu->sr->sr_confidence_level = xrtmag_dB-(gNB->measurements.n0_power_tot_dB+gNB->pucch0_thres);
|
uci_pdu->sr->sr_confidence_level = xrtmag_dB-(gNB->measurements.n0_power_tot_dB+11+gNB->pucch0_thres);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -244,11 +244,11 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
|
|||||||
//------------------- ULSCH unscrambling -------------------
|
//------------------- ULSCH unscrambling -------------------
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
start_meas(&gNB->ulsch_unscrambling_stats);
|
start_meas(&gNB->ulsch_unscrambling_stats);
|
||||||
nr_ulsch_unscrambling(gNB->pusch_vars[ULSCH_id]->llr,
|
nr_ulsch_unscrambling_optim(gNB->pusch_vars[ULSCH_id]->llr,
|
||||||
G,
|
G,
|
||||||
0,
|
0,
|
||||||
pusch_pdu->data_scrambling_id,
|
pusch_pdu->data_scrambling_id,
|
||||||
pusch_pdu->rnti);
|
pusch_pdu->rnti);
|
||||||
stop_meas(&gNB->ulsch_unscrambling_stats);
|
stop_meas(&gNB->ulsch_unscrambling_stats);
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
//--------------------- ULSCH decoding ---------------------
|
//--------------------- ULSCH decoding ---------------------
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ int main(int argc, char **argv)
|
|||||||
uint8_t transmission_mode = 1,n_tx=1,n_rx=1;
|
uint8_t transmission_mode = 1,n_tx=1,n_rx=1;
|
||||||
uint16_t Nid_cell=0;
|
uint16_t Nid_cell=0;
|
||||||
uint64_t SSB_positions=0x01;
|
uint64_t SSB_positions=0x01;
|
||||||
channel_desc_t *gNB2UE;
|
channel_desc_t *UE2gNB;
|
||||||
int format=0;
|
int format=0;
|
||||||
//uint8_t extended_prefix_flag=0;
|
//uint8_t extended_prefix_flag=0;
|
||||||
FILE *input_fd=NULL;
|
FILE *input_fd=NULL;
|
||||||
@@ -100,6 +100,8 @@ int main(int argc, char **argv)
|
|||||||
uint16_t nrofPRB=2;
|
uint16_t nrofPRB=2;
|
||||||
uint8_t timeDomainOCC=0;
|
uint8_t timeDomainOCC=0;
|
||||||
SCM_t channel_model=AWGN;//Rayleigh1_anticorr;
|
SCM_t channel_model=AWGN;//Rayleigh1_anticorr;
|
||||||
|
|
||||||
|
double DS_TDL = .03;
|
||||||
|
|
||||||
int N_RB_DL=273,mu=1;
|
int N_RB_DL=273,mu=1;
|
||||||
float target_error_rate=0.001;
|
float target_error_rate=0.001;
|
||||||
@@ -162,6 +164,20 @@ int main(int argc, char **argv)
|
|||||||
case 'G':
|
case 'G':
|
||||||
channel_model=ETU;
|
channel_model=ETU;
|
||||||
break;
|
break;
|
||||||
|
case 'H':
|
||||||
|
channel_model = TDL_C;
|
||||||
|
DS_TDL = .030; // 30 ns
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'I':
|
||||||
|
channel_model = TDL_C;
|
||||||
|
DS_TDL = .3; // 300ns
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'J':
|
||||||
|
channel_model=TDL_D;
|
||||||
|
DS_TDL = .03;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printf("Unsupported channel model!\n");
|
printf("Unsupported channel model!\n");
|
||||||
@@ -402,9 +418,9 @@ int main(int argc, char **argv)
|
|||||||
printf("FFO = %lf; IFO = %d\n",eps-IFO,IFO);
|
printf("FFO = %lf; IFO = %d\n",eps-IFO,IFO);
|
||||||
}
|
}
|
||||||
|
|
||||||
gNB2UE = new_channel_desc_scm(n_tx, n_rx, channel_model, fs, bw, 0, 0, 0);
|
UE2gNB = new_channel_desc_scm(n_tx, n_rx, channel_model, fs, bw, DS_TDL,0, 0, 0);
|
||||||
|
|
||||||
if (gNB2UE==NULL) {
|
if (UE2gNB==NULL) {
|
||||||
printf("Problem generating channel model. Exiting.\n");
|
printf("Problem generating channel model. Exiting.\n");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user