Fixed number of codewords in format2

master
Ismael Gomez 8 years ago
parent 3f92feea9c
commit ac31169088

@ -106,6 +106,7 @@ typedef struct SRSLTE_API {
uint32_t Qm2; uint32_t Qm2;
srslte_ra_mcs_t mcs; srslte_ra_mcs_t mcs;
srslte_ra_mcs_t mcs2; srslte_ra_mcs_t mcs2;
uint32_t nof_tb;
} srslte_ra_dl_grant_t; } srslte_ra_dl_grant_t;
/** Unpacked DCI message for DL grant */ /** Unpacked DCI message for DL grant */
@ -134,7 +135,7 @@ typedef struct SRSLTE_API {
uint8_t tpc_pucch; uint8_t tpc_pucch;
uint32_t nof_tb; bool tb_en[2];
bool dci_is_1a; bool dci_is_1a;
bool dci_is_1c; bool dci_is_1c;

@ -625,7 +625,8 @@ int dci_format1_unpack(srslte_dci_msg_t *msg, srslte_ra_dl_dci_t *data, uint32_t
// TPC not implemented // TPC not implemented
data->nof_tb = 1; data->tb_en[0] = true;
data->tb_en[1] = false;
return SRSLTE_SUCCESS; return SRSLTE_SUCCESS;
} }
@ -814,7 +815,8 @@ int dci_format1As_unpack(srslte_dci_msg_t *msg, srslte_ra_dl_dci_t *data, uint32
data->type2_alloc.n_prb1a = *y++; // LSB indicates N_prb_1a for TBS data->type2_alloc.n_prb1a = *y++; // LSB indicates N_prb_1a for TBS
} }
data->nof_tb = 1; data->tb_en[0] = true;
data->tb_en[1] = false;
return SRSLTE_SUCCESS; return SRSLTE_SUCCESS;
} }
@ -860,7 +862,8 @@ int dci_format1B_unpack(srslte_dci_msg_t *msg, srslte_ra_dl_dci_t *data, uint32_
data->pinfo = srslte_bit_pack(&y, tpmi_bits(nof_ports)); data->pinfo = srslte_bit_pack(&y, tpmi_bits(nof_ports));
data->pconf = *y++ ? true : false; data->pconf = *y++ ? true : false;
data->nof_tb = 1; data->tb_en[0] = true;
data->tb_en[1] = false;
return SRSLTE_SUCCESS; return SRSLTE_SUCCESS;
} }
@ -955,7 +958,8 @@ int dci_format1Cs_unpack(srslte_dci_msg_t *msg, srslte_ra_dl_dci_t *data, uint32
msg->nof_bits = (y - msg->data); msg->nof_bits = (y - msg->data);
data->nof_tb = 1; data->tb_en[0] = true;
data->tb_en[1] = false;
return SRSLTE_SUCCESS; return SRSLTE_SUCCESS;
} }
@ -1001,7 +1005,8 @@ int dci_format1D_unpack(srslte_dci_msg_t *msg, srslte_ra_dl_dci_t *data, uint32_
data->pinfo = srslte_bit_pack(&y, tpmi_bits(nof_ports)); data->pinfo = srslte_bit_pack(&y, tpmi_bits(nof_ports));
data->power_offset = *y++ ? true : false; data->power_offset = *y++ ? true : false;
data->nof_tb = 1; data->tb_en[0] = true;
data->tb_en[1] = false;
return SRSLTE_SUCCESS; return SRSLTE_SUCCESS;
} }
@ -1051,16 +1056,23 @@ int dci_format2AB_unpack(srslte_dci_msg_t *msg, srslte_ra_dl_dci_t *data, uint32
/* unpack MCS according to 7.1.7 of 36.213 */ /* unpack MCS according to 7.1.7 of 36.213 */
data->mcs_idx = srslte_bit_pack(&y, 5); data->mcs_idx = srslte_bit_pack(&y, 5);
data->ndi = *y++ ? true : false; data->ndi = *y++ ? true : false;
// rv version
data->rv_idx = srslte_bit_pack(&y, 2); data->rv_idx = srslte_bit_pack(&y, 2);
if (data->mcs_idx == 0 && data->rv_idx == 1) {
data->tb_en[0] = false;
} else {
data->tb_en[0] = true;
}
// same for tb1 // same for tb1
data->mcs_idx_1 = srslte_bit_pack(&y, 5); data->mcs_idx_1 = srslte_bit_pack(&y, 5);
data->ndi_1 = *y++ ? true : false; data->ndi_1 = *y++ ? true : false;
data->rv_idx_1 = srslte_bit_pack(&y, 2); data->rv_idx_1 = srslte_bit_pack(&y, 2);
if (data->mcs_idx_1 == 0 && data->rv_idx_1 == 1) {
data->tb_en[1] = false;
} else {
data->tb_en[1] = true;
}
// Precoding information // Precoding information
if (msg->format == SRSLTE_DCI_FORMAT2A) { if (msg->format == SRSLTE_DCI_FORMAT2A) {
@ -1069,7 +1081,6 @@ int dci_format2AB_unpack(srslte_dci_msg_t *msg, srslte_ra_dl_dci_t *data, uint32
data->pinfo = srslte_bit_pack(&y, precoding_bits_f2a(nof_ports)); data->pinfo = srslte_bit_pack(&y, precoding_bits_f2a(nof_ports));
} }
data->nof_tb = 2;
return SRSLTE_SUCCESS; return SRSLTE_SUCCESS;
} }

@ -172,6 +172,7 @@ int srslte_ra_ul_dci_to_grant_prb_allocation(srslte_ra_ul_dci_t *dci, srslte_ra_
srslte_mod_t last_mod[8]; srslte_mod_t last_mod[8];
uint32_t last_ul_tbs_idx[8]; uint32_t last_ul_tbs_idx[8];
uint32_t last_dl_tbs[8]; uint32_t last_dl_tbs[8];
uint32_t last_dl_tbs2[8];
static int ul_dci_to_grant_mcs(srslte_ra_ul_dci_t *dci, srslte_ra_ul_grant_t *grant, uint32_t harq_pid) { static int ul_dci_to_grant_mcs(srslte_ra_ul_dci_t *dci, srslte_ra_ul_grant_t *grant, uint32_t harq_pid) {
int tbs = -1; int tbs = -1;
@ -459,21 +460,38 @@ static int dl_dci_to_grant_mcs(srslte_ra_dl_dci_t *dci, srslte_ra_dl_grant_t *gr
grant->mcs.tbs = (uint32_t) tbs; grant->mcs.tbs = (uint32_t) tbs;
} else { } else {
n_prb = grant->nof_prb; n_prb = grant->nof_prb;
grant->mcs.idx = dci->mcs_idx; grant->nof_tb = 0;
tbs = dl_fill_ra_mcs(&grant->mcs, n_prb); if (dci->tb_en[0]) {
if (tbs) { grant->mcs.idx = dci->mcs_idx;
last_dl_tbs[dci->harq_process%8] = tbs; tbs = dl_fill_ra_mcs(&grant->mcs, n_prb);
if (tbs) {
last_dl_tbs[dci->harq_process%8] = tbs;
} else {
// For mcs>=29, set last TBS received for this PID
grant->mcs.tbs = last_dl_tbs[dci->harq_process%8];
}
grant->nof_tb++;
} else { } else {
// For mcs>=29, set last TBS received for this PID grant->mcs.tbs = 0;
grant->mcs.tbs = last_dl_tbs[dci->harq_process%8];
} }
if (dci->nof_tb == 2) { if (dci->tb_en[1]) {
grant->mcs2.idx = dci->mcs_idx_1; grant->mcs2.idx = dci->mcs_idx_1;
tbs = dl_fill_ra_mcs(&grant->mcs2, n_prb); tbs = dl_fill_ra_mcs(&grant->mcs2, n_prb);
if (tbs) {
last_dl_tbs2[dci->harq_process%8] = tbs;
} else {
// For mcs>=29, set last TBS received for this PID
grant->mcs2.tbs = last_dl_tbs2[dci->harq_process%8];
}
grant->nof_tb++;
} else {
grant->mcs2.tbs = 0;
} }
} }
grant->Qm = srslte_mod_bits_x_symbol(grant->mcs.mod); if (dci->tb_en[0]) {
if (dci->nof_tb == 2) { grant->Qm = srslte_mod_bits_x_symbol(grant->mcs.mod);
}
if (dci->tb_en[1]) {
grant->Qm2 = srslte_mod_bits_x_symbol(grant->mcs2.mod); grant->Qm2 = srslte_mod_bits_x_symbol(grant->mcs2.mod);
} }
if (tbs < 0) { if (tbs < 0) {

Loading…
Cancel
Save