Fixed bug in PUSCH and PUCCH decoding

master
Ismael Gomez 8 years ago
parent 2985a68e91
commit fe867af319

@ -1,15 +1,16 @@
clear
ueConfig=struct('NCellID',1,'RNTI',11,'NULRB',25,'NSubframe',0,'CyclicPrefixUL','Normal','NTxAnts',1,'Hopping','Off');
pucchConfig=struct('NLayers',1,'OrthCover','Off','Shortened',0,'ResourceSize',2);
ueConfig=struct('NCellID',1,'RNTI',46,'NULRB',25,'CyclicPrefixUL','Normal','NTxAnts',1,'Hopping','Off');
pucchConfig=struct('NLayers',1,'OrthCover','Off','Shortened',0);
format_str={'1','1a'};
threshold=[0.5 0];
formats=[1];
formats=1;
pucchConfig.ResourceIdx= 0;
pucchConfig.DeltaShift = 1;
pucchConfig.DeltaShift = 2;
pucchConfig.CyclicShifts = 0;
ueConfig.NSubframe=0;
pucchConfig.ResourceSize=2;
ueConfig.NSubframe=9;
enable_fading=false;

@ -102,6 +102,8 @@ typedef struct SRSLTE_API {
float threshold_format1;
float threshold_format1a;
float last_corr;
uint32_t last_n_prb;
uint32_t last_n_pucch;
}srslte_pucch_t;

@ -237,6 +237,8 @@ void srslte_refsignal_ul_set_cfg(srslte_refsignal_ul_t *q,
if (pucch_cfg) {
if (srslte_pucch_cfg_isvalid(pucch_cfg, q->cell.nof_prb)) {
memcpy(&q->pucch_cfg, pucch_cfg, sizeof(srslte_pucch_cfg_t));
} else {
fprintf(stderr, "Invalid PUCCH configuration in refsignal_ul\n");
}
}
if (srs_cfg) {

@ -259,11 +259,7 @@ int srslte_enb_ul_get_pucch(srslte_enb_ul_t *q, uint16_t rnti,
// Save ACK bits
if (uci_data->uci_ack_len > 0) {
if (ret_val > 0) {
uci_data->uci_ack = bits[0];
} else {
uci_data->uci_ack = 0;
}
}
return SRSLTE_SUCCESS;
} else {

@ -67,7 +67,7 @@ float w_n_oc[2][3][4] = {
bool srslte_pucch_cfg_isvalid(srslte_pucch_cfg_t *cfg, uint32_t nof_prb) {
if (cfg->delta_pucch_shift > 0 && cfg->delta_pucch_shift < 4 &&
cfg->N_cs < 8 && (cfg->N_cs%cfg->delta_pucch_shift) == 0 &&
cfg->n_rb_2 < nof_prb) {
cfg->n_rb_2 <= nof_prb) {
return true;
} else {
return false;
@ -377,7 +377,7 @@ static int pucch_cp(srslte_pucch_t *q, srslte_pucch_format_t format, uint32_t n_
// Determine n_prb
uint32_t n_prb = srslte_pucch_n_prb(&q->pucch_cfg, format, n_pucch, q->cell.nof_prb, q->cell.cp, ns);
q->last_n_prb = n_prb;
if (n_prb < q->cell.nof_prb) {
for (uint32_t i=0;i<N_sf;i++) {
uint32_t l = get_pucch_symbol(i, format, q->cell.cp);
@ -654,6 +654,8 @@ int srslte_pucch_encode(srslte_pucch_t* q, srslte_pucch_format_t format,
}
}
q->last_n_pucch = n_pucch;
if (format >= SRSLTE_PUCCH_FORMAT_2 && !q->rnti_is_set) {
fprintf(stderr, "Error encoding PUCCH: C-RNTI must be set before encoding PUCCH Format 2/2a/2b\n");
return SRSLTE_ERROR;
@ -700,6 +702,8 @@ int srslte_pucch_decode(srslte_pucch_t* q, srslte_pucch_format_t format,
}
}
q->last_n_pucch = n_pucch;
if (format >= SRSLTE_PUCCH_FORMAT_2 && !q->rnti_is_set) {
fprintf(stderr, "Error decoding PUCCH: C-RNTI must be set before encoding PUCCH Format 2/2a/2b\n");
return SRSLTE_ERROR;
@ -731,6 +735,7 @@ int srslte_pucch_decode(srslte_pucch_t* q, srslte_pucch_format_t format,
} else {
ret = 0;
}
q->last_corr = corr;
DEBUG("format1 corr=%f, nof_re=%d, th=%f\n", corr, nof_re, q->threshold_format1);
break;
case SRSLTE_PUCCH_FORMAT_1A:
@ -740,15 +745,32 @@ int srslte_pucch_decode(srslte_pucch_t* q, srslte_pucch_format_t format,
bits[0] = b;
pucch_encode(q, format, n_pucch, sf_idx, bits, q->z_tmp);
corr = crealf(srslte_vec_dot_prod_conj_ccc(q->z, q->z_tmp, nof_re))/nof_re;
if (corr > corr_max && corr >= q->threshold_format1a) {
if (corr > corr_max) {
corr_max = corr;
b_max = b;
}
if (corr_max > q->threshold_format1a) {
if (corr_max > q->threshold_format1) { // check with format1 in case ack+sr because ack only is binary
ret = 1;
}
DEBUG("format1a b=%d, corr=%f, nof_re=%d, th=%f\n", b, corr, nof_re, q->threshold_format1a);
}
q->last_corr = corr_max;
/*
if (corr_max < 0.01) {
srslte_vec_save_file("sf_symbols", sf_symbols, sizeof(cf_t)*SRSLTE_SF_LEN_RE(q->cell.nof_prb, q->cell.cp));
srslte_vec_save_file("sf_ce", ce, sizeof(cf_t)*SRSLTE_SF_LEN_RE(q->cell.nof_prb, q->cell.cp));
srslte_vec_save_file("ce", q->ce, sizeof(cf_t)*nof_re);
srslte_vec_save_file("z_before", zz, sizeof(cf_t)*nof_re);
srslte_vec_save_file("z_eq", q->z, sizeof(cf_t)*nof_re);
srslte_vec_save_file("z_1", q->z_tmp, sizeof(cf_t)*nof_re);
bits[0] = 0;
pucch_encode(q, format, n_pucch, sf_idx, bits, q->z_tmp);
srslte_vec_save_file("z_0", q->z_tmp, sizeof(cf_t)*nof_re);
printf("corr_max=%f, b_max=%d, n_pucch=%d, n_prb=%d, sf_idx=%d, nof_re=%d, noise_estimate=%f\n", corr_max, b_max, n_pucch, q->last_n_prb, sf_idx, nof_re, noise_estimate);
exit(-1);
}
*/
bits[0] = b_max;
break;
default:
@ -756,7 +778,6 @@ int srslte_pucch_decode(srslte_pucch_t* q, srslte_pucch_format_t format,
ret = SRSLTE_ERROR;
break;
}
q->last_corr = corr;
}
return ret;

@ -554,7 +554,6 @@ int srslte_pusch_decode(srslte_pusch_t *q,
srslte_scrambling_s_offset(seq, q->q, 0, cfg->nbits.nof_bits);
if (!q->users[rnti]) {
srslte_scrambling_s_offset(seq, q->q, 0, cfg->nbits.nof_bits);
srslte_sequence_free(seq);
}

Loading…
Cancel
Save