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
zzha zzha
OpenXG-RAN
Commits
84c3f705
Commit
84c3f705
authored
Sep 09, 2018
by
Raymond Knopp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added prints for unrolling preparation
fixed issue for llr updates with the approximation
parent
609e6521
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
1 deletion
+54
-1
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
+3
-0
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c
+51
-1
No files found.
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
View file @
84c3f705
...
...
@@ -106,6 +106,8 @@ int8_t polar_decoder(
uint8_t
listIndex
[
2
*
listSize
],
copyIndex
;
for
(
uint16_t
currentBit
=
0
;
currentBit
<
polarParams
->
N
;
currentBit
++
){
printf
(
"***************** BIT %d
\n
"
,
currentBit
);
updateLLR
(
llr
,
llrUpdated
,
bit
,
bitUpdated
,
currentListSize
,
currentBit
,
0
,
polarParams
->
N
,
(
polarParams
->
n
+
1
),
pathMetricAppr
);
if
(
polarParams
->
information_bit_pattern
[
currentBit
]
==
0
)
{
//Frozen bit.
updatePathMetric
(
pathMetric
,
llr
,
currentListSize
,
0
,
currentBit
,
pathMetricAppr
);
//approximation=0 --> 11b, approximation=1 --> 12
...
...
@@ -128,6 +130,7 @@ int8_t polar_decoder(
for
(
int
k
=
0
;
k
<
(
polarParams
->
n
+
1
);
k
++
)
{
bit
[
j
][
k
][
i
+
currentListSize
]
=
bit
[
j
][
k
][
i
];
llr
[
j
][
k
][
i
+
currentListSize
]
=
llr
[
j
][
k
][
i
];}}}
for
(
int
i
=
0
;
i
<
currentListSize
;
i
++
)
{
bit
[
currentBit
][
0
][
i
]
=
0
;
crcState
[
i
+
currentListSize
]
=
crcState
[
i
];
...
...
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c
View file @
84c3f705
...
...
@@ -20,6 +20,7 @@
*/
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
#define SHOWCOMP 1
void
updateLLR
(
double
***
llr
,
uint8_t
**
llrU
,
uint8_t
***
bit
,
uint8_t
**
bitU
,
uint8_t
listSize
,
uint16_t
row
,
uint16_t
col
,
uint16_t
xlen
,
uint8_t
ylen
,
uint8_t
approximation
)
{
...
...
@@ -29,6 +30,10 @@ void updateLLR(double ***llr, uint8_t **llrU, uint8_t ***bit, uint8_t **bitU,
if
(
bitU
[
row
-
offset
][
col
]
==
0
)
updateBit
(
bit
,
bitU
,
listSize
,
(
row
-
offset
),
col
,
xlen
,
ylen
);
if
(
llrU
[
row
-
offset
][
col
+
1
]
==
0
)
updateLLR
(
llr
,
llrU
,
bit
,
bitU
,
listSize
,
(
row
-
offset
),
(
col
+
1
),
xlen
,
ylen
,
approximation
);
if
(
llrU
[
row
][
col
+
1
]
==
0
)
updateLLR
(
llr
,
llrU
,
bit
,
bitU
,
listSize
,
row
,
(
col
+
1
),
xlen
,
ylen
,
approximation
);
#ifdef SHOWCOMP
printf
(
"updating LLR (%d,%d,%d) (bit %d,%d,%d, llr0 %d,%d,%d, llr1 %d,%d,%d
\n
"
,
row
,
col
,
i
,
row
-
offset
,
col
,
i
,
row
-
offset
,
col
+
1
,
i
,
row
,
col
+
1
,
i
);
#endif
llr
[
row
][
col
][
i
]
=
(
pow
((
-
1
),
bit
[
row
-
offset
][
col
][
i
])
*
llr
[
row
-
offset
][
col
+
1
][
i
])
+
llr
[
row
][
col
+
1
][
i
];
}
else
{
if
(
llrU
[
row
][
col
+
1
]
==
0
)
updateLLR
(
llr
,
llrU
,
bit
,
bitU
,
listSize
,
row
,
(
col
+
1
),
xlen
,
ylen
,
approximation
);
...
...
@@ -48,10 +53,18 @@ void updateBit(uint8_t ***bit, uint8_t **bitU, uint8_t listSize, uint16_t row,
if
((
(
row
)
%
(
2
*
offset
)
)
>=
offset
)
{
if
(
bitU
[
row
][
col
-
1
]
==
0
)
updateBit
(
bit
,
bitU
,
listSize
,
row
,
(
col
-
1
),
xlen
,
ylen
);
bit
[
row
][
col
][
i
]
=
bit
[
row
][
col
-
1
][
i
];
#ifdef SHOWCOMP
printf
(
"updating bit (%d,%d,%d) from (%d,%d,%d)
\n
"
,
row
,
col
,
i
,
row
,
col
-
1
,
i
);
#endif
}
else
{
if
(
bitU
[
row
][
col
-
1
]
==
0
)
updateBit
(
bit
,
bitU
,
listSize
,
row
,
(
col
-
1
),
xlen
,
ylen
);
if
(
bitU
[
row
+
offset
][
col
-
1
]
==
0
)
updateBit
(
bit
,
bitU
,
listSize
,
(
row
+
offset
),
(
col
-
1
),
xlen
,
ylen
);
bit
[
row
][
col
][
i
]
=
(
(
bit
[
row
][
col
-
1
][
i
]
+
bit
[
row
+
offset
][
col
-
1
][
i
])
%
2
);
#ifdef SHOWCOMP
printf
(
"updating bit (%d,%d,%d) from (%d,%d,%d)+(%d,%d,%d)
\n
"
,
row
,
col
,
i
,
row
,
col
-
1
,
i
,
row
+
offset
,
col
-
1
,
i
);
#endif
}
}
...
...
@@ -61,6 +74,11 @@ void updateBit(uint8_t ***bit, uint8_t **bitU, uint8_t listSize, uint16_t row,
void
updatePathMetric
(
double
*
pathMetric
,
double
***
llr
,
uint8_t
listSize
,
uint8_t
bitValue
,
uint16_t
row
,
uint8_t
approximation
)
{
#ifdef SHOWCOMP
printf
(
"updating path_metric from Frozen bit (%d,%d)
\n
"
,
row
,
0
);
#endif
if
(
approximation
)
{
//eq. (12)
for
(
uint8_t
i
=
0
;
i
<
listSize
;
i
++
)
{
if
((
2
*
bitValue
)
!=
(
1
-
copysign
(
1
.
0
,
llr
[
row
][
0
][
i
])
))
pathMetric
[
i
]
+=
fabs
(
llr
[
row
][
0
][
i
]);
...
...
@@ -72,6 +90,7 @@ void updatePathMetric(double *pathMetric, double ***llr, uint8_t listSize, uint8
}
/*
void updatePathMetric2(double *pathMetric, double ***llr, uint8_t listSize, uint16_t row, uint8_t appr) {
double *tempPM = malloc(sizeof(double) * listSize);
...
...
@@ -100,6 +119,35 @@ void updatePathMetric2(double *pathMetric, double ***llr, uint8_t listSize, uint
free(tempPM);
}
*/
void
updatePathMetric2
(
double
*
pathMetric
,
double
***
llr
,
uint8_t
listSize
,
uint16_t
row
,
uint8_t
appr
)
{
double
*
pm2
=&
pathMetric
[
listSize
];
memcpy
((
void
*
)
pm2
,(
void
*
)
pathMetric
,
listSize
*
sizeof
(
double
*
));
int
i
;
#ifdef SHOWCOMP
printf
(
"updating path_metric from information bit (%d,%d)
\n
"
,
row
,
0
);
#endif
if
(
appr
)
{
//eq. (12)
for
(
i
=
0
;
i
<
listSize
;
i
++
)
{
// bitValue=0
if
(
llr
[
row
][
0
][
i
]
<
0
)
pathMetric
[
i
]
-=
llr
[
row
][
0
][
i
];
// bitValue=1
else
pm2
[
i
]
+=
llr
[
row
][
0
][
i
];
}
}
else
{
//eq. (11b)
for
(
i
=
0
;
i
<
listSize
;
i
++
)
{
// bitValue=0
pathMetric
[
i
]
+=
log
(
1
+
exp
(
-
llr
[
row
][
0
][
i
]));
// bitValue=1
pm2
[
i
]
+=
log
(
1
+
exp
(
llr
[
row
][
0
][
i
]));
}
}
}
void
computeLLR
(
double
***
llr
,
uint16_t
row
,
uint16_t
col
,
uint8_t
i
,
uint16_t
offset
,
uint8_t
approximation
)
{
...
...
@@ -108,7 +156,9 @@ void computeLLR(double ***llr, uint16_t row, uint16_t col, uint8_t i,
double
absA
=
fabs
(
a
);
double
b
=
llr
[
row
+
offset
][
col
+
1
][
i
];
double
absB
=
fabs
(
b
);
#ifdef SHOWCOMP
printf
(
"computeLLR (%d,%d,%d,%d)
\n
"
,
row
,
col
,
offset
,
i
);
#endif
if
(
approximation
||
isinf
(
absA
)
||
isinf
(
absB
))
{
//eq. (9)
llr
[
row
][
col
][
i
]
=
copysign
(
1
.
0
,
a
)
*
copysign
(
1
.
0
,
b
)
*
fmin
(
absA
,
absB
);
}
else
{
//eq. (8a)
...
...
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