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
22
Merge Requests
22
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
oai
openairinterface5G
Commits
88d5bf42
Commit
88d5bf42
authored
Oct 13, 2018
by
knopp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
16-bit llr decoder integrated
parent
fa4a73bb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
20 deletions
+44
-20
openair1/PHY/CODING/TESTBENCH/polartest.c
openair1/PHY/CODING/TESTBENCH/polartest.c
+25
-14
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
+3
-3
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c
+13
-3
openair1/PHY/CODING/nr_polar_init.c
openair1/PHY/CODING/nr_polar_init.c
+3
-0
No files found.
openair1/PHY/CODING/TESTBENCH/polartest.c
View file @
88d5bf42
...
@@ -151,7 +151,9 @@ int main(int argc, char *argv[]) {
...
@@ -151,7 +151,9 @@ int main(int argc, char *argv[]) {
uint8_t
*
encoderOutputByte
=
malloc
(
sizeof
(
uint8_t
)
*
coderLength
);
uint8_t
*
encoderOutputByte
=
malloc
(
sizeof
(
uint8_t
)
*
coderLength
);
double
*
modulatedInput
=
malloc
(
sizeof
(
double
)
*
coderLength
);
//channel input
double
*
modulatedInput
=
malloc
(
sizeof
(
double
)
*
coderLength
);
//channel input
double
*
channelOutput
=
malloc
(
sizeof
(
double
)
*
coderLength
);
//add noise
double
*
channelOutput
=
malloc
(
sizeof
(
double
)
*
coderLength
);
//add noise
int16_t
*
channelOutput_int16
;
if
(
decoder_int16
==
1
)
channelOutput_int16
=
(
int16_t
*
)
malloc
(
sizeof
(
int16_t
)
*
coderLength
);
t_nrPolar_paramsPtr
nrPolar_params
=
NULL
,
currentPtr
=
NULL
;
t_nrPolar_paramsPtr
nrPolar_params
=
NULL
,
currentPtr
=
NULL
;
nr_polar_init
(
&
nrPolar_params
,
polarMessageType
,
testLength
,
aggregation_level
);
nr_polar_init
(
&
nrPolar_params
,
polarMessageType
,
testLength
,
aggregation_level
);
currentPtr
=
nr_polar_params
(
nrPolar_params
,
polarMessageType
,
testLength
,
aggregation_level
);
currentPtr
=
nr_polar_params
(
nrPolar_params
,
polarMessageType
,
testLength
,
aggregation_level
);
...
@@ -323,13 +325,6 @@ int main(int argc, char *argv[]) {
...
@@ -323,13 +325,6 @@ int main(int argc, char *argv[]) {
/*printf("encoderOutput: [0]->0x%08x\n", encoderOutput[0]);
/*printf("encoderOutput: [0]->0x%08x\n", encoderOutput[0]);
printf("encoderOutput: [1]->0x%08x\n", encoderOutput[1]);*/
printf("encoderOutput: [1]->0x%08x\n", encoderOutput[1]);*/
/*
if (decoder_int16==1) {
if (channelOutput[i] > 15) channelOutput_int8[i] = 127;
else if (channelOutput[i] < -16) channelOutput_int8[i] = -128;
else channelOutput_int8[i] = (int16_t) (8*channelOutput[i]);
}
*/
//Bit-to-byte:
//Bit-to-byte:
nr_bit2byte_uint32_8_t
(
encoderOutput
,
coderLength
,
encoderOutputByte
);
nr_bit2byte_uint32_8_t
(
encoderOutput
,
coderLength
,
encoderOutputByte
);
...
@@ -341,6 +336,15 @@ int main(int argc, char *argv[]) {
...
@@ -341,6 +336,15 @@ 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_int16
==
1
)
{
if
(
channelOutput
[
i
]
>
15
)
channelOutput_int16
[
i
]
=
127
;
else
if
(
channelOutput
[
i
]
<
-
16
)
channelOutput_int16
[
i
]
=
-
128
;
else
channelOutput_int16
[
i
]
=
(
int16_t
)
(
8
*
channelOutput
[
i
]);
}
}
}
start_meas
(
&
timeDecoder
);
start_meas
(
&
timeDecoder
);
...
@@ -350,12 +354,19 @@ int main(int argc, char *argv[]) {
...
@@ -350,12 +354,19 @@ int main(int argc, char *argv[]) {
NR_POLAR_DECODER_LISTSIZE,
NR_POLAR_DECODER_LISTSIZE,
aPrioriArray,
aPrioriArray,
NR_POLAR_DECODER_PATH_METRIC_APPROXIMATION);*/
NR_POLAR_DECODER_PATH_METRIC_APPROXIMATION);*/
decoderState
=
polar_decoder_aPriori
(
channelOutput
,
if
(
decoder_int16
==
0
)
estimatedOutput
,
decoderState
=
polar_decoder_aPriori
(
channelOutput
,
currentPtr
,
estimatedOutput
,
NR_POLAR_DECODER_LISTSIZE
,
currentPtr
,
NR_POLAR_DECODER_PATH_METRIC_APPROXIMATION
,
NR_POLAR_DECODER_LISTSIZE
,
aPrioriArray
);
NR_POLAR_DECODER_PATH_METRIC_APPROXIMATION
,
aPrioriArray
);
else
decoderState
=
polar_decoder_int16
(
channelOutput_int16
,
estimatedOutput
,
currentPtr
);
stop_meas
(
&
timeDecoder
);
stop_meas
(
&
timeDecoder
);
/*printf("testInput: [0]->0x%08x\n", testInput[0]);
/*printf("testInput: [0]->0x%08x\n", testInput[0]);
printf("estimatedOutput: [0]->0x%08x\n", estimatedOutput[0]);*/
printf("estimatedOutput: [0]->0x%08x\n", estimatedOutput[0]);*/
...
...
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
View file @
88d5bf42
...
@@ -1039,7 +1039,7 @@ int8_t polar_decoder_dci(double *input,
...
@@ -1039,7 +1039,7 @@ int8_t polar_decoder_dci(double *input,
int8_t
polar_decoder_int16
(
int16_t
*
input
,
int8_t
polar_decoder_int16
(
int16_t
*
input
,
uint8_t
*
out
put
,
uint8_t
*
out
,
t_nrPolar_params
*
polarParams
)
t_nrPolar_params
*
polarParams
)
{
{
...
@@ -1069,9 +1069,9 @@ int8_t polar_decoder_int16(int16_t *input,
...
@@ -1069,9 +1069,9 @@ int8_t polar_decoder_int16(int16_t *input,
nr_polar_deinterleaver
(
polarParams
->
nr_polar_CPrime
,
polarParams
->
nr_polar_B
,
polarParams
->
interleaving_pattern
,
polarParams
->
K
);
nr_polar_deinterleaver
(
polarParams
->
nr_polar_CPrime
,
polarParams
->
nr_polar_B
,
polarParams
->
interleaving_pattern
,
polarParams
->
K
);
//Remove the CRC (â)
//Remove the CRC (â)
for
(
int
j
=
0
;
j
<
polarParams
->
payloadBits
;
j
++
)
output
[
j
]
=
polarParams
->
nr_polar_B
[
j
];
for
(
int
j
=
0
;
j
<
polarParams
->
payloadBits
;
j
++
)
polarParams
->
nr_polar_A
[
j
]
=
polarParams
->
nr_polar_B
[
j
];
nr_byte2bit_uint8_32_t
(
polarParams
->
nr_polar_A
,
polarParams
->
payloadBits
,
out
);
return
(
0
);
return
(
0
);
}
}
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c
View file @
88d5bf42
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
#include "PHY/sse_intrin.h"
#include "PHY/sse_intrin.h"
#include "PHY/impl_defs_top.h"
#include "PHY/impl_defs_top.h"
//#define DEBUG_NEW_IMPL
void
updateLLR
(
double
***
llr
,
void
updateLLR
(
double
***
llr
,
uint8_t
**
llrU
,
uint8_t
**
llrU
,
...
@@ -266,7 +267,7 @@ void applyFtoleft(t_nrPolar_params *pp,decoder_node_t *node) {
...
@@ -266,7 +267,7 @@ void applyFtoleft(t_nrPolar_params *pp,decoder_node_t *node) {
for
(
int
i
=
0
;
i
<
node
->
Nv
;
i
++
)
printf
(
"i%d (frozen %d): alpha_v[i] = %d
\n
"
,
i
,
1
-
pp
->
information_bit_pattern
[
node
->
first_leaf_index
+
i
],
alpha_v
[
i
]);
for
(
int
i
=
0
;
i
<
node
->
Nv
;
i
++
)
printf
(
"i%d (frozen %d): alpha_v[i] = %d
\n
"
,
i
,
1
-
pp
->
information_bit_pattern
[
node
->
first_leaf_index
+
i
],
alpha_v
[
i
]);
#endif
#endif
if
(
node
->
left
->
all_frozen
==
0
)
{
if
(
node
->
left
->
all_frozen
==
0
)
{
...
@@ -275,7 +276,8 @@ void applyFtoleft(t_nrPolar_params *pp,decoder_node_t *node) {
...
@@ -275,7 +276,8 @@ void applyFtoleft(t_nrPolar_params *pp,decoder_node_t *node) {
if
(
avx2mod
==
0
)
{
if
(
avx2mod
==
0
)
{
__m256i
a256
,
b256
,
absa256
,
absb256
,
minabs256
;
__m256i
a256
,
b256
,
absa256
,
absb256
,
minabs256
;
int
avx2len
=
node
->
Nv
/
2
/
16
;
int
avx2len
=
node
->
Nv
/
2
/
16
;
// printf("avx2len %d\n",avx2len);
for
(
int
i
=
0
;
i
<
avx2len
;
i
++
)
{
for
(
int
i
=
0
;
i
<
avx2len
;
i
++
)
{
a256
=
((
__m256i
*
)
alpha_v
)[
i
];
a256
=
((
__m256i
*
)
alpha_v
)[
i
];
b256
=
((
__m256i
*
)
alpha_v
)[
i
+
avx2len
];
b256
=
((
__m256i
*
)
alpha_v
)[
i
+
avx2len
];
...
@@ -283,6 +285,13 @@ void applyFtoleft(t_nrPolar_params *pp,decoder_node_t *node) {
...
@@ -283,6 +285,13 @@ void applyFtoleft(t_nrPolar_params *pp,decoder_node_t *node) {
absb256
=
_mm256_abs_epi16
(
b256
);
absb256
=
_mm256_abs_epi16
(
b256
);
minabs256
=
_mm256_min_epi16
(
absa256
,
absb256
);
minabs256
=
_mm256_min_epi16
(
absa256
,
absb256
);
((
__m256i
*
)
alpha_l
)[
i
]
=
_mm256_sign_epi16
(
minabs256
,
_mm256_xor_si256
(
a256
,
b256
));
((
__m256i
*
)
alpha_l
)[
i
]
=
_mm256_sign_epi16
(
minabs256
,
_mm256_xor_si256
(
a256
,
b256
));
/* for (int j=0;j<16;j++) printf("alphal[%d] %d (%d,%d,%d)\n",
(16*i) + j,
alpha_l[(16*i)+j],
((int16_t*)&minabs256)[j],
alpha_v[(16*i)+j],
alpha_v[(16*i)+j+(node->Nv/2)]);
*/
}
}
}
}
else
if
(
avx2mod
==
8
)
{
else
if
(
avx2mod
==
8
)
{
...
@@ -315,6 +324,7 @@ void applyFtoleft(t_nrPolar_params *pp,decoder_node_t *node) {
...
@@ -315,6 +324,7 @@ void applyFtoleft(t_nrPolar_params *pp,decoder_node_t *node) {
absb
=
(
b
+
maskb
)
^
maskb
;
absb
=
(
b
+
maskb
)
^
maskb
;
minabs
=
absa
<
absb
?
absa
:
absb
;
minabs
=
absa
<
absb
?
absa
:
absb
;
alpha_l
[
i
]
=
(
maska
^
maskb
)
==
0
?
minabs
:
-
minabs
;
alpha_l
[
i
]
=
(
maska
^
maskb
)
==
0
?
minabs
:
-
minabs
;
// printf("alphal[%d] %d (%d,%d)\n",i,alpha_l[i],a,b);
}
}
}
}
if
(
node
->
Nv
==
2
)
{
// apply hard decision on left node
if
(
node
->
Nv
==
2
)
{
// apply hard decision on left node
...
@@ -368,7 +378,7 @@ void applyGtoright(t_nrPolar_params *pp,decoder_node_t *node) {
...
@@ -368,7 +378,7 @@ void applyGtoright(t_nrPolar_params *pp,decoder_node_t *node) {
betar
[
0
]
=
(
alpha_r
[
0
]
>
0
)
?
-
1
:
1
;
betar
[
0
]
=
(
alpha_r
[
0
]
>
0
)
?
-
1
:
1
;
pp
->
nr_polar_U
[
node
->
first_leaf_index
+
1
]
=
(
1
+
betar
[
0
])
>>
1
;
pp
->
nr_polar_U
[
node
->
first_leaf_index
+
1
]
=
(
1
+
betar
[
0
])
>>
1
;
#ifdef DEBUG_NEW_IMPL
#ifdef DEBUG_NEW_IMPL
printf
(
"Setting bit %d to %d (LLR %d
frozen_mask %d)
\n
"
,
node
->
first_leaf_index
+
1
,(
betar
[
0
]
+
1
)
>>
1
,
alpha_r
[
0
],
frozen_mask
);
printf
(
"Setting bit %d to %d (LLR %d
)
\n
"
,
node
->
first_leaf_index
+
1
,(
betar
[
0
]
+
1
)
>>
1
,
alpha_r
[
0
]
);
#endif
#endif
}
}
}
}
...
...
openair1/PHY/CODING/nr_polar_init.c
View file @
88d5bf42
...
@@ -147,6 +147,9 @@ void nr_polar_init(t_nrPolar_paramsPtr *polarParams,
...
@@ -147,6 +147,9 @@ void nr_polar_init(t_nrPolar_paramsPtr *polarParams,
free
(
J
);
free
(
J
);
build_decoder_tree
(
newPolarInitNode
);
printf
(
"decoder tree nodes %d
\n
"
,
newPolarInitNode
->
tree
.
num_nodes
);
}
else
{
}
else
{
AssertFatal
(
1
==
0
,
"[nr_polar_init] New t_nrPolar_paramsPtr could not be created"
);
AssertFatal
(
1
==
0
,
"[nr_polar_init] New t_nrPolar_paramsPtr could not be created"
);
}
}
...
...
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