change the namespace of tti point helper functions for the eNB

master
Francisco Paisana 4 years ago committed by Andre Puschmann
parent 114932b4c6
commit 88105c1577

@ -59,6 +59,7 @@
#define TTIMOD(tti) (tti % TTIMOD_SZ) #define TTIMOD(tti) (tti % TTIMOD_SZ)
#define INVALID_TTI 10241 #define INVALID_TTI 10241
#define TX_ENB_DELAY FDD_HARQ_DELAY_UL_MS
#define PHICH_MAX_SF 6 // Maximum PHICH in a subframe (1 in FDD, > 1 in TDD, see table 9.1.2-1 36.213) #define PHICH_MAX_SF 6 // Maximum PHICH in a subframe (1 in FDD, > 1 in TDD, see table 9.1.2-1 36.213)

@ -31,7 +31,7 @@ namespace srslte {
struct tti_point { struct tti_point {
constexpr tti_point() = default; constexpr tti_point() = default;
explicit tti_point(uint32_t tti_val_) : tti_val(tti_val_ % 10240) explicit tti_point(uint32_t tti_val_) : tti_val(tti_val_ % 10240u)
{ {
if (tti_val_ > std::numeric_limits<uint32_t>::max() / 2) { if (tti_val_ > std::numeric_limits<uint32_t>::max() / 2) {
// there was a overflow at tti initialization // there was a overflow at tti initialization
@ -118,21 +118,29 @@ inline tti_point min(tti_point tti1, tti_point tti2)
return tti1 < tti2 ? tti1 : tti2; return tti1 < tti2 ? tti1 : tti2;
} }
inline tti_point to_tx_dl(const srslte::tti_point& t) using tti_interval = srslte::interval<srslte::tti_point>;
} // namespace srslte
namespace srsenb {
inline srslte::tti_point to_tx_dl(srslte::tti_point t)
{ {
return t + FDD_HARQ_DELAY_UL_MS; return t + TX_ENB_DELAY;
} }
inline tti_point to_tx_ul(const srslte::tti_point& t) inline srslte::tti_point to_tx_ul(srslte::tti_point t)
{ {
return t + (FDD_HARQ_DELAY_UL_MS + FDD_HARQ_DELAY_DL_MS); return t + (TX_ENB_DELAY + FDD_HARQ_DELAY_DL_MS);
} }
inline tti_point to_tx_dl_ack(const srslte::tti_point& t) inline srslte::tti_point to_tx_dl_ack(srslte::tti_point t)
{ {
return to_tx_ul(t); return to_tx_ul(t);
} }
inline srslte::tti_point to_tx_ul_ack(srslte::tti_point t)
{
return to_tx_ul(t) + TX_ENB_DELAY;
}
using tti_interval = srslte::interval<srslte::tti_point>; } // namespace srsenb
} // namespace srslte
#endif // SRSLTE_TTI_POINT_H #endif // SRSLTE_TTI_POINT_H

@ -23,7 +23,7 @@
#define SRSLTE_SCHEDULER_COMMON_H #define SRSLTE_SCHEDULER_COMMON_H
#include "srslte/adt/bounded_bitset.h" #include "srslte/adt/bounded_bitset.h"
#include "srslte/adt/interval.h" #include "srslte/common/tti_point.h"
#include "srslte/interfaces/sched_interface.h" #include "srslte/interfaces/sched_interface.h"
namespace srsenb { namespace srsenb {

@ -383,8 +383,8 @@ std::pair<bool, uint32_t> harq_entity::set_ul_crc(srslte::tti_point tti_rx, uint
void harq_entity::reset_pending_data(srslte::tti_point tti_rx) void harq_entity::reset_pending_data(srslte::tti_point tti_rx)
{ {
tti_point tti_tx_ul = srslte::to_tx_ul(tti_rx); tti_point tti_tx_ul = to_tx_ul(tti_rx);
tti_point tti_tx_dl = srslte::to_tx_dl(tti_rx); tti_point tti_tx_dl = to_tx_dl(tti_rx);
// Reset ACK state of UL Harq // Reset ACK state of UL Harq
get_ul_harq(tti_tx_ul.to_uint())->reset_pending_data(); get_ul_harq(tti_tx_ul.to_uint())->reset_pending_data();

@ -28,6 +28,7 @@
#include "srslte/mac/pdu.h" #include "srslte/mac/pdu.h"
#include "srslte/srslte.h" #include "srslte/srslte.h"
using srslte::tti_interval;
using srslte::tti_point; using srslte::tti_point;
namespace srsenb { namespace srsenb {
@ -1366,7 +1367,7 @@ void cc_sched_ue::finish_tti(srslte::tti_point tti_rx)
// Check if cell state needs to be updated // Check if cell state needs to be updated
if (ue_cc_idx > 0 and cc_state_ == cc_st::deactivating) { if (ue_cc_idx > 0 and cc_state_ == cc_st::deactivating) {
// wait for all ACKs to be received before completely deactivating SCell // wait for all ACKs to be received before completely deactivating SCell
if (last_tti > srslte::to_tx_dl_ack(cfg_tti)) { if (last_tti > to_tx_dl_ack(cfg_tti)) {
cc_state_ = cc_st::idle; cc_state_ = cc_st::idle;
reset(); reset();
} }

@ -49,7 +49,7 @@ int test_pusch_collisions(const sf_output_res_t& sf_out, uint32_t enb_cc_idx, co
/* TEST: Check if there is space for PRACH */ /* TEST: Check if there is space for PRACH */
bool is_prach_tti_tx_ul = bool is_prach_tti_tx_ul =
srslte_prach_tti_opportunity_config_fdd(cell_params.cfg.prach_config, sf_out.tti_tx_ul().to_uint(), -1); srslte_prach_tti_opportunity_config_fdd(cell_params.cfg.prach_config, to_tx_ul(sf_out.tti_rx).to_uint(), -1);
if (is_prach_tti_tx_ul) { if (is_prach_tti_tx_ul) {
try_ul_fill({cell_params.cfg.prach_freq_offset, cell_params.cfg.prach_freq_offset + 6}, "PRACH"); try_ul_fill({cell_params.cfg.prach_freq_offset, cell_params.cfg.prach_freq_offset + 6}, "PRACH");
} }
@ -131,7 +131,8 @@ int test_pdsch_collisions(const sf_output_res_t& sf_out, uint32_t enb_cc_idx, co
// forbid Data in DL if its ACKs conflict with PRACH for PRB==6 // forbid Data in DL if its ACKs conflict with PRACH for PRB==6
if (cell_params.nof_prb() == 6) { if (cell_params.nof_prb() == 6) {
if (srslte_prach_tti_opportunity_config_fdd(cell_params.cfg.prach_config, sf_out.tti_rx_ack_dl().to_uint(), -1)) { if (srslte_prach_tti_opportunity_config_fdd(
cell_params.cfg.prach_config, to_tx_dl_ack(sf_out.tti_rx).to_uint(), -1)) {
dl_allocs.fill(0, dl_allocs.size()); dl_allocs.fill(0, dl_allocs.size());
} }
} }
@ -171,8 +172,8 @@ int test_sib_scheduling(const sf_output_res_t& sf_out, uint32_t enb_cc_idx)
{ {
const auto& cell_params = sf_out.cc_params[enb_cc_idx]; const auto& cell_params = sf_out.cc_params[enb_cc_idx];
const auto& dl_result = sf_out.dl_cc_result[enb_cc_idx]; const auto& dl_result = sf_out.dl_cc_result[enb_cc_idx];
uint32_t sfn = sf_out.tti_tx_dl().to_uint() / 10; uint32_t sfn = to_tx_dl(sf_out.tti_rx).to_uint() / 10;
uint32_t sf_idx = sf_out.tti_tx_dl().to_uint() % 10; uint32_t sf_idx = to_tx_dl(sf_out.tti_rx).to_uint() % 10;
bool sib1_expected = ((sfn % 2) == 0) and sf_idx == 5; bool sib1_expected = ((sfn % 2) == 0) and sf_idx == 5;
using bc_elem = const sched_interface::dl_sched_bc_t; using bc_elem = const sched_interface::dl_sched_bc_t;
@ -202,7 +203,7 @@ int test_sib_scheduling(const sf_output_res_t& sf_out, uint32_t enb_cc_idx)
} }
srslte::tti_point win_start{sfn_start * 10 + sf}; srslte::tti_point win_start{sfn_start * 10 + sf};
srslte::tti_interval window{win_start, win_start + cell_params.cfg.si_window_ms}; srslte::tti_interval window{win_start, win_start + cell_params.cfg.si_window_ms};
CONDERROR(not window.contains(sf_out.tti_tx_dl()), "Scheduled SIB is outside of its SIB window\n"); CONDERROR(not window.contains(to_tx_dl(sf_out.tti_rx)), "Scheduled SIB is outside of its SIB window\n");
} }
return SRSLTE_SUCCESS; return SRSLTE_SUCCESS;
} }

@ -34,9 +34,6 @@ struct sf_output_res_t {
srslte::tti_point tti_rx; srslte::tti_point tti_rx;
srslte::span<const sched_interface::ul_sched_res_t> ul_cc_result; srslte::span<const sched_interface::ul_sched_res_t> ul_cc_result;
srslte::span<const sched_interface::dl_sched_res_t> dl_cc_result; srslte::span<const sched_interface::dl_sched_res_t> dl_cc_result;
srslte::tti_point tti_tx_ul() const { return srslte::to_tx_ul(tti_rx); }
srslte::tti_point tti_rx_ack_dl() const { return tti_tx_ul(); }
srslte::tti_point tti_tx_dl() const { return srslte::to_tx_dl(tti_rx); }
}; };
/** /**

@ -199,8 +199,8 @@ int ue_ctxt_test::test_ra(cc_result result)
/* TEST: RAR allocation */ /* TEST: RAR allocation */
uint32_t rar_win_size = cell_params[result.enb_cc_idx].prach_rar_window; uint32_t rar_win_size = cell_params[result.enb_cc_idx].prach_rar_window;
std::array<srslte::tti_point, 2> rar_window = {prach_tti + 3, prach_tti + 3 + rar_win_size}; std::array<srslte::tti_point, 2> rar_window = {prach_tti + 3, prach_tti + 3 + rar_win_size};
srslte::tti_point tti_tx_dl = srslte::to_tx_dl(current_tti_rx); srslte::tti_point tti_tx_dl = to_tx_dl(current_tti_rx);
srslte::tti_point tti_tx_ul = srslte::to_tx_ul(current_tti_rx); srslte::tti_point tti_tx_ul = to_tx_ul(current_tti_rx);
bool is_in_rar_window = tti_tx_dl >= rar_window[0] and tti_tx_dl <= rar_window[1]; bool is_in_rar_window = tti_tx_dl >= rar_window[0] and tti_tx_dl <= rar_window[1];
if (not is_in_rar_window) { if (not is_in_rar_window) {
@ -357,7 +357,7 @@ int ue_ctxt_test::test_harqs(cc_result result)
h.active = true; h.active = true;
h.nof_retxs = 0; h.nof_retxs = 0;
h.ndi = data.dci.tb[0].ndi; h.ndi = data.dci.tb[0].ndi;
h.tti_tx = srslte::to_tx_dl(current_tti_rx); h.tti_tx = to_tx_dl(current_tti_rx);
} else { } else {
// it is retx // it is retx
CONDERROR(sched_utils::get_rvidx(h.nof_retxs + 1) != (uint32_t)data.dci.tb[0].rv, "Invalid rv index for retx\n"); CONDERROR(sched_utils::get_rvidx(h.nof_retxs + 1) != (uint32_t)data.dci.tb[0].rv, "Invalid rv index for retx\n");
@ -370,7 +370,7 @@ int ue_ctxt_test::test_harqs(cc_result result)
sim_cfg.ue_cfg.maxharq_tx); sim_cfg.ue_cfg.maxharq_tx);
h.nof_retxs++; h.nof_retxs++;
h.tti_tx = srslte::to_tx_dl(current_tti_rx); h.tti_tx = to_tx_dl(current_tti_rx);
} }
h.nof_txs++; h.nof_txs++;
} }
@ -383,7 +383,7 @@ int ue_ctxt_test::test_harqs(cc_result result)
} }
CONDERROR(pusch.dci.ue_cc_idx != cc->ue_cc_idx, "invalid ue_cc_idx=%d in sched result\n", pusch.dci.ue_cc_idx); CONDERROR(pusch.dci.ue_cc_idx != cc->ue_cc_idx, "invalid ue_cc_idx=%d in sched result\n", pusch.dci.ue_cc_idx);
auto& h = cc->ul_harqs[srslte::to_tx_ul(current_tti_rx).to_uint() % cc->ul_harqs.size()]; auto& h = cc->ul_harqs[to_tx_ul(current_tti_rx).to_uint() % cc->ul_harqs.size()];
uint32_t nof_retx = sched_utils::get_nof_retx(pusch.dci.tb.rv); // 0..3 uint32_t nof_retx = sched_utils::get_nof_retx(pusch.dci.tb.rv); // 0..3
if (h.nof_txs == 0 or h.ndi != pusch.dci.tb.ndi) { if (h.nof_txs == 0 or h.ndi != pusch.dci.tb.ndi) {
@ -409,7 +409,7 @@ int ue_ctxt_test::test_harqs(cc_result result)
h.nof_retxs++; h.nof_retxs++;
} }
h.tti_tx = srslte::to_tx_ul(current_tti_rx); h.tti_tx = to_tx_ul(current_tti_rx);
h.riv = pusch.dci.type2_alloc.riv; h.riv = pusch.dci.type2_alloc.riv;
h.nof_txs++; h.nof_txs++;
} }
@ -430,7 +430,7 @@ int ue_ctxt_test::schedule_acks(cc_result result)
continue; continue;
} }
pending_ack_t ack_data; pending_ack_t ack_data;
ack_data.tti_ack = srslte::to_tx_dl_ack(current_tti_rx); ack_data.tti_ack = to_tx_dl_ack(current_tti_rx);
ack_data.cc_idx = result.enb_cc_idx; ack_data.cc_idx = result.enb_cc_idx;
ack_data.tb = 0; ack_data.tb = 0;
ack_data.pid = data.dci.pid; ack_data.pid = data.dci.pid;
@ -449,11 +449,11 @@ int ue_ctxt_test::schedule_acks(cc_result result)
} }
pending_ack_t ack_data; pending_ack_t ack_data;
ack_data.tti_ack = srslte::to_tx_ul(current_tti_rx); ack_data.tti_ack = to_tx_ul(current_tti_rx);
ack_data.cc_idx = result.enb_cc_idx; ack_data.cc_idx = result.enb_cc_idx;
ack_data.ue_cc_idx = pusch.dci.ue_cc_idx; ack_data.ue_cc_idx = pusch.dci.ue_cc_idx;
ack_data.tb = 0; ack_data.tb = 0;
ack_data.pid = srslte::to_tx_ul(current_tti_rx).to_uint() % cc->ul_harqs.size(); ack_data.pid = to_tx_ul(current_tti_rx).to_uint() % cc->ul_harqs.size();
uint32_t nof_retx = sched_utils::get_nof_retx(pusch.dci.tb.rv); // 0..3 uint32_t nof_retx = sched_utils::get_nof_retx(pusch.dci.tb.rv); // 0..3
ack_data.ack = randf() < sim_cfg.prob_ul_ack_mask[nof_retx % sim_cfg.prob_ul_ack_mask.size()]; ack_data.ack = randf() < sim_cfg.prob_ul_ack_mask[nof_retx % sim_cfg.prob_ul_ack_mask.size()];

Loading…
Cancel
Save