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
41d88e9f
Commit
41d88e9f
authored
May 25, 2023
by
rmagueta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improvements in nr_pucch2_3_4_scrambling()
parent
1b4c8420
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
87 additions
and
45 deletions
+87
-45
openair1/PHY/CODING/nrSmallBlock/encodeSmallBlock.c
openair1/PHY/CODING/nrSmallBlock/encodeSmallBlock.c
+10
-0
openair1/PHY/CODING/nrSmallBlock/nr_small_block_defs.h
openair1/PHY/CODING/nrSmallBlock/nr_small_block_defs.h
+2
-0
openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c
openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c
+75
-45
No files found.
openair1/PHY/CODING/nrSmallBlock/encodeSmallBlock.c
View file @
41d88e9f
...
...
@@ -42,3 +42,13 @@ uint32_t encodeSmallBlock(uint16_t *in, uint8_t len){
return
out
;
}
uint32_t
encodeSmallBlockInv
(
uint16_t
*
in
,
uint8_t
len
)
{
uint32_t
aux
=
encodeSmallBlock
(
in
,
len
);
uint32_t
out
=
0
;
for
(
int
i
=
0
;
i
<
32
;
i
++
)
{
out
|=
((
aux
>>
i
)
&
1
)
<<
(
31
-
i
);
}
return
out
;
}
\ No newline at end of file
openair1/PHY/CODING/nrSmallBlock/nr_small_block_defs.h
View file @
41d88e9f
...
...
@@ -45,6 +45,8 @@
uint32_t
encodeSmallBlock
(
uint16_t
*
in
,
uint8_t
len
);
uint32_t
encodeSmallBlockInv
(
uint16_t
*
in
,
uint8_t
len
);
uint16_t
decodeSmallBlock
(
int8_t
*
in
,
uint8_t
len
);
static
const
uint32_t
nrSmallBlockBasis
[
11
]
=
{
0xFFFFFFFF
,
0x4BA5A933
,
0x7D910E5A
,
0x6D26339C
,
0x71C7C3E0
,
...
...
openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c
View file @
41d88e9f
...
...
@@ -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
,
...
...
@@ -805,51 +806,67 @@ 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
,
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
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
);
}
M_bit3
-=
32
;
M_bit2
=
M_bit3
>
31
?
32
:
(
M_bit3
&
31
);
}
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
(
" "
);
}
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
);
}
printf
(
"
\n
"
);
#endif
#ifdef DEBUG_NR_PUCCH_TX
printf
(
"
\t\t
[nr_pucch2_3_4_scrambling] scrambling M_bit=%d bits
\n
"
,
M_bit
);
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
"
);
#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
,
...
...
@@ -931,11 +948,12 @@ static void nr_uci_encoding(uint64_t payload,
#endif
if
(
A
<=
11
)
{
// procedure in subclause 6.3.1.2.2 (UCI encoded by channel coding of small block lengths -> subclause 6.3.1.3.2)
// CRC bits are not attached, and coding small block lengths (subclause 5.3.3)
uint64_t
b0
=
encodeSmallBlock
((
uint16_t
*
)
&
payload
,
A
);
// repetition for rate-matching up to 16 PRB
b
[
0
]
=
b0
|
(
b0
<<
32
);
// TS 38.212 - Section 6.3.1.2.2 UCI encoded by channel coding of small block lengths
// --> If the payload size A<=11, CRC bits are not attached.
uint64_t
b0
=
encodeSmallBlockInv
((
uint16_t
*
)
&
payload
,
A
);
// TS 38.212 - Section 5.4.3 Rate matching for channel coding of small block lengths
// --> Repetition for rate-matching up to 16 PRB
b
[
0
]
=
b0
|
(
b0
<<
32
);
b
[
1
]
=
b
[
0
];
b
[
2
]
=
b
[
0
];
b
[
3
]
=
b
[
0
];
...
...
@@ -994,7 +1012,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