Beispiel #1
0
int test_dci_payload_size() {
  int i, j;
  int x[5];
  const srslte_dci_format_t formats[] = { SRSLTE_DCI_FORMAT0, SRSLTE_DCI_FORMAT1, SRSLTE_DCI_FORMAT1A, SRSLTE_DCI_FORMAT1C, SRSLTE_DCI_FORMAT2A };
  const int prb[6] = { 6, 15, 25, 50, 75, 100 };
  const int dci_sz[6][5] = { { 21, 19, 21, 8, 28 }, { 22, 23, 22, 10 , 31}, { 25, 27,
      25, 12 , 36}, { 27, 31, 27, 13 , 41}, { 27, 33, 27, 14 , 42}, { 28, 39, 28, 15, 48 }};

  srslte_dl_sf_cfg_t dl_sf;
  ZERO_OBJECT(dl_sf);

  srslte_cell_t cell_test;
  ZERO_OBJECT(cell_test);
  cell_test.nof_ports = 1;

  ZERO_OBJECT(dci_cfg);

  printf("Testing DCI payload sizes...\n");
  printf("  PRB\t0\t1\t1A\t1C\t2A\n");
  for (i = 0; i < 6; i++) {
    int n = prb[i];
    cell_test.nof_prb = n;

    for (j = 0; j < 5; j++) {
      x[j] = srslte_dci_format_sizeof(&cell_test, &dl_sf, &dci_cfg, formats[j]);
      if (x[j] != dci_sz[i][j]) {
        ERROR("Invalid DCI payload size for %s and %d PRB. Is %d and should be %d\n",
              srslte_dci_format_string(formats[j]),
              n,
              x[j],
              dci_sz[i][j]);
        return -1;
      }
    }
    printf("  %2d:\t%2d\t%2d\t%2d\t%2d\t%2d\n", n, x[0], x[1], x[2], x[3], x[4]);
  }
  printf("Ok\n");
  
  if (print_dci_table) {
    printf("dci_sz_table[101][4] = {\n");
    for (i=0;i<=100;i++) {
      printf("  {");
      for (j = 0; j < 4; j++) {
        cell_test.nof_prb = i;
        printf("%d", srslte_dci_format_sizeof(&cell, &dl_sf, &dci_cfg, formats[j]));
        if (j<3) {
          printf(", ");
        }
      }
      if (i<100) {
        printf("},\n");
      } else {
        printf("}\n");
      }
    }
    printf("};\n");
  }
  return 0;
}
Beispiel #2
0
static int dci_blind_search(srslte_ue_dl_t*     q,
                            srslte_dl_sf_cfg_t* sf,
                            uint16_t            rnti,
                            dci_blind_search_t* search_space,
                            srslte_dci_cfg_t*   dci_cfg,
                            srslte_dci_msg_t    dci_msg[SRSLTE_MAX_DCI_MSG])
{
  uint32_t nof_dci = 0;
  if (rnti) {
    int i = 0;
    while ((dci_cfg->cif_enabled || !nof_dci) && (i < search_space->nof_locations) && (nof_dci < SRSLTE_MAX_DCI_MSG)) {
      DEBUG("Searching format %s in %d,%d (%d/%d)\n",
            srslte_dci_format_string(search_space->format),
            search_space->loc[i].ncce,
            search_space->loc[i].L,
            i,
            search_space->nof_locations);

      dci_msg[nof_dci].location = search_space->loc[i];
      dci_msg[nof_dci].format   = search_space->format;
      dci_msg[nof_dci].rnti     = 0;
      if (srslte_pdcch_decode_msg(&q->pdcch, sf, dci_cfg, &dci_msg[nof_dci])) {
        ERROR("Error decoding DCI msg\n");
        return SRSLTE_ERROR;
      }

      if ((dci_msg[nof_dci].rnti == rnti) && (dci_msg[nof_dci].nof_bits > 0)) {

        dci_msg[nof_dci].rnti = rnti;
        // If searching for Format1A but found Format0 save it for later
        if (dci_msg[nof_dci].format == SRSLTE_DCI_FORMAT0 && search_space->format == SRSLTE_DCI_FORMAT1A) {
          /* If there is space for accumulate another UL DCI dci and it was not detected before, then store it */
          if (q->pending_ul_dci_count < SRSLTE_MAX_CARRIERS &&
              !find_dci(q->pending_ul_dci_msg, q->pending_ul_dci_count, &dci_msg[nof_dci])) {
            srslte_dci_msg_t* pending_ul_dci_msg = &q->pending_ul_dci_msg[q->pending_ul_dci_count];
            pending_ul_dci_msg->format           = dci_msg[nof_dci].format;
            pending_ul_dci_msg->location         = dci_msg[nof_dci].location;
            pending_ul_dci_msg->nof_bits         = dci_msg[nof_dci].nof_bits;
            pending_ul_dci_msg->rnti             = dci_msg[nof_dci].rnti;
            memcpy(pending_ul_dci_msg->payload, dci_msg[nof_dci].payload, dci_msg[nof_dci].nof_bits);
            q->pending_ul_dci_count++;
          }
          // Else if we found it, save location and keep going if required
        } else if (dci_msg[nof_dci].format == search_space->format) {
          /* Check if the DCI is duplicated */
          if (!find_dci(dci_msg, (uint32_t)nof_dci, &dci_msg[nof_dci])) {
            nof_dci++;
          }
        }
      }
      i++;
    }
  } else {
    ERROR("RNTI not specified\n");
  }
  return nof_dci;
}
Beispiel #3
0
void usage(char *prog) {
  printf("Usage: %s [vcfoe] -i input_file\n", prog);
  printf("\t-c cell.id [Default %d]\n", cell.id);
  printf("\t-f cfi [Default %d]\n", cfi);
  printf("\t-o DCI Format [Default %s]\n", srslte_dci_format_string(dci_format));
  printf("\t-r rnti [Default SI-RNTI]\n");
  printf("\t-p cell.nof_ports [Default %d]\n", cell.nof_ports);
  printf("\t-n cell.nof_prb [Default %d]\n", cell.nof_prb);
  printf("\t-m max_frames [Default %d]\n", max_frames);
  printf("\t-e Set extended prefix [Default Normal]\n");
  printf("\t-v [set srslte_verbose to debug, default none]\n");
}
Beispiel #4
0
// Blind search for C-RNTI
static int find_dl_dci_type_crnti(srslte_ue_dl_t*     q,
                                  srslte_dl_sf_cfg_t* sf,
                                  srslte_ue_dl_cfg_t* cfg,
                                  uint16_t            rnti,
                                  srslte_dci_msg_t    dci_msg[SRSLTE_MAX_DCI_MSG])
{
  int                 ret = SRSLTE_SUCCESS;
  dci_blind_search_t  search_space;
  dci_blind_search_t* current_ss = &search_space;

  uint32_t          sf_idx  = sf->tti % 10;
  uint32_t          cfi     = sf->cfi;
  srslte_dci_cfg_t* dci_cfg = &cfg->dci_cfg;

  // Search UE-specific search space
  if (q->pregen_rnti == rnti) {
    current_ss = &q->current_ss_ue[MI_IDX(sf_idx)][cfi - 1][sf_idx];
  } else {
    // If locations are not pre-generated, generate them now
    current_ss->nof_locations = srslte_pdcch_ue_locations(&q->pdcch, sf, current_ss->loc, MAX_CANDIDATES_UE, rnti);
  }

  if (cfg->cfg.tm > SRSLTE_TM8) {
    ERROR("Searching DL CRNTI: Invalid TM=%d\n", cfg->cfg.tm + 1);
  }

  for (int f = 0; f < 2; f++) {
    srslte_dci_format_t format = ue_dci_formats[cfg->cfg.tm][f];

    INFO("Searching DL C-RNTI %s in %d ue locations\n", srslte_dci_format_string(format), current_ss->nof_locations);

    current_ss->format = format;
    if ((ret = dci_blind_search(q, sf, rnti, current_ss, dci_cfg, dci_msg))) {
      return ret;
    }
  }

  // Search Format 1A in the Common SS also
  if (q->pregen_rnti == rnti) {
    current_ss = &q->current_ss_common[MI_IDX(sf_idx)][cfi - 1];
  } else {
    // If locations are not pre-generated, generate them now
    current_ss->nof_locations = srslte_pdcch_common_locations(&q->pdcch, current_ss->loc, MAX_CANDIDATES_COM, cfi);
  }

  // Search for RNTI only if there is room for the common search space
  if (current_ss->nof_locations > 0) {
    current_ss->format = SRSLTE_DCI_FORMAT1A;
    INFO("Searching DL C-RNTI in %d ue locations, format 1A\n", current_ss->nof_locations);
    return dci_blind_search(q, sf, rnti, current_ss, dci_cfg, dci_msg);
  }
  return SRSLTE_SUCCESS;
}
Beispiel #5
0
void usage(char *prog) {
  printf("Usage: %s [rovfcenmps] -i input_file\n", prog);
  printf("\t-o DCI format [Default %s]\n", srslte_dci_format_string(dci_format));
  printf("\t-c cell.id [Default %d]\n", cell.id);
  printf("\t-s Start subframe_idx [Default %d]\n", sf_idx);
  printf("\t-f cfi [Default %d]\n", cfi);
  printf("\t-r rnti [Default 0x%x]\n",rnti);
  printf("\t-p cell.nof_ports [Default %d]\n", cell.nof_ports);
  printf("\t-n cell.nof_prb [Default %d]\n", cell.nof_prb);
  printf("\t-m max_frames [Default %d]\n", max_frames);
  printf("\t-e Set extended prefix [Default Normal]\n");
  printf("\t-v [set srslte_verbose to debug, default none]\n");
}
Beispiel #6
0
int srslte_ue_dl_find_dl_dci_type(srslte_ue_dl_t *q, srslte_dci_msg_t *dci_msg, uint32_t cfi, uint32_t sf_idx, 
                                  uint16_t rnti, srslte_rnti_type_t rnti_type)
{
  srslte_dci_location_t locations[MAX_CANDIDATES];
  uint32_t nof_locations;
  uint32_t nof_formats; 
  srslte_dci_format_t *formats = NULL; 

  /* Generate PDCCH candidates */
  if (rnti_type == SRSLTE_RNTI_SI || rnti_type == SRSLTE_RNTI_PCH || rnti_type == SRSLTE_RNTI_RAR) {
    nof_locations = srslte_pdcch_common_locations(&q->pdcch, locations, MAX_CANDIDATES, q->cfi);
    formats = common_formats;
    nof_formats = nof_common_formats;
  } else {
    nof_locations = srslte_pdcch_ue_locations(&q->pdcch, locations, MAX_CANDIDATES, sf_idx, q->cfi, rnti);    
    formats = ue_formats; 
    nof_formats = nof_ue_formats;
  }

  uint16_t crc_rem = 0; 
  for (int f=0;f<nof_formats && crc_rem != rnti;f++) {
    for (int i=0;i<nof_locations && crc_rem != rnti;i++) {
      DEBUG("Trying format %s (nbits=%d), location L=%d, ncce=%d\n", srslte_dci_format_string(formats[f]), 
             srslte_dci_format_sizeof_lut(formats[f], q->cell.nof_prb), locations[i].L, locations[i].ncce);
      q->last_n_cce = locations[i].ncce;
      if (srslte_pdcch_decode_msg(&q->pdcch, dci_msg, &locations[i], formats[f], &crc_rem)) {
        fprintf(stderr, "Error decoding DCI msg\n");
        return SRSLTE_ERROR;
      }
      if (crc_rem == rnti) {
        INFO("Found DCI nCCE: %d, L: %d, n_bits=%d\n", locations[i].ncce, locations[i].L, srslte_dci_format_sizeof_lut(formats[f], q->cell.nof_prb));
        memcpy(&q->last_location, &locations[i], sizeof(srslte_dci_location_t));
      }
      if (crc_rem == rnti && formats[f] == SRSLTE_DCI_FORMAT1A && dci_msg->data[0] != 1) {
        /* Save Format 0 msg. Recovered next call to srslte_ue_dl_find_ul_dci() */
        q->pending_ul_dci_rnti = crc_rem; 
        memcpy(&q->pending_ul_dci_msg, dci_msg, sizeof(srslte_dci_msg_t));
        crc_rem = 0;         
      }
      DEBUG("Decoded DCI message RNTI: 0x%x\n", crc_rem);
    }
  } 
  if (crc_rem == rnti) {
    return 1; 
  } else {
    INFO("Couldn't find any DCI for RNTI=0x%x\n", rnti);
    return 0; 
  }
}
Beispiel #7
0
// Blind search for C-RNTI
static int find_dl_dci_type_crnti(srslte_ue_dl_t *q, uint32_t tm, uint32_t cfi,
                                  uint32_t sf_idx, uint16_t rnti, srslte_dci_msg_t *dci_msg) {
  int ret = SRSLTE_SUCCESS; 
  dci_blind_search_t search_space; 
  dci_blind_search_t *current_ss = &search_space;

  if (cfi < 1 || cfi > 3) {
    ERROR("CFI must be 1 ≤ cfi ≤ 3 (cfi=%d)", cfi);
    return SRSLTE_ERROR;
  }

  // Search UE-specific search space 
  if (q->current_rnti == rnti) {
    current_ss = &q->current_ss_ue[cfi-1][sf_idx];
  } else {
    // If locations are not pre-generated, generate them now
    current_ss->nof_locations = srslte_pdcch_ue_locations(&q->pdcch, current_ss->loc, MAX_CANDIDATES_UE, sf_idx, cfi, rnti);        
  }

  for (int f = 0; f < 2; f++) {
    srslte_dci_format_t format = ue_dci_formats[tm][f];

    INFO("Searching DL C-RNTI %s in %d ue locations\n", srslte_dci_format_string(format),
         current_ss->nof_locations);

    current_ss->format = format;
    if ((ret = dci_blind_search(q, current_ss, rnti, cfi, dci_msg))) {
      return ret;
    }
  }

  // Search Format 1A in the Common SS also
  if (q->current_rnti == rnti) {
    current_ss = &q->current_ss_common[cfi-1];
  } else {
    // If locations are not pre-generated, generate them now
    current_ss->nof_locations = srslte_pdcch_common_locations(&q->pdcch, current_ss->loc, MAX_CANDIDATES_COM, cfi);
  }
  
  // Search for RNTI only if there is room for the common search space
  if (current_ss->nof_locations > 0) {    
    current_ss->format = SRSLTE_DCI_FORMAT1A; 
    INFO("Searching DL C-RNTI in %d ue locations, format 1A\n", current_ss->nof_locations);
    return dci_blind_search(q, current_ss, rnti, cfi, dci_msg);
  }
  return SRSLTE_SUCCESS; 
}
Beispiel #8
0
static int dci_blind_search(srslte_ue_dl_t *q, dci_blind_search_t *search_space, uint16_t rnti, uint32_t cfi, srslte_dci_msg_t *dci_msg)
{
  int ret = SRSLTE_ERROR; 
  uint16_t crc_rem = 0; 
  if (rnti) {
    ret = 0; 
    int i=0;
    while (!ret && i < search_space->nof_locations) {
      DEBUG("Searching format %s in %d,%d (%d/%d)\n", 
             srslte_dci_format_string(search_space->format), search_space->loc[i].ncce, search_space->loc[i].L, 
             i, search_space->nof_locations);
      
      if (srslte_pdcch_decode_msg(&q->pdcch, dci_msg, &search_space->loc[i], search_space->format, cfi, &crc_rem)) {
        fprintf(stderr, "Error decoding DCI msg\n");
        return SRSLTE_ERROR;
      }
      if (crc_rem == rnti) {        
        // If searching for Format1A but found Format0 save it for later 
        if (dci_msg->format == SRSLTE_DCI_FORMAT0 && search_space->format == SRSLTE_DCI_FORMAT1A) 
        {
          if (!q->pending_ul_dci_rnti) {
            q->pending_ul_dci_rnti = crc_rem; 
            memcpy(&q->pending_ul_dci_msg, dci_msg, sizeof(srslte_dci_msg_t));          
            memcpy(&q->last_location_ul, &search_space->loc[i], sizeof(srslte_dci_location_t));          
          }
        // Else if we found it, save location and leave
        } else if (dci_msg->format == search_space->format) {
          ret = 1; 
          if (dci_msg->format == SRSLTE_DCI_FORMAT0) {
            memcpy(&q->last_location_ul, &search_space->loc[i], sizeof(srslte_dci_location_t));          
          } else {
            memcpy(&q->last_location, &search_space->loc[i], sizeof(srslte_dci_location_t));          
          }
        } 
      }
      i++; 
    }    
  } else {
    fprintf(stderr, "RNTI not specified\n");
  }
  return ret; 
}
Beispiel #9
0
int srslte_ue_dl_find_dl_dci(srslte_ue_dl_t *q, srslte_dci_msg_t *dci_msg, uint32_t cfi, uint32_t sf_idx, uint16_t rnti)
{
  srslte_dci_location_t locations[MAX_CANDIDATES];
  uint32_t nof_locations;
  uint32_t nof_formats; 
  srslte_dci_format_t *formats = NULL; 

  /* Generate PDCCH candidates */
  if (rnti == SRSLTE_SIRNTI) {
    nof_locations = srslte_pdcch_common_locations(&q->pdcch, locations, MAX_CANDIDATES, q->cfi);
    formats = common_formats;
    nof_formats = nof_common_formats;
  } else {
    nof_locations = srslte_pdcch_ue_locations(&q->pdcch, locations, MAX_CANDIDATES, sf_idx, q->cfi, rnti);    
    formats = ue_formats; 
    nof_formats = nof_ue_formats;
  }

  uint16_t crc_rem = 0; 
  for (int f=0;f<nof_formats && crc_rem != rnti;f++) {
    INFO("Trying format %s\n", srslte_dci_format_string(formats[f]));
    for (int i=0;i<nof_locations && crc_rem != rnti;i++) {
      q->last_n_cce = locations[i].ncce;
      if (srslte_pdcch_decode_msg(&q->pdcch, dci_msg, &locations[i], formats[f], &crc_rem)) {
        fprintf(stderr, "Error decoding DCI msg\n");
        return SRSLTE_ERROR;
      }
      if (formats[f] == SRSLTE_DCI_FORMAT1A) {
        if (dci_msg->data[0] != 1) {
          crc_rem = 0; 
        }
      }
      DEBUG("Decoded DCI message RNTI: 0x%x\n", crc_rem);
    }
  } 
  if (crc_rem == rnti) {
    return 1; 
  } else {
    return 0; 
  }
}