Using only one nr_modulation funtion across the code
This commit is contained in:
committed by
Thomas Schlichter
parent
f3ebd69477
commit
f1d4d5daf5
@@ -1272,6 +1272,7 @@ set(PHY_SRC_UE
|
||||
set(PHY_NR_SRC
|
||||
${OPENAIR1_DIR}/PHY/INIT/nr_init.c
|
||||
${OPENAIR1_DIR}/PHY/INIT/nr_parms.c
|
||||
${OPENAIR1_DIR}/PHY/MODULATION/nr_modulation.c
|
||||
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_pss.c
|
||||
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_sss.c
|
||||
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_pbch.c
|
||||
@@ -1303,8 +1304,9 @@ set(PHY_SRC_UE
|
||||
)
|
||||
|
||||
set(PHY_NR_UE_SRC
|
||||
${OPENAIR1_DIR}/PHY/MODULATION/slot_fep_nr.c
|
||||
${OPENAIR1_DIR}/PHY/INIT/nr_parms.c
|
||||
${OPENAIR1_DIR}/PHY/MODULATION/nr_modulation.c
|
||||
${OPENAIR1_DIR}/PHY/MODULATION/slot_fep_nr.c
|
||||
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/pss_nr.c
|
||||
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/sss_nr.c
|
||||
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/cic_filter_nr.c
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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.1 (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
|
||||
*/
|
||||
|
||||
#include "nr_modulation.h"
|
||||
|
||||
extern short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT];
|
||||
|
||||
void nr_modulation(uint32_t *in,
|
||||
uint16_t length,
|
||||
uint16_t mod_order,
|
||||
int16_t *out) {
|
||||
|
||||
uint16_t offset;
|
||||
uint16_t order;
|
||||
int i,j;
|
||||
uint8_t idx, b_idx;
|
||||
|
||||
offset = (mod_order==2)? NR_MOD_TABLE_QPSK_OFFSET : (mod_order==4)? NR_MOD_TABLE_QAM16_OFFSET : \
|
||||
(mod_order==6)? NR_MOD_TABLE_QAM64_OFFSET: (mod_order==8)? NR_MOD_TABLE_QAM256_OFFSET : 0;
|
||||
|
||||
for (i=0; i<length/mod_order; i++) {
|
||||
idx = 0;
|
||||
|
||||
for (j=0; j<mod_order; j++) {
|
||||
b_idx = (i*mod_order+j)&0x1f;
|
||||
if (i && (!b_idx))
|
||||
in++;
|
||||
idx ^= (((*in)>>b_idx)&1)<<(mod_order-j-1);
|
||||
}
|
||||
|
||||
out[i<<1] = nr_mod_table[(offset+idx)<<1];
|
||||
out[(i<<1)+1] = nr_mod_table[((offset+idx)<<1)+1];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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.1 (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
|
||||
*/
|
||||
|
||||
#ifndef __NR_MODULATION_H__
|
||||
#define __NR_MODULATION_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include "PHY/defs_nr_common.h"
|
||||
|
||||
/*! \brief Perform NR modulation. TS 38.211 V15.4.0 subclause 5.1
|
||||
@param[in] in, Pointer to input bits
|
||||
@param[in] length, size of input bits
|
||||
@param[in] modulation_type, modulation order
|
||||
@param[out] out, complex valued modulated symbols
|
||||
*/
|
||||
|
||||
void nr_modulation(uint32_t *in,
|
||||
uint16_t length,
|
||||
uint16_t mod_order,
|
||||
int16_t *out);
|
||||
|
||||
#endif
|
||||
@@ -32,14 +32,13 @@
|
||||
|
||||
#include "nr_dci.h"
|
||||
#include "nr_dlsch.h"
|
||||
#include "PHY/MODULATION/nr_modulation.h"
|
||||
|
||||
//#define DEBUG_PDCCH_DMRS
|
||||
//#define DEBUG_DCI
|
||||
//#define DEBUG_CHANNEL_CODING
|
||||
|
||||
|
||||
extern short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT];
|
||||
|
||||
uint16_t nr_get_dci_size(nfapi_nr_dci_format_e format,
|
||||
nfapi_nr_rnti_type_e rnti_type,
|
||||
uint16_t N_RB,
|
||||
@@ -217,9 +216,9 @@ uint8_t nr_generate_dci_top(NR_gNB_PDCCH pdcch_vars,
|
||||
#endif
|
||||
}
|
||||
|
||||
nr_modulation(dmrs_seq, dmrs_length, MOD_QPSK, mod_dmrs[symb]);
|
||||
nr_modulation(dmrs_seq, dmrs_length, 2, mod_dmrs[symb]); //Qm = 2 as DMRS is QPSK modulated
|
||||
} else
|
||||
nr_modulation(gold_pdcch_dmrs[symb], dmrs_length, MOD_QPSK, mod_dmrs[symb]);
|
||||
nr_modulation(gold_pdcch_dmrs[symb], dmrs_length, 2, mod_dmrs[symb]); //Qm = 2 as DMRS is QPSK modulated
|
||||
|
||||
#ifdef DEBUG_PDCCH_DMRS
|
||||
|
||||
@@ -264,7 +263,7 @@ uint8_t nr_generate_dci_top(NR_gNB_PDCCH pdcch_vars,
|
||||
#endif
|
||||
/// QPSK modulation
|
||||
int16_t mod_dci[NR_MAX_DCI_SIZE>>1];
|
||||
nr_modulation(scrambled_output, encoded_length, MOD_QPSK, mod_dci);
|
||||
nr_modulation(scrambled_output, encoded_length, 2, mod_dci); //Qm = 2 as DMRS is QPSK modulated
|
||||
#ifdef DEBUG_DCI
|
||||
|
||||
for (int i=0; i<encoded_length>>1; i++)
|
||||
|
||||
@@ -33,13 +33,11 @@
|
||||
#include "nr_dlsch.h"
|
||||
#include "nr_dci.h"
|
||||
#include "nr_sch_dmrs.h"
|
||||
#include "PHY/MODULATION/nr_modulation.h"
|
||||
|
||||
//#define DEBUG_DLSCH
|
||||
//#define DEBUG_DLSCH_MAPPING
|
||||
|
||||
uint8_t mod_order[5] = {1, 2, 4, 6, 8};
|
||||
uint16_t mod_offset[5] = {1,3,7,23,87};
|
||||
|
||||
void nr_pdsch_codeword_scrambling(uint8_t *in,
|
||||
uint16_t size,
|
||||
uint8_t q,
|
||||
@@ -67,54 +65,6 @@ void nr_pdsch_codeword_scrambling(uint8_t *in,
|
||||
|
||||
}
|
||||
|
||||
void nr_modulation(uint32_t *in,
|
||||
uint16_t length,
|
||||
nr_mod_t modulation_type,
|
||||
int16_t *out) {
|
||||
|
||||
uint16_t offset;
|
||||
uint16_t order;
|
||||
order = mod_order[modulation_type];
|
||||
offset = mod_offset[modulation_type];
|
||||
|
||||
for (int i=0; i<length/order; i++) {
|
||||
uint8_t idx = 0, b_idx;
|
||||
|
||||
for (int j=0; j<order; j++) {
|
||||
b_idx = (i*order+j)&0x1f;
|
||||
if (i && (!b_idx))
|
||||
in++;
|
||||
idx ^= (((*in)>>b_idx)&1)<<(order-j-1);
|
||||
}
|
||||
|
||||
out[i<<1] = nr_mod_table[(offset+idx)<<1];
|
||||
out[(i<<1)+1] = nr_mod_table[((offset+idx)<<1)+1];
|
||||
}
|
||||
}
|
||||
|
||||
void nr_pdsch_codeword_modulation(uint32_t *in,
|
||||
uint8_t Qm,
|
||||
uint32_t length,
|
||||
int16_t *out) {
|
||||
|
||||
uint16_t offset = (Qm==2)? NR_MOD_TABLE_QPSK_OFFSET : (Qm==4)? NR_MOD_TABLE_QAM16_OFFSET : \
|
||||
(Qm==6)? NR_MOD_TABLE_QAM64_OFFSET: (Qm==8)? NR_MOD_TABLE_QAM256_OFFSET : 0;
|
||||
AssertFatal(offset, "Invalid modulation order %d\n", Qm);
|
||||
|
||||
for (int i=0; i<length/Qm; i++) {
|
||||
uint8_t idx = 0, b_idx;
|
||||
|
||||
for (int j=0; j<Qm; j++) {
|
||||
b_idx = (i*Qm+j)&0x1f;
|
||||
if (i && (!b_idx))
|
||||
in++;
|
||||
idx ^= (((*in)>>b_idx)&1)<<(Qm-j-1);
|
||||
}
|
||||
|
||||
out[i<<1] = nr_mod_table[(offset+idx)<<1];
|
||||
out[(i<<1)+1] = nr_mod_table[((offset+idx)<<1)+1];
|
||||
}
|
||||
}
|
||||
|
||||
void nr_pdsch_layer_mapping(int16_t **mod_symbs,
|
||||
uint8_t n_layers,
|
||||
@@ -255,10 +205,11 @@ for (int i=0; i<encoded_length>>8; i++) {
|
||||
#endif
|
||||
|
||||
/// Modulation
|
||||
|
||||
for (int q=0; q<rel15->nb_codewords; q++)
|
||||
nr_pdsch_codeword_modulation(scrambled_output[q],
|
||||
Qm,
|
||||
nr_modulation(scrambled_output[q],
|
||||
encoded_length,
|
||||
Qm,
|
||||
mod_symbs[q]);
|
||||
#ifdef DEBUG_DLSCH
|
||||
printf("PDSCH Modulation: Qm %d(%d)\n", Qm, nb_symbols);
|
||||
@@ -297,8 +248,8 @@ for (int l=0; l<rel15->nb_layers; l++)
|
||||
uint8_t mapping_type = config.pdsch_config.mapping_type.value;
|
||||
|
||||
l0 = get_l0(mapping_type, 2);//config.pdsch_config.dmrs_typeA_position.value);
|
||||
nr_modulation(pdsch_dmrs[l0][0], n_dmrs, MOD_QPSK, mod_dmrs); // currently only codeword 0 is modulated
|
||||
|
||||
nr_modulation(pdsch_dmrs[l0][0], n_dmrs, 2, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated
|
||||
|
||||
#ifdef DEBUG_DLSCH
|
||||
printf("DMRS modulation (single symbol %d, %d symbols, type %d):\n", l0, n_dmrs>>1, dmrs_type);
|
||||
for (int i=0; i<n_dmrs>>4; i++) {
|
||||
|
||||
@@ -30,9 +30,10 @@
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#include "PHY/defs_gNB.h"
|
||||
#ifndef __NR_DLSCH__H
|
||||
#define __NR_DLSCH__H
|
||||
|
||||
extern short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT];
|
||||
#include "PHY/defs_gNB.h"
|
||||
|
||||
void nr_get_time_domain_allocation_type(nfapi_nr_config_request_t config,
|
||||
nfapi_nr_dl_config_dci_dl_pdu dci_pdu,
|
||||
@@ -67,16 +68,6 @@ void nr_pdsch_codeword_scrambling(uint8_t *in,
|
||||
uint32_t n_RNTI,
|
||||
uint32_t* out);
|
||||
|
||||
void nr_modulation(uint32_t *in,
|
||||
uint16_t length,
|
||||
nr_mod_t modulation_type,
|
||||
int16_t *out);
|
||||
|
||||
void nr_pdsch_codeword_modulation(uint32_t *in,
|
||||
uint8_t Qm,
|
||||
uint32_t length,
|
||||
int16_t *out);
|
||||
|
||||
void nr_pdsch_layer_mapping(int16_t **mod_symbs,
|
||||
uint8_t n_layers,
|
||||
uint16_t n_symbs,
|
||||
@@ -120,3 +111,4 @@ int nr_dlsch_encoding(unsigned char *a,int frame,
|
||||
|
||||
void nr_emulate_dlsch_payload(uint8_t* payload, uint16_t size);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1070,18 +1070,6 @@ void nr_pusch_codeword_scrambling(uint8_t *in,
|
||||
uint32_t* out);
|
||||
|
||||
|
||||
/*! \brief Perform PUSCH modulation. TS 38.211 V15.4.0 subclause 6.3.1.2
|
||||
@param[in] in, Pointer to input bits
|
||||
@param[in] Qm, modulation order
|
||||
@param[in] length, size of input bits
|
||||
@param[out] out, complex valued modulated symbols
|
||||
*/
|
||||
|
||||
void nr_pusch_codeword_modulation(uint32_t *in,
|
||||
uint8_t Qm,
|
||||
uint32_t length,
|
||||
int16_t *out);
|
||||
|
||||
|
||||
uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
|
||||
@@ -34,8 +34,6 @@
|
||||
#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h"
|
||||
#include "PHY/defs_nr_common.h"
|
||||
|
||||
extern short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT];
|
||||
|
||||
|
||||
|
||||
void nr_pusch_codeword_scrambling(uint8_t *in,
|
||||
@@ -67,29 +65,4 @@ void nr_pusch_codeword_scrambling(uint8_t *in,
|
||||
//printf("i %d b_idx %d in %d s 0x%08x out 0x%08x\n", i, b_idx, in[i], s, *out);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// This function is copied from PHY/NR_TRANSPORT/nr_dlsch.c
|
||||
void nr_pusch_codeword_modulation(uint32_t *in,
|
||||
uint8_t Qm,
|
||||
uint32_t length,
|
||||
int16_t *out) {
|
||||
|
||||
uint16_t offset = (Qm==2)? NR_MOD_TABLE_QPSK_OFFSET : (Qm==4)? NR_MOD_TABLE_QAM16_OFFSET : \
|
||||
(Qm==6)? NR_MOD_TABLE_QAM64_OFFSET: (Qm==8)? NR_MOD_TABLE_QAM256_OFFSET : 0;
|
||||
AssertFatal(offset, "Invalid modulation order %d\n", Qm);
|
||||
|
||||
for (int i=0; i<length/Qm; i++) {
|
||||
uint8_t idx = 0, b_idx;
|
||||
|
||||
for (int j=0; j<Qm; j++) {
|
||||
b_idx = (i*Qm+j)&0x1f;
|
||||
if (i && (!b_idx))
|
||||
in++;
|
||||
idx ^= (((*in)>>b_idx)&1)<<(Qm-j-1);
|
||||
}
|
||||
|
||||
out[i<<1] = nr_mod_table[(offset+idx)<<1];
|
||||
out[(i<<1)+1] = nr_mod_table[((offset+idx)<<1)+1];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "PHY/INIT/phy_init.h"
|
||||
#include "PHY/NR_REFSIG/refsig_defs_ue.h"
|
||||
#include "PHY/NR_REFSIG/nr_mod_table.h"
|
||||
#include "PHY/MODULATION/nr_modulation.h"
|
||||
#include "PHY/MODULATION/modulation_eNB.h"
|
||||
#include "PHY/MODULATION/modulation_UE.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_transport.h"
|
||||
@@ -569,10 +570,10 @@ int main(int argc, char **argv) {
|
||||
/////////////////////////ULSCH modulation/////////////////////////
|
||||
///////////
|
||||
|
||||
nr_pusch_codeword_modulation(scrambled_output[0], // assume one codeword for the moment
|
||||
mod_order,
|
||||
encoded_length,
|
||||
ulsch_ue->d);
|
||||
nr_modulation(scrambled_output[0], // assume one codeword for the moment
|
||||
encoded_length,
|
||||
mod_order,
|
||||
ulsch_ue->d);
|
||||
|
||||
///////////
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user