-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mac: split pucch_alloc_harq_sr_csi_test.cpp into multiple files
- Loading branch information
Showing
5 changed files
with
1,957 additions
and
1,898 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
124 changes: 124 additions & 0 deletions
124
tests/unittests/scheduler/uci_and_pucch/pucch_alloc_base_tester.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
/* | ||
* | ||
* Copyright 2021-2024 Software Radio Systems Limited | ||
* | ||
* By using this file, you agree to the terms and conditions set | ||
* forth in the LICENSE file which can be found at the top level of | ||
* the distribution. | ||
* | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "uci_test_utils.h" | ||
|
||
using namespace srsran; | ||
|
||
class pucch_allocator_base_tester | ||
{ | ||
public: | ||
pucch_allocator_base_tester(test_bench_params params_ = test_bench_params{.pucch_res_common = 11, .n_cces = 1}, | ||
unsigned max_pucchs_per_slot_ = 32U, | ||
unsigned max_ul_grants_per_slot_ = 32U) : | ||
t_bench(params_, max_pucchs_per_slot_, max_ul_grants_per_slot_){}; | ||
|
||
protected: | ||
// Parameters that are passed by the routine to run the tests. | ||
test_bench t_bench; | ||
const unsigned pucch_res_idx{0}; | ||
|
||
// Add a SR grant to the main UE. | ||
void add_sr_grant() | ||
{ | ||
t_bench.pucch_alloc.pucch_allocate_sr_opportunity(t_bench.res_grid[t_bench.k0 + t_bench.k1], | ||
t_bench.get_main_ue().crnti, | ||
t_bench.get_main_ue().get_pcell().cfg()); | ||
} | ||
|
||
// Add a HARQ grant of PUCCH Formats 0/1 (1 bit) to the main UE. | ||
void add_harq_grant() | ||
{ | ||
t_bench.pucch_alloc.alloc_ded_pucch_harq_ack_ue( | ||
t_bench.res_grid, t_bench.get_main_ue().crnti, t_bench.get_main_ue().get_pcell().cfg(), t_bench.k0, t_bench.k1); | ||
} | ||
|
||
// Add a HARQ grant of PUCCH Formats 2/3/4 (> 2 bits) to the main UE. | ||
std::optional<unsigned> add_format2_3_4_harq_grant() | ||
{ | ||
t_bench.pucch_alloc.alloc_ded_pucch_harq_ack_ue( | ||
t_bench.res_grid, t_bench.get_main_ue().crnti, t_bench.get_main_ue().get_pcell().cfg(), t_bench.k0, t_bench.k1); | ||
t_bench.pucch_alloc.alloc_ded_pucch_harq_ack_ue( | ||
t_bench.res_grid, t_bench.get_main_ue().crnti, t_bench.get_main_ue().get_pcell().cfg(), t_bench.k0, t_bench.k1); | ||
return t_bench.pucch_alloc.alloc_ded_pucch_harq_ack_ue( | ||
t_bench.res_grid, t_bench.get_main_ue().crnti, t_bench.get_main_ue().get_pcell().cfg(), t_bench.k0, t_bench.k1); | ||
} | ||
|
||
// Add a CSI grant to the main UE. | ||
void add_csi_grant(unsigned csi_part1_bits = 4) | ||
{ | ||
t_bench.pucch_alloc.pucch_allocate_csi_opportunity(t_bench.res_grid[t_bench.k0 + t_bench.k1], | ||
t_bench.get_main_ue().crnti, | ||
t_bench.get_main_ue().get_pcell().cfg(), | ||
csi_part1_bits); | ||
} | ||
|
||
// Add an extra UE and allocate a HARQ grant to it. | ||
void add_ue_with_harq_grant() | ||
{ | ||
t_bench.add_ue(); | ||
t_bench.pucch_alloc.alloc_ded_pucch_harq_ack_ue(t_bench.res_grid, | ||
t_bench.last_allocated_rnti, | ||
t_bench.get_ue(t_bench.last_allocated_ue_idx).get_pcell().cfg(), | ||
t_bench.k0, | ||
t_bench.k1); | ||
} | ||
|
||
// Add a HARQ grant of PUCCH Formats 2/3/4 (> 2 bits) to the last allocated UE. | ||
void add_harq_f2_3_4_to_last_allocated_ue() | ||
{ | ||
t_bench.pucch_alloc.alloc_ded_pucch_harq_ack_ue(t_bench.res_grid, | ||
t_bench.last_allocated_rnti, | ||
t_bench.get_ue(t_bench.last_allocated_ue_idx).get_pcell().cfg(), | ||
t_bench.k0, | ||
t_bench.k1); | ||
t_bench.pucch_alloc.alloc_ded_pucch_harq_ack_ue(t_bench.res_grid, | ||
t_bench.last_allocated_rnti, | ||
t_bench.get_ue(t_bench.last_allocated_ue_idx).get_pcell().cfg(), | ||
t_bench.k0, | ||
t_bench.k1); | ||
t_bench.pucch_alloc.alloc_ded_pucch_harq_ack_ue(t_bench.res_grid, | ||
t_bench.last_allocated_rnti, | ||
t_bench.get_ue(t_bench.last_allocated_ue_idx).get_pcell().cfg(), | ||
t_bench.k0, | ||
t_bench.k1); | ||
} | ||
|
||
// Add an extra UE and allocate a HARQ grant of PUCCH Formats 2/3/4 (> 2 bits) to it. | ||
void add_ue_with_format2_harq_grant() | ||
{ | ||
t_bench.add_ue(); | ||
add_harq_f2_3_4_to_last_allocated_ue(); | ||
} | ||
|
||
// Add an extra UE and allocate a SR HARQ grant of PUCCH Formats 2/3/4 (> 2 bits) to it. | ||
void add_ue_with_sr_and_harq_f2_3_4() | ||
{ | ||
t_bench.add_ue(); | ||
t_bench.pucch_alloc.pucch_allocate_sr_opportunity(t_bench.res_grid[t_bench.k0 + t_bench.k1], | ||
t_bench.last_allocated_rnti, | ||
t_bench.get_ue(t_bench.last_allocated_ue_idx).get_pcell().cfg()); | ||
add_harq_f2_3_4_to_last_allocated_ue(); | ||
} | ||
|
||
// Add an extra UE and allocate a CSI HARQ grant of PUCCH Formats 2/3/4 (> 2 bits) to it. | ||
void add_ue_with_csi_and_harq_f2() | ||
{ | ||
unsigned csi_part1_bits = 4; | ||
t_bench.add_ue(); | ||
t_bench.pucch_alloc.pucch_allocate_csi_opportunity(t_bench.res_grid[t_bench.k0 + t_bench.k1], | ||
t_bench.last_allocated_rnti, | ||
t_bench.get_ue(t_bench.last_allocated_ue_idx).get_pcell().cfg(), | ||
csi_part1_bits); | ||
add_harq_f2_3_4_to_last_allocated_ue(); | ||
} | ||
}; |
Oops, something went wrong.