Skip NR PDSCH allocation in PDSCH DMRS symbols

master
Xavier Arteaga 4 years ago committed by Xavier Arteaga
parent 1775052144
commit 0a06074158

@ -145,6 +145,18 @@ typedef enum SRSLTE_API {
srslte_mcs_table_N
} srslte_mcs_table_t;
/**
* @brief RNTI types
*/
typedef enum SRSLTE_API {
srslte_rnti_type_c = 0,
srslte_rnti_type_p,
srslte_rnti_type_si,
srslte_rnti_type_ra,
srslte_rnti_type_tc,
srslte_rnti_type_cs,
} srslte_rnti_type_t;
/**
* @brief DCI formats
* @remark Described in TS 38.212 V15.9.0 Section 7.3.1 DCI formats

@ -17,14 +17,6 @@
#include "srslte/phy/common/phy_common_nr.h"
#include "srslte/phy/phch/pdsch_cfg_nr.h"
typedef enum SRSLTE_API {
srslte_rnti_type_c = 0,
srslte_rnti_type_p,
srslte_rnti_type_si,
srslte_rnti_type_ra,
srslte_rnti_type_tc,
} srslte_rnti_type_t;
typedef struct SRSLTE_API {
srslte_dci_location_t location;
srslte_search_space_type_t search_space;

@ -108,6 +108,7 @@ typedef struct SRSLTE_API {
typedef struct SRSLTE_API {
/// UE identifier
uint16_t rnti;
srslte_rnti_type_t rnti_type;
/// Time domain resources
uint32_t k0;

@ -32,6 +32,36 @@
extern "C" {
#endif
/**
* @brief Determines target rate
* @param mcs_table Configured MCS table
* @param dci_format DCI format used for the grant
* @param search_space_type Search space type
* @param rnti_type RNTI type
* @param mcs_idx Desired Modulation Coding Scheme (MCS) index
* @return The target rate if provided information is valid. Otherwise, it returns NAN
*/
SRSLTE_API double srslte_ra_nr_R_from_mcs(srslte_mcs_table_t mcs_table,
srslte_dci_format_nr_t dci_format,
srslte_search_space_type_t search_space_type,
srslte_rnti_type_t rnti_type,
uint32_t mcs_idx);
/**
* @brief Determines target rate
* @param mcs_table Configured MCS table
* @param dci_format DCI format used for the grant
* @param search_space_type Search space type
* @param rnti_type RNTI type
* @param mcs_idx Desired Modulation Coding Scheme (MCS) index
* @return The selected modulation if provided information is valid. Otherwise, it returns SRSLTE_MOD_NITEMS
*/
SRSLTE_API srslte_mod_t srslte_ra_nr_mod_from_mcs(srslte_mcs_table_t mcs_table,
srslte_dci_format_nr_t dci_format,
srslte_search_space_type_t search_space_type,
srslte_rnti_type_t rnti_type,
uint32_t mcs_idx);
/**
* @brief Determines the number of resource elements available for a given PDSCH transmission
* @param pdsch_cfg PDSCH configuration provided by higher layers

@ -414,12 +414,6 @@ int srslte_dmrs_pdsch_get_sc_idx(const srslte_pdsch_dmrs_cfg_t* cfg, uint32_t ma
int srslte_dmrs_pdsch_get_N_prb(const srslte_pdsch_cfg_nr_t* cfg, const srslte_pdsch_grant_nr_t* grant)
{
const srslte_pdsch_dmrs_cfg_t* dmrs_cfg =
grant->mapping == srslte_pdsch_mapping_type_A ? &cfg->dmrs_cfg_typeA : &cfg->dmrs_cfg_typeB;
// Get number of frequency domain resource elements used for DMRS
int nof_sc = dmrs_cfg->type == srslte_dmrs_pdsch_type_1 ? 6 : 4;
// Get number of symbols used for DMRS
uint32_t symbols[SRSLTE_DMRS_PDSCH_MAX_SYMBOLS] = {};
int ret = srslte_dmrs_pdsch_get_symbols_idx(cfg, grant, symbols);
@ -428,7 +422,7 @@ int srslte_dmrs_pdsch_get_N_prb(const srslte_pdsch_cfg_nr_t* cfg, const srslte_p
return SRSLTE_ERROR;
}
return nof_sc * ret;
return SRSLTE_NRE * ret;
}
static uint32_t srslte_dmrs_pdsch_seed(const srslte_carrier_nr_t* carrier,
@ -739,30 +733,12 @@ int srslte_dmrs_pdsch_estimate(srslte_dmrs_pdsch_t* q,
}
if (symbols[symbol_idx] == l) {
switch (dmrs_cfg->type) {
case srslte_dmrs_pdsch_type_1:
for (uint32_t i = 0; i < nof_re_x_symbol; i++) {
if (i % 2 != delta) {
chest_res->ce[0][0][count] = ce[i];
count++;
}
}
break;
case srslte_dmrs_pdsch_type_2:
for (uint32_t i = 0; i < nof_re_x_symbol; i++) {
if ((i % 6 != delta) && (i % 6 != delta + 1)) {
chest_res->ce[0][0][count] = ce[i];
count++;
}
}
break;
continue;
}
} else {
srslte_vec_cf_copy(&chest_res->ce[0][0][count], ce, nof_re_x_symbol);
count += nof_re_x_symbol;
}
}
// Set other values in the estimation result
chest_res->nof_re = count;

@ -229,7 +229,7 @@ void srslte_ofdm_free_(srslte_ofdm_t* q)
if (q->window_offset_buffer) {
free(q->window_offset_buffer);
}
bzero(q, sizeof(srslte_ofdm_t));
SRSLTE_MEM_ZERO(q, srslte_ofdm_t, 1);
}
int srslte_ofdm_rx_init(srslte_ofdm_t* q, srslte_cp_t cp, cf_t* in_buffer, cf_t* out_buffer, uint32_t max_prb)

@ -98,7 +98,7 @@ void srslte_enb_dl_nr_free(srslte_enb_dl_nr_t* q)
srslte_pdcch_nr_free(&q->pdcch);
memset(q, 0, sizeof(srslte_enb_dl_nr_t));
SRSLTE_MEM_ZERO(q, srslte_enb_dl_nr_t, 1);
}
int srslte_enb_dl_nr_set_carrier(srslte_enb_dl_nr_t* q, const srslte_carrier_nr_t* carrier)

@ -168,100 +168,9 @@ void srslte_pdsch_nr_free(srslte_pdsch_nr_t* q)
if (q->evm_buffer != NULL) {
srslte_evm_free(q->evm_buffer);
}
}
/**
* @brief copies a number of countiguous Resource Elements
* @param sf_symbols slot symbols in frequency domain
* @param symbols resource elements
* @param count number of resource elements to copy
* @param put Direction, symbols are copied into sf_symbols if put is true, otherwise sf_symbols are copied into symbols
*/
static void srslte_pdsch_re_cp(cf_t* sf_symbols, cf_t* symbols, uint32_t count, bool put)
{
if (put) {
srslte_vec_cf_copy(sf_symbols, symbols, count);
} else {
srslte_vec_cf_copy(symbols, sf_symbols, count);
}
}
static uint32_t srslte_pdsch_nr_cp_dmrs_type1(const srslte_pdsch_nr_t* q,
const srslte_pdsch_grant_nr_t* grant,
cf_t* symbols,
cf_t* sf_symbols,
bool put)
{
uint32_t count = 0;
uint32_t delta = 0;
for (uint32_t i = 0; i < q->carrier.nof_prb; i++) {
if (grant->prb_idx[i]) {
for (uint32_t j = 0; j < SRSLTE_NRE; j += 2) {
if (put) {
sf_symbols[i * SRSLTE_NRE + delta + j + 1] = symbols[count++];
} else {
symbols[count++] = sf_symbols[i * SRSLTE_NRE + delta + j + 1];
}
}
}
}
return count;
}
static uint32_t srslte_pdsch_nr_cp_dmrs_type2(const srslte_pdsch_nr_t* q,
const srslte_pdsch_grant_nr_t* grant,
cf_t* symbols,
cf_t* sf_symbols,
bool put)
{
uint32_t count = 0;
uint32_t delta = 0;
for (uint32_t i = 0; i < q->carrier.nof_prb; i++) {
if (grant->prb_idx[i]) {
// Copy RE before first pilot pair
if (delta > 0) {
srslte_pdsch_re_cp(&sf_symbols[i * SRSLTE_NRE], &symbols[count], delta, put);
count += delta;
}
// Copy RE between pilot pairs
srslte_pdsch_re_cp(&sf_symbols[i * SRSLTE_NRE + delta + 2], &symbols[count], 4, put);
count += 4;
// Copy RE after second pilot
srslte_pdsch_re_cp(&sf_symbols[(i + 1) * SRSLTE_NRE - 4 + delta], &symbols[count], 4 - delta, put);
count += 4 - delta;
}
}
return count;
}
static uint32_t srslte_pdsch_nr_cp_dmrs(const srslte_pdsch_nr_t* q,
const srslte_pdsch_cfg_nr_t* cfg,
const srslte_pdsch_grant_nr_t* grant,
cf_t* symbols,
cf_t* sf_symbols,
bool put)
{
uint32_t count = 0;
const srslte_pdsch_dmrs_cfg_t* dmrs_cfg =
grant->mapping == srslte_pdsch_mapping_type_A ? &cfg->dmrs_cfg_typeA : &cfg->dmrs_cfg_typeB;
switch (dmrs_cfg->type) {
case srslte_dmrs_pdsch_type_1:
count = srslte_pdsch_nr_cp_dmrs_type1(q, grant, symbols, sf_symbols, put);
break;
case srslte_dmrs_pdsch_type_2:
count = srslte_pdsch_nr_cp_dmrs_type2(q, grant, symbols, sf_symbols, put);
break;
}
return count;
// Make sure whole structure is fill with zeros
SRSLTE_MEM_ZERO(q, srslte_pdsch_nr_t, 1);
}
static uint32_t srslte_pdsch_nr_cp_clean(const srslte_pdsch_nr_t* q,
@ -340,13 +249,12 @@ static int srslte_pdsch_nr_cp(const srslte_pdsch_nr_t* q,
dmrs_l_count++;
}
// Skip DMRS symbol
if (l == dmrs_l_idx[dmrs_l_count]) {
count += srslte_pdsch_nr_cp_dmrs(
q, cfg, grant, &symbols[count], &sf_symbols[l * q->carrier.nof_prb * SRSLTE_NRE], put);
} else {
count +=
srslte_pdsch_nr_cp_clean(q, grant, &symbols[count], &sf_symbols[l * q->carrier.nof_prb * SRSLTE_NRE], put);
continue;
}
count += srslte_pdsch_nr_cp_clean(q, grant, &symbols[count], &sf_symbols[l * q->carrier.nof_prb * SRSLTE_NRE], put);
}
return count;
@ -400,7 +308,7 @@ static inline int pdsch_nr_encode_codeword(srslte_pdsch_nr_t* q,
}
if (SRSLTE_DEBUG_ENABLED && srslte_verbose >= SRSLTE_VERBOSE_INFO && !handler_registered) {
printf("b=");
INFO("b=");
srslte_vec_fprint_b(stdout, q->b[tb->cw_idx], tb->nof_bits);
}
@ -416,7 +324,7 @@ static inline int pdsch_nr_encode_codeword(srslte_pdsch_nr_t* q,
srslte_mod_modulate(&q->modem_tables[tb->mod], q->b[tb->cw_idx], q->d[tb->cw_idx], tb->nof_bits);
if (SRSLTE_DEBUG_ENABLED && srslte_verbose >= SRSLTE_VERBOSE_INFO && !handler_registered) {
printf("d=");
INFO("d=");
srslte_vec_fprint_c(stdout, q->d[tb->cw_idx], tb->nof_re);
}
@ -471,7 +379,16 @@ int srslte_pdsch_nr_encode(srslte_pdsch_nr_t* q,
// ... Not implemented
// 7.3.1.6 Mapping from virtual to physical resource blocks
srslte_pdsch_nr_put(q, cfg, grant, x[0], sf_symbols[0]);
int n = srslte_pdsch_nr_put(q, cfg, grant, x[0], sf_symbols[0]);
if (n < SRSLTE_SUCCESS) {
ERROR("Putting NR PDSCH resources\n");
return SRSLTE_ERROR;
}
if (n != grant->tb[0].nof_re) {
ERROR("Unmatched number of RE (%d != %d)\n", n, grant->tb[0].nof_re);
return SRSLTE_ERROR;
}
if (q->meas_time_en) {
gettimeofday(&t[2], NULL);

@ -111,18 +111,18 @@ typedef enum { ra_nr_table_1 = 0, ra_nr_table_2, ra_nr_table_3 } ra_nr_table_t;
static ra_nr_table_t ra_nr_select_table(srslte_mcs_table_t mcs_table,
srslte_dci_format_nr_t dci_format,
srslte_search_space_type_t search_space_type,
uint16_t rnti)
srslte_rnti_type_t rnti_type)
{
// Non-implemented parameters
bool sps_config_mcs_table_present = false;
srslte_mcs_table_t sps_config_mcs_table = srslte_mcs_table_64qam;
bool is_cs_rnti = false;
bool is_pdcch_sps = false;
// - the higher layer parameter mcs-Table given by PDSCH-Config is set to 'qam256', and
// - the PDSCH is scheduled by a PDCCH with DCI format 1_1 with
// - CRC scrambled by C-RNTI
if (mcs_table == srslte_mcs_table_256qam && dci_format == srslte_dci_format_nr_1_1 && SRSLTE_RNTI_ISUSER(rnti)) {
if (mcs_table == srslte_mcs_table_256qam && dci_format == srslte_dci_format_nr_1_1 &&
rnti_type == srslte_rnti_type_c) {
return ra_nr_table_1;
}
@ -131,7 +131,7 @@ static ra_nr_table_t ra_nr_select_table(srslte_mcs_table_t mcs_table,
// the PDSCH is scheduled by a PDCCH in a UE-specific search space with
// CRC scrambled by C - RNTI
if (mcs_table == srslte_mcs_table_qam64LowSE && search_space_type == srslte_search_space_type_ue &&
SRSLTE_RNTI_ISUSER(rnti)) {
rnti_type == srslte_rnti_type_c) {
return ra_nr_table_3;
}
@ -140,7 +140,7 @@ static ra_nr_table_t ra_nr_select_table(srslte_mcs_table_t mcs_table,
// - if the PDSCH is scheduled by a PDCCH with DCI format 1_1 with CRC scrambled by CS-RNTI or
// - if the PDSCH is scheduled without corresponding PDCCH transmission using SPS-Config,
if (!sps_config_mcs_table_present && mcs_table == srslte_mcs_table_256qam &&
((dci_format == srslte_dci_format_nr_1_1 && is_cs_rnti) || (!is_pdcch_sps))) {
((dci_format == srslte_dci_format_nr_1_1 && rnti_type == srslte_rnti_type_c) || (!is_pdcch_sps))) {
return ra_nr_table_2;
}
@ -148,7 +148,7 @@ static ra_nr_table_t ra_nr_select_table(srslte_mcs_table_t mcs_table,
// - if the PDSCH is scheduled by a PDCCH with CRC scrambled by CS-RNTI or
// - if the PDSCH is scheduled without corresponding PDCCH transmission using SPS-Config,
if (sps_config_mcs_table_present && sps_config_mcs_table == srslte_mcs_table_qam64LowSE &&
(is_cs_rnti || is_pdcch_sps)) {
(rnti_type == srslte_rnti_type_cs || is_pdcch_sps)) {
return ra_nr_table_3;
}
@ -159,10 +159,10 @@ static ra_nr_table_t ra_nr_select_table(srslte_mcs_table_t mcs_table,
double srslte_ra_nr_R_from_mcs(srslte_mcs_table_t mcs_table,
srslte_dci_format_nr_t dci_format,
srslte_search_space_type_t search_space_type,
uint16_t rnti,
srslte_rnti_type_t rnti_type,
uint32_t mcs_idx)
{
ra_nr_table_t table = ra_nr_select_table(mcs_table, dci_format, search_space_type, rnti);
ra_nr_table_t table = ra_nr_select_table(mcs_table, dci_format, search_space_type, rnti_type);
switch (table) {
case ra_nr_table_1:
@ -181,10 +181,10 @@ double srslte_ra_nr_R_from_mcs(srslte_mcs_table_t mcs_table,
srslte_mod_t srslte_ra_nr_mod_from_mcs(srslte_mcs_table_t mcs_table,
srslte_dci_format_nr_t dci_format,
srslte_search_space_type_t search_space_type,
uint16_t rnti,
srslte_rnti_type_t rnti_type,
uint32_t mcs_idx)
{
ra_nr_table_t table = ra_nr_select_table(mcs_table, dci_format, search_space_type, rnti);
ra_nr_table_t table = ra_nr_select_table(mcs_table, dci_format, search_space_type, rnti_type);
switch (table) {
case ra_nr_table_1:
@ -323,14 +323,14 @@ int srslte_ra_nr_fill_tb(const srslte_pdsch_cfg_nr_t* pdsch_cfg,
// Get target Rate
double R = srslte_ra_nr_R_from_mcs(
pdsch_cfg->sch_cfg.mcs_table, grant->dci_format, grant->dci_search_space, grant->rnti, mcs_idx);
pdsch_cfg->sch_cfg.mcs_table, grant->dci_format, grant->dci_search_space, grant->rnti_type, mcs_idx);
if (!isnormal(R)) {
return SRSLTE_ERROR;
}
// Get modulation
srslte_mod_t m = srslte_ra_nr_mod_from_mcs(
pdsch_cfg->sch_cfg.mcs_table, grant->dci_format, grant->dci_search_space, grant->rnti, mcs_idx);
pdsch_cfg->sch_cfg.mcs_table, grant->dci_format, grant->dci_search_space, grant->rnti_type, mcs_idx);
if (m >= SRSLTE_MOD_NITEMS) {
return SRSLTE_ERROR;
}

@ -362,6 +362,11 @@ int srslte_dlsch_nr_encode(srslte_sch_nr_t* q,
return SRSLTE_ERROR_INVALID_INPUTS;
}
if (!tb->softbuffer.tx) {
ERROR("Error: Missing Tx softbuffer\n");
return SRSLTE_ERROR;
}
const uint8_t* input_ptr = data;
uint8_t* output_ptr = e_bits;
@ -402,7 +407,7 @@ int srslte_dlsch_nr_encode(srslte_sch_nr_t* q,
// Calculate TB CRC
uint32_t checksum_tb = srslte_crc_checksum_byte(cfg.crc_tb, data, tb->tbs);
if (SRSLTE_DEBUG_ENABLED && srslte_verbose >= SRSLTE_VERBOSE_INFO && !handler_registered) {
printf("Encode: ");
INFO("tb=");
srslte_vec_fprint_byte(stdout, data, tb->tbs / 8);
}
@ -437,7 +442,7 @@ int srslte_dlsch_nr_encode(srslte_sch_nr_t* q,
}
if (SRSLTE_DEBUG_ENABLED && srslte_verbose >= SRSLTE_VERBOSE_INFO && !handler_registered) {
printf("CB %d:", r);
INFO("cb%d=", r);
srslte_vec_fprint_byte(stdout, input_ptr, cb_len / 8);
}
@ -456,6 +461,11 @@ int srslte_dlsch_nr_encode(srslte_sch_nr_t* q,
// Encode code block
srslte_ldpc_encoder_encode(cfg.encoder, q->temp_cb, rm_buffer, cfg.Kr);
if (SRSLTE_DEBUG_ENABLED && srslte_verbose >= SRSLTE_VERBOSE_INFO && !handler_registered) {
INFO("encoded=");
srslte_vec_fprint_b(stdout, rm_buffer, cfg.encoder->liftN - 2 * cfg.encoder->ls);
}
}
// Skip block

Loading…
Cancel
Save