Wrap slot index in modulus macro

master
Xavier Arteaga 4 years ago committed by Xavier Arteaga
parent 4bab0b53b7
commit f3bf0c1c68

@ -112,7 +112,7 @@ uint32_t csi_rs_cinit(const srslte_carrier_nr_t* carrier,
const srslte_csi_rs_nzp_resource_t* resource,
uint32_t l)
{
uint32_t n = slot_cfg->idx % SRSLTE_NSLOTS_PER_FRAME_NR(carrier->numerology);
uint32_t n = SRSLTE_SLOT_NR_MOD(carrier->numerology, slot_cfg->idx);
uint32_t n_id = resource->scrambling_id;
return ((SRSLTE_NSYMB_PER_SLOT_NR * n + l + 1UL) * (2UL * n_id) << 10UL) + n_id;

@ -289,7 +289,7 @@ static uint32_t dmrs_pucch_format2_cinit(const srslte_carrier_nr_t* car
const srslte_slot_cfg_t* slot,
uint32_t l)
{
uint64_t n = slot->idx;
uint64_t n = SRSLTE_SLOT_NR_MOD(carrier->numerology, slot->idx);
uint64_t n_id = (cfg->scrambling_id_present) ? cfg->scambling_id : carrier->id;
return SRSLTE_SEQUENCE_MOD((((SRSLTE_NSYMB_PER_SLOT_NR * n + l + 1UL) * (2UL * n_id + 1UL)) << 17UL) + 2UL * n_id);

@ -451,8 +451,6 @@ static uint32_t srslte_dmrs_sch_seed(const srslte_carrier_nr_t* carrier,
{
const srslte_dmrs_sch_cfg_t* dmrs_cfg = &cfg->dmrs;
slot_idx = slot_idx % SRSLTE_NSLOTS_PER_FRAME_NR(carrier->numerology);
// Calculate scrambling IDs
uint32_t n_id = carrier->id;
uint32_t n_scid = (grant->n_scid) ? 1 : 0;
@ -575,8 +573,8 @@ int srslte_dmrs_sch_put_sf(srslte_dmrs_sch_t* q,
// Iterate symbols
for (uint32_t i = 0; i < nof_symbols; i++) {
uint32_t l = symbols[i]; // Symbol index inside the slot
uint32_t slot_idx = slot_cfg->idx; // Slot index in the frame
uint32_t l = symbols[i]; // Symbol index inside the slot
uint32_t slot_idx = SRSLTE_SLOT_NR_MOD(q->carrier.numerology, slot_cfg->idx); // Slot index in the frame
uint32_t cinit = srslte_dmrs_sch_seed(&q->carrier, pdsch_cfg, grant, slot_idx, l);
srslte_dmrs_sch_put_symbol(q, pdsch_cfg, grant, cinit, delta, &sf_symbols[symbol_sz * l]);
@ -699,7 +697,8 @@ int srslte_dmrs_sch_estimate(srslte_dmrs_sch_t* q,
for (uint32_t i = 0; i < nof_symbols; i++) {
uint32_t l = symbols[i]; // Symbol index inside the slot
uint32_t cinit = srslte_dmrs_sch_seed(&q->carrier, pdsch_cfg, grant, slot_cfg->idx, l);
uint32_t cinit = srslte_dmrs_sch_seed(
&q->carrier, pdsch_cfg, grant, SRSLTE_SLOT_NR_MOD(q->carrier.numerology, slot_cfg->idx), l);
nof_pilots_x_symbol = srslte_dmrs_sch_get_symbol(
q, pdsch_cfg, grant, cinit, delta, &sf_symbols[symbol_sz * l], &q->pilot_estimates[nof_pilots_x_symbol * i]);

@ -71,7 +71,7 @@ int srslte_pucch_nr_alpha_idx(const srslte_carrier_nr_t* carrier,
}
// Compute number of slot
uint32_t n_slot = slot->idx % SRSLTE_NSLOTS_PER_FRAME_NR(carrier->numerology);
uint32_t n_slot = SRSLTE_SLOT_NR_MOD(carrier->numerology, slot->idx);
// Generate pseudo-random sequence
uint32_t cinit = cfg->hopping_id_present ? cfg->hopping_id : carrier->id;

Loading…
Cancel
Save