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
b722d92f
Commit
b722d92f
authored
May 25, 2023
by
rmagueta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract the information bits from U
parent
fb7d4dc4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
148 additions
and
9 deletions
+148
-9
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
+92
-6
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
+7
-0
openair1/PHY/CODING/nrPolar_tools/nr_polar_procedures.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_procedures.c
+35
-2
openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c
openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c
+14
-1
No files found.
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
View file @
b722d92f
...
...
@@ -39,6 +39,8 @@
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
#include "assertions.h"
//#define POLAR_CODING_DEBUG
static
inline
void
updateCrcChecksum2
(
int
xlen
,
int
ylen
,
uint8_t
crcChecksum
[
xlen
][
ylen
],
...
...
@@ -611,6 +613,19 @@ uint32_t polar_decoder_int16(int16_t *input,
uint8_t
aggregation_level
)
{
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);
nr_polar_rate_matching_int16
(
input
,
d_tilde
,
polarParams
->
rate_matching_pattern
,
polarParams
->
K
,
polarParams
->
N
,
polarParams
->
encoderLength
,
polarParams
->
i_bil
);
...
...
@@ -619,16 +634,57 @@ uint32_t polar_decoder_int16(int16_t *input,
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
);
generic_polar_decoder
(
polarParams
,
polarParams
->
tree
.
root
);
//Extract the information bits (û to ĉ)
uint64_t
Cprime
[
4
]
=
{
0
,
0
,
0
,
0
};
uint64_t
B
[
4
]
=
{
0
,
0
,
0
,
0
};
#ifdef POLAR_CODING_DEBUG
printf
(
"d: "
);
for
(
int
i
=
0
;
i
<
polarParams
->
N
;
i
++
)
{
if
(
i
%
4
==
0
)
{
printf
(
" "
);
}
printf
(
"%i"
,
d_tilde
[
i
]
<
0
?
1
:
0
);
}
printf
(
"
\n
"
);
#endif
memcpy
((
void
*
)
&
polarParams
->
tree
.
root
->
alpha
[
0
],
(
void
*
)
&
d_tilde
[
0
],
sizeof
(
int16_t
)
*
polarParams
->
N
);
memset
(
polarParams
->
nr_polar_U
,
0
,
polarParams
->
N
*
sizeof
(
uint8_t
));
generic_polar_decoder
(
polarParams
,
polarParams
->
tree
.
root
);
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
);
#ifdef POLAR_CODING_DEBUG
printf
(
"u: "
);
for
(
int
i
=
0
;
i
<
polarParams
->
N
;
i
++
)
{
if
(
i
%
4
==
0
)
{
printf
(
" "
);
}
printf
(
"%i"
,
polarParams
->
nr_polar_U
[
i
]);
}
printf
(
"
\n
"
);
#endif
// Extract the information bits (û to ĉ)
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
->
n_pc
);
#ifdef POLAR_CODING_DEBUG
printf
(
"c: "
);
for
(
int
n
=
0
;
n
<
polarParams
->
K
;
n
++
)
{
if
(
n
%
4
==
0
)
{
printf
(
" "
);
}
int
n1
=
n
>>
6
;
int
n2
=
n
-
(
n1
<<
6
);
printf
(
"%lu"
,
(
Cprime
[
n1
]
>>
n2
)
&
1
);
}
printf
(
"
\n
"
);
#endif
//Deinterleaving (ĉ to b)
uint8_t
*
Cprimebyte
=
(
uint8_t
*
)
Cprime
;
uint64_t
B
[
4
]
=
{
0
};
if
(
polarParams
->
K
<
65
)
{
B
[
0
]
=
polarParams
->
B_tab0
[
0
][
Cprimebyte
[
0
]]
|
...
...
@@ -650,6 +706,21 @@ uint32_t polar_decoder_int16(int16_t *input,
}
}
#ifdef POLAR_CODING_DEBUG
int
B_array
=
(
polarParams
->
K
+
63
)
>>
6
;
int
n_start
=
(
B_array
<<
6
)
-
polarParams
->
K
;
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_mod64=len&63;
int
crclen
=
polarParams
->
crcParityBits
;
...
...
@@ -700,6 +771,21 @@ uint32_t polar_decoder_int16(int16_t *input,
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
printf("A %llx B %llx|%llx Cprime %llx|%llx (crc %x,rxcrc %llx %d)\n",
Ar,
...
...
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
View file @
b722d92f
...
...
@@ -286,6 +286,13 @@ 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_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
,
uint8_t
n_pc
);
void
nr_polar_bit_insertion
(
uint8_t
*
input
,
uint8_t
*
output
,
uint16_t
N
,
...
...
openair1/PHY/CODING/nrPolar_tools/nr_polar_procedures.c
View file @
b722d92f
...
...
@@ -86,6 +86,39 @@ 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
,
uint8_t
n_pc
)
{
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
>>
6
;
int
k2
=
k
-
(
k1
<<
6
);
Cprime
[
k1
]
|=
(
uint64_t
)
u
[
n
]
<<
k2
;
k
++
;
}
}
}
}
else
{
for
(
int
n
=
0
;
n
<
N
;
n
++
)
{
if
(
information_bit_pattern
[
n
]
==
1
)
{
int
k1
=
k
>>
6
;
int
k2
=
k
-
(
k1
<<
6
);
Cprime
[
k1
]
|=
(
uint64_t
)
u
[
n
]
<<
k2
;
k
++
;
}
}
}
}
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
;
...
...
@@ -446,7 +479,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
i
=
0
;
i
<
T
-
j
;
i
++
)
{
if
(
k
<
E
&&
v_tab
[
i
][
j
]
!=
0
)
{
v
[
i
][
j
]
=
in
[
E
-
1
-
k
];
v
[
i
][
j
]
=
in
[
k
];
k
++
;
}
else
{
v
[
i
][
j
]
=
INT_MAX
;
...
...
@@ -459,7 +492,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
j
=
0
;
j
<
T
-
i
;
j
++
)
{
if
(
v
[
i
][
j
]
!=
INT_MAX
)
{
out
[
E
-
1
-
k
]
=
v
[
i
][
j
];
out
[
k
]
=
v
[
i
][
j
];
k
++
;
}
}
...
...
openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c
View file @
b722d92f
...
...
@@ -49,6 +49,7 @@
#endif
//#define ONE_OVER_SQRT2 23170 // 32767/sqrt(2) = 23170 (ONE_OVER_SQRT2)
//#define POLAR_CODING_DEBUG
void
nr_generate_pucch0
(
PHY_VARS_NR_UE
*
ue
,
c16_t
**
txdataF
,
...
...
@@ -692,7 +693,19 @@ void nr_generate_pucch2(PHY_VARS_NR_UE *ue,
/*
* Implementing TS 38.211 Subclause 6.3.2.5.1 scrambling format 2
*/
nr_pucch2_3_4_scrambling
(
M_bit
,
rnti
,
pucch_pdu
->
data_scrambling_id
,
&
b
[
0
],
btilde
);
nr_pucch2_3_4_scrambling
(
M_bit
,
rnti
,
pucch_pdu
->
data_scrambling_id
,
b
,
btilde
);
#ifdef POLAR_CODING_DEBUG
printf
(
"bt:"
);
for
(
int
n
=
0
;
n
<
M_bit
;
n
++
)
{
if
(
n
%
4
==
0
)
{
printf
(
" "
);
}
printf
(
"%u"
,
btilde
[
n
]);
}
printf
(
"
\n
"
);
#endif
/*
* Implementing TS 38.211 Subclause 6.3.2.5.2 modulation format 2
* btilde shall be modulated as described in subclause 5.1 using QPSK
...
...
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