Commit 29ee6b17 authored by francescomani's avatar francescomani

adding check on allowed pm index in dlsim

parent 65ce8348
......@@ -723,6 +723,18 @@ void get_samplerate_and_bw(int mu,
}
}
void get_K1_K2(int N1, int N2, int *K1, int *K2)
{
// num of allowed k1 and k2 according to 5.2.2.2.1-3 and -4 in 38.214
if(N2 == N1 || N1 == 2)
*K1 = 2;
else if (N2 == 1)
*K1 = 5;
else
*K1 = 3;
*K2 = N2 > 1 ? 2 : 1;
}
// from start symbol index and nb or symbols to symbol occupation bitmap in a slot
uint16_t SL_to_bitmap(int startSymbolIndex, int nrOfSymbols) {
return ((1<<nrOfSymbols)-1)<<startSymbolIndex;
......
......@@ -92,6 +92,7 @@ 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);
void get_samplerate_and_bw(int mu,
int n_rb,
int8_t threequarter_fs,
......
......@@ -236,8 +236,39 @@ nrUE_params_t *get_nrUE_params(void) {
return &nrUE_params;
}
void do_nothing(void *args) {
void validate_input_pmi(rrc_pdsch_AntennaPorts_t pdsch_AntennaPorts, int nrOfLayers, int pmi)
{
if (pmi == 0)
return;
int num_antenna_ports = pdsch_AntennaPorts.N1 * pdsch_AntennaPorts.N2 * pdsch_AntennaPorts.XP;
int N1 = pdsch_AntennaPorts.N1;
int N2 = pdsch_AntennaPorts.N2;
int O1 = N1 > 1 ? 4 : 1;
int O2 = N2 > 1 ? 4 : 1;
int K1, K2;
if (num_antenna_ports > 2)
get_K1_K2(N1, N2, &K1, &K2);
else {
K1 = 1; K2 = 1;
}
int num_pmi = 1; // pmi = 0 is the identity matrix
switch (nrOfLayers) {
case 1 :
num_pmi += N1 * O1 * N2 * O2 * 4;
AssertFatal(pmi < num_pmi, "Input PMI index %d exceeds the limit of configured matrices %d for %d layers\n", pmi, num_pmi, nrOfLayers);
return;
case 2 :
num_pmi += N1 * O1 * N2 * O2 * K1 * K2 * 2;
AssertFatal(pmi < num_pmi, "Input PMI index %d exceeds the limit of conigured matrices %d for %d layers\n", pmi, num_pmi, nrOfLayers);
break;
default :
AssertFatal(false, "Precoding with more than 2 nrOfLayers not yet supported\n");
}
}
int NB_UE_INST = 1;
int main(int argc, char **argv)
......@@ -544,6 +575,7 @@ int main(int argc, char **argv)
printf("-y Number of TX antennas used in gNB\n");
printf("-z Number of RX antennas used in UE\n");
printf("-x Num of layer for PDSCH\n");
printf("-p Precoding matrix index\n");
printf("-i Change channel estimation technique. Arguments list: Frequency domain {0:Linear interpolation, 1:PRB based averaging}, Time domain {0:Estimates of last DMRS symbol, 1:Average of DMRS symbols}\n");
//printf("-j Relative strength of second intefering gNB (in dB) - cell_id mod 3 = 2\n");
printf("-R N_RB_DL\n");
......@@ -673,6 +705,8 @@ int main(int argc, char **argv)
gNB->ap_N2 = pdsch_AntennaPorts.N2;
gNB->ap_XP = pdsch_AntennaPorts.XP;
validate_input_pmi(pdsch_AntennaPorts, g_nrOfLayers, g_pmi);
NR_UE_NR_Capability_t* UE_Capability_nr = CALLOC(1,sizeof(NR_UE_NR_Capability_t));
prepare_sim_uecap(UE_Capability_nr,scc,mu,
N_RB_DL,g_mcsTableIdx);
......
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