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
canghaiwuhen
OpenXG-RAN
Commits
3716e921
Commit
3716e921
authored
Jul 09, 2018
by
Guy De Souza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Scrambling updates
parent
f16d6127
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
18 deletions
+31
-18
openair1/PHY/NR_TRANSPORT/nr_pbch.c
openair1/PHY/NR_TRANSPORT/nr_pbch.c
+26
-15
openair1/PHY/NR_TRANSPORT/nr_transport.h
openair1/PHY/NR_TRANSPORT/nr_transport.h
+4
-3
openair1/PHY/defs_gNB.h
openair1/PHY/defs_gNB.h
+1
-0
No files found.
openair1/PHY/NR_TRANSPORT/nr_pbch.c
View file @
3716e921
...
@@ -131,14 +131,19 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs,
...
@@ -131,14 +131,19 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs,
return
0
;
return
0
;
}
}
void
nr_pbch_scrambling
(
uint32_t
Nid
,
void
nr_pbch_scrambling
(
NR_gNB_PBCH
*
pbch
,
uint32_t
Nid
,
uint8_t
nushift
,
uint8_t
nushift
,
uint8_t
*
pbch_a
,
uint16_t
M
,
uint16_t
M
,
uint16_t
length
)
uint16_t
length
,
uint8_t
bitwise
)
{
{
uint8_t
reset
,
offset
;
uint8_t
reset
,
offset
;
uint32_t
x1
,
x2
,
s
=
0
;
uint32_t
x1
,
x2
,
s
=
0
;
uint8_t
*
pbch_e
=
pbch
->
pbch_e
;
uint32_t
*
pbch_a_prime
=
(
uint32_t
*
)
pbch
->
pbch_a_prime
;
uint32_t
*
pbch_a_interleaved
=
(
uint32_t
*
)
pbch
->
pbch_a_interleaved
;
uint32_t
unscrambling_mask
=
0x87002D
;
reset
=
1
;
reset
=
1
;
// x1 is set in lte_gold_generic
// x1 is set in lte_gold_generic
...
@@ -157,7 +162,12 @@ void nr_pbch_scrambling(uint32_t Nid,
...
@@ -157,7 +162,12 @@ void nr_pbch_scrambling(uint32_t Nid,
s
=
lte_gold_generic
(
&
x1
,
&
x2
,
reset
);
s
=
lte_gold_generic
(
&
x1
,
&
x2
,
reset
);
reset
=
0
;
reset
=
0
;
}
}
pbch_a
[
i
]
=
(
pbch_a
[
i
]
&
1
)
^
((
s
>>
((
i
+
offset
)
&
0x1f
))
&
1
);
if
(
bitwise
)
{
(
*
pbch_a_prime
)
^=
((
unscrambling_mask
>>
i
)
&
1
)
?
(((
*
pbch_a_interleaved
)
>>
i
)
&
1
)
<<
i
:
((((
*
pbch_a_interleaved
)
>>
i
)
&
1
)
^
((
s
>>
((
i
+
offset
)
&
0x1f
))
&
1
))
<<
i
;
}
else
pbch_e
[
i
]
=
(
pbch_e
[
i
]
&
1
)
^
((
s
>>
((
i
+
offset
)
&
0x1f
))
&
1
);
}
}
}
}
...
@@ -167,11 +177,11 @@ uint8_t nr_pbch_payload_interleaving_pattern[32] = {16, 23, 18, 17, 8, 30, 10, 6
...
@@ -167,11 +177,11 @@ uint8_t nr_pbch_payload_interleaving_pattern[32] = {16, 23, 18, 17, 8, 30, 10, 6
uint8_t
nr_pbch_payload_interleaver
(
uint8_t
i
)
{
uint8_t
nr_pbch_payload_interleaver
(
uint8_t
i
)
{
uint8_t
j_sfn
=
0
,
j_hrf
=
10
,
j_ssb
=
11
,
j_other
=
14
;
uint8_t
j_sfn
=
0
,
j_hrf
=
10
,
j_ssb
=
11
,
j_other
=
14
;
if
(
24
<=
i
&&
i
<=
27
)
//
s
fn bits
if
(
24
<=
i
&&
i
<=
27
)
//
S
fn bits
return
nr_pbch_payload_interleaving_pattern
[
j_sfn
+
i
-
24
];
return
nr_pbch_payload_interleaving_pattern
[
j_sfn
+
i
-
24
];
else
if
(
i
==
28
)
// Hrf bit
else
if
(
i
==
28
)
// Hrf bit
return
nr_pbch_payload_interleaving_pattern
[
j_hrf
];
return
nr_pbch_payload_interleaving_pattern
[
j_hrf
];
else
if
(
29
<=
i
)
// S
SB
bits
else
if
(
29
<=
i
)
// S
sb
bits
return
nr_pbch_payload_interleaving_pattern
[
j_ssb
+
(
i
-
29
)];
return
nr_pbch_payload_interleaving_pattern
[
j_ssb
+
(
i
-
29
)];
else
else
return
nr_pbch_payload_interleaving_pattern
[
j_other
+
i
];
return
nr_pbch_payload_interleaving_pattern
[
j_other
+
i
];
...
@@ -207,7 +217,7 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
...
@@ -207,7 +217,7 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
#ifdef DEBUG_PBCH_ENCODING
#ifdef DEBUG_PBCH_ENCODING
printf
(
"Byte endian fix:
\n
"
);
printf
(
"Byte endian fix:
\n
"
);
for
(
int
i
=
0
;
i
<
4
;
i
++
)
for
(
int
i
=
0
;
i
<
4
;
i
++
)
printf
(
"pbch_a[%d]: 0x%0
8
x
\n
"
,
i
,
pbch
->
pbch_a
[
i
]);
printf
(
"pbch_a[%d]: 0x%0
4
x
\n
"
,
i
,
pbch
->
pbch_a
[
i
]);
#endif
#endif
...
@@ -227,7 +237,7 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
...
@@ -227,7 +237,7 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
#ifdef DEBUG_PBCH_ENCODING
#ifdef DEBUG_PBCH_ENCODING
printf
(
"Extra byte:
\n
"
);
printf
(
"Extra byte:
\n
"
);
for
(
int
i
=
0
;
i
<
4
;
i
++
)
for
(
int
i
=
0
;
i
<
4
;
i
++
)
printf
(
"pbch_a[%d]: 0x%0
8
x
\n
"
,
i
,
pbch
->
pbch_a
[
i
]);
printf
(
"pbch_a[%d]: 0x%0
4
x
\n
"
,
i
,
pbch
->
pbch_a
[
i
]);
#endif
#endif
// Payload interleaving
// Payload interleaving
...
@@ -238,26 +248,28 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
...
@@ -238,26 +248,28 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
#ifdef DEBUG_PBCH_ENCODING
#ifdef DEBUG_PBCH_ENCODING
printf
(
"Interleaving:
\n
"
);
printf
(
"Interleaving:
\n
"
);
for
(
int
i
=
0
;
i
<
4
;
i
++
)
for
(
int
i
=
0
;
i
<
4
;
i
++
)
printf
(
"pbch_a_interleaved[%d]: 0x%0
8
x
\n
"
,
i
,
pbch
->
pbch_a_interleaved
[
i
]);
printf
(
"pbch_a_interleaved[%d]: 0x%0
4
x
\n
"
,
i
,
pbch
->
pbch_a_interleaved
[
i
]);
#endif
#endif
// Scrambling
// Scrambling
M
=
NR_POLAR_PBCH_PAYLOAD_BITS
-
3
;
// case Lmax = 4--> 29
M
=
(
Lmax
==
64
)
?
(
NR_POLAR_PBCH_PAYLOAD_BITS
-
6
)
:
(
NR_POLAR_PBCH_PAYLOAD_BITS
-
3
);
nr_pbch_scrambling
((
uint32_t
)
config
->
sch_config
.
physical_cell_id
.
value
,
nushift
,
pbch
->
pbch_a_interleaved
,
M
,
NR_POLAR_PBCH_PAYLOAD_BITS
);
nushift
=
(((
sfn
>>
2
)
&
1
)
<<
1
)
^
((
sfn
>>
1
)
&
1
);
nr_pbch_scrambling
(
pbch
,
(
uint32_t
)
config
->
sch_config
.
physical_cell_id
.
value
,
nushift
,
M
,
NR_POLAR_PBCH_PAYLOAD_BITS
,
1
);
#ifdef DEBUG_PBCH_ENCODING
#ifdef DEBUG_PBCH_ENCODING
#endif
#endif
/// CRC, coding and rate matching
/// CRC, coding and rate matching
polar_encoder
(
pbch
->
pbch_a
,
pbch
->
pbch_e
,
&
frame_parms
->
pbch_polar_params
);
polar_encoder
(
pbch
->
pbch_a
_prime
,
pbch
->
pbch_e
,
&
frame_parms
->
pbch_polar_params
);
#ifdef DEBUG_PBCH_ENCODING
#ifdef DEBUG_PBCH_ENCODING
#endif
#endif
/// Scrambling
/// Scrambling
M
=
NR_POLAR_PBCH_E
;
M
=
NR_POLAR_PBCH_E
;
nr_pbch_scrambling
((
uint32_t
)
config
->
sch_config
.
physical_cell_id
.
value
,
nushift
,
pbch
->
pbch_a
,
M
,
NR_POLAR_PBCH_E
);
nushift
=
config
->
sch_config
.
physical_cell_id
.
value
&
3
;;
nr_pbch_scrambling
(
pbch
,
(
uint32_t
)
config
->
sch_config
.
physical_cell_id
.
value
,
nushift
,
M
,
NR_POLAR_PBCH_E
,
0
);
/// QPSK modulation
/// QPSK modulation
for
(
int
i
=
0
;
i
<
NR_POLAR_PBCH_E
>>
1
;
i
++
){
for
(
int
i
=
0
;
i
<
NR_POLAR_PBCH_E
>>
1
;
i
++
){
...
@@ -271,7 +283,6 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
...
@@ -271,7 +283,6 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
}
}
/// Resource mapping
/// Resource mapping
nushift
=
config
->
sch_config
.
physical_cell_id
.
value
&
3
;
a
=
(
config
->
rf_config
.
tx_antenna_ports
.
value
==
1
)
?
amp
:
(
amp
*
ONE_OVER_SQRT2_Q15
)
>>
15
;
a
=
(
config
->
rf_config
.
tx_antenna_ports
.
value
==
1
)
?
amp
:
(
amp
*
ONE_OVER_SQRT2_Q15
)
>>
15
;
for
(
int
aa
=
0
;
aa
<
config
->
rf_config
.
tx_antenna_ports
.
value
;
aa
++
)
for
(
int
aa
=
0
;
aa
<
config
->
rf_config
.
tx_antenna_ports
.
value
;
aa
++
)
...
...
openair1/PHY/NR_TRANSPORT/nr_transport.h
View file @
3716e921
...
@@ -70,11 +70,12 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs,
...
@@ -70,11 +70,12 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs,
\brief PBCH scrambling function
\brief PBCH scrambling function
@param
@param
*/
*/
void
nr_pbch_scrambling
(
uint32_t
Nid
,
void
nr_pbch_scrambling
(
NR_gNB_PBCH
*
pbch
,
uint32_t
Nid
,
uint8_t
nushift
,
uint8_t
nushift
,
uint8_t
*
pbch_a
,
uint16_t
M
,
uint16_t
M
,
uint16_t
length
);
uint16_t
length
,
uint8_t
bitwise
);
/*!
/*!
\fn int nr_generate_pbch
\fn int nr_generate_pbch
...
...
openair1/PHY/defs_gNB.h
View file @
3716e921
...
@@ -40,6 +40,7 @@
...
@@ -40,6 +40,7 @@
typedef
struct
{
typedef
struct
{
uint8_t
pbch_a
[
NR_POLAR_PBCH_PAYLOAD_BITS
>>
3
];
uint8_t
pbch_a
[
NR_POLAR_PBCH_PAYLOAD_BITS
>>
3
];
uint8_t
pbch_a_interleaved
[
NR_POLAR_PBCH_PAYLOAD_BITS
>>
3
];
uint8_t
pbch_a_interleaved
[
NR_POLAR_PBCH_PAYLOAD_BITS
>>
3
];
uint8_t
pbch_a_prime
[
NR_POLAR_PBCH_PAYLOAD_BITS
>>
3
];
uint8_t
pbch_e
[
NR_POLAR_PBCH_E
];
uint8_t
pbch_e
[
NR_POLAR_PBCH_E
];
}
NR_gNB_PBCH
;
}
NR_gNB_PBCH
;
...
...
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