nr_dlsim: add -f feature flag support and remove unused SCG handling

- Replace previous handling of -f with a generic feature flag option.
- Add support for the "cuda" flag to enable CUDA channel simulation when
  compiled with ENABLE_CUDA.
- Remove unused SCGroupConfig file handling (scg_fd) and related code.
- Clean up deprecated code and variables associated with SCG reading - not
  required anymore after b232be94ed
This commit is contained in:
Jaroslava Fiedlerova
2026-02-26 11:32:09 +00:00
parent 5fb9a9c665
commit de3dfee0c2
+14 -69
View File
@@ -407,8 +407,6 @@ int main(int argc, char **argv)
int print_perf = 0;
FILE *scg_fd=NULL;
int use_cuda = 0;
void *h_tx_sig_pinned = NULL;
@@ -420,15 +418,7 @@ int main(int argc, char **argv)
void *d_channel_coeffs_gpu = NULL;
#endif
static struct option long_options[] = {{"cuda", no_argument, 0, 0}, {0, 0, 0, 0}};
int option_index = 0;
while ((c = getopt_long(argc,
argv,
"O:f:hA:p:g:i:n:s:S:t:v:x:y:z:o:H:M:N:F:GR:d:PI:L:a:b:e:m:w:T:U:q:X:Y:Z:",
long_options,
&option_index))
!= -1) {
while ((c = getopt(argc, argv, "--:O:f:hA:p:f:g:i:n:s:S:t:v:x:y:z:o:H:M:N:F:GR:d:PI:L:a:b:e:m:w:T:U:q:X:Y:Z:")) != -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')
@@ -436,19 +426,14 @@ int main(int argc, char **argv)
printf("handling optarg %c\n",c);
switch (c) {
#ifdef ENABLE_CUDA
case 0:
if (strcmp(long_options[option_index].name, "cuda") == 0) {
use_cuda = 1;
}
#endif
break;
case 'f':
scg_fd = fopen(optarg,"r");
if (scg_fd==NULL) {
printf("Error opening %s\n",optarg);
#ifdef ENABLE_CUDA
if (strcmp(optarg, "cuda") == 0) {
use_cuda = 1;
} else
#endif
{
printf("Unsupported flag '%s' for -f. Run '-h' to see the list of available options.\n", optarg);
exit(-1);
}
break;
@@ -658,7 +643,12 @@ int main(int argc, char **argv)
printf("-b Number of PRB for PDSCH\n");
printf("-d number of dlsch threads, 0: no dlsch parallelization\n");
printf("-e MSC index\n");
printf("-f raw file containing RRC configuration (generated by gNB)\n");
printf("-f <flag> Enable optional feature flag. Available flags:\n");
#ifdef ENABLE_CUDA
printf(" cuda Enable CUDA channel simulation\n");
#else
printf(" (none) No optional features were compiled into this executable\n");
#endif
printf("-g Channel model: [A] TDLA30, [B] TDLB100, [C] TDLC300, e.g. -g A\n");
printf("-h This message\n");
printf("-H Slot number\n");
@@ -818,48 +808,6 @@ int main(int argc, char **argv)
gNB_mac->dl_bler.harq_round_max = num_rounds;
/*
// read in SCGroupConfig
AssertFatal(scg_fd != NULL,"no reconfig.raw file\n");
char buffer[1024];
int msg_len=fread(buffer,1,1024,scg_fd);
NR_RRCReconfiguration_t *NR_RRCReconfiguration = NULL;
printf("Decoding NR_RRCReconfiguration (%d bytes)\n",msg_len);
asn_dec_rval_t dec_rval = uper_decode_complete( NULL,
&asn_DEF_NR_RRCReconfiguration,
(void **)&NR_RRCReconfiguration,
(uint8_t *)buffer,
msg_len);
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
AssertFatal(1==0,"NR_RRCReConfiguration decode error\n");
// free the memory
SEQUENCE_free( &asn_DEF_NR_RRCReconfiguration, NR_RRCReconfiguration, 1 );
exit(-1);
}
fclose(scg_fd);
AssertFatal(NR_RRCReconfiguration->criticalExtensions.present == NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration,"wrong NR_RRCReconfiguration->criticalExstions.present type\n");
NR_RRCReconfiguration_IEs_t *reconfig_ies = NR_RRCReconfiguration->criticalExtensions.choice.rrcReconfiguration;
NR_CellGroupConfig_t *secondaryCellGroup = NULL;
dec_rval = uper_decode_complete( NULL,
&asn_DEF_NR_CellGroupConfig,
(void **)&secondaryCellGroup,
(uint8_t *)reconfig_ies->secondaryCellGroup->buf,
reconfig_ies->secondaryCellGroup->size);
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
AssertFatal(1==0,"NR_CellGroupConfig decode error\n");
// free the memory
SEQUENCE_free( &asn_DEF_NR_CellGroupConfig, secondaryCellGroup, 1 );
exit(-1);
}
NR_ServingCellConfigCommon_t *scc = secondaryCellGroup->spCellConfig->reconfigurationWithSync->spCellConfigCommon;
*/
gNB->ap_N1 = pdsch_AntennaPorts.N1;
gNB->ap_N2 = pdsch_AntennaPorts.N2;
gNB->ap_XP = pdsch_AntennaPorts.XP;
@@ -1595,9 +1543,6 @@ int main(int argc, char **argv)
if (input_fd)
fclose(input_fd);
if (scg_fd)
fclose(scg_fd);
// closing csv file
if (filename_csv != NULL) { // means we are asked to print stats to CSV
fclose(csv_file);