From 5fa775580ceca0365b5a731cdb195270314204db Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Wed, 29 Jul 2020 13:01:09 +0200 Subject: [PATCH 01/19] Removed unwanted loop and if Reordered mod_table to support new changes in the function --- executables/nr-softmodem.c | 3 +-- openair1/PHY/MODULATION/nr_modulation.c | 10 ++-------- openair1/PHY/NR_REFSIG/nr_mod_table.h | 2 +- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index bf77125975..77f6dc14b1 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -84,8 +84,7 @@ unsigned short config_frames[4] = {2,9,11,13}; #include "NB_IoT_interface.h" #include "x2ap_eNB.h" -short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT] = {0,0,16384,16384,-16384,-16384,16384,16384,16384,-16384,-16384,16384,-16384,-16384,7327,7327,7327,21981,21981,7327,21981,21981,7327,-7327,7327,-21981,21981,-7327,21981,-21981,-7327,7327,-7327,21981,-21981,7327,-21981,21981,-7327,-7327,-7327,-21981,-21981,-7327,-21981,-21981,10726,10726,10726,3576,3576,10726,3576,3576,10726,17876,10726,25027,3576,17876,3576,25027,17876,10726,17876,3576,25027,10726,25027,3576,17876,17876,17876,25027,25027,17876,25027,25027,10726,-10726,10726,-3576,3576,-10726,3576,-3576,10726,-17876,10726,-25027,3576,-17876,3576,-25027,17876,-10726,17876,-3576,25027,-10726,25027,-3576,17876,-17876,17876,-25027,25027,-17876,25027,-25027,-10726,10726,-10726,3576,-3576,10726,-3576,3576,-10726,17876,-10726,25027,-3576,17876,-3576,25027,-17876,10726,-17876,3576,-25027,10726,-25027,3576,-17876,17876,-17876,25027,-25027,17876,-25027,25027,-10726,-10726,-10726,-3576,-3576,-10726,-3576,-3576,-10726,-17876,-10726,-25027,-3576,-17876,-3576,-25027,-17876,-10726,-17876,-3576,-25027,-10726,-25027,-3576,-17876,-17876,-17876,-25027,-25027,-17876,-25027,-25027,8886,8886,8886,12439,12439,8886,12439,12439,8886,5332,8886,1778,12439,5332,12439,1778,5332,8886,5332,12439,1778,8886,1778,12439,5332,5332,5332,1778,1778,5332,1778,1778,8886,19547,8886,15993,12439,19547,12439,15993,8886,23101,8886,26655,12439,23101,12439,26655,5332,19547,5332,15993,1778,19547,1778,15993,5332,23101,5332,26655,1778,23101,1778,26655,19547,8886,19547,12439,15993,8886,15993,12439,19547,5332,19547,1778,15993,5332,15993,1778,23101,8886,23101,12439,26655,8886,26655,12439,23101,5332,23101,1778,26655,5332,26655,1778,19547,19547,19547,15993,15993,19547,15993,15993,19547,23101,19547,26655,15993,23101,15993,26655,23101,19547,23101,15993,26655,19547,26655,15993,23101,23101,23101,26655,26655,23101,26655,26655,8886,-8886,8886,-12439,12439,-8886,12439,-12439,8886,-5332,8886,-1778,12439,-5332,12439,-1778,5332,-8886,5332,-12439,1778,-8886,1778,-12439,5332,-5332,5332,-1778,1778,-5332,1778,-1778,8886,-19547,8886,-15993,12439,-19547,12439,-15993,8886,-23101,8886,-26655,12439,-23101,12439,-26655,5332,-19547,5332,-15993,1778,-19547,1778,-15993,5332,-23101,5332,-26655,1778,-23101,1778,-26655,19547,-8886,19547,-12439,15993,-8886,15993,-12439,19547,-5332,19547,-1778,15993,-5332,15993,-1778,23101,-8886,23101,-12439,26655,-8886,26655,-12439,23101,-5332,23101,-1778,26655,-5332,26655,-1778,19547,-19547,19547,-15993,15993,-19547,15993,-15993,19547,-23101,19547,-26655,15993,-23101,15993,-26655,23101,-19547,23101,-15993,26655,-19547,26655,-15993,23101,-23101,23101,-26655,26655,-23101,26655,-26655,-8886,8886,-8886,12439,-12439,8886,-12439,12439,-8886,5332,-8886,1778,-12439,5332,-12439,1778,-5332,8886,-5332,12439,-1778,8886,-1778,12439,-5332,5332,-5332,1778,-1778,5332,-1778,1778,-8886,19547,-8886,15993,-12439,19547,-12439,15993,-8886,23101,-8886,26655,-12439,23101,-12439,26655,-5332,19547,-5332,15993,-1778,19547,-1778,15993,-5332,23101,-5332,26655,-1778,23101,-1778,26655,-19547,8886,-19547,12439,-15993,8886,-15993,12439,-19547,5332,-19547,1778,-15993,5332,-15993,1778,-23101,8886,-23101,12439,-26655,8886,-26655,12439,-23101,5332,-23101,1778,-26655,5332,-26655,1778,-19547,19547,-19547,15993,-15993,19547,-15993,15993,-19547,23101,-19547,26655,-15993,23101,-15993,26655,-23101,19547,-23101,15993,-26655,19547,-26655,15993,-23101,23101,-23101,26655,-26655,23101,-26655,26655,-8886,-8886,-8886,-12439,-12439,-8886,-12439,-12439,-8886,-5332,-8886,-1778,-12439,-5332,-12439,-1778,-5332,-8886,-5332,-12439,-1778,-8886,-1778,-12439,-5332,-5332,-5332,-1778,-1778,-5332,-1778,-1778,-8886,-19547,-8886,-15993,-12439,-19547,-12439,-15993,-8886,-23101,-8886,-26655,-12439,-23101,-12439,-26655,-5332,-19547,-5332,-15993,-1778,-19547,-1778,-15993,-5332,-23101,-5332,-26655,-1778,-23101,-1778,-26655,-19547,-8886,-19547,-12439,-15993,-8886,-15993,-12439,-19547,-5332,-19547,-1778,-15993,-5332,-15993,-1778,-23101,-8886,-23101,-12439,-26655,-8886,-26655,-12439,-23101,-5332,-23101,-1778,-26655,-5332,-26655,-1778,-19547,-19547,-19547,-15993,-15993,-19547,-15993,-15993,-19547,-23101,-19547,-26655,-15993,-23101,-15993,-26655,-23101,-19547,-23101,-15993,-26655,-19547,-26655,-15993,-23101,-23101,-23101,-26655,-26655,-23101,-26655,-26655}; - +short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT] = {0,0,16384,16384,-16384,-16384,16384,16384,-16384,16384,16384,-16384,-16384,-16384,7327,7327,-7327,7327,7327,-7327,-7327,-7327,21981,7327,-21981,7327,21981,-7327,-21981,-7327,7327,21981,-7327,21981,7327,-21981,-7327,-21981,21981,21981,-21981,21981,21981,-21981,-21981,-21981,10726,10726,-10726,10726,10726,-10726,-10726,-10726,17876,10726,-17876,10726,17876,-10726,-17876,-10726,10726,17876,-10726,17876,10726,-17876,-10726,-17876,17876,17876,-17876,17876,17876,-17876,-17876,-17876,3576,10726,-3576,10726,3576,-10726,-3576,-10726,25027,10726,-25027,10726,25027,-10726,-25027,-10726,3576,17876,-3576,17876,3576,-17876,-3576,-17876,25027,17876,-25027,17876,25027,-17876,-25027,-17876,10726,3576,-10726,3576,10726,-3576,-10726,-3576,17876,3576,-17876,3576,17876,-3576,-17876,-3576,10726,25027,-10726,25027,10726,-25027,-10726,-25027,17876,25027,-17876,25027,17876,-25027,-17876,-25027,3576,3576,-3576,3576,3576,-3576,-3576,-3576,25027,3576,-25027,3576,25027,-3576,-25027,-3576,3576,25027,-3576,25027,3576,-25027,-3576,-25027,25027,25027,-25027,25027,25027,-25027,-25027,-25027,8886,8886,-8886,8886,8886,-8886,-8886,-8886,19547,8886,-19547,8886,19547,-8886,-19547,-8886,8886,19547,-8886,19547,8886,-19547,-8886,-19547,19547,19547,-19547,19547,19547,-19547,-19547,-19547,5332,8886,-5332,8886,5332,-8886,-5332,-8886,23101,8886,-23101,8886,23101,-8886,-23101,-8886,5332,19547,-5332,19547,5332,-19547,-5332,-19547,23101,19547,-23101,19547,23101,-19547,-23101,-19547,8886,5332,-8886,5332,8886,-5332,-8886,-5332,19547,5332,-19547,5332,19547,-5332,-19547,-5332,8886,23101,-8886,23101,8886,-23101,-8886,-23101,19547,23101,-19547,23101,19547,-23101,-19547,-23101,5332,5332,-5332,5332,5332,-5332,-5332,-5332,23101,5332,-23101,5332,23101,-5332,-23101,-5332,5332,23101,-5332,23101,5332,-23101,-5332,-23101,23101,23101,-23101,23101,23101,-23101,-23101,-23101,12439,8886,-12439,8886,12439,-8886,-12439,-8886,15993,8886,-15993,8886,15993,-8886,-15993,-8886,12439,19547,-12439,19547,12439,-19547,-12439,-19547,15993,19547,-15993,19547,15993,-19547,-15993,-19547,1778,8886,-1778,8886,1778,-8886,-1778,-8886,26655,8886,-26655,8886,26655,-8886,-26655,-8886,1778,19547,-1778,19547,1778,-19547,-1778,-19547,26655,19547,-26655,19547,26655,-19547,-26655,-19547,12439,5332,-12439,5332,12439,-5332,-12439,-5332,15993,5332,-15993,5332,15993,-5332,-15993,-5332,12439,23101,-12439,23101,12439,-23101,-12439,-23101,15993,23101,-15993,23101,15993,-23101,-15993,-23101,1778,5332,-1778,5332,1778,-5332,-1778,-5332,26655,5332,-26655,5332,26655,-5332,-26655,-5332,1778,23101,-1778,23101,1778,-23101,-1778,-23101,26655,23101,-26655,23101,26655,-23101,-26655,-23101,8886,12439,-8886,12439,8886,-12439,-8886,-12439,19547,12439,-19547,12439,19547,-12439,-19547,-12439,8886,15993,-8886,15993,8886,-15993,-8886,-15993,19547,15993,-19547,15993,19547,-15993,-19547,-15993,5332,12439,-5332,12439,5332,-12439,-5332,-12439,23101,12439,-23101,12439,23101,-12439,-23101,-12439,5332,15993,-5332,15993,5332,-15993,-5332,-15993,23101,15993,-23101,15993,23101,-15993,-23101,-15993,8886,1778,-8886,1778,8886,-1778,-8886,-1778,19547,1778,-19547,1778,19547,-1778,-19547,-1778,8886,26655,-8886,26655,8886,-26655,-8886,-26655,19547,26655,-19547,26655,19547,-26655,-19547,-26655,5332,1778,-5332,1778,5332,-1778,-5332,-1778,23101,1778,-23101,1778,23101,-1778,-23101,-1778,5332,26655,-5332,26655,5332,-26655,-5332,-26655,23101,26655,-23101,26655,23101,-26655,-23101,-26655,12439,12439,-12439,12439,12439,-12439,-12439,-12439,15993,12439,-15993,12439,15993,-12439,-15993,-12439,12439,15993,-12439,15993,12439,-15993,-12439,-15993,15993,15993,-15993,15993,15993,-15993,-15993,-15993,1778,12439,-1778,12439,1778,-12439,-1778,-12439,26655,12439,-26655,12439,26655,-12439,-26655,-12439,1778,15993,-1778,15993,1778,-15993,-1778,-15993,26655,15993,-26655,15993,26655,-15993,-26655,-15993,12439,1778,-12439,1778,12439,-1778,-12439,-1778,15993,1778,-15993,1778,15993,-1778,-15993,-1778,12439,26655,-12439,26655,12439,-26655,-12439,-26655,15993,26655,-15993,26655,15993,-26655,-15993,-26655,1778,1778,-1778,1778,1778,-1778,-1778,-1778,26655,1778,-26655,1778,26655,-1778,-26655,-1778,1778,26655,-1778,26655,1778,-26655,-1778,-26655,26655,26655,-26655,26655,26655,-26655,-26655,-26655}; pthread_cond_t nfapi_sync_cond; pthread_mutex_t nfapi_sync_mutex; diff --git a/openair1/PHY/MODULATION/nr_modulation.c b/openair1/PHY/MODULATION/nr_modulation.c index dbfe93adee..289ac1df5f 100644 --- a/openair1/PHY/MODULATION/nr_modulation.c +++ b/openair1/PHY/MODULATION/nr_modulation.c @@ -36,16 +36,10 @@ void nr_modulation(uint32_t *in, LOG_D(PHY,"nr_modulation: length %d, mod_order %d\n",length,mod_order); + uint16_t mask = ((1<>b_idx)&1)<<(mod_order-j-1); - } + idx = ((in[i*mod_order/32]>>(i*mod_order)) & mask); out[i<<1] = nr_mod_table[(offset+idx)<<1]; out[(i<<1)+1] = nr_mod_table[((offset+idx)<<1)+1]; diff --git a/openair1/PHY/NR_REFSIG/nr_mod_table.h b/openair1/PHY/NR_REFSIG/nr_mod_table.h index c34dadb663..99d207ecc8 100644 --- a/openair1/PHY/NR_REFSIG/nr_mod_table.h +++ b/openair1/PHY/NR_REFSIG/nr_mod_table.h @@ -28,6 +28,6 @@ #define NR_MOD_TABLE_QAM16_OFFSET 7 #define NR_MOD_TABLE_QAM64_OFFSET 23 #define NR_MOD_TABLE_QAM256_OFFSET 87 -short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT] = {0,0,16384,16384,-16384,-16384,16384,16384,16384,-16384,-16384,16384,-16384,-16384,7327,7327,7327,21981,21981,7327,21981,21981,7327,-7327,7327,-21981,21981,-7327,21981,-21981,-7327,7327,-7327,21981,-21981,7327,-21981,21981,-7327,-7327,-7327,-21981,-21981,-7327,-21981,-21981,10726,10726,10726,3576,3576,10726,3576,3576,10726,17876,10726,25027,3576,17876,3576,25027,17876,10726,17876,3576,25027,10726,25027,3576,17876,17876,17876,25027,25027,17876,25027,25027,10726,-10726,10726,-3576,3576,-10726,3576,-3576,10726,-17876,10726,-25027,3576,-17876,3576,-25027,17876,-10726,17876,-3576,25027,-10726,25027,-3576,17876,-17876,17876,-25027,25027,-17876,25027,-25027,-10726,10726,-10726,3576,-3576,10726,-3576,3576,-10726,17876,-10726,25027,-3576,17876,-3576,25027,-17876,10726,-17876,3576,-25027,10726,-25027,3576,-17876,17876,-17876,25027,-25027,17876,-25027,25027,-10726,-10726,-10726,-3576,-3576,-10726,-3576,-3576,-10726,-17876,-10726,-25027,-3576,-17876,-3576,-25027,-17876,-10726,-17876,-3576,-25027,-10726,-25027,-3576,-17876,-17876,-17876,-25027,-25027,-17876,-25027,-25027,8886,8886,8886,12439,12439,8886,12439,12439,8886,5332,8886,1778,12439,5332,12439,1778,5332,8886,5332,12439,1778,8886,1778,12439,5332,5332,5332,1778,1778,5332,1778,1778,8886,19547,8886,15993,12439,19547,12439,15993,8886,23101,8886,26655,12439,23101,12439,26655,5332,19547,5332,15993,1778,19547,1778,15993,5332,23101,5332,26655,1778,23101,1778,26655,19547,8886,19547,12439,15993,8886,15993,12439,19547,5332,19547,1778,15993,5332,15993,1778,23101,8886,23101,12439,26655,8886,26655,12439,23101,5332,23101,1778,26655,5332,26655,1778,19547,19547,19547,15993,15993,19547,15993,15993,19547,23101,19547,26655,15993,23101,15993,26655,23101,19547,23101,15993,26655,19547,26655,15993,23101,23101,23101,26655,26655,23101,26655,26655,8886,-8886,8886,-12439,12439,-8886,12439,-12439,8886,-5332,8886,-1778,12439,-5332,12439,-1778,5332,-8886,5332,-12439,1778,-8886,1778,-12439,5332,-5332,5332,-1778,1778,-5332,1778,-1778,8886,-19547,8886,-15993,12439,-19547,12439,-15993,8886,-23101,8886,-26655,12439,-23101,12439,-26655,5332,-19547,5332,-15993,1778,-19547,1778,-15993,5332,-23101,5332,-26655,1778,-23101,1778,-26655,19547,-8886,19547,-12439,15993,-8886,15993,-12439,19547,-5332,19547,-1778,15993,-5332,15993,-1778,23101,-8886,23101,-12439,26655,-8886,26655,-12439,23101,-5332,23101,-1778,26655,-5332,26655,-1778,19547,-19547,19547,-15993,15993,-19547,15993,-15993,19547,-23101,19547,-26655,15993,-23101,15993,-26655,23101,-19547,23101,-15993,26655,-19547,26655,-15993,23101,-23101,23101,-26655,26655,-23101,26655,-26655,-8886,8886,-8886,12439,-12439,8886,-12439,12439,-8886,5332,-8886,1778,-12439,5332,-12439,1778,-5332,8886,-5332,12439,-1778,8886,-1778,12439,-5332,5332,-5332,1778,-1778,5332,-1778,1778,-8886,19547,-8886,15993,-12439,19547,-12439,15993,-8886,23101,-8886,26655,-12439,23101,-12439,26655,-5332,19547,-5332,15993,-1778,19547,-1778,15993,-5332,23101,-5332,26655,-1778,23101,-1778,26655,-19547,8886,-19547,12439,-15993,8886,-15993,12439,-19547,5332,-19547,1778,-15993,5332,-15993,1778,-23101,8886,-23101,12439,-26655,8886,-26655,12439,-23101,5332,-23101,1778,-26655,5332,-26655,1778,-19547,19547,-19547,15993,-15993,19547,-15993,15993,-19547,23101,-19547,26655,-15993,23101,-15993,26655,-23101,19547,-23101,15993,-26655,19547,-26655,15993,-23101,23101,-23101,26655,-26655,23101,-26655,26655,-8886,-8886,-8886,-12439,-12439,-8886,-12439,-12439,-8886,-5332,-8886,-1778,-12439,-5332,-12439,-1778,-5332,-8886,-5332,-12439,-1778,-8886,-1778,-12439,-5332,-5332,-5332,-1778,-1778,-5332,-1778,-1778,-8886,-19547,-8886,-15993,-12439,-19547,-12439,-15993,-8886,-23101,-8886,-26655,-12439,-23101,-12439,-26655,-5332,-19547,-5332,-15993,-1778,-19547,-1778,-15993,-5332,-23101,-5332,-26655,-1778,-23101,-1778,-26655,-19547,-8886,-19547,-12439,-15993,-8886,-15993,-12439,-19547,-5332,-19547,-1778,-15993,-5332,-15993,-1778,-23101,-8886,-23101,-12439,-26655,-8886,-26655,-12439,-23101,-5332,-23101,-1778,-26655,-5332,-26655,-1778,-19547,-19547,-19547,-15993,-15993,-19547,-15993,-15993,-19547,-23101,-19547,-26655,-15993,-23101,-15993,-26655,-23101,-19547,-23101,-15993,-26655,-19547,-26655,-15993,-23101,-23101,-23101,-26655,-26655,-23101,-26655,-26655}; +short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT] = {0,0,16384,16384,-16384,-16384,16384,16384,-16384,16384,16384,-16384,-16384,-16384,7327,7327,-7327,7327,7327,-7327,-7327,-7327,21981,7327,-21981,7327,21981,-7327,-21981,-7327,7327,21981,-7327,21981,7327,-21981,-7327,-21981,21981,21981,-21981,21981,21981,-21981,-21981,-21981,10726,10726,-10726,10726,10726,-10726,-10726,-10726,17876,10726,-17876,10726,17876,-10726,-17876,-10726,10726,17876,-10726,17876,10726,-17876,-10726,-17876,17876,17876,-17876,17876,17876,-17876,-17876,-17876,3576,10726,-3576,10726,3576,-10726,-3576,-10726,25027,10726,-25027,10726,25027,-10726,-25027,-10726,3576,17876,-3576,17876,3576,-17876,-3576,-17876,25027,17876,-25027,17876,25027,-17876,-25027,-17876,10726,3576,-10726,3576,10726,-3576,-10726,-3576,17876,3576,-17876,3576,17876,-3576,-17876,-3576,10726,25027,-10726,25027,10726,-25027,-10726,-25027,17876,25027,-17876,25027,17876,-25027,-17876,-25027,3576,3576,-3576,3576,3576,-3576,-3576,-3576,25027,3576,-25027,3576,25027,-3576,-25027,-3576,3576,25027,-3576,25027,3576,-25027,-3576,-25027,25027,25027,-25027,25027,25027,-25027,-25027,-25027,8886,8886,-8886,8886,8886,-8886,-8886,-8886,19547,8886,-19547,8886,19547,-8886,-19547,-8886,8886,19547,-8886,19547,8886,-19547,-8886,-19547,19547,19547,-19547,19547,19547,-19547,-19547,-19547,5332,8886,-5332,8886,5332,-8886,-5332,-8886,23101,8886,-23101,8886,23101,-8886,-23101,-8886,5332,19547,-5332,19547,5332,-19547,-5332,-19547,23101,19547,-23101,19547,23101,-19547,-23101,-19547,8886,5332,-8886,5332,8886,-5332,-8886,-5332,19547,5332,-19547,5332,19547,-5332,-19547,-5332,8886,23101,-8886,23101,8886,-23101,-8886,-23101,19547,23101,-19547,23101,19547,-23101,-19547,-23101,5332,5332,-5332,5332,5332,-5332,-5332,-5332,23101,5332,-23101,5332,23101,-5332,-23101,-5332,5332,23101,-5332,23101,5332,-23101,-5332,-23101,23101,23101,-23101,23101,23101,-23101,-23101,-23101,12439,8886,-12439,8886,12439,-8886,-12439,-8886,15993,8886,-15993,8886,15993,-8886,-15993,-8886,12439,19547,-12439,19547,12439,-19547,-12439,-19547,15993,19547,-15993,19547,15993,-19547,-15993,-19547,1778,8886,-1778,8886,1778,-8886,-1778,-8886,26655,8886,-26655,8886,26655,-8886,-26655,-8886,1778,19547,-1778,19547,1778,-19547,-1778,-19547,26655,19547,-26655,19547,26655,-19547,-26655,-19547,12439,5332,-12439,5332,12439,-5332,-12439,-5332,15993,5332,-15993,5332,15993,-5332,-15993,-5332,12439,23101,-12439,23101,12439,-23101,-12439,-23101,15993,23101,-15993,23101,15993,-23101,-15993,-23101,1778,5332,-1778,5332,1778,-5332,-1778,-5332,26655,5332,-26655,5332,26655,-5332,-26655,-5332,1778,23101,-1778,23101,1778,-23101,-1778,-23101,26655,23101,-26655,23101,26655,-23101,-26655,-23101,8886,12439,-8886,12439,8886,-12439,-8886,-12439,19547,12439,-19547,12439,19547,-12439,-19547,-12439,8886,15993,-8886,15993,8886,-15993,-8886,-15993,19547,15993,-19547,15993,19547,-15993,-19547,-15993,5332,12439,-5332,12439,5332,-12439,-5332,-12439,23101,12439,-23101,12439,23101,-12439,-23101,-12439,5332,15993,-5332,15993,5332,-15993,-5332,-15993,23101,15993,-23101,15993,23101,-15993,-23101,-15993,8886,1778,-8886,1778,8886,-1778,-8886,-1778,19547,1778,-19547,1778,19547,-1778,-19547,-1778,8886,26655,-8886,26655,8886,-26655,-8886,-26655,19547,26655,-19547,26655,19547,-26655,-19547,-26655,5332,1778,-5332,1778,5332,-1778,-5332,-1778,23101,1778,-23101,1778,23101,-1778,-23101,-1778,5332,26655,-5332,26655,5332,-26655,-5332,-26655,23101,26655,-23101,26655,23101,-26655,-23101,-26655,12439,12439,-12439,12439,12439,-12439,-12439,-12439,15993,12439,-15993,12439,15993,-12439,-15993,-12439,12439,15993,-12439,15993,12439,-15993,-12439,-15993,15993,15993,-15993,15993,15993,-15993,-15993,-15993,1778,12439,-1778,12439,1778,-12439,-1778,-12439,26655,12439,-26655,12439,26655,-12439,-26655,-12439,1778,15993,-1778,15993,1778,-15993,-1778,-15993,26655,15993,-26655,15993,26655,-15993,-26655,-15993,12439,1778,-12439,1778,12439,-1778,-12439,-1778,15993,1778,-15993,1778,15993,-1778,-15993,-1778,12439,26655,-12439,26655,12439,-26655,-12439,-26655,15993,26655,-15993,26655,15993,-26655,-15993,-26655,1778,1778,-1778,1778,1778,-1778,-1778,-1778,26655,1778,-26655,1778,26655,-1778,-26655,-1778,1778,26655,-1778,26655,1778,-26655,-1778,-26655,26655,26655,-26655,26655,26655,-26655,-26655,-26655}; #endif From 7bcf468e1b4c3d19904977dc05a915e38c53965a Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Wed, 29 Jul 2020 13:11:31 +0200 Subject: [PATCH 02/19] Added the changed octave script --- openair1/PHY/NR_REFSIG/nr_gen_mod_table.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openair1/PHY/NR_REFSIG/nr_gen_mod_table.m b/openair1/PHY/NR_REFSIG/nr_gen_mod_table.m index 13a8d4ad09..3fe03b2dc5 100644 --- a/openair1/PHY/NR_REFSIG/nr_gen_mod_table.m +++ b/openair1/PHY/NR_REFSIG/nr_gen_mod_table.m @@ -45,7 +45,7 @@ for r=0:1 %0 -- 1 LS for j=0:1 %0 -- 1 MS %% Formula is dispalayed -qpsk_table(2*r+j+1) = ((1-r*2)*QPSK + 1j*(1-2*j)*QPSK); +qpsk_table(2*j+r+1) = ((1-r*2)*QPSK + 1j*(1-2*j)*QPSK); end end @@ -61,7 +61,7 @@ for b0=0:1 for b1=0:1 for b2=0:1 for b3=0:1 -qam16_table2(b0*8+b1*4+b2*2+b3*1+1) = qam16_table(b0*2+b2*1+1) + 1j*qam16_table(b1*2+b3*1+1); +qam16_table2(b3*8+b2*4+b1*2+b0*1+1) = qam16_table(b0*2+b2*1+1) + 1j*qam16_table(b1*2+b3*1+1); end end end @@ -84,7 +84,7 @@ for b2=0:1 for b3=0:1 for b4=0:1 for b5=0:1 -qam64_table2(b0*32+b1*16+b2*8+b3*4+b4*2+b5*1+1) = qam64_table(b0*4+b2*2+b4*1+1) + 1j*qam64_table(b1*4+b3*2+b5*1+1); +qam64_table2(b5*32+b4*16+b3*8+b2*4+b1*2+b0*1+1) = qam64_table(b0*4+b2*2+b4*1+1) + 1j*qam64_table(b1*4+b3*2+b5*1+1); end end end @@ -116,7 +116,7 @@ for b6=0:1 for b7=0:1 %%qam64_table2(b0*32+b1*16+b2*8+b3*4+b4*2+b5*1+1) = qam64_table(b0*4+b2*2+b4*1+1) + 1j*qam64_table(b1*4+b3*2+b5*1+1); -qam256_table2(b0*128+b1*64+b2*32+b3*16+b4*8+b5*4+b6*2+b7*1+1) = qam256_table(b0*8+b2*4+b4*2+b6*1+1) + 1j*qam256_table(b1*8+b3*4+b5*2+b7*1+1); +qam256_table2(b7*128+b6*64+b5*32+b4*16+b3*8+b2*4+b1*2+b0*1+1) = qam256_table(b0*8+b2*4+b4*2+b6*1+1) + 1j*qam256_table(b1*8+b3*4+b5*2+b7*1+1); end end end From 82be36533b47a427689ab46d90df38dea1abe2ca Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Thu, 30 Jul 2020 16:49:00 +0200 Subject: [PATCH 03/19] Included special case for 64qam --- openair1/PHY/MODULATION/nr_modulation.c | 30 +++++++++++++++++++------ 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/openair1/PHY/MODULATION/nr_modulation.c b/openair1/PHY/MODULATION/nr_modulation.c index 289ac1df5f..e0a4254563 100644 --- a/openair1/PHY/MODULATION/nr_modulation.c +++ b/openair1/PHY/MODULATION/nr_modulation.c @@ -29,20 +29,36 @@ void nr_modulation(uint32_t *in, int16_t *out) { uint16_t offset; - uint8_t idx, b_idx; + uint16_t mask = ((1<>(i*mod_order)) & mask); + if (mod_order==6) { + uint16_t u = 1; + uint8_t shift_lut[3] = {0, 2, 4}; + for (int i=0; i>((i*mod_order)&0x1f)) & mask); + if ((((i+1)*mod_order)>32*u) && (i!=0)) + idx |= (in[(i*mod_order/32)+1]<>((i*mod_order)&0x1f)) & mask); + + out[i<<1] = nr_mod_table[(offset+idx)<<1]; + out[(i<<1)+1] = nr_mod_table[((offset+idx)<<1)+1]; + } } } From fbd4df014cbad0c7dee0ef89db21c5fce98c7cd6 Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Mon, 3 Aug 2020 11:22:34 +0200 Subject: [PATCH 04/19] Further improvements additional 50% speed improvement with SIMD vectors --- openair1/PHY/MODULATION/nr_modulation.c | 64 ++++++++++++++++++++----- openair1/PHY/NR_REFSIG/nr_mod_table.h | 4 ++ openair1/PHY/NR_TRANSPORT/nr_dci.c | 4 +- openair1/SIMULATION/NR_PHY/dlschsim.c | 1 - openair1/SIMULATION/NR_PHY/dlsim.c | 1 - openair1/SIMULATION/NR_PHY/pbchsim.c | 1 - openair1/SIMULATION/NR_PHY/prachsim.c | 1 - openair1/SIMULATION/NR_PHY/pucchsim.c | 1 - openair1/SIMULATION/NR_PHY/ulschsim.c | 1 - openair1/SIMULATION/NR_PHY/ulsim.c | 1 - 10 files changed, 57 insertions(+), 22 deletions(-) diff --git a/openair1/PHY/MODULATION/nr_modulation.c b/openair1/PHY/MODULATION/nr_modulation.c index e0a4254563..ee880f8c2a 100644 --- a/openair1/PHY/MODULATION/nr_modulation.c +++ b/openair1/PHY/MODULATION/nr_modulation.c @@ -20,6 +20,7 @@ */ #include "nr_modulation.h" +#include "PHY/NR_REFSIG/nr_mod_table.h" extern short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT]; @@ -30,16 +31,29 @@ void nr_modulation(uint32_t *in, { uint16_t offset; uint16_t mask = ((1<>((i*mod_order)&0x1f)) & mask); @@ -47,18 +61,42 @@ void nr_modulation(uint32_t *in, idx |= (in[(i*mod_order/32)+1]<>((i*mod_order)&0x1f)) & mask); + return; - out[i<<1] = nr_mod_table[(offset+idx)<<1]; - out[(i<<1)+1] = nr_mod_table[((offset+idx)<<1)+1]; - } + case 8: + nr_mod_table32 = (int32_t*) nr_mod_table; + for (int i=0; i>((i*mod_order)&0x1f)) & mask); + + out32[i] = nr_mod_table32[(offset+idx)]; } } diff --git a/openair1/PHY/NR_REFSIG/nr_mod_table.h b/openair1/PHY/NR_REFSIG/nr_mod_table.h index 99d207ecc8..f644e86359 100644 --- a/openair1/PHY/NR_REFSIG/nr_mod_table.h +++ b/openair1/PHY/NR_REFSIG/nr_mod_table.h @@ -30,4 +30,8 @@ #define NR_MOD_TABLE_QAM256_OFFSET 87 short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT] = {0,0,16384,16384,-16384,-16384,16384,16384,-16384,16384,16384,-16384,-16384,-16384,7327,7327,-7327,7327,7327,-7327,-7327,-7327,21981,7327,-21981,7327,21981,-7327,-21981,-7327,7327,21981,-7327,21981,7327,-21981,-7327,-21981,21981,21981,-21981,21981,21981,-21981,-21981,-21981,10726,10726,-10726,10726,10726,-10726,-10726,-10726,17876,10726,-17876,10726,17876,-10726,-17876,-10726,10726,17876,-10726,17876,10726,-17876,-10726,-17876,17876,17876,-17876,17876,17876,-17876,-17876,-17876,3576,10726,-3576,10726,3576,-10726,-3576,-10726,25027,10726,-25027,10726,25027,-10726,-25027,-10726,3576,17876,-3576,17876,3576,-17876,-3576,-17876,25027,17876,-25027,17876,25027,-17876,-25027,-17876,10726,3576,-10726,3576,10726,-3576,-10726,-3576,17876,3576,-17876,3576,17876,-3576,-17876,-3576,10726,25027,-10726,25027,10726,-25027,-10726,-25027,17876,25027,-17876,25027,17876,-25027,-17876,-25027,3576,3576,-3576,3576,3576,-3576,-3576,-3576,25027,3576,-25027,3576,25027,-3576,-25027,-3576,3576,25027,-3576,25027,3576,-25027,-3576,-25027,25027,25027,-25027,25027,25027,-25027,-25027,-25027,8886,8886,-8886,8886,8886,-8886,-8886,-8886,19547,8886,-19547,8886,19547,-8886,-19547,-8886,8886,19547,-8886,19547,8886,-19547,-8886,-19547,19547,19547,-19547,19547,19547,-19547,-19547,-19547,5332,8886,-5332,8886,5332,-8886,-5332,-8886,23101,8886,-23101,8886,23101,-8886,-23101,-8886,5332,19547,-5332,19547,5332,-19547,-5332,-19547,23101,19547,-23101,19547,23101,-19547,-23101,-19547,8886,5332,-8886,5332,8886,-5332,-8886,-5332,19547,5332,-19547,5332,19547,-5332,-19547,-5332,8886,23101,-8886,23101,8886,-23101,-8886,-23101,19547,23101,-19547,23101,19547,-23101,-19547,-23101,5332,5332,-5332,5332,5332,-5332,-5332,-5332,23101,5332,-23101,5332,23101,-5332,-23101,-5332,5332,23101,-5332,23101,5332,-23101,-5332,-23101,23101,23101,-23101,23101,23101,-23101,-23101,-23101,12439,8886,-12439,8886,12439,-8886,-12439,-8886,15993,8886,-15993,8886,15993,-8886,-15993,-8886,12439,19547,-12439,19547,12439,-19547,-12439,-19547,15993,19547,-15993,19547,15993,-19547,-15993,-19547,1778,8886,-1778,8886,1778,-8886,-1778,-8886,26655,8886,-26655,8886,26655,-8886,-26655,-8886,1778,19547,-1778,19547,1778,-19547,-1778,-19547,26655,19547,-26655,19547,26655,-19547,-26655,-19547,12439,5332,-12439,5332,12439,-5332,-12439,-5332,15993,5332,-15993,5332,15993,-5332,-15993,-5332,12439,23101,-12439,23101,12439,-23101,-12439,-23101,15993,23101,-15993,23101,15993,-23101,-15993,-23101,1778,5332,-1778,5332,1778,-5332,-1778,-5332,26655,5332,-26655,5332,26655,-5332,-26655,-5332,1778,23101,-1778,23101,1778,-23101,-1778,-23101,26655,23101,-26655,23101,26655,-23101,-26655,-23101,8886,12439,-8886,12439,8886,-12439,-8886,-12439,19547,12439,-19547,12439,19547,-12439,-19547,-12439,8886,15993,-8886,15993,8886,-15993,-8886,-15993,19547,15993,-19547,15993,19547,-15993,-19547,-15993,5332,12439,-5332,12439,5332,-12439,-5332,-12439,23101,12439,-23101,12439,23101,-12439,-23101,-12439,5332,15993,-5332,15993,5332,-15993,-5332,-15993,23101,15993,-23101,15993,23101,-15993,-23101,-15993,8886,1778,-8886,1778,8886,-1778,-8886,-1778,19547,1778,-19547,1778,19547,-1778,-19547,-1778,8886,26655,-8886,26655,8886,-26655,-8886,-26655,19547,26655,-19547,26655,19547,-26655,-19547,-26655,5332,1778,-5332,1778,5332,-1778,-5332,-1778,23101,1778,-23101,1778,23101,-1778,-23101,-1778,5332,26655,-5332,26655,5332,-26655,-5332,-26655,23101,26655,-23101,26655,23101,-26655,-23101,-26655,12439,12439,-12439,12439,12439,-12439,-12439,-12439,15993,12439,-15993,12439,15993,-12439,-15993,-12439,12439,15993,-12439,15993,12439,-15993,-12439,-15993,15993,15993,-15993,15993,15993,-15993,-15993,-15993,1778,12439,-1778,12439,1778,-12439,-1778,-12439,26655,12439,-26655,12439,26655,-12439,-26655,-12439,1778,15993,-1778,15993,1778,-15993,-1778,-15993,26655,15993,-26655,15993,26655,-15993,-26655,-15993,12439,1778,-12439,1778,12439,-1778,-12439,-1778,15993,1778,-15993,1778,15993,-1778,-15993,-1778,12439,26655,-12439,26655,12439,-26655,-12439,-26655,15993,26655,-15993,26655,15993,-26655,-15993,-26655,1778,1778,-1778,1778,1778,-1778,-1778,-1778,26655,1778,-26655,1778,26655,-1778,-26655,-1778,1778,26655,-1778,26655,1778,-26655,-1778,-26655,26655,26655,-26655,26655,26655,-26655,-26655,-26655}; + +short nr_qpsk_byte_mod_table[2048] = {16384,16384,16384,16384,16384,16384,16384,16384,-16384,16384,16384,16384,16384,16384,16384,16384,16384,-16384,16384,16384,16384,16384,16384,16384,-16384,-16384,16384,16384,16384,16384,16384,16384,16384,16384,-16384,16384,16384,16384,16384,16384,-16384,16384,-16384,16384,16384,16384,16384,16384,16384,-16384,-16384,16384,16384,16384,16384,16384,-16384,-16384,-16384,16384,16384,16384,16384,16384,16384,16384,16384,-16384,16384,16384,16384,16384,-16384,16384,16384,-16384,16384,16384,16384,16384,16384,-16384,16384,-16384,16384,16384,16384,16384,-16384,-16384,16384,-16384,16384,16384,16384,16384,16384,16384,-16384,-16384,16384,16384,16384,16384,-16384,16384,-16384,-16384,16384,16384,16384,16384,16384,-16384,-16384,-16384,16384,16384,16384,16384,-16384,-16384,-16384,-16384,16384,16384,16384,16384,16384,16384,16384,16384,-16384,16384,16384,16384,-16384,16384,16384,16384,-16384,16384,16384,16384,16384,-16384,16384,16384,-16384,16384,16384,16384,-16384,-16384,16384,16384,-16384,16384,16384,16384,16384,16384,-16384,16384,-16384,16384,16384,16384,-16384,16384,-16384,16384,-16384,16384,16384,16384,16384,-16384,-16384,16384,-16384,16384,16384,16384,-16384,-16384,-16384,16384,-16384,16384,16384,16384,16384,16384,16384,-16384,-16384,16384,16384,16384,-16384,16384,16384,-16384,-16384,16384,16384,16384,16384,-16384,16384,-16384,-16384,16384,16384,16384,-16384,-16384,16384,-16384,-16384,16384,16384,16384,16384,16384,-16384,-16384,-16384,16384,16384,16384,-16384,16384,-16384,-16384,-16384,16384,16384,16384,16384,-16384,-16384,-16384,-16384,16384,16384,16384,-16384,-16384,-16384,-16384,-16384,16384,16384,16384,16384,16384,16384,16384,16384,-16384,16384,16384,-16384,16384,16384,16384,16384,-16384,16384,16384,16384,-16384,16384,16384,16384,-16384,16384,16384,-16384,-16384,16384,16384,16384,-16384,16384,16384,16384,16384,-16384,16384,16384,-16384,16384,16384,-16384,16384,-16384,16384,16384,-16384,16384,16384,16384,-16384,-16384,16384,16384,-16384,16384,16384,-16384,-16384,-16384,16384,16384,-16384,16384,16384,16384,16384,16384,-16384,16384,-16384,16384,16384,-16384,16384,16384,-16384,16384,-16384,16384,16384,16384,-16384,16384,-16384,16384,-16384,16384,16384,-16384,-16384,16384,-16384,16384,-16384,16384,16384,16384,16384,-16384,-16384,16384,-16384,16384,16384,-16384,16384,-16384,-16384,16384,-16384,16384,16384,16384,-16384,-16384,-16384,16384,-16384,16384,16384,-16384,-16384,-16384,-16384,16384,-16384,16384,16384,16384,16384,16384,16384,-16384,-16384,16384,16384,-16384,16384,16384,16384,-16384,-16384,16384,16384,16384,-16384,16384,16384,-16384,-16384,16384,16384,-16384,-16384,16384,16384,-16384,-16384,16384,16384,16384,16384,-16384,16384,-16384,-16384,16384,16384,-16384,16384,-16384,16384,-16384,-16384,16384,16384,16384,-16384,-16384,16384,-16384,-16384,16384,16384,-16384,-16384,-16384,16384,-16384,-16384,16384,16384,16384,16384,16384,-16384,-16384,-16384,16384,16384,-16384,16384,16384,-16384,-16384,-16384,16384,16384,16384,-16384,16384,-16384,-16384,-16384,16384,16384,-16384,-16384,16384,-16384,-16384,-16384,16384,16384,16384,16384,-16384,-16384,-16384,-16384,16384,16384,-16384,16384,-16384,-16384,-16384,-16384,16384,16384,16384,-16384,-16384,-16384,-16384,-16384,16384,16384,-16384,-16384,-16384,-16384,-16384,-16384,16384,16384,16384,16384,16384,16384,16384,16384,-16384,16384,-16384,16384,16384,16384,16384,16384,-16384,16384,16384,-16384,16384,16384,16384,16384,-16384,16384,-16384,-16384,16384,16384,16384,16384,-16384,16384,16384,16384,-16384,16384,16384,16384,-16384,16384,-16384,16384,-16384,16384,16384,16384,-16384,16384,16384,-16384,-16384,16384,16384,16384,-16384,16384,-16384,-16384,-16384,16384,16384,16384,-16384,16384,16384,16384,16384,-16384,16384,16384,-16384,16384,-16384,16384,16384,-16384,16384,16384,-16384,16384,16384,-16384,16384,-16384,16384,16384,-16384,16384,-16384,-16384,16384,-16384,16384,16384,-16384,16384,16384,16384,-16384,-16384,16384,16384,-16384,16384,-16384,16384,-16384,-16384,16384,16384,-16384,16384,16384,-16384,-16384,-16384,16384,16384,-16384,16384,-16384,-16384,-16384,-16384,16384,16384,-16384,16384,16384,16384,16384,16384,-16384,16384,-16384,16384,-16384,16384,16384,16384,-16384,16384,-16384,16384,16384,-16384,16384,16384,-16384,16384,-16384,16384,-16384,-16384,16384,16384,-16384,16384,-16384,16384,16384,16384,-16384,16384,-16384,16384,-16384,16384,-16384,16384,-16384,16384,-16384,16384,-16384,16384,16384,-16384,-16384,16384,-16384,16384,-16384,16384,-16384,-16384,-16384,16384,-16384,16384,-16384,16384,16384,16384,16384,-16384,-16384,16384,-16384,16384,-16384,16384,16384,-16384,-16384,16384,-16384,16384,16384,-16384,16384,-16384,-16384,16384,-16384,16384,-16384,-16384,16384,-16384,-16384,16384,-16384,16384,16384,16384,-16384,-16384,-16384,16384,-16384,16384,-16384,16384,-16384,-16384,-16384,16384,-16384,16384,16384,-16384,-16384,-16384,-16384,16384,-16384,16384,-16384,-16384,-16384,-16384,-16384,16384,-16384,16384,16384,16384,16384,16384,16384,-16384,-16384,16384,-16384,16384,16384,16384,16384,-16384,-16384,16384,16384,-16384,16384,16384,16384,-16384,-16384,16384,-16384,-16384,16384,16384,16384,-16384,-16384,16384,16384,16384,-16384,16384,16384,-16384,-16384,16384,-16384,16384,-16384,16384,16384,-16384,-16384,16384,16384,-16384,-16384,16384,16384,-16384,-16384,16384,-16384,-16384,-16384,16384,16384,-16384,-16384,16384,16384,16384,16384,-16384,16384,-16384,-16384,16384,-16384,16384,16384,-16384,16384,-16384,-16384,16384,16384,-16384,16384,-16384,16384,-16384,-16384,16384,-16384,-16384,16384,-16384,16384,-16384,-16384,16384,16384,16384,-16384,-16384,16384,-16384,-16384,16384,-16384,16384,-16384,-16384,16384,-16384,-16384,16384,16384,-16384,-16384,-16384,16384,-16384,-16384,16384,-16384,-16384,-16384,-16384,16384,-16384,-16384,16384,16384,16384,16384,16384,-16384,-16384,-16384,16384,-16384,16384,16384,16384,-16384,-16384,-16384,16384,16384,-16384,16384,16384,-16384,-16384,-16384,16384,-16384,-16384,16384,16384,-16384,-16384,-16384,16384,16384,16384,-16384,16384,-16384,-16384,-16384,16384,-16384,16384,-16384,16384,-16384,-16384,-16384,16384,16384,-16384,-16384,16384,-16384,-16384,-16384,16384,-16384,-16384,-16384,16384,-16384,-16384,-16384,16384,16384,16384,16384,-16384,-16384,-16384,-16384,16384,-16384,16384,16384,-16384,-16384,-16384,-16384,16384,16384,-16384,16384,-16384,-16384,-16384,-16384,16384,-16384,-16384,16384,-16384,-16384,-16384,-16384,16384,16384,16384,-16384,-16384,-16384,-16384,-16384,16384,-16384,16384,-16384,-16384,-16384,-16384,-16384,16384,16384,-16384,-16384,-16384,-16384,-16384,-16384,16384,-16384,-16384,-16384,-16384,-16384,-16384,-16384,16384,16384,16384,16384,16384,16384,16384,16384,-16384,-16384,16384,16384,16384,16384,16384,16384,-16384,16384,-16384,16384,16384,16384,16384,16384,-16384,-16384,-16384,16384,16384,16384,16384,16384,-16384,16384,16384,-16384,16384,16384,16384,16384,-16384,-16384,16384,-16384,16384,16384,16384,16384,-16384,16384,-16384,-16384,16384,16384,16384,16384,-16384,-16384,-16384,-16384,16384,16384,16384,16384,-16384,16384,16384,16384,-16384,16384,16384,16384,-16384,-16384,16384,16384,-16384,16384,16384,16384,-16384,16384,-16384,16384,-16384,16384,16384,16384,-16384,-16384,-16384,16384,-16384,16384,16384,16384,-16384,16384,16384,-16384,-16384,16384,16384,16384,-16384,-16384,16384,-16384,-16384,16384,16384,16384,-16384,16384,-16384,-16384,-16384,16384,16384,16384,-16384,-16384,-16384,-16384,-16384,16384,16384,16384,-16384,16384,16384,16384,16384,-16384,16384,16384,-16384,-16384,16384,16384,16384,-16384,16384,16384,-16384,16384,-16384,16384,16384,-16384,16384,16384,-16384,-16384,-16384,16384,16384,-16384,16384,16384,-16384,16384,16384,-16384,16384,-16384,16384,16384,-16384,-16384,16384,-16384,16384,-16384,16384,16384,-16384,16384,-16384,-16384,16384,-16384,16384,16384,-16384,-16384,-16384,-16384,16384,-16384,16384,16384,-16384,16384,16384,16384,-16384,-16384,16384,16384,-16384,-16384,16384,16384,-16384,-16384,16384,16384,-16384,16384,-16384,16384,-16384,-16384,16384,16384,-16384,-16384,-16384,16384,-16384,-16384,16384,16384,-16384,16384,16384,-16384,-16384,-16384,16384,16384,-16384,-16384,16384,-16384,-16384,-16384,16384,16384,-16384,16384,-16384,-16384,-16384,-16384,16384,16384,-16384,-16384,-16384,-16384,-16384,-16384,16384,16384,-16384,16384,16384,16384,16384,16384,-16384,16384,-16384,-16384,16384,16384,16384,16384,-16384,16384,-16384,16384,-16384,16384,16384,16384,-16384,16384,-16384,-16384,-16384,16384,16384,16384,-16384,16384,-16384,16384,16384,-16384,16384,16384,-16384,16384,-16384,-16384,16384,-16384,16384,16384,-16384,16384,-16384,16384,-16384,-16384,16384,16384,-16384,16384,-16384,-16384,-16384,-16384,16384,16384,-16384,16384,-16384,16384,16384,16384,-16384,16384,-16384,16384,-16384,-16384,16384,16384,-16384,16384,-16384,16384,-16384,16384,-16384,16384,-16384,16384,-16384,16384,-16384,-16384,-16384,16384,-16384,16384,-16384,16384,-16384,16384,16384,-16384,-16384,16384,-16384,16384,-16384,-16384,16384,-16384,-16384,16384,-16384,16384,-16384,16384,-16384,-16384,-16384,16384,-16384,16384,-16384,-16384,-16384,-16384,-16384,16384,-16384,16384,-16384,16384,16384,16384,16384,-16384,-16384,16384,-16384,-16384,16384,16384,16384,-16384,-16384,16384,-16384,16384,-16384,16384,16384,-16384,-16384,16384,-16384,-16384,-16384,16384,16384,-16384,-16384,16384,-16384,16384,16384,-16384,16384,-16384,-16384,16384,-16384,-16384,16384,-16384,16384,-16384,-16384,16384,-16384,16384,-16384,-16384,16384,-16384,-16384,16384,-16384,-16384,-16384,-16384,16384,-16384,-16384,16384,-16384,16384,16384,16384,-16384,-16384,-16384,16384,-16384,-16384,16384,16384,-16384,-16384,-16384,16384,-16384,16384,-16384,16384,-16384,-16384,-16384,16384,-16384,-16384,-16384,16384,-16384,-16384,-16384,16384,-16384,16384,16384,-16384,-16384,-16384,-16384,16384,-16384,-16384,16384,-16384,-16384,-16384,-16384,16384,-16384,16384,-16384,-16384,-16384,-16384,-16384,16384,-16384,-16384,-16384,-16384,-16384,-16384,-16384,16384,-16384,16384,16384,16384,16384,16384,16384,-16384,-16384,-16384,16384,16384,16384,16384,16384,-16384,-16384,16384,-16384,16384,16384,16384,16384,-16384,-16384,-16384,-16384,16384,16384,16384,16384,-16384,-16384,16384,16384,-16384,16384,16384,16384,-16384,-16384,-16384,16384,-16384,16384,16384,16384,-16384,-16384,16384,-16384,-16384,16384,16384,16384,-16384,-16384,-16384,-16384,-16384,16384,16384,16384,-16384,-16384,16384,16384,16384,-16384,16384,16384,-16384,-16384,-16384,16384,16384,-16384,16384,16384,-16384,-16384,16384,-16384,16384,-16384,16384,16384,-16384,-16384,-16384,-16384,16384,-16384,16384,16384,-16384,-16384,16384,16384,-16384,-16384,16384,16384,-16384,-16384,-16384,16384,-16384,-16384,16384,16384,-16384,-16384,16384,-16384,-16384,-16384,16384,16384,-16384,-16384,-16384,-16384,-16384,-16384,16384,16384,-16384,-16384,16384,16384,16384,16384,-16384,16384,-16384,-16384,-16384,16384,16384,16384,-16384,16384,-16384,-16384,16384,-16384,16384,16384,-16384,16384,-16384,-16384,-16384,-16384,16384,16384,-16384,16384,-16384,-16384,16384,16384,-16384,16384,-16384,16384,-16384,-16384,-16384,16384,-16384,16384,-16384,16384,-16384,-16384,16384,-16384,-16384,16384,-16384,16384,-16384,-16384,-16384,-16384,-16384,16384,-16384,16384,-16384,-16384,16384,16384,16384,-16384,-16384,16384,-16384,-16384,-16384,16384,16384,-16384,-16384,16384,-16384,-16384,16384,-16384,16384,-16384,-16384,16384,-16384,-16384,-16384,-16384,16384,-16384,-16384,16384,-16384,-16384,16384,16384,-16384,-16384,-16384,16384,-16384,-16384,-16384,16384,-16384,-16384,-16384,16384,-16384,-16384,16384,-16384,-16384,-16384,-16384,16384,-16384,-16384,-16384,-16384,-16384,-16384,-16384,16384,-16384,-16384,16384,16384,16384,16384,16384,-16384,-16384,-16384,-16384,16384,16384,16384,16384,-16384,-16384,-16384,16384,-16384,16384,16384,16384,-16384,-16384,-16384,-16384,-16384,16384,16384,16384,-16384,-16384,-16384,16384,16384,-16384,16384,16384,-16384,-16384,-16384,-16384,16384,-16384,16384,16384,-16384,-16384,-16384,16384,-16384,-16384,16384,16384,-16384,-16384,-16384,-16384,-16384,-16384,16384,16384,-16384,-16384,-16384,16384,16384,16384,-16384,16384,-16384,-16384,-16384,-16384,16384,16384,-16384,16384,-16384,-16384,-16384,16384,-16384,16384,-16384,16384,-16384,-16384,-16384,-16384,-16384,16384,-16384,16384,-16384,-16384,-16384,16384,16384,-16384,-16384,16384,-16384,-16384,-16384,-16384,16384,-16384,-16384,16384,-16384,-16384,-16384,16384,-16384,-16384,-16384,16384,-16384,-16384,-16384,-16384,-16384,-16384,-16384,16384,-16384,-16384,-16384,16384,16384,16384,16384,-16384,-16384,-16384,-16384,-16384,16384,16384,16384,-16384,-16384,-16384,-16384,16384,-16384,16384,16384,-16384,-16384,-16384,-16384,-16384,-16384,16384,16384,-16384,-16384,-16384,-16384,16384,16384,-16384,16384,-16384,-16384,-16384,-16384,-16384,16384,-16384,16384,-16384,-16384,-16384,-16384,16384,-16384,-16384,16384,-16384,-16384,-16384,-16384,-16384,-16384,-16384,16384,-16384,-16384,-16384,-16384,16384,16384,16384,-16384,-16384,-16384,-16384,-16384,-16384,16384,16384,-16384,-16384,-16384,-16384,-16384,16384,-16384,16384,-16384,-16384,-16384,-16384,-16384,-16384,-16384,16384,-16384,-16384,-16384,-16384,-16384,16384,16384,-16384,-16384,-16384,-16384,-16384,-16384,-16384,16384,-16384,-16384,-16384,-16384,-16384,-16384,16384,-16384,-16384,-16384,-16384,-16384,-16384,-16384,-16384,-16384,-16384,-16384,-16384,-16384,-16384,-16384}; + +short nr_qam16_byte_mod_table[1024] = {7327,7327,7327,7327,-7327,7327,7327,7327,7327,-7327,7327,7327,-7327,-7327,7327,7327,21981,7327,7327,7327,-21981,7327,7327,7327,21981,-7327,7327,7327,-21981,-7327,7327,7327,7327,21981,7327,7327,-7327,21981,7327,7327,7327,-21981,7327,7327,-7327,-21981,7327,7327,21981,21981,7327,7327,-21981,21981,7327,7327,21981,-21981,7327,7327,-21981,-21981,7327,7327,7327,7327,-7327,7327,-7327,7327,-7327,7327,7327,-7327,-7327,7327,-7327,-7327,-7327,7327,21981,7327,-7327,7327,-21981,7327,-7327,7327,21981,-7327,-7327,7327,-21981,-7327,-7327,7327,7327,21981,-7327,7327,-7327,21981,-7327,7327,7327,-21981,-7327,7327,-7327,-21981,-7327,7327,21981,21981,-7327,7327,-21981,21981,-7327,7327,21981,-21981,-7327,7327,-21981,-21981,-7327,7327,7327,7327,7327,-7327,-7327,7327,7327,-7327,7327,-7327,7327,-7327,-7327,-7327,7327,-7327,21981,7327,7327,-7327,-21981,7327,7327,-7327,21981,-7327,7327,-7327,-21981,-7327,7327,-7327,7327,21981,7327,-7327,-7327,21981,7327,-7327,7327,-21981,7327,-7327,-7327,-21981,7327,-7327,21981,21981,7327,-7327,-21981,21981,7327,-7327,21981,-21981,7327,-7327,-21981,-21981,7327,-7327,7327,7327,-7327,-7327,-7327,7327,-7327,-7327,7327,-7327,-7327,-7327,-7327,-7327,-7327,-7327,21981,7327,-7327,-7327,-21981,7327,-7327,-7327,21981,-7327,-7327,-7327,-21981,-7327,-7327,-7327,7327,21981,-7327,-7327,-7327,21981,-7327,-7327,7327,-21981,-7327,-7327,-7327,-21981,-7327,-7327,21981,21981,-7327,-7327,-21981,21981,-7327,-7327,21981,-21981,-7327,-7327,-21981,-21981,-7327,-7327,7327,7327,21981,7327,-7327,7327,21981,7327,7327,-7327,21981,7327,-7327,-7327,21981,7327,21981,7327,21981,7327,-21981,7327,21981,7327,21981,-7327,21981,7327,-21981,-7327,21981,7327,7327,21981,21981,7327,-7327,21981,21981,7327,7327,-21981,21981,7327,-7327,-21981,21981,7327,21981,21981,21981,7327,-21981,21981,21981,7327,21981,-21981,21981,7327,-21981,-21981,21981,7327,7327,7327,-21981,7327,-7327,7327,-21981,7327,7327,-7327,-21981,7327,-7327,-7327,-21981,7327,21981,7327,-21981,7327,-21981,7327,-21981,7327,21981,-7327,-21981,7327,-21981,-7327,-21981,7327,7327,21981,-21981,7327,-7327,21981,-21981,7327,7327,-21981,-21981,7327,-7327,-21981,-21981,7327,21981,21981,-21981,7327,-21981,21981,-21981,7327,21981,-21981,-21981,7327,-21981,-21981,-21981,7327,7327,7327,21981,-7327,-7327,7327,21981,-7327,7327,-7327,21981,-7327,-7327,-7327,21981,-7327,21981,7327,21981,-7327,-21981,7327,21981,-7327,21981,-7327,21981,-7327,-21981,-7327,21981,-7327,7327,21981,21981,-7327,-7327,21981,21981,-7327,7327,-21981,21981,-7327,-7327,-21981,21981,-7327,21981,21981,21981,-7327,-21981,21981,21981,-7327,21981,-21981,21981,-7327,-21981,-21981,21981,-7327,7327,7327,-21981,-7327,-7327,7327,-21981,-7327,7327,-7327,-21981,-7327,-7327,-7327,-21981,-7327,21981,7327,-21981,-7327,-21981,7327,-21981,-7327,21981,-7327,-21981,-7327,-21981,-7327,-21981,-7327,7327,21981,-21981,-7327,-7327,21981,-21981,-7327,7327,-21981,-21981,-7327,-7327,-21981,-21981,-7327,21981,21981,-21981,-7327,-21981,21981,-21981,-7327,21981,-21981,-21981,-7327,-21981,-21981,-21981,-7327,7327,7327,7327,21981,-7327,7327,7327,21981,7327,-7327,7327,21981,-7327,-7327,7327,21981,21981,7327,7327,21981,-21981,7327,7327,21981,21981,-7327,7327,21981,-21981,-7327,7327,21981,7327,21981,7327,21981,-7327,21981,7327,21981,7327,-21981,7327,21981,-7327,-21981,7327,21981,21981,21981,7327,21981,-21981,21981,7327,21981,21981,-21981,7327,21981,-21981,-21981,7327,21981,7327,7327,-7327,21981,-7327,7327,-7327,21981,7327,-7327,-7327,21981,-7327,-7327,-7327,21981,21981,7327,-7327,21981,-21981,7327,-7327,21981,21981,-7327,-7327,21981,-21981,-7327,-7327,21981,7327,21981,-7327,21981,-7327,21981,-7327,21981,7327,-21981,-7327,21981,-7327,-21981,-7327,21981,21981,21981,-7327,21981,-21981,21981,-7327,21981,21981,-21981,-7327,21981,-21981,-21981,-7327,21981,7327,7327,7327,-21981,-7327,7327,7327,-21981,7327,-7327,7327,-21981,-7327,-7327,7327,-21981,21981,7327,7327,-21981,-21981,7327,7327,-21981,21981,-7327,7327,-21981,-21981,-7327,7327,-21981,7327,21981,7327,-21981,-7327,21981,7327,-21981,7327,-21981,7327,-21981,-7327,-21981,7327,-21981,21981,21981,7327,-21981,-21981,21981,7327,-21981,21981,-21981,7327,-21981,-21981,-21981,7327,-21981,7327,7327,-7327,-21981,-7327,7327,-7327,-21981,7327,-7327,-7327,-21981,-7327,-7327,-7327,-21981,21981,7327,-7327,-21981,-21981,7327,-7327,-21981,21981,-7327,-7327,-21981,-21981,-7327,-7327,-21981,7327,21981,-7327,-21981,-7327,21981,-7327,-21981,7327,-21981,-7327,-21981,-7327,-21981,-7327,-21981,21981,21981,-7327,-21981,-21981,21981,-7327,-21981,21981,-21981,-7327,-21981,-21981,-21981,-7327,-21981,7327,7327,21981,21981,-7327,7327,21981,21981,7327,-7327,21981,21981,-7327,-7327,21981,21981,21981,7327,21981,21981,-21981,7327,21981,21981,21981,-7327,21981,21981,-21981,-7327,21981,21981,7327,21981,21981,21981,-7327,21981,21981,21981,7327,-21981,21981,21981,-7327,-21981,21981,21981,21981,21981,21981,21981,-21981,21981,21981,21981,21981,-21981,21981,21981,-21981,-21981,21981,21981,7327,7327,-21981,21981,-7327,7327,-21981,21981,7327,-7327,-21981,21981,-7327,-7327,-21981,21981,21981,7327,-21981,21981,-21981,7327,-21981,21981,21981,-7327,-21981,21981,-21981,-7327,-21981,21981,7327,21981,-21981,21981,-7327,21981,-21981,21981,7327,-21981,-21981,21981,-7327,-21981,-21981,21981,21981,21981,-21981,21981,-21981,21981,-21981,21981,21981,-21981,-21981,21981,-21981,-21981,-21981,21981,7327,7327,21981,-21981,-7327,7327,21981,-21981,7327,-7327,21981,-21981,-7327,-7327,21981,-21981,21981,7327,21981,-21981,-21981,7327,21981,-21981,21981,-7327,21981,-21981,-21981,-7327,21981,-21981,7327,21981,21981,-21981,-7327,21981,21981,-21981,7327,-21981,21981,-21981,-7327,-21981,21981,-21981,21981,21981,21981,-21981,-21981,21981,21981,-21981,21981,-21981,21981,-21981,-21981,-21981,21981,-21981,7327,7327,-21981,-21981,-7327,7327,-21981,-21981,7327,-7327,-21981,-21981,-7327,-7327,-21981,-21981,21981,7327,-21981,-21981,-21981,7327,-21981,-21981,21981,-7327,-21981,-21981,-21981,-7327,-21981,-21981,7327,21981,-21981,-21981,-7327,21981,-21981,-21981,7327,-21981,-21981,-21981,-7327,-21981,-21981,-21981,21981,21981,-21981,-21981,-21981,21981,-21981,-21981,21981,-21981,-21981,-21981,-21981,-21981,-21981,-21981}; #endif diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c index a29211b55b..3344682f20 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c @@ -161,7 +161,7 @@ uint8_t nr_generate_dci_top(nfapi_nr_dl_tti_pdcch_pdu *pdcch_pdu, int16_t amp, NR_DL_FRAME_PARMS frame_parms) { - int16_t mod_dmrs[NR_MAX_CSET_DURATION][NR_MAX_PDCCH_DMRS_LENGTH>>1]; // 3 for the max coreset duration + int16_t mod_dmrs[NR_MAX_CSET_DURATION][NR_MAX_PDCCH_DMRS_LENGTH>>1] __attribute__((aligned(128))); // 3 for the max coreset duration uint16_t cset_start_sc; uint8_t cset_start_symb, cset_nsymb; int k,l,k_prime,dci_idx, dmrs_idx; @@ -260,7 +260,7 @@ uint8_t nr_generate_dci_top(nfapi_nr_dl_tti_pdcch_pdu *pdcch_pdu, scrambled_output[6], scrambled_output[7], scrambled_output[8], scrambled_output[9], scrambled_output[10],scrambled_output[11] ); #endif /// QPSK modulation - int16_t mod_dci[NR_MAX_DCI_SIZE>>1]; + int16_t mod_dci[NR_MAX_DCI_SIZE>>1] __attribute__((aligned(128))); nr_modulation(scrambled_output, encoded_length, DMRS_MOD_ORDER, mod_dci); //Qm = 2 as DMRS is QPSK modulated #ifdef DEBUG_DCI diff --git a/openair1/SIMULATION/NR_PHY/dlschsim.c b/openair1/SIMULATION/NR_PHY/dlschsim.c index 9374050e58..8f53b9acc4 100644 --- a/openair1/SIMULATION/NR_PHY/dlschsim.c +++ b/openair1/SIMULATION/NR_PHY/dlschsim.c @@ -37,7 +37,6 @@ #include "PHY/INIT/phy_init.h" #include "PHY/MODULATION/modulation_eNB.h" #include "PHY/MODULATION/modulation_UE.h" -#include "PHY/NR_REFSIG/nr_mod_table.h" #include "PHY/NR_REFSIG/refsig_defs_ue.h" #include "PHY/NR_TRANSPORT/nr_dlsch.h" #include "PHY/NR_TRANSPORT/nr_transport_proto.h" diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 137c358d7f..90aa3f6333 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -39,7 +39,6 @@ #include "PHY/INIT/phy_init.h" #include "PHY/MODULATION/modulation_eNB.h" #include "PHY/MODULATION/modulation_UE.h" -#include "PHY/NR_REFSIG/nr_mod_table.h" #include "PHY/NR_REFSIG/refsig_defs_ue.h" #include "PHY/NR_TRANSPORT/nr_transport_proto.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c index 2144652f86..8c37024858 100644 --- a/openair1/SIMULATION/NR_PHY/pbchsim.c +++ b/openair1/SIMULATION/NR_PHY/pbchsim.c @@ -33,7 +33,6 @@ #include "PHY/defs_nr_UE.h" #include "PHY/defs_gNB.h" #include "PHY/NR_REFSIG/refsig_defs_ue.h" -#include "PHY/NR_REFSIG/nr_mod_table.h" #include "PHY/MODULATION/modulation_eNB.h" #include "PHY/MODULATION/modulation_UE.h" #include "PHY/INIT/phy_init.h" diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c index 2db5bc905c..950f9a67f6 100644 --- a/openair1/SIMULATION/NR_PHY/prachsim.c +++ b/openair1/SIMULATION/NR_PHY/prachsim.c @@ -37,7 +37,6 @@ #include "SCHED_NR_UE/phy_frame_config_nr.h" #include "PHY/phy_vars_nr_ue.h" #include "PHY/NR_REFSIG/refsig_defs_ue.h" -#include "PHY/NR_REFSIG/nr_mod_table.h" #include "PHY/MODULATION/modulation_eNB.h" #include "PHY/MODULATION/modulation_UE.h" #include "PHY/INIT/phy_init.h" diff --git a/openair1/SIMULATION/NR_PHY/pucchsim.c b/openair1/SIMULATION/NR_PHY/pucchsim.c index 004a7b8de8..86f7d651e4 100644 --- a/openair1/SIMULATION/NR_PHY/pucchsim.c +++ b/openair1/SIMULATION/NR_PHY/pucchsim.c @@ -33,7 +33,6 @@ #include "PHY/defs_nr_UE.h" #include "PHY/defs_gNB.h" #include "PHY/NR_REFSIG/refsig_defs_ue.h" -#include "PHY/NR_REFSIG/nr_mod_table.h" #include "PHY/MODULATION/modulation_eNB.h" #include "PHY/MODULATION/modulation_UE.h" #include "PHY/INIT/phy_init.h" diff --git a/openair1/SIMULATION/NR_PHY/ulschsim.c b/openair1/SIMULATION/NR_PHY/ulschsim.c index b0557ef1b4..af49aa757b 100644 --- a/openair1/SIMULATION/NR_PHY/ulschsim.c +++ b/openair1/SIMULATION/NR_PHY/ulschsim.c @@ -34,7 +34,6 @@ #include "PHY/defs_gNB.h" #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/modulation_eNB.h" #include "PHY/MODULATION/modulation_UE.h" #include "PHY/NR_TRANSPORT/nr_transport_proto.h" diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index bcaa967a30..f016092442 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -37,7 +37,6 @@ #include "PHY/MODULATION/modulation_UE.h" #include "PHY/MODULATION/nr_modulation.h" #include "PHY/NR_REFSIG/dmrs_nr.h" -#include "PHY/NR_REFSIG/nr_mod_table.h" #include "PHY/NR_REFSIG/refsig_defs_ue.h" #include "PHY/NR_TRANSPORT/nr_dlsch.h" #include "PHY/NR_TRANSPORT/nr_sch_dmrs.h" From 18a3747e82431efb5659cc74b72ecd93c2836a9f Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Mon, 3 Aug 2020 11:46:33 +0200 Subject: [PATCH 05/19] added the changed octave script --- openair1/PHY/NR_REFSIG/nr_gen_mod_table.m | 51 +++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/openair1/PHY/NR_REFSIG/nr_gen_mod_table.m b/openair1/PHY/NR_REFSIG/nr_gen_mod_table.m index 3fe03b2dc5..6e1415bf28 100644 --- a/openair1/PHY/NR_REFSIG/nr_gen_mod_table.m +++ b/openair1/PHY/NR_REFSIG/nr_gen_mod_table.m @@ -126,6 +126,49 @@ end end end +%%QPSK byte +for b0=0:1 +for b1=0:1 +for b2=0:1 +for b3=0:1 +for b4=0:1 +for b5=0:1 +for b6=0:1 +for b7=0:1 +qpsk_byte_table2(b7*128+b6*64+b5*32+b4*16+b3*8+b2*4+b1*2+b0*1+1,:)=[(1-b0*2)*QPSK (1-2*b1)*QPSK (1-b2*2)*QPSK (1-2*b3)*QPSK ... + (1-b4*2)*QPSK (1-2*b5)*QPSK (1-b6*2)*QPSK (1-2*b7)*QPSK]; + +end +end +end +end +end +end +end +end + +%%16QAM byte +qam16_byte_table2=[]; +for b0=0:1 +for b1=0:1 +for b2=0:1 +for b3=0:1 +for b4=0:1 +for b5=0:1 +for b6=0:1 +for b7=0:1 +qam16_byte_table2(b7*128+b6*64+b5*32+b4*16+b3*8+b2*4+b1*2+b0*1+1,:)=[qam16_table(b0*2+b2*1+1) qam16_table(b1*2+b3*1+1) ... + qam16_table(b4*2+b6*1+1) qam16_table(b5*2+b7*1+1) ]; + +end +end +end +end +end +end +end +end + table = round(K * [ 0; bpsk_table(:); qpsk_table(:);qam16_table2(:); qam64_table2(:);qam256_table2(:) ]); %scatter (real(qam256_table2), imag(qam256_table2), 'x'); save mod_table.mat table @@ -133,6 +176,8 @@ save mod_table.mat table table2 = zeros(1,length(table)*2); table2(1:2:end) = real(table); table2(2:2:end) = imag(table); +qpsk_byte_table2=round(K * qpsk_byte_table2'(:)); +qam16_byte_table2=round(K * qam16_byte_table2'(:)); fd = fopen("nr_mod_table.h","w"); fprintf(fd,"#define NR_MOD_TABLE_SIZE_SHORT %d\n", length(table)*2); @@ -144,4 +189,10 @@ fprintf(fd,"#define NR_MOD_TABLE_QAM256_OFFSET %d\n", 87); fprintf(fd,"short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT] = {"); fprintf(fd,"%d,",table2(1:end-1)); fprintf(fd,"%d};\n",table2(end)); +fprintf(fd,"short nr_qpsk_mod_table[2048] = {"); +fprintf(fd,"%d,",qpsk_byte_table2(1:end-1)); +fprintf(fd,"%d};\n",qpsk_byte_table2(end)); +fprintf(fd,"short nr_qam16_mod_table[1024] = {"); +fprintf(fd,"%d,",qam16_byte_table2(1:end-1)); +fprintf(fd,"%d};\n",qam16_byte_table2(end)); fclose(fd); From f8675c258dc2e5a7a1327667c5f22e3628cdf254 Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Mon, 3 Aug 2020 14:11:52 +0200 Subject: [PATCH 06/19] Fixed linking errors --- executables/nr-softmodem.c | 2 -- executables/nr-uesoftmodem.c | 1 - 2 files changed, 3 deletions(-) diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 77f6dc14b1..22fca57970 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -84,8 +84,6 @@ unsigned short config_frames[4] = {2,9,11,13}; #include "NB_IoT_interface.h" #include "x2ap_eNB.h" -short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT] = {0,0,16384,16384,-16384,-16384,16384,16384,-16384,16384,16384,-16384,-16384,-16384,7327,7327,-7327,7327,7327,-7327,-7327,-7327,21981,7327,-21981,7327,21981,-7327,-21981,-7327,7327,21981,-7327,21981,7327,-21981,-7327,-21981,21981,21981,-21981,21981,21981,-21981,-21981,-21981,10726,10726,-10726,10726,10726,-10726,-10726,-10726,17876,10726,-17876,10726,17876,-10726,-17876,-10726,10726,17876,-10726,17876,10726,-17876,-10726,-17876,17876,17876,-17876,17876,17876,-17876,-17876,-17876,3576,10726,-3576,10726,3576,-10726,-3576,-10726,25027,10726,-25027,10726,25027,-10726,-25027,-10726,3576,17876,-3576,17876,3576,-17876,-3576,-17876,25027,17876,-25027,17876,25027,-17876,-25027,-17876,10726,3576,-10726,3576,10726,-3576,-10726,-3576,17876,3576,-17876,3576,17876,-3576,-17876,-3576,10726,25027,-10726,25027,10726,-25027,-10726,-25027,17876,25027,-17876,25027,17876,-25027,-17876,-25027,3576,3576,-3576,3576,3576,-3576,-3576,-3576,25027,3576,-25027,3576,25027,-3576,-25027,-3576,3576,25027,-3576,25027,3576,-25027,-3576,-25027,25027,25027,-25027,25027,25027,-25027,-25027,-25027,8886,8886,-8886,8886,8886,-8886,-8886,-8886,19547,8886,-19547,8886,19547,-8886,-19547,-8886,8886,19547,-8886,19547,8886,-19547,-8886,-19547,19547,19547,-19547,19547,19547,-19547,-19547,-19547,5332,8886,-5332,8886,5332,-8886,-5332,-8886,23101,8886,-23101,8886,23101,-8886,-23101,-8886,5332,19547,-5332,19547,5332,-19547,-5332,-19547,23101,19547,-23101,19547,23101,-19547,-23101,-19547,8886,5332,-8886,5332,8886,-5332,-8886,-5332,19547,5332,-19547,5332,19547,-5332,-19547,-5332,8886,23101,-8886,23101,8886,-23101,-8886,-23101,19547,23101,-19547,23101,19547,-23101,-19547,-23101,5332,5332,-5332,5332,5332,-5332,-5332,-5332,23101,5332,-23101,5332,23101,-5332,-23101,-5332,5332,23101,-5332,23101,5332,-23101,-5332,-23101,23101,23101,-23101,23101,23101,-23101,-23101,-23101,12439,8886,-12439,8886,12439,-8886,-12439,-8886,15993,8886,-15993,8886,15993,-8886,-15993,-8886,12439,19547,-12439,19547,12439,-19547,-12439,-19547,15993,19547,-15993,19547,15993,-19547,-15993,-19547,1778,8886,-1778,8886,1778,-8886,-1778,-8886,26655,8886,-26655,8886,26655,-8886,-26655,-8886,1778,19547,-1778,19547,1778,-19547,-1778,-19547,26655,19547,-26655,19547,26655,-19547,-26655,-19547,12439,5332,-12439,5332,12439,-5332,-12439,-5332,15993,5332,-15993,5332,15993,-5332,-15993,-5332,12439,23101,-12439,23101,12439,-23101,-12439,-23101,15993,23101,-15993,23101,15993,-23101,-15993,-23101,1778,5332,-1778,5332,1778,-5332,-1778,-5332,26655,5332,-26655,5332,26655,-5332,-26655,-5332,1778,23101,-1778,23101,1778,-23101,-1778,-23101,26655,23101,-26655,23101,26655,-23101,-26655,-23101,8886,12439,-8886,12439,8886,-12439,-8886,-12439,19547,12439,-19547,12439,19547,-12439,-19547,-12439,8886,15993,-8886,15993,8886,-15993,-8886,-15993,19547,15993,-19547,15993,19547,-15993,-19547,-15993,5332,12439,-5332,12439,5332,-12439,-5332,-12439,23101,12439,-23101,12439,23101,-12439,-23101,-12439,5332,15993,-5332,15993,5332,-15993,-5332,-15993,23101,15993,-23101,15993,23101,-15993,-23101,-15993,8886,1778,-8886,1778,8886,-1778,-8886,-1778,19547,1778,-19547,1778,19547,-1778,-19547,-1778,8886,26655,-8886,26655,8886,-26655,-8886,-26655,19547,26655,-19547,26655,19547,-26655,-19547,-26655,5332,1778,-5332,1778,5332,-1778,-5332,-1778,23101,1778,-23101,1778,23101,-1778,-23101,-1778,5332,26655,-5332,26655,5332,-26655,-5332,-26655,23101,26655,-23101,26655,23101,-26655,-23101,-26655,12439,12439,-12439,12439,12439,-12439,-12439,-12439,15993,12439,-15993,12439,15993,-12439,-15993,-12439,12439,15993,-12439,15993,12439,-15993,-12439,-15993,15993,15993,-15993,15993,15993,-15993,-15993,-15993,1778,12439,-1778,12439,1778,-12439,-1778,-12439,26655,12439,-26655,12439,26655,-12439,-26655,-12439,1778,15993,-1778,15993,1778,-15993,-1778,-15993,26655,15993,-26655,15993,26655,-15993,-26655,-15993,12439,1778,-12439,1778,12439,-1778,-12439,-1778,15993,1778,-15993,1778,15993,-1778,-15993,-1778,12439,26655,-12439,26655,12439,-26655,-12439,-26655,15993,26655,-15993,26655,15993,-26655,-15993,-26655,1778,1778,-1778,1778,1778,-1778,-1778,-1778,26655,1778,-26655,1778,26655,-1778,-26655,-1778,1778,26655,-1778,26655,1778,-26655,-1778,-26655,26655,26655,-26655,26655,26655,-26655,-26655,-26655}; - pthread_cond_t nfapi_sync_cond; pthread_mutex_t nfapi_sync_mutex; int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 6d3bbc9038..3630ef91d4 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -44,7 +44,6 @@ #include "SCHED/sched_common_vars.h" #include "PHY/MODULATION/modulation_vars.h" //#include "../../SIMU/USER/init_lte.h" -#include "PHY/NR_REFSIG/nr_mod_table.h" #include "LAYER2/MAC/mac_vars.h" #include "RRC/LTE/rrc_vars.h" From 82df0e51b92839888109688f5d4b2eae08a11d14 Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Mon, 10 Aug 2020 15:19:53 +0200 Subject: [PATCH 07/19] updated tables and 64qam mod --- cmake_targets/CMakeLists.txt | 1 + openair1/PHY/INIT/nr_init.c | 1 + openair1/PHY/MODULATION/nr_modulation.c | 113 ++++++++++++++++++------ openair1/PHY/NR_REFSIG/nr_mod_table.h | 11 ++- openair1/PHY/NR_REFSIG/nr_refsig.h | 2 + openair1/PHY/NR_TRANSPORT/nr_dlsch.c | 2 +- openair1/SIMULATION/NR_PHY/dlsim.c | 33 +++---- 7 files changed, 116 insertions(+), 47 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 0b60172747..23490ce9f6 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -1543,6 +1543,7 @@ set(PHY_SRC_UE ${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_dmrs_rx.c ${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_gold.c ${OPENAIR1_DIR}/PHY/NR_REFSIG/scrambling_luts.c + ${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_gen_mod_table.c ${OPENAIR1_DIR}/PHY/NR_REFSIG/dmrs_nr.c ${OPENAIR1_DIR}/PHY/NR_REFSIG/ptrs_nr.c ${OPENAIR1_DIR}/PHY/NR_UE_ESTIMATION/filt16a_32.c diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 9e095d5ab5..136092f2d4 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -132,6 +132,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, } } + nr_generate_modulation_table(); nr_init_pdcch_dmrs(gNB, cfg->cell_config.phy_cell_id.value); nr_init_pbch_interleaver(gNB->nr_pbch_interleaver); //PDSCH DMRS init diff --git a/openair1/PHY/MODULATION/nr_modulation.c b/openair1/PHY/MODULATION/nr_modulation.c index ee880f8c2a..dc3934ffca 100644 --- a/openair1/PHY/MODULATION/nr_modulation.c +++ b/openair1/PHY/MODULATION/nr_modulation.c @@ -34,64 +34,123 @@ void nr_modulation(uint32_t *in, int32_t* nr_mod_table32; int32_t* out32 = (int32_t*) out; uint8_t* in_bytes = (uint8_t*) in; + uint64_t* in64 = (uint64_t*) in; + int64_t* out64 = (int64_t*) out; uint8_t idx; - uint16_t u = 1; - uint8_t shift_lut[3] = {0, 2, 4}; + uint32_t i,j; + uint32_t bit_cnt; + uint64_t x,x1,x2; -#if defined(__SSE2__) +#if defined(__AVX2__) + uint16_t *in_2bytes = (uint16_t*) in; + __m256i *nr_mod_table256; + __m256i *out256; +#elif defined(__SSE2__) __m128i *nr_mod_table128; __m128i *out128; - __m64 *nr_mod_table64; - __m64 *out64; #endif 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; - LOG_D(PHY,"nr_modulation: length %d, mod_order %d\n",length,mod_order); + LOG_I(PHY,"nr_modulation: length %d, mod_order %d\n",length,mod_order); switch (mod_order) { case 6: - nr_mod_table32 = (int32_t*) nr_mod_table; - for (int i=0; i>((i*mod_order)&0x1f)) & mask); - if ((((i+1)*mod_order)>32*u) && (i!=0)) - idx |= (in[(i*mod_order/32)+1]<>12)&4095; + out64[j++] = nr_64qam_mod_table[x1]; + x1 = (x>>24)&4095; + out64[j++] = nr_64qam_mod_table[x1]; + x1 = (x>>36)&4095; + out64[j++] = nr_64qam_mod_table[x1]; + x1 = (x>>48)&4095; + out64[j++] = nr_64qam_mod_table[x1]; + x2 = (x>>60); + x = in64[i*3+1]; + x2 |= x<<4; + x1 = x2&4095; + out64[j++] = nr_64qam_mod_table[x1]; + x1 = (x2>>12)&4095; + out64[j++] = nr_64qam_mod_table[x1]; + x1 = (x2>>24)&4095; + out64[j++] = nr_64qam_mod_table[x1]; + x1 = (x2>>36)&4095; + out64[j++] = nr_64qam_mod_table[x1]; + x1 = (x2>>48)&4095; + out64[j++] = nr_64qam_mod_table[x1]; + x2 = ((x>>56)&0xf0) | (x2>>60); + x = in64[i*3+2]; + x2 |= x<<8; + x1 = x2&4095; + out64[j++] = nr_64qam_mod_table[x1]; + x1 = (x2>>12)&4095; + out64[j++] = nr_64qam_mod_table[x1]; + x1 = (x2>>24)&4095; + out64[j++] = nr_64qam_mod_table[x1]; + x1 = (x2>>36)&4095; + out64[j++] = nr_64qam_mod_table[x1]; + x1 = (x2>>48)&4095; + out64[j++] = nr_64qam_mod_table[x1]; + x2 = ((x>>52)&0xff0) | (x2>>60); + out64[j++] = nr_64qam_mod_table[x2]; + } + i *= 24; + bit_cnt = i * 8; + while (bit_cnt < length) { + x = *((uint32_t*)(in_bytes+i)); + x1 = x&4095; + out64[j++] = nr_64qam_mod_table[x1]; + x1 = (x>>12)&4095; + out64[j++] = nr_64qam_mod_table[x1]; + i += 3; + bit_cnt += 24; } return; - + case 8: nr_mod_table32 = (int32_t*) nr_mod_table; - for (int i=0; i>((i*mod_order)&0x1f)) & mask); diff --git a/openair1/PHY/NR_REFSIG/nr_mod_table.h b/openair1/PHY/NR_REFSIG/nr_mod_table.h index f644e86359..d42f211e8e 100644 --- a/openair1/PHY/NR_REFSIG/nr_mod_table.h +++ b/openair1/PHY/NR_REFSIG/nr_mod_table.h @@ -28,10 +28,15 @@ #define NR_MOD_TABLE_QAM16_OFFSET 7 #define NR_MOD_TABLE_QAM64_OFFSET 23 #define NR_MOD_TABLE_QAM256_OFFSET 87 -short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT] = {0,0,16384,16384,-16384,-16384,16384,16384,-16384,16384,16384,-16384,-16384,-16384,7327,7327,-7327,7327,7327,-7327,-7327,-7327,21981,7327,-21981,7327,21981,-7327,-21981,-7327,7327,21981,-7327,21981,7327,-21981,-7327,-21981,21981,21981,-21981,21981,21981,-21981,-21981,-21981,10726,10726,-10726,10726,10726,-10726,-10726,-10726,17876,10726,-17876,10726,17876,-10726,-17876,-10726,10726,17876,-10726,17876,10726,-17876,-10726,-17876,17876,17876,-17876,17876,17876,-17876,-17876,-17876,3576,10726,-3576,10726,3576,-10726,-3576,-10726,25027,10726,-25027,10726,25027,-10726,-25027,-10726,3576,17876,-3576,17876,3576,-17876,-3576,-17876,25027,17876,-25027,17876,25027,-17876,-25027,-17876,10726,3576,-10726,3576,10726,-3576,-10726,-3576,17876,3576,-17876,3576,17876,-3576,-17876,-3576,10726,25027,-10726,25027,10726,-25027,-10726,-25027,17876,25027,-17876,25027,17876,-25027,-17876,-25027,3576,3576,-3576,3576,3576,-3576,-3576,-3576,25027,3576,-25027,3576,25027,-3576,-25027,-3576,3576,25027,-3576,25027,3576,-25027,-3576,-25027,25027,25027,-25027,25027,25027,-25027,-25027,-25027,8886,8886,-8886,8886,8886,-8886,-8886,-8886,19547,8886,-19547,8886,19547,-8886,-19547,-8886,8886,19547,-8886,19547,8886,-19547,-8886,-19547,19547,19547,-19547,19547,19547,-19547,-19547,-19547,5332,8886,-5332,8886,5332,-8886,-5332,-8886,23101,8886,-23101,8886,23101,-8886,-23101,-8886,5332,19547,-5332,19547,5332,-19547,-5332,-19547,23101,19547,-23101,19547,23101,-19547,-23101,-19547,8886,5332,-8886,5332,8886,-5332,-8886,-5332,19547,5332,-19547,5332,19547,-5332,-19547,-5332,8886,23101,-8886,23101,8886,-23101,-8886,-23101,19547,23101,-19547,23101,19547,-23101,-19547,-23101,5332,5332,-5332,5332,5332,-5332,-5332,-5332,23101,5332,-23101,5332,23101,-5332,-23101,-5332,5332,23101,-5332,23101,5332,-23101,-5332,-23101,23101,23101,-23101,23101,23101,-23101,-23101,-23101,12439,8886,-12439,8886,12439,-8886,-12439,-8886,15993,8886,-15993,8886,15993,-8886,-15993,-8886,12439,19547,-12439,19547,12439,-19547,-12439,-19547,15993,19547,-15993,19547,15993,-19547,-15993,-19547,1778,8886,-1778,8886,1778,-8886,-1778,-8886,26655,8886,-26655,8886,26655,-8886,-26655,-8886,1778,19547,-1778,19547,1778,-19547,-1778,-19547,26655,19547,-26655,19547,26655,-19547,-26655,-19547,12439,5332,-12439,5332,12439,-5332,-12439,-5332,15993,5332,-15993,5332,15993,-5332,-15993,-5332,12439,23101,-12439,23101,12439,-23101,-12439,-23101,15993,23101,-15993,23101,15993,-23101,-15993,-23101,1778,5332,-1778,5332,1778,-5332,-1778,-5332,26655,5332,-26655,5332,26655,-5332,-26655,-5332,1778,23101,-1778,23101,1778,-23101,-1778,-23101,26655,23101,-26655,23101,26655,-23101,-26655,-23101,8886,12439,-8886,12439,8886,-12439,-8886,-12439,19547,12439,-19547,12439,19547,-12439,-19547,-12439,8886,15993,-8886,15993,8886,-15993,-8886,-15993,19547,15993,-19547,15993,19547,-15993,-19547,-15993,5332,12439,-5332,12439,5332,-12439,-5332,-12439,23101,12439,-23101,12439,23101,-12439,-23101,-12439,5332,15993,-5332,15993,5332,-15993,-5332,-15993,23101,15993,-23101,15993,23101,-15993,-23101,-15993,8886,1778,-8886,1778,8886,-1778,-8886,-1778,19547,1778,-19547,1778,19547,-1778,-19547,-1778,8886,26655,-8886,26655,8886,-26655,-8886,-26655,19547,26655,-19547,26655,19547,-26655,-19547,-26655,5332,1778,-5332,1778,5332,-1778,-5332,-1778,23101,1778,-23101,1778,23101,-1778,-23101,-1778,5332,26655,-5332,26655,5332,-26655,-5332,-26655,23101,26655,-23101,26655,23101,-26655,-23101,-26655,12439,12439,-12439,12439,12439,-12439,-12439,-12439,15993,12439,-15993,12439,15993,-12439,-15993,-12439,12439,15993,-12439,15993,12439,-15993,-12439,-15993,15993,15993,-15993,15993,15993,-15993,-15993,-15993,1778,12439,-1778,12439,1778,-12439,-1778,-12439,26655,12439,-26655,12439,26655,-12439,-26655,-12439,1778,15993,-1778,15993,1778,-15993,-1778,-15993,26655,15993,-26655,15993,26655,-15993,-26655,-15993,12439,1778,-12439,1778,12439,-1778,-12439,-1778,15993,1778,-15993,1778,15993,-1778,-15993,-1778,12439,26655,-12439,26655,12439,-26655,-12439,-26655,15993,26655,-15993,26655,15993,-26655,-15993,-26655,1778,1778,-1778,1778,1778,-1778,-1778,-1778,26655,1778,-26655,1778,26655,-1778,-26655,-1778,1778,26655,-1778,26655,1778,-26655,-1778,-26655,26655,26655,-26655,26655,26655,-26655,-26655,-26655}; +short nr_qpsk_mod_table[8] = {16384,16384,-16384,16384,16384,-16384,-16384,-16384}; +#if defined(__AVX2__) +__m256i nr_qpsk_2byte_mod_table[65536]; +#elif defined(__SSE2__) +__m128i nr_qpsk_byte_mod_table[2048]; +#endif -short nr_qpsk_byte_mod_table[2048] = {16384,16384,16384,16384,16384,16384,16384,16384,-16384,16384,16384,16384,16384,16384,16384,16384,16384,-16384,16384,16384,16384,16384,16384,16384,-16384,-16384,16384,16384,16384,16384,16384,16384,16384,16384,-16384,16384,16384,16384,16384,16384,-16384,16384,-16384,16384,16384,16384,16384,16384,16384,-16384,-16384,16384,16384,16384,16384,16384,-16384,-16384,-16384,16384,16384,16384,16384,16384,16384,16384,16384,-16384,16384,16384,16384,16384,-16384,16384,16384,-16384,16384,16384,16384,16384,16384,-16384,16384,-16384,16384,16384,16384,16384,-16384,-16384,16384,-16384,16384,16384,16384,16384,16384,16384,-16384,-16384,16384,16384,16384,16384,-16384,16384,-16384,-16384,16384,16384,16384,16384,16384,-16384,-16384,-16384,16384,16384,16384,16384,-16384,-16384,-16384,-16384,16384,16384,16384,16384,16384,16384,16384,16384,-16384,16384,16384,16384,-16384,16384,16384,16384,-16384,16384,16384,16384,16384,-16384,16384,16384,-16384,16384,16384,16384,-16384,-16384,16384,16384,-16384,16384,16384,16384,16384,16384,-16384,16384,-16384,16384,16384,16384,-16384,16384,-16384,16384,-16384,16384,16384,16384,16384,-16384,-16384,16384,-16384,16384,16384,16384,-16384,-16384,-16384,16384,-16384,16384,16384,16384,16384,16384,16384,-16384,-16384,16384,16384,16384,-16384,16384,16384,-16384,-16384,16384,16384,16384,16384,-16384,16384,-16384,-16384,16384,16384,16384,-16384,-16384,16384,-16384,-16384,16384,16384,16384,16384,16384,-16384,-16384,-16384,16384,16384,16384,-16384,16384,-16384,-16384,-16384,16384,16384,16384,16384,-16384,-16384,-16384,-16384,16384,16384,16384,-16384,-16384,-16384,-16384,-16384,16384,16384,16384,16384,16384,16384,16384,16384,-16384,16384,16384,-16384,16384,16384,16384,16384,-16384,16384,16384,16384,-16384,16384,16384,16384,-16384,16384,16384,-16384,-16384,16384,16384,16384,-16384,16384,16384,16384,16384,-16384,16384,16384,-16384,16384,16384,-16384,16384,-16384,16384,16384,-16384,16384,16384,16384,-16384,-16384,16384,16384,-16384,16384,16384,-16384,-16384,-16384,16384,16384,-16384,16384,16384,16384,16384,16384,-16384,16384,-16384,16384,16384,-16384,16384,16384,-16384,16384,-16384,16384,16384,16384,-16384,16384,-16384,16384,-16384,16384,16384,-16384,-16384,16384,-16384,16384,-16384,16384,16384,16384,16384,-16384,-16384,16384,-16384,16384,16384,-16384,16384,-16384,-16384,16384,-16384,16384,16384,16384,-16384,-16384,-16384,16384,-16384,16384,16384,-16384,-16384,-16384,-16384,16384,-16384,16384,16384,16384,16384,16384,16384,-16384,-16384,16384,16384,-16384,16384,16384,16384,-16384,-16384,16384,16384,16384,-16384,16384,16384,-16384,-16384,16384,16384,-16384,-16384,16384,16384,-16384,-16384,16384,16384,16384,16384,-16384,16384,-16384,-16384,16384,16384,-16384,16384,-16384,16384,-16384,-16384,16384,16384,16384,-16384,-16384,16384,-16384,-16384,16384,16384,-16384,-16384,-16384,16384,-16384,-16384,16384,16384,16384,16384,16384,-16384,-16384,-16384,16384,16384,-16384,16384,16384,-16384,-16384,-16384,16384,16384,16384,-16384,16384,-16384,-16384,-16384,16384,16384,-16384,-16384,16384,-16384,-16384,-16384,16384,16384,16384,16384,-16384,-16384,-16384,-16384,16384,16384,-16384,16384,-16384,-16384,-16384,-16384,16384,16384,16384,-16384,-16384,-16384,-16384,-16384,16384,16384,-16384,-16384,-16384,-16384,-16384,-16384,16384,16384,16384,16384,16384,16384,16384,16384,-16384,16384,-16384,16384,16384,16384,16384,16384,-16384,16384,16384,-16384,16384,16384,16384,16384,-16384,16384,-16384,-16384,16384,16384,16384,16384,-16384,16384,16384,16384,-16384,16384,16384,16384,-16384,16384,-16384,16384,-16384,16384,16384,16384,-16384,16384,16384,-16384,-16384,16384,16384,16384,-16384,16384,-16384,-16384,-16384,16384,16384,16384,-16384,16384,16384,16384,16384,-16384,16384,16384,-16384,16384,-16384,16384,16384,-16384,16384,16384,-16384,16384,16384,-16384,16384,-16384,16384,16384,-16384,16384,-16384,-16384,16384,-16384,16384,16384,-16384,16384,16384,16384,-16384,-16384,16384,16384,-16384,16384,-16384,16384,-16384,-16384,16384,16384,-16384,16384,16384,-16384,-16384,-16384,16384,16384,-16384,16384,-16384,-16384,-16384,-16384,16384,16384,-16384,16384,16384,16384,16384,16384,-16384,16384,-16384,16384,-16384,16384,16384,16384,-16384,16384,-16384,16384,16384,-16384,16384,16384,-16384,16384,-16384,16384,-16384,-16384,16384,16384,-16384,16384,-16384,16384,16384,16384,-16384,16384,-16384,16384,-16384,16384,-16384,16384,-16384,16384,-16384,16384,-16384,16384,16384,-16384,-16384,16384,-16384,16384,-16384,16384,-16384,-16384,-16384,16384,-16384,16384,-16384,16384,16384,16384,16384,-16384,-16384,16384,-16384,16384,-16384,16384,16384,-16384,-16384,16384,-16384,16384,16384,-16384,16384,-16384,-16384,16384,-16384,16384,-16384,-16384,16384,-16384,-16384,16384,-16384,16384,16384,16384,-16384,-16384,-16384,16384,-16384,16384,-16384,16384,-16384,-16384,-16384,16384,-16384,16384,16384,-16384,-16384,-16384,-16384,16384,-16384,16384,-16384,-16384,-16384,-16384,-16384,16384,-16384,16384,16384,16384,16384,16384,16384,-16384,-16384,16384,-16384,16384,16384,16384,16384,-16384,-16384,16384,16384,-16384,16384,16384,16384,-16384,-16384,16384,-16384,-16384,16384,16384,16384,-16384,-16384,16384,16384,16384,-16384,16384,16384,-16384,-16384,16384,-16384,16384,-16384,16384,16384,-16384,-16384,16384,16384,-16384,-16384,16384,16384,-16384,-16384,16384,-16384,-16384,-16384,16384,16384,-16384,-16384,16384,16384,16384,16384,-16384,16384,-16384,-16384,16384,-16384,16384,16384,-16384,16384,-16384,-16384,16384,16384,-16384,16384,-16384,16384,-16384,-16384,16384,-16384,-16384,16384,-16384,16384,-16384,-16384,16384,16384,16384,-16384,-16384,16384,-16384,-16384,16384,-16384,16384,-16384,-16384,16384,-16384,-16384,16384,16384,-16384,-16384,-16384,16384,-16384,-16384,16384,-16384,-16384,-16384,-16384,16384,-16384,-16384,16384,16384,16384,16384,16384,-16384,-16384,-16384,16384,-16384,16384,16384,16384,-16384,-16384,-16384,16384,16384,-16384,16384,16384,-16384,-16384,-16384,16384,-16384,-16384,16384,16384,-16384,-16384,-16384,16384,16384,16384,-16384,16384,-16384,-16384,-16384,16384,-16384,16384,-16384,16384,-16384,-16384,-16384,16384,16384,-16384,-16384,16384,-16384,-16384,-16384,16384,-16384,-16384,-16384,16384,-16384,-16384,-16384,16384,16384,16384,16384,-16384,-16384,-16384,-16384,16384,-16384,16384,16384,-16384,-16384,-16384,-16384,16384,16384,-16384,16384,-16384,-16384,-16384,-16384,16384,-16384,-16384,16384,-16384,-16384,-16384,-16384,16384,16384,16384,-16384,-16384,-16384,-16384,-16384,16384,-16384,16384,-16384,-16384,-16384,-16384,-16384,16384,16384,-16384,-16384,-16384,-16384,-16384,-16384,16384,-16384,-16384,-16384,-16384,-16384,-16384,-16384,16384,16384,16384,16384,16384,16384,16384,16384,-16384,-16384,16384,16384,16384,16384,16384,16384,-16384,16384,-16384,16384,16384,16384,16384,16384,-16384,-16384,-16384,16384,16384,16384,16384,16384,-16384,16384,16384,-16384,16384,16384,16384,16384,-16384,-16384,16384,-16384,16384,16384,16384,16384,-16384,16384,-16384,-16384,16384,16384,16384,16384,-16384,-16384,-16384,-16384,16384,16384,16384,16384,-16384,16384,16384,16384,-16384,16384,16384,16384,-16384,-16384,16384,16384,-16384,16384,16384,16384,-16384,16384,-16384,16384,-16384,16384,16384,16384,-16384,-16384,-16384,16384,-16384,16384,16384,16384,-16384,16384,16384,-16384,-16384,16384,16384,16384,-16384,-16384,16384,-16384,-16384,16384,16384,16384,-16384,16384,-16384,-16384,-16384,16384,16384,16384,-16384,-16384,-16384,-16384,-16384,16384,16384,16384,-16384,16384,16384,16384,16384,-16384,16384,16384,-16384,-16384,16384,16384,16384,-16384,16384,16384,-16384,16384,-16384,16384,16384,-16384,16384,16384,-16384,-16384,-16384,16384,16384,-16384,16384,16384,-16384,16384,16384,-16384,16384,-16384,16384,16384,-16384,-16384,16384,-16384,16384,-16384,16384,16384,-16384,16384,-16384,-16384,16384,-16384,16384,16384,-16384,-16384,-16384,-16384,16384,-16384,16384,16384,-16384,16384,16384,16384,-16384,-16384,16384,16384,-16384,-16384,16384,16384,-16384,-16384,16384,16384,-16384,16384,-16384,16384,-16384,-16384,16384,16384,-16384,-16384,-16384,16384,-16384,-16384,16384,16384,-16384,16384,16384,-16384,-16384,-16384,16384,16384,-16384,-16384,16384,-16384,-16384,-16384,16384,16384,-16384,16384,-16384,-16384,-16384,-16384,16384,16384,-16384,-16384,-16384,-16384,-16384,-16384,16384,16384,-16384,16384,16384,16384,16384,16384,-16384,16384,-16384,-16384,16384,16384,16384,16384,-16384,16384,-16384,16384,-16384,16384,16384,16384,-16384,16384,-16384,-16384,-16384,16384,16384,16384,-16384,16384,-16384,16384,16384,-16384,16384,16384,-16384,16384,-16384,-16384,16384,-16384,16384,16384,-16384,16384,-16384,16384,-16384,-16384,16384,16384,-16384,16384,-16384,-16384,-16384,-16384,16384,16384,-16384,16384,-16384,16384,16384,16384,-16384,16384,-16384,16384,-16384,-16384,16384,16384,-16384,16384,-16384,16384,-16384,16384,-16384,16384,-16384,16384,-16384,16384,-16384,-16384,-16384,16384,-16384,16384,-16384,16384,-16384,16384,16384,-16384,-16384,16384,-16384,16384,-16384,-16384,16384,-16384,-16384,16384,-16384,16384,-16384,16384,-16384,-16384,-16384,16384,-16384,16384,-16384,-16384,-16384,-16384,-16384,16384,-16384,16384,-16384,16384,16384,16384,16384,-16384,-16384,16384,-16384,-16384,16384,16384,16384,-16384,-16384,16384,-16384,16384,-16384,16384,16384,-16384,-16384,16384,-16384,-16384,-16384,16384,16384,-16384,-16384,16384,-16384,16384,16384,-16384,16384,-16384,-16384,16384,-16384,-16384,16384,-16384,16384,-16384,-16384,16384,-16384,16384,-16384,-16384,16384,-16384,-16384,16384,-16384,-16384,-16384,-16384,16384,-16384,-16384,16384,-16384,16384,16384,16384,-16384,-16384,-16384,16384,-16384,-16384,16384,16384,-16384,-16384,-16384,16384,-16384,16384,-16384,16384,-16384,-16384,-16384,16384,-16384,-16384,-16384,16384,-16384,-16384,-16384,16384,-16384,16384,16384,-16384,-16384,-16384,-16384,16384,-16384,-16384,16384,-16384,-16384,-16384,-16384,16384,-16384,16384,-16384,-16384,-16384,-16384,-16384,16384,-16384,-16384,-16384,-16384,-16384,-16384,-16384,16384,-16384,16384,16384,16384,16384,16384,16384,-16384,-16384,-16384,16384,16384,16384,16384,16384,-16384,-16384,16384,-16384,16384,16384,16384,16384,-16384,-16384,-16384,-16384,16384,16384,16384,16384,-16384,-16384,16384,16384,-16384,16384,16384,16384,-16384,-16384,-16384,16384,-16384,16384,16384,16384,-16384,-16384,16384,-16384,-16384,16384,16384,16384,-16384,-16384,-16384,-16384,-16384,16384,16384,16384,-16384,-16384,16384,16384,16384,-16384,16384,16384,-16384,-16384,-16384,16384,16384,-16384,16384,16384,-16384,-16384,16384,-16384,16384,-16384,16384,16384,-16384,-16384,-16384,-16384,16384,-16384,16384,16384,-16384,-16384,16384,16384,-16384,-16384,16384,16384,-16384,-16384,-16384,16384,-16384,-16384,16384,16384,-16384,-16384,16384,-16384,-16384,-16384,16384,16384,-16384,-16384,-16384,-16384,-16384,-16384,16384,16384,-16384,-16384,16384,16384,16384,16384,-16384,16384,-16384,-16384,-16384,16384,16384,16384,-16384,16384,-16384,-16384,16384,-16384,16384,16384,-16384,16384,-16384,-16384,-16384,-16384,16384,16384,-16384,16384,-16384,-16384,16384,16384,-16384,16384,-16384,16384,-16384,-16384,-16384,16384,-16384,16384,-16384,16384,-16384,-16384,16384,-16384,-16384,16384,-16384,16384,-16384,-16384,-16384,-16384,-16384,16384,-16384,16384,-16384,-16384,16384,16384,16384,-16384,-16384,16384,-16384,-16384,-16384,16384,16384,-16384,-16384,16384,-16384,-16384,16384,-16384,16384,-16384,-16384,16384,-16384,-16384,-16384,-16384,16384,-16384,-16384,16384,-16384,-16384,16384,16384,-16384,-16384,-16384,16384,-16384,-16384,-16384,16384,-16384,-16384,-16384,16384,-16384,-16384,16384,-16384,-16384,-16384,-16384,16384,-16384,-16384,-16384,-16384,-16384,-16384,-16384,16384,-16384,-16384,16384,16384,16384,16384,16384,-16384,-16384,-16384,-16384,16384,16384,16384,16384,-16384,-16384,-16384,16384,-16384,16384,16384,16384,-16384,-16384,-16384,-16384,-16384,16384,16384,16384,-16384,-16384,-16384,16384,16384,-16384,16384,16384,-16384,-16384,-16384,-16384,16384,-16384,16384,16384,-16384,-16384,-16384,16384,-16384,-16384,16384,16384,-16384,-16384,-16384,-16384,-16384,-16384,16384,16384,-16384,-16384,-16384,16384,16384,16384,-16384,16384,-16384,-16384,-16384,-16384,16384,16384,-16384,16384,-16384,-16384,-16384,16384,-16384,16384,-16384,16384,-16384,-16384,-16384,-16384,-16384,16384,-16384,16384,-16384,-16384,-16384,16384,16384,-16384,-16384,16384,-16384,-16384,-16384,-16384,16384,-16384,-16384,16384,-16384,-16384,-16384,16384,-16384,-16384,-16384,16384,-16384,-16384,-16384,-16384,-16384,-16384,-16384,16384,-16384,-16384,-16384,16384,16384,16384,16384,-16384,-16384,-16384,-16384,-16384,16384,16384,16384,-16384,-16384,-16384,-16384,16384,-16384,16384,16384,-16384,-16384,-16384,-16384,-16384,-16384,16384,16384,-16384,-16384,-16384,-16384,16384,16384,-16384,16384,-16384,-16384,-16384,-16384,-16384,16384,-16384,16384,-16384,-16384,-16384,-16384,16384,-16384,-16384,16384,-16384,-16384,-16384,-16384,-16384,-16384,-16384,16384,-16384,-16384,-16384,-16384,16384,16384,16384,-16384,-16384,-16384,-16384,-16384,-16384,16384,16384,-16384,-16384,-16384,-16384,-16384,16384,-16384,16384,-16384,-16384,-16384,-16384,-16384,-16384,-16384,16384,-16384,-16384,-16384,-16384,-16384,16384,16384,-16384,-16384,-16384,-16384,-16384,-16384,-16384,16384,-16384,-16384,-16384,-16384,-16384,-16384,16384,-16384,-16384,-16384,-16384,-16384,-16384,-16384,-16384,-16384,-16384,-16384,-16384,-16384,-16384,-16384}; +int64_t nr_16qam_byte_mod_table[1024]; -short nr_qam16_byte_mod_table[1024] = {7327,7327,7327,7327,-7327,7327,7327,7327,7327,-7327,7327,7327,-7327,-7327,7327,7327,21981,7327,7327,7327,-21981,7327,7327,7327,21981,-7327,7327,7327,-21981,-7327,7327,7327,7327,21981,7327,7327,-7327,21981,7327,7327,7327,-21981,7327,7327,-7327,-21981,7327,7327,21981,21981,7327,7327,-21981,21981,7327,7327,21981,-21981,7327,7327,-21981,-21981,7327,7327,7327,7327,-7327,7327,-7327,7327,-7327,7327,7327,-7327,-7327,7327,-7327,-7327,-7327,7327,21981,7327,-7327,7327,-21981,7327,-7327,7327,21981,-7327,-7327,7327,-21981,-7327,-7327,7327,7327,21981,-7327,7327,-7327,21981,-7327,7327,7327,-21981,-7327,7327,-7327,-21981,-7327,7327,21981,21981,-7327,7327,-21981,21981,-7327,7327,21981,-21981,-7327,7327,-21981,-21981,-7327,7327,7327,7327,7327,-7327,-7327,7327,7327,-7327,7327,-7327,7327,-7327,-7327,-7327,7327,-7327,21981,7327,7327,-7327,-21981,7327,7327,-7327,21981,-7327,7327,-7327,-21981,-7327,7327,-7327,7327,21981,7327,-7327,-7327,21981,7327,-7327,7327,-21981,7327,-7327,-7327,-21981,7327,-7327,21981,21981,7327,-7327,-21981,21981,7327,-7327,21981,-21981,7327,-7327,-21981,-21981,7327,-7327,7327,7327,-7327,-7327,-7327,7327,-7327,-7327,7327,-7327,-7327,-7327,-7327,-7327,-7327,-7327,21981,7327,-7327,-7327,-21981,7327,-7327,-7327,21981,-7327,-7327,-7327,-21981,-7327,-7327,-7327,7327,21981,-7327,-7327,-7327,21981,-7327,-7327,7327,-21981,-7327,-7327,-7327,-21981,-7327,-7327,21981,21981,-7327,-7327,-21981,21981,-7327,-7327,21981,-21981,-7327,-7327,-21981,-21981,-7327,-7327,7327,7327,21981,7327,-7327,7327,21981,7327,7327,-7327,21981,7327,-7327,-7327,21981,7327,21981,7327,21981,7327,-21981,7327,21981,7327,21981,-7327,21981,7327,-21981,-7327,21981,7327,7327,21981,21981,7327,-7327,21981,21981,7327,7327,-21981,21981,7327,-7327,-21981,21981,7327,21981,21981,21981,7327,-21981,21981,21981,7327,21981,-21981,21981,7327,-21981,-21981,21981,7327,7327,7327,-21981,7327,-7327,7327,-21981,7327,7327,-7327,-21981,7327,-7327,-7327,-21981,7327,21981,7327,-21981,7327,-21981,7327,-21981,7327,21981,-7327,-21981,7327,-21981,-7327,-21981,7327,7327,21981,-21981,7327,-7327,21981,-21981,7327,7327,-21981,-21981,7327,-7327,-21981,-21981,7327,21981,21981,-21981,7327,-21981,21981,-21981,7327,21981,-21981,-21981,7327,-21981,-21981,-21981,7327,7327,7327,21981,-7327,-7327,7327,21981,-7327,7327,-7327,21981,-7327,-7327,-7327,21981,-7327,21981,7327,21981,-7327,-21981,7327,21981,-7327,21981,-7327,21981,-7327,-21981,-7327,21981,-7327,7327,21981,21981,-7327,-7327,21981,21981,-7327,7327,-21981,21981,-7327,-7327,-21981,21981,-7327,21981,21981,21981,-7327,-21981,21981,21981,-7327,21981,-21981,21981,-7327,-21981,-21981,21981,-7327,7327,7327,-21981,-7327,-7327,7327,-21981,-7327,7327,-7327,-21981,-7327,-7327,-7327,-21981,-7327,21981,7327,-21981,-7327,-21981,7327,-21981,-7327,21981,-7327,-21981,-7327,-21981,-7327,-21981,-7327,7327,21981,-21981,-7327,-7327,21981,-21981,-7327,7327,-21981,-21981,-7327,-7327,-21981,-21981,-7327,21981,21981,-21981,-7327,-21981,21981,-21981,-7327,21981,-21981,-21981,-7327,-21981,-21981,-21981,-7327,7327,7327,7327,21981,-7327,7327,7327,21981,7327,-7327,7327,21981,-7327,-7327,7327,21981,21981,7327,7327,21981,-21981,7327,7327,21981,21981,-7327,7327,21981,-21981,-7327,7327,21981,7327,21981,7327,21981,-7327,21981,7327,21981,7327,-21981,7327,21981,-7327,-21981,7327,21981,21981,21981,7327,21981,-21981,21981,7327,21981,21981,-21981,7327,21981,-21981,-21981,7327,21981,7327,7327,-7327,21981,-7327,7327,-7327,21981,7327,-7327,-7327,21981,-7327,-7327,-7327,21981,21981,7327,-7327,21981,-21981,7327,-7327,21981,21981,-7327,-7327,21981,-21981,-7327,-7327,21981,7327,21981,-7327,21981,-7327,21981,-7327,21981,7327,-21981,-7327,21981,-7327,-21981,-7327,21981,21981,21981,-7327,21981,-21981,21981,-7327,21981,21981,-21981,-7327,21981,-21981,-21981,-7327,21981,7327,7327,7327,-21981,-7327,7327,7327,-21981,7327,-7327,7327,-21981,-7327,-7327,7327,-21981,21981,7327,7327,-21981,-21981,7327,7327,-21981,21981,-7327,7327,-21981,-21981,-7327,7327,-21981,7327,21981,7327,-21981,-7327,21981,7327,-21981,7327,-21981,7327,-21981,-7327,-21981,7327,-21981,21981,21981,7327,-21981,-21981,21981,7327,-21981,21981,-21981,7327,-21981,-21981,-21981,7327,-21981,7327,7327,-7327,-21981,-7327,7327,-7327,-21981,7327,-7327,-7327,-21981,-7327,-7327,-7327,-21981,21981,7327,-7327,-21981,-21981,7327,-7327,-21981,21981,-7327,-7327,-21981,-21981,-7327,-7327,-21981,7327,21981,-7327,-21981,-7327,21981,-7327,-21981,7327,-21981,-7327,-21981,-7327,-21981,-7327,-21981,21981,21981,-7327,-21981,-21981,21981,-7327,-21981,21981,-21981,-7327,-21981,-21981,-21981,-7327,-21981,7327,7327,21981,21981,-7327,7327,21981,21981,7327,-7327,21981,21981,-7327,-7327,21981,21981,21981,7327,21981,21981,-21981,7327,21981,21981,21981,-7327,21981,21981,-21981,-7327,21981,21981,7327,21981,21981,21981,-7327,21981,21981,21981,7327,-21981,21981,21981,-7327,-21981,21981,21981,21981,21981,21981,21981,-21981,21981,21981,21981,21981,-21981,21981,21981,-21981,-21981,21981,21981,7327,7327,-21981,21981,-7327,7327,-21981,21981,7327,-7327,-21981,21981,-7327,-7327,-21981,21981,21981,7327,-21981,21981,-21981,7327,-21981,21981,21981,-7327,-21981,21981,-21981,-7327,-21981,21981,7327,21981,-21981,21981,-7327,21981,-21981,21981,7327,-21981,-21981,21981,-7327,-21981,-21981,21981,21981,21981,-21981,21981,-21981,21981,-21981,21981,21981,-21981,-21981,21981,-21981,-21981,-21981,21981,7327,7327,21981,-21981,-7327,7327,21981,-21981,7327,-7327,21981,-21981,-7327,-7327,21981,-21981,21981,7327,21981,-21981,-21981,7327,21981,-21981,21981,-7327,21981,-21981,-21981,-7327,21981,-21981,7327,21981,21981,-21981,-7327,21981,21981,-21981,7327,-21981,21981,-21981,-7327,-21981,21981,-21981,21981,21981,21981,-21981,-21981,21981,21981,-21981,21981,-21981,21981,-21981,-21981,-21981,21981,-21981,7327,7327,-21981,-21981,-7327,7327,-21981,-21981,7327,-7327,-21981,-21981,-7327,-7327,-21981,-21981,21981,7327,-21981,-21981,-21981,7327,-21981,-21981,21981,-7327,-21981,-21981,-21981,-7327,-21981,-21981,7327,21981,-21981,-21981,-7327,21981,-21981,-21981,7327,-21981,-21981,-21981,-7327,-21981,-21981,-21981,21981,21981,-21981,-21981,-21981,21981,-21981,-21981,21981,-21981,-21981,-21981,-21981,-21981,-21981,-21981}; +int64_t nr_64qam_mod_table[4096]; #endif diff --git a/openair1/PHY/NR_REFSIG/nr_refsig.h b/openair1/PHY/NR_REFSIG/nr_refsig.h index 1bf2ef4fb2..786fb2af35 100644 --- a/openair1/PHY/NR_REFSIG/nr_refsig.h +++ b/openair1/PHY/NR_REFSIG/nr_refsig.h @@ -53,6 +53,8 @@ int nr_pusch_dmrs_rx(PHY_VARS_gNB *gNB, void init_scrambling_luts(void); +void nr_generate_modulation_table(void); + extern __m64 byte2m64_re[256]; extern __m64 byte2m64_im[256]; diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index 23466132d6..ac5a126276 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -150,7 +150,7 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t *dlsch, nb_re = ((12*rel15->NrOfSymbols)-nb_re_dmrs-xOverhead)*rel15->rbSize*rel15->NrOfCodewords; uint8_t Qm = rel15->qamModOrder[0]; uint32_t encoded_length = nb_re*Qm; - int16_t mod_dmrs[n_dmrs<<1]; + int16_t mod_dmrs[n_dmrs<<1] __attribute__ ((aligned(256))); /// CRC, coding, interleaving and rate matching AssertFatal(harq->pdu!=NULL,"harq->pdu is null\n"); diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 90aa3f6333..64ab482db8 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -926,22 +926,6 @@ int main(int argc, char **argv) printf("SNR %f : n_errors (negative CRC) = %d/%d, Avg round %.2f, Channel BER %e, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %d bits/slot\n", SNR, n_errors, n_trials,roundStats[snrRun],(double)errors_scrambling/available_bits/n_trials,effRate,effRate/TBS*100,TBS); printf("\n"); - if (n_trials == 1) { - - LOG_M("rxsig0.m","rxs0", UE->common_vars.rxdata[0], frame_length_complex_samples, 1, 1); - if (UE->frame_parms.nb_antennas_rx>1) - LOG_M("rxsig1.m","rxs1", UE->common_vars.rxdata[1], frame_length_complex_samples, 1, 1); - LOG_M("chestF0.m","chF0",UE->pdsch_vars[0][0]->dl_ch_estimates_ext,N_RB_DL*12*14,1,1); - write_output("rxF_comp.m","rxFc",&UE->pdsch_vars[0][0]->rxdataF_comp0[0][0],N_RB_DL*12*14,1,1); - break; - } - - //if ((float)n_errors/(float)n_trials <= target_error_rate) { - if (effRate >= (eff_tp_check*TBS)) { - printf("PDSCH test OK\n"); - break; - } - if (print_perf==1) { printf("\ngNB TX function statistics (per %d us slot, NPRB %d, mcs %d, TBS %d, Kr %d (Zc %d))\n", 1000>>*scc->ssbSubcarrierSpacing,dlsch_config.rbSize,dlsch_config.mcsIndex[0], @@ -992,6 +976,23 @@ int main(int argc, char **argv) printStatIndent2(&UE->dlsch_tc_intl2_stats,"intl2+HardDecode+CRC"); */ } + + if (n_trials == 1) { + + LOG_M("rxsig0.m","rxs0", UE->common_vars.rxdata[0], frame_length_complex_samples, 1, 1); + if (UE->frame_parms.nb_antennas_rx>1) + LOG_M("rxsig1.m","rxs1", UE->common_vars.rxdata[1], frame_length_complex_samples, 1, 1); + LOG_M("chestF0.m","chF0",UE->pdsch_vars[0][0]->dl_ch_estimates_ext,N_RB_DL*12*14,1,1); + write_output("rxF_comp.m","rxFc",&UE->pdsch_vars[0][0]->rxdataF_comp0[0][0],N_RB_DL*12*14,1,1); + break; + } + + //if ((float)n_errors/(float)n_trials <= target_error_rate) { + if (effRate >= (eff_tp_check*TBS)) { + printf("PDSCH test OK\n"); + break; + } + snrRun++; } // NSR From e2afb8662ed82aec23550640b67159099c8086fa Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Mon, 10 Aug 2020 15:21:59 +0200 Subject: [PATCH 08/19] new table generator --- openair1/PHY/NR_REFSIG/nr_gen_mod_table.c | 73 +++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 openair1/PHY/NR_REFSIG/nr_gen_mod_table.c diff --git a/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c b/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c new file mode 100644 index 0000000000..4adcfd02d9 --- /dev/null +++ b/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c @@ -0,0 +1,73 @@ +/* + * 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_refsig.h" +#include "nr_mod_table.h" +#include + +void nr_generate_modulation_table() { + float sqrt2 = 0.70711; + float sqrt10 = 0.31623; + float sqrt42 = 0.15430; + float sqrt170 = 0.076696; + float val = 32768.0; + uint32_t i,j; + short* table; + + //QPSK m128 + for (i=0; i<256; i++) { + for (j=0; j<4; j++) { + nr_qpsk_byte_mod_table[i*8+(j*2)] = (short)(1-2*((i>>(j*2))&1))*val*sqrt2*sqrt2; + nr_qpsk_byte_mod_table[i*8+(j*2)+1] = (short)(1-2*((i>>(j*2+1))&1))*val*sqrt2*sqrt2; + //printf("%d j%d\n",nr_qpsk_byte_mod_table[i*8+(j*2)],nr_qpsk_byte_mod_table[i*8+(j*2)+1]); + } + } + + //QPSK m256 + table = (short*) nr_qpsk_2byte_mod_table; + for (i=0; i<65536; i++) { + for (j=0; j<8; j++) { + table[i*16+(j*2)] = (short)(1-2*((i>>(j*2))&1))*val*sqrt2*sqrt2; + table[i*16+(j*2)+1] = (short)(1-2*((i>>(j*2+1))&1))*val*sqrt2*sqrt2; + //printf("%d j%d\n",nr_qpsk_byte_mod_table[i*8+(j*2)],nr_qpsk_byte_mod_table[i*8+(j*2)+1]); + } + } + + //16QAM + for (i=0; i<256; i++) { + for (j=0; j<2; j++) { + nr_16qam_byte_mod_table[i*4+(j*2)] = (short)((1-2*((i>>(j*4))&1))*(2-(1-2*((i>>(j*4+2))&1))))*val*sqrt10*sqrt2; + nr_16qam_byte_mod_table[i*4+(j*2)+1] = (short)((1-2*((i>>(j*4+1))&1))*(2-(1-2*((i>>(j*4+3))&1))))*val*sqrt10*sqrt2; + //printf("%d j%d\n",nr_16qam_byte_mod_table[i*4+(j*2)],nr_16qam_byte_mod_table[i*4+(j*2)+1]); + } + } + + //64QAM + table = (short*) nr_64qam_mod_table; + for (i=0; i<4096; i++) { + for (j=0; j<2; j++) { + table[i*4+(j*2)] = (short)((1-2*((i>>(j*6))&1))*(4-(1-2*((i>>(j*6+2))&1))*(2-(1-2*((i>>(j*6+4))&1)))))*val*sqrt42*sqrt2; + table[i*4+(j*2)+1] = (short)((1-2*((i>>(j*6+1))&1))*(4-(1-2*((i>>(j*6+3))&1))*(2-(1-2*((i>>(j*6+5))&1)))))*val*sqrt42*sqrt2; + //printf("%d j%d\n",table[i*4+(j*2)],table[i*4+(j*2)+1]); + } + } +} + From 5e7ce26c10843427f8a78690fb81ced3d3677965 Mon Sep 17 00:00:00 2001 From: Sakthi Date: Mon, 10 Aug 2020 19:14:14 +0200 Subject: [PATCH 09/19] more additions --- openair1/PHY/MODULATION/nr_modulation.c | 4 +--- openair1/PHY/NR_REFSIG/nr_gen_mod_table.c | 29 ++++++++++++++++------- openair1/PHY/NR_REFSIG/nr_mod_table.h | 5 +++- openair1/PHY/NR_TRANSPORT/nr_pbch.c | 10 ++++---- 4 files changed, 31 insertions(+), 17 deletions(-) diff --git a/openair1/PHY/MODULATION/nr_modulation.c b/openair1/PHY/MODULATION/nr_modulation.c index dc3934ffca..8905dcca38 100644 --- a/openair1/PHY/MODULATION/nr_modulation.c +++ b/openair1/PHY/MODULATION/nr_modulation.c @@ -22,8 +22,6 @@ #include "nr_modulation.h" #include "PHY/NR_REFSIG/nr_mod_table.h" -extern short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT]; - void nr_modulation(uint32_t *in, uint32_t length, uint16_t mod_order, @@ -114,7 +112,7 @@ void nr_modulation(uint32_t *in, return; case 8: - nr_mod_table32 = (int32_t*) nr_mod_table; + nr_mod_table32 = (int32_t*) nr_256qam_mod_table; for (i=0; i>(j*2))&1))*val*sqrt2*sqrt2; - nr_qpsk_byte_mod_table[i*8+(j*2)+1] = (short)(1-2*((i>>(j*2+1))&1))*val*sqrt2*sqrt2; - //printf("%d j%d\n",nr_qpsk_byte_mod_table[i*8+(j*2)],nr_qpsk_byte_mod_table[i*8+(j*2)+1]); - } - } +short nr_qpsk_mod_table[8] = {16384,16384,-16384,16384,16384,-16384,-16384,-16384}; +#if defined(__AVX2__) //QPSK m256 table = (short*) nr_qpsk_2byte_mod_table; for (i=0; i<65536; i++) { @@ -50,6 +44,18 @@ void nr_generate_modulation_table() { //printf("%d j%d\n",nr_qpsk_byte_mod_table[i*8+(j*2)],nr_qpsk_byte_mod_table[i*8+(j*2)+1]); } } +#elif defined(__SSE2__) + + //QPSK m128 + table = (short*) nr_qpsk_byte_mod_table; + for (i=0; i<256; i++) { + for (j=0; j<4; j++) { + table[i*8+(j*2)] = (short)(1-2*((i>>(j*2))&1))*val*sqrt2*sqrt2; + table[i*8+(j*2)+1] = (short)(1-2*((i>>(j*2+1))&1))*val*sqrt2*sqrt2; + //printf("%d j%d\n",nr_qpsk_byte_mod_table[i*8+(j*2)],nr_qpsk_byte_mod_table[i*8+(j*2)+1]); + } + } +#endif //16QAM for (i=0; i<256; i++) { @@ -69,5 +75,12 @@ void nr_generate_modulation_table() { //printf("%d j%d\n",table[i*4+(j*2)],table[i*4+(j*2)+1]); } } + + //256QAM + table = (short*) nr_256qam_mod_table; + for (i=0; i<256; i++) { + table[i*2] = (short)((1-2*(i&1))*(8-(1-2*((i>>2)&1))*(4-(1-2*((i>>4)&1))*(2-(1-2*((i>>6)&1))))))*val*sqrt170*sqrt2; + table[i*2+1] = (short)((1-2*((i>>1)&1))*(8-(1-2*((i>>3)&1))*(4-(1-2*((i>>5)&1))*(2-(1-2*((i>>7)&1))))))*val*sqrt170*sqrt2; + } } diff --git a/openair1/PHY/NR_REFSIG/nr_mod_table.h b/openair1/PHY/NR_REFSIG/nr_mod_table.h index d42f211e8e..4722ad7b7a 100644 --- a/openair1/PHY/NR_REFSIG/nr_mod_table.h +++ b/openair1/PHY/NR_REFSIG/nr_mod_table.h @@ -28,7 +28,8 @@ #define NR_MOD_TABLE_QAM16_OFFSET 7 #define NR_MOD_TABLE_QAM64_OFFSET 23 #define NR_MOD_TABLE_QAM256_OFFSET 87 -short nr_qpsk_mod_table[8] = {16384,16384,-16384,16384,16384,-16384,-16384,-16384}; + +short nr_qpsk_mod_table[8]; #if defined(__AVX2__) __m256i nr_qpsk_2byte_mod_table[65536]; @@ -39,4 +40,6 @@ __m128i nr_qpsk_byte_mod_table[2048]; int64_t nr_16qam_byte_mod_table[1024]; int64_t nr_64qam_mod_table[4096]; + +int32_t nr_256qam_mod_table[512]; #endif diff --git a/openair1/PHY/NR_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_TRANSPORT/nr_pbch.c index bc33d93811..13dd65d90e 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_pbch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_pbch.c @@ -40,7 +40,7 @@ //#define DEBUG_PBCH_ENCODING //#define DEBUG_PBCH_DMRS -extern short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT]; +extern short nr_qpsk_mod_table[8]; uint8_t nr_pbch_payload_interleaving_pattern[32] = {16, 23, 18, 17, 8, 30, 10, 6, 24, 7, 0, 5, 3, 2, 1, 4, 9, 11, 12, 13, 14, 15, 19, 20, 21, 22, 25, 26, 27, 28, 29, 31 @@ -62,8 +62,8 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs, /// QPSK modulation for (int m=0; m>5])>>((m<<1)&0x1f))&1)<<1) ^ (((gold_pbch_dmrs[((m<<1)+1)>>5])>>(((m<<1)+1)&0x1f))&1); - mod_dmrs[m<<1] = nr_mod_table[(NR_MOD_TABLE_QPSK_OFFSET + idx)<<1]; - mod_dmrs[(m<<1)+1] = nr_mod_table[((NR_MOD_TABLE_QPSK_OFFSET + idx)<<1) + 1]; + mod_dmrs[m<<1] = nr_qpsk_mod_table[idx<<1]; + mod_dmrs[(m<<1)+1] = nr_qpsk_mod_table[(idx<<1) + 1]; #ifdef DEBUG_PBCH_DMRS printf("m %d idx %d gold seq %d b0-b1 %d-%d mod_dmrs %d %d\n", m, idx, gold_pbch_dmrs[(m<<1)>>5], (((gold_pbch_dmrs[(m<<1)>>5])>>((m<<1)&0x1f))&1), (((gold_pbch_dmrs[((m<<1)+1)>>5])>>(((m<<1)+1)&0x1f))&1), mod_dmrs[(m<<1)], mod_dmrs[(m<<1)+1]); @@ -324,8 +324,8 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch, /// QPSK modulation for (int i=0; i>1; i++) { idx = (((pbch->pbch_e[(i<<1)>>5]>>((i<<1)&0x1f))&1)<<1) ^ ((pbch->pbch_e[((i<<1)+1)>>5]>>(((i<<1)+1)&0x1f))&1); - mod_pbch_e[i<<1] = nr_mod_table[(NR_MOD_TABLE_QPSK_OFFSET + idx)<<1]; - mod_pbch_e[(i<<1)+1] = nr_mod_table[((NR_MOD_TABLE_QPSK_OFFSET + idx)<<1)+1]; + mod_pbch_e[i<<1] = nr_qpsk_mod_table[idx<<1]; + mod_pbch_e[(i<<1)+1] = nr_qpsk_mod_table[(idx<<1)+1]; #ifdef DEBUG_PBCH printf("i %d idx %d mod_pbch %d %d\n", i, idx, mod_pbch_e[2*i], mod_pbch_e[2*i+1]); #endif From 76f7840961e3d8ccfa521e14f03120a40b4d9882 Mon Sep 17 00:00:00 2001 From: Sakthi Date: Mon, 10 Aug 2020 19:22:53 +0200 Subject: [PATCH 10/19] bug fixes --- openair1/PHY/MODULATION/nr_modulation.c | 2 +- openair1/PHY/NR_REFSIG/nr_gen_mod_table.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/openair1/PHY/MODULATION/nr_modulation.c b/openair1/PHY/MODULATION/nr_modulation.c index 8905dcca38..c1cabfb8d8 100644 --- a/openair1/PHY/MODULATION/nr_modulation.c +++ b/openair1/PHY/MODULATION/nr_modulation.c @@ -51,7 +51,7 @@ void nr_modulation(uint32_t *in, 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; - LOG_I(PHY,"nr_modulation: length %d, mod_order %d\n",length,mod_order); + LOG_D(PHY,"nr_modulation: length %d, mod_order %d\n",length,mod_order); switch (mod_order) { diff --git a/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c b/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c index 0f8111b6b0..f7ec99e8e8 100644 --- a/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c +++ b/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c @@ -58,10 +58,11 @@ short nr_qpsk_mod_table[8] = {16384,16384,-16384,16384,16384,-16384,-16384,-1638 #endif //16QAM + table = (short*) nr_16qam_byte_mod_table; for (i=0; i<256; i++) { for (j=0; j<2; j++) { - nr_16qam_byte_mod_table[i*4+(j*2)] = (short)((1-2*((i>>(j*4))&1))*(2-(1-2*((i>>(j*4+2))&1))))*val*sqrt10*sqrt2; - nr_16qam_byte_mod_table[i*4+(j*2)+1] = (short)((1-2*((i>>(j*4+1))&1))*(2-(1-2*((i>>(j*4+3))&1))))*val*sqrt10*sqrt2; + table[i*4+(j*2)] = (short)((1-2*((i>>(j*4))&1))*(2-(1-2*((i>>(j*4+2))&1))))*val*sqrt10*sqrt2; + table[i*4+(j*2)+1] = (short)((1-2*((i>>(j*4+1))&1))*(2-(1-2*((i>>(j*4+3))&1))))*val*sqrt10*sqrt2; //printf("%d j%d\n",nr_16qam_byte_mod_table[i*4+(j*2)],nr_16qam_byte_mod_table[i*4+(j*2)+1]); } } From 8aa88999fc709e5f85a92dd7f5d673eedf80f6e3 Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Fri, 14 Aug 2020 11:43:54 +0200 Subject: [PATCH 11/19] fixes --- openair1/PHY/MODULATION/nr_modulation.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/openair1/PHY/MODULATION/nr_modulation.c b/openair1/PHY/MODULATION/nr_modulation.c index c1cabfb8d8..3ce067fe14 100644 --- a/openair1/PHY/MODULATION/nr_modulation.c +++ b/openair1/PHY/MODULATION/nr_modulation.c @@ -27,7 +27,6 @@ void nr_modulation(uint32_t *in, uint16_t mod_order, int16_t *out) { - uint16_t offset; uint16_t mask = ((1<>((i*mod_order)&0x1f)) & mask); - out32[i] = nr_mod_table32[(offset+idx)]; + out32[i] = nr_mod_table32[idx]; } } From 9c01cc66ead61cdefd53009fc3ebad5319a99000 Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Fri, 14 Aug 2020 16:31:37 +0200 Subject: [PATCH 12/19] diabling avx2 for qpsk --- openair1/PHY/MODULATION/nr_modulation.c | 6 ++++-- openair1/PHY/NR_REFSIG/nr_gen_mod_table.c | 2 +- openair1/PHY/NR_REFSIG/nr_mod_table.h | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/openair1/PHY/MODULATION/nr_modulation.c b/openair1/PHY/MODULATION/nr_modulation.c index 3ce067fe14..cba5e4ba53 100644 --- a/openair1/PHY/MODULATION/nr_modulation.c +++ b/openair1/PHY/MODULATION/nr_modulation.c @@ -38,7 +38,7 @@ void nr_modulation(uint32_t *in, uint32_t bit_cnt; uint64_t x,x1,x2; -#if defined(__AVX2__) +#if 0//defined(__AVX2__) uint16_t *in_2bytes = (uint16_t*) in; __m256i *nr_mod_table256; __m256i *out256; @@ -113,7 +113,9 @@ void nr_modulation(uint32_t *in, out32[i] = nr_mod_table32[in_bytes[i]]; return; -#if defined(__AVX2__) +#if 0//defined(__AVX2__) +// disabling this as it is slower than SSE2 +// (maybe because L1 cache could not hold the large table) case 2: nr_mod_table256 = (__m256i*) nr_qpsk_2byte_mod_table; out256 = (__m256i*) out; diff --git a/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c b/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c index f7ec99e8e8..286df21203 100644 --- a/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c +++ b/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c @@ -34,7 +34,7 @@ void nr_generate_modulation_table() { short nr_qpsk_mod_table[8] = {16384,16384,-16384,16384,16384,-16384,-16384,-16384}; -#if defined(__AVX2__) +#if 0//defined(__AVX2__) //QPSK m256 table = (short*) nr_qpsk_2byte_mod_table; for (i=0; i<65536; i++) { diff --git a/openair1/PHY/NR_REFSIG/nr_mod_table.h b/openair1/PHY/NR_REFSIG/nr_mod_table.h index 4722ad7b7a..659d63c8d0 100644 --- a/openair1/PHY/NR_REFSIG/nr_mod_table.h +++ b/openair1/PHY/NR_REFSIG/nr_mod_table.h @@ -31,7 +31,7 @@ short nr_qpsk_mod_table[8]; -#if defined(__AVX2__) +#if 0//defined(__AVX2__) __m256i nr_qpsk_2byte_mod_table[65536]; #elif defined(__SSE2__) __m128i nr_qpsk_byte_mod_table[2048]; From 12feffcc1c9a6f7c4e1944ff1a1f54a350aebaee Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Fri, 14 Aug 2020 17:29:51 +0200 Subject: [PATCH 13/19] bugfix --- openair1/PHY/NR_REFSIG/nr_gen_mod_table.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c b/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c index 286df21203..350b16d391 100644 --- a/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c +++ b/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c @@ -32,7 +32,14 @@ void nr_generate_modulation_table() { uint32_t i,j; short* table; -short nr_qpsk_mod_table[8] = {16384,16384,-16384,16384,16384,-16384,-16384,-16384}; +nr_qpsk_mod_table[0] = 16384; +nr_qpsk_mod_table[1] = 16384; +nr_qpsk_mod_table[2] = -16384; +nr_qpsk_mod_table[3] = 16384; +nr_qpsk_mod_table[4] = 16384; +nr_qpsk_mod_table[5] = -16384; +nr_qpsk_mod_table[6] = -16384; +nr_qpsk_mod_table[7] = -16384; #if 0//defined(__AVX2__) //QPSK m256 From 92595bb2af08e4ba1cce5d48204e12a42a294bb4 Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Fri, 14 Aug 2020 18:03:04 +0200 Subject: [PATCH 14/19] further fixes --- openair1/PHY/NR_TRANSPORT/nr_pbch.c | 4 ++-- openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_TRANSPORT/nr_pbch.c index 13dd65d90e..bd1278b2eb 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_pbch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_pbch.c @@ -61,7 +61,7 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs, /// QPSK modulation for (int m=0; m>5])>>((m<<1)&0x1f))&1)<<1) ^ (((gold_pbch_dmrs[((m<<1)+1)>>5])>>(((m<<1)+1)&0x1f))&1); + idx = (((gold_pbch_dmrs[(m<<1)>>5])>>((m<<1)&0x1f))&3); mod_dmrs[m<<1] = nr_qpsk_mod_table[idx<<1]; mod_dmrs[(m<<1)+1] = nr_qpsk_mod_table[(idx<<1) + 1]; #ifdef DEBUG_PBCH_DMRS @@ -323,7 +323,7 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch, /// QPSK modulation for (int i=0; i>1; i++) { - idx = (((pbch->pbch_e[(i<<1)>>5]>>((i<<1)&0x1f))&1)<<1) ^ ((pbch->pbch_e[((i<<1)+1)>>5]>>(((i<<1)+1)&0x1f))&1); + idx = ((pbch->pbch_e[(i<<1)>>5]>>((i<<1)&0x1f))&3); mod_pbch_e[i<<1] = nr_qpsk_mod_table[idx<<1]; mod_pbch_e[(i<<1)+1] = nr_qpsk_mod_table[(idx<<1)+1]; #ifdef DEBUG_PBCH diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h index 6b2d5e7255..918ff5210a 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h @@ -177,7 +177,7 @@ typedef struct { /// Scrambled "b"-sequences (for definition see 36-211 V8.6 2009-03, p.14) uint8_t b_tilde[MAX_NUM_NR_CHANNEL_BITS]; /// Modulated "d"-sequences (for definition see 36-211 V8.6 2009-03, p.14) - uint32_t d_mod[MAX_NUM_NR_RE]; + uint32_t d_mod[MAX_NUM_NR_RE] __attribute__ ((aligned(16))); /// Transform-coded "y"-sequences (for definition see 38-211 V15.3.0 2018-09, subsection 6.3.1.4) uint32_t y[MAX_NUM_NR_RE] __attribute__ ((aligned(16))); /* From dc2d948badb5a6519af0eb6cf47a684c1ea52a79 Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Mon, 17 Aug 2020 13:55:13 +0200 Subject: [PATCH 15/19] memory bugfix and other minor fixes --- openair1/PHY/MODULATION/nr_modulation.c | 80 +++++++++++------------ openair1/PHY/NR_REFSIG/nr_gen_mod_table.c | 33 ++++------ openair1/PHY/NR_REFSIG/nr_mod_table.h | 5 +- 3 files changed, 54 insertions(+), 64 deletions(-) diff --git a/openair1/PHY/MODULATION/nr_modulation.c b/openair1/PHY/MODULATION/nr_modulation.c index cba5e4ba53..9ad12c1a96 100644 --- a/openair1/PHY/MODULATION/nr_modulation.c +++ b/openair1/PHY/MODULATION/nr_modulation.c @@ -38,11 +38,7 @@ void nr_modulation(uint32_t *in, uint32_t bit_cnt; uint64_t x,x1,x2; -#if 0//defined(__AVX2__) - uint16_t *in_2bytes = (uint16_t*) in; - __m256i *nr_mod_table256; - __m256i *out256; -#elif defined(__SSE2__) +#if defined(__SSE2__) __m128i *nr_mod_table128; __m128i *out128; #endif @@ -51,6 +47,44 @@ void nr_modulation(uint32_t *in, switch (mod_order) { +#if defined(__SSE2__) + case 2: + nr_mod_table128 = (__m128i*) nr_qpsk_byte_mod_table; + out128 = (__m128i*) out; + for (i=0; i>((i*2)&0x7)) & mask); + out32[i] = nr_mod_table32[idx]; + i++; + } + return; +#else + case 2: + nr_mod_table32 = (int32_t*) nr_qpsk_mod_table; + for (i=0; i>((i*2)&0x1f)) & mask); + out32[i] = nr_mod_table32[idx]; + } + return; +#endif + + case 4: + out64 = (int64_t*) out; + for (i=0; i>((i*4)&0x7)) & mask); + out32[i] = nr_16qam_mod_table[idx]; + i++; + } + return; + case 6: j = 0; for (i=0; i>((i*mod_order)&0x1f)) & mask); - - out32[i] = nr_mod_table32[idx]; - } } void nr_layer_mapping(int16_t **mod_symbs, diff --git a/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c b/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c index 350b16d391..b0f9e6d03c 100644 --- a/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c +++ b/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c @@ -21,7 +21,6 @@ #include "nr_refsig.h" #include "nr_mod_table.h" -#include void nr_generate_modulation_table() { float sqrt2 = 0.70711; @@ -32,27 +31,14 @@ void nr_generate_modulation_table() { uint32_t i,j; short* table; -nr_qpsk_mod_table[0] = 16384; -nr_qpsk_mod_table[1] = 16384; -nr_qpsk_mod_table[2] = -16384; -nr_qpsk_mod_table[3] = 16384; -nr_qpsk_mod_table[4] = 16384; -nr_qpsk_mod_table[5] = -16384; -nr_qpsk_mod_table[6] = -16384; -nr_qpsk_mod_table[7] = -16384; - -#if 0//defined(__AVX2__) - //QPSK m256 - table = (short*) nr_qpsk_2byte_mod_table; - for (i=0; i<65536; i++) { - for (j=0; j<8; j++) { - table[i*16+(j*2)] = (short)(1-2*((i>>(j*2))&1))*val*sqrt2*sqrt2; - table[i*16+(j*2)+1] = (short)(1-2*((i>>(j*2+1))&1))*val*sqrt2*sqrt2; - //printf("%d j%d\n",nr_qpsk_byte_mod_table[i*8+(j*2)],nr_qpsk_byte_mod_table[i*8+(j*2)+1]); - } + // QPSK + for (i=0; i<4; i++) { + nr_qpsk_mod_table[i*2] = (short)(1-2*(i&1))*val*sqrt2*sqrt2; + nr_qpsk_mod_table[i*2+1] = (short)(1-2*((i>>1)&1))*val*sqrt2*sqrt2; + //printf("%d j%d\n",nr_qpsk_mod_table[i*2],nr_qpsk_mod_table[i*2+1]); } -#elif defined(__SSE2__) +#if defined(__SSE2__) //QPSK m128 table = (short*) nr_qpsk_byte_mod_table; for (i=0; i<256; i++) { @@ -74,6 +60,13 @@ nr_qpsk_mod_table[7] = -16384; } } + table = (short*) nr_16qam_mod_table; + for (i=0; i<16; i++) { + table[i*2] = (short)((1-2*(i&1))*(2-(1-2*((i>>2)&1))))*val*sqrt10*sqrt2; + table[i*2+1] = (short)((1-2*((i>>1)&1))*(2-(1-2*((i>>3)&1))))*val*sqrt10*sqrt2; + //printf("%d j%d\n",table[i*2],table[i*2+1]); + } + //64QAM table = (short*) nr_64qam_mod_table; for (i=0; i<4096; i++) { diff --git a/openair1/PHY/NR_REFSIG/nr_mod_table.h b/openair1/PHY/NR_REFSIG/nr_mod_table.h index 659d63c8d0..aa8b99f584 100644 --- a/openair1/PHY/NR_REFSIG/nr_mod_table.h +++ b/openair1/PHY/NR_REFSIG/nr_mod_table.h @@ -31,9 +31,8 @@ short nr_qpsk_mod_table[8]; -#if 0//defined(__AVX2__) -__m256i nr_qpsk_2byte_mod_table[65536]; -#elif defined(__SSE2__) +int32_t nr_16qam_mod_table[16]; +#if defined(__SSE2__) __m128i nr_qpsk_byte_mod_table[2048]; #endif From 923070e6c16fc952262c52bbec315773b60979cb Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Tue, 18 Aug 2020 15:16:23 +0200 Subject: [PATCH 16/19] mem alignment for dmrs symbs --- openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index 93acda23f8..bc09ad872d 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -268,7 +268,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, /////////// pusch_dmrs = UE->nr_gold_pusch_dmrs[slot]; n_dmrs = (nb_rb*((dmrs_type == pusch_dmrs_type1) ? 6:4)*number_dmrs_symbols); - int16_t mod_dmrs[n_dmrs<<1]; + int16_t mod_dmrs[n_dmrs<<1] __attribute((aligned(16))); /////////// //////////////////////////////////////////////////////////////////////// From e4755f9c31efd1f30224f721831db973bae5bf14 Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Wed, 19 Aug 2020 10:27:59 +0200 Subject: [PATCH 17/19] init mod tables fo ue --- cmake_targets/CMakeLists.txt | 1 + openair1/PHY/INIT/nr_init_ue.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index ae1a53d5d4..b68db7ddb0 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -1600,6 +1600,7 @@ set(PHY_SRC_UE ${OPENAIR1_DIR}/PHY/NR_REFSIG/dmrs_nr.c ${OPENAIR1_DIR}/PHY/NR_REFSIG/ptrs_nr.c ${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_gold_ue.c + ${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_gen_mod_table.c ${OPENAIR1_DIR}/PHY/NR_UE_ESTIMATION/filt16a_32.c ${OPENAIR1_DIR}/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c ${OPENAIR1_DIR}/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index 1729ac0d9e..fed58dea12 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -39,6 +39,7 @@ #include "PHY/NR_REFSIG/pss_nr.h" #include "PHY/NR_REFSIG/ul_ref_seq_nr.h" #include "PHY/NR_REFSIG/refsig_defs_ue.h" +#include "PHY/NR_REFSIG/nr_refsig.h" //uint8_t dmrs1_tab_ue[8] = {0,2,3,4,6,8,9,10}; @@ -681,6 +682,8 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, ue->bitrate[eNB_id] = 0; ue->total_received_bits[eNB_id] = 0; } + // init NR modulation lookup tables + nr_generate_modulation_table(); /////////////////////////PUSCH init///////////////////////// /////////// From 8a10323d2a8f49a08babccce19cea43717d12abe Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Wed, 19 Aug 2020 15:52:16 +0200 Subject: [PATCH 18/19] more mem alignment for dmrs --- openair1/PHY/NR_TRANSPORT/nr_dci.c | 4 ++-- openair1/PHY/NR_TRANSPORT/nr_dlsch.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c index 3344682f20..3a44ebc49a 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c @@ -161,7 +161,7 @@ uint8_t nr_generate_dci_top(nfapi_nr_dl_tti_pdcch_pdu *pdcch_pdu, int16_t amp, NR_DL_FRAME_PARMS frame_parms) { - int16_t mod_dmrs[NR_MAX_CSET_DURATION][NR_MAX_PDCCH_DMRS_LENGTH>>1] __attribute__((aligned(128))); // 3 for the max coreset duration + int16_t mod_dmrs[NR_MAX_CSET_DURATION][NR_MAX_PDCCH_DMRS_LENGTH>>1] __attribute__((aligned(16))); // 3 for the max coreset duration uint16_t cset_start_sc; uint8_t cset_start_symb, cset_nsymb; int k,l,k_prime,dci_idx, dmrs_idx; @@ -260,7 +260,7 @@ uint8_t nr_generate_dci_top(nfapi_nr_dl_tti_pdcch_pdu *pdcch_pdu, scrambled_output[6], scrambled_output[7], scrambled_output[8], scrambled_output[9], scrambled_output[10],scrambled_output[11] ); #endif /// QPSK modulation - int16_t mod_dci[NR_MAX_DCI_SIZE>>1] __attribute__((aligned(128))); + int16_t mod_dci[NR_MAX_DCI_SIZE>>1] __attribute__((aligned(16))); nr_modulation(scrambled_output, encoded_length, DMRS_MOD_ORDER, mod_dci); //Qm = 2 as DMRS is QPSK modulated #ifdef DEBUG_DCI diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index ac5a126276..2849986833 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -150,7 +150,7 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t *dlsch, nb_re = ((12*rel15->NrOfSymbols)-nb_re_dmrs-xOverhead)*rel15->rbSize*rel15->NrOfCodewords; uint8_t Qm = rel15->qamModOrder[0]; uint32_t encoded_length = nb_re*Qm; - int16_t mod_dmrs[n_dmrs<<1] __attribute__ ((aligned(256))); + int16_t mod_dmrs[n_dmrs<<1] __attribute__ ((aligned(16))); /// CRC, coding, interleaving and rate matching AssertFatal(harq->pdu!=NULL,"harq->pdu is null\n"); From 579f9f969ba08998a64ec5650dbc4f563b8fd57f Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Thu, 20 Aug 2020 16:59:02 +0200 Subject: [PATCH 19/19] included check for mod_order --- openair1/PHY/MODULATION/nr_modulation.c | 1 + 1 file changed, 1 insertion(+) diff --git a/openair1/PHY/MODULATION/nr_modulation.c b/openair1/PHY/MODULATION/nr_modulation.c index 9ad12c1a96..764b02065f 100644 --- a/openair1/PHY/MODULATION/nr_modulation.c +++ b/openair1/PHY/MODULATION/nr_modulation.c @@ -150,6 +150,7 @@ void nr_modulation(uint32_t *in, default: break; } + AssertFatal(false,"Invalid or unsupported modulation order %d\n",mod_order); }