Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
openairinterface5G
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Merge Requests
16
Merge Requests
16
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
oai
openairinterface5G
Commits
061fb00f
Commit
061fb00f
authored
Oct 09, 2018
by
knopp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added new polar decoder implementation
parent
7aad1584
Changes
6
Expand all
Hide 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
${
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_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_info_bit_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[]) {
double
timeEncoderCumulative
=
0
,
timeDecoderCumulative
=
0
;
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
)
{
case
's'
:
...
...
@@ -80,6 +81,13 @@ int main(int argc, char *argv[]) {
decoder_int8
=
1
;
break
;
case
'g'
:
generate_optim_code
=
1
;
iterations
=
1
;
SNRstart
=-
6
.
0
;
SNRstop
=-
6
.
0
;
decoder_int8
=
1
;
break
;
case
'h'
:
printf
(
"./polartest -s SNRstart -d SNRinc -f SNRstop -m [0=DCI|1=PBCH|2=UCI] -i iterations -l decoderListSize -a pathMetricAppr
\n
"
);
exit
(
-
1
);
...
...
@@ -141,12 +149,18 @@ int main(int argc, char *argv[]) {
t_nrPolar_params
nrPolar_params
;
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.
double
aPrioriArray
[
nrPolar_params
.
payloadBits
];
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
)
{
printf
(
"SNR %f
\n
"
,
SNR
);
SNR_lin
=
pow
(
10
,
SNR
/
10
);
for
(
itr
=
1
;
itr
<=
iterations
;
itr
++
)
{
...
...
@@ -165,20 +179,29 @@ int main(int argc, char *argv[]) {
modulatedInput
[
i
]
=
(
-
1
)
/
sqrt
(
2
);
channelOutput
[
i
]
=
modulatedInput
[
i
]
+
(
gaussdouble
(
0
.
0
,
1
.
0
)
*
(
1
/
sqrt
(
2
*
SNR_lin
)));
if
(
decoder_int8
==
1
)
{
if
(
channelOutput
[
i
]
>
1
024
)
channelOutput_int8
[
i
]
=
32768
;
else
if
(
channelOutput
[
i
]
<
-
1
023
)
channelOutput_int8
[
i
]
=
-
32767
;
else
channelOutput_int8
[
i
]
=
(
int16_t
)
(
32
*
channelOutput
[
i
]);
if
(
channelOutput
[
i
]
>
1
5
)
channelOutput_int8
[
i
]
=
127
;
else
if
(
channelOutput
[
i
]
<
-
1
6
)
channelOutput_int8
[
i
]
=
-
128
;
else
channelOutput_int8
[
i
]
=
(
int16_t
)
(
8
*
channelOutput
[
i
]);
}
}
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
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
);
//calculate errors
if
(
decoderState
==-
1
)
{
blockErrorState
=-
1
;
...
...
openair1/PHY/CODING/nrPolar_init.c
View file @
061fb00f
...
...
@@ -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_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
->
decoder_kernel
=
NULL
;
//polar_decoder_K56_N512_E864;
}
else
if
(
messageType
==
2
)
{
//UCI
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
...
...
@@ -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_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
->
crcCorrectionBits
=
NR_POLAR_CRC_ERROR_CORRECTION_BITS
;
...
...
@@ -161,5 +167,38 @@ uint32_t poly24c = 0xB2B11700; //101100101011000100010111 -> D^24...
nr_polar_channel_interleaver_pattern
(
polarParams
->
channel_interleaver_pattern
,
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
);
}
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