Rename TX_DELAY and FDD_HARQ_DELAY_MS

master
Xavier Arteaga 5 years ago committed by Xavier Arteaga
parent 65711d06dc
commit 76408b195e

@ -42,27 +42,24 @@
#define SRSLTE_N_MCH_LCIDS 32
#define TX_DELAY 4
#define TX_DELAY_DL 4
#define MSG3_DELAY_MS 2 // Delay added to TX_DELAY
#define FDD_HARQ_DELAY_DL_MS 4
#define FDD_HARQ_DELAY_UL_MS 4
#define MSG3_DELAY_MS 2 // Delay added to FDD_HARQ_DELAY_DL_MS
#define TTI_SUB(a, b) ((((a) + 10240) - (b)) % 10240)
#define TTI_ADD(a, b) (((a) + (b)) % 10240)
#define TTI_TX(tti) TTI_ADD(tti, TX_DELAY)
#define TTI_TX(tti) TTI_ADD(tti, FDD_HARQ_DELAY_DL_MS)
// Use only in FDD mode!!
#define FDD_HARQ_DELAY_MS 4
#define FDD_HARQ_DELAY_DL_MS 4
#define TTI_RX(tti) (TTI_SUB(tti, FDD_HARQ_DELAY_MS))
#define TTI_RX_ACK(tti) (TTI_ADD(tti, FDD_HARQ_DELAY_MS + TX_DELAY))
#define TTI_RX(tti) (TTI_SUB(tti, FDD_HARQ_DELAY_UL_MS))
#define TTI_RX_ACK(tti) (TTI_ADD(tti, FDD_HARQ_DELAY_UL_MS + FDD_HARQ_DELAY_DL_MS))
#define TTIMOD_SZ 20
#define TTIMOD(tti) (tti % TTIMOD_SZ)
#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 ASYNC_DL_SCHED (FDD_HARQ_DELAY_MS <= 4)
#define ASYNC_DL_SCHED (FDD_HARQ_DELAY_UL_MS <= 4)
// Cat 4 UE - Max number of DL-SCH transport block bits received within a TTI
// 3GPP 36.306 v15.4.0 Table 4.1.1 for Category 11 with 2 layers and 256QAM

@ -160,7 +160,7 @@ typedef enum { SRSLTE_SF_NORM = 0, SRSLTE_SF_MBSFN } srslte_sf_t;
? (SRSLTE_CP_LEN_EXT(symbol_sz) - SRSLTE_CP_LEN_NORM(0, symbol_sz)) \
: (2 * SRSLTE_CP_LEN_EXT(symbol_sz) - SRSLTE_CP_LEN_NORM(0, symbol_sz) - SRSLTE_CP_LEN_NORM(1, symbol_sz)))
#define SRSLTE_FDD_NOF_HARQ (TX_DELAY + FDD_HARQ_DELAY_MS)
#define SRSLTE_FDD_NOF_HARQ (FDD_HARQ_DELAY_DL_MS + FDD_HARQ_DELAY_UL_MS)
#define SRSLTE_MAX_HARQ_PROC 15
#define SRSLTE_NOF_LTE_BANDS 58

@ -118,7 +118,7 @@ int main(int argc, char** argv)
int ret = SRSLTE_SUCCESS;
// Simulation Constants
const uint32_t nof_workers = FDD_HARQ_DELAY_MS;
const uint32_t nof_workers = FDD_HARQ_DELAY_UL_MS;
const uint32_t nof_tti = 10240;
const float enable_probability = 0.9f;
srslte_random_t random_gen = srslte_random_init(1234);

@ -33,7 +33,7 @@
namespace srsenb {
struct sched_ue_carrier {
const static int SCHED_MAX_HARQ_PROC = TX_DELAY_DL + FDD_HARQ_DELAY_DL_MS;
const static int SCHED_MAX_HARQ_PROC = FDD_HARQ_DELAY_UL_MS + FDD_HARQ_DELAY_DL_MS;
sched_ue_carrier(const sched_interface::ue_cfg_t& cfg_,
const sched_cell_params_t& cell_cfg_,

@ -176,7 +176,7 @@ cf_t* cc_worker::get_buffer_tx(uint32_t antenna_idx)
void cc_worker::set_tti(uint32_t tti_)
{
tti_rx = tti_;
tti_tx_dl = TTI_ADD(tti_rx, FDD_HARQ_DELAY_MS);
tti_tx_dl = TTI_ADD(tti_rx, FDD_HARQ_DELAY_UL_MS);
tti_tx_ul = TTI_RX_ACK(tti_rx);
}

@ -121,7 +121,7 @@ cf_t* sf_worker::get_buffer_rx(uint32_t cc_idx, uint32_t antenna_idx)
void sf_worker::set_time(uint32_t tti_, uint32_t tx_worker_cnt_, srslte_timestamp_t tx_time_)
{
tti_rx = tti_;
tti_tx_dl = TTI_ADD(tti_rx, FDD_HARQ_DELAY_MS);
tti_tx_dl = TTI_ADD(tti_rx, FDD_HARQ_DELAY_UL_MS);
tti_tx_ul = TTI_RX_ACK(tti_rx);
t_tx_dl = TTIMOD(tti_tx_dl);

@ -139,7 +139,7 @@ void txrx::run_thread()
/* Compute TX time: Any transmission happens in TTI+4 thus advance 4 ms the reception time */
srslte_timestamp_copy(&tx_time, &rx_time);
srslte_timestamp_add(&tx_time, 0, FDD_HARQ_DELAY_MS * 1e-3);
srslte_timestamp_add(&tx_time, 0, FDD_HARQ_DELAY_UL_MS * 1e-3);
Debug("Setting TTI=%d, tx_mutex=%d, tx_time=%ld:%f to worker %d\n",
tti,

@ -40,7 +40,7 @@ namespace sched_utils {
uint32_t tti_subtract(uint32_t tti1, uint32_t tti2)
{
return (tti1 + 10240 - tti2) % 10240;
return TTI_SUB(tti1, tti2);
}
uint32_t max_tti(uint32_t tti1, uint32_t tti2)
@ -378,7 +378,7 @@ int sched::dl_sched(uint32_t tti, uint32_t cc_idx, sched_interface::dl_sched_res
}
std::lock_guard<std::mutex> lock(sched_mutex);
uint32_t tti_rx = sched_utils::tti_subtract(tti, TX_DELAY_DL);
uint32_t tti_rx = sched_utils::tti_subtract(tti, FDD_HARQ_DELAY_UL_MS);
last_tti = sched_utils::max_tti(last_tti, tti_rx);
if (cc_idx < carrier_schedulers.size()) {
@ -401,7 +401,7 @@ int sched::ul_sched(uint32_t tti, uint32_t cc_idx, srsenb::sched_interface::ul_s
std::lock_guard<std::mutex> lock(sched_mutex);
// Compute scheduling Result for tti_rx
uint32_t tti_rx = sched_utils::tti_subtract(tti, TX_DELAY_DL + FDD_HARQ_DELAY_DL_MS);
uint32_t tti_rx = sched_utils::tti_subtract(tti, FDD_HARQ_DELAY_UL_MS + FDD_HARQ_DELAY_DL_MS);
if (cc_idx < carrier_schedulers.size()) {
const sf_sched_result& tti_sched = carrier_schedulers[cc_idx]->generate_tti_result(tti_rx);

@ -48,10 +48,10 @@ const char* alloc_outcome_t::to_string() const
tti_params_t::tti_params_t(uint32_t tti_rx_) :
tti_rx(tti_rx_),
sf_idx_tx_dl(TTI_ADD(tti_rx, TX_DELAY_DL) % 10),
tti_tx_dl(TTI_ADD(tti_rx, TX_DELAY_DL)),
tti_tx_ul(TTI_ADD(tti_rx, (TX_DELAY_DL + FDD_HARQ_DELAY_DL_MS))),
sfn_tx_dl(TTI_ADD(tti_rx, TX_DELAY_DL) / 10)
sf_idx_tx_dl(TTI_ADD(tti_rx, FDD_HARQ_DELAY_UL_MS) % 10),
tti_tx_dl(TTI_ADD(tti_rx, FDD_HARQ_DELAY_UL_MS)),
tti_tx_ul(TTI_ADD(tti_rx, (FDD_HARQ_DELAY_UL_MS + FDD_HARQ_DELAY_DL_MS))),
sfn_tx_dl(TTI_ADD(tti_rx, FDD_HARQ_DELAY_UL_MS) / 10)
{
}

@ -205,7 +205,7 @@ rbgmask_t dl_harq_proc::get_rbgmask() const
bool dl_harq_proc::has_pending_retx(uint32_t tb_idx, uint32_t tti_tx_dl) const
{
uint32_t tti_diff = srslte_tti_interval(tti_tx_dl, tti);
return (tti_diff < (10240 / 2)) and (tti_diff >= TX_DELAY_DL + FDD_HARQ_DELAY_DL_MS) and
return (tti_diff < (10240 / 2)) and (tti_diff >= FDD_HARQ_DELAY_UL_MS + FDD_HARQ_DELAY_DL_MS) and
has_pending_retx_common(tb_idx);
}
@ -364,8 +364,8 @@ ul_harq_proc* harq_entity::get_ul_harq(uint32_t tti_tx_ul)
void harq_entity::reset_pending_data(uint32_t tti_rx)
{
uint32_t tti_tx_ul = TTI_ADD(tti_rx, (TX_DELAY_DL + FDD_HARQ_DELAY_DL_MS));
uint32_t tti_tx_dl = TTI_ADD(tti_rx, TX_DELAY_DL);
uint32_t tti_tx_ul = TTI_ADD(tti_rx, (FDD_HARQ_DELAY_UL_MS + FDD_HARQ_DELAY_DL_MS));
uint32_t tti_tx_dl = TTI_ADD(tti_rx, FDD_HARQ_DELAY_UL_MS);
// Reset ACK state of UL Harq
get_ul_harq(tti_tx_ul)->reset_pending_data();

@ -187,7 +187,7 @@ int test_scell_activation(test_scell_activation_params params)
// Event: Wait for UE to receive and ack CE. Send cqi==0, which should not activate the SCell
uint32_t cqi = 0;
for (uint32_t i = 0; i < TX_DELAY_DL; ++i) {
for (uint32_t i = 0; i < FDD_HARQ_DELAY_UL_MS; ++i) {
tester.dl_cqi_info(tester.tti_info.tti_params.tti_rx, rnti1, 1, cqi);
generator.step_tti();
}

@ -780,7 +780,7 @@ int common_sched_tester::schedule_acks()
while (it != to_ack.end() and it->first < ack_data.tti) {
if (it->second.rnti == ack_data.rnti and it->second.dl_harq.get_id() == ack_data.dl_harq.get_id() and
it->second.ue_cc_idx == ack_data.ue_cc_idx) {
CONDERROR(it->second.tti + TX_DELAY_DL + FDD_HARQ_DELAY_DL_MS > ack_data.tti,
CONDERROR(it->second.tti + FDD_HARQ_DELAY_UL_MS + FDD_HARQ_DELAY_DL_MS > ack_data.tti,
"The retx dl harq id=%d was transmitted too soon\n",
ack_data.dl_harq.get_id());
auto toerase_it = it++;
@ -802,7 +802,7 @@ int common_sched_tester::schedule_acks()
ack_data.ue_cc_idx = ue_db[ack_data.rnti].get_cell_index(ccidx).second;
ack_data.ul_harq = *ue_db[ack_data.rnti].get_ul_harq(tti_info.tti_params.tti_tx_ul, ack_data.ue_cc_idx);
ack_data.tti_tx_ul = tti_info.tti_params.tti_tx_ul;
ack_data.tti_ack = tti_info.tti_params.tti_tx_ul + FDD_HARQ_DELAY_MS;
ack_data.tti_ack = tti_info.tti_params.tti_tx_ul + FDD_HARQ_DELAY_UL_MS;
if (ack_data.ul_harq.nof_retx(0) == 0) {
ack_data.ack = randf() > sim_args0.P_retx;
} else {

@ -33,8 +33,8 @@ struct tti_counter {
tti_counter() = default;
void set_start_tti(uint32_t tti_) { counter = tti_; }
uint32_t tti_rx() const { return counter % 10240u; }
tti_counter tic_tx_dl() const { return tti_counter{counter + TX_DELAY_DL}; }
tti_counter tic_tx_ul() const { return tti_counter{counter + TX_DELAY_DL + FDD_HARQ_DELAY_DL_MS}; }
tti_counter tic_tx_dl() const { return tti_counter{counter + FDD_HARQ_DELAY_UL_MS}; }
tti_counter tic_tx_ul() const { return tti_counter{counter + FDD_HARQ_DELAY_UL_MS + FDD_HARQ_DELAY_DL_MS}; }
bool operator==(const tti_counter& other) const { return counter == other.counter; }
bool operator!=(const tti_counter& other) const { return counter != other.counter; }
bool operator<(const tti_counter& other) const { return counter < other.counter; }

@ -577,7 +577,7 @@ public:
// Schedule grant
if (sched) {
uint32_t tti_pdcch = TTI_SUB(tti, TX_DELAY);
uint32_t tti_pdcch = TTI_SUB(tti, FDD_HARQ_DELAY_DL_MS);
uint32_t location_idx = (tti_pdcch + 1) % nof_locations[tti_pdcch % SRSLTE_NOF_SF_X_FRAME];
srslte_dci_location_t location = dci_locations[tti_pdcch % SRSLTE_NOF_SF_X_FRAME][location_idx];
@ -636,7 +636,7 @@ public:
tti_dl_info_t& tti_dl_ack = tti_dl_info_ack_queue.front();
// Calculate ACK TTI
tti_dl_sched.tti = TTI_ADD(tti_dl_sched.tti, TX_DELAY);
tti_dl_sched.tti = TTI_ADD(tti_dl_sched.tti, FDD_HARQ_DELAY_DL_MS);
// Assert that ACKs have been received
TESTASSERT(tti_dl_sched.tti == tti_dl_ack.tti);
@ -795,11 +795,11 @@ public:
}
// Push HARQ delay to radio
for (uint32_t i = 0; i < TX_DELAY; i++) {
for (uint32_t i = 0; i < FDD_HARQ_DELAY_DL_MS; i++) {
radio->write_rx(buffers, sf_len);
sf_ul_cfg.tti = TTI_ADD(sf_ul_cfg.tti, 1); // Advance UL TTI too
}
for (uint32_t i = 0; i < FDD_HARQ_DELAY_MS; i++) {
for (uint32_t i = 0; i < FDD_HARQ_DELAY_UL_MS; i++) {
radio->write_rx(buffers, sf_len);
}
}

@ -219,7 +219,7 @@ private:
uint32_t grant_cc_idx;
srslte_dci_dl_t dl_dci;
} pending_dl_grant_t;
pending_dl_grant_t pending_dl_grant[FDD_HARQ_DELAY_MS][SRSLTE_MAX_CARRIERS] = {};
pending_dl_grant_t pending_dl_grant[FDD_HARQ_DELAY_UL_MS][SRSLTE_MAX_CARRIERS] = {};
srslte_cell_t cell = {};

@ -259,7 +259,7 @@ uint32_t phy_common::ul_pidof(uint32_t tti, srslte_tdd_config_t* tdd_config)
// Computes SF->TTI at which PHICH will be received according to 9.1.2 of 36.213
#define tti_phich(sf) \
(sf->tti + (cell.frame_type == SRSLTE_FDD ? FDD_HARQ_DELAY_MS : k_phich[sf->tdd_config.sf_config][sf->tti % 10]))
(sf->tti + (cell.frame_type == SRSLTE_FDD ? FDD_HARQ_DELAY_UL_MS : k_phich[sf->tdd_config.sf_config][sf->tti % 10]))
// Here SF->TTI is when PUSCH is transmitted
void phy_common::set_ul_pending_ack(srslte_ul_sf_cfg_t* sf,
@ -319,14 +319,14 @@ bool phy_common::is_any_ul_pending_ack()
// Computes SF->TTI at which PUSCH will be transmitted according to Section 8 of 36.213
#define tti_pusch_hi(sf) \
(sf->tti + \
(cell.frame_type == SRSLTE_FDD ? FDD_HARQ_DELAY_MS \
(cell.frame_type == SRSLTE_FDD ? FDD_HARQ_DELAY_UL_MS \
: I_phich ? 7 : k_pusch[sf->tdd_config.sf_config][sf->tti % 10]) + \
(TX_DELAY - FDD_HARQ_DELAY_MS))
(FDD_HARQ_DELAY_DL_MS - FDD_HARQ_DELAY_UL_MS))
#define tti_pusch_gr(sf) \
(sf->tti + \
(cell.frame_type == SRSLTE_FDD ? FDD_HARQ_DELAY_MS \
(cell.frame_type == SRSLTE_FDD ? FDD_HARQ_DELAY_UL_MS \
: dci->ul_idx == 1 ? 7 : k_pusch[sf->tdd_config.sf_config][sf->tti % 10]) + \
(TX_DELAY - FDD_HARQ_DELAY_MS))
(FDD_HARQ_DELAY_DL_MS - FDD_HARQ_DELAY_UL_MS))
// SF->TTI is at which Format0 dci is received
void phy_common::set_ul_pending_grant(srslte_dl_sf_cfg_t* sf, uint32_t cc_idx, srslte_dci_ul_t* dci)
@ -427,10 +427,10 @@ void phy_common::set_dl_pending_grant(uint32_t tti,
const srslte_dci_dl_t* dl_dci)
{
std::lock_guard<std::mutex> lock(pending_dl_grant_mutex);
if (!pending_dl_grant[tti % FDD_HARQ_DELAY_MS][cc_idx].enable) {
pending_dl_grant[tti % FDD_HARQ_DELAY_MS][cc_idx].dl_dci = *dl_dci;
pending_dl_grant[tti % FDD_HARQ_DELAY_MS][cc_idx].grant_cc_idx = grant_cc_idx;
pending_dl_grant[tti % FDD_HARQ_DELAY_MS][cc_idx].enable = true;
if (!pending_dl_grant[tti % FDD_HARQ_DELAY_UL_MS][cc_idx].enable) {
pending_dl_grant[tti % FDD_HARQ_DELAY_UL_MS][cc_idx].dl_dci = *dl_dci;
pending_dl_grant[tti % FDD_HARQ_DELAY_UL_MS][cc_idx].grant_cc_idx = grant_cc_idx;
pending_dl_grant[tti % FDD_HARQ_DELAY_UL_MS][cc_idx].enable = true;
} else {
Warning("set_dl_pending_grant: cc=%d already exists\n", cc_idx);
}
@ -439,16 +439,16 @@ void phy_common::set_dl_pending_grant(uint32_t tti,
bool phy_common::get_dl_pending_grant(uint32_t tti, uint32_t cc_idx, uint32_t* grant_cc_idx, srslte_dci_dl_t* dl_dci)
{
std::lock_guard<std::mutex> lock(pending_dl_grant_mutex);
if (pending_dl_grant[tti % FDD_HARQ_DELAY_MS][cc_idx].enable) {
if (pending_dl_grant[tti % FDD_HARQ_DELAY_UL_MS][cc_idx].enable) {
// Read grant
if (dl_dci) {
*dl_dci = pending_dl_grant[tti % FDD_HARQ_DELAY_MS][cc_idx].dl_dci;
*dl_dci = pending_dl_grant[tti % FDD_HARQ_DELAY_UL_MS][cc_idx].dl_dci;
}
if (grant_cc_idx) {
*grant_cc_idx = pending_dl_grant[tti % FDD_HARQ_DELAY_MS][cc_idx].grant_cc_idx;
*grant_cc_idx = pending_dl_grant[tti % FDD_HARQ_DELAY_UL_MS][cc_idx].grant_cc_idx;
}
// Reset read flag
pending_dl_grant[tti % FDD_HARQ_DELAY_MS][cc_idx].enable = false;
pending_dl_grant[tti % FDD_HARQ_DELAY_UL_MS][cc_idx].enable = false;
return true;
} else {
return false;
@ -493,8 +493,8 @@ bool phy_common::get_dl_pending_ack(srslte_ul_sf_cfg_t* sf, uint32_t cc_idx, srs
for (uint32_t i = 0; i < M; i++) {
uint32_t k =
(cell.frame_type == SRSLTE_FDD) ? FDD_HARQ_DELAY_MS : das_table[sf->tdd_config.sf_config][sf->tti % 10].K[i];
uint32_t pdsch_tti = TTI_SUB(sf->tti, k + (TX_DELAY - FDD_HARQ_DELAY_MS));
(cell.frame_type == SRSLTE_FDD) ? FDD_HARQ_DELAY_UL_MS : das_table[sf->tdd_config.sf_config][sf->tti % 10].K[i];
uint32_t pdsch_tti = TTI_SUB(sf->tti, k + (FDD_HARQ_DELAY_DL_MS - FDD_HARQ_DELAY_UL_MS));
if (pending_dl_ack[TTIMOD(pdsch_tti)][cc_idx].enable) {
ack->m[i].present = true;
ack->m[i].k = k;

@ -487,7 +487,7 @@ void sync::run_thread()
srslte_timestamp_t rx_time, tx_time;
srslte_ue_sync_get_last_timestamp(&ue_sync, &rx_time);
srslte_timestamp_copy(&tx_time, &rx_time);
srslte_timestamp_add(&tx_time, 0, TX_DELAY * 1e-3 - time_adv_sec);
srslte_timestamp_add(&tx_time, 0, FDD_HARQ_DELAY_DL_MS * 1e-3 - time_adv_sec);
worker->set_prach(prach_ptr ? &prach_ptr[prach_sf_cnt * SRSLTE_SF_LEN_PRB(cell.nof_prb)] : NULL,
prach_power);

@ -667,7 +667,7 @@ public:
return is_bsr;
}
uint32_t get_pid(const uint32_t tti_) { return tti_ % (2 * FDD_HARQ_DELAY_MS); }
uint32_t get_pid(const uint32_t tti_) { return tti_ % SRSLTE_FDD_NOF_HARQ; }
bool get_ndi_for_new_ul_tx(const uint32_t tti_)
{
@ -1207,8 +1207,8 @@ private:
uint16_t crnti = TTCN3_CRNTI;
int force_lcid = -1;
srslte::timer_handler timers;
bool last_dl_ndi[2 * FDD_HARQ_DELAY_MS] = {};
bool last_ul_ndi[2 * FDD_HARQ_DELAY_MS] = {};
bool last_dl_ndi[SRSLTE_FDD_NOF_HARQ] = {};
bool last_ul_ndi[SRSLTE_FDD_NOF_HARQ] = {};
// For events/actions that need to be carried out in a specific TTI
typedef std::vector<move_task_t> task_list_t;

Loading…
Cancel
Save