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
ff26c550
Commit
ff26c550
authored
Jun 26, 2018
by
hongzhi wang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'nr_pbch' into develop-nr
parents
8760ad83
624fa4dc
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
150 additions
and
340 deletions
+150
-340
cmake_targets/CMakeLists.txt
cmake_targets/CMakeLists.txt
+1
-0
openair1/PHY/INIT/nr_init_ue.c
openair1/PHY/INIT/nr_init_ue.c
+8
-4
openair1/PHY/INIT/nr_parms.c
openair1/PHY/INIT/nr_parms.c
+0
-12
openair1/PHY/NR_REFSIG/nr_dmrs_rx.c
openair1/PHY/NR_REFSIG/nr_dmrs_rx.c
+5
-3
openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c
openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c
+21
-55
openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
+9
-54
openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c
openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c
+99
-209
openair1/PHY/defs_nr_UE.h
openair1/PHY/defs_nr_UE.h
+4
-2
targets/RT/USER/nr-ue.c
targets/RT/USER/nr-ue.c
+3
-1
No files found.
cmake_targets/CMakeLists.txt
View file @
ff26c550
...
@@ -1296,6 +1296,7 @@ set(PHY_SRC_UE
...
@@ -1296,6 +1296,7 @@ set(PHY_SRC_UE
${
OPENAIR1_DIR
}
/PHY/INIT/nr_init_ue.c
${
OPENAIR1_DIR
}
/PHY/INIT/nr_init_ue.c
${
OPENAIR1_DIR
}
/SCHED_NR_UE/phy_procedures_nr_ue.c
${
OPENAIR1_DIR
}
/SCHED_NR_UE/phy_procedures_nr_ue.c
#${OPENAIR1_DIR}/SCHED_NR_UE/phy_procedures_nr_common_ue.c
#${OPENAIR1_DIR}/SCHED_NR_UE/phy_procedures_nr_common_ue.c
${
PHY_POLARSRC
}
)
)
...
...
openair1/PHY/INIT/nr_init_ue.c
View file @
ff26c550
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
#include "PHY/NR_UE_TRANSPORT/nr_transport_ue.h"
#include "PHY/NR_UE_TRANSPORT/nr_transport_ue.h"
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
#include "PHY/LTE_REFSIG/lte_refsig.h"
#include "PHY/LTE_REFSIG/lte_refsig.h"
#include "PHY/CODING/nrPolar_tools/nr_polar_pbch_defs.h"
//uint8_t dmrs1_tab_ue[8] = {0,2,3,4,6,8,9,10};
//uint8_t dmrs1_tab_ue[8] = {0,2,3,4,6,8,9,10};
...
@@ -841,17 +842,17 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
...
@@ -841,17 +842,17 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
pbch_vars
[
eNB_id
]
->
rxdataF_ext
=
(
int32_t
**
)
malloc16
(
fp
->
nb_antennas_rx
*
sizeof
(
int32_t
*
)
);
pbch_vars
[
eNB_id
]
->
rxdataF_ext
=
(
int32_t
**
)
malloc16
(
fp
->
nb_antennas_rx
*
sizeof
(
int32_t
*
)
);
pbch_vars
[
eNB_id
]
->
rxdataF_comp
=
(
int32_t
**
)
malloc16_clear
(
8
*
sizeof
(
int32_t
*
)
);
pbch_vars
[
eNB_id
]
->
rxdataF_comp
=
(
int32_t
**
)
malloc16_clear
(
8
*
sizeof
(
int32_t
*
)
);
pbch_vars
[
eNB_id
]
->
dl_ch_estimates_ext
=
(
int32_t
**
)
malloc16_clear
(
8
*
sizeof
(
int32_t
*
)
);
pbch_vars
[
eNB_id
]
->
dl_ch_estimates_ext
=
(
int32_t
**
)
malloc16_clear
(
8
*
sizeof
(
int32_t
*
)
);
pbch_vars
[
eNB_id
]
->
llr
=
(
int8_t
*
)
malloc16_clear
(
1920
);
pbch_vars
[
eNB_id
]
->
llr
=
(
int8_t
*
)
malloc16_clear
(
1920
);
//
prach_vars
[
eNB_id
]
->
prachF
=
(
int16_t
*
)
malloc16_clear
(
sizeof
(
int
)
*
(
7
*
2
*
sizeof
(
int
)
*
(
fp
->
ofdm_symbol_size
*
12
))
);
prach_vars
[
eNB_id
]
->
prachF
=
(
int16_t
*
)
malloc16_clear
(
sizeof
(
int
)
*
(
7
*
2
*
sizeof
(
int
)
*
(
fp
->
ofdm_symbol_size
*
12
))
);
prach_vars
[
eNB_id
]
->
prach
=
(
int16_t
*
)
malloc16_clear
(
sizeof
(
int
)
*
(
7
*
2
*
sizeof
(
int
)
*
(
fp
->
ofdm_symbol_size
*
12
))
);
prach_vars
[
eNB_id
]
->
prach
=
(
int16_t
*
)
malloc16_clear
(
sizeof
(
int
)
*
(
7
*
2
*
sizeof
(
int
)
*
(
fp
->
ofdm_symbol_size
*
12
))
);
for
(
i
=
0
;
i
<
fp
->
nb_antennas_rx
;
i
++
)
{
for
(
i
=
0
;
i
<
fp
->
nb_antennas_rx
;
i
++
)
{
pbch_vars
[
eNB_id
]
->
rxdataF_ext
[
i
]
=
(
int32_t
*
)
malloc16_clear
(
sizeof
(
int32_t
)
*
6
*
12
*
4
);
pbch_vars
[
eNB_id
]
->
rxdataF_ext
[
i
]
=
(
int32_t
*
)
malloc16_clear
(
sizeof
(
int32_t
)
*
20
*
12
*
4
);
for
(
j
=
0
;
j
<
4
;
j
++
)
{
//fp->nb_antennas_tx;j++) {
for
(
j
=
0
;
j
<
4
;
j
++
)
{
//fp->nb_antennas_tx;j++) {
int
idx
=
(
j
<<
1
)
+
i
;
int
idx
=
(
j
<<
1
)
+
i
;
pbch_vars
[
eNB_id
]
->
rxdataF_comp
[
idx
]
=
(
int32_t
*
)
malloc16_clear
(
sizeof
(
int32_t
)
*
6
*
12
*
4
);
pbch_vars
[
eNB_id
]
->
rxdataF_comp
[
idx
]
=
(
int32_t
*
)
malloc16_clear
(
sizeof
(
int32_t
)
*
20
*
12
*
4
);
pbch_vars
[
eNB_id
]
->
dl_ch_estimates_ext
[
idx
]
=
(
int32_t
*
)
malloc16_clear
(
sizeof
(
int32_t
)
*
6
*
12
*
4
);
pbch_vars
[
eNB_id
]
->
dl_ch_estimates_ext
[
idx
]
=
(
int32_t
*
)
malloc16_clear
(
sizeof
(
int32_t
)
*
20
*
12
*
4
);
}
}
}
}
}
}
...
@@ -955,6 +956,9 @@ void phy_init_nr_top(NR_DL_FRAME_PARMS *frame_parms)
...
@@ -955,6 +956,9 @@ void phy_init_nr_top(NR_DL_FRAME_PARMS *frame_parms)
generate_ul_reference_signal_sequences
(
SHRT_MAX
);
generate_ul_reference_signal_sequences
(
SHRT_MAX
);
// Polar encoder init for PBCH
nr_polar_init
(
&
frame_parms
->
pbch_polar_params
,
1
);
//lte_sync_time_init(frame_parms);
//lte_sync_time_init(frame_parms);
//generate_ul_ref_sigs();
//generate_ul_ref_sigs();
...
...
openair1/PHY/INIT/nr_parms.c
View file @
ff26c550
...
@@ -165,18 +165,6 @@ int nr_init_frame_parms_ue(nfapi_config_request_t* config,
...
@@ -165,18 +165,6 @@ int nr_init_frame_parms_ue(nfapi_config_request_t* config,
LOG_I
(
PHY
,
"Initializing frame parms for mu %d, N_RB %d, Ncp %d
\n
"
,
mu
,
N_RB
,
Ncp
);
LOG_I
(
PHY
,
"Initializing frame parms for mu %d, N_RB %d, Ncp %d
\n
"
,
mu
,
N_RB
,
Ncp
);
#endif
#endif
frame_parms
->
frame_type
=
FDD
;
frame_parms
->
tdd_config
=
3
;
//frame_parms[CC_id]->tdd_config_S = 0;
frame_parms
->
N_RB_DL
=
100
;
frame_parms
->
N_RB_UL
=
100
;
frame_parms
->
Ncp
=
NORMAL
;
//frame_parms[CC_id]->Ncp_UL = NORMAL;
frame_parms
->
Nid_cell
=
0
;
//frame_parms[CC_id]->num_MBSFN_config = 0;
frame_parms
->
nb_antenna_ports_eNB
=
1
;
frame_parms
->
nb_antennas_tx
=
1
;
frame_parms
->
nb_antennas_rx
=
1
;
if
(
Ncp
==
EXTENDED
)
if
(
Ncp
==
EXTENDED
)
AssertFatal
(
mu
==
NR_MU_2
,
"Invalid cyclic prefix %d for numerology index %d
\n
"
,
Ncp
,
mu
);
AssertFatal
(
mu
==
NR_MU_2
,
"Invalid cyclic prefix %d for numerology index %d
\n
"
,
Ncp
,
mu
);
...
...
openair1/PHY/NR_REFSIG/nr_dmrs_rx.c
View file @
ff26c550
...
@@ -49,7 +49,9 @@ int wt1[8][2] = {{1,1},{1,1},{1,1},{1,1},{1,-1},{1,-1},{1,-1},{1,-1}};
...
@@ -49,7 +49,9 @@ int wt1[8][2] = {{1,1},{1,1},{1,1},{1,1},{1,-1},{1,-1},{1,-1},{1,-1}};
int
wf2
[
12
][
2
]
=
{{
1
,
1
},{
1
,
-
1
},{
1
,
1
},{
1
,
-
1
},{
1
,
1
},{
1
,
-
1
},{
1
,
1
},{
1
,
1
},{
1
,
1
},{
1
,
-
1
},{
1
,
1
},{
1
,
1
}};
int
wf2
[
12
][
2
]
=
{{
1
,
1
},{
1
,
-
1
},{
1
,
1
},{
1
,
-
1
},{
1
,
1
},{
1
,
-
1
},{
1
,
1
},{
1
,
1
},{
1
,
1
},{
1
,
-
1
},{
1
,
1
},{
1
,
1
}};
int
wt2
[
12
][
2
]
=
{{
1
,
1
},{
1
,
1
},{
1
,
1
},{
1
,
1
},{
1
,
1
},{
1
,
1
},{
1
,
-
1
},{
1
,
-
1
},{
1
,
-
1
},{
1
,
-
1
},{
1
,
-
1
},{
1
,
-
1
}};
int
wt2
[
12
][
2
]
=
{{
1
,
1
},{
1
,
1
},{
1
,
1
},{
1
,
1
},{
1
,
1
},{
1
,
1
},{
1
,
-
1
},{
1
,
-
1
},{
1
,
-
1
},{
1
,
-
1
},{
1
,
-
1
},{
1
,
-
1
}};
short
nr_mod_table
[
14
]
=
{
0
,
0
,
23170
,
23170
,
-
23170
,
-
23170
,
23170
,
23170
,
23170
,
-
23170
,
-
23170
,
23170
,
-
23170
,
-
23170
};
//short nr_mod_table[14] = {0,0,-23170,-23170,23170,23170,-23170,-23170,-23170,23170,23170,-23170,23170,23170};
short
nr_mod_table
[
14
]
=
{
0
,
0
,
23170
,
-
23170
,
-
23170
,
23170
,
23170
,
-
23170
,
23170
,
23170
,
-
23170
,
-
23170
,
-
23170
,
23170
};
//short nr_mod_table[14] = {0,0,23170,23170,-23170,-23170,23170,23170,23170,-23170,-23170,23170,-23170,-23170};
//extern short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT];
//extern short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT];
...
@@ -149,8 +151,8 @@ int nr_pbch_dmrs_rx(unsigned int *nr_gold_pbch,
...
@@ -149,8 +151,8 @@ int nr_pbch_dmrs_rx(unsigned int *nr_gold_pbch,
((
int16_t
*
)
output
)[(
m
<<
1
)
+
1
]
=
nr_mod_table
[((
1
+
((
nr_gold_pbch
[
m
>>
5
]
&
(
1
<<
(
m
&
0x1f
)))
>>
(
m
&
0x1f
)))
<<
1
)
+
1
];
((
int16_t
*
)
output
)[(
m
<<
1
)
+
1
]
=
nr_mod_table
[((
1
+
((
nr_gold_pbch
[
m
>>
5
]
&
(
1
<<
(
m
&
0x1f
)))
>>
(
m
&
0x1f
)))
<<
1
)
+
1
];
#ifdef DEBUG_PBCH
#ifdef DEBUG_PBCH
//printf("nr_gold_pbch[m>>5] %x\n",nr_gold_pbch[m>>5]);
//printf("nr_gold_pbch[m>>5] %x\n",nr_gold_pbch[m>>5]);
if
(
m
<
6
)
if
(
m
<
1
6
)
printf
(
"m %d output %d %d addr %p
\n
"
,
m
,
output
[
2
*
m
],
output
[
2
*
m
+
1
],
&
output
[
0
]);
printf
(
"m %d output %d %d addr %p
\n
"
,
m
,
((
int16_t
*
)
output
)[
m
<<
1
],
((
int16_t
*
)
output
)[(
m
<<
1
)
+
1
],
&
output
[
0
]);
#endif
#endif
}
}
...
...
openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c
View file @
ff26c550
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
#include "PHY/defs_nr_UE.h"
#include "PHY/defs_nr_UE.h"
#include "filt16a_32.h"
#include "filt16a_32.h"
#include "T.h"
#include "T.h"
#define DEBUG_CH
//
#define DEBUG_CH
int
nr_pbch_channel_estimation
(
PHY_VARS_NR_UE
*
ue
,
int
nr_pbch_channel_estimation
(
PHY_VARS_NR_UE
*
ue
,
uint8_t
eNB_id
,
uint8_t
eNB_id
,
...
@@ -41,20 +41,19 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
...
@@ -41,20 +41,19 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
unsigned
char
aarx
;
unsigned
char
aarx
;
unsigned
short
k
;
unsigned
short
k
;
unsigned
int
pilot_cnt
;
unsigned
int
pilot_cnt
;
int16_t
ch
[
2
],
*
pil
,
*
rxF
,
*
dl_ch
,
*
fl
,
*
fm
,
*
f
2l
,
*
fr
,
f1
,
*
f2r
,
*
fl_dc
,
*
fm_dc
,
*
fr_dc
;
int16_t
ch
[
2
],
*
pil
,
*
rxF
,
*
dl_ch
,
*
fl
,
*
fm
,
*
f
r
;
int
ch_offset
,
symbol_offset
;
int
ch_offset
,
symbol_offset
;
uint16_t
Nid_cell
=
(
eNB_offset
==
0
)
?
ue
->
frame_parms
.
Nid_cell
:
ue
->
measurements
.
adj_cell_id
[
eNB_offset
-
1
];
//
uint16_t Nid_cell = (eNB_offset == 0) ? ue->frame_parms.Nid_cell : ue->measurements.adj_cell_id[eNB_offset-1];
uint8_t
nushift
;
uint8_t
nushift
,
Lmax
,
ssb_index
=
0
,
n_hf
=
0
;
uint8_t
previous_thread_id
=
ue
->
current_thread_id
[
Ns
>>
1
]
==
0
?
(
RX_NB_TH
-
1
)
:
(
ue
->
current_thread_id
[
Ns
>>
1
]
-
1
);
int
**
dl_ch_estimates
=
ue
->
common_vars
.
common_vars_rx_data_per_thread
[
ue
->
current_thread_id
[
Ns
>>
1
]].
dl_ch_estimates
[
eNB_offset
];
int
**
dl_ch_estimates
=
ue
->
common_vars
.
common_vars_rx_data_per_thread
[
ue
->
current_thread_id
[
Ns
>>
1
]].
dl_ch_estimates
[
eNB_offset
];
int
**
rxdataF
=
ue
->
common_vars
.
common_vars_rx_data_per_thread
[
ue
->
current_thread_id
[
Ns
>>
1
]].
rxdataF
;
int
**
rxdataF
=
ue
->
common_vars
.
common_vars_rx_data_per_thread
[
ue
->
current_thread_id
[
Ns
>>
1
]].
rxdataF
;
Lmax
=
8
;
//to be updated
// recompute nushift with eNB_offset corresponding to adjacent eNB on which to perform channel estimation
nushift
=
(
Lmax
<
8
)
?
ssb_index
&
3
:
ssb_index
&
7
;
nushift
=
Nid_cell
%
4
;
ue
->
frame_parms
.
nushift
=
nushift
;
if
(
ue
->
high_speed_flag
==
0
)
// use second channel estimate position for temporary storage
if
(
ue
->
high_speed_flag
==
0
)
// use second channel estimate position for temporary storage
ch_offset
=
ue
->
frame_parms
.
ofdm_symbol_size
;
ch_offset
=
ue
->
frame_parms
.
ofdm_symbol_size
;
else
else
...
@@ -74,48 +73,24 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
...
@@ -74,48 +73,24 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
fl
=
filt16a_l0
;
fl
=
filt16a_l0
;
fm
=
filt16a_m0
;
fm
=
filt16a_m0
;
fr
=
filt16a_r0
;
fr
=
filt16a_r0
;
fl_dc
=
filt16a_l0
;
fm_dc
=
filt16a_m0
;
fr_dc
=
filt16a_r0
;
f1
=
filt16a_1
;
f2l
=
filt16a_2l0
;
f2r
=
filt16a_2r0
;
break
;
break
;
case
1
:
case
1
:
fl
=
filt16a_l1
;
fl
=
filt16a_l1
;
fm
=
filt16a_m1
;
fm
=
filt16a_m1
;
fr
=
filt16a_r1
;
fr
=
filt16a_r1
;
fl_dc
=
filt16a_l1
;
fm_dc
=
filt16a_m1
;
fr_dc
=
filt16a_r1
;
f1
=
filt16a_1
;
f2l
=
filt16a_2l1
;
f2r
=
filt16a_2r1
;
break
;
break
;
case
2
:
case
2
:
fl
=
filt16a_l2
;
fl
=
filt16a_l2
;
fm
=
filt16a_m2
;
fm
=
filt16a_m2
;
fr
=
filt16a_r2
;
fr
=
filt16a_r2
;
fl_dc
=
filt16a_l2
;
fm_dc
=
filt16a_m2
;
fr_dc
=
filt16a_r2
;
f1
=
filt16a_1
;
f2l
=
filt16a_2l0
;
f2r
=
filt16a_2r0
;
break
;
break
;
case
3
:
case
3
:
fl
=
filt16a_l3
;
fl
=
filt16a_l3
;
fm
=
filt16a_m3
;
fm
=
filt16a_m3
;
fr
=
filt16a_r3
;
fr
=
filt16a_r3
;
fl_dc
=
filt16a_l3
;
fm_dc
=
filt16a_m3
;
fr_dc
=
filt16a_r3
;
f1
=
filt16a_1
;
f2l
=
filt16a_2l1
;
f2r
=
filt16a_2r1
;
break
;
break
;
default:
default:
...
@@ -124,11 +99,8 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
...
@@ -124,11 +99,8 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
break
;
break
;
}
}
// generate pilot
// generate pilot
nr_pbch_dmrs_rx
(
ue
->
nr_gold_pbch
,
nr_pbch_dmrs_rx
(
ue
->
nr_gold_pbch
[
n_hf
][
ssb_index
],
&
pilot
[
p
][
0
]);
&
pilot
[
p
][
0
]);
for
(
aarx
=
0
;
aarx
<
ue
->
frame_parms
.
nb_antennas_rx
;
aarx
++
)
{
for
(
aarx
=
0
;
aarx
<
ue
->
frame_parms
.
nb_antennas_rx
;
aarx
++
)
{
...
@@ -154,7 +126,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
...
@@ -154,7 +126,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
ch
[
1
]
=
(
int16_t
)(((
int32_t
)
pil
[
0
]
*
rxF
[
1
]
+
(
int32_t
)
pil
[
1
]
*
rxF
[
0
])
>>
15
);
ch
[
1
]
=
(
int16_t
)(((
int32_t
)
pil
[
0
]
*
rxF
[
1
]
+
(
int32_t
)
pil
[
1
]
*
rxF
[
0
])
>>
15
);
#ifdef DEBUG_CH
#ifdef DEBUG_CH
printf
(
"ch 0 %d
\n
"
,((
int32_t
)
pil
[
0
]
*
rxF
[
0
]
-
(
int32_t
)
pil
[
1
]
*
rxF
[
1
]));
printf
(
"ch 0 %d
\n
"
,((
int32_t
)
pil
[
0
]
*
rxF
[
0
]
-
(
int32_t
)
pil
[
1
]
*
rxF
[
1
]));
printf
(
"pilot 0 : rxF - > (%d,%d)
ch -> (%d,%d), pil -> (%d,%d)
\n
"
,
rxF
[
0
],
rxF
[
1
],
ch
[
0
],
ch
[
1
],
pil
[
0
],
pil
[
1
]);
printf
(
"pilot 0 : rxF - > (%d,%d)
addr %p ch -> (%d,%d), pil -> (%d,%d)
\n
"
,
rxF
[
0
],
rxF
[
1
],
&
rxF
[
0
],
ch
[
0
],
ch
[
1
],
pil
[
0
],
pil
[
1
]);
#endif
#endif
multadd_real_vector_complex_scalar
(
fl
,
multadd_real_vector_complex_scalar
(
fl
,
ch
,
ch
,
...
@@ -162,8 +134,8 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
...
@@ -162,8 +134,8 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
16
);
16
);
pil
+=
2
;
pil
+=
2
;
rxF
+=
8
;
rxF
+=
8
;
for
(
int
i
=
0
;
i
<
8
;
i
++
)
//
for (int i= 0; i<8; i++)
printf
(
"dl_ch addr %p %d
\n
"
,
dl_ch
+
i
,
*
(
dl_ch
+
i
));
//
printf("dl_ch addr %p %d\n", dl_ch+i, *(dl_ch+i));
ch
[
0
]
=
(
int16_t
)(((
int32_t
)
pil
[
0
]
*
rxF
[
0
]
-
(
int32_t
)
pil
[
1
]
*
rxF
[
1
])
>>
15
);
ch
[
0
]
=
(
int16_t
)(((
int32_t
)
pil
[
0
]
*
rxF
[
0
]
-
(
int32_t
)
pil
[
1
]
*
rxF
[
1
])
>>
15
);
ch
[
1
]
=
(
int16_t
)(((
int32_t
)
pil
[
0
]
*
rxF
[
1
]
+
(
int32_t
)
pil
[
1
]
*
rxF
[
0
])
>>
15
);
ch
[
1
]
=
(
int16_t
)(((
int32_t
)
pil
[
0
]
*
rxF
[
1
]
+
(
int32_t
)
pil
[
1
]
*
rxF
[
0
])
>>
15
);
...
@@ -174,19 +146,15 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
...
@@ -174,19 +146,15 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
ch
,
ch
,
dl_ch
,
dl_ch
,
16
);
16
);
//printf("after dl_ch %d %d\n", dl_ch, *(dl_ch));
//for (int i= 0; i<16; i++)
// printf("dl_ch %d %d\n", dl_ch+i, *(dl_ch+i));
pil
+=
2
;
pil
+=
2
;
rxF
+=
8
;
rxF
+=
8
;
ch
[
0
]
=
(
int16_t
)(((
int32_t
)
pil
[
0
]
*
rxF
[
0
]
-
(
int32_t
)
pil
[
1
]
*
rxF
[
1
])
>>
15
);
ch
[
0
]
=
(
int16_t
)(((
int32_t
)
pil
[
0
]
*
rxF
[
0
]
-
(
int32_t
)
pil
[
1
]
*
rxF
[
1
])
>>
15
);
ch
[
1
]
=
(
int16_t
)(((
int32_t
)
pil
[
0
]
*
rxF
[
1
]
+
(
int32_t
)
pil
[
1
]
*
rxF
[
0
])
>>
15
);
ch
[
1
]
=
(
int16_t
)(((
int32_t
)
pil
[
0
]
*
rxF
[
1
]
+
(
int32_t
)
pil
[
1
]
*
rxF
[
0
])
>>
15
);
#ifdef DEBUG_CH
#ifdef DEBUG_CH
printf
(
"pilot 2 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d)
\n
"
,
rxF
[
0
],
rxF
[
1
],
ch
[
0
],
ch
[
1
],
pil
[
0
],
pil
[
1
]);
printf
(
"pilot 2 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d)
\n
"
,
rxF
[
0
],
rxF
[
1
],
ch
[
0
],
ch
[
1
],
pil
[
0
],
pil
[
1
]);
#endif
#endif
multadd_real_vector_complex_scalar
(
fr
,
multadd_real_vector_complex_scalar
(
fr
,
ch
,
ch
,
...
@@ -204,7 +172,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
...
@@ -204,7 +172,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
ch
[
0
]
=
(
int16_t
)(((
int32_t
)
pil
[
0
]
*
rxF
[
0
]
-
(
int32_t
)
pil
[
1
]
*
rxF
[
1
])
>>
15
);
ch
[
0
]
=
(
int16_t
)(((
int32_t
)
pil
[
0
]
*
rxF
[
0
]
-
(
int32_t
)
pil
[
1
]
*
rxF
[
1
])
>>
15
);
ch
[
1
]
=
(
int16_t
)(((
int32_t
)
pil
[
0
]
*
rxF
[
1
]
+
(
int32_t
)
pil
[
1
]
*
rxF
[
0
])
>>
15
);
ch
[
1
]
=
(
int16_t
)(((
int32_t
)
pil
[
0
]
*
rxF
[
1
]
+
(
int32_t
)
pil
[
1
]
*
rxF
[
0
])
>>
15
);
#ifdef DEBUG_CH
#ifdef DEBUG_CH
//
printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
printf
(
"pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d)
\n
"
,
pilot_cnt
,
rxF
[
0
],
rxF
[
1
],
ch
[
0
],
ch
[
1
],
pil
[
0
],
pil
[
1
]);
#endif
#endif
multadd_real_vector_complex_scalar
(
fl
,
multadd_real_vector_complex_scalar
(
fl
,
ch
,
ch
,
...
@@ -220,7 +188,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
...
@@ -220,7 +188,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
ch
[
0
]
=
(
int16_t
)(((
int32_t
)
pil
[
0
]
*
rxF
[
0
]
-
(
int32_t
)
pil
[
1
]
*
rxF
[
1
])
>>
15
);
ch
[
0
]
=
(
int16_t
)(((
int32_t
)
pil
[
0
]
*
rxF
[
0
]
-
(
int32_t
)
pil
[
1
]
*
rxF
[
1
])
>>
15
);
ch
[
1
]
=
(
int16_t
)(((
int32_t
)
pil
[
0
]
*
rxF
[
1
]
+
(
int32_t
)
pil
[
1
]
*
rxF
[
0
])
>>
15
);
ch
[
1
]
=
(
int16_t
)(((
int32_t
)
pil
[
0
]
*
rxF
[
1
]
+
(
int32_t
)
pil
[
1
]
*
rxF
[
0
])
>>
15
);
#ifdef DEBUG_CH
#ifdef DEBUG_CH
//
printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
printf
(
"pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d)
\n
"
,
pilot_cnt
+
1
,
rxF
[
0
],
rxF
[
1
],
ch
[
0
],
ch
[
1
],
pil
[
0
],
pil
[
1
]);
#endif
#endif
multadd_real_vector_complex_scalar
(
fm
,
multadd_real_vector_complex_scalar
(
fm
,
ch
,
ch
,
...
@@ -232,9 +200,9 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
...
@@ -232,9 +200,9 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
ch
[
0
]
=
(
int16_t
)(((
int32_t
)
pil
[
0
]
*
rxF
[
0
]
-
(
int32_t
)
pil
[
1
]
*
rxF
[
1
])
>>
15
);
ch
[
0
]
=
(
int16_t
)(((
int32_t
)
pil
[
0
]
*
rxF
[
0
]
-
(
int32_t
)
pil
[
1
]
*
rxF
[
1
])
>>
15
);
ch
[
1
]
=
(
int16_t
)(((
int32_t
)
pil
[
0
]
*
rxF
[
1
]
+
(
int32_t
)
pil
[
1
]
*
rxF
[
0
])
>>
15
);
ch
[
1
]
=
(
int16_t
)(((
int32_t
)
pil
[
0
]
*
rxF
[
1
]
+
(
int32_t
)
pil
[
1
]
*
rxF
[
0
])
>>
15
);
#ifdef DEBUG_CH
#ifdef DEBUG_CH
//
printf("pilot 1 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
printf
(
"pilot 1 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d)
\n
"
,
rxF
[
0
],
rxF
[
1
],
ch
[
0
],
ch
[
1
],
pil
[
0
],
pil
[
1
]);
#endif
#endif
multadd_real_vector_complex_scalar
(
fr
,
multadd_real_vector_complex_scalar
(
fr
,
ch
,
ch
,
...
@@ -249,8 +217,6 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
...
@@ -249,8 +217,6 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
}
}
printf
(
"finish dl_ch addr %p
\n
"
,
dl_ch
);
}
}
return
(
0
);
return
(
0
);
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
View file @
ff26c550
...
@@ -52,7 +52,7 @@ void set_default_frame_parms_single(nfapi_config_request_t *config, NR_DL_FRAME_
...
@@ -52,7 +52,7 @@ void set_default_frame_parms_single(nfapi_config_request_t *config, NR_DL_FRAME_
//#define DEBUG_INITIAL_SYNCH
//#define DEBUG_INITIAL_SYNCH
int
pbch_detection
(
PHY_VARS_NR_UE
*
ue
,
runmode_t
mode
)
int
nr_
pbch_detection
(
PHY_VARS_NR_UE
*
ue
,
runmode_t
mode
)
{
{
uint8_t
l
,
pbch_decoded
,
frame_mod4
,
pbch_tx_ant
,
dummy
;
uint8_t
l
,
pbch_decoded
,
frame_mod4
,
pbch_tx_ant
,
dummy
;
...
@@ -95,6 +95,8 @@ int pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode)
...
@@ -95,6 +95,8 @@ int pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode)
pbch_decoded
=
0
;
pbch_decoded
=
0
;
printf
(
"pbch_detection nid_cell %d
\n
"
,
frame_parms
->
Nid_cell
);
//for (frame_mod4=0; frame_mod4<4; frame_mod4++) {
//for (frame_mod4=0; frame_mod4<4; frame_mod4++) {
pbch_tx_ant
=
nr_rx_pbch
(
ue
,
pbch_tx_ant
=
nr_rx_pbch
(
ue
,
&
ue
->
proc
.
proc_rxtx
[
0
],
&
ue
->
proc
.
proc_rxtx
[
0
],
...
@@ -105,11 +107,8 @@ int pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode)
...
@@ -105,11 +107,8 @@ int pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode)
ue
->
high_speed_flag
,
ue
->
high_speed_flag
,
frame_mod4
);
frame_mod4
);
if
((
pbch_tx_ant
>
0
)
&&
(
pbch_tx_ant
<=
2
))
{
pbch_decoded
=
0
;
//to be updated
pbch_decoded
=
1
;
// break;
// break;
}
//}
//}
...
@@ -127,43 +126,6 @@ int pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode)
...
@@ -127,43 +126,6 @@ int pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode)
// ue->pbch_vars[0]->decoded_output[0] = ue->pbch_vars[0]->decoded_output[2];
// ue->pbch_vars[0]->decoded_output[0] = ue->pbch_vars[0]->decoded_output[2];
// ue->pbch_vars[0]->decoded_output[2] = dummy;
// ue->pbch_vars[0]->decoded_output[2] = dummy;
// now check for Bandwidth of Cell
dummy
=
(
ue
->
pbch_vars
[
0
]
->
decoded_output
[
2
]
>>
5
)
&
7
;
switch
(
dummy
)
{
case
0
:
frame_parms
->
N_RB_DL
=
6
;
break
;
case
1
:
frame_parms
->
N_RB_DL
=
15
;
break
;
case
2
:
frame_parms
->
N_RB_DL
=
25
;
break
;
case
3
:
frame_parms
->
N_RB_DL
=
50
;
break
;
case
4
:
frame_parms
->
N_RB_DL
=
75
;
break
;
case
5
:
frame_parms
->
N_RB_DL
=
100
;
break
;
default:
LOG_E
(
PHY
,
"[UE%d] Initial sync: PBCH decoding: Unknown N_RB_DL
\n
"
,
ue
->
Mod_id
);
return
-
1
;
break
;
}
for
(
int
i
=
0
;
i
<
RX_NB_TH
;
i
++
)
for
(
int
i
=
0
;
i
<
RX_NB_TH
;
i
++
)
{
{
ue
->
proc
.
proc_rxtx
[
i
].
frame_rx
=
(((
ue
->
pbch_vars
[
0
]
->
decoded_output
[
2
]
&
3
)
<<
6
)
+
(
ue
->
pbch_vars
[
0
]
->
decoded_output
[
1
]
>>
2
))
<<
2
;
ue
->
proc
.
proc_rxtx
[
i
].
frame_rx
=
(((
ue
->
pbch_vars
[
0
]
->
decoded_output
[
2
]
&
3
)
<<
6
)
+
(
ue
->
pbch_vars
[
0
]
->
decoded_output
[
1
]
>>
2
))
<<
2
;
...
@@ -176,14 +138,11 @@ int pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode)
...
@@ -176,14 +138,11 @@ int pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode)
ue
->
proc
.
proc_rxtx
[
i
].
frame_tx
=
ue
->
proc
.
proc_rxtx
[
0
].
frame_rx
;
ue
->
proc
.
proc_rxtx
[
i
].
frame_tx
=
ue
->
proc
.
proc_rxtx
[
0
].
frame_rx
;
}
}
#ifdef DEBUG_INITIAL_SYNCH
#ifdef DEBUG_INITIAL_SYNCH
LOG_I
(
PHY
,
"[UE%d] Initial sync: pbch decoded sucessfully mode1_flag %d, tx_ant %d, frame %d
, N_RB_DL %d, phich_duration %d, phich_resource %s!
\n
"
,
LOG_I
(
PHY
,
"[UE%d] Initial sync: pbch decoded sucessfully mode1_flag %d, tx_ant %d, frame %d
\n
"
,
ue
->
Mod_id
,
ue
->
Mod_id
,
frame_parms
->
mode1_flag
,
frame_parms
->
mode1_flag
,
pbch_tx_ant
,
pbch_tx_ant
,
ue
->
proc
.
proc_rxtx
[
0
].
frame_rx
,
ue
->
proc
.
proc_rxtx
[
0
].
frame_rx
,);
frame_parms
->
N_RB_DL
,
frame_parms
->
phich_config_common
.
phich_duration
,
phich_resource
);
//frame_parms->phich_config_common.phich_resource);
#endif
#endif
return
(
0
);
return
(
0
);
}
else
{
}
else
{
...
@@ -192,7 +151,6 @@ int pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode)
...
@@ -192,7 +151,6 @@ int pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode)
}
}
char
phich_string
[
13
][
4
]
=
{
""
,
"1/6"
,
""
,
"1/2"
,
""
,
""
,
"one"
,
""
,
""
,
""
,
""
,
""
,
"two"
};
char
duplex_string
[
2
][
4
]
=
{
"FDD"
,
"TDD"
};
char
duplex_string
[
2
][
4
]
=
{
"FDD"
,
"TDD"
};
char
prefix_string
[
2
][
9
]
=
{
"NORMAL"
,
"EXTENDED"
};
char
prefix_string
[
2
][
9
]
=
{
"NORMAL"
,
"EXTENDED"
};
...
@@ -260,11 +218,12 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode)
...
@@ -260,11 +218,12 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode)
rx_sss_nr
(
ue
,
&
metric_fdd_ncp
,
&
phase_fdd_ncp
);
rx_sss_nr
(
ue
,
&
metric_fdd_ncp
,
&
phase_fdd_ncp
);
set_default_frame_parms_single
(
config
,
&
ue
->
frame_parms
);
//
set_default_frame_parms_single(config,&ue->frame_parms);
nr_init_frame_parms_ue
(
config
,
&
ue
->
frame_parms
);
nr_init_frame_parms_ue
(
config
,
&
ue
->
frame_parms
);
nr_gold_pbch
(
ue
);
nr_gold_pbch
(
ue
);
ret
=
pbch_detection
(
ue
,
mode
);
ret
=
nr_pbch_detection
(
ue
,
mode
);
ret
=
-
1
;
//to be deleted
// write_output("rxdata2.m","rxd2",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
// write_output("rxdata2.m","rxd2",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
#ifdef DEBUG_INITIAL_SYNCH
#ifdef DEBUG_INITIAL_SYNCH
...
@@ -322,10 +281,6 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode)
...
@@ -322,10 +281,6 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode)
}
}
#endif
#endif
generate_pcfich_reg_mapping
(
frame_parms
);
generate_phich_reg_mapping
(
frame_parms
);
ue
->
pbch_vars
[
0
]
->
pdu_errors_conseq
=
0
;
ue
->
pbch_vars
[
0
]
->
pdu_errors_conseq
=
0
;
}
}
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c
View file @
ff26c550
...
@@ -31,20 +31,12 @@
...
@@ -31,20 +31,12 @@
*/
*/
#include "PHY/defs_nr_UE.h"
#include "PHY/defs_nr_UE.h"
#include "PHY/CODING/coding_extern.h"
#include "PHY/CODING/coding_extern.h"
#include "PHY/CODING/lte_interleaver_inline.h"
//#include "defs.h"
//#include "extern.h"
#include "PHY/phy_extern_nr_ue.h"
#include "PHY/phy_extern_nr_ue.h"
#include "PHY/sse_intrin.h"
#include "PHY/sse_intrin.h"
#include "SIMULATION/TOOLS/sim.h"
#ifdef PHY_ABSTRACTION
#include "SIMULATION/TOOLS/defs.h"
#endif
//#define DEBUG_PBCH 1
//#define DEBUG_PBCH 1
//#define DEBUG_PBCH_ENCODING
//#define DEBUG_PBCH_ENCODING
//#define INTERFERENCE_MITIGATION 1
#ifdef OPENAIR2
#ifdef OPENAIR2
//#include "PHY_INTERFACE/defs.h"
//#include "PHY_INTERFACE/defs.h"
...
@@ -71,17 +63,17 @@ uint16_t nr_pbch_extract(int **rxdataF,
...
@@ -71,17 +63,17 @@ uint16_t nr_pbch_extract(int **rxdataF,
int
nushiftmod4
=
frame_parms
->
nushift
;
int
nushiftmod4
=
frame_parms
->
nushift
;
for
(
aarx
=
0
;
aarx
<
frame_parms
->
nb_antennas_rx
;
aarx
++
)
{
for
(
aarx
=
0
;
aarx
<
frame_parms
->
nb_antennas_rx
;
aarx
++
)
{
printf
(
"extract_rbs (nushift %d): rx_offset=%d, symbol %d
\n
"
,
frame_parms
->
nushift
,
(
rx_offset
+
(
symbol
*
(
frame_parms
->
ofdm_symbol_size
))),
symbol
);
rxF
=
&
rxdataF
[
aarx
][(
rx_offset
+
(
symbol
*
(
frame_parms
->
ofdm_symbol_size
)))];
rxF
=
&
rxdataF
[
aarx
][(
rx_offset
+
(
symbol
*
(
frame_parms
->
ofdm_symbol_size
)))];
rxF_ext
=
&
rxdataF_ext
[
aarx
][
symbol
*
(
20
*
12
)];
rxF_ext
=
&
rxdataF_ext
[
aarx
][
symbol
*
(
20
*
12
)];
#ifdef DEBUG_PBCH
#ifdef DEBUG_PBCH
printf
(
"extract_rbs (nushift %d): rx_offset=%d, symbol %d
\n
"
,
frame_parms
->
nushift
,
(
rx_offset
+
(
symbol
*
(
frame_parms
->
ofdm_symbol_size
))),
symbol
);
int16_t
*
p
=
(
int16_t
*
)
rxF
;
int16_t
*
p
=
(
int16_t
*
)
rxF
;
for
(
int
i
=
0
;
i
<
240
;
i
++
){
for
(
int
i
=
0
;
i
<
8
;
i
++
){
printf
(
"rxF [%d]= %d
\n
"
,
i
,
rxF
[
i
]);
printf
(
"rxF [%d]= %d
\n
"
,
i
,
rxF
[
i
]);
printf
(
"pbch pss %d %d @%p
\n
"
,
p
[
2
*
i
],
p
[
2
*
i
+
1
],
&
p
[
2
*
i
]);
printf
(
"pbch extract rxF %d %d addr %p
\n
"
,
p
[
2
*
i
],
p
[
2
*
i
+
1
],
&
p
[
2
*
i
]);
printf
(
"rxF ext addr %p
\n
"
,
&
rxF_ext
[
i
]);
}
}
#endif
#endif
...
@@ -105,13 +97,13 @@ uint16_t nr_pbch_extract(int **rxdataF,
...
@@ -105,13 +97,13 @@ uint16_t nr_pbch_extract(int **rxdataF,
rxF
+=
12
;
rxF
+=
12
;
rxF_ext
+=
9
;
rxF_ext
+=
9
;
}
else
{
//symbol 2
}
else
{
//symbol 2
if
((
rb
<
4
)
&&
(
rb
>
15
)){
if
((
rb
<
4
)
||
(
rb
>
15
)){
for
(
i
=
0
;
i
<
12
;
i
++
)
{
for
(
i
=
0
;
i
<
12
;
i
++
)
{
if
((
i
!=
nushiftmod4
)
&&
if
((
i
!=
nushiftmod4
)
&&
(
i
!=
(
nushiftmod4
+
4
))
&&
(
i
!=
(
nushiftmod4
+
4
))
&&
(
i
!=
(
nushiftmod4
+
8
)))
{
(
i
!=
(
nushiftmod4
+
8
)))
{
rxF_ext
[
j
]
=
rxF
[
i
];
rxF_ext
[
j
]
=
rxF
[
i
];
//printf("rxF ext[%d] = %d at %p\n",j,rxF_ext[j],&rxF[i]);
//printf("
symbol2
rxF ext[%d] = %d at %p\n",j,rxF_ext[j],&rxF[i]);
j
++
;
j
++
;
}
}
}
}
...
@@ -128,7 +120,7 @@ uint16_t nr_pbch_extract(int **rxdataF,
...
@@ -128,7 +120,7 @@ uint16_t nr_pbch_extract(int **rxdataF,
else
else
dl_ch0
=
&
dl_ch_estimates
[(
aatx
<<
1
)
+
aarx
][
0
];
dl_ch0
=
&
dl_ch_estimates
[(
aatx
<<
1
)
+
aarx
][
0
];
printf
(
"dl_ch0 addr %p
\n
"
,
dl_ch0
);
//
printf("dl_ch0 addr %p\n",dl_ch0);
dl_ch0_ext
=
&
dl_ch_estimates_ext
[(
aatx
<<
1
)
+
aarx
][
symbol
*
(
20
*
12
)];
dl_ch0_ext
=
&
dl_ch_estimates_ext
[(
aatx
<<
1
)
+
aarx
][
symbol
*
(
20
*
12
)];
...
@@ -140,8 +132,8 @@ uint16_t nr_pbch_extract(int **rxdataF,
...
@@ -140,8 +132,8 @@ uint16_t nr_pbch_extract(int **rxdataF,
(
i
!=
(
nushiftmod4
+
4
))
&&
(
i
!=
(
nushiftmod4
+
4
))
&&
(
i
!=
(
nushiftmod4
+
8
)))
{
(
i
!=
(
nushiftmod4
+
8
)))
{
dl_ch0_ext
[
j
]
=
dl_ch0
[
i
];
dl_ch0_ext
[
j
]
=
dl_ch0
[
i
];
if
((
rb
==
0
)
&&
(
i
<
2
))
//
if ((rb==0) && (i<2))
printf
(
"dl ch0 ext[%d] = %d dl_ch0 [%d]= %d
\n
"
,
j
,
dl_ch0_ext
[
j
],
i
,
dl_ch0
[
i
]);
//
printf("dl ch0 ext[%d] = %d dl_ch0 [%d]= %d\n",j,dl_ch0_ext[j],i,dl_ch0[i]);
j
++
;
j
++
;
}
}
}
}
...
@@ -150,12 +142,13 @@ uint16_t nr_pbch_extract(int **rxdataF,
...
@@ -150,12 +142,13 @@ uint16_t nr_pbch_extract(int **rxdataF,
dl_ch0_ext
+=
9
;
dl_ch0_ext
+=
9
;
}
}
else
{
//symbol 2
else
{
//symbol 2
if
((
rb
<
4
)
&&
(
rb
>
15
)){
if
((
rb
<
4
)
||
(
rb
>
15
)){
for
(
i
=
0
;
i
<
12
;
i
++
)
{
for
(
i
=
0
;
i
<
12
;
i
++
)
{
if
((
i
!=
nushiftmod4
)
&&
if
((
i
!=
nushiftmod4
)
&&
(
i
!=
(
nushiftmod4
+
4
))
&&
(
i
!=
(
nushiftmod4
+
4
))
&&
(
i
!=
(
nushiftmod4
+
8
)))
{
(
i
!=
(
nushiftmod4
+
8
)))
{
dl_ch0_ext
[
j
]
=
dl_ch0
[
i
];
dl_ch0_ext
[
j
]
=
dl_ch0
[
i
];
//printf("symbol2 dl ch0 ext[%d] = %d dl_ch0 [%d]= %d\n",j,dl_ch0_ext[j],i,dl_ch0[i]);
j
++
;
j
++
;
}
}
}
}
...
@@ -181,7 +174,7 @@ int nr_pbch_channel_level(int **dl_ch_estimates_ext,
...
@@ -181,7 +174,7 @@ int nr_pbch_channel_level(int **dl_ch_estimates_ext,
uint32_t
symbol
)
uint32_t
symbol
)
{
{
int16_t
rb
,
nb_rb
=
6
;
int16_t
rb
,
nb_rb
=
20
;
uint8_t
aatx
,
aarx
;
uint8_t
aatx
,
aarx
;
#if defined(__x86_64__) || defined(__i386__)
#if defined(__x86_64__) || defined(__i386__)
...
@@ -193,19 +186,16 @@ int nr_pbch_channel_level(int **dl_ch_estimates_ext,
...
@@ -193,19 +186,16 @@ int nr_pbch_channel_level(int **dl_ch_estimates_ext,
#endif
#endif
int
avg1
=
0
,
avg2
=
0
;
int
avg1
=
0
,
avg2
=
0
;
uint32_t
nsymb
=
(
frame_parms
->
Ncp
==
0
)
?
7
:
6
;
for
(
aatx
=
0
;
aatx
<
frame_parms
->
nb_antenna_ports_eNB
;
aatx
++
)
uint32_t
symbol_mod
=
symbol
%
nsymb
;
for
(
aatx
=
0
;
aatx
<
4
;
aatx
++
)
//frame_parms->nb_antenna_ports_eNB;aatx++)
for
(
aarx
=
0
;
aarx
<
frame_parms
->
nb_antennas_rx
;
aarx
++
)
{
for
(
aarx
=
0
;
aarx
<
frame_parms
->
nb_antennas_rx
;
aarx
++
)
{
//clear average level
//clear average level
#if defined(__x86_64__) || defined(__i386__)
#if defined(__x86_64__) || defined(__i386__)
avg128
=
_mm_setzero_si128
();
avg128
=
_mm_setzero_si128
();
dl_ch128
=
(
__m128i
*
)
&
dl_ch_estimates_ext
[(
aatx
<<
1
)
+
aarx
][
symbol
_mod
*
6
*
12
];
dl_ch128
=
(
__m128i
*
)
&
dl_ch_estimates_ext
[(
aatx
<<
1
)
+
aarx
][
symbol
*
20
*
12
];
#elif defined(__arm__)
#elif defined(__arm__)
avg128
=
vdupq_n_s32
(
0
);
avg128
=
vdupq_n_s32
(
0
);
dl_ch128
=
(
int16x8_t
*
)
&
dl_ch_estimates_ext
[(
aatx
<<
1
)
+
aarx
][
symbol
_mod
*
6
*
12
];
dl_ch128
=
(
int16x8_t
*
)
&
dl_ch_estimates_ext
[(
aatx
<<
1
)
+
aarx
][
symbol
*
20
*
12
];
#endif
#endif
for
(
rb
=
0
;
rb
<
nb_rb
;
rb
++
)
{
for
(
rb
=
0
;
rb
<
nb_rb
;
rb
++
)
{
...
@@ -257,22 +247,24 @@ void nr_pbch_channel_compensation(int **rxdataF_ext,
...
@@ -257,22 +247,24 @@ void nr_pbch_channel_compensation(int **rxdataF_ext,
uint8_t
output_shift
)
uint8_t
output_shift
)
{
{
uint16_t
rb
,
nb_rb
=
6
;
uint16_t
rb
,
nb_rb
=
20
;
uint8_t
aatx
,
aarx
,
symbol_mod
;
uint8_t
aatx
,
aarx
;
#if defined(__x86_64__) || defined(__i386__)
#if defined(__x86_64__) || defined(__i386__)
__m128i
*
dl_ch128
,
*
rxdataF128
,
*
rxdataF_comp128
;
__m128i
*
dl_ch128
,
*
rxdataF128
,
*
rxdataF_comp128
;
#elif defined(__arm__)
#elif defined(__arm__)
#endif
#endif
symbol_mod
=
(
symbol
>=
(
7
-
frame_parms
->
Ncp
))
?
symbol
-
(
7
-
frame_parms
->
Ncp
)
:
symbol
;
for
(
aatx
=
0
;
aatx
<
4
;
aatx
++
)
//
frame_parms->nb_antenna_ports_eNB;aatx++)
for
(
aatx
=
0
;
aatx
<
frame_parms
->
nb_antenna_ports_eNB
;
aatx
++
)
for
(
aarx
=
0
;
aarx
<
frame_parms
->
nb_antennas_rx
;
aarx
++
)
{
for
(
aarx
=
0
;
aarx
<
frame_parms
->
nb_antennas_rx
;
aarx
++
)
{
#if defined(__x86_64__) || defined(__i386__)
#if defined(__x86_64__) || defined(__i386__)
dl_ch128
=
(
__m128i
*
)
&
dl_ch_estimates_ext
[(
aatx
<<
1
)
+
aarx
][
symbol_mod
*
6
*
12
];
dl_ch128
=
(
__m128i
*
)
&
dl_ch_estimates_ext
[(
aatx
<<
1
)
+
aarx
][
symbol
*
20
*
12
];
rxdataF128
=
(
__m128i
*
)
&
rxdataF_ext
[
aarx
][
symbol_mod
*
6
*
12
];
rxdataF128
=
(
__m128i
*
)
&
rxdataF_ext
[
aarx
][
symbol
*
20
*
12
];
rxdataF_comp128
=
(
__m128i
*
)
&
rxdataF_comp
[(
aatx
<<
1
)
+
aarx
][
symbol_mod
*
6
*
12
];
rxdataF_comp128
=
(
__m128i
*
)
&
rxdataF_comp
[(
aatx
<<
1
)
+
aarx
][
symbol
*
20
*
12
];
//printf("ch compensation dl_ch ext addr %p \n", &dl_ch_estimates_ext[(aatx<<1)+aarx][symbol*20*12]);
//printf("rxdataf ext addr %p symbol %d\n", &rxdataF_ext[aarx][symbol*20*12], symbol);
//printf("rxdataf_comp addr %p\n",&rxdataF_comp[(aatx<<1)+aarx][symbol*20*12]);
#elif defined(__arm__)
#elif defined(__arm__)
// to be filled in
// to be filled in
...
@@ -321,7 +313,6 @@ void nr_pbch_channel_compensation(int **rxdataF_ext,
...
@@ -321,7 +313,6 @@ void nr_pbch_channel_compensation(int **rxdataF_ext,
// print_shorts("ch:",dl_ch128+1);
// print_shorts("ch:",dl_ch128+1);
// print_shorts("pack:",rxdataF_comp128+1);
// print_shorts("pack:",rxdataF_comp128+1);
if
(
symbol_mod
>
1
)
{
// multiply by conjugated channel
// multiply by conjugated channel
mmtmpP0
=
_mm_madd_epi16
(
dl_ch128
[
2
],
rxdataF128
[
2
]);
mmtmpP0
=
_mm_madd_epi16
(
dl_ch128
[
2
],
rxdataF128
[
2
]);
// mmtmpP0 contains real part of 4 consecutive outputs (32-bit)
// mmtmpP0 contains real part of 4 consecutive outputs (32-bit)
...
@@ -342,11 +333,7 @@ void nr_pbch_channel_compensation(int **rxdataF_ext,
...
@@ -342,11 +333,7 @@ void nr_pbch_channel_compensation(int **rxdataF_ext,
dl_ch128
+=
3
;
dl_ch128
+=
3
;
rxdataF128
+=
3
;
rxdataF128
+=
3
;
rxdataF_comp128
+=
3
;
rxdataF_comp128
+=
3
;
}
else
{
dl_ch128
+=
2
;
rxdataF128
+=
2
;
rxdataF_comp128
+=
2
;
}
#elif defined(__arm__)
#elif defined(__arm__)
// to be filled in
// to be filled in
#endif
#endif
...
@@ -399,59 +386,30 @@ void nr_pbch_detection_mrc(NR_DL_FRAME_PARMS *frame_parms,
...
@@ -399,59 +386,30 @@ void nr_pbch_detection_mrc(NR_DL_FRAME_PARMS *frame_parms,
#endif
#endif
}
}
void
nr_pbch_scrambling
(
NR_DL_FRAME_PARMS
*
frame_parms
,
uint8_t
*
pbch_e
,
uint32_t
length
)
{
int
i
;
uint8_t
reset
;
uint32_t
x1
,
x2
,
s
=
0
;
reset
=
1
;
// x1 is set in lte_gold_generic
x2
=
frame_parms
->
Nid_cell
;
//this is c_init in 36.211 Sec 6.6.1
// msg("pbch_scrambling: Nid_cell = %d\n",x2);
for
(
i
=
0
;
i
<
length
;
i
++
)
{
if
((
i
&
0x1f
)
==
0
)
{
s
=
lte_gold_generic
(
&
x1
,
&
x2
,
reset
);
// printf("lte_gold[%d]=%x\n",i,s);
reset
=
0
;
}
pbch_e
[
i
]
=
(
pbch_e
[
i
]
&
1
)
^
((
s
>>
(
i
&
0x1f
))
&
1
);
}
}
void
nr_pbch_unscrambling
(
NR_DL_FRAME_PARMS
*
frame_parms
,
void
nr_pbch_unscrambling
(
NR_DL_FRAME_PARMS
*
frame_parms
,
int8_t
*
llr
,
uint8_t
*
pbch_a
,
uint32_t
length
,
uint32_t
length
)
uint8_t
frame_mod4
)
{
{
int
i
;
int
i
;
uint8_t
reset
;
uint8_t
reset
;
uint32_t
x1
,
x2
,
s
=
0
;
uint32_t
x1
,
x2
,
s
=
0
;
//printf("unscramb nid_cell %d\n",frame_parms->Nid_cell);
reset
=
1
;
reset
=
1
;
// x1 is set in first call to lte_gold_generic
// x1 is set in first call to lte_gold_generic
x2
=
frame_parms
->
Nid_cell
;
//this is c_init in 36.211 Sec 6.6.1
x2
=
frame_parms
->
Nid_cell
;
//this is c_init in 36.211 Sec 6.6.1
// msg("pbch_unscrambling: Nid_cell = %d\n",x2);
for
(
i
=
0
;
i
<
length
;
i
++
)
{
for
(
i
=
0
;
i
<
length
;
i
++
)
{
if
(
i
%
32
==
0
)
{
if
(
i
%
32
==
0
)
{
s
=
lte_gold_generic
(
&
x1
,
&
x2
,
reset
);
s
=
lte_gold_generic
(
&
x1
,
&
x2
,
reset
);
//
printf("lte_gold[%d]=%x\n",i,s);
//
printf("lte_gold[%d]=%x\n",i,s);
reset
=
0
;
reset
=
0
;
}
}
// take the quarter of the PBCH that corresponds to this frame
//printf("s = %d\n",((s>>(i%32))&1) );
if
((
i
>=
(
frame_mod4
*
(
length
>>
2
)))
&&
(
i
<
((
1
+
frame_mod4
)
*
(
length
>>
2
))))
{
if
(((
s
>>
(
i
%
32
))
&
1
)
==
1
)
// if (((s>>(i%32))&1)==1)
pbch_a
[
i
]
=
1
-
pbch_a
[
i
];
if
(((
s
>>
(
i
%
32
))
&
1
)
==
0
)
llr
[
i
]
=
-
llr
[
i
];
}
}
}
}
}
...
@@ -501,19 +459,19 @@ void nr_pbch_quantize(int8_t *pbch_llr8,
...
@@ -501,19 +459,19 @@ void nr_pbch_quantize(int8_t *pbch_llr8,
uint16_t
i
;
uint16_t
i
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
for
(
i
=
0
;
i
<
len
;
i
++
)
{
if
(
pbch_llr
[
i
]
>
7
)
/*
if (pbch_llr[i]>7)
pbch_llr8[i]=7;
pbch_llr8[i]=7;
else if (pbch_llr[i]<-8)
else if (pbch_llr[i]<-8)
pbch_llr8[i]=-8;
pbch_llr8[i]=-8;
else
else
*/
pbch_llr8
[
i
]
=
(
char
)(
pbch_llr
[
i
]);
pbch_llr8
[
i
]
=
(
char
)(
pbch_llr
[
i
]);
}
}
}
}
static
unsigned
char
dummy_w_rx
[
3
*
3
*
(
16
+
PBCH_A
)];
unsigned
char
sign
(
int8_t
x
)
{
static
int8_t
pbch_w_rx
[
3
*
3
*
(
16
+
PBCH_A
)],
pbch_d_rx
[
96
+
(
3
*
(
16
+
PBCH_A
))]
;
return
(
unsigned
char
)
x
>>
7
;
}
uint16_t
nr_rx_pbch
(
PHY_VARS_NR_UE
*
ue
,
uint16_t
nr_rx_pbch
(
PHY_VARS_NR_UE
*
ue
,
UE_nr_rxtx_proc_t
*
proc
,
UE_nr_rxtx_proc_t
*
proc
,
...
@@ -527,39 +485,40 @@ uint16_t nr_rx_pbch( PHY_VARS_NR_UE *ue,
...
@@ -527,39 +485,40 @@ uint16_t nr_rx_pbch( PHY_VARS_NR_UE *ue,
NR_UE_COMMON
*
nr_ue_common_vars
=
&
ue
->
common_vars
;
NR_UE_COMMON
*
nr_ue_common_vars
=
&
ue
->
common_vars
;
uint8_t
log2_maxh
;
//,aatx,aarx;
uint8_t
log2_maxh
;
int
max_h
=
0
;
int
max_h
=
0
;
int
symbol
,
i
;
int
symbol
,
i
;
uint32_t
nsymb
=
(
frame_parms
->
Ncp
==
0
)
?
14
:
12
;
//uint8_t pbch_a[64];
uint16_t
pbch_E
;
uint8_t
*
pbch_a
=
malloc
(
sizeof
(
uint8_t
)
*
32
);
;
uint8_t
pbch_a
[
8
];
uint8_t
RCC
;
int8_t
*
pbch_e_rx
;
int8_t
*
pbch_e_rx
;
uint8_t
*
decoded_output
=
nr_ue_pbch_vars
->
decoded_output
;
uint8_t
*
decoded_output
=
nr_ue_pbch_vars
->
decoded_output
;
uint16_t
crc
;
//uint16_t crc;
//short nr_demod_table[8] = {0,0,0,1,1,0,1,1};
double
nr_demod_table
[
8
]
=
{
0
.
707
,
0
.
707
,
0
.
707
,
-
0
.
707
,
-
0
.
707
,
0
.
707
,
-
0
.
707
,
-
0
.
707
};
double
*
demod_pbch_e
=
malloc
(
sizeof
(
double
)
*
864
);
unsigned
short
idx_demod
=
0
;
int8_t
decoderState
=
0
;
uint8_t
decoderListSize
=
8
,
pathMetricAppr
=
0
;
double
aPrioriArray
[
frame_parms
->
pbch_polar_params
.
payloadBits
];
// assume no a priori knowledge available about the payload.
int
subframe_rx
=
proc
->
subframe_rx
;
memset
(
&
pbch_a
[
0
],
0
,
sizeof
(
uint8_t
)
*
NR_POLAR_PBCH_PAYLOAD_BITS
)
;
//
pbch_D = 16+PBCH_A
;
//
printf("nr_pbch_ue nid_cell %d\n",frame_parms->Nid_cell)
;
pbch_E
=
(
frame_parms
->
Ncp
==
0
)
?
1920
:
1728
;
//RE/RB * #RB * bits/RB (QPSK)
for
(
int
i
=
0
;
i
<
frame_parms
->
pbch_polar_params
.
payloadBits
;
i
++
)
aPrioriArray
[
i
]
=
NAN
;
pbch_e_rx
=
&
nr_ue_pbch_vars
->
llr
[
frame_mod4
*
(
pbch_E
>>
2
)];
#ifdef DEBUG_PBCH
int
subframe_rx
=
proc
->
subframe_rx
;
msg
(
"[PBCH] starting symbol loop (Ncp %d, frame_mod4 %d,mimo_mode %d
\n
"
,
frame_parms
->
Ncp
,
frame_mod4
,
mimo_mode
);
#endif
pbch_e_rx
=
&
nr_ue_pbch_vars
->
llr
[
0
];
// clear LLR buffer
// clear LLR buffer
memset
(
nr_ue_pbch_vars
->
llr
,
0
,
pbch
_E
);
memset
(
nr_ue_pbch_vars
->
llr
,
0
,
NR_POLAR_PBCH
_E
);
for
(
symbol
=
1
;
symbol
<
4
;
symbol
++
)
{
for
(
symbol
=
1
;
symbol
<
4
;
symbol
++
)
{
#ifdef DEBUG_PBCH
//printf("address dataf %p",nr_ue_common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe_rx]].rxdataF);
msg
(
"[PBCH] starting extract ofdm size %d
\n
"
,
frame_parms
->
ofdm_symbol_size
);
#endif
printf
(
"address dataf %p"
,
nr_ue_common_vars
->
common_vars_rx_data_per_thread
[
ue
->
current_thread_id
[
subframe_rx
]].
rxdataF
);
//write_output("rxdataF0_pbch.m","rxF0pbch",nr_ue_common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe_rx]].rxdataF,frame_parms->ofdm_symbol_size*4,2,1);
//write_output("rxdataF0_pbch.m","rxF0pbch",nr_ue_common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe_rx]].rxdataF,frame_parms->ofdm_symbol_size*4,2,1);
nr_pbch_extract
(
nr_ue_common_vars
->
common_vars_rx_data_per_thread
[
ue
->
current_thread_id
[
subframe_rx
]].
rxdataF
,
nr_pbch_extract
(
nr_ue_common_vars
->
common_vars_rx_data_per_thread
[
ue
->
current_thread_id
[
subframe_rx
]].
rxdataF
,
...
@@ -570,7 +529,7 @@ uint16_t nr_rx_pbch( PHY_VARS_NR_UE *ue,
...
@@ -570,7 +529,7 @@ uint16_t nr_rx_pbch( PHY_VARS_NR_UE *ue,
high_speed_flag
,
high_speed_flag
,
frame_parms
);
frame_parms
);
#ifdef DEBUG_PBCH
#ifdef DEBUG_PBCH
msg
(
"[PHY] PBCH Symbol %d
\n
"
,
symbol
);
msg
(
"[PHY] PBCH Symbol %d
ofdm size %d
\n
"
,
symbol
,
frame_parms
->
ofdm_symbol_size
);
msg
(
"[PHY] PBCH starting channel_level
\n
"
);
msg
(
"[PHY] PBCH starting channel_level
\n
"
);
#endif
#endif
...
@@ -590,6 +549,8 @@ uint16_t nr_rx_pbch( PHY_VARS_NR_UE *ue,
...
@@ -590,6 +549,8 @@ uint16_t nr_rx_pbch( PHY_VARS_NR_UE *ue,
symbol
,
symbol
,
log2_maxh
);
// log2_maxh+I0_shift
log2_maxh
);
// log2_maxh+I0_shift
//write_output("rxdataF_comp.m","rxFcomp",nr_ue_pbch_vars->rxdataF_comp,180,2,1);
/*if (frame_parms->nb_antennas_rx > 1)
/*if (frame_parms->nb_antennas_rx > 1)
pbch_detection_mrc(frame_parms,
pbch_detection_mrc(frame_parms,
nr_ue_pbch_vars->rxdataF_comp,
nr_ue_pbch_vars->rxdataF_comp,
...
@@ -598,25 +559,23 @@ uint16_t nr_rx_pbch( PHY_VARS_NR_UE *ue,
...
@@ -598,25 +559,23 @@ uint16_t nr_rx_pbch( PHY_VARS_NR_UE *ue,
if
(
mimo_mode
==
ALAMOUTI
)
{
if
(
mimo_mode
==
ALAMOUTI
)
{
nr_pbch_alamouti
(
frame_parms
,
nr_ue_pbch_vars
->
rxdataF_comp
,
symbol
);
nr_pbch_alamouti
(
frame_parms
,
nr_ue_pbch_vars
->
rxdataF_comp
,
symbol
);
// msg("[PBCH][RX] Alamouti receiver not yet implemented!\n");
// return(-1);
}
else
if
(
mimo_mode
!=
SISO
)
{
}
else
if
(
mimo_mode
!=
SISO
)
{
msg
(
"[PBCH][RX] Unsupported MIMO mode
\n
"
);
msg
(
"[PBCH][RX] Unsupported MIMO mode
\n
"
);
return
(
-
1
);
return
(
-
1
);
}
}
if
(
symbol
>
(
nsymb
>>
1
)
+
1
)
{
if
(
symbol
==
2
)
{
nr_pbch_quantize
(
pbch_e_rx
,
nr_pbch_quantize
(
pbch_e_rx
,
(
short
*
)
&
(
nr_ue_pbch_vars
->
rxdataF_comp
[
0
][
(
symbol
%
(
nsymb
>>
1
))
*
72
]),
(
short
*
)
&
(
nr_ue_pbch_vars
->
rxdataF_comp
[
0
][
symbol
*
240
]),
144
);
144
);
pbch_e_rx
+=
144
;
pbch_e_rx
+=
144
;
}
else
{
}
else
{
nr_pbch_quantize
(
pbch_e_rx
,
nr_pbch_quantize
(
pbch_e_rx
,
(
short
*
)
&
(
nr_ue_pbch_vars
->
rxdataF_comp
[
0
][
(
symbol
%
(
nsymb
>>
1
))
*
72
]),
(
short
*
)
&
(
nr_ue_pbch_vars
->
rxdataF_comp
[
0
][
symbol
*
240
]),
96
);
360
);
pbch_e_rx
+=
96
;
pbch_e_rx
+=
360
;
}
}
...
@@ -624,114 +583,45 @@ uint16_t nr_rx_pbch( PHY_VARS_NR_UE *ue,
...
@@ -624,114 +583,45 @@ uint16_t nr_rx_pbch( PHY_VARS_NR_UE *ue,
pbch_e_rx
=
nr_ue_pbch_vars
->
llr
;
pbch_e_rx
=
nr_ue_pbch_vars
->
llr
;
//un-scrambling
#ifdef DEBUG_PBCH
#ifdef DEBUG_PBCH
msg
(
"[PBCH] doing unscrambling
\n
"
);
//pbch_e_rx = &nr_ue_pbch_vars->llr[0];
#endif
nr_pbch_unscrambling
(
frame_parms
,
pbch_e_rx
,
pbch_E
,
frame_mod4
);
//un-rate matching
short
*
p
=
(
short
*
)
&
(
nr_ue_pbch_vars
->
rxdataF_comp
[
0
][
1
*
20
*
12
]);
#ifdef DEBUG_PBCH
for
(
int
cnt
=
0
;
cnt
<
8
;
cnt
++
)
msg
(
"[PBCH] doing un-rate-matching
\n
"
);
printf
(
"pbch rx llr %d rxdata_comp %d addr %p
\n
"
,
*
(
pbch_e_rx
+
cnt
),
p
[
cnt
],
&
p
[
0
]
);
#endif
#endif
for
(
i
=
0
;
i
<
NR_POLAR_PBCH_E
/
2
;
i
++
){
memset
(
dummy_w_rx
,
0
,
3
*
3
*
(
16
+
PBCH_A
));
idx_demod
=
(
sign
(
pbch_e_rx
[
i
<<
1
])
&
1
)
^
((
sign
(
pbch_e_rx
[(
i
<<
1
)
+
1
])
&
1
)
<<
1
);
RCC
=
generate_dummy_w_cc
(
16
+
PBCH_A
,
demod_pbch_e
[
i
<<
1
]
=
nr_demod_table
[(
idx_demod
)
<<
1
];
dummy_w_rx
);
demod_pbch_e
[(
i
<<
1
)
+
1
]
=
nr_demod_table
[((
idx_demod
)
<<
1
)
+
1
];
lte_rate_matching_cc_rx
(
RCC
,
pbch_E
,
pbch_w_rx
,
dummy_w_rx
,
pbch_e_rx
);
sub_block_deinterleaving_cc
((
unsigned
int
)(
PBCH_A
+
16
),
&
pbch_d_rx
[
96
],
&
pbch_w_rx
[
0
]);
memset
(
pbch_a
,
0
,((
16
+
PBCH_A
)
>>
3
));
phy_viterbi_lte_sse2
(
pbch_d_rx
+
96
,
pbch_a
,
16
+
PBCH_A
);
// Fix byte endian of PBCH (bit 23 goes in first)
for
(
i
=
0
;
i
<
(
PBCH_A
>>
3
);
i
++
)
decoded_output
[(
PBCH_A
>>
3
)
-
i
-
1
]
=
pbch_a
[
i
];
#ifdef DEBUG_PBCH
for
(
i
=
0
;
i
<
(
PBCH_A
>>
3
);
i
++
)
msg
(
"[PBCH] pbch_a[%d] = %x
\n
"
,
i
,
decoded_output
[
i
]);
#endif //DEBUG_PBCH
#ifdef DEBUG_PBCH
#ifdef DEBUG_PBCH
msg
(
"PBCH CRC %x : %x
\n
"
,
if
(
i
<
16
){
crc16
(
pbch_a
,
PBCH_A
),
printf
(
"idx[%d]= %d
\n
"
,
i
,
idx_demod
);
((
uint16_t
)
pbch_a
[
PBCH_A
>>
3
]
<<
8
)
+
pbch_a
[(
PBCH_A
>>
3
)
+
1
]);
printf
(
"sign[%d]= %d sign[%d]= %d
\n
"
,
i
<<
1
,
sign
(
pbch_e_rx
[
i
<<
1
]),
(
i
<<
1
)
+
1
,
sign
(
pbch_e_rx
[(
i
<<
1
)
+
1
]));
printf
(
"demod_pbch_e2[%d] r = %2.3f i = %2.3f
\n
"
,
i
<<
1
,
demod_pbch_e
[
i
<<
1
],
demod_pbch_e
[(
i
<<
1
)
+
1
]);}
#endif
#endif
crc
=
(
crc16
(
pbch_a
,
PBCH_A
)
>>
16
)
^
(((
uint16_t
)
pbch_a
[
PBCH_A
>>
3
]
<<
8
)
+
pbch_a
[(
PBCH_A
>>
3
)
+
1
]);
if
(
crc
==
0x0000
)
return
(
1
);
else
if
(
crc
==
0xffff
)
return
(
2
);
else
if
(
crc
==
0x5555
)
return
(
4
);
else
return
(
-
1
);
}
#ifdef PHY_ABSTRACTION
uint16_t
rx_pbch_emul
(
PHY_VARS_UE
*
phy_vars_ue
,
uint8_t
eNB_id
,
uint8_t
pbch_phase
)
{
double
bler
=
0
.
0
;
//, x=0.0;
double
sinr
=
0
.
0
;
uint16_t
nb_rb
=
phy_vars_ue
->
frame_parms
.
N_RB_DL
;
int16_t
f
;
uint8_t
CC_id
=
phy_vars_ue
->
CC_id
;
int
frame_rx
=
phy_vars_ue
->
proc
.
proc_rxtx
[
0
].
frame_rx
;
// compute effective sinr
// TODO: adapt this to varible bandwidth
for
(
f
=
(
nb_rb
*
6
-
3
*
12
);
f
<
(
nb_rb
*
6
+
3
*
12
);
f
++
)
{
if
(
f
!=
0
)
//skip DC
sinr
+=
pow
(
10
,
0
.
1
*
(
phy_vars_ue
->
sinr_dB
[
f
]));
}
}
sinr
=
10
*
log10
(
sinr
/
(
6
*
12
));
//polar decoding de-rate matching
decoderState
=
polar_decoder
(
demod_pbch_e
,
pbch_a
,
&
frame_parms
->
pbch_polar_params
,
decoderListSize
,
aPrioriArray
,
pathMetricAppr
);
bler
=
pbch_bler
(
sinr
);
//for (i=0; i<NR_POLAR_PBCH_PAYLOAD_BITS; i++)
// printf("pbch_a[%d] = %u \n", i,pbch_a[i]);
//un-scrambling
nr_pbch_unscrambling
(
frame_parms
,
pbch_a
,
NR_POLAR_PBCH_PAYLOAD_BITS
);
LOG_D
(
PHY
,
"EMUL UE rx_pbch_emul: eNB_id %d, pbch_phase %d, sinr %f dB, bler %f
\n
"
,
// Fix byte endian
eNB_id
,
for
(
i
=
0
;
i
<
(
NR_POLAR_PBCH_PAYLOAD_BITS
);
i
++
)
pbch_phase
,
decoded_output
[(
NR_POLAR_PBCH_PAYLOAD_BITS
)
-
i
-
1
]
=
pbch_a
[
i
];
sinr
,
bler
);
//#ifdef DEBUG_PBCH
for
(
i
=
0
;
i
<
(
NR_POLAR_PBCH_PAYLOAD_BITS
);
i
++
)
printf
(
"unscrambling pbch_a[%d] = %d
\n
"
,
i
,
pbch_a
[
i
]);
//for (i=0; i<NR_POLAR_PBCH_PAYLOAD_BITS; i++)
// printf("[PBCH] decoder_output[%d] = %x\n",i,decoded_output[i]);
//#endif
if
(
pbch_phase
==
(
frame_rx
%
4
))
{
if
(
uniformrandom
()
>=
bler
)
{
memcpy
(
phy_vars_ue
->
pbch_vars
[
eNB_id
]
->
decoded_output
,
PHY_vars_eNB_g
[
eNB_id
][
CC_id
]
->
pbch_pdu
,
PBCH_PDU_SIZE
);
return
(
PHY_vars_eNB_g
[
eNB_id
][
CC_id
]
->
frame_parms
.
nb_antenna_ports_eNB
);
}
else
return
(
-
1
);
}
else
return
(
-
1
);
}
}
#endif
openair1/PHY/defs_nr_UE.h
View file @
ff26c550
...
@@ -34,6 +34,8 @@
...
@@ -34,6 +34,8 @@
#include "defs_nr_common.h"
#include "defs_nr_common.h"
#include "CODING/nrPolar_tools/nr_polar_pbch_defs.h"
#define _GNU_SOURCE
#define _GNU_SOURCE
#include <stdio.h>
#include <stdio.h>
...
@@ -110,8 +112,8 @@
...
@@ -110,8 +112,8 @@
#define openair_sched_exit() exit(-1)
#define openair_sched_exit() exit(-1)
#define max(a,b) ((a)>(b) ? (a) : (b))
//
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
//
#define min(a,b) ((a)<(b) ? (a) : (b))
#define bzero(s,n) (memset((s),0,(n)))
#define bzero(s,n) (memset((s),0,(n)))
...
...
targets/RT/USER/nr-ue.c
View file @
ff26c550
...
@@ -61,6 +61,8 @@
...
@@ -61,6 +61,8 @@
#include "T.h"
#include "T.h"
extern
double
cpuf
;
extern
double
cpuf
;
static
nfapi_config_request_t
config_t
;
static
nfapi_config_request_t
*
config
=&
config_t
;
#define FRAME_PERIOD 100000000ULL
#define FRAME_PERIOD 100000000ULL
#define DAQ_PERIOD 66667ULL
#define DAQ_PERIOD 66667ULL
...
@@ -413,7 +415,7 @@ static void *UE_thread_synch(void *arg) {
...
@@ -413,7 +415,7 @@ static void *UE_thread_synch(void *arg) {
//UE->rfdevice.trx_set_gains_func(&openair0,&openair0_cfg[0]);
//UE->rfdevice.trx_set_gains_func(&openair0,&openair0_cfg[0]);
//UE->rfdevice.trx_stop_func(&UE->rfdevice);
//UE->rfdevice.trx_stop_func(&UE->rfdevice);
// sleep(1);
// sleep(1);
nr_init_frame_parms_ue
(
&
UE
->
frame_parms
);
nr_init_frame_parms_ue
(
config
,
&
UE
->
frame_parms
);
/*if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) {
/*if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) {
LOG_E(HW,"Could not start the device\n");
LOG_E(HW,"Could not start the device\n");
oai_exit=1;
oai_exit=1;
...
...
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