Working on SRS integration in PUSCH

master
ismagom 10 years ago
parent 723b574d14
commit ccfdb783c9

@ -1,13 +1,13 @@
clear
ueConfig=struct('NCellID',25,'RNTI',11,'NULRB',6,'NSubframe',1,'CyclicPrefixUL','Normal','NTxAnts',1,'Hopping','Off');
pucchConfig=struct('NLayers',1,'OrthCover','Off','Shortened',1,'ResourceSize',0);
pucchConfig=struct('NLayers',1,'OrthCover','Off','Shortened',0,'ResourceSize',0);
addpath('../../build/srslte/lib/phch/test')
format_str={'1','1a','1b','2','2a','2b'};
k=1;
for f=0:2
for f=0:5
for n=0:7:130
for d=1:3
for ncs=0:d:7

@ -107,9 +107,9 @@ namespace ue {
return true;
}
}
bool to_pusch_cfg(uint32_t sf_idx, uint32_t N_srs, srslte_ue_ul_t *ue_ul) {
bool to_pusch_cfg(srslte_pusch_hopping_cfg_t *hopping_cfg, srslte_pusch_srs_cfg_t *srs_cfg, uint32_t sf_idx, srslte_ue_ul_t *ue_ul) {
memcpy(&ue_ul->pusch_cfg.grant, &grant, sizeof(srslte_ra_ul_grant_t));
if (srslte_ue_ul_cfg_grant(ue_ul, NULL, 0, N_srs, sf_idx, get_rv())) {
if (srslte_ue_ul_cfg_grant(ue_ul, NULL, hopping_cfg, srs_cfg, sf_idx, get_rv())) {
return false;
}
return true;

@ -142,24 +142,6 @@ bool ul_buffer::generate_data(ul_sched_grant *grant, srslte_softbuffer_tx_t *sof
dmrs_cfg.cyclic_shift_for_dmrs = grant->get_n_dmrs();
}
}
srslte_pusch_hopping_cfg_t pusch_hopping;
if (grant) {
bzero(&pusch_hopping, sizeof(srslte_pusch_hopping_cfg_t));
pusch_hopping.n_sb = params_db->get_param(phy_params::PUSCH_HOPPING_N_SB);
pusch_hopping.hop_mode = params_db->get_param(phy_params::PUSCH_HOPPING_INTRA_SF) ?
pusch_hopping.SRSLTE_PUSCH_HOP_MODE_INTRA_SF :
pusch_hopping.SRSLTE_PUSCH_HOP_MODE_INTER_SF;
pusch_hopping.hopping_offset = params_db->get_param(phy_params::PUSCH_HOPPING_OFFSET);
pusch_hopping.current_tx_nb = grant->get_current_tx_nb();
}
bool is_shortened = false;
if (params_db->get_param(phy_params::SRS_IS_CS_CONFIGURED)) {
if (srslte_refsignal_srs_send_cs((uint32_t) params_db->get_param(phy_params::SRS_CS_SFCFG), tti%10) == 1) {
is_shortened = true;
Info("PUCCH/PUSCH Shortened\n");
}
}
srslte_pucch_cfg_t pucch_cfg;
bzero(&pucch_cfg, sizeof(srslte_pucch_cfg_t));
@ -168,7 +150,9 @@ bool ul_buffer::generate_data(ul_sched_grant *grant, srslte_softbuffer_tx_t *sof
pucch_cfg.group_hopping_en = dmrs_cfg.group_hopping_en;
pucch_cfg.N_cs = params_db->get_param(phy_params::PUCCH_CYCLIC_SHIFT);
pucch_cfg.n_rb_2 = params_db->get_param(phy_params::PUCCH_N_RB_2);
pucch_cfg.shortened = is_shortened;
pucch_cfg.srs_cs_configured = params_db->get_param(phy_params::SRS_IS_CS_CONFIGURED)?true:false;
pucch_cfg.srs_cs_subf_cfg = (uint32_t) params_db->get_param(phy_params::SRS_CS_SFCFG);
pucch_cfg.srs_simul_ack = params_db->get_param(phy_params::SRS_CS_ACKNACKSIMUL)?true:false;
srslte_pucch_sched_t pucch_sched;
bzero(&pucch_sched, sizeof(srslte_pucch_sched_t));
@ -181,7 +165,7 @@ bool ul_buffer::generate_data(ul_sched_grant *grant, srslte_softbuffer_tx_t *sof
pucch_sched.n_pucch_2 = params_db->get_param(phy_params::PUCCH_N_PUCCH_2);
pucch_sched.n_pucch_sr = params_db->get_param(phy_params::PUCCH_N_PUCCH_SR);
srslte_ue_ul_set_cfg(&ue_ul, &dmrs_cfg, &pusch_hopping, &pucch_cfg, &pucch_sched);
srslte_ue_ul_set_cfg(&ue_ul, &dmrs_cfg, &pucch_cfg, &pucch_sched);
uci_data.I_offset_ack = params_db->get_param(phy_params::UCI_I_OFFSET_ACK);
uci_data.I_offset_cqi = params_db->get_param(phy_params::UCI_I_OFFSET_CQI);
@ -190,26 +174,46 @@ bool ul_buffer::generate_data(ul_sched_grant *grant, srslte_softbuffer_tx_t *sof
int n = 0;
// Transmit on PUSCH if UL grant available, otherwise in PUCCH
if (grant) {
srslte_pusch_hopping_cfg_t pusch_hopping_cfg;
srslte_pusch_srs_cfg_t pusch_srs_cfg;
bzero(&pusch_hopping_cfg, sizeof(srslte_pusch_hopping_cfg_t));
bzero(&pusch_srs_cfg, sizeof(srslte_pusch_srs_cfg_t));
grant->to_pusch_cfg(tti%10, is_shortened?1:0, &ue_ul);
pusch_hopping_cfg.n_sb = params_db->get_param(phy_params::PUSCH_HOPPING_N_SB);
pusch_hopping_cfg.hop_mode = params_db->get_param(phy_params::PUSCH_HOPPING_INTRA_SF) ?
pusch_hopping.SRSLTE_PUSCH_HOP_MODE_INTRA_SF :
pusch_hopping.SRSLTE_PUSCH_HOP_MODE_INTER_SF;
pusch_hopping_cfg.hopping_offset = params_db->get_param(phy_params::PUSCH_HOPPING_OFFSET);
pusch_hopping_cfg.current_tx_nb = grant->get_current_tx_nb();
Info("PUSCH: TTI=%d, TBS=%d, mod=%s, rb_start=%d n_prb=%d, ack=%s, sr=%s, rnti=%d, sf_idx=%d\n",
tti, grant->get_tbs(), srslte_mod_string(ue_ul.pusch_cfg.grant.mcs.mod), ue_ul.pusch_cfg.grant.n_prb[0],
ue_ul.pusch_cfg.grant.L_prb,
uci_data.uci_ack_len>0?(uci_data.uci_ack?"1":"0"):"no",uci_data.scheduling_request?"yes":"no",
grant->get_rnti(), tti%10);
pusch_srs_cfg.cs_configured = params_db->get_param(phy_params::SRS_IS_CS_CONFIGURED)?true:false;
pusch_srs_cfg.ue_configured = params_db->get_param(phy_params::SRS_IS_UE_CONFIGURED)?true:false;
pusch_srs_cfg.cs_subf_cfg = (uint32_t) params_db->get_param(phy_params::SRS_CS_SFCFG);
pusch_srs_cfg.cs_bw_cfg = (uint32_t) params_db->get_param(phy_params::SRS_CS_BWCFG);
pusch_srs_cfg.ue_config_idx = (uint32_t) params_db->get_param(phy_params::SRS_UE_CONFIGINDEX);
grant->to_pusch_cfg(&pusch_hopping_cfg, &pusch_srs_cfg, tti%10, &ue_ul);
n = srslte_ue_ul_pusch_encode_rnti_softbuffer(&ue_ul,
payload, uci_data,
softbuffer,
grant->get_rnti(),
signal_buffer);
} else {
Info("PUCCH: TTI=%d n_cce=%d, sf_idx=%d, ack=%s, sr=%s\n", tti, last_n_cce, tti%10,
uci_data.uci_ack_len>0?(uci_data.uci_ack?"1":"0"):"no",uci_data.scheduling_request?"yes":"no");
Info("PUSCH: TTI=%d, TBS=%d, mod=%s, rb_start=%d n_prb=%d, ack=%s, sr=%s, rnti=%d, shortened=%s\n",
tti, grant->get_tbs(), srslte_mod_string(ue_ul.pusch_cfg.grant.mcs.mod), ue_ul.pusch_cfg.grant.n_prb[0],
ue_ul.pusch_cfg.grant.L_prb,
uci_data.uci_ack_len>0?(uci_data.uci_ack?"1":"0"):"no",uci_data.scheduling_request?"yes":"no",
grant->get_rnti(), ue_ul.pusch_is_shortened?"yes":"no");
} else {
n = srslte_ue_ul_pucch_encode(&ue_ul, uci_data, tti%10, signal_buffer);
Info("PUCCH: TTI=%d n_cce=%d, ack=%s, sr=%s, shortened=%s\n", tti, last_n_cce,
uci_data.uci_ack_len>0?(uci_data.uci_ack?"1":"0"):"no",uci_data.scheduling_request?"yes":"no", ue_ul.pucch.shortened?"yes":"no");
}
// Reset UCI data
bzero(&uci_data, sizeof(srslte_uci_data_t));

@ -70,7 +70,9 @@ typedef struct SRSLTE_API {
uint32_t n_rb_2;
uint32_t N_cs;
bool group_hopping_en;
bool shortened;
bool srs_cs_configured;
uint32_t srs_cs_subf_cfg;
bool srs_simul_ack;
} srslte_pucch_cfg_t;
/* PUSCH object */
@ -87,6 +89,7 @@ typedef struct SRSLTE_API {
float tmp_arg[SRSLTE_PUCCH_N_SEQ];
cf_t z[SRSLTE_PUCCH_MAX_SYMBOLS];
bool rnti_is_set;
bool shortened;
}srslte_pucch_t;

@ -64,13 +64,18 @@ typedef struct {
uint32_t n_sb;
} srslte_pusch_hopping_cfg_t;
typedef struct {
bool cs_configured;
bool ue_configured;
uint32_t cs_subf_cfg;
uint32_t cs_bw_cfg;
uint32_t ue_config_idx;
} srslte_pusch_srs_cfg_t;
/* PUSCH object */
typedef struct SRSLTE_API {
srslte_cell_t cell;
srslte_pusch_hopping_cfg_t hopping_cfg;
uint32_t max_re;
bool rnti_is_set;
uint16_t rnti;
@ -107,13 +112,15 @@ SRSLTE_API void srslte_pusch_free(srslte_pusch_t *q);
SRSLTE_API int srslte_pusch_cfg(srslte_pusch_cfg_t *cfg,
srslte_cell_t cell,
srslte_dci_msg_t *dci_msg,
uint32_t n_rb_ho,
uint32_t N_srs,
srslte_pusch_hopping_cfg_t *hopping_cfg,
srslte_pusch_srs_cfg_t *srs_cfg,
uint32_t sf_idx,
uint32_t rvidx);
SRSLTE_API void srslte_pusch_set_hopping_cfg(srslte_pusch_t *q,
srslte_pusch_hopping_cfg_t *cfg);
SRSLTE_API void srslte_pusch_freq_hopping(srslte_ra_ul_grant_t *grant,
srslte_pusch_hopping_cfg_t *hopping,
uint32_t sf_idx,
uint32_t nof_prb);
SRSLTE_API int srslte_pusch_set_rnti(srslte_pusch_t *q,
uint16_t rnti);

@ -54,6 +54,9 @@
#define SRSLTE_UE_UL_NOF_HARQ_PROCESSES 8
typedef struct SRSLTE_API {
srslte_ofdm_t fft;
srslte_cfo_t cfo;
@ -73,6 +76,7 @@ typedef struct SRSLTE_API {
srslte_pucch_sched_t pucch_sched;
cf_t *refsignal;
cf_t *sf_symbols;
@ -96,14 +100,13 @@ SRSLTE_API void srslte_ue_ul_set_normalization(srslte_ue_ul_t *q,
SRSLTE_API void srslte_ue_ul_set_cfg(srslte_ue_ul_t *q,
srslte_refsignal_dmrs_pusch_cfg_t *dmrs_cfg,
srslte_pusch_hopping_cfg_t *pusch_hopping_cfg,
srslte_pucch_cfg_t *pucch_cfg,
srslte_pucch_sched_t *pucch_sched);
SRSLTE_API int srslte_ue_ul_cfg_grant(srslte_ue_ul_t *q,
srslte_dci_msg_t *dci_msg,
uint32_t n_rb_ho,
uint32_t N_srs,
srslte_pusch_hopping_cfg_t *hopping_cfg,
srslte_pusch_srs_cfg_t *srs_cfg,
uint32_t sf_idx,
uint32_t rvidx);

@ -35,6 +35,7 @@
#include <math.h>
#include <complex.h>
#include "srslte/ch_estimation/refsignal_ul.h"
#include "srslte/phch/pucch.h"
#include "srslte/common/sequence.h"
#include "srslte/common/phy_common.h"
@ -291,9 +292,9 @@ static int pucch_put(srslte_pucch_t *q, srslte_pucch_format_t format, uint32_t n
// Determine m
uint32_t m = srslte_pucch_m(&q->pucch_cfg, format, n_pucch, q->cell.cp);
uint32_t N_sf_0 = get_N_sf(format, 0, q->pucch_cfg.shortened);
uint32_t N_sf_0 = get_N_sf(format, 0, q->shortened);
for (uint32_t ns=0;ns<2;ns++) {
uint32_t N_sf = get_N_sf(format, ns%2, q->pucch_cfg.shortened);
uint32_t N_sf = get_N_sf(format, ns%2, q->shortened);
// Determine n_prb
uint32_t n_prb = m/2;
if ((m+ns)%2) {
@ -480,6 +481,18 @@ int srslte_pucch_encode(srslte_pucch_t* q, srslte_pucch_format_t format,
{
ret = SRSLTE_ERROR;
// Shortened PUCCH happen in every cell-specific SRS subframes for Format 1/1a/1b
q->shortened = false;
if (q->pucch_cfg.srs_cs_configured && format < SRSLTE_PUCCH_FORMAT_2) {
// If CQI is not transmitted, PUCCH will be normal unless ACK/NACK and SRS simultaneous transmission is enabled
if (q->pucch_cfg.srs_simul_ack) {
// If simultaneous ACK and SRS is enabled, PUCCH is shortened in cell-specific SRS subframes
if (srslte_refsignal_srs_send_cs(q->pucch_cfg.srs_cs_subf_cfg, sf_idx) == 1) {
q->shortened = true;
}
}
}
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;
@ -488,9 +501,9 @@ int srslte_pucch_encode(srslte_pucch_t* q, srslte_pucch_format_t format,
fprintf(stderr, "Error encoding PUCCH bits\n");
return SRSLTE_ERROR;
}
uint32_t N_sf_0 = get_N_sf(format, 0, q->pucch_cfg.shortened);
uint32_t N_sf_0 = get_N_sf(format, 0, q->shortened);
for (uint32_t ns=2*sf_idx;ns<2*(sf_idx+1);ns++) {
uint32_t N_sf = get_N_sf(format, ns%2, q->pucch_cfg.shortened);
uint32_t N_sf = get_N_sf(format, ns%2, q->shortened);
// Get group hopping number u
uint32_t f_gh=0;
if (q->pucch_cfg.group_hopping_en) {

@ -34,6 +34,7 @@
#include <assert.h>
#include <math.h>
#include "srslte/ch_estimation/refsignal_ul.h"
#include "srslte/phch/pusch.h"
#include "srslte/phch/pusch_cfg.h"
#include "srslte/phch/uci.h"
@ -84,19 +85,15 @@ static int f_m(srslte_pusch_t *q, srslte_pusch_hopping_cfg_t *hopping, uint32_t
}
}
int pusch_cp(srslte_pusch_t *q, srslte_ra_ul_grant_t *grant, uint32_t sf_idx, cf_t *input, cf_t *output, bool advance_input)
/* Computes PUSCH frequency hopping as defined in Section 8.4 of 36.213 */
void srslte_pusch_freq_hopping(srslte_ra_ul_grant_t *grant, srslte_pusch_hopping_cfg_t *hopping, uint32_t sf_idx, uint32_t nof_prb)
{
cf_t *in_ptr = input;
cf_t *out_ptr = output;
srslte_pusch_hopping_cfg_t *hopping = &q->hopping_cfg;
uint32_t L_ref = 3;
if (SRSLTE_CP_ISEXT(q->cell.cp)) {
L_ref = 2;
}
INFO("PUSCH Freq hopping: %d\n", grant->freq_hopping);
for (uint32_t slot=0;slot<2;slot++) {
INFO("PUSCH Freq hopping: %d\n", grant->freq_hopping);
uint32_t n_prb_tilde = grant->n_prb[slot];
if (grant->freq_hopping == 1) {
if (hopping->hop_mode == SRSLTE_PUSCH_HOP_MODE_INTER_SF) {
n_prb_tilde = grant->n_prb[hopping->current_tx_nb%2];
@ -116,7 +113,7 @@ int pusch_cp(srslte_pusch_t *q, srslte_ra_ul_grant_t *grant, uint32_t sf_idx, cf
} else {
i = 2*sf_idx+slot;
}
uint32_t n_rb_sb = q->cell.nof_prb;
uint32_t n_rb_sb = nof_prb;
if (hopping->n_sb > 1) {
n_rb_sb = (n_rb_sb-hopping->hopping_offset-hopping->hopping_offset%2)/hopping->n_sb;
}
@ -131,11 +128,27 @@ int pusch_cp(srslte_pusch_t *q, srslte_ra_ul_grant_t *grant, uint32_t sf_idx, cf
}
grant->n_prb_tilde[slot] = n_prb_tilde;
INFO("Allocating PUSCH %d PRB to index %d at slot %d\n",grant->L_prb, n_prb_tilde,slot);
}
}
/* Allocate/deallocate PUSCH RBs to the resource grid
*/
int pusch_cp(srslte_pusch_t *q, srslte_ra_ul_grant_t *grant, cf_t *input, cf_t *output, bool advance_input)
{
cf_t *in_ptr = input;
cf_t *out_ptr = output;
uint32_t L_ref = 3;
if (SRSLTE_CP_ISEXT(q->cell.cp)) {
L_ref = 2;
}
for (uint32_t slot=0;slot<2;slot++) {
INFO("Allocating PUSCH %d PRB to index %d at slot %d\n",grant->L_prb, grant->n_prb_tilde[slot], slot);
for (uint32_t l=0;l<SRSLTE_CP_NSYMB(q->cell.cp);l++) {
if (l != L_ref) {
uint32_t idx = SRSLTE_RE_IDX(q->cell.nof_prb, l+slot*SRSLTE_CP_NSYMB(q->cell.cp),
n_prb_tilde*SRSLTE_NRE);
grant->n_prb_tilde[slot]*SRSLTE_NRE);
if (advance_input) {
out_ptr = &output[idx];
} else {
@ -281,17 +294,12 @@ void srslte_pusch_free(srslte_pusch_t *q) {
}
void srslte_pusch_set_hopping_cfg(srslte_pusch_t *q, srslte_pusch_hopping_cfg_t *cfg)
{
if (cfg) {
memcpy(&q->hopping_cfg, cfg, sizeof(srslte_pusch_hopping_cfg_t));
}
}
/* Configures the structure srslte_pusch_cfg_t from the UL DCI allocation dci_msg.
* If dci_msg is NULL, the grant is assumed to be already stored in cfg->grant
*/
int srslte_pusch_cfg(srslte_pusch_cfg_t *cfg, srslte_cell_t cell, srslte_dci_msg_t *dci_msg, uint32_t n_rb_ho, uint32_t N_srs, uint32_t sf_idx, uint32_t rvidx)
int srslte_pusch_cfg(srslte_pusch_cfg_t *cfg, srslte_cell_t cell, srslte_dci_msg_t *dci_msg,
srslte_pusch_hopping_cfg_t *hopping_cfg, srslte_pusch_srs_cfg_t *srs_cfg,
uint32_t sf_idx, uint32_t rvidx)
{
if (dci_msg) {
srslte_ra_ul_dci_t ul_dci;
@ -304,7 +312,30 @@ int srslte_pusch_cfg(srslte_pusch_cfg_t *cfg, srslte_cell_t cell, srslte_dci_msg
fprintf(stderr, "Error computing Codeblock segmentation for TBS=%d\n", cfg->grant.mcs.tbs);
return SRSLTE_ERROR;
}
/* Compute PUSCH frequency hopping */
srslte_pusch_freq_hopping(&cfg->grant, hopping_cfg, sf_idx, cell.nof_prb);
uint32_t N_srs = 0;
if (srs_cfg->cs_configured) {
// If UE-specific SRS is configured, PUSCH is shortened every time UE transmits SRS even if overlaping in the same RB or not
if (srs_cfg->ue_configured) {
if (srslte_refsignal_srs_send_cs(srs_cfg->cs_subf_cfg, sf_idx) == 1 &&
srslte_refsignal_srs_send_ue(srs_cfg->ue_config_idx, sf_idx) == 1)
{
N_srs = 1;
}
}
// If not coincides with UE transmission. PUSCH shall be shortened if cell-specific SRS transmission bw coincides with PUSCH allocated RB
if (N_srs == 0) {
}
}
/* Compute final number of bits and RE */
srslte_ra_ul_grant_to_nbits(&cfg->grant, cell.cp, N_srs, &cfg->nbits);
cfg->sf_idx = sf_idx;
cfg->rv = rvidx;
cfg->cp = cell.cp;

@ -156,22 +156,21 @@ void srslte_ue_ul_reset(srslte_ue_ul_t *q) {
void srslte_ue_ul_set_cfg(srslte_ue_ul_t *q,
srslte_refsignal_dmrs_pusch_cfg_t *dmrs_cfg,
srslte_pusch_hopping_cfg_t *pusch_hopping_cfg,
srslte_pucch_cfg_t *pucch_cfg,
srslte_pucch_sched_t *pucch_sched)
{
srslte_refsignal_ul_set_pusch_cfg(&q->dmrs, dmrs_cfg);
srslte_refsignal_ul_set_pucch_cfg(&q->dmrs, pucch_cfg);
srslte_pusch_set_hopping_cfg(&q->pusch, pusch_hopping_cfg);
srslte_pucch_set_cfg(&q->pucch, pucch_cfg);
if (pucch_sched) {
memcpy(&q->pucch_sched, pucch_sched, sizeof(srslte_pucch_sched_t));
}
}
int srslte_ue_ul_cfg_grant(srslte_ue_ul_t *q, srslte_dci_msg_t *dci_msg, uint32_t n_rb_ho, uint32_t N_srs, uint32_t sf_idx, uint32_t rvidx)
int srslte_ue_ul_cfg_grant(srslte_ue_ul_t *q, srslte_dci_msg_t *dci_msg,
srslte_pusch_hopping_cfg_t *hopping_cfg, srslte_pusch_srs_cfg_t *srs_cfg, uint32_t sf_idx, uint32_t rvidx)
{
return srslte_pusch_cfg(&q->pusch_cfg, q->cell, dci_msg, n_rb_ho, N_srs, sf_idx, rvidx);
return srslte_pusch_cfg(&q->pusch_cfg, q->cell, dci_msg, hopping_cfg, srs_cfg, sf_idx, rvidx);
}
/* Choose PUCCH format as in Sec 10.1 of 36.213 and generate PUCCH signal

Loading…
Cancel
Save