Added functions for spectral efficiency computation

This commit is contained in:
Ismael Gomez 2016-11-17 20:05:56 +01:00
parent bb5e511513
commit 4a2d9d1776
4 changed files with 28 additions and 5 deletions

View File

@ -93,6 +93,9 @@ SRSLTE_API void srslte_pdcch_free(srslte_pdcch_t *q);
SRSLTE_API void srslte_pdcch_set_cfi(srslte_pdcch_t *q,
uint32_t cfi);
SRSLTE_API float srslte_pdcch_coderate(uint32_t nof_bits,
uint32_t l);
/* Encoding function */
SRSLTE_API int srslte_pdcch_encode(srslte_pdcch_t *q,
srslte_dci_msg_t *msg,

View File

@ -222,13 +222,19 @@ SRSLTE_API void srslte_ra_ul_grant_to_nbits(srslte_ra_ul_grant_t *grant,
uint32_t N_srs,
srslte_ra_nbits_t *nbits);
SRSLTE_API int srslte_ul_dci_to_grant_prb_allocation(srslte_ra_ul_dci_t *dci,
SRSLTE_API int srslte_ra_ul_dci_to_grant_prb_allocation(srslte_ra_ul_dci_t *dci,
srslte_ra_ul_grant_t *grant,
uint32_t n_rb_ho,
uint32_t nof_prb);
SRSLTE_API int srslte_ra_dl_dci_to_grant_prb_allocation(srslte_ra_dl_dci_t *dci,
srslte_ra_dl_grant_t *grant,
uint32_t nof_prb);
SRSLTE_API int srslte_ra_tbs_idx_from_mcs(uint32_t mcs);
SRSLTE_API srslte_mod_t srslte_ra_mod_from_mcs(uint32_t mcs);
SRSLTE_API int srslte_ra_mcs_from_tbs_idx(uint32_t tbs_idx);
SRSLTE_API int srslte_ra_tbs_from_idx(uint32_t tbs_idx,

View File

@ -56,6 +56,10 @@ void srslte_pdcch_set_cfi(srslte_pdcch_t *q, uint32_t cfi) {
set_cfi(q, cfi);
}
float srslte_pdcch_coderate(uint32_t nof_bits, uint32_t l) {
return (float) (nof_bits+16)/PDCCH_FORMAT_NOF_BITS(l);
}
/** Initializes the PDCCH transmitter and receiver */
int srslte_pdcch_init(srslte_pdcch_t *q, srslte_regs_t *regs, srslte_cell_t cell) {
int ret = SRSLTE_ERROR_INVALID_INPUTS;

View File

@ -106,7 +106,7 @@ uint32_t ra_re_x_prb(uint32_t subframe, uint32_t slot, uint32_t prb_idx, uint32_
return re;
}
int srslte_ul_dci_to_grant_prb_allocation(srslte_ra_ul_dci_t *dci, srslte_ra_ul_grant_t *grant, uint32_t n_rb_ho, uint32_t nof_prb)
int srslte_ra_ul_dci_to_grant_prb_allocation(srslte_ra_ul_dci_t *dci, srslte_ra_ul_grant_t *grant, uint32_t n_rb_ho, uint32_t nof_prb)
{
bzero(grant, sizeof(srslte_ra_ul_grant_t));
@ -228,7 +228,7 @@ int srslte_ra_ul_dci_to_grant(srslte_ra_ul_dci_t *dci, uint32_t nof_prb, uint32_
{
// Compute PRB allocation
if (!srslte_ul_dci_to_grant_prb_allocation(dci, grant, n_rb_ho, nof_prb)) {
if (!srslte_ra_ul_dci_to_grant_prb_allocation(dci, grant, n_rb_ho, nof_prb)) {
// Compute MCS
if (!ul_dci_to_grant_mcs(dci, grant, harq_pid)) {
@ -269,7 +269,7 @@ uint32_t srslte_ra_dl_grant_nof_re(srslte_ra_dl_grant_t *grant, srslte_cell_t ce
}
/** Compute PRB allocation for Downlink as defined in 7.1.6 of 36.213 */
static int dl_dci_to_grant_prb_allocation(srslte_ra_dl_dci_t *dci, srslte_ra_dl_grant_t *grant, uint32_t nof_prb) {
int srslte_ra_dl_dci_to_grant_prb_allocation(srslte_ra_dl_dci_t *dci, srslte_ra_dl_grant_t *grant, uint32_t nof_prb) {
int i, j;
uint32_t bitmask;
uint32_t P = srslte_ra_type0_P(nof_prb);
@ -482,7 +482,7 @@ int srslte_ra_dl_dci_to_grant(srslte_ra_dl_dci_t *dci,
crc_is_crnti = true;
}
// Compute PRB allocation
if (!dl_dci_to_grant_prb_allocation(dci, grant, nof_prb)) {
if (!srslte_ra_dl_dci_to_grant_prb_allocation(dci, grant, nof_prb)) {
// Compute MCS
if (!dl_dci_to_grant_mcs(dci, grant, crc_is_crnti)) {
// Apply Section 7.1.7.3. If RA-RNTI and Format1C rv_idx=0
@ -592,6 +592,16 @@ int srslte_ra_tbs_idx_from_mcs(uint32_t mcs) {
}
}
srslte_mod_t srslte_ra_mod_from_mcs(uint32_t mcs) {
if (mcs <= 10 || mcs == 29) {
return SRSLTE_MOD_QPSK;
} else if (mcs <= 17 || mcs == 30) {
return SRSLTE_MOD_16QAM;
} else {
return SRSLTE_MOD_64QAM;
}
}
int srslte_ra_mcs_from_tbs_idx(uint32_t tbs_idx) {
for (int i=0;i<29;i++) {
if (tbs_idx == mcs_tbs_idx_table[i]) {