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
promise
OpenXG-RAN
Commits
59c4ddef
Commit
59c4ddef
authored
Oct 01, 2018
by
Raymond Knopp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
completed most of code generation tool for polar decoder integrated into "polartest"
parent
8cda0a0f
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
186 additions
and
176 deletions
+186
-176
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
+110
-93
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c
+74
-81
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
+2
-2
No files found.
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
View file @
59c4ddef
...
@@ -30,7 +30,6 @@
...
@@ -30,7 +30,6 @@
#include "PHY/TOOLS/time_meas.h"
#include "PHY/TOOLS/time_meas.h"
int8_t
polar_decoder
(
int8_t
polar_decoder
(
double
*
input
,
double
*
input
,
uint8_t
*
output
,
uint8_t
*
output
,
...
@@ -294,6 +293,92 @@ int8_t polar_decoder(
...
@@ -294,6 +293,92 @@ int8_t polar_decoder(
}
}
#define decoder_int8_A(sorted_dlist,currentListSize,polarParams) {for (int i = 0; i < currentListSize; i++) { \
for (int k = 0; k < (polarParams->n+1); k++) { \
memcpy((void*)&sorted_dlist[i+currentListSize]->bit[k][0],\
(void*)&sorted_dlist[i]->bit[k][0],\
sizeof(uint8_t)*polarParams->N);\
memcpy((void*)&sorted_dlist[i+currentListSize]->llr[k][0],\
(void*)&sorted_dlist[i]->llr[k][0],\
sizeof(int16_t)*polarParams->N);}}}
#define decoder_int8_B(sorted_dlist,currentListSize) {for (int i = 0; i < currentListSize; i++) {sorted_dlist[i]->bit[0][currentBit]=0;sorted_dlist[i+currentListSize]->bit[0][currentBit]=1;}}
void
inline
decoder_int8_C
(
decoder_list_int8_t
*
sorted_dlist
[],
t_nrPolar_params
*
polarParams
,
int
currentBit
,
int
currentListSize
,
int
listSize
)
{
int32_t
pathMetric
[
2
*
listSize
];
decoder_list_int8_t
*
temp_dlist
[
2
*
listSize
];
int
listIndex
[
2
*
listSize
];
int
listIndex2
[
2
*
listSize
];
for
(
int
i
=
0
;
i
<
currentListSize
;
i
++
)
{
listIndex
[
i
]
=
i
;
pathMetric
[
i
]
=
sorted_dlist
[
i
]
->
pathMetric
;
}
nr_sort_asc_int16_1D_array_ind
(
pathMetric
,
listIndex
,
currentListSize
);
for
(
int
i
=
0
;
i
<
currentListSize
;
i
++
)
{
listIndex2
[
listIndex
[
i
]]
=
i
;
}
// copy the llr/bit arrays that are needed
for
(
int
i
=
0
;
i
<
listSize
;
i
++
)
{
// printf("listIndex[%d] %d\n",i,listIndex[i]);
if
((
listIndex2
[
i
+
listSize
]
<
listSize
)
&&
(
listIndex2
[
i
]
<
listSize
))
{
// both '0' and '1' path metrics are to be kept
// do memcpy of LLR and Bit arrays
for
(
int
k
=
0
;
k
<
(
polarParams
->
n
+
1
);
k
++
)
{
memcpy
((
void
*
)
&
sorted_dlist
[
i
+
listSize
]
->
bit
[
k
][
0
],
(
void
*
)
&
sorted_dlist
[
i
]
->
bit
[
k
][
0
],
sizeof
(
uint8_t
)
*
polarParams
->
N
);
memcpy
((
void
*
)
&
sorted_dlist
[
i
+
listSize
]
->
llr
[
k
][
0
],
(
void
*
)
&
sorted_dlist
[
i
]
->
llr
[
k
][
0
],
sizeof
(
int16_t
)
*
polarParams
->
N
);
}
sorted_dlist
[
i
]
->
bit
[
0
][
currentBit
]
=
0
;
sorted_dlist
[
i
+
listSize
]
->
bit
[
0
][
currentBit
]
=
1
;
}
else
if
(
listIndex2
[
i
+
listSize
]
<
listSize
)
{
// only '1' path metric is to be kept
// just change the current bit from '0' to '1'
for
(
int
k
=
0
;
k
<
(
polarParams
->
n
+
1
);
k
++
)
{
memcpy
((
void
*
)
&
sorted_dlist
[
i
+
listSize
]
->
bit
[
k
][
0
],
(
void
*
)
&
sorted_dlist
[
i
]
->
bit
[
k
][
0
],
sizeof
(
uint8_t
)
*
polarParams
->
N
);
memcpy
((
void
*
)
&
sorted_dlist
[
i
+
listSize
]
->
llr
[
k
][
0
],
(
void
*
)
&
sorted_dlist
[
i
]
->
llr
[
k
][
0
],
sizeof
(
int16_t
)
*
polarParams
->
N
);
}
sorted_dlist
[
i
+
listSize
]
->
bit
[
0
][
currentBit
]
=
1
;
/*
decoder_list_t *tmp = sorted_dlist[i+listSize];
sorted_dlist[i+listSize] = sorted_dlist[i];
sorted_dlist[i+listSize]->pathMetric = tmp->pathMetric;
sorted_dlist[i+listSize]->bit[0][currentBit]=1;
memcpy((void*)&sorted_dlist[i+listSize]->crcChecksum[0],
(void*)&tmp->crcChecksum[0],
24*sizeof(uint8_t));*/
}
}
for
(
int
i
=
0
;
i
<
2
*
listSize
;
i
++
)
{
temp_dlist
[
i
]
=
sorted_dlist
[
i
];
}
for
(
int
i
=
0
;
i
<
2
*
listSize
;
i
++
)
{
// printf("i %d => %d\n",i,listIndex[i]);
sorted_dlist
[
i
]
=
temp_dlist
[
listIndex
[
i
]];
}
}
int8_t
polar_decoder_int8
(
int16_t
*
input
,
int8_t
polar_decoder_int8
(
int16_t
*
input
,
uint8_t
*
output
,
uint8_t
*
output
,
t_nrPolar_params
*
polarParams
,
t_nrPolar_params
*
polarParams
,
...
@@ -380,9 +465,6 @@ int8_t polar_decoder_int8(int16_t *input,
...
@@ -380,9 +465,6 @@ int8_t polar_decoder_int8(int16_t *input,
uint8_t
currentListSize
=
1
;
uint8_t
currentListSize
=
1
;
decoder_list_int8_t
*
sorted_dlist
[
2
*
listSize
];
decoder_list_int8_t
*
sorted_dlist
[
2
*
listSize
];
decoder_list_int8_t
*
temp_dlist
[
2
*
listSize
];
int
listIndex
[
2
*
listSize
];
int32_t
pathMetric
[
2
*
listSize
];
for
(
uint8_t
i
=
0
;
i
<
2
*
listSize
;
i
++
)
sorted_dlist
[
i
]
=
&
dlist
[
i
];
for
(
uint8_t
i
=
0
;
i
<
2
*
listSize
;
i
++
)
sorted_dlist
[
i
]
=
&
dlist
[
i
];
...
@@ -403,101 +485,36 @@ int8_t polar_decoder_int8(int16_t *input,
...
@@ -403,101 +485,36 @@ int8_t polar_decoder_int8(int16_t *input,
start_meas
(
sorting
);
start_meas
(
sorting
);
// for (int i=0;i<currentListSize;i++) {
// printf("sorted_dlist[%d] pathmetric %d\n",i,sorted_dlist[i]->pathMetric);
// }
if
(
currentListSize
<=
listSize
/
2
)
{
if
(
currentListSize
<=
listSize
/
2
)
{
// until listsize is full we need to copy bit and LLR arrays to new entries
// until listsize is full we need to copy bit and LLR arrays to new entries
// below we only copy the ones we need to keep for sure
// below we only copy the ones we need to keep for sure
decoder_int8_A
(
sorted_dlist
,
currentListSize
,
polarParams
);
for
(
int
i
=
0
;
i
<
currentListSize
;
i
++
)
{
#ifdef SHOWCOMP
for
(
int
k
=
0
;
k
<
(
polarParams
->
n
+
1
);
k
++
)
{
printf
(
"decoder_int8_A(sorted_dlist,%d,polarParams);
\n
"
,
currentListSize
);
#endif
memcpy
((
void
*
)
&
sorted_dlist
[
i
+
currentListSize
]
->
bit
[
k
][
0
],
(
void
*
)
&
sorted_dlist
[
i
]
->
bit
[
k
][
0
],
sizeof
(
uint8_t
)
*
polarParams
->
N
);
memcpy
((
void
*
)
&
sorted_dlist
[
i
+
currentListSize
]
->
llr
[
k
][
0
],
(
void
*
)
&
sorted_dlist
[
i
]
->
llr
[
k
][
0
],
sizeof
(
int16_t
)
*
polarParams
->
N
);
}
}
}
}
decoder_int8_B
(
sorted_dlist
,
currentListSize
);
#ifdef SHOWCOMP
printf
(
"decoder_int8_B(sorted_dlist,%d);
\n
"
,
currentListSize
);
#endif
for
(
int
i
=
0
;
i
<
currentListSize
;
i
++
)
{
sorted_dlist
[
i
]
->
bit
[
0
][
currentBit
]
=
0
;
sorted_dlist
[
i
+
currentListSize
]
->
bit
[
0
][
currentBit
]
=
1
;
}
bitUpdated
[
currentBit
][
0
]
=
1
;
bitUpdated
[
currentBit
][
0
]
=
1
;
updateCrcChecksum2_int8
(
sorted_dlist
,
extended_crc_generator_matrix
,
currentListSize
,
nonFrozenBit
,
polarParams
->
crcParityBits
);
updateCrcChecksum2_int8
(
sorted_dlist
,
extended_crc_generator_matrix
,
currentListSize
,
nonFrozenBit
,
polarParams
->
crcParityBits
);
currentListSize
*=
2
;
currentListSize
*=
2
;
//Keep only the best "listSize" number of entries.
//Keep only the best "listSize" number of entries.
if
(
currentListSize
>
listSize
)
{
if
(
currentListSize
>
listSize
)
{
int
listIndex2
[
listSize
];
for
(
int
i
=
0
;
i
<
currentListSize
;
i
++
)
{
listIndex
[
i
]
=
i
;
pathMetric
[
i
]
=
sorted_dlist
[
i
]
->
pathMetric
;
}
nr_sort_asc_int16_1D_array_ind
(
pathMetric
,
listIndex
,
currentListSize
);
for
(
int
i
=
0
;
i
<
currentListSize
;
i
++
)
{
listIndex2
[
listIndex
[
i
]]
=
i
;
}
// copy the llr/bit arrays that are needed
for
(
int
i
=
0
;
i
<
listSize
;
i
++
)
{
// printf("listIndex[%d] %d\n",i,listIndex[i]);
if
((
listIndex2
[
i
+
listSize
]
<
listSize
)
&&
(
listIndex2
[
i
]
<
listSize
))
{
// both '0' and '1' path metrics are to be kept
// do memcpy of LLR and Bit arrays
for
(
int
k
=
0
;
k
<
(
polarParams
->
n
+
1
);
k
++
)
{
memcpy
((
void
*
)
&
sorted_dlist
[
i
+
listSize
]
->
bit
[
k
][
0
],
(
void
*
)
&
sorted_dlist
[
i
]
->
bit
[
k
][
0
],
sizeof
(
uint8_t
)
*
polarParams
->
N
);
memcpy
((
void
*
)
&
sorted_dlist
[
i
+
listSize
]
->
llr
[
k
][
0
],
(
void
*
)
&
sorted_dlist
[
i
]
->
llr
[
k
][
0
],
sizeof
(
int16_t
)
*
polarParams
->
N
);
}
sorted_dlist
[
i
]
->
bit
[
0
][
currentBit
]
=
0
;
sorted_dlist
[
i
+
listSize
]
->
bit
[
0
][
currentBit
]
=
1
;
}
else
if
(
listIndex2
[
i
+
listSize
]
<
listSize
)
{
// only '1' path metric is to be kept
// just change the current bit from '0' to '1'
for
(
int
k
=
0
;
k
<
(
polarParams
->
n
+
1
);
k
++
)
{
memcpy
((
void
*
)
&
sorted_dlist
[
i
+
listSize
]
->
bit
[
k
][
0
],
(
void
*
)
&
sorted_dlist
[
i
]
->
bit
[
k
][
0
],
sizeof
(
uint8_t
)
*
polarParams
->
N
);
memcpy
((
void
*
)
&
sorted_dlist
[
i
+
listSize
]
->
llr
[
k
][
0
],
(
void
*
)
&
sorted_dlist
[
i
]
->
llr
[
k
][
0
],
sizeof
(
int16_t
)
*
polarParams
->
N
);
}
sorted_dlist
[
i
+
listSize
]
->
bit
[
0
][
currentBit
]
=
1
;
/*
decoder_list_t *tmp = sorted_dlist[i+listSize];
sorted_dlist[i+listSize] = sorted_dlist[i];
sorted_dlist[i+listSize]->pathMetric = tmp->pathMetric;
sorted_dlist[i+listSize]->bit[0][currentBit]=1;
memcpy((void*)&sorted_dlist[i+listSize]->crcChecksum[0],
(void*)&tmp->crcChecksum[0],
24*sizeof(uint8_t));*/
}
}
decoder_int8_C
(
sorted_dlist
,
polarParams
,
currentBit
,
currentListSize
,
listSize
);
currentListSize
=
listSize
;
currentListSize
=
listSize
;
for
(
int
i
=
0
;
i
<
2
*
listSize
;
i
++
)
{
temp_dlist
[
i
]
=
sorted_dlist
[
i
];
}
for
(
int
i
=
0
;
i
<
2
*
listSize
;
i
++
)
{
// printf("i %d => %d\n",i,listIndex[i]);
sorted_dlist
[
i
]
=
temp_dlist
[
listIndex
[
i
]];
}
}
}
stop_meas
(
sorting
);
stop_meas
(
sorting
);
nonFrozenBit
++
;
nonFrozenBit
++
;
...
...
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c
View file @
59c4ddef
This diff is collapsed.
Click to expand it.
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
View file @
59c4ddef
...
@@ -147,8 +147,8 @@ typedef struct decoder_list_s {
...
@@ -147,8 +147,8 @@ typedef struct decoder_list_s {
typedef
struct
decoder_list_int8_s
{
typedef
struct
decoder_list_int8_s
{
uint8_t
bit
[
1
+
nmax
][
Nmax
];
uint8_t
bit
[
1
+
nmax
][
Nmax
]
__attribute__
((
aligned
(
32
)))
;
int16_t
llr
[
1
+
nmax
][
Nmax
];
int16_t
llr
[
1
+
nmax
][
Nmax
]
__attribute__
((
aligned
(
32
)))
;
uint8_t
crcChecksum
[
24
];
uint8_t
crcChecksum
[
24
];
int32_t
pathMetric
;
int32_t
pathMetric
;
...
...
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