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
OpenXG
OpenXG UE
Commits
8223ea3d
Commit
8223ea3d
authored
Sep 19, 2018
by
Hongzhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nr pbch format change
parent
5887fca2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
25 deletions
+19
-25
openair1/PHY/CODING/nrPolar_tools/nr_polar_pbch_defs.h
openair1/PHY/CODING/nrPolar_tools/nr_polar_pbch_defs.h
+1
-0
openair1/PHY/NR_TRANSPORT/nr_pbch.c
openair1/PHY/NR_TRANSPORT/nr_pbch.c
+15
-22
openair1/PHY/defs_gNB.h
openair1/PHY/defs_gNB.h
+3
-3
No files found.
openair1/PHY/CODING/nrPolar_tools/nr_polar_pbch_defs.h
View file @
8223ea3d
...
@@ -51,6 +51,7 @@
...
@@ -51,6 +51,7 @@
//Sec. 7.1.5: Rate Matching
//Sec. 7.1.5: Rate Matching
#define NR_POLAR_PBCH_I_BIL 0 //uint8_t
#define NR_POLAR_PBCH_I_BIL 0 //uint8_t
#define NR_POLAR_PBCH_E 864 //uint16_t
#define NR_POLAR_PBCH_E 864 //uint16_t
#define NR_POLAR_PBCH_E_DWORD 27 // NR_POLAR_PBCH_E/32
/*
/*
* TEST CODE
* TEST CODE
...
...
openair1/PHY/NR_TRANSPORT/nr_pbch.c
View file @
8223ea3d
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
#include "PHY/sse_intrin.h"
#include "PHY/sse_intrin.h"
//#define DEBUG_PBCH
//#define DEBUG_PBCH
//
#define DEBUG_PBCH_ENCODING
#define DEBUG_PBCH_ENCODING
//#define DEBUG_PBCH_DMRS
//#define DEBUG_PBCH_DMRS
extern
short
nr_mod_table
[
NR_MOD_TABLE_SIZE_SHORT
];
extern
short
nr_mod_table
[
NR_MOD_TABLE_SIZE_SHORT
];
...
@@ -140,9 +140,9 @@ void nr_pbch_scrambling(NR_gNB_PBCH *pbch,
...
@@ -140,9 +140,9 @@ void nr_pbch_scrambling(NR_gNB_PBCH *pbch,
{
{
uint8_t
reset
,
offset
;
uint8_t
reset
,
offset
;
uint32_t
x1
,
x2
,
s
=
0
;
uint32_t
x1
,
x2
,
s
=
0
;
uint
8
_t
*
pbch_e
=
pbch
->
pbch_e
;
uint
32
_t
*
pbch_e
=
pbch
->
pbch_e
;
uint32_t
*
pbch_a_prime
=
(
uint32_t
*
)
pbch
->
pbch_a_prime
;
uint32_t
pbch_a_prime
=
pbch
->
pbch_a_prime
;
uint32_t
*
pbch_a_interleaved
=
(
uint32_t
*
)
pbch
->
pbch_a_interleaved
;
uint32_t
pbch_a_interleaved
=
pbch
->
pbch_a_interleaved
;
uint32_t
unscrambling_mask
=
0x100006D
;
uint32_t
unscrambling_mask
=
0x100006D
;
reset
=
1
;
reset
=
1
;
...
@@ -157,7 +157,7 @@ void nr_pbch_scrambling(NR_gNB_PBCH *pbch,
...
@@ -157,7 +157,7 @@ void nr_pbch_scrambling(NR_gNB_PBCH *pbch,
// Scrambling is now done with offset (nushift*M)%32
// Scrambling is now done with offset (nushift*M)%32
offset
=
(
nushift
*
M
)
&
0x1f
;
offset
=
(
nushift
*
M
)
&
0x1f
;
#ifdef DEBUG_PBCH_ENCODING
#ifdef DEBUG_PBCH_ENCODING
printf
(
"Scrambling params: nushift %d M %d length %d
bitwise %d offset %d
\n
"
,
nushift
,
M
,
length
,
bitwise
,
offset
);
printf
(
"Scrambling params: nushift %d M %d length %d
encoded %d offset %d
\n
"
,
nushift
,
M
,
length
,
encoded
,
offset
);
#endif
#endif
for
(
int
i
=
0
;
i
<
length
;
i
++
)
{
for
(
int
i
=
0
;
i
<
length
;
i
++
)
{
...
@@ -169,7 +169,7 @@ void nr_pbch_scrambling(NR_gNB_PBCH *pbch,
...
@@ -169,7 +169,7 @@ void nr_pbch_scrambling(NR_gNB_PBCH *pbch,
printf
(
"s: %04x
\t
"
,
s
);
printf
(
"s: %04x
\t
"
,
s
);
#endif
#endif
if
(
!
encoded
)
{
if
(
!
encoded
)
{
(
*
pbch_a_prime
)
^=
((
unscrambling_mask
>>
i
)
&
1
)
?
(((
*
pbch_a_interleaved
)
>>
i
)
&
1
)
<<
i
:
((((
*
pbch_a_interleaved
)
>>
i
)
&
1
)
^
((
s
>>
((
i
+
offset
)
&
0x1f
))
&
1
))
<<
i
;
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
else
...
@@ -246,11 +246,11 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
...
@@ -246,11 +246,11 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
(
*
xbyte
)
^=
((
ssb_index
>>
(
3
+
i
))
&
1
)
<<
(
5
+
i
);
// resp. 4th, 5th and 6th bits of ssb_index
(
*
xbyte
)
^=
((
ssb_index
>>
(
3
+
i
))
&
1
)
<<
(
5
+
i
);
// resp. 4th, 5th and 6th bits of ssb_index
else
else
(
*
xbyte
)
^=
((
config
->
sch_config
.
ssb_subcarrier_offset
.
value
>>
5
)
&
1
)
<<
5
;
//MSB of k_SSB
(
*
xbyte
)
^=
((
config
->
sch_config
.
ssb_subcarrier_offset
.
value
>>
5
)
&
1
)
<<
5
;
//MSB of k_SSB
#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%02x
\n
"
,
i
,
pbch
->
pbch_a
[
i
]);
printf
(
"pbch_a[%d]: 0x%02x
\n
"
,
i
,
pbch
->
pbch_a
[
i
]);
#endif
//
#endif
// Payload interleaving
// Payload interleaving
uint32_t
in
=
0
,
out
=
0
;
uint32_t
in
=
0
,
out
=
0
;
...
@@ -258,19 +258,18 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
...
@@ -258,19 +258,18 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
in
|=
(
uint32_t
)(
pbch
->
pbch_a
[
i
]
<<
((
3
-
i
)
<<
3
));
in
|=
(
uint32_t
)(
pbch
->
pbch_a
[
i
]
<<
((
3
-
i
)
<<
3
));
for
(
int
i
=
0
;
i
<
32
;
i
++
)
{
for
(
int
i
=
0
;
i
<
32
;
i
++
)
{
out
|=
((
in
>>
i
)
&
1
)
<<
(
nr_pbch_payload_interleaver
(
i
));
//nr_pbch_payload_interleaving_pattern[i]
pbch
->
pbch_a_interleaved
|=
((
in
>>
i
)
&
1
)
<<
(
nr_pbch_payload_interleaver
(
i
));
//nr_pbch_payload_interleaving_pattern[i]
#ifdef DEBUG_PBCH_ENCODING
#ifdef DEBUG_PBCH_ENCODING
printf
(
"i %d in 0x%08x out 0x%08x ilv %d (in>>i)&1) %d
\n
"
,
i
,
in
,
out
,
nr_pbch_payload_interleaver
(
i
),
(
in
>>
i
)
&
1
);
printf
(
"i %d in 0x%08x out 0x%08x ilv %d (in>>i)&1) %d
\n
"
,
i
,
in
,
out
,
nr_pbch_payload_interleaver
(
i
),
(
in
>>
i
)
&
1
);
#endif
#endif
}
}
for
(
int
i
=
0
;
i
<
NR_POLAR_PBCH_PAYLOAD_BITS
>>
3
;
i
++
)
/*
for (int i=0; i<NR_POLAR_PBCH_PAYLOAD_BITS>>3; i++)
pbch
->
pbch_a_interleaved
[
i
]
=
(
uint8_t
)((
out
>>
(
i
<<
3
))
&
0xff
);
pbch->pbch_a_interleaved[i] = (uint8_t)((out>>(i<<3))&0xff);
*/
#ifdef DEBUG_PBCH_ENCODING
#ifdef DEBUG_PBCH_ENCODING
printf
(
"Interleaving:
\n
"
);
printf
(
"Interleaving:
\n
"
);
for
(
int
i
=
0
;
i
<
4
;
i
++
)
printf
(
"pbch_a_interleaved: 0x%08x
\n
"
,
pbch
->
pbch_a_interleaved
);
printf
(
"pbch_a_interleaved[%d]: 0x%02x
\n
"
,
i
,
pbch
->
pbch_a_interleaved
[
i
]);
#endif
#endif
// Scrambling
// Scrambling
...
@@ -279,20 +278,14 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
...
@@ -279,20 +278,14 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
nr_pbch_scrambling
(
pbch
,
(
uint32_t
)
config
->
sch_config
.
physical_cell_id
.
value
,
nushift
,
M
,
NR_POLAR_PBCH_PAYLOAD_BITS
,
0
);
nr_pbch_scrambling
(
pbch
,
(
uint32_t
)
config
->
sch_config
.
physical_cell_id
.
value
,
nushift
,
M
,
NR_POLAR_PBCH_PAYLOAD_BITS
,
0
);
#ifdef DEBUG_PBCH_ENCODING
#ifdef DEBUG_PBCH_ENCODING
printf
(
"Payload scrambling:
\n
"
);
printf
(
"Payload scrambling:
\n
"
);
for
(
int
i
=
0
;
i
<
4
;
i
++
)
printf
(
"pbch_a_prime[%d]: 0x%08x
\n
"
,
pbch
->
pbch_a_prime
);
printf
(
"pbch_a_prime[%d]: 0x%02x
\n
"
,
i
,
pbch
->
pbch_a_prime
[
i
]);
#endif
#endif
for
(
int
m
=
0
;
m
<
32
;
m
++
){
pbch_a_b
[
m
]
=
((
pbch
->
pbch_a_prime
[
m
>>
3
]
>>
(
m
&
7
))
&
1
);
//printf("pbch_a_b[%d] %d\n", m, pbch_a_b[m] );
}
/// CRC, coding and rate matching
/// CRC, coding and rate matching
polar_encoder
(
pbch
->
pbch_a_prime
,
pbch
->
pbch_e
,
polar_params
);
polar_encoder
(
pbch
->
pbch_a_prime
,
pbch
->
pbch_e
,
polar_params
);
#ifdef DEBUG_PBCH_ENCODING
#ifdef DEBUG_PBCH_ENCODING
printf
(
"Channel coding:
\n
"
);
printf
(
"Channel coding:
\n
"
);
for
(
int
i
=
0
;
i
<
(
uint16_t
)
ceil
((
NR_POLAR_PBCH_E
>>
3
)
/
32
)
;
i
++
)
for
(
int
i
=
0
;
i
<
NR_POLAR_PBCH_E_DWORD
;
i
++
)
printf
(
"pbch_e[%d]: 0x%08x
\t
"
,
i
,
pbch
->
pbch_e
[
i
]);
printf
(
"pbch_e[%d]: 0x%08x
\t
"
,
i
,
pbch
->
pbch_e
[
i
]);
printf
(
"
\n
"
);
printf
(
"
\n
"
);
#endif
#endif
...
@@ -303,7 +296,7 @@ pbch_a_b[m] = ((pbch->pbch_a_prime[m>>3]>>(m&7))&1);
...
@@ -303,7 +296,7 @@ pbch_a_b[m] = ((pbch->pbch_a_prime[m>>3]>>(m&7))&1);
nr_pbch_scrambling
(
pbch
,
(
uint32_t
)
config
->
sch_config
.
physical_cell_id
.
value
,
nushift
,
M
,
NR_POLAR_PBCH_E
,
1
);
nr_pbch_scrambling
(
pbch
,
(
uint32_t
)
config
->
sch_config
.
physical_cell_id
.
value
,
nushift
,
M
,
NR_POLAR_PBCH_E
,
1
);
#ifdef DEBUG_PBCH_ENCODING
#ifdef DEBUG_PBCH_ENCODING
printf
(
"Scrambling:
\n
"
);
printf
(
"Scrambling:
\n
"
);
for
(
int
i
=
0
;
i
<
(
uint16_t
)
ceil
((
NR_POLAR_PBCH_E
>>
3
)
/
32
)
;
i
++
)
for
(
int
i
=
0
;
i
<
NR_POLAR_PBCH_E_DWORD
;
i
++
)
printf
(
"pbch_e[%d]: 0x%08x
\t
"
,
i
,
pbch
->
pbch_e
[
i
]);
printf
(
"pbch_e[%d]: 0x%08x
\t
"
,
i
,
pbch
->
pbch_e
[
i
]);
printf
(
"
\n
"
);
printf
(
"
\n
"
);
#endif
#endif
...
...
openair1/PHY/defs_gNB.h
View file @
8223ea3d
...
@@ -41,9 +41,9 @@
...
@@ -41,9 +41,9 @@
typedef
struct
{
typedef
struct
{
uint8_t
pbch_a
[
NR_POLAR_PBCH_PAYLOAD_BITS
>>
3
];
uint8_t
pbch_a
[
NR_POLAR_PBCH_PAYLOAD_BITS
>>
3
];
uint
8_t
pbch_a_interleaved
[
NR_POLAR_PBCH_PAYLOAD_BITS
>>
3
]
;
uint
32_t
pbch_a_interleaved
;
uint
8_t
pbch_a_prime
[
NR_POLAR_PBCH_PAYLOAD_BITS
>>
3
]
;
uint
32_t
pbch_a_prime
;
uint
8_t
pbch_e
[
NR_POLAR_PBCH_E
];
uint
32_t
pbch_e
[
NR_POLAR_PBCH_E_DWORD
];
}
NR_gNB_PBCH
;
}
NR_gNB_PBCH
;
typedef
struct
{
typedef
struct
{
...
...
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