Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
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
常顺宇
OpenXG-RAN
Commits
061fb00f
Commit
061fb00f
authored
Oct 09, 2018
by
Raymond Knopp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added new polar decoder implementation
parent
7aad1584
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
814 additions
and
391 deletions
+814
-391
cmake_targets/CMakeLists.txt
cmake_targets/CMakeLists.txt
+1
-0
openair1/PHY/CODING/TESTBENCH/polartest.c
openair1/PHY/CODING/TESTBENCH/polartest.c
+30
-7
openair1/PHY/CODING/nrPolar_init.c
openair1/PHY/CODING/nrPolar_init.c
+39
-0
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
+180
-206
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c
+308
-108
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
+256
-70
No files found.
cmake_targets/CMakeLists.txt
View file @
061fb00f
...
@@ -1123,6 +1123,7 @@ set(PHY_POLARSRC
...
@@ -1123,6 +1123,7 @@ set(PHY_POLARSRC
${
OPENAIR1_DIR
}
/PHY/CODING/nrPolar_tools/nr_polar_bit_insertion.c
${
OPENAIR1_DIR
}
/PHY/CODING/nrPolar_tools/nr_polar_bit_insertion.c
${
OPENAIR1_DIR
}
/PHY/CODING/nrPolar_tools/nr_polar_channel_interleaver_pattern.c
${
OPENAIR1_DIR
}
/PHY/CODING/nrPolar_tools/nr_polar_channel_interleaver_pattern.c
# ${OPENAIR1_DIR}/PHY/CODING/nrPolar_tools/nr_polar_crc.c
# ${OPENAIR1_DIR}/PHY/CODING/nrPolar_tools/nr_polar_crc.c
# ${OPENAIR1_DIR}/PHY/CODING/nrPolar_tools/decoder_K56_N512_E864.c
${
OPENAIR1_DIR
}
/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c
${
OPENAIR1_DIR
}
/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c
${
OPENAIR1_DIR
}
/PHY/CODING/nrPolar_tools/nr_polar_info_bit_pattern.c
${
OPENAIR1_DIR
}
/PHY/CODING/nrPolar_tools/nr_polar_info_bit_pattern.c
${
OPENAIR1_DIR
}
/PHY/CODING/nrPolar_tools/nr_polar_interleaving_pattern.c
${
OPENAIR1_DIR
}
/PHY/CODING/nrPolar_tools/nr_polar_interleaving_pattern.c
...
...
openair1/PHY/CODING/TESTBENCH/polartest.c
View file @
061fb00f
...
@@ -43,8 +43,9 @@ int main(int argc, char *argv[]) {
...
@@ -43,8 +43,9 @@ int main(int argc, char *argv[]) {
double
timeEncoderCumulative
=
0
,
timeDecoderCumulative
=
0
;
double
timeEncoderCumulative
=
0
,
timeDecoderCumulative
=
0
;
uint8_t
decoderListSize
=
8
,
pathMetricAppr
=
0
;
//0 --> eq. (8a) and (11b), 1 --> eq. (9) and (12)
uint8_t
decoderListSize
=
8
,
pathMetricAppr
=
0
;
//0 --> eq. (8a) and (11b), 1 --> eq. (9) and (12)
int
generate_optim_code
=
0
;
while
((
arguments
=
getopt
(
argc
,
argv
,
"s:d:f:m:i:l:a:h:q"
))
!=
-
1
)
while
((
arguments
=
getopt
(
argc
,
argv
,
"s:d:f:m:i:l:a:h:q
g
"
))
!=
-
1
)
switch
(
arguments
)
switch
(
arguments
)
{
{
case
's'
:
case
's'
:
...
@@ -80,6 +81,13 @@ int main(int argc, char *argv[]) {
...
@@ -80,6 +81,13 @@ int main(int argc, char *argv[]) {
decoder_int8
=
1
;
decoder_int8
=
1
;
break
;
break
;
case
'g'
:
generate_optim_code
=
1
;
iterations
=
1
;
SNRstart
=-
6
.
0
;
SNRstop
=-
6
.
0
;
decoder_int8
=
1
;
break
;
case
'h'
:
case
'h'
:
printf
(
"./polartest -s SNRstart -d SNRinc -f SNRstop -m [0=DCI|1=PBCH|2=UCI] -i iterations -l decoderListSize -a pathMetricAppr
\n
"
);
printf
(
"./polartest -s SNRstart -d SNRinc -f SNRstop -m [0=DCI|1=PBCH|2=UCI] -i iterations -l decoderListSize -a pathMetricAppr
\n
"
);
exit
(
-
1
);
exit
(
-
1
);
...
@@ -141,12 +149,18 @@ int main(int argc, char *argv[]) {
...
@@ -141,12 +149,18 @@ int main(int argc, char *argv[]) {
t_nrPolar_params
nrPolar_params
;
t_nrPolar_params
nrPolar_params
;
nr_polar_init
(
&
nrPolar_params
,
polarMessageType
);
nr_polar_init
(
&
nrPolar_params
,
polarMessageType
);
nr_polar_llrtableinit
();
if
(
generate_optim_code
==
1
)
nrPolar_params
.
decoder_kernel
=
NULL
;
// We assume no a priori knowledge available about the payload.
// We assume no a priori knowledge available about the payload.
double
aPrioriArray
[
nrPolar_params
.
payloadBits
];
double
aPrioriArray
[
nrPolar_params
.
payloadBits
];
for
(
int
i
=
0
;
i
<=
nrPolar_params
.
payloadBits
;
i
++
)
aPrioriArray
[
i
]
=
NAN
;
for
(
int
i
=
0
;
i
<=
nrPolar_params
.
payloadBits
;
i
++
)
aPrioriArray
[
i
]
=
NAN
;
printf
(
"SNRstart %f, SNRstop %f,, SNRinc %f
\n
"
,
SNRstart
,
SNRstop
,
SNRinc
);
for
(
SNR
=
SNRstart
;
SNR
<=
SNRstop
;
SNR
+=
SNRinc
)
{
for
(
SNR
=
SNRstart
;
SNR
<=
SNRstop
;
SNR
+=
SNRinc
)
{
printf
(
"SNR %f
\n
"
,
SNR
);
SNR_lin
=
pow
(
10
,
SNR
/
10
);
SNR_lin
=
pow
(
10
,
SNR
/
10
);
for
(
itr
=
1
;
itr
<=
iterations
;
itr
++
)
{
for
(
itr
=
1
;
itr
<=
iterations
;
itr
++
)
{
...
@@ -165,18 +179,27 @@ int main(int argc, char *argv[]) {
...
@@ -165,18 +179,27 @@ int main(int argc, char *argv[]) {
modulatedInput
[
i
]
=
(
-
1
)
/
sqrt
(
2
);
modulatedInput
[
i
]
=
(
-
1
)
/
sqrt
(
2
);
channelOutput
[
i
]
=
modulatedInput
[
i
]
+
(
gaussdouble
(
0
.
0
,
1
.
0
)
*
(
1
/
sqrt
(
2
*
SNR_lin
)));
channelOutput
[
i
]
=
modulatedInput
[
i
]
+
(
gaussdouble
(
0
.
0
,
1
.
0
)
*
(
1
/
sqrt
(
2
*
SNR_lin
)));
if
(
decoder_int8
==
1
)
{
if
(
decoder_int8
==
1
)
{
if
(
channelOutput
[
i
]
>
1
024
)
channelOutput_int8
[
i
]
=
32768
;
if
(
channelOutput
[
i
]
>
1
5
)
channelOutput_int8
[
i
]
=
127
;
else
if
(
channelOutput
[
i
]
<
-
1
023
)
channelOutput_int8
[
i
]
=
-
32767
;
else
if
(
channelOutput
[
i
]
<
-
1
6
)
channelOutput_int8
[
i
]
=
-
128
;
else
channelOutput_int8
[
i
]
=
(
int16_t
)
(
32
*
channelOutput
[
i
]);
else
channelOutput_int8
[
i
]
=
(
int16_t
)
(
8
*
channelOutput
[
i
]);
}
}
}
}
start_meas
(
&
timeDecoder
);
start_meas
(
&
timeDecoder
);
if
(
decoder_int8
==
0
)
decoderState
=
polar_decoder
(
channelOutput
,
estimatedOutput
,
&
nrPolar_params
,
decoderListSize
,
aPrioriArray
,
pathMetricAppr
,
&
polar_decoder_init
,
&
polar_rate_matching
,
&
decoding
,
&
bit_extraction
,
&
deinterleaving
,
&
sorting
,
&
path_metric
,
&
update_LLR
);
if
(
decoder_int8
==
0
)
decoderState
=
polar_decoder
(
channelOutput
,
estimatedOutput
,
&
nrPolar_params
,
decoderListSize
,
aPrioriArray
,
pathMetricAppr
,
&
polar_decoder_init
,
&
polar_rate_matching
,
&
decoding
,
&
bit_extraction
,
&
deinterleaving
,
&
sorting
,
&
path_metric
,
&
update_LLR
);
else
else
decoderState
=
polar_decoder_int8
(
channelOutput_int8
,
estimatedOutput
,
&
nrPolar_params
,
decoderListSize
,
&
polar_decoder_init
,
&
polar_rate_matching
,
&
decoding
,
&
bit_extraction
,
&
deinterleaving
,
&
sorting
,
&
path_metric
,
&
update_LLR
);
decoderState
=
polar_decoder_int8_new
(
channelOutput_int8
,
estimatedOutput
,
&
nrPolar_params
,
decoderListSize
,
&
polar_decoder_init
,
&
polar_rate_matching
,
&
decoding
,
&
bit_extraction
,
&
deinterleaving
,
&
sorting
,
&
path_metric
,
&
update_LLR
,
generate_optim_code
);
stop_meas
(
&
timeDecoder
);
stop_meas
(
&
timeDecoder
);
//calculate errors
//calculate errors
...
...
openair1/PHY/CODING/nrPolar_init.c
View file @
061fb00f
...
@@ -62,6 +62,11 @@ uint32_t poly24c = 0xB2B11700; //101100101011000100010111 -> D^24...
...
@@ -62,6 +62,11 @@ uint32_t poly24c = 0xB2B11700; //101100101011000100010111 -> D^24...
polarParams
->
nr_polar_u
=
malloc
(
sizeof
(
uint8_t
)
*
polarParams
->
N
);
//Decoder: nr_polar_uHat
polarParams
->
nr_polar_u
=
malloc
(
sizeof
(
uint8_t
)
*
polarParams
->
N
);
//Decoder: nr_polar_uHat
polarParams
->
nr_polar_cPrime
=
malloc
(
sizeof
(
uint8_t
)
*
polarParams
->
K
);
//Decoder: nr_polar_cHat
polarParams
->
nr_polar_cPrime
=
malloc
(
sizeof
(
uint8_t
)
*
polarParams
->
K
);
//Decoder: nr_polar_cHat
polarParams
->
nr_polar_b
=
malloc
(
sizeof
(
uint8_t
)
*
polarParams
->
K
);
//Decoder: nr_polar_bHat
polarParams
->
nr_polar_b
=
malloc
(
sizeof
(
uint8_t
)
*
polarParams
->
K
);
//Decoder: nr_polar_bHat
polarParams
->
decoder_kernel
=
NULL
;
//polar_decoder_K56_N512_E864;
}
else
if
(
messageType
==
2
)
{
//UCI
}
else
if
(
messageType
==
2
)
{
//UCI
polarParams
->
payloadBits
=
NR_POLAR_PUCCH_PAYLOAD_BITS
;
//A depends on what they carry...
polarParams
->
payloadBits
=
NR_POLAR_PUCCH_PAYLOAD_BITS
;
//A depends on what they carry...
polarParams
->
encoderLength
=
NR_POLAR_PUCCH_E
;
//E depends on other standards 6.3.1.4
polarParams
->
encoderLength
=
NR_POLAR_PUCCH_E
;
//E depends on other standards 6.3.1.4
...
@@ -131,6 +136,7 @@ uint32_t poly24c = 0xB2B11700; //101100101011000100010111 -> D^24...
...
@@ -131,6 +136,7 @@ uint32_t poly24c = 0xB2B11700; //101100101011000100010111 -> D^24...
polarParams
->
nr_polar_u
=
malloc
(
sizeof
(
uint8_t
)
*
polarParams
->
N
);
//Decoder: nr_polar_uHat
polarParams
->
nr_polar_u
=
malloc
(
sizeof
(
uint8_t
)
*
polarParams
->
N
);
//Decoder: nr_polar_uHat
polarParams
->
nr_polar_cPrime
=
malloc
(
sizeof
(
uint8_t
)
*
polarParams
->
K
);
//Decoder: nr_polar_cHat
polarParams
->
nr_polar_cPrime
=
malloc
(
sizeof
(
uint8_t
)
*
polarParams
->
K
);
//Decoder: nr_polar_cHat
polarParams
->
nr_polar_b
=
malloc
(
sizeof
(
uint8_t
)
*
polarParams
->
K
);
//Decoder: nr_polar_bHat
polarParams
->
nr_polar_b
=
malloc
(
sizeof
(
uint8_t
)
*
polarParams
->
K
);
//Decoder: nr_polar_bHat
}
}
polarParams
->
crcCorrectionBits
=
NR_POLAR_CRC_ERROR_CORRECTION_BITS
;
polarParams
->
crcCorrectionBits
=
NR_POLAR_CRC_ERROR_CORRECTION_BITS
;
...
@@ -161,5 +167,38 @@ uint32_t poly24c = 0xB2B11700; //101100101011000100010111 -> D^24...
...
@@ -161,5 +167,38 @@ uint32_t poly24c = 0xB2B11700; //101100101011000100010111 -> D^24...
nr_polar_channel_interleaver_pattern
(
polarParams
->
channel_interleaver_pattern
,
nr_polar_channel_interleaver_pattern
(
polarParams
->
channel_interleaver_pattern
,
polarParams
->
i_bil
,
polarParams
->
encoderLength
);
polarParams
->
i_bil
,
polarParams
->
encoderLength
);
polarParams
->
extended_crc_generator_matrix
=
malloc
(
polarParams
->
K
*
sizeof
(
uint8_t
*
));
//G_P3
uint8_t
tempECGM
[
polarParams
->
K
][
polarParams
->
crcParityBits
];
for
(
int
i
=
0
;
i
<
polarParams
->
K
;
i
++
){
polarParams
->
extended_crc_generator_matrix
[
i
]
=
malloc
(
polarParams
->
crcParityBits
*
sizeof
(
uint8_t
));
}
for
(
int
i
=
0
;
i
<
polarParams
->
payloadBits
;
i
++
)
{
for
(
int
j
=
0
;
j
<
polarParams
->
crcParityBits
;
j
++
)
{
tempECGM
[
i
][
j
]
=
polarParams
->
crc_generator_matrix
[
i
][
j
];
}
}
for
(
int
i
=
polarParams
->
payloadBits
;
i
<
polarParams
->
K
;
i
++
)
{
for
(
int
j
=
0
;
j
<
polarParams
->
crcParityBits
;
j
++
)
{
if
(
(
i
-
polarParams
->
payloadBits
)
==
j
){
tempECGM
[
i
][
j
]
=
1
;
}
else
{
tempECGM
[
i
][
j
]
=
0
;
}
}
}
for
(
int
i
=
0
;
i
<
polarParams
->
K
;
i
++
)
{
for
(
int
j
=
0
;
j
<
polarParams
->
crcParityBits
;
j
++
)
{
polarParams
->
extended_crc_generator_matrix
[
i
][
j
]
=
tempECGM
[
polarParams
->
interleaving_pattern
[
i
]][
j
];
}
}
build_decoder_tree
(
polarParams
);
printf
(
"decoder tree nodes %d
\n
"
,
polarParams
->
tree
.
num_nodes
);
free
(
J
);
free
(
J
);
}
}
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
View file @
061fb00f
This diff is collapsed.
Click to expand it.
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c
View file @
061fb00f
This diff is collapsed.
Click to expand it.
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
View file @
061fb00f
This diff is collapsed.
Click to expand it.
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