@@ -60,6 +60,38 @@ static pucch_resource* get_sr_pucch_res_cfg(const pucch_config& pucch_cfg)
6060 return res_cfg != pucch_res_list.end () ? const_cast <pucch_resource*>(res_cfg) : nullptr ;
6161}
6262
63+ static void mark_pucch_in_resource_grid (cell_slot_resource_allocator& pucch_slot_alloc,
64+ const grant_info& first_hop_grant,
65+ const std::optional<grant_info>& second_hop_grant,
66+ const crb_interval& ul_bwp_crbs,
67+ const scheduler_expert_config& expert_cfg)
68+ {
69+ const unsigned guard_rbs = expert_cfg.ue .min_pucch_pusch_prb_distance ;
70+
71+ if (guard_rbs == 0 ) {
72+ pucch_slot_alloc.ul_res_grid .fill (first_hop_grant);
73+ if (second_hop_grant.has_value ()) {
74+ pucch_slot_alloc.ul_res_grid .fill (second_hop_grant.value ());
75+ }
76+ return ;
77+ }
78+
79+ // Add guard band to the allocated grid resources to minimize cross PUCCH-PUSCH interference.
80+ auto grant_extended = first_hop_grant;
81+ unsigned start = first_hop_grant.crbs .start () >= guard_rbs ? first_hop_grant.crbs .start () - guard_rbs : 0 ;
82+ grant_extended.crbs = {start, first_hop_grant.crbs .stop () + guard_rbs};
83+ grant_extended.crbs .intersect (ul_bwp_crbs);
84+ pucch_slot_alloc.ul_res_grid .fill (grant_extended);
85+
86+ if (second_hop_grant.has_value ()) {
87+ start = second_hop_grant->crbs .start () >= guard_rbs ? second_hop_grant->crbs .start () - guard_rbs : 0 ;
88+ grant_extended = *second_hop_grant;
89+ grant_extended.crbs = {start, second_hop_grant->crbs .stop () + guard_rbs};
90+ grant_extended.crbs .intersect (ul_bwp_crbs);
91+ pucch_slot_alloc.ul_res_grid .fill (grant_extended);
92+ }
93+ }
94+
6395static void mark_pucch_in_resource_grid (cell_slot_resource_allocator& pucch_slot_alloc,
6496 const pucch_resource& pucch_res,
6597 const ue_cell_configuration& ue_cell_cfg)
@@ -88,23 +120,9 @@ static void mark_pucch_in_resource_grid(cell_slot_resource_allocator& pucch_slot
88120 first_hop_grant = {init_ul_bwp.scs , symbols, crbs};
89121 }
90122
91- // Add guard band to the allocated grid resources to minimize cross PUCCH-PUSCH interference.
92- const unsigned guard_rbs = ue_cell_cfg.cell_cfg_common .expert_cfg .ue .min_pucch_pusch_prb_distance ;
93- if (guard_rbs > 0 ) {
94- unsigned start = first_hop_grant.crbs .start () >= guard_rbs ? first_hop_grant.crbs .start () - guard_rbs : 0 ;
95- first_hop_grant.crbs = {start, first_hop_grant.crbs .stop () + guard_rbs};
96- first_hop_grant.crbs .intersect (init_ul_bwp.crbs );
97- if (second_hop_grant.has_value ()) {
98- start = second_hop_grant->crbs .start () >= guard_rbs ? second_hop_grant->crbs .start () - guard_rbs : 0 ;
99- second_hop_grant->crbs = {start, second_hop_grant->crbs .stop () + guard_rbs};
100- second_hop_grant->crbs .intersect (init_ul_bwp.crbs );
101- }
102- }
103-
104- pucch_slot_alloc.ul_res_grid .fill (first_hop_grant);
105- if (second_hop_grant.has_value ()) {
106- pucch_slot_alloc.ul_res_grid .fill (second_hop_grant.value ());
107- }
123+ // Fill Slot grid.
124+ mark_pucch_in_resource_grid (
125+ pucch_slot_alloc, first_hop_grant, second_hop_grant, init_ul_bwp.crbs , ue_cell_cfg.cell_cfg_common .expert_cfg );
108126}
109127
110128// //////////// Public functions //////////////
@@ -169,8 +187,11 @@ std::optional<unsigned> pucch_allocator_impl::alloc_common_pucch_harq_ack_ue(cel
169187 }
170188
171189 // Fill Slot grid.
172- pucch_slot_alloc.ul_res_grid .fill (pucch_res.value ().first_hop_res );
173- pucch_slot_alloc.ul_res_grid .fill (pucch_res.value ().second_hop_res );
190+ mark_pucch_in_resource_grid (pucch_slot_alloc,
191+ pucch_res->first_hop_res ,
192+ pucch_res->second_hop_res ,
193+ cell_cfg.ul_cfg_common .init_ul_bwp .generic_params .crbs ,
194+ cell_cfg.expert_cfg );
174195
175196 // Fill scheduler output.
176197 pucch_info& pucch_info = pucch_slot_alloc.result .ul .pucchs .emplace_back ();
@@ -1008,8 +1029,11 @@ void pucch_allocator_impl::compute_pucch_common_params_and_alloc(cell_slot_resou
10081029 .format = pucch_res.format });
10091030
10101031 // Allocate common HARQ-ACK resource.
1011- pucch_alloc.ul_res_grid .fill (first_hop_grant);
1012- pucch_alloc.ul_res_grid .fill (second_hop_grant);
1032+ mark_pucch_in_resource_grid (pucch_alloc,
1033+ first_hop_grant,
1034+ second_hop_grant,
1035+ cell_cfg.ul_cfg_common .init_ul_bwp .generic_params .crbs ,
1036+ cell_cfg.expert_cfg );
10131037
10141038 // Update the PUCCH grants with the common resource.
10151039 auto & pucch_grants = pucch_grants_alloc_grid[pucch_alloc.slot .to_uint ()];
0 commit comments