From fc53139f669c52de6c2a107753eb1cf9cd9899be Mon Sep 17 00:00:00 2001 From: Guy De Souza Date: Thu, 27 Sep 2018 12:39:02 +0200 Subject: [PATCH] MOdulation order and code rate --- cmake_targets/CMakeLists.txt | 1 + openair1/PHY/NR_TRANSPORT/nr_dlsch.h | 4 ++ openair1/PHY/NR_TRANSPORT/nr_tbs_tools.c | 81 ++++++++++++++++++++++++ 3 files changed, 86 insertions(+) create mode 100644 openair1/PHY/NR_TRANSPORT/nr_tbs_tools.c diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 71832b43fc..33f005e51a 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -1294,6 +1294,7 @@ set(PHY_SRC_UE ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_dci_tools.c ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_dlsch.c ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_dlsch_tools.c + ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_tbs_tools.c ${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_gold.c ${OPENAIR1_DIR}/PHY/TOOLS/file_output.c ${OPENAIR1_DIR}/PHY/TOOLS/cadd_vv.c diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.h b/openair1/PHY/NR_TRANSPORT/nr_dlsch.h index 71ba0a189e..418af34b39 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.h +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.h @@ -46,3 +46,7 @@ void nr_get_rbg_parms(NR_BWP_PARMS* bwp, uint8_t config_type); void nr_get_rbg_list(uint32_t bitmap, uint8_t n_rbg, uint8_t* rbg_list); void nr_get_PRG_parms(NR_BWP_PARMS* bwp, NR_gNB_DCI_ALLOC_t dci_alloc, uint8_t prb_bundling_type); + +uint8_t nr_get_Qm(uint8_t Imcs, uint8_t table_idx); + +uint32_t nr_get_code_rate(uint8_t Imcs, uint8_t table_idx); diff --git a/openair1/PHY/NR_TRANSPORT/nr_tbs_tools.c b/openair1/PHY/NR_TRANSPORT/nr_tbs_tools.c new file mode 100644 index 0000000000..84afa0d325 --- /dev/null +++ b/openair1/PHY/NR_TRANSPORT/nr_tbs_tools.c @@ -0,0 +1,81 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +/*! \file PHY/LTE_TRANSPORT/dlsch_coding.c +* \brief Top-level routines for implementing LDPC-coded (DLSCH) transport channels from 38-212, 15.2 +* \author H.Wang +* \date 2018 +* \version 0.1 +* \company Eurecom +* \email: +* \note +* \warning +*/ + +#include "nr_dlsch.h" + +/// Target code rate tables indexed by Imcs +uint16_t nr_target_code_rate_table1[29] = {120, 157, 193, 251, 308, 379, 449, 526, 602, 679, 340, 378, 434, 490, 553, \ + 616, 658, 438, 466, 517, 567, 616, 666, 719, 772, 822, 873, 910, 948}; + // The -1 values correspond to non integer factors which are handled differently for indexes 20(682.5) and 26(916.5) +uint16_t nr_target_code_rate_table2[28] = {120, 193, 308, 449, 602, 378, 434, 490, 553, 616, 658, 466, 517, 567, \ + 616, 666, 719, 772, 822, 873, -1, 711, 754, 797, 841, 885, -1, 948}; +uint16_t nr_target_code_rate_table3[29] = {30, 40, 50, 64, 78, 99, 120, 157, 193, 251, 308, 379, 449, 526, 602, 340, \ + 378, 434, 490, 553, 616, 438, 466, 517, 567, 616, 666, 719, 772}; + + +uint8_t nr_get_Qm(uint8_t Imcs, uint8_t table_idx) { + switch(table_idx) { + case 1: + return (((Imcs<10)||(Imcs==29))?2:((Imcs<17)||(Imcs==30))?4:((Imcs<29)||(Imcs==31))?6:-1); + break; + + case 2: + return (((Imcs<5)||(Imcs==28))?2:((Imcs<11)||(Imcs==29))?4:((Imcs<20)||(Imcs==30))?6:((Imcs<28)||(Imcs==31))?8:-1); + break; + + case 3: + return (((Imcs<15)||(Imcs==29))?2:((Imcs<21)||(Imcs==30))?4:((Imcs<29)||(Imcs==31))?6:-1); + break; + + default: + AssertFatal(0, "Invalid MCS table index %d (expected in range [1,3])\n", table_idx); + } +} + +uint32_t nr_get_code_rate(uint8_t Imcs, uint8_t table_idx) { + switch(table_idx) { + case 1: + return (nr_target_code_rate_table1[Imcs]<<10); + break; + + case 2: + return ((Imcs==20)?0xaaa00 : (Imcs==26)?0xe5200 : nr_target_code_rate_table3[Imcs]<<10); + break; + + case 3: + return (nr_target_code_rate_table3[Imcs]<<10); + break; + + default: + AssertFatal(0, "Invalid MCS table index %d (expected in range [1,3])\n", table_idx); + } +}