Compare commits

...

1 Commits

Author SHA1 Message Date
Rakesh Mundlamuri
00497d62ff Enable SRS to use 8 ports in the PHY 2026-03-20 15:02:27 +05:30
4 changed files with 62 additions and 24 deletions

View File

@@ -72,8 +72,7 @@
#define MAX_NUM_NR_RE (4*14*273*12)
#define MAX_NUM_NR_SRS_SYMBOLS 4
#define MAX_NUM_NR_SRS_AP 4
#define MAX_NUM_NR_SRS_AP 8
#define MAX_DELAY_COMP 20

View File

@@ -48,7 +48,7 @@
#define MAX_NR_OF_SRS_RESOURCES_PER_SET (1)
#define NR_NUMBER_OF_SUBFRAMES_PER_FRAME (10)
#define MAX_NROFSRS_PORTS (4)
#define MAX_NROFSRS_PORTS (8)
/* TS 38.211 Table 4.3.2-1: Number of OFDM symbols per slot, slots per frame, and slots per subframe for normal cyclic prefix */
#define MU_NUMBER (5)
@@ -163,13 +163,9 @@ typedef struct TDD_UL_DL_SlotConfig_s {
*
************************************************************************/
static const int16_t SRS_antenna_port[MAX_NROFSRS_PORTS] = {1000, 1001, 1002, 1003};
static const int16_t SRS_antenna_port[MAX_NROFSRS_PORTS] = {1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007};
typedef enum {
port1 = 1,
port2 = 2,
port4 = 4
} nrof_Srs_Ports_t;
typedef enum { port1 = 1, port2 = 2, port4 = 4, port8 = 8 } nrof_Srs_Ports_t;
typedef enum {
neitherHopping = 0,

View File

@@ -234,7 +234,14 @@ bool generate_srs_nr(const NR_DL_FRAME_PARMS *frame_parms,
LOG_I(NR_PHY,"============ port %d ============\n", p_index);
#endif
uint16_t n_SRS_cs_i = (nr_srs_info->n_SRS_cs + (n_SRS_cs_max * (SRS_antenna_port[p_index] - 1000) / N_ap)) % n_SRS_cs_max;
uint16_t n_SRS_cs_i = 0;
if ((N_ap == 8) && (n_SRS_cs_max == 6)) {
n_SRS_cs_i = (nr_srs_info->n_SRS_cs + (n_SRS_cs_max * (SRS_antenna_port[p_index] - 1000) / 4) / 2) % n_SRS_cs_max;
} else if (((N_ap == 4) && (n_SRS_cs_max == 6)) || ((N_ap == 8) && (n_SRS_cs_max == 12))) {
n_SRS_cs_i = (nr_srs_info->n_SRS_cs + (n_SRS_cs_max * (SRS_antenna_port[p_index] - 1000) / 2) / (N_ap / 2)) % n_SRS_cs_max;
} else {
n_SRS_cs_i = (nr_srs_info->n_SRS_cs + (n_SRS_cs_max * (SRS_antenna_port[p_index] - 1000)) / N_ap) % n_SRS_cs_max;
}
double alpha_i = 2 * M_PI * ((double)n_SRS_cs_i / (double)n_SRS_cs_max);
#ifdef SRS_DEBUG
@@ -289,10 +296,30 @@ bool generate_srs_nr(const NR_DL_FRAME_PARMS *frame_parms,
// Compute the frequency-domain starting position
uint8_t K_TC_p = 0;
if((nr_srs_info->n_SRS_cs >= n_SRS_cs_max / 2)
&& (nr_srs_info->n_SRS_cs < n_SRS_cs_max)
&& (N_ap == 4)
&& ((SRS_antenna_port[p_index] == 1001) || (SRS_antenna_port[p_index] == 1003))) {
if ((N_ap == 8) && ((SRS_antenna_port[p_index] == 1003) || (SRS_antenna_port[p_index] == 1007)) && (n_SRS_cs_max == 6)) {
K_TC_p = (nr_srs_info->K_TC_overbar + 3 * K_TC / 4) % K_TC;
} else if ((N_ap == 8) && ((SRS_antenna_port[p_index] == 1002) || (SRS_antenna_port[p_index] == 1006))
&& (n_SRS_cs_max == 6)) {
K_TC_p = (nr_srs_info->K_TC_overbar + K_TC / 2) % K_TC;
} else if ((N_ap == 8) && ((SRS_antenna_port[p_index] == 1001) || (SRS_antenna_port[p_index] == 1005))
&& (n_SRS_cs_max == 6)) {
K_TC_p = (nr_srs_info->K_TC_overbar + K_TC / 4) % K_TC;
} else if ((N_ap == 8)
&& ((SRS_antenna_port[p_index] == 1001) || (SRS_antenna_port[p_index] == 1003)
|| (SRS_antenna_port[p_index] == 1005) || (SRS_antenna_port[p_index] == 1007))
&& (n_SRS_cs_max == 12)) {
K_TC_p = (nr_srs_info->K_TC_overbar + K_TC / 2) % K_TC;
} else if ((N_ap == 8)
&& ((SRS_antenna_port[p_index] == 1001) || (SRS_antenna_port[p_index] == 1003)
|| (SRS_antenna_port[p_index] == 1005) || (SRS_antenna_port[p_index] == 1007))
&& (n_SRS_cs_max == 8) && (nr_srs_info->n_SRS_cs >= n_SRS_cs_max / 2) && (nr_srs_info->n_SRS_cs < n_SRS_cs_max)) {
K_TC_p = (nr_srs_info->K_TC_overbar + K_TC / 2) % K_TC;
} else if ((N_ap == 4) && ((SRS_antenna_port[p_index] == 1001) || (SRS_antenna_port[p_index] == 1003))
&& (n_SRS_cs_max == 6)) {
K_TC_p = (nr_srs_info->K_TC_overbar + K_TC / 2) % K_TC;
} else if ((nr_srs_info->n_SRS_cs >= n_SRS_cs_max / 2) && (nr_srs_info->n_SRS_cs < n_SRS_cs_max) && (N_ap == 4)
&& ((SRS_antenna_port[p_index] == 1001) || (SRS_antenna_port[p_index] == 1003))
&& ((n_SRS_cs_max == 8) || (n_SRS_cs_max == 12))) {
K_TC_p = (nr_srs_info->K_TC_overbar + K_TC / 2) % K_TC;
} else {
K_TC_p = nr_srs_info->K_TC_overbar;

View File

@@ -95,7 +95,7 @@ int main(int argc, char *argv[])
double **s_re, **s_im, **r_re, **r_im;
int trial, n_trials = 1, delay = 0;
double maxDoppler = 0.0;
uint8_t n_tx = 1, n_rx = 1;
uint8_t n_tx = 1, n_rx = 1, n_ports = 1;
channel_desc_t *UE2gNB;
uint8_t extended_prefix_flag = 0;
SCM_t channel_model = AWGN;
@@ -127,7 +127,7 @@ int main(int argc, char *argv[])
InitSinLUT();
int c;
while ((c = getopt(argc, argv, "--:O:a:b:c:d:e:f:g:h:i:kl:m:n:p:s:u:y:z:A:B:C:H:PR:S:L:")) != -1) {
while ((c = getopt(argc, argv, "--:O:a:b:c:d:e:f:g:h:i:kl:m:n:p:q:s:u:y:z:A:B:C:H:PR:S:L:")) != -1) {
/* ignore long options starting with '--', option '-O' and their arguments that are handled by configmodule */
/* with this opstring getopt returns 1 for non-option arguments, refer to 'man 3 getopt' */
if (c == 1 || c == '-' || c == 'O')
@@ -159,7 +159,7 @@ int main(int argc, char *argv[])
case 'e':
srs_comb_size = atoi(optarg);
AssertFatal(srs_comb_size >= 0 && srs_comb_size < 2, "comb_size %d is not in 0 or 1\n", srs_comb_size);
AssertFatal(srs_comb_size >= 0 && srs_comb_size < 3, "comb_size %d is not between 0 or 2\n", srs_comb_size);
break;
case 'f':
@@ -168,6 +168,8 @@ int main(int argc, char *argv[])
AssertFatal(srs_comb_offset >= 0 && srs_comb_offset <= 1, "comb_offset %d is not in 0...1\n", srs_comb_offset);
} else if (srs_comb_size == 1) {
AssertFatal(srs_comb_offset >= 0 && srs_comb_offset <= 3, "comb_offset %d is not in 0...3\n", srs_comb_offset);
} else if (srs_comb_size == 2) {
AssertFatal(srs_comb_offset >= 0 && srs_comb_offset <= 7, "comb_offset %d is not in 0...7\n", srs_comb_offset);
}
break;
@@ -219,9 +221,11 @@ int main(int argc, char *argv[])
case 'i':
srs_cyclic_shift = atoi(optarg);
if (srs_comb_size == 0) {
AssertFatal(srs_cyclic_shift >= 0 && srs_cyclic_shift <= 7, "comb_shift %d is not in 0...7\n", srs_cyclic_shift);
AssertFatal(srs_cyclic_shift >= 0 && srs_cyclic_shift <= 8, "cyclic_shift %d is not in 0...8\n", srs_cyclic_shift);
} else if (srs_comb_size == 1) {
AssertFatal(srs_cyclic_shift >= 0 && srs_cyclic_shift <= 11, "comb_shift %d is not in 0...11\n", srs_cyclic_shift);
AssertFatal(srs_cyclic_shift >= 0 && srs_cyclic_shift <= 12, "cyclic_shift %d is not in 0...12\n", srs_cyclic_shift);
} else if (srs_comb_size == 2) {
AssertFatal(srs_cyclic_shift >= 0 && srs_cyclic_shift <= 6, "cyclic_shift %d is not in 0...6\n", srs_cyclic_shift);
}
break;
@@ -238,6 +242,14 @@ int main(int argc, char *argv[])
extended_prefix_flag = 1;
break;
case 'q':
n_ports = atoi(optarg);
if ((n_ports < 0) || (n_ports > 3)) {
printf("Unsupported number of antenna ports %d\n", n_ports);
exit(-1);
}
break;
case 's':
snr0 = atof(optarg);
printf("Setting SNR0 to %f\n", snr0);
@@ -249,7 +261,7 @@ int main(int argc, char *argv[])
case 'y':
n_tx = atoi(optarg);
if ((n_tx == 0) || (n_tx > 4)) {
if ((n_tx == 0) || (n_tx > 8)) {
printf("Unsupported number of tx antennas %d\n", n_tx);
exit(-1);
}
@@ -304,6 +316,7 @@ int main(int argc, char *argv[])
printf("-k 3/4 sampling\n");
printf("-n Number of trials to simulate\n");
printf("-p Use extended prefix mode\n");
printf("-q number of antenna ports, 0 (1 port), 1 (2 ports), 2 (4 ports), 3 (8 ports)\n");
printf("-s Starting SNR, runs from SNR0 to SNR0 + 10 dB if ending SNR isn't given\n");
printf("-S Ending SNR, runs from SNR0 to SNR1\n");
printf("-u Set the numerology\n");
@@ -321,6 +334,11 @@ int main(int argc, char *argv[])
logInit();
set_glog(loglvl);
if ((1 << n_ports) > min(n_tx, n_rx)) {
printf("Unsupported port configuration\n");
exit(-1);
}
int ret = 1;
if (snr1set == 0)
@@ -424,9 +442,7 @@ int main(int argc, char *argv[])
.bwp_start = NRRIV2PRBOFFSET(locationAndBandwidth, 275),
.subcarrier_spacing = fp->numerology_index,
.cyclic_prefix = extended_prefix_flag,
.num_ant_ports = n_tx == 4 ? 2
: n_tx == 2 ? 1
: 0,
.num_ant_ports = n_ports,
.num_symbols = nb_symb_srs,
.num_repetitions = 0, // Value: 0 = 1, 1 = 2, 2 = 4
.time_start_position = fp->symbols_per_slot - 1 - srs_start_symbol,
@@ -550,7 +566,7 @@ int main(int argc, char *argv[])
int tao_ns_count = 0;
for (trial = 0; trial < n_trials && !stop; trial++) {
// Estimate noise power from the transmitter level and SNR
double sigma = compute_noise_variance(txlev_sum, ofdm_symbol_size, srs_pdu.bwp_size, 1, SNR, n_trials);
double sigma = compute_noise_variance(txlev_sum, ofdm_symbol_size, srs_pdu.bwp_size, n_ports, SNR, n_trials);
//----------- Apply propagation channel ----------------------------
multipath_channel(UE2gNB, s_re, s_im, r_re, r_im, slot_length, 0, (n_trials == 1) ? 1 : 0);