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
6798cda3
Commit
6798cda3
authored
Jun 02, 2023
by
rmagueta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Attempt 1
parent
1982ea9d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
88 additions
and
112 deletions
+88
-112
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
+19
-23
openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
+17
-21
openair1/PHY/CODING/nrPolar_tools/nr_polar_procedures.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_procedures.c
+13
-13
openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c
openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c
+39
-55
No files found.
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
View file @
6798cda3
...
...
@@ -687,29 +687,25 @@ uint32_t polar_decoder_int16(int16_t *input,
// 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
]];
}
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
]];
}
}
...
...
openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
View file @
6798cda3
...
...
@@ -279,7 +279,7 @@ void nr_polar_rm_interleaving_cb(void *in, void *out, uint16_t E)
if
(
k
<
E
)
{
int
k1
=
k
>>
6
;
int
k2
=
k
-
(
k1
<<
6
);
v
[
i
][
j
]
=
(
in64
[
N_array
-
1
-
k1
]
>>
(
63
-
k2
)
)
&
1
;
v
[
i
][
j
]
=
(
in64
[
k1
]
>>
k2
)
&
1
;
}
else
{
v
[
i
][
j
]
=
-
1
;
}
...
...
@@ -295,7 +295,7 @@ void nr_polar_rm_interleaving_cb(void *in, void *out, uint16_t E)
if
(
v
[
i
][
j
]
!=
-
1
)
{
int
k1
=
k
>>
6
;
int
k2
=
k
-
(
k1
<<
6
);
out64
[
N_array
-
1
-
k1
]
|=
(
uint64_t
)
v
[
i
][
j
]
<<
(
63
-
k2
)
;
out64
[
k1
]
|=
(
uint64_t
)
v
[
i
][
j
]
<<
k2
;
k
++
;
}
}
...
...
@@ -616,26 +616,22 @@ void polar_encoder_fast(uint64_t *A,
#endif
// TS 38.212 - Section 5.3.1.1 Interleaving
// For each byte of B, lookup in corresponding table for 64-bit word corresponding to that byte and its position
uint64_t
Cprime
[
4
]
=
{
0
};
if
(
polarParams
->
i_il
==
0
)
{
memcpy
(
Cprime
,
B
,
sizeof
(
B
));
}
else
{
// For each byte of B, lookup in corresponding table for 64-bit word corresponding to that byte and its position
uint8_t
*
Bbyte
=
(
uint8_t
*
)
B
;
if
(
polarParams
->
K
<
65
)
{
Cprime
[
0
]
=
polarParams
->
cprime_tab0
[
0
][
Bbyte
[
0
]]
|
polarParams
->
cprime_tab0
[
1
][
Bbyte
[
1
]]
|
polarParams
->
cprime_tab0
[
2
][
Bbyte
[
2
]]
|
polarParams
->
cprime_tab0
[
3
][
Bbyte
[
3
]]
|
polarParams
->
cprime_tab0
[
4
][
Bbyte
[
4
]]
|
polarParams
->
cprime_tab0
[
5
][
Bbyte
[
5
]]
|
polarParams
->
cprime_tab0
[
6
][
Bbyte
[
6
]]
|
polarParams
->
cprime_tab0
[
7
][
Bbyte
[
7
]];
}
else
if
(
polarParams
->
K
<
129
)
{
for
(
int
i
=
0
;
i
<
1
+
(
polarParams
->
K
/
8
);
i
++
)
{
Cprime
[
0
]
|=
polarParams
->
cprime_tab0
[
i
][
Bbyte
[
i
]];
Cprime
[
1
]
|=
polarParams
->
cprime_tab1
[
i
][
Bbyte
[
i
]];
}
uint8_t
*
Bbyte
=
(
uint8_t
*
)
B
;
if
(
polarParams
->
K
<
65
)
{
Cprime
[
0
]
=
polarParams
->
cprime_tab0
[
0
][
Bbyte
[
0
]]
|
polarParams
->
cprime_tab0
[
1
][
Bbyte
[
1
]]
|
polarParams
->
cprime_tab0
[
2
][
Bbyte
[
2
]]
|
polarParams
->
cprime_tab0
[
3
][
Bbyte
[
3
]]
|
polarParams
->
cprime_tab0
[
4
][
Bbyte
[
4
]]
|
polarParams
->
cprime_tab0
[
5
][
Bbyte
[
5
]]
|
polarParams
->
cprime_tab0
[
6
][
Bbyte
[
6
]]
|
polarParams
->
cprime_tab0
[
7
][
Bbyte
[
7
]];
}
else
if
(
polarParams
->
K
<
129
)
{
for
(
int
i
=
0
;
i
<
1
+
(
polarParams
->
K
/
8
);
i
++
)
{
Cprime
[
0
]
|=
polarParams
->
cprime_tab0
[
i
][
Bbyte
[
i
]];
Cprime
[
1
]
|=
polarParams
->
cprime_tab1
[
i
][
Bbyte
[
i
]];
}
}
...
...
openair1/PHY/CODING/nrPolar_tools/nr_polar_procedures.c
View file @
6798cda3
...
...
@@ -64,9 +64,9 @@ void nr_polar_generate_u(uint64_t *u,
if
(
parity_check_bit_pattern
[
n
]
==
1
)
{
u
[
N_array
-
1
-
n1
]
|=
y0
<<
(
63
-
n2
);
}
else
{
int
k1
=
(
k
+
k_start
)
>>
6
;
int
k2
=
(
k
+
k_start
)
-
(
k1
<<
6
);
uint64_t
bit
=
(
Cprime
[
K_array
-
1
-
k1
]
>>
(
63
-
k2
)
)
&
1
;
int
k1
=
k
>>
6
;
int
k2
=
k
-
(
k1
<<
6
);
uint64_t
bit
=
(
Cprime
[
k1
]
>>
k2
)
&
1
;
u
[
N_array
-
1
-
n1
]
|=
bit
<<
(
63
-
n2
);
k
++
;
y0
=
y0
^
(
int
)
bit
;
...
...
@@ -79,9 +79,9 @@ void nr_polar_generate_u(uint64_t *u,
if
(
information_bit_pattern
[
n
]
==
1
)
{
int
n1
=
n
>>
6
;
int
n2
=
n
-
(
n1
<<
6
);
int
k1
=
(
k
+
k_start
)
>>
6
;
int
k2
=
(
k
+
k_start
)
-
(
k1
<<
6
);
uint64_t
bit
=
(
Cprime
[
K_array
-
1
-
k1
]
>>
(
63
-
k2
)
)
&
1
;
int
k1
=
k
>>
6
;
int
k2
=
k
-
(
k1
<<
6
);
uint64_t
bit
=
(
Cprime
[
k1
]
>>
k2
)
&
1
;
u
[
N_array
-
1
-
n1
]
|=
bit
<<
(
63
-
n2
);
k
++
;
}
...
...
@@ -105,9 +105,9 @@ void nr_polar_info_extraction_from_u(uint64_t *Cprime,
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
)
;
int
k1
=
k
>>
6
;
int
k2
=
k
-
(
k1
<<
6
);
Cprime
[
k1
]
|=
(
uint64_t
)
u
[
n
]
<<
k2
;
k
++
;
}
}
...
...
@@ -116,9 +116,9 @@ void nr_polar_info_extraction_from_u(uint64_t *Cprime,
}
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
)
;
int
k1
=
k
>>
6
;
int
k2
=
k
-
(
k1
<<
6
);
Cprime
[
k1
]
|=
(
uint64_t
)
u
[
n
]
<<
k2
;
k
++
;
}
}
...
...
@@ -145,7 +145,7 @@ void nr_polar_uxG(uint64_t *D, const uint64_t *u, const uint64_t **G_N_tab, uint
int
n1
=
n
>>
6
;
int
n2
=
n
-
(
n1
<<
6
);
D
[
N_array
-
1
-
n1
]
|=
bit
<<
(
63
-
n2
)
;
D
[
n1
]
|=
bit
<<
n2
;
}
}
...
...
openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c
View file @
6798cda3
...
...
@@ -806,67 +806,51 @@ void nr_generate_pucch1_old(PHY_VARS_NR_UE *ue,
}
#endif //0
static
inline
void
nr_pucch2_3_4_scrambling
(
uint16_t
M_bit
,
uint16_t
rnti
,
uint16_t
n_id
,
const
uint64_t
*
B64
,
uint8_t
*
btilde
)
__attribute__
((
always_inline
));
static
inline
void
nr_pucch2_3_4_scrambling
(
uint16_t
M_bit
,
uint16_t
rnti
,
uint16_t
n_id
,
const
uint64_t
*
B64
,
uint8_t
*
btilde
)
{
uint32_t
x1
=
0
;
uint32_t
x2
=
((
rnti
)
<<
15
)
+
n_id
;
int
iprime_end
=
(
M_bit
+
31
)
>>
5
;
int
N_array
=
(
M_bit
+
63
)
>>
6
;
uint32_t
scram_seq32
[
N_array
<<
1
];
for
(
int
iprime
=
0
;
iprime
<
iprime_end
;
iprime
++
)
{
uint32_t
s
=
lte_gold_generic
(
&
x1
,
&
x2
,
(
iprime
==
0
)
?
1
:
0
);
scram_seq32
[
iprime_end
-
1
-
iprime
]
=
0
;
for
(
int
i
=
0
;
i
<
32
;
i
++
)
{
scram_seq32
[
iprime_end
-
1
-
iprime
]
|=
(((
s
>>
i
)
&
1
))
<<
(
31
-
i
);
}
}
uint64_t
*
scram_seq
=
(
uint64_t
*
)
scram_seq32
;
#ifdef POLAR_CODING_DEBUG
printf
(
"ss:"
);
for
(
int
n
=
0
;
n
<
M_bit
;
n
++
)
{
if
(
n
%
4
==
0
)
{
printf
(
" "
);
static
inline
void
nr_pucch2_3_4_scrambling
(
uint16_t
M_bit
,
uint16_t
rnti
,
uint16_t
n_id
,
uint64_t
*
B64
,
uint8_t
*
btilde
)
__attribute__
((
always_inline
));
static
inline
void
nr_pucch2_3_4_scrambling
(
uint16_t
M_bit
,
uint16_t
rnti
,
uint16_t
n_id
,
uint64_t
*
B64
,
uint8_t
*
btilde
)
{
uint32_t
x1
=
0
,
x2
=
0
,
s
=
0
;
int
i
;
uint8_t
c
;
// c_init=nRNTI*2^15+n_id according to TS 38.211 Subclause 6.3.2.6.1
//x2 = (rnti) + ((uint32_t)(1+nr_slot_tx)<<16)*(1+(fp->Nid_cell<<1));
x2
=
((
rnti
)
<<
15
)
+
n_id
;
#ifdef DEBUG_NR_PUCCH_TX
printf
(
"
\t\t
[nr_pucch2_3_4_scrambling] gold sequence s=%x, M_bit %d
\n
"
,
s
,
M_bit
);
#endif
uint8_t
*
btildep
=
btilde
;
int
M_bit2
=
M_bit
>
31
?
32
:
(
M_bit
&
31
),
M_bit3
=
M_bit
;
uint32_t
B
;
for
(
int
iprime
=
0
;
iprime
<=
(
M_bit
>>
5
);
iprime
++
,
btildep
+=
32
)
{
s
=
lte_gold_generic
(
&
x1
,
&
x2
,
(
iprime
==
0
)
?
1
:
0
);
B
=
((
uint32_t
*
)
B64
)[
iprime
];
for
(
int
n
=
0
;
n
<
M_bit2
;
n
+=
8
)
LOG_D
(
PHY
,
"PUCCH2 encoded %d : %d,%d,%d,%d,%d,%d,%d,%d
\n
"
,
n
,
(
B
>>
n
)
&
1
,
(
B
>>
(
n
+
1
))
&
1
,
(
B
>>
(
n
+
2
))
&
1
,
(
B
>>
(
n
+
3
))
&
1
,
(
B
>>
(
n
+
4
))
&
1
,
(
B
>>
(
n
+
5
))
&
1
,
(
B
>>
(
n
+
6
))
&
1
,
(
B
>>
(
n
+
7
))
&
1
);
for
(
i
=
0
;
i
<
M_bit2
;
i
++
)
{
c
=
(
uint8_t
)((
s
>>
i
)
&
1
);
btildep
[
i
]
=
(((
B
>>
i
)
&
1
)
^
c
);
#ifdef DEBUG_NR_PUCCH_TX
printf
(
"
\t\t\t
btilde[%d]=%x from unscrambled bit %d and scrambling %d (%x)
\n
"
,
i
+
(
iprime
<<
5
),
btilde
[
i
],((
B
>>
i
)
&
1
),
c
,
s
>>
i
);
#endif
}
int
n1
=
n
>>
6
;
int
n2
=
n
-
(
n1
<<
6
);
int
nlen
=
n1
==
0
?
M_bit
-
(
N_array
<<
6
)
:
64
;
printf
(
"%lu"
,
(
scram_seq
[
N_array
-
1
-
n1
]
>>
(
nlen
-
1
-
n2
))
&
1
);
M_bit3
-=
32
;
M_bit2
=
M_bit3
>
31
?
32
:
(
M_bit3
&
31
);
}
printf
(
"
\n
"
);
#endif
uint64_t
out64
[
N_array
];
for
(
int
n
=
0
;
n
<
N_array
;
n
++
)
{
out64
[
n
]
=
B64
[
n
]
^
scram_seq
[
n
];
}
#ifdef POLAR_CODING_DEBUG
printf
(
"s: "
);
for
(
int
n
=
0
;
n
<
M_bit
;
n
++
)
{
if
(
n
%
4
==
0
)
{
printf
(
" "
);
}
int
n1
=
n
>>
6
;
int
n2
=
n
-
(
n1
<<
6
);
int
nlen
=
n1
==
0
?
M_bit
-
(
N_array
<<
6
)
:
64
;
printf
(
"%lu"
,
(
out64
[
N_array
-
1
-
n1
]
>>
(
nlen
-
1
-
n2
))
&
1
);
}
printf
(
"
\n
"
);
#ifdef DEBUG_NR_PUCCH_TX
printf
(
"
\t\t
[nr_pucch2_3_4_scrambling] scrambling M_bit=%d bits
\n
"
,
M_bit
);
#endif
for
(
int
n
=
0
;
n
<
M_bit
;
n
++
)
{
int
n1
=
n
>>
6
;
int
n2
=
n
-
(
n1
<<
6
);
int
nlen
=
n1
==
0
?
M_bit
-
(
N_array
<<
6
)
:
64
;
btilde
[
n
]
=
(
out64
[
N_array
-
1
-
n1
]
>>
(
nlen
-
1
-
n2
))
&
1
;
}
}
static
void
nr_uci_encoding
(
uint64_t
payload
,
uint8_t
nr_bit
,
int
fmt
,
...
...
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