Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG UE
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lizhongxiao
OpenXG UE
Commits
a0bcd41b
Commit
a0bcd41b
authored
Apr 14, 2019
by
yilmazt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added clean_gNB_ulsch, fully working polartest, and many other minor warning removals.
parent
f8eff2f9
Changes
26
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
419 additions
and
1106 deletions
+419
-1106
cmake_targets/CMakeLists.txt
cmake_targets/CMakeLists.txt
+3
-1
cmake_targets/autotests/test_case_list.xml
cmake_targets/autotests/test_case_list.xml
+8
-9
cmake_targets/build_oai
cmake_targets/build_oai
+0
-2
openair1/PHY/CODING/TESTBENCH/polartest.c
openair1/PHY/CODING/TESTBENCH/polartest.c
+180
-303
openair1/PHY/CODING/TESTBENCH/smallblocktest.c
openair1/PHY/CODING/TESTBENCH/smallblocktest.c
+1
-5
openair1/PHY/CODING/crc_byte.c
openair1/PHY/CODING/crc_byte.c
+1
-32
openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/time_meas.c
openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/time_meas.c
+0
-117
openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/time_meas.h
openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/time_meas.h
+0
-156
openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_types.h
openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_types.h
+1
-1
openair1/PHY/CODING/nrPolar_tools/nr_bitwise_operations.c
openair1/PHY/CODING/nrPolar_tools/nr_bitwise_operations.c
+13
-14
openair1/PHY/CODING/nrPolar_tools/nr_crc_byte.c
openair1/PHY/CODING/nrPolar_tools/nr_crc_byte.c
+21
-35
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
+8
-285
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
+20
-36
openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
+26
-77
openair1/PHY/CODING/nrSmallBlock/decodeSmallBlock.c
openair1/PHY/CODING/nrSmallBlock/decodeSmallBlock.c
+1
-1
openair1/PHY/CODING/nr_polar_init.c
openair1/PHY/CODING/nr_polar_init.c
+9
-10
openair1/PHY/NR_TRANSPORT/nr_dci.h
openair1/PHY/NR_TRANSPORT/nr_dci.h
+0
-2
openair1/PHY/NR_TRANSPORT/nr_dlsch.h
openair1/PHY/NR_TRANSPORT/nr_dlsch.h
+2
-0
openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c
openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c
+99
-1
openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c
openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c
+2
-2
openair1/SCHED_NR/fapi_nr_l1.h
openair1/SCHED_NR/fapi_nr_l1.h
+3
-1
openair1/SIMULATION/NR_PHY/dlschsim.c
openair1/SIMULATION/NR_PHY/dlschsim.c
+1
-1
openair1/SIMULATION/NR_PHY/dlsim.c
openair1/SIMULATION/NR_PHY/dlsim.c
+5
-2
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c
+8
-8
openair2/LAYER2/NR_MAC_gNB/mac_proto.h
openair2/LAYER2/NR_MAC_gNB/mac_proto.h
+7
-1
openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h
openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h
+0
-4
No files found.
cmake_targets/CMakeLists.txt
View file @
a0bcd41b
...
...
@@ -2511,7 +2511,9 @@ add_executable(polartest
target_link_libraries
(
polartest SIMU PHY PHY_NR PHY_COMMON m
${
ATLAS_LIBRARIES
}
)
add_executable
(
smallblocktest
${
OPENAIR1_DIR
}
/PHY/CODING/TESTBENCH/smallblocktest.c
)
add_executable
(
smallblocktest
${
OPENAIR1_DIR
}
/PHY/CODING/TESTBENCH/smallblocktest.c
${
OPENAIR_DIR
}
/common/utils/backtrace.c
)
target_link_libraries
(
smallblocktest SIMU PHY PHY_NR PHY_COMMON m
${
ATLAS_LIBRARIES
}
)
add_executable
(
ldpctest
...
...
cmake_targets/autotests/test_case_list.xml
View file @
a0bcd41b
...
...
@@ -1120,16 +1120,15 @@
<testCase
id=
"015107"
>
<class>
execution
</class>
<desc>
shortblocktest Test cases. (Test1: 3 bits),
(Test2: 6 bits)
(Test3: 7 bits)
(Test4: 11 bits)
</desc>
(Test2: 6 bits),
(Test3: 7 bits),
(Test4: 11 bits)
</desc>
<main_exec>
$OPENAIR_DIR/targets/bin/smallblocktest.Rel15
</main_exec>
<main_exec_args>
-l 3
-l 6
-l 7
-l 11
</main_exec_args>
<tags>
smallblocktest.test1 smallblocktest.test2 smallblocktest.test3 smallblocktest.test
3
</tags>
<main_exec_args>
-l 3
-s -4 -d 1 -i 10000
-l 6
-s -4 -d 1 -i 10000
-l 7
-s -4 -d 1 -i 10000
-l 11
-s -4 -d 1 -i 10000
</main_exec_args>
<tags>
smallblocktest.test1 smallblocktest.test2 smallblocktest.test3 smallblocktest.test
4
</tags>
<search_expr_true>
BLER= 0.000000
</search_expr_true>
<search_expr_false>
segmentation fault|assertion|exiting|fatal
</search_expr_false>
<nruns>
3
</nruns>
...
...
cmake_targets/build_oai
View file @
a0bcd41b
...
...
@@ -80,8 +80,6 @@ function print_help() {
This program installs OpenAirInterface Software
You should have ubuntu 16.xx or 18.04 updated
Options
-h
This help
-c | --clean
Erase all files to make a rebuild from start
-C | --clean-all
...
...
openair1/PHY/CODING/TESTBENCH/polartest.c
View file @
a0bcd41b
This diff is collapsed.
Click to expand it.
openair1/PHY/CODING/TESTBENCH/smallblocktest.c
View file @
a0bcd41b
...
...
@@ -127,17 +127,13 @@ int main(int argc, char *argv[]) {
#ifdef DEBUG_SMALLBLOCKTEST
printf
(
"[smallblocktest] Input = 0x%x, Output = 0x%x, DecoderOutput = 0x%x
\n
"
,
testInput
,
encoderOutput
,
estimatedOutput
);
for
(
int
i
=
0
;
i
<
32
;
i
++
)
printf
(
"[smallblocktest] Input[%d] = %d, Output[%d] = %d,
Mask[%d] = %d
\n
"
,
i
,
(
testInput
>>
i
)
&
1
,
i
,
(
estimatedOutput
>>
i
)
&
1
,
i
,
(
mask
>>
i
)
&
1
);
printf
(
"[smallblocktest] Input[%d] = %d, Output[%d] = %d,
codingDifference[%d]=%d, Mask[%d] = %d
\n
"
,
i
,
(
testInput
>>
i
)
&
1
,
i
,
(
estimatedOutput
>>
i
)
&
1
,
i
,
(
codingDifference
>>
i
)
&
1
,
i
,
(
mask
>>
i
)
&
1
);
#endif
//Error Calculation
estimatedOutput
&=
mask
;
codingDifference
=
((
uint32_t
)
estimatedOutput
)
^
testInput
;
// Count the # of 1's in codingDifference by Brian Kernighan’s algorithm.
//for (int i=0;i<32;i++)
//printf("[smallblocktest] Input[%d] = %d, Output[%d] = %d, codingDifference[%d]=%d, Mask[%d] = %d, bitError = %d\n", i, (testInput>>i)&1, i, (estimatedOutput>>i)&1, i, (codingDifference>>i)&1, i, (mask>>i)&1, nBitError);
for
(
nBitError
=
0
;
codingDifference
;
nBitError
++
)
codingDifference
&=
codingDifference
-
1
;
...
...
openair1/PHY/CODING/crc_byte.c
View file @
a0bcd41b
...
...
@@ -106,17 +106,6 @@ void crcTableInit (void)
}
while
(
++
c
);
}
//Generic version
void
crcTable256Init
(
uint32_t
poly
,
uint32_t
*
crc256Table
)
{
unsigned
char
c
=
0
;
do
{
crc256Table
[
c
]
=
crcbit
(
&
c
,
1
,
poly
);
}
while
(
++
c
);
}
/*********************************************************
Byte by byte implementations,
...
...
@@ -236,26 +225,6 @@ crc8 (unsigned char * inptr, int bitlen)
return
crc
;
}
//Generic version
unsigned
int
crcPayload
(
unsigned
char
*
inptr
,
int
bitlen
,
uint32_t
*
crc256Table
)
{
int
octetlen
,
resbit
;
unsigned
int
crc
=
0
;
octetlen
=
bitlen
/
8
;
// Change in bytes
resbit
=
(
bitlen
%
8
);
while
(
octetlen
--
>
0
)
{
crc
=
(
crc
<<
8
)
^
crc256Table
[(
*
inptr
++
)
^
(
crc
>>
24
)];
}
if
(
resbit
>
0
)
{
crc
=
(
crc
<<
resbit
)
^
crc256Table
[((
*
inptr
)
>>
(
8
-
resbit
))
^
(
crc
>>
(
32
-
resbit
))];
}
return
crc
;
}
int
check_crc
(
uint8_t
*
decoded_bytes
,
uint32_t
n
,
uint32_t
F
,
uint8_t
crc_type
)
{
uint32_t
crc
=
0
,
oldcrc
=
0
;
...
...
@@ -335,7 +304,7 @@ main()
{
unsigned
char
test
[]
=
"Thebigredfox"
;
crcTableInit
();
printf
(
"%x
\n
"
,
crcbit
(
test
,
sizeof
(
test
)
-
1
,
poly24
));
printf
(
"%x
\n
"
,
crcbit
(
test
,
sizeof
(
test
)
-
1
,
poly24
a
));
printf
(
"%x
\n
"
,
crc24
(
test
,
(
sizeof
(
test
)
-
1
)
*
8
));
printf
(
"%x
\n
"
,
crcbit
(
test
,
sizeof
(
test
)
-
1
,
poly8
));
printf
(
"%x
\n
"
,
crc8
(
test
,
(
sizeof
(
test
)
-
1
)
*
8
));
...
...
openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/time_meas.c
deleted
100644 → 0
View file @
f8eff2f9
/*
* 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 <stdio.h>
#include "time_meas.h"
#include <math.h>
#include <unistd.h>
// global var for openair performance profiler
extern
int
opp_enabled
;
double
get_cpu_freq_GHz
(
void
)
{
time_stats_t
ts
=
{
0
};
reset_meas
(
&
ts
);
ts
.
trials
++
;
ts
.
in
=
rdtsc_oai
();
sleep
(
1
);
ts
.
diff
=
(
rdtsc_oai
()
-
ts
.
in
);
cpu_freq_GHz
=
(
double
)
ts
.
diff
/
1000000000
;
printf
(
"CPU Freq is %f
\n
"
,
cpu_freq_GHz
);
return
cpu_freq_GHz
;
}
void
print_meas_now
(
time_stats_t
*
ts
,
const
char
*
name
,
FILE
*
file_name
){
if
(
opp_enabled
)
{
//static double cpu_freq_GHz = 3.2;
//if (cpu_freq_GHz == 0.0)
//cpu_freq_GHz = get_cpu_freq_GHz(); // super slow
if
(
ts
->
trials
>
0
)
{
//fprintf(file_name,"Name %25s: Processing %15.3f ms for SF %d, diff_now %15.3f \n", name,(ts->diff_now/(cpu_freq_GHz*1000000.0)),subframe,ts->diff_now);
fprintf
(
file_name
,
"%15.3f ms, diff_now %15.3f
\n
"
,(
ts
->
diff_now
/
(
cpu_freq_GHz
*
1000000
.
0
)),(
double
)
ts
->
diff_now
);
}
}
}
void
print_meas
(
time_stats_t
*
ts
,
const
char
*
name
,
time_stats_t
*
total_exec_time
,
time_stats_t
*
sf_exec_time
)
{
if
(
opp_enabled
)
{
static
int
first_time
=
0
;
static
double
cpu_freq_GHz
=
0
.
0
;
if
(
cpu_freq_GHz
==
0
.
0
)
cpu_freq_GHz
=
get_cpu_freq_GHz
();
if
(
first_time
==
0
)
{
first_time
=
1
;
if
((
total_exec_time
==
NULL
)
||
(
sf_exec_time
==
NULL
))
fprintf
(
stderr
,
"%25s %25s %25s %25s %25s %6f
\n
"
,
"Name"
,
"Total"
,
"Per Trials"
,
"Num Trials"
,
"CPU_F_GHz"
,
cpu_freq_GHz
);
else
fprintf
(
stderr
,
"%25s %25s %25s %20s %15s %6f
\n
"
,
"Name"
,
"Total"
,
"Average/Frame"
,
"Trials"
,
"CPU_F_GHz"
,
cpu_freq_GHz
);
}
if
(
ts
->
trials
>
0
)
{
//printf("%20s: total: %10.3f ms, average: %10.3f us (%10d trials)\n", name, ts->diff/cpu_freq_GHz/1000000.0, ts->diff/ts->trials/cpu_freq_GHz/1000.0, ts->trials);
if
((
total_exec_time
==
NULL
)
||
(
sf_exec_time
==
NULL
))
{
fprintf
(
stderr
,
"%25s: %15.3f ms ; %15.3f us; %15d;
\n
"
,
name
,
(
ts
->
diff
/
cpu_freq_GHz
/
1000000
.
0
),
(
ts
->
diff
/
ts
->
trials
/
cpu_freq_GHz
/
1000
.
0
),
ts
->
trials
);
}
else
{
fprintf
(
stderr
,
"%25s: %15.3f ms (%5.2f%%); %15.3f us (%5.2f%%); %15d;
\n
"
,
name
,
(
ts
->
diff
/
cpu_freq_GHz
/
1000000
.
0
),
((
ts
->
diff
/
cpu_freq_GHz
/
1000000
.
0
)
/
(
total_exec_time
->
diff
/
cpu_freq_GHz
/
1000000
.
0
))
*
100
,
// percentage
(
ts
->
diff
/
ts
->
trials
/
cpu_freq_GHz
/
1000
.
0
),
((
ts
->
diff
/
ts
->
trials
/
cpu_freq_GHz
/
1000
.
0
)
/
(
sf_exec_time
->
diff
/
sf_exec_time
->
trials
/
cpu_freq_GHz
/
1000
.
0
))
*
100
,
// percentage
ts
->
trials
);
}
}
}
}
double
get_time_meas_us
(
time_stats_t
*
ts
)
{
static
double
cpu_freq_GHz
=
0
.
0
;
if
(
cpu_freq_GHz
==
0
.
0
)
cpu_freq_GHz
=
get_cpu_freq_GHz
();
if
(
ts
->
trials
>
0
)
return
(
ts
->
diff
/
ts
->
trials
/
cpu_freq_GHz
/
1000
.
0
);
return
0
;
}
openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/time_meas.h
deleted
100644 → 0
View file @
f8eff2f9
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef __TIME_MEAS_DEFS__H__
#define __TIME_MEAS_DEFS__H__
#include <unistd.h>
#include <math.h>
#include <stdint.h>
#include <time.h>
#include <errno.h>
#include <stdio.h>
#include <pthread.h>
#include <linux/kernel.h>
#include <linux/types.h>
// global var to enable openair performance profiler
static
int
opp_enabled
=
1
;
double
cpu_freq_GHz
;
#if defined(__x86_64__) || defined(__i386__)
typedef
struct
{
long
long
in
;
long
long
diff
;
long
long
diff_now
;
long
long
p_time
;
/*!< \brief absolute process duration */
long
long
diff_square
;
/*!< \brief process duration square */
long
long
max
;
int
trials
;
int
meas_flag
;
}
time_stats_t
;
#elif defined(__arm__)
typedef
struct
{
uint32_t
in
;
uint32_t
diff_now
;
uint32_t
diff
;
uint32_t
p_time
;
/*!< \brief absolute process duration */
uint32_t
diff_square
;
/*!< \brief process duration square */
uint32_t
max
;
int
trials
;
}
time_stats_t
;
#endif
static
inline
void
start_meas
(
time_stats_t
*
ts
)
__attribute__
((
always_inline
));
static
inline
void
stop_meas
(
time_stats_t
*
ts
)
__attribute__
((
always_inline
));
void
print_meas_now
(
time_stats_t
*
ts
,
const
char
*
name
,
FILE
*
file_name
);
//void print_meas(time_stats_t *ts, const char* name, time_stats_t * total_exec_time, time_stats_t * sf_exec_time);
double
get_time_meas_us
(
time_stats_t
*
ts
);
double
get_cpu_freq_GHz
(
void
);
#if defined(__i386__)
static
inline
unsigned
long
long
rdtsc_oai
(
void
)
__attribute__
((
always_inline
));
static
inline
unsigned
long
long
rdtsc_oai
(
void
)
{
unsigned
long
long
int
x
;
__asm__
volatile
(
".byte 0x0f, 0x31"
:
"=A"
(
x
));
return
x
;
}
#elif defined(__x86_64__)
static
inline
unsigned
long
long
rdtsc_oai
(
void
)
__attribute__
((
always_inline
));
static
inline
unsigned
long
long
rdtsc_oai
(
void
)
{
unsigned
long
long
a
,
d
;
__asm__
volatile
(
"rdtsc"
:
"=a"
(
a
),
"=d"
(
d
));
return
(
d
<<
32
)
|
a
;
}
#elif defined(__arm__)
static
inline
uint32_t
rdtsc_oai
(
void
)
__attribute__
((
always_inline
));
static
inline
uint32_t
rdtsc_oai
(
void
)
{
uint32_t
r
=
0
;
asm
volatile
(
"mrc p15, 0, %0, c9, c13, 0"
:
"=r"
(
r
)
);
return
r
;
}
#endif
static
inline
void
start_meas
(
time_stats_t
*
ts
)
{
if
(
opp_enabled
)
{
if
(
ts
->
meas_flag
==
0
)
{
ts
->
trials
++
;
ts
->
in
=
rdtsc_oai
();
ts
->
meas_flag
=
1
;
}
else
{
ts
->
in
=
rdtsc_oai
();
}
}
}
static
inline
void
stop_meas
(
time_stats_t
*
ts
)
{
if
(
opp_enabled
)
{
long
long
out
=
rdtsc_oai
();
ts
->
diff_now
=
(
out
-
ts
->
in
);
ts
->
diff_now
=
(
out
-
ts
->
in
);
ts
->
diff
+=
(
out
-
ts
->
in
);
/// process duration is the difference between two clock points
ts
->
p_time
=
(
out
-
ts
->
in
);
ts
->
diff_square
+=
(
out
-
ts
->
in
)
*
(
out
-
ts
->
in
);
if
((
out
-
ts
->
in
)
>
ts
->
max
)
ts
->
max
=
out
-
ts
->
in
;
ts
->
meas_flag
=
0
;
}
}
static
inline
void
reset_meas
(
time_stats_t
*
ts
)
{
ts
->
trials
=
0
;
ts
->
diff
=
0
;
ts
->
diff_now
=
0
;
ts
->
p_time
=
0
;
ts
->
diff_square
=
0
;
ts
->
max
=
0
;
ts
->
meas_flag
=
0
;
}
static
inline
void
copy_meas
(
time_stats_t
*
dst_ts
,
time_stats_t
*
src_ts
)
{
if
(
opp_enabled
)
{
dst_ts
->
trials
=
src_ts
->
trials
;
dst_ts
->
diff
=
src_ts
->
diff
;
dst_ts
->
max
=
src_ts
->
max
;
}
}
#endif
openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_types.h
View file @
a0bcd41b
...
...
@@ -31,7 +31,7 @@
#ifndef __NR_LDPC_TYPES__H__
#define __NR_LDPC_TYPES__H__
#include "
./nrLDPC_tools
/time_meas.h"
#include "
PHY/TOOLS
/time_meas.h"
// ==============================================================================
// TYPES
...
...
openair1/PHY/CODING/nrPolar_tools/nr_bitwise_operations.c
View file @
a0bcd41b
...
...
@@ -19,6 +19,17 @@
* contact@openairinterface.org
*/
/*!\file PHY/CODING/nrPolar_tools/nr_bitwise_operations.c
* \brief
* \author Turker Yilmaz
* \date 2018
* \version 0.1
* \company EURECOM
* \email turker.yilmaz@eurecom.fr
* \note
* \warning
*/
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
void
nr_bit2byte_uint32_8
(
uint32_t
*
in
,
uint16_t
arraySize
,
uint8_t
*
out
)
{
...
...
@@ -29,7 +40,8 @@ void nr_bit2byte_uint32_8(uint32_t *in, uint16_t arraySize, uint8_t *out) {
}
}
for
(
int
j
=
0
;
j
<
arraySize
-
((
arrayInd
-
1
)
*
32
);
j
++
)
out
[
j
+
((
arrayInd
-
1
)
*
32
)]
=
(
in
[(
arrayInd
-
1
)]
>>
j
)
&
1
;
for
(
int
j
=
0
;
j
<
arraySize
-
((
arrayInd
-
1
)
*
32
);
j
++
)
out
[
j
+
((
arrayInd
-
1
)
*
32
)]
=
(
in
[(
arrayInd
-
1
)]
>>
j
)
&
1
;
}
void
nr_byte2bit_uint8_32
(
uint8_t
*
in
,
uint16_t
arraySize
,
uint32_t
*
out
)
{
...
...
@@ -43,16 +55,3 @@ void nr_byte2bit_uint8_32(uint8_t *in, uint16_t arraySize, uint32_t *out) {
out
[
i
]
|=
in
[(
i
*
32
)];
}
}
void
nr_crc_bit2bit_uint32_8
(
uint32_t
*
in
,
uint16_t
arraySize
,
uint8_t
*
out
)
{
out
[
0
]
=
0xff
;
out
[
1
]
=
0xff
;
out
[
2
]
=
0xff
;
uint8_t
arrayInd
=
ceil
(
arraySize
/
32
.
0
);
for
(
int
i
=
0
;
i
<
arrayInd
;
i
++
)
{
out
[
3
+
i
*
4
]
=
((
in
[
i
]
&
(
0x0000000f
))
<<
4
)
|
((
in
[
i
]
&
(
0x000000f0
))
>>
4
);
out
[
4
+
i
*
4
]
=
(((
in
[
i
]
&
(
0x00000f00
))
<<
4
)
|
((
in
[
i
]
&
(
0x0000f000
))
>>
4
))
>>
8
;
out
[
5
+
i
*
4
]
=
(((
in
[
i
]
&
(
0x000f0000
))
<<
4
)
|
((
in
[
i
]
&
(
0x00f00000
))
>>
4
))
>>
16
;
out
[
6
+
i
*
4
]
=
(((
in
[
i
]
&
(
0x0f000000
))
<<
4
)
|
((
in
[
i
]
&
(
0xf0000000
))
>>
4
))
>>
24
;
}
}
openair1/PHY/CODING/nrPolar_tools/nr_crc_byte.c
View file @
a0bcd41b
...
...
@@ -21,43 +21,36 @@
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
// ----- Old implementation ----
uint8_t
**
crc24c_generator_matrix
(
uint16_t
payloadSizeBits
){
uint8_t
crcPolynomialPattern
[
25
]
=
{
1
,
1
,
0
,
1
,
1
,
0
,
0
,
1
,
0
,
1
,
0
,
1
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
1
,
1
,
1
};
// 1011 0010 1011 0001 0001 0111 D^24 + D^23 + D^21 + D^20 + D^17 + D^15 + D^13 + D^12 + D^8 + D^4 + D^2 + D + 1
uint8_t
crcPolynomialSize
=
24
;
// 24 because crc24c
uint8_t
crcPolynomialSize
=
24
;
uint8_t
temp1
[
crcPolynomialSize
],
temp2
[
crcPolynomialSize
];
uint8_t
**
crc_generator_matrix
=
malloc
(
payloadSizeBits
*
sizeof
(
uint8_t
*
));
if
(
crc_generator_matrix
)
{
for
(
int
i
=
0
;
i
<
payloadSizeBits
;
i
++
)
{
crc_generator_matrix
[
i
]
=
malloc
(
crcPolynomialSize
*
sizeof
(
uint8_t
));
}
}
for
(
int
i
=
0
;
i
<
crcPolynomialSize
;
i
++
)
crc_generator_matrix
[
payloadSizeBits
-
1
][
i
]
=
crcPolynomialPattern
[
i
+
1
];
for
(
int
i
=
payloadSizeBits
-
2
;
i
>=
0
;
i
--
){
for
(
int
j
=
0
;
j
<
crcPolynomialSize
-
1
;
j
++
)
temp1
[
j
]
=
crc_generator_matrix
[
i
+
1
][
j
+
1
];
temp1
[
crcPolynomialSize
-
1
]
=
0
;
for
(
int
j
=
0
;
j
<
crcPolynomialSize
;
j
++
)
temp2
[
j
]
=
crc_generator_matrix
[
i
+
1
][
0
]
*
crcPolynomialPattern
[
j
+
1
];
for
(
int
j
=
0
;
j
<
crcPolynomialSize
;
j
++
)
temp2
[
j
]
=
crc_generator_matrix
[
i
+
1
][
0
]
*
crcPolynomialPattern
[
j
+
1
];
for
(
int
j
=
0
;
j
<
crcPolynomialSize
;
j
++
){
if
(
temp1
[
j
]
+
temp2
[
j
]
==
1
)
{
if
(
temp1
[
j
]
+
temp2
[
j
]
==
1
)
crc_generator_matrix
[
i
][
j
]
=
1
;
}
else
{
else
crc_generator_matrix
[
i
][
j
]
=
0
;
}
}
}
return
crc_generator_matrix
;
}
...
...
@@ -70,30 +63,26 @@ uint8_t **crc11_generator_matrix(uint16_t payloadSizeBits){
uint8_t
**
crc_generator_matrix
=
malloc
(
payloadSizeBits
*
sizeof
(
uint8_t
*
));
if
(
crc_generator_matrix
)
{
for
(
int
i
=
0
;
i
<
payloadSizeBits
;
i
++
)
{
crc_generator_matrix
[
i
]
=
malloc
(
crcPolynomialSize
*
sizeof
(
uint8_t
));
}
}
for
(
int
i
=
0
;
i
<
crcPolynomialSize
;
i
++
)
crc_generator_matrix
[
payloadSizeBits
-
1
][
i
]
=
crcPolynomialPattern
[
i
+
1
];
for
(
int
i
=
payloadSizeBits
-
2
;
i
>=
0
;
i
--
){
for
(
int
j
=
0
;
j
<
crcPolynomialSize
-
1
;
j
++
)
temp1
[
j
]
=
crc_generator_matrix
[
i
+
1
][
j
+
1
];
for
(
int
j
=
0
;
j
<
crcPolynomialSize
-
1
;
j
++
)
temp1
[
j
]
=
crc_generator_matrix
[
i
+
1
][
j
+
1
];
temp1
[
crcPolynomialSize
-
1
]
=
0
;
for
(
int
j
=
0
;
j
<
crcPolynomialSize
;
j
++
)
temp2
[
j
]
=
crc_generator_matrix
[
i
+
1
][
0
]
*
crcPolynomialPattern
[
j
+
1
];
for
(
int
j
=
0
;
j
<
crcPolynomialSize
;
j
++
)
temp2
[
j
]
=
crc_generator_matrix
[
i
+
1
][
0
]
*
crcPolynomialPattern
[
j
+
1
];
for
(
int
j
=
0
;
j
<
crcPolynomialSize
;
j
++
){
if
(
temp1
[
j
]
+
temp2
[
j
]
==
1
)
{
if
(
temp1
[
j
]
+
temp2
[
j
]
==
1
)
crc_generator_matrix
[
i
][
j
]
=
1
;
}
else
{
else
crc_generator_matrix
[
i
][
j
]
=
0
;
}
}
}
return
crc_generator_matrix
;
...
...
@@ -105,33 +94,30 @@ uint8_t **crc6_generator_matrix(uint16_t payloadSizeBits){
// 0110 0001 D^6 + D^5 + 1
uint8_t
crcPolynomialSize
=
6
;
uint8_t
temp1
[
crcPolynomialSize
],
temp2
[
crcPolynomialSize
];
uint8_t
**
crc_generator_matrix
=
malloc
(
payloadSizeBits
*
sizeof
(
uint8_t
*
));
if
(
crc_generator_matrix
)
{
for
(
int
i
=
0
;
i
<
payloadSizeBits
;
i
++
)
{
crc_generator_matrix
[
i
]
=
malloc
(
crcPolynomialSize
*
sizeof
(
uint8_t
));
}
}
for
(
int
i
=
0
;
i
<
crcPolynomialSize
;
i
++
)
crc_generator_matrix
[
payloadSizeBits
-
1
][
i
]
=
crcPolynomialPattern
[
i
+
1
];
for
(
int
i
=
0
;
i
<
crcPolynomialSize
;
i
++
)
crc_generator_matrix
[
payloadSizeBits
-
1
][
i
]
=
crcPolynomialPattern
[
i
+
1
];
for
(
int
i
=
payloadSizeBits
-
2
;
i
>=
0
;
i
--
){
for
(
int
j
=
0
;
j
<
crcPolynomialSize
-
1
;
j
++
)
temp1
[
j
]
=
crc_generator_matrix
[
i
+
1
][
j
+
1
];
for
(
int
j
=
0
;
j
<
crcPolynomialSize
-
1
;
j
++
)
temp1
[
j
]
=
crc_generator_matrix
[
i
+
1
][
j
+
1
];
temp1
[
crcPolynomialSize
-
1
]
=
0
;
for
(
int
j
=
0
;
j
<
crcPolynomialSize
;
j
++
)
temp2
[
j
]
=
crc_generator_matrix
[
i
+
1
][
0
]
*
crcPolynomialPattern
[
j
+
1
];
for
(
int
j
=
0
;
j
<
crcPolynomialSize
;
j
++
)
temp2
[
j
]
=
crc_generator_matrix
[
i
+
1
][
0
]
*
crcPolynomialPattern
[
j
+
1
];
for
(
int
j
=
0
;
j
<
crcPolynomialSize
;
j
++
){
if
(
temp1
[
j
]
+
temp2
[
j
]
==
1
)
{
if
(
temp1
[
j
]
+
temp2
[
j
]
==
1
)
crc_generator_matrix
[
i
][
j
]
=
1
;
}
else
{
else
crc_generator_matrix
[
i
][
j
]
=
0
;
}
}
}
return
crc_generator_matrix
;
...
...
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
View file @
a0bcd41b
This diff is collapsed.
Click to expand it.
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
View file @
a0bcd41b
...
...
@@ -21,11 +21,11 @@
/*!\file PHY/CODING/nrPolar_tools/nr_polar_defs.h
* \brief
* \author Turker Yilmaz
* \author
Raymond Knopp,
Turker Yilmaz
* \date 2018
* \version 0.1
* \company EURECOM
* \email turker.yilmaz@eurecom.fr
* \email
raymond.knopp@eurecom.fr,
turker.yilmaz@eurecom.fr
* \note
* \warning
*/
...
...
@@ -105,7 +105,7 @@ struct nrPolar_params {
int16_t
*
Q_PC_N
;
uint8_t
*
information_bit_pattern
;
uint16_t
*
channel_interleaver_pattern
;
uint32_t
crc_polynomial
;
//
uint32_t crc_polynomial;
uint8_t
**
crc_generator_matrix
;
//G_P
uint8_t
**
G_N
;
...
...
@@ -116,7 +116,6 @@ struct nrPolar_params {
uint64_t
cprime_tab1
[
32
][
256
];
uint64_t
B_tab0
[
32
][
256
];
uint64_t
B_tab1
[
32
][
256
];
uint32_t
*
crc256Table
;
uint8_t
**
extended_crc_generator_matrix
;
//lowercase: bits, Uppercase: Bits stored in bytes
//polar_encoder vectors
...
...
@@ -151,7 +150,7 @@ void polar_encoder_fast(uint64_t *A,
t_nrPolar_params
*
polarParams
);
int8_t
polar_decoder
(
double
*
input
,
uint8
_t
*
output
,
uint32
_t
*
output
,
t_nrPolar_params
*
polarParams
,
uint8_t
listSize
,
uint8_t
pathMetricAppr
);
...
...
@@ -167,15 +166,6 @@ int8_t polar_decoder_aPriori(double *input,
uint8_t
pathMetricAppr
,
double
*
aPrioriPayload
);
int8_t
polar_decoder_aPriori_timing
(
double
*
input
,
uint32_t
*
output
,
t_nrPolar_params
*
polarParams
,
uint8_t
listSize
,
uint8_t
pathMetricAppr
,
double
*
aPrioriPayload
,
double
cpuFreqGHz
,
FILE
*
logFile
);
int8_t
polar_decoder_dci
(
double
*
input
,
uint32_t
*
out
,
t_nrPolar_params
*
polarParams
,
...
...
@@ -192,9 +182,9 @@ void init_polar_deinterleaver_table(t_nrPolar_params *polarParams);
void
nr_polar_print_polarParams
(
t_nrPolar_params
*
polarParams
);
t_nrPolar_params
*
nr_polar_params
(
int8_t
messageType
,
uint16_t
messageLength
,
uint8_t
aggregation_level
);
t_nrPolar_params
*
nr_polar_params
(
int8_t
messageType
,
uint16_t
messageLength
,
uint8_t
aggregation_level
);
uint16_t
nr_polar_aggregation_prime
(
uint8_t
aggregation_level
);
...
...
@@ -256,16 +246,18 @@ void nr_polar_info_bit_extraction(uint8_t *input,
uint16_t
size
);
void
nr_bit2byte_uint32_8
(
uint32_t
*
in
,
uint16_t
arraySize
,
uint8_t
*
out
);
uint16_t
arraySize
,
uint8_t
*
out
);
void
nr_byte2bit_uint8_32
(
uint8_t
*
in
,
uint16_t
arraySize
,
uint32_t
*
out
);
uint16_t
arraySize
,
uint32_t
*
out
);
uint8_t
**
crc24c_generator_matrix
(
uint16_t
payloadSizeBits
);
void
nr_crc_bit2bit_uint32_8
(
uint32_t
*
in
,
uint16_t
arraySize
,
uint8_t
*
out
);
uint8_t
**
crc11_generator_matrix
(
uint16_t
payloadSizeBits
);
uint8_t
**
crc6_generator_matrix
(
uint16_t
payloadSizeBits
);
void
nr_polar_bit_insertion
(
uint8_t
*
input
,
uint8_t
*
output
,
...
...
@@ -370,12 +362,6 @@ void updateCrcChecksum2(uint8_t **crcChecksum,
uint32_t
i2
,
uint8_t
len
);
uint8_t
**
crc24c_generator_matrix
(
uint16_t
payloadSizeBits
);
uint8_t
**
crc11_generator_matrix
(
uint16_t
payloadSizeBits
);
uint8_t
**
crc6_generator_matrix
(
uint16_t
payloadSizeBits
);
//Also nr_polar_rate_matcher
static
inline
void
nr_polar_interleaver
(
uint8_t
*
input
,
uint8_t
*
output
,
...
...
@@ -385,12 +371,10 @@ static inline void nr_polar_interleaver(uint8_t *input,
}
static
inline
void
nr_polar_deinterleaver
(
uint8_t
*
input
,
uint8_t
*
output
,
uint16_t
*
pattern
,
uint16_t
size
)
{
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
output
[
pattern
[
i
]]
=
input
[
i
];
}
uint8_t
*
output
,
uint16_t
*
pattern
,
uint16_t
size
)
{
for
(
int
i
=
0
;
i
<
size
;
i
++
)
output
[
pattern
[
i
]]
=
input
[
i
];
}
#endif
openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
View file @
a0bcd41b
...
...
@@ -32,7 +32,6 @@
//#define DEBUG_POLAR_ENCODER
//#define DEBUG_POLAR_ENCODER_DCI
//#define DEBUG_POLAR_ENCODER_TIMING
//#define DEBUG_POLAR_MATLAB
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
...
...
@@ -51,16 +50,16 @@ void polar_encoder(uint32_t *in,
printf("polar_B %llx (crc %x)\n",B,crc24c((uint8_t*)in,polarParams->payloadBits)>>8);
#endif
nr_bit2byte_uint32_8_t((uint32_t*)&B, polarParams->K, polarParams->nr_polar_B);*/
nr_bit2byte_uint32_8
(
(
uint32_t
*
)
in
,
polarParams
->
payloadBits
,
polarParams
->
nr_polar_A
);
nr_bit2byte_uint32_8
(
in
,
polarParams
->
payloadBits
,
polarParams
->
nr_polar_A
);
/*
* Bytewise operations
*/
//Calculate CRC.
nr_matrix_multiplication_uint8_1D_uint8_2D
(
polarParams
->
nr_polar_A
,
polarParams
->
crc_generator_matrix
,
polarParams
->
nr_polar_crc
,
polarParams
->
payloadBits
,
polarParams
->
crcParityBits
);
polarParams
->
crc_generator_matrix
,
polarParams
->
nr_polar_crc
,
polarParams
->
payloadBits
,
polarParams
->
crcParityBits
);
for
(
uint8_t
i
=
0
;
i
<
polarParams
->
crcParityBits
;
i
++
)
polarParams
->
nr_polar_crc
[
i
]
=
(
polarParams
->
nr_polar_crc
[
i
]
%
2
);
...
...
@@ -78,6 +77,8 @@ void polar_encoder(uint32_t *in,
for
(
int
i
=
0
;
i
<
polarParams
->
K
;
i
++
)
B2
=
B2
|
((
uint64_t
)
polarParams
->
nr_polar_B
[
i
]
<<
i
);
printf
(
"polar_B %llx
\n
"
,
B2
);
for
(
int
i
=
0
;
i
<
polarParams
->
payloadBits
;
i
++
)
printf
(
"a[%d]=%d
\n
"
,
i
,
polarParams
->
nr_polar_A
[
i
]);
for
(
int
i
=
0
;
i
<
polarParams
->
K
;
i
++
)
printf
(
"b[%d]=%d
\n
"
,
i
,
polarParams
->
nr_polar_B
[
i
]);
#endif
/* for (int j=0;j<polarParams->crcParityBits;j++) {
for (int i=0;i<polarParams->payloadBits;i++)
...
...
@@ -116,10 +117,10 @@ void polar_encoder(uint32_t *in,
polarParams->nr_polar_U[247]=1;
polarParams->nr_polar_U[253]=1;*/
nr_matrix_multiplication_uint8_1D_uint8_2D
(
polarParams
->
nr_polar_U
,
polarParams
->
G_N
,
polarParams
->
nr_polar_D
,
polarParams
->
N
,
polarParams
->
N
);
polarParams
->
G_N
,
polarParams
->
nr_polar_D
,
polarParams
->
N
,
polarParams
->
N
);
for
(
uint16_t
i
=
0
;
i
<
polarParams
->
N
;
i
++
)
polarParams
->
nr_polar_D
[
i
]
=
(
polarParams
->
nr_polar_D
[
i
]
%
2
);
...
...
@@ -169,35 +170,29 @@ void polar_encoder_dci(uint32_t *in,
#ifdef DEBUG_POLAR_ENCODER_DCI
printf
(
"[polar_encoder_dci] A: "
);
for
(
int
i
=
0
;
i
<
polarParams
->
payloadBits
;
i
++
)
printf
(
"%d-"
,
polarParams
->
nr_polar_A
[
i
]);
printf
(
"
\n
"
);
printf
(
"[polar_encoder_dci] APrime: "
);
printf
(
"[polar_encoder_dci] APrime: "
);
for
(
int
i
=
0
;
i
<
polarParams
->
K
;
i
++
)
printf
(
"%d-"
,
polarParams
->
nr_polar_APrime
[
i
]);
printf
(
"
\n
"
);
printf
(
"[polar_encoder_dci] GP: "
);
printf
(
"[polar_encoder_dci] GP: "
);
for
(
int
i
=
0
;
i
<
polarParams
->
crcParityBits
;
i
++
)
printf
(
"%d-"
,
polarParams
->
crc_generator_matrix
[
0
][
i
]);
printf
(
"
\n
"
);
#endif
//Calculate CRC.
nr_matrix_multiplication_uint8_1D_uint8_2D
(
polarParams
->
nr_polar_APrime
,
polarParams
->
crc_generator_matrix
,
polarParams
->
nr_polar_crc
,
polarParams
->
K
,
polarParams
->
crcParityBits
);
polarParams
->
crc_generator_matrix
,
polarParams
->
nr_polar_crc
,
polarParams
->
K
,
polarParams
->
crcParityBits
);
for
(
uint8_t
i
=
0
;
i
<
polarParams
->
crcParityBits
;
i
++
)
polarParams
->
nr_polar_crc
[
i
]
=
(
polarParams
->
nr_polar_crc
[
i
]
%
2
);
#ifdef DEBUG_POLAR_ENCODER_DCI
printf
(
"[polar_encoder_dci] CRC: "
);
for
(
int
i
=
0
;
i
<
polarParams
->
crcParityBits
;
i
++
)
printf
(
"%d-"
,
polarParams
->
nr_polar_crc
[
i
]);
printf
(
"
\n
"
);
#endif
...
...
@@ -209,55 +204,16 @@ void polar_encoder_dci(uint32_t *in,
polarParams
->
nr_polar_B
[
i
]
=
polarParams
->
nr_polar_crc
[
i
-
(
polarParams
->
payloadBits
)];
//Scrambling (b to c)
for
(
int
i
=
0
;
i
<
16
;
i
++
)
{
polarParams
->
nr_polar_B
[
polarParams
->
payloadBits
+
8
+
i
]
=
(
polarParams
->
nr_polar_B
[
polarParams
->
payloadBits
+
8
+
i
]
+
((
n_RNTI
>>
(
15
-
i
))
&
1
)
)
%
2
;
}
for
(
int
i
=
0
;
i
<
16
;
i
++
)
polarParams
->
nr_polar_B
[
polarParams
->
payloadBits
+
8
+
i
]
=
(
polarParams
->
nr_polar_B
[
polarParams
->
payloadBits
+
8
+
i
]
+
((
n_RNTI
>>
(
15
-
i
))
&
1
)
)
%
2
;
/* //(a to a')
nr_crc_bit2bit_uint32_8_t(in, polarParams->payloadBits, polarParams->nr_polar_aPrime);
//Parity bits computation (p)
polarParams->crcBit = crc24c(polarParams->nr_polar_aPrime, (polarParams->payloadBits+polarParams->crcParityBits));
#ifdef DEBUG_POLAR_ENCODER_DCI
printf("[polar_encoder_dci] crc: 0x%08x\n", polarParams->crcBit);
for (int i=0; i<32; i++)
{
printf("%d\n",((polarParams->crcBit)>>i)&1);
}
#endif
//(a to b)
//
// Bytewise operations
//
uint8_t arrayInd = ceil(polarParams->payloadBits / 8.0);
for (int i=0; i<arrayInd-1; i++){
for (int j=0; j<8; j++) {
polarParams->nr_polar_B[j+(i*8)] = ((polarParams->nr_polar_aPrime[3+i]>>(7-j)) & 1);
}
}
for (int i=0; i<((polarParams->payloadBits)%8); i++) {
polarParams->nr_polar_B[i+(arrayInd-1)*8] = ((polarParams->nr_polar_aPrime[3+(arrayInd-1)]>>(7-i)) & 1);
}
for (int i=0; i<8; i++) {
polarParams->nr_polar_B[polarParams->payloadBits+i] = ((polarParams->crcBit)>>(31-i))&1;
}
//Scrambling (b to c)
for (int i=0; i<16; i++) {
polarParams->nr_polar_B[polarParams->payloadBits+8+i] =
( (((polarParams->crcBit)>>(23-i))&1) + ((n_RNTI>>(15-i))&1) ) % 2;
}*/
#ifdef DEBUG_POLAR_ENCODER_DCI
printf
(
"[polar_encoder_dci] B: "
);
for
(
int
i
=
0
;
i
<
polarParams
->
K
;
i
++
)
printf
(
"%d-"
,
polarParams
->
nr_polar_B
[
i
]);
printf
(
"
\n
"
);
#endif
//Interleaving (c to c')
nr_polar_interleaver
(
polarParams
->
nr_polar_B
,
polarParams
->
nr_polar_CPrime
,
polarParams
->
interleaving_pattern
,
polarParams
->
K
);
nr_polar_interleaver
(
polarParams
->
nr_polar_B
,
polarParams
->
nr_polar_CPrime
,
polarParams
->
interleaving_pattern
,
polarParams
->
K
);
//Bit insertion (c' to u)
nr_polar_bit_insertion
(
polarParams
->
nr_polar_CPrime
,
polarParams
->
nr_polar_U
,
...
...
@@ -268,13 +224,11 @@ void polar_encoder_dci(uint32_t *in,
polarParams
->
n_pc
);
//Encoding (u to d)
nr_matrix_multiplication_uint8_1D_uint8_2D
(
polarParams
->
nr_polar_U
,
polarParams
->
G_N
,
polarParams
->
nr_polar_D
,
polarParams
->
N
,
polarParams
->
N
);
for
(
uint16_t
i
=
0
;
i
<
polarParams
->
N
;
i
++
)
polarParams
->
nr_polar_D
[
i
]
=
(
polarParams
->
nr_polar_D
[
i
]
%
2
);
polarParams
->
G_N
,
polarParams
->
nr_polar_D
,
polarParams
->
N
,
polarParams
->
N
);
for
(
uint16_t
i
=
0
;
i
<
polarParams
->
N
;
i
++
)
polarParams
->
nr_polar_D
[
i
]
=
(
polarParams
->
nr_polar_D
[
i
]
%
2
);
//Rate matching
//Sub-block interleaving (d to y) and Bit selection (y to e)
...
...
@@ -288,16 +242,11 @@ void polar_encoder_dci(uint32_t *in,
nr_byte2bit_uint8_32
(
polarParams
->
nr_polar_E
,
polarParams
->
encoderLength
,
out
);
#ifdef DEBUG_POLAR_ENCODER_DCI
printf
(
"[polar_encoder_dci] E: "
);
for
(
int
i
=
0
;
i
<
polarParams
->
encoderLength
;
i
++
)
printf
(
"%d-"
,
polarParams
->
nr_polar_E
[
i
]);
uint8_t
outputInd
=
ceil
(
polarParams
->
encoderLength
/
32
.
0
);
printf
(
"
\n
[polar_encoder_dci] out: "
);
for
(
int
i
=
0
;
i
<
outputInd
;
i
++
)
{
printf
(
"[%d]->0x%08x
\t
"
,
i
,
out
[
i
]);
}
for
(
int
i
=
0
;
i
<
outputInd
;
i
++
)
printf
(
"[%d]->0x%08x
\t
"
,
i
,
out
[
i
]);
#endif
}
...
...
openair1/PHY/CODING/nrSmallBlock/decodeSmallBlock.c
View file @
a0bcd41b
...
...
@@ -48,7 +48,7 @@ uint16_t decodeSmallBlock(int8_t *in, uint8_t len){
int16_t
Rhat
[
NR_SMALL_BLOCK_CODED_BITS
]
=
{
0
},
Rhatabs
[
NR_SMALL_BLOCK_CODED_BITS
]
=
{
0
};
uint16_t
maxVal
;
uint8_t
maxInd
=
0
;
in
t
jmax
=
(
1
<<
(
len
-
1
));
uint8_
t
jmax
=
(
1
<<
(
len
-
1
));
for
(
int
j
=
0
;
j
<
jmax
;
++
j
)
for
(
int
k
=
0
;
k
<
NR_SMALL_BLOCK_CODED_BITS
;
++
k
)
Rhat
[
j
]
+=
in
[
k
]
*
hadamard32InterleavedTransposed
[
j
][
k
];
...
...
openair1/PHY/CODING/nr_polar_init.c
View file @
a0bcd41b
...
...
@@ -21,19 +21,16 @@
/*!\file PHY/CODING/nr_polar_init.h
* \brief
* \author Turker Yilmaz
* \author Turker Yilmaz
, Raymond Knopp
* \date 2018
* \version 0.1
* \company EURECOM
* \email turker.yilmaz@eurecom.fr
* \email turker.yilmaz@eurecom.fr
, raymond.knopp@eurecom.fr
* \note
* \warning
*/
#include "nrPolar_tools/nr_polar_defs.h"
#include "PHY/CODING/nrPolar_tools/nr_polar_dci_defs.h"
#include "PHY/CODING/nrPolar_tools/nr_polar_uci_defs.h"
#include "PHY/CODING/nrPolar_tools/nr_polar_pbch_defs.h"
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
#include "PHY/NR_TRANSPORT/nr_dci.h"
static
int
intcmp
(
const
void
*
p1
,
const
void
*
p2
)
{
...
...
@@ -95,7 +92,9 @@ static void nr_polar_init(t_nrPolar_params * *polarParams,
}
newPolarInitNode
->
K
=
newPolarInitNode
->
payloadBits
+
newPolarInitNode
->
crcParityBits
;
// Number of bits to encode.
newPolarInitNode
->
N
=
nr_polar_output_length
(
newPolarInitNode
->
K
,
newPolarInitNode
->
encoderLength
,
newPolarInitNode
->
n_max
);
newPolarInitNode
->
N
=
nr_polar_output_length
(
newPolarInitNode
->
K
,
newPolarInitNode
->
encoderLength
,
newPolarInitNode
->
n_max
);
newPolarInitNode
->
n
=
log2
(
newPolarInitNode
->
N
);
newPolarInitNode
->
G_N
=
nr_polar_kronecker_power_matrices
(
newPolarInitNode
->
n
);
//polar_encoder vectors:
...
...
@@ -182,9 +181,9 @@ void nr_polar_print_polarParams(t_nrPolar_params *polarParams) {
return
;
}
t_nrPolar_params
*
nr_polar_params
(
int8_t
messageType
,
uint16_t
messageLength
,
uint8_t
aggregation_level
)
{
t_nrPolar_params
*
nr_polar_params
(
int8_t
messageType
,
uint16_t
messageLength
,
uint8_t
aggregation_level
)
{
static
t_nrPolar_params
*
polarList
=
NULL
;
nr_polar_init
(
&
polarList
,
messageType
,
messageLength
,
aggregation_level
);
t_nrPolar_params
*
polarParams
=
polarList
;
...
...
openair1/PHY/NR_TRANSPORT/nr_dci.h
View file @
a0bcd41b
...
...
@@ -25,8 +25,6 @@
#include "PHY/defs_gNB.h"
#include "PHY/NR_REFSIG/nr_refsig.h"
typedef
unsigned
__int128
uint128_t
;
uint16_t
nr_get_dci_size
(
nfapi_nr_dci_format_e
format
,
nfapi_nr_rnti_type_e
rnti_type
,
uint16_t
N_RB
,
...
...
openair1/PHY/NR_TRANSPORT/nr_dlsch.h
View file @
a0bcd41b
...
...
@@ -96,6 +96,8 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t *dlsch);
void
clean_gNB_dlsch
(
NR_gNB_DLSCH_t
*
dlsch
);
void
clean_gNB_ulsch
(
NR_gNB_ULSCH_t
*
ulsch
);
int
nr_dlsch_encoding
(
unsigned
char
*
a
,
uint8_t
subframe
,
NR_gNB_DLSCH_t
*
dlsch
,
...
...
openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c
View file @
a0bcd41b
...
...
@@ -171,6 +171,104 @@ NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations,uint8_t N_RB_UL, uint8
return
(
NULL
);
}
void
clean_gNB_ulsch
(
NR_gNB_ULSCH_t
*
ulsch
)
{
unsigned
char
i
,
j
;
if
(
ulsch
)
{
ulsch
->
harq_mask
=
0
;
ulsch
->
bundling
=
0
;
ulsch
->
beta_offset_cqi_times8
=
0
;
ulsch
->
beta_offset_ri_times8
=
0
;
ulsch
->
beta_offset_harqack_times8
=
0
;
ulsch
->
Msg3_active
=
0
;
ulsch
->
Msg3_flag
=
0
;
ulsch
->
Msg3_subframe
=
0
;
ulsch
->
Msg3_frame
=
0
;
ulsch
->
rnti
=
0
;
ulsch
->
rnti_type
=
0
;
ulsch
->
cyclicShift
=
0
;
ulsch
->
cooperation_flag
=
0
;
ulsch
->
Mlimit
=
0
;
ulsch
->
max_ldpc_iterations
=
0
;
ulsch
->
last_iteration_cnt
=
0
;
ulsch
->
num_active_cba_groups
=
0
;
for
(
i
=
0
;
i
<
NUM_MAX_CBA_GROUP
;
i
++
)
ulsch
->
cba_rnti
[
i
]
=
0
;
for
(
i
=
0
;
i
<
NR_MAX_SLOTS_PER_FRAME
;
i
++
)
ulsch
->
harq_process_id
[
i
]
=
0
;
for
(
i
=
0
;
i
<
NR_MAX_ULSCH_HARQ_PROCESSES
;
i
++
)
{
if
(
ulsch
->
harq_processes
[
i
]){
/// Nfapi ULSCH PDU
//nfapi_nr_ul_config_ulsch_pdu ulsch_pdu;
ulsch
->
harq_processes
[
i
]
->
frame
=
0
;
ulsch
->
harq_processes
[
i
]
->
subframe
=
0
;
ulsch
->
harq_processes
[
i
]
->
round
=
0
;
ulsch
->
harq_processes
[
i
]
->
TPC
=
0
;
ulsch
->
harq_processes
[
i
]
->
mimo_mode
=
0
;
ulsch
->
harq_processes
[
i
]
->
dci_alloc
=
0
;
ulsch
->
harq_processes
[
i
]
->
rar_alloc
=
0
;
ulsch
->
harq_processes
[
i
]
->
status
=
0
;
ulsch
->
harq_processes
[
i
]
->
subframe_scheduling_flag
=
0
;
ulsch
->
harq_processes
[
i
]
->
subframe_cba_scheduling_flag
=
0
;
ulsch
->
harq_processes
[
i
]
->
phich_active
=
0
;
ulsch
->
harq_processes
[
i
]
->
phich_ACK
=
0
;
ulsch
->
harq_processes
[
i
]
->
previous_first_rb
=
0
;
ulsch
->
harq_processes
[
i
]
->
handled
=
0
;
ulsch
->
harq_processes
[
i
]
->
delta_TF
=
0
;
ulsch
->
harq_processes
[
i
]
->
TBS
=
0
;
/// Pointer to the payload (38.212 V15.4.0 section 5.1)
//uint8_t *b;
ulsch
->
harq_processes
[
i
]
->
B
=
0
;
/// Pointers to code blocks after code block segmentation and CRC attachment (38.212 V15.4.0 section 5.2.2)
//uint8_t *c[MAX_NUM_NR_ULSCH_SEGMENTS];
ulsch
->
harq_processes
[
i
]
->
K
=
0
;
ulsch
->
harq_processes
[
i
]
->
F
=
0
;
ulsch
->
harq_processes
[
i
]
->
C
=
0
;
/// Pointers to code blocks after LDPC coding (38.212 V15.4.0 section 5.3.2)
//int16_t *d[MAX_NUM_NR_ULSCH_SEGMENTS];
/// LDPC processing buffer
//t_nrLDPC_procBuf* p_nrLDPC_procBuf[MAX_NUM_NR_ULSCH_SEGMENTS];
ulsch
->
harq_processes
[
i
]
->
Z
=
0
;
/// code blocks after bit selection in rate matching for LDPC code (38.212 V15.4.0 section 5.4.2.1)
//int16_t e[MAX_NUM_NR_DLSCH_SEGMENTS][3*8448];
ulsch
->
harq_processes
[
i
]
->
E
;
ulsch
->
harq_processes
[
i
]
->
G
;
ulsch
->
harq_processes
[
i
]
->
n_DMRS
=
0
;
ulsch
->
harq_processes
[
i
]
->
n_DMRS2
=
0
;
ulsch
->
harq_processes
[
i
]
->
previous_n_DMRS
=
0
;
ulsch
->
harq_processes
[
i
]
->
cqi_crc_status
=
0
;
for
(
j
=
0
;
j
<
MAX_CQI_BYTES
;
j
++
)
ulsch
->
harq_processes
[
i
]
->
o
[
j
]
=
0
;
ulsch
->
harq_processes
[
i
]
->
uci_format
=
0
;
ulsch
->
harq_processes
[
i
]
->
Or1
=
0
;
ulsch
->
harq_processes
[
i
]
->
Or2
=
0
;
ulsch
->
harq_processes
[
i
]
->
o_RI
[
0
]
=
0
;
ulsch
->
harq_processes
[
i
]
->
o_RI
[
1
]
=
0
;
ulsch
->
harq_processes
[
i
]
->
O_RI
=
0
;
ulsch
->
harq_processes
[
i
]
->
o_ACK
[
0
]
=
0
;
ulsch
->
harq_processes
[
i
]
->
o_ACK
[
1
]
=
0
;
ulsch
->
harq_processes
[
i
]
->
o_ACK
[
2
]
=
0
;
ulsch
->
harq_processes
[
i
]
->
o_ACK
[
3
]
=
0
;
ulsch
->
harq_processes
[
i
]
->
O_ACK
=
0
;
ulsch
->
harq_processes
[
i
]
->
V_UL_DAI
=
0
;
/// "q" sequences for CQI/PMI (for definition see 36-212 V8.6 2009-03, p.27)
//int8_t q[MAX_CQI_PAYLOAD];
ulsch
->
harq_processes
[
i
]
->
o_RCC
=
0
;
/// coded and interleaved CQI bits
//int8_t o_w[(MAX_CQI_BITS+8)*3];
/// coded CQI bits
//int8_t o_d[96+((MAX_CQI_BITS+8)*3)];
for
(
j
=
0
;
j
<
MAX_ACK_PAYLOAD
;
j
++
)
ulsch
->
harq_processes
[
i
]
->
q_ACK
[
j
]
=
0
;
for
(
j
=
0
;
j
<
MAX_RI_PAYLOAD
;
j
++
)
ulsch
->
harq_processes
[
i
]
->
q_RI
[
j
]
=
0
;
/// Temporary h sequence to flag PUSCH_x/PUSCH_y symbols which are not scrambled
//uint8_t h[MAX_NUM_CHANNEL_BITS];
/// soft bits for each received segment ("w"-sequence)(for definition see 36-212 V8.6 2009-03, p.15)
//int16_t w[MAX_NUM_ULSCH_SEGMENTS][3*(6144+64)];
}
}
}
}
uint32_t
nr_ulsch_decoding
(
PHY_VARS_gNB
*
phy_vars_gNB
,
uint8_t
UE_id
,
...
...
@@ -608,4 +706,4 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
ulsch
->
last_iteration_cnt
=
ret
;
return
(
ret
);
}
\ No newline at end of file
}
openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c
View file @
a0bcd41b
...
...
@@ -39,6 +39,7 @@
#include "PHY/CODING/nrLDPC_encoder/defs.h"
#include "PHY/NR_UE_TRANSPORT/nr_transport_ue.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
#include "PHY/NR_TRANSPORT/nr_dlsch.h"
...
...
@@ -92,7 +93,7 @@ NR_UE_ULSCH_t *new_nr_ue_ulsch(unsigned char N_RB_UL, int number_of_harq_pids, u
{
NR_UE_ULSCH_t
*
ulsch
;
unsigned
char
exit_flag
=
0
,
i
,
j
,
r
;
unsigned
char
exit_flag
=
0
,
i
,
r
;
unsigned
char
bw_scaling
=
1
;
switch
(
N_RB_UL
)
{
...
...
@@ -211,7 +212,6 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
uint32_t
Tbslbrm
;
uint8_t
nb_re_dmrs
;
uint16_t
length_dmrs
;
int
i
;
float
Coderate
;
///////////
...
...
openair1/SCHED_NR/fapi_nr_l1.h
View file @
a0bcd41b
...
...
@@ -32,7 +32,9 @@
#include "PHY/defs_gNB.h"
#include "PHY/phy_extern.h"
#include "PHY/LTE_TRANSPORT/transport_proto.h"
//#include "PHY/LTE_TRANSPORT/transport_proto.h"
//#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
#include "SCHED/sched_eNB.h"
#include "SCHED/sched_common.h"
#include "SCHED_NR/sched_nr.h"
...
...
openair1/SIMULATION/NR_PHY/dlschsim.c
View file @
a0bcd41b
...
...
@@ -494,7 +494,7 @@ int main(int argc, char **argv) {
unsigned
char
*
test_input_bit
=
malloc16
(
sizeof
(
unsigned
char
)
*
16
*
68
*
384
);
unsigned
int
errors_bit
=
0
;
test_input_bit
=
(
unsigned
char
*
)
malloc16
(
sizeof
(
unsigned
char
)
*
16
*
68
*
384
);
estimated_output
=
(
unsigned
char
*
)
malloc16
(
sizeof
(
unsigned
char
)
*
16
*
68
*
384
);
//
estimated_output = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384);
estimated_output_bit
=
(
unsigned
char
*
)
malloc16
(
sizeof
(
unsigned
char
)
*
16
*
68
*
384
);
NR_UE_DLSCH_t
*
dlsch0_ue
=
UE
->
dlsch
[
0
][
0
][
0
];
NR_DL_UE_HARQ_t
*
harq_process
=
dlsch0_ue
->
harq_processes
[
harq_pid
];
...
...
openair1/SIMULATION/NR_PHY/dlsim.c
View file @
a0bcd41b
...
...
@@ -42,11 +42,13 @@
#include "PHY/MODULATION/modulation_UE.h"
#include "PHY/INIT/phy_init.h"
#include "PHY/NR_TRANSPORT/nr_transport.h"
//#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
//openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
#include "SCHED_NR/sched_nr.h"
#include "SCHED_NR_UE/fapi_nr_ue_l1.h"
#include "SCHED_NR/fapi_nr_l1.h"
#include "SCHED_NR_UE/defs.h"
#include "LAYER2/NR_MAC_gNB/nr_mac_gNB.h"
#include "LAYER2/NR_MAC_UE/mac_defs.h"
...
...
@@ -58,6 +60,7 @@
#include "LAYER2/NR_MAC_UE/mac_proto.h"
//#include "LAYER2/NR_MAC_gNB/mac_proto.h"
//#include "openair2/LAYER2/NR_MAC_UE/mac_proto.h"
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
#include "RRC/NR/MESSAGES/asn1_msg.h"
...
...
@@ -515,7 +518,7 @@ int main(int argc, char **argv)
gNB_mac
=
RC
.
nrmac
[
0
];
config_common
(
0
,
0
,
Nid_cell
,
78
,
ssb_pattern
,(
uint64_t
)
3640000000L
,
N_RB_DL
);
config_nr_mib
(
0
,
0
,
1
,
kHz30
,
0
,
0
,
0
,
0
);
config_nr_mib
(
0
,
0
,
1
,
kHz30
,
0
,
0
,
0
,
0
,
0
);
nr_l2_init_ue
();
UE_mac
=
get_mac_inst
(
0
);
...
...
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c
View file @
a0bcd41b
...
...
@@ -387,20 +387,20 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
// Note: This should not be done in the MAC!
for
(
int
ii
=
0
;
ii
<
MAX_MOBILES_PER_GNB
;
ii
++
)
{
LTE_eNB_ULSCH_t
*
ulsch
=
RC
.
gNB
[
module_idP
][
CC_id
]
->
ulsch
[
ii
];
NR_gNB_ULSCH_t
*
ulsch
=
RC
.
gNB
[
module_idP
][
CC_id
]
->
ulsch
[
ii
][
0
];
if
((
ulsch
!=
NULL
)
&&
(
ulsch
->
rnti
==
rnti
)){
LOG_I
(
MAC
,
"clean_eNb_ulsch UE %x
\n
"
,
rnti
);
clean_
eNb
_ulsch
(
ulsch
);
clean_
gNB
_ulsch
(
ulsch
);
}
}
for
(
int
ii
=
0
;
ii
<
MAX_MOBILES_PER_GNB
;
ii
++
)
{
NR_gNB_DLSCH_t
*
dlsch
=
RC
.
gNB
[
module_idP
][
CC_id
]
->
dlsch
[
ii
][
0
];
if
((
dlsch
!=
NULL
)
&&
(
dlsch
->
rnti
==
rnti
)){
LOG_I
(
MAC
,
"clean_eNb_dlsch UE %x
\n
"
,
rnti
);
LOG_E
(
PHY
,
"Calling with wrong param
ter type
\n
"
);
clean_eNb
_dlsch
(
dlsch
);
}
NR_gNB_DLSCH_t
*
dlsch
=
RC
.
gNB
[
module_idP
][
CC_id
]
->
dlsch
[
ii
][
0
];
if
((
dlsch
!=
NULL
)
&&
(
dlsch
->
rnti
==
rnti
)){
LOG_I
(
MAC
,
"clean_eNb_dlsch UE %x
\n
"
,
rnti
);
LOG_E
(
PHY
,
"Calling with wrong parame
ter type
\n
"
);
clean_gNB
_dlsch
(
dlsch
);
}
}
for
(
int
j
=
0
;
j
<
10
;
j
++
){
...
...
openair2/LAYER2/NR_MAC_gNB/mac_proto.h
View file @
a0bcd41b
...
...
@@ -53,10 +53,12 @@ void config_nr_mib(int Mod_idP,
void
config_common
(
int
Mod_idP
,
int
CC_idP
,
int
Nid_cell
,
int
nr_bandP
,
uint64_t
ssb_pattern
,
uint64_t
dl_CarrierFreqP
,
uint32_t
dl_BandwidthP
);
);
int
rrc_mac_config_req_gNB
(
module_id_t
Mod_idP
,
int
CC_id
,
...
...
@@ -89,6 +91,10 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
frame_t
frameP
,
sub_frame_t
subframeP
);
void
nr_schedule_uss_dlsch_phytest
(
module_id_t
module_idP
,
frame_t
frameP
,
sub_frame_t
slotP
);
void
nr_configure_css_dci_initial
(
nfapi_nr_dl_config_pdcch_parameters_rel15_t
*
pdcch_params
,
nr_scs_e
scs_common
,
...
...
openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h
View file @
a0bcd41b
...
...
@@ -171,8 +171,4 @@ typedef struct gNB_MAC_INST_s {
time_stats_t
schedule_pch
;
}
gNB_MAC_INST
;
void
nr_schedule_css_dlsch_phytest
(
module_id_t
module_idP
,
frame_t
frameP
,
sub_frame_t
subframeP
);
#endif
/*__LAYER2_NR_MAC_GNB_H__ */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment