Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG UE
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 UE
Commits
7e5ae8e7
Commit
7e5ae8e7
authored
Nov 30, 2018
by
Guy De Souza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scrambling fixes gNB/UE
parent
dd554232
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
2 deletions
+63
-2
openair1/PHY/NR_TRANSPORT/nr_pbch.c
openair1/PHY/NR_TRANSPORT/nr_pbch.c
+60
-1
openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c
openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c
+3
-1
No files found.
openair1/PHY/NR_TRANSPORT/nr_pbch.c
View file @
7e5ae8e7
...
...
@@ -149,7 +149,7 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs,
return
0
;
}
void
nr_pbch_scrambling
(
NR_gNB_PBCH
*
pbch
,
/*
void nr_pbch_scrambling(NR_gNB_PBCH *pbch,
uint32_t Nid,
uint8_t nushift,
uint16_t M,
...
...
@@ -189,8 +189,67 @@ void nr_pbch_scrambling(NR_gNB_PBCH *pbch,
else
pbch_e[i>>5] ^= (((s>>((i+offset)&0x1f))&1)<<(i&0x1f));
}
}*/
void
nr_pbch_scrambling
(
NR_gNB_PBCH
*
pbch
,
uint32_t
Nid
,
uint8_t
nushift
,
uint16_t
M
,
uint16_t
length
,
uint8_t
encoded
,
uint32_t
unscrambling_mask
)
{
uint8_t
reset
,
offset
;
uint32_t
x1
,
x2
,
s
=
0
;
uint32_t
*
pbch_e
=
pbch
->
pbch_e
;
reset
=
1
;
// x1 is set in lte_gold_generic
x2
=
Nid
;
// The Gold sequence is shifted by nushift* M, so we skip (nushift*M /32) double words
for
(
int
i
=
0
;
i
<
(
uint16_t
)
ceil
(((
float
)
nushift
*
M
)
/
32
);
i
++
)
{
s
=
lte_gold_generic
(
&
x1
,
&
x2
,
reset
);
reset
=
0
;
}
// Scrambling is now done with offset (nushift*M)%32
offset
=
(
nushift
*
M
)
&
0x1f
;
#ifdef DEBUG_PBCH_ENCODING
printf
(
"Scrambling params: nushift %d M %d length %d encoded %d offset %d
\n
"
,
nushift
,
M
,
length
,
encoded
,
offset
);
#endif
#ifdef DEBUG_PBCH_ENCODING
printf
(
"s: %04x
\t
"
,
s
);
#endif
int
k
=
0
;
if
(
!
encoded
)
{
/// 1st Scrambling
for
(
int
i
=
0
;
i
<
length
;
++
i
)
{
if
((
unscrambling_mask
>>
i
)
&
1
)
pbch
->
pbch_a_prime
^=
((
pbch
->
pbch_a_interleaved
>>
i
)
&
1
)
<<
i
;
else
{
if
(((
k
+
offset
)
&
0x1f
)
==
0
)
{
s
=
lte_gold_generic
(
&
x1
,
&
x2
,
reset
);
reset
=
0
;
}
pbch
->
pbch_a_prime
^=
(((
pbch
->
pbch_a_interleaved
>>
i
)
&
1
)
^
((
s
>>
((
k
+
offset
)
&
0x1f
))
&
1
))
<<
i
;
k
++
;
/// k increase only when payload bit is not special bit
}
}
}
else
{
/// 2nd Scrambling
for
(
int
i
=
0
;
i
<
length
;
++
i
)
{
if
(((
i
+
offset
)
&
0x1f
)
==
0
)
{
s
=
lte_gold_generic
(
&
x1
,
&
x2
,
reset
);
reset
=
0
;
}
pbch_e
[
i
>>
5
]
^=
(((
s
>>
((
i
+
offset
)
&
0x1f
))
&
1
)
<<
(
i
&
0x1f
));
}
}
}
uint8_t
nr_init_pbch_interleaver
(
uint8_t
*
interleaver
)
{
uint8_t
j_sfn
=
0
,
j_hrf
=
10
,
j_ssb
=
11
,
j_other
=
14
;
memset
((
void
*
)
interleaver
,
0
,
NR_POLAR_PBCH_PAYLOAD_BITS
);
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c
View file @
7e5ae8e7
...
...
@@ -441,6 +441,7 @@ void nr_pbch_unscrambling(NR_UE_PBCH *pbch,
{
uint8_t
reset
,
offset
;
uint32_t
x1
,
x2
,
s
=
0
;
uint8_t
k
=
0
;
int16_t
*
demod_pbch_e
=
pbch
->
llr
;
...
...
@@ -468,7 +469,8 @@ void nr_pbch_unscrambling(NR_UE_PBCH *pbch,
#endif
if
(
bitwise
)
{
(
pbch
->
pbch_a_interleaved
)
^=
((
unscrambling_mask
>>
i
)
&
1
)
?
((
pbch
->
pbch_a_prime
>>
i
)
&
1
)
<<
i
:
(((
pbch
->
pbch_a_prime
>>
i
)
&
1
)
^
((
s
>>
((
i
+
offset
)
&
0x1f
))
&
1
))
<<
i
;
(
pbch
->
pbch_a_interleaved
)
^=
((
unscrambling_mask
>>
i
)
&
1
)
?
((
pbch
->
pbch_a_prime
>>
i
)
&
1
)
<<
i
:
(((
pbch
->
pbch_a_prime
>>
i
)
&
1
)
^
((
s
>>
((
k
+
offset
)
&
0x1f
))
&
1
))
<<
i
;
k
+=!
((
unscrambling_mask
>>
i
)
&
1
);
}
else
{
...
...
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