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
Michael Black
OpenXG-RAN
Commits
1982ea9d
Commit
1982ea9d
authored
May 26, 2023
by
rmagueta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract the information bits from U
parent
41d88e9f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
165 additions
and
30 deletions
+165
-30
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
+119
-28
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
+8
-0
openair1/PHY/CODING/nrPolar_tools/nr_polar_procedures.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_procedures.c
+38
-2
No files found.
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
View file @
1982ea9d
...
@@ -39,6 +39,8 @@
...
@@ -39,6 +39,8 @@
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
#include "assertions.h"
#include "assertions.h"
//#define POLAR_CODING_DEBUG
static
inline
void
updateCrcChecksum2
(
int
xlen
,
static
inline
void
updateCrcChecksum2
(
int
xlen
,
int
ylen
,
int
ylen
,
uint8_t
crcChecksum
[
xlen
][
ylen
],
uint8_t
crcChecksum
[
xlen
][
ylen
],
...
@@ -611,6 +613,19 @@ uint32_t polar_decoder_int16(int16_t *input,
...
@@ -611,6 +613,19 @@ uint32_t polar_decoder_int16(int16_t *input,
uint8_t
aggregation_level
)
uint8_t
aggregation_level
)
{
{
t_nrPolar_params
*
polarParams
=
nr_polar_params
(
messageType
,
messageLength
,
aggregation_level
,
true
);
t_nrPolar_params
*
polarParams
=
nr_polar_params
(
messageType
,
messageLength
,
aggregation_level
,
true
);
#ifdef POLAR_CODING_DEBUG
printf
(
"
\n
RX
\n
"
);
printf
(
"rm:"
);
for
(
int
i
=
0
;
i
<
polarParams
->
N
;
i
++
)
{
if
(
i
%
4
==
0
)
{
printf
(
" "
);
}
printf
(
"%i"
,
input
[
i
]
<
0
?
1
:
0
);
}
printf
(
"
\n
"
);
#endif
int16_t
d_tilde
[
polarParams
->
N
];
// = malloc(sizeof(double) * polarParams->N);
int16_t
d_tilde
[
polarParams
->
N
];
// = malloc(sizeof(double) * polarParams->N);
nr_polar_rate_matching_int16
(
input
,
d_tilde
,
polarParams
->
rate_matching_pattern
,
polarParams
->
K
,
polarParams
->
N
,
polarParams
->
encoderLength
,
polarParams
->
i_bil
);
nr_polar_rate_matching_int16
(
input
,
d_tilde
,
polarParams
->
rate_matching_pattern
,
polarParams
->
K
,
polarParams
->
N
,
polarParams
->
encoderLength
,
polarParams
->
i_bil
);
...
@@ -619,36 +634,97 @@ uint32_t polar_decoder_int16(int16_t *input,
...
@@ -619,36 +634,97 @@ uint32_t polar_decoder_int16(int16_t *input,
else
if
(
d_tilde
[
i
]
>
127
)
d_tilde
[
i
]
=
128
;
else
if
(
d_tilde
[
i
]
>
127
)
d_tilde
[
i
]
=
128
;
}
}
memcpy
((
void
*
)
&
polarParams
->
tree
.
root
->
alpha
[
0
],(
void
*
)
&
d_tilde
[
0
],
sizeof
(
int16_t
)
*
polarParams
->
N
);
#ifdef POLAR_CODING_DEBUG
generic_polar_decoder
(
polarParams
,
polarParams
->
tree
.
root
);
printf
(
"d: "
);
//Extract the information bits (û to ĉ)
for
(
int
i
=
0
;
i
<
polarParams
->
N
;
i
++
)
{
uint64_t
Cprime
[
4
]
=
{
0
,
0
,
0
,
0
};
if
(
i
%
4
==
0
)
{
uint64_t
B
[
4
]
=
{
0
,
0
,
0
,
0
};
printf
(
" "
);
}
for
(
int
i
=
0
;
i
<
polarParams
->
K
;
i
++
)
Cprime
[
i
>>
6
]
=
Cprime
[
i
>>
6
]
|
((
uint64_t
)
polarParams
->
nr_polar_U
[
polarParams
->
Q_I_N
[
i
]])
<<
(
i
&
63
);
printf
(
"%i"
,
d_tilde
[
i
]
<
0
?
1
:
0
);
}
//Deinterleaving (ĉ to b)
printf
(
"
\n
"
);
uint8_t
*
Cprimebyte
=
(
uint8_t
*
)
Cprime
;
#endif
if
(
polarParams
->
K
<
65
)
{
memcpy
((
void
*
)
&
polarParams
->
tree
.
root
->
alpha
[
0
],
(
void
*
)
&
d_tilde
[
0
],
sizeof
(
int16_t
)
*
polarParams
->
N
);
B
[
0
]
=
polarParams
->
B_tab0
[
0
][
Cprimebyte
[
0
]]
|
memset
(
polarParams
->
nr_polar_U
,
0
,
polarParams
->
N
*
sizeof
(
uint8_t
));
polarParams
->
B_tab0
[
1
][
Cprimebyte
[
1
]]
|
generic_polar_decoder
(
polarParams
,
polarParams
->
tree
.
root
);
polarParams
->
B_tab0
[
2
][
Cprimebyte
[
2
]]
|
polarParams
->
B_tab0
[
3
][
Cprimebyte
[
3
]]
|
#ifdef POLAR_CODING_DEBUG
polarParams
->
B_tab0
[
4
][
Cprimebyte
[
4
]]
|
printf
(
"u: "
);
polarParams
->
B_tab0
[
5
][
Cprimebyte
[
5
]]
|
for
(
int
i
=
0
;
i
<
polarParams
->
N
;
i
++
)
{
polarParams
->
B_tab0
[
6
][
Cprimebyte
[
6
]]
|
if
(
i
%
4
==
0
)
{
polarParams
->
B_tab0
[
7
][
Cprimebyte
[
7
]];
printf
(
" "
);
}
else
if
(
polarParams
->
K
<
129
)
{
}
int
len
=
polarParams
->
K
/
8
;
printf
(
"%i"
,
polarParams
->
nr_polar_U
[
i
]);
}
if
((
polarParams
->
K
&
7
)
>
0
)
len
++
;
printf
(
"
\n
"
);
#endif
for
(
int
k
=
0
;
k
<
len
;
k
++
)
{
B
[
0
]
|=
polarParams
->
B_tab0
[
k
][
Cprimebyte
[
k
]];
// Extract the information bits (û to ĉ)
B
[
1
]
|=
polarParams
->
B_tab1
[
k
][
Cprimebyte
[
k
]];
uint64_t
Cprime
[
4
]
=
{
0
};
nr_polar_info_extraction_from_u
(
Cprime
,
polarParams
->
nr_polar_U
,
polarParams
->
information_bit_pattern
,
polarParams
->
parity_check_bit_pattern
,
polarParams
->
N
,
polarParams
->
K
,
polarParams
->
n_pc
);
#ifdef POLAR_CODING_DEBUG
int
B_array
=
(
polarParams
->
K
+
63
)
>>
6
;
int
n_start
=
(
B_array
<<
6
)
-
polarParams
->
K
;
printf
(
"c: "
);
for
(
int
n
=
0
;
n
<
polarParams
->
K
;
n
++
)
{
if
(
n
%
4
==
0
)
{
printf
(
" "
);
}
int
n1
=
(
n
+
n_start
)
>>
6
;
int
n2
=
(
n
+
n_start
)
-
(
n1
<<
6
);
printf
(
"%lu"
,
(
Cprime
[
B_array
-
1
-
n1
]
>>
(
63
-
n2
))
&
1
);
}
printf
(
"
\n
"
);
#endif
// Deinterleaving (ĉ to b)
uint64_t
B
[
4
]
=
{
0
};
if
(
polarParams
->
i_il
==
0
)
{
memcpy
(
B
,
Cprime
,
sizeof
(
Cprime
));
}
else
{
uint8_t
*
Cprimebyte
=
(
uint8_t
*
)
Cprime
;
if
(
polarParams
->
K
<
65
)
{
B
[
0
]
=
polarParams
->
B_tab0
[
0
][
Cprimebyte
[
0
]]
|
polarParams
->
B_tab0
[
1
][
Cprimebyte
[
1
]]
|
polarParams
->
B_tab0
[
2
][
Cprimebyte
[
2
]]
|
polarParams
->
B_tab0
[
3
][
Cprimebyte
[
3
]]
|
polarParams
->
B_tab0
[
4
][
Cprimebyte
[
4
]]
|
polarParams
->
B_tab0
[
5
][
Cprimebyte
[
5
]]
|
polarParams
->
B_tab0
[
6
][
Cprimebyte
[
6
]]
|
polarParams
->
B_tab0
[
7
][
Cprimebyte
[
7
]];
}
else
if
(
polarParams
->
K
<
129
)
{
int
len
=
polarParams
->
K
/
8
;
if
((
polarParams
->
K
&
7
)
>
0
)
len
++
;
for
(
int
k
=
0
;
k
<
len
;
k
++
)
{
B
[
0
]
|=
polarParams
->
B_tab0
[
k
][
Cprimebyte
[
k
]];
B
[
1
]
|=
polarParams
->
B_tab1
[
k
][
Cprimebyte
[
k
]];
}
}
}
#ifdef POLAR_CODING_DEBUG
printf
(
"b: "
);
for
(
int
n
=
0
;
n
<
polarParams
->
K
;
n
++
)
{
if
(
n
%
4
==
0
)
{
printf
(
" "
);
}
}
int
n1
=
(
n
+
n_start
)
>>
6
;
int
n2
=
(
n
+
n_start
)
-
(
n1
<<
6
);
printf
(
"%lu"
,
(
B
[
B_array
-
1
-
n1
]
>>
(
63
-
n2
))
&
1
);
}
}
printf
(
"
\n
"
);
#endif
int
len
=
polarParams
->
payloadBits
;
int
len
=
polarParams
->
payloadBits
;
//int len_mod64=len&63;
//int len_mod64=len&63;
...
@@ -700,6 +776,21 @@ uint32_t polar_decoder_int16(int16_t *input,
...
@@ -700,6 +776,21 @@ uint32_t polar_decoder_int16(int16_t *input,
else
if
(
crclen
==
6
)
crc
=
(
uint64_t
)(
crc6
(
A64_flip
,
8
*
offset
+
len
)
>>
26
)
&
0x3f
;
else
if
(
crclen
==
6
)
crc
=
(
uint64_t
)(
crc6
(
A64_flip
,
8
*
offset
+
len
)
>>
26
)
&
0x3f
;
}
}
#ifdef POLAR_CODING_DEBUG
int
A_array
=
(
len
+
63
)
>>
6
;
printf
(
"a: "
);
for
(
int
n
=
0
;
n
<
len
;
n
++
)
{
if
(
n
%
4
==
0
)
{
printf
(
" "
);
}
int
n1
=
n
>>
6
;
int
n2
=
n
-
(
n1
<<
6
);
int
alen
=
n1
==
0
?
len
-
(
A_array
<<
6
)
:
64
;
printf
(
"%lu"
,
(
Ar
>>
(
alen
-
1
-
n2
))
&
1
);
}
printf
(
"
\n\n
"
);
#endif
#if 0
#if 0
printf("A %llx B %llx|%llx Cprime %llx|%llx (crc %x,rxcrc %llx %d)\n",
printf("A %llx B %llx|%llx Cprime %llx|%llx (crc %x,rxcrc %llx %d)\n",
Ar,
Ar,
...
...
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
View file @
1982ea9d
...
@@ -287,6 +287,14 @@ void nr_polar_generate_u(uint64_t *u,
...
@@ -287,6 +287,14 @@ void nr_polar_generate_u(uint64_t *u,
void
nr_polar_uxG
(
uint64_t
*
D
,
const
uint64_t
*
u
,
const
uint64_t
**
G_N_tab
,
uint16_t
N
);
void
nr_polar_uxG
(
uint64_t
*
D
,
const
uint64_t
*
u
,
const
uint64_t
**
G_N_tab
,
uint16_t
N
);
void
nr_polar_info_extraction_from_u
(
uint64_t
*
Cprime
,
const
uint8_t
*
u
,
const
uint8_t
*
information_bit_pattern
,
const
uint8_t
*
parity_check_bit_pattern
,
uint16_t
N
,
uint16_t
bitlen_Cprime
,
uint8_t
n_pc
);
void
nr_polar_bit_insertion
(
uint8_t
*
input
,
void
nr_polar_bit_insertion
(
uint8_t
*
input
,
uint8_t
*
output
,
uint8_t
*
output
,
uint16_t
N
,
uint16_t
N
,
...
...
openair1/PHY/CODING/nrPolar_tools/nr_polar_procedures.c
View file @
1982ea9d
...
@@ -89,6 +89,42 @@ void nr_polar_generate_u(uint64_t *u,
...
@@ -89,6 +89,42 @@ void nr_polar_generate_u(uint64_t *u,
}
}
}
}
void
nr_polar_info_extraction_from_u
(
uint64_t
*
Cprime
,
const
uint8_t
*
u
,
const
uint8_t
*
information_bit_pattern
,
const
uint8_t
*
parity_check_bit_pattern
,
uint16_t
N
,
uint16_t
bitlen_Cprime
,
uint8_t
n_pc
)
{
int
K_array
=
(
bitlen_Cprime
+
63
)
>>
6
;
int
k_start
=
(
K_array
<<
6
)
-
bitlen_Cprime
;
int
k
=
0
;
if
(
n_pc
>
0
)
{
for
(
int
n
=
0
;
n
<
N
;
n
++
)
{
if
(
information_bit_pattern
[
n
]
==
1
)
{
if
(
parity_check_bit_pattern
[
n
]
==
0
)
{
int
k1
=
(
k
+
k_start
)
>>
6
;
int
k2
=
(
k
+
k_start
)
-
(
k1
<<
6
);
Cprime
[
K_array
-
1
-
k1
]
|=
(
uint64_t
)
u
[
n
]
<<
(
63
-
k2
);
k
++
;
}
}
}
}
else
{
for
(
int
n
=
0
;
n
<
N
;
n
++
)
{
if
(
information_bit_pattern
[
n
]
==
1
)
{
int
k1
=
(
k
+
k_start
)
>>
6
;
int
k2
=
(
k
+
k_start
)
-
(
k1
<<
6
);
Cprime
[
K_array
-
1
-
k1
]
|=
(
uint64_t
)
u
[
n
]
<<
(
63
-
k2
);
k
++
;
}
}
}
}
void
nr_polar_uxG
(
uint64_t
*
D
,
const
uint64_t
*
u
,
const
uint64_t
**
G_N_tab
,
uint16_t
N
)
void
nr_polar_uxG
(
uint64_t
*
D
,
const
uint64_t
*
u
,
const
uint64_t
**
G_N_tab
,
uint16_t
N
)
{
{
int
N_array
=
N
>>
6
;
int
N_array
=
N
>>
6
;
...
@@ -449,7 +485,7 @@ void nr_polar_rm_deinterleaving_cb(const int16_t *in, int16_t *out, const uint16
...
@@ -449,7 +485,7 @@ void nr_polar_rm_deinterleaving_cb(const int16_t *in, int16_t *out, const uint16
for
(
int
j
=
0
;
j
<
T
;
j
++
)
{
for
(
int
j
=
0
;
j
<
T
;
j
++
)
{
for
(
int
i
=
0
;
i
<
T
-
j
;
i
++
)
{
for
(
int
i
=
0
;
i
<
T
-
j
;
i
++
)
{
if
(
k
<
E
&&
v_tab
[
i
][
j
]
!=
0
)
{
if
(
k
<
E
&&
v_tab
[
i
][
j
]
!=
0
)
{
v
[
i
][
j
]
=
in
[
E
-
1
-
k
];
v
[
i
][
j
]
=
in
[
k
];
k
++
;
k
++
;
}
else
{
}
else
{
v
[
i
][
j
]
=
INT_MAX
;
v
[
i
][
j
]
=
INT_MAX
;
...
@@ -462,7 +498,7 @@ void nr_polar_rm_deinterleaving_cb(const int16_t *in, int16_t *out, const uint16
...
@@ -462,7 +498,7 @@ void nr_polar_rm_deinterleaving_cb(const int16_t *in, int16_t *out, const uint16
for
(
int
i
=
0
;
i
<
T
;
i
++
)
{
for
(
int
i
=
0
;
i
<
T
;
i
++
)
{
for
(
int
j
=
0
;
j
<
T
-
i
;
j
++
)
{
for
(
int
j
=
0
;
j
<
T
-
i
;
j
++
)
{
if
(
v
[
i
][
j
]
!=
INT_MAX
)
{
if
(
v
[
i
][
j
]
!=
INT_MAX
)
{
out
[
E
-
1
-
k
]
=
v
[
i
][
j
];
out
[
k
]
=
v
[
i
][
j
];
k
++
;
k
++
;
}
}
}
}
...
...
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