Commit 5c467b61 authored by francescomani's avatar francescomani

improvements for 4-layer MIMO at gNB

parent 513f060f
......@@ -85,11 +85,9 @@ static const int tables_5_3_2[5][12] = {
{32, 66, 132, 264, -1, -1, -1, -1, -1, -1, -1, -1} // 120FR2
};
int get_supported_band_index(int scs, int band, int n_rbs)
int get_supported_band_index(int scs, frequency_range_t freq_range, int n_rbs)
{
int scs_index = scs;
if (band > 256)
scs_index++;
int scs_index = scs + freq_range;
for (int i = 0; i < 12; i++) {
if(n_rbs == tables_5_3_2[scs_index][i])
return i;
......@@ -224,7 +222,7 @@ bool compare_relative_ul_channel_bw(int nr_band, int scs, int nb_ul, frame_type_
// 38.101-1 section 6.2.2
// Relative channel bandwidth <= 4% for TDD bands and <= 3% for FDD bands
int index = get_nr_table_idx(nr_band, scs);
int bw_index = get_supported_band_index(scs, nr_band, nb_ul);
int bw_index = get_supported_band_index(scs, nr_band > 256 ? FR2 : FR1, nb_ul);
int band_size_khz = get_supported_bw_mhz(nr_band > 256 ? FR2 : FR1, bw_index) * 1000;
float limit = frame_type == TDD ? 0.04 : 0.03;
float rel_bw = (float) (2 * band_size_khz) / (float) (nr_bandtable[index].ul_max + nr_bandtable[index].ul_min);
......
......@@ -186,11 +186,11 @@ void SLIV2SL(int SLIV,int *S,int *L);
int get_dmrs_port(int nl, uint16_t dmrs_ports);
uint16_t SL_to_bitmap(int startSymbolIndex, int nrOfSymbols);
int get_nb_periods_per_frame(uint8_t tdd_period);
int get_supported_band_index(int scs, int band, int n_rbs);
long rrc_get_max_nr_csrs(const int max_rbs, long b_SRS);
void get_K1_K2(int N1, int N2, int *K1, int *K2);
bool compare_relative_ul_channel_bw(int nr_band, int scs, int nb_ul, frame_type_t frame_type);
int get_supported_bw_mhz(frequency_range_t frequency_range, int bw_index);
int get_supported_band_index(int scs, frequency_range_t freq_range, int n_rbs);
void get_samplerate_and_bw(int mu,
int n_rb,
int8_t threequarter_fs,
......
......@@ -60,7 +60,7 @@ Furthermore, the gNB and UE support
- Single and multiple DMRS symbols
- PTRS support
- Support for 1, 2 and 4 TX antennas
- Support for up to 2 layers (currently limited to DMRS configuration type 2)
- Support for up to 4 layers
- Support for 256 QAM
* NR-CSIRS Generation of sequence at PHY
* NR-PUSCH (including Segmentation, LDPC encoding, rate matching, scrambling, modulation, RB mapping, etc).
......
......@@ -1004,7 +1004,8 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
int frame,
int slot,
nfapi_nr_uci_pucch_pdu_format_2_3_4_t* uci_pdu,
nfapi_nr_pucch_pdu_t* pucch_pdu) {
nfapi_nr_pucch_pdu_t* pucch_pdu)
{
c16_t **rxdataF = gNB->common_vars.rxdataF;
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
......
......@@ -499,6 +499,9 @@ typedef struct{
uint8_t li_bitlen[8];
uint8_t pmi_x1_bitlen[8];
uint8_t pmi_x2_bitlen[8];
uint8_t pmi_i11_bitlen[8];
uint8_t pmi_i12_bitlen[8];
uint8_t pmi_i13_bitlen[8];
uint8_t cqi_bitlen[8];
} CSI_Meas_bitlen_t;
......
......@@ -129,6 +129,46 @@ uint8_t get_dl_nrOfLayers(const NR_UE_sched_ctrl_t *sched_ctrl,
}
// Table 5.2.2.2.1-3 and Table 5.2.2.2.1-4 in 38.214
void get_k1_k2_indices(const int layers, const int N1, const int N2, const int i13, int *k1, int *k2)
{
*k1 = 0;
*k2 = 0;
if (layers == 2) {
if (N2 == 1)
*k1 = i13;
else if (N1 == N2) {
*k1 = i13 & 1;
*k2 = i13 >> 1;
}
else {
*k1 = (i13 & 1) + (i13 == 3);
*k2 = (i13 == 2);
}
}
if (layers == 3 || layers == 4) {
if (N2 == 1)
*k1 = i13 + 1;
else if (N1 == 2 && N2 == 2) {
*k1 = !(i13 & 1);
*k2 = (i13 > 0);
}
else {
if (i13 == 0)
*k1 = 1;
if (i13 == 1)
*k2 = 1;
if (i13 == 2) {
*k1 = 1;
*k2 = 1;
}
if (i13 == 3)
*k1 = 2;
}
}
}
uint16_t get_pm_index(const gNB_MAC_INST *nrmac,
const NR_UE_info_t *UE,
nr_dci_format_t dci_format,
......@@ -144,7 +184,10 @@ uint16_t get_pm_index(const gNB_MAC_INST *nrmac,
const int N1 = csi_report->N1;
const int N2 = csi_report->N2;
const int antenna_ports = (N1 * N2) << 1;
const int x1 = sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.pmi_x1;
if (antenna_ports < 2)
return 0; // single antenna port
int x1 = sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.pmi_x1;
const int x2 = sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.pmi_x2;
LOG_D(NR_MAC,"PMI report: x1 %d x2 %d layers: %d\n", x1, x2, layers);
......@@ -159,8 +202,30 @@ uint16_t get_pm_index(const gNB_MAC_INST *nrmac,
// elements from n+1 to m for 2 layers etc.
if (antenna_ports == 2)
return 1 + prev_layers_size + x2; // 0 for identity matrix
else
AssertFatal(1==0,"More than 2 antenna ports not yet supported\n");
else {
// the order of i1x in X1 report needs to be verified
// the standard is not very clear (Table 6.3.1.1.2-7 in 38.212)
// it says: PMI wideband information fields X1 , from left to right
int bitlen = csi_report->csi_meas_bitlen.pmi_i13_bitlen[layers];
const int i13 = x1 & ((1 << bitlen) - 1);
x1 >>= bitlen;
bitlen = csi_report->csi_meas_bitlen.pmi_i12_bitlen[layers];
const int i12 = x1 & ((1 << bitlen) - 1);
x1 >>= bitlen;
bitlen = csi_report->csi_meas_bitlen.pmi_i11_bitlen[layers];
const int i11 = x1 & ((1 << bitlen) - 1);
const int i2 = x2;
int k1, k2;
get_k1_k2_indices(layers, N1, N2, i13, &k1, &k2); // get indices k1 and k2 for PHY matrix (not actual k1 and k2 values)
const int max_i2 = (layers == 1) ? 4 : 2;
// num of allowed k1 and k2 according to 5.2.2.2.1-3 and -4 in 38.214
int K1, K2;
get_K1_K2(N1, N2, &K1, &K2);
const int O2 = N2 == 1 ? 1 : 4;
// computing precoding matrix index according to rule set in allocation function init_codebook_gNB
int lay_index = i2 + (k2 * max_i2) + (k1 * max_i2 * K2) + (i12 * max_i2 * K2 * K1) + (i11 * max_i2 * K2 * K1 * N2 * O2);
return 1 + prev_layers_size + lay_index;
}
}
uint8_t get_mcs_from_cqi(int mcs_table, int cqi_table, int cqi_idx)
......
This diff is collapsed.
......@@ -44,7 +44,8 @@
#include "NR_SecurityConfig.h"
#include "NR_CellGroupConfig.h"
#define NR_MAX_SUPPORTED_DL_LAYERS 2
#define NR_MAX_SUPPORTED_DL_LAYERS 4
void rrc_init_nr_srb_param(NR_LCHAN_DESC *chan);
void rrc_gNB_process_SgNBAdditionRequest(
const protocol_ctxt_t *const ctxt_pP,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment