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
7ce5066f
Commit
7ce5066f
authored
Mar 01, 2020
by
ISIP
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parallel architecture of 5G NR
parent
10dd25b2
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
406 additions
and
66 deletions
+406
-66
cmake_targets/build_oai
cmake_targets/build_oai
+2
-1
openair1/PHY/NR_TRANSPORT/nr_dlsch.c
openair1/PHY/NR_TRANSPORT/nr_dlsch.c
+36
-15
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
+18
-5
openair1/PHY/defs_gNB.h
openair1/PHY/defs_gNB.h
+29
-4
openair1/SIMULATION/NR_PHY/dlsim.c
openair1/SIMULATION/NR_PHY/dlsim.c
+321
-41
No files found.
cmake_targets/build_oai
View file @
7ce5066f
...
@@ -661,7 +661,8 @@ function main() {
...
@@ -661,7 +661,8 @@ function main() {
if
[
"
$SIMUS_PHY
"
=
"1"
]
;
then
if
[
"
$SIMUS_PHY
"
=
"1"
]
;
then
echo_info
"Compiling physical unitary tests simulators"
echo_info
"Compiling physical unitary tests simulators"
# TODO: fix: dlsim_tm4 pucchsim prachsim pdcchsim pbchsim mbmssim
# TODO: fix: dlsim_tm4 pucchsim prachsim pdcchsim pbchsim mbmssim
simlist
=
"dlsim ulsim ldpctest polartest smallblocktest nr_pbchsim nr_dlschsim nr_ulschsim nr_dlsim nr_ulsim nr_pucchsim"
simlist
=
"nr_dlsim "
#simlist="dlsim ulsim ldpctest polartest smallblocktest nr_pbchsim nr_dlschsim nr_ulschsim nr_dlsim nr_ulsim nr_pucchsim"
for
f
in
$simlist
;
do
for
f
in
$simlist
;
do
compilations
\
compilations
\
phy_simulators
$f
\
phy_simulators
$f
\
...
...
openair1/PHY/NR_TRANSPORT/nr_dlsch.c
View file @
7ce5066f
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
#include "nr_dci.h"
#include "nr_dci.h"
#include "nr_sch_dmrs.h"
#include "nr_sch_dmrs.h"
#include "PHY/MODULATION/nr_modulation.h"
#include "PHY/MODULATION/nr_modulation.h"
#define thread_for_scrambling_modulation
//#define DEBUG_DLSCH
//#define DEBUG_DLSCH
//#define DEBUG_DLSCH_MAPPING
//#define DEBUG_DLSCH_MAPPING
...
@@ -88,20 +88,23 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t *dlsch,
...
@@ -88,20 +88,23 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t *dlsch,
PHY_VARS_gNB
*
gNB
=
RC
.
gNB
[
0
][
0
];
PHY_VARS_gNB
*
gNB
=
RC
.
gNB
[
0
][
0
];
NR_DL_gNB_HARQ_t
*
harq
=
dlsch
->
harq_processes
[
dci_alloc
->
harq_pid
];
NR_DL_gNB_HARQ_t
*
harq
=
dlsch
->
harq_processes
[
dci_alloc
->
harq_pid
];
nfapi_nr_dl_config_dlsch_pdu_rel15_t
*
rel15
=
&
harq
->
dlsch_pdu
.
dlsch_pdu_rel15
;
nfapi_nr_dl_config_dlsch_pdu_rel15_t
*
rel15
=
&
harq
->
dlsch_pdu
.
dlsch_pdu_rel15
;
//
nfapi_nr_dl_config_pdcch_parameters_rel15_t pdcch_params = dci_alloc->pdcch_params;
nfapi_nr_dl_config_pdcch_parameters_rel15_t
pdcch_params
=
dci_alloc
->
pdcch_params
;
//
uint32_t scrambled_output[NR_MAX_NB_CODEWORDS][NR_MAX_PDSCH_ENCODED_LENGTH>>5];
uint32_t
scrambled_output
[
NR_MAX_NB_CODEWORDS
][
NR_MAX_PDSCH_ENCODED_LENGTH
>>
5
];
int16_t
**
mod_symbs
=
(
int16_t
**
)
dlsch
->
mod_symbs
;
int16_t
**
mod_symbs
=
(
int16_t
**
)
dlsch
->
mod_symbs
;
int16_t
**
tx_layers
=
(
int16_t
**
)
dlsch
->
txdataF
;
int16_t
**
tx_layers
=
(
int16_t
**
)
dlsch
->
txdataF
;
int8_t
Wf
[
2
],
Wt
[
2
],
l0
,
l_prime
[
2
],
delta
;
int8_t
Wf
[
2
],
Wt
[
2
],
l0
,
l_prime
[
2
],
delta
;
uint16_t
nb_symbols
=
rel15
->
nb_mod_symbols
;
uint16_t
nb_symbols
=
rel15
->
nb_mod_symbols
;
//uint8_t Qm = rel15->modulation_order;
struct
timespec
tt1
,
tt2
,
tt3
,
tt4
,
tt5
;
//uint32_t encoded_length = nb_symbols*Qm;
uint8_t
Qm
=
rel15
->
modulation_order
;
//printf("encoded_length = %d\n",encoded_length);
uint32_t
encoded_length
=
nb_symbols
*
Qm
;
gNB
->
complete_scrambling_and_modulation
=
0
;
gNB
->
complete_scrambling
=
0
;
gNB
->
complete_scrambling
=
0
;
gNB
->
complete_modulation
=
0
;
gNB
->
complete_modulation
=
0
;
for
(
int
q
=
0
;
q
<
13
;
q
++
){
/*
for(int q = 0 ;q<NR_MAX_NB_CODEWORDS;q++){
gNB->q_scrambling[q] = 0;
gNB->q_scrambling[q] = 0;
}
}
*/
/// CRC, coding, interleaving and rate matching
/// CRC, coding, interleaving and rate matching
AssertFatal
(
harq
->
pdu
!=
NULL
,
"harq->pdu is null
\n
"
);
AssertFatal
(
harq
->
pdu
!=
NULL
,
"harq->pdu is null
\n
"
);
start_meas
(
dlsch_encoding_stats
);
start_meas
(
dlsch_encoding_stats
);
...
@@ -123,16 +126,34 @@ for (int i=0; i<encoded_length>>3; i++) {
...
@@ -123,16 +126,34 @@ for (int i=0; i<encoded_length>>3; i++) {
}
}
printf
(
"
\n
"
);
printf
(
"
\n
"
);
#endif
#endif
long
sum
=
0
;
#ifdef thread_for_scrambling_modulation
// for(int j = 0;j<100;j++){
gNB
->
complete_scrambling_and_modulation
=
0
;
gNB
->
complete_modulation
=
0
;
clock_gettime
(
CLOCK_REALTIME
,
&
tt3
);
//clock_gettime(CLOCK_REALTIME, &tt1);
//pthread_cond_signal(&gNB->thread_modulation.cond_tx);
for
(
int
q
=
0
;
q
<
rel15
->
nb_codewords
;
q
++
)
pthread_cond_signal
(
&
gNB
->
thread_scrambling
[
q
].
cond_tx
);
//clock_gettime(CLOCK_REALTIME, &tt2);
//printf("pthread_cond_signal thread_scrambling [%d] consumes %ld nanoseconds!\n",j,tt2.tv_nsec - tt1.tv_nsec);
//while(gNB->complete_modulation != 1);
//clock_gettime(CLOCK_REALTIME, &tt1);
while
(
gNB
->
complete_scrambling_and_modulation
!=
1
);
//clock_gettime(CLOCK_REALTIME, &tt2);
//printf(" busy waiting for [%d] consumes %ld nanoseconds!\n",j,tt2.tv_nsec - tt1.tv_nsec);
clock_gettime
(
CLOCK_REALTIME
,
&
tt4
);
//usleep(100000);
// printf("scrambling_proc[] for all consumes %ld nanoseconds!%%%%%%%%%%%%%%%\n",tt4.tv_nsec - tt3.tv_nsec);
// sum += (tt4.tv_nsec - tt3.tv_nsec);
// }
// printf("averge time = %ld\n",sum/100);
pthread_cond_signal
(
&
gNB
->
thread_modulation
.
cond_tx
);
#else
pthread_cond_signal
(
&
gNB
->
thread_scrambling
.
cond_tx
);
while
(
gNB
->
complete_scrambling
!=
1
);
while
(
gNB
->
complete_modulation
!=
1
);
/*
/// scrambling
/// scrambling
start_meas
(
dlsch_scrambling_stats
);
start_meas
(
dlsch_scrambling_stats
);
printf("nb_codewords = %d encoded_length = %d\n",rel15->nb_codewords,encoded_length);
//
printf("nb_codewords = %d encoded_length = %d\n",rel15->nb_codewords,encoded_length);
for
(
int
q
=
0
;
q
<
rel15
->
nb_codewords
;
q
++
)
for
(
int
q
=
0
;
q
<
rel15
->
nb_codewords
;
q
++
)
memset
((
void
*
)
scrambled_output
[
q
],
0
,
(
encoded_length
>>
5
)
*
sizeof
(
uint32_t
));
memset
((
void
*
)
scrambled_output
[
q
],
0
,
(
encoded_length
>>
5
)
*
sizeof
(
uint32_t
));
uint16_t
n_RNTI
=
(
pdcch_params
.
search_space_type
==
NFAPI_NR_SEARCH_SPACE_TYPE_UE_SPECIFIC
)
?
\
uint16_t
n_RNTI
=
(
pdcch_params
.
search_space_type
==
NFAPI_NR_SEARCH_SPACE_TYPE_UE_SPECIFIC
)
?
\
...
@@ -174,8 +195,8 @@ for (int i=0; i<nb_symbols>>3; i++) {
...
@@ -174,8 +195,8 @@ for (int i=0; i<nb_symbols>>3; i++) {
printf
(
"
\n
"
);
printf
(
"
\n
"
);
}
}
#endif
#endif
*/
#endif
/// Layer mapping
/// Layer mapping
nr_layer_mapping
(
mod_symbs
,
nr_layer_mapping
(
mod_symbs
,
rel15
->
nb_layers
,
rel15
->
nb_layers
,
...
...
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
View file @
7ce5066f
...
@@ -158,6 +158,9 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(unsigned char Kmimo,
...
@@ -158,6 +158,9 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(unsigned char Kmimo,
for
(
int
q
=
0
;
q
<
NR_MAX_NB_CODEWORDS
;
q
++
)
for
(
int
q
=
0
;
q
<
NR_MAX_NB_CODEWORDS
;
q
++
)
dlsch
->
mod_symbs
[
q
]
=
(
int32_t
*
)
malloc16
(
NR_MAX_PDSCH_ENCODED_LENGTH
*
sizeof
(
int32_t
));
dlsch
->
mod_symbs
[
q
]
=
(
int32_t
*
)
malloc16
(
NR_MAX_PDSCH_ENCODED_LENGTH
*
sizeof
(
int32_t
));
for
(
int
q
=
0
;
q
<
NR_MAX_NB_CODEWORDS
;
q
++
)
dlsch
->
mod_symbs_test
[
q
]
=
(
int32_t
*
)
malloc16
(
NR_MAX_PDSCH_ENCODED_LENGTH
*
sizeof
(
int32_t
));
dlsch
->
calib_dl_ch_estimates
=
(
int32_t
**
)
malloc16
(
64
*
sizeof
(
int32_t
*
));
dlsch
->
calib_dl_ch_estimates
=
(
int32_t
**
)
malloc16
(
64
*
sizeof
(
int32_t
*
));
for
(
aa
=
0
;
aa
<
64
;
aa
++
)
{
for
(
aa
=
0
;
aa
<
64
;
aa
++
)
{
dlsch
->
calib_dl_ch_estimates
[
aa
]
=
(
int32_t
*
)
malloc16
(
OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES
*
sizeof
(
int32_t
));
dlsch
->
calib_dl_ch_estimates
[
aa
]
=
(
int32_t
*
)
malloc16
(
OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES
*
sizeof
(
int32_t
));
...
@@ -276,7 +279,16 @@ int nr_dlsch_encoding(unsigned char *a,
...
@@ -276,7 +279,16 @@ int nr_dlsch_encoding(unsigned char *a,
NR_gNB_DLSCH_t
*
dlsch
,
NR_gNB_DLSCH_t
*
dlsch
,
NR_DL_FRAME_PARMS
*
frame_parms
)
NR_DL_FRAME_PARMS
*
frame_parms
)
{
{
PHY_VARS_gNB
*
gNB
=
RC
.
gNB
[
0
][
0
];
gNB
->
complete_encode
[
0
]
=
0
;
gNB
->
complete_encode
[
1
]
=
0
;
gNB
->
complete_encode
[
2
]
=
0
;
gNB
->
complete_encode
[
3
]
=
0
;
for
(
int
t
=
0
;
t
<
4
;
t
++
){
pthread_cond_signal
(
&
gNB
->
thread_encode
[
t
].
cond_encode
);
}
while
((
gNB
->
complete_encode
[
0
]
!=
1
)
||
(
gNB
->
complete_encode
[
1
]
!=
1
)
||
(
gNB
->
complete_encode
[
2
]
!=
1
)
||
(
gNB
->
complete_encode
[
3
]
!=
1
));
/*
unsigned int G;
unsigned int G;
unsigned int crc=1;
unsigned int crc=1;
uint8_t harq_pid = dlsch->harq_ids[frame&2][slot];
uint8_t harq_pid = dlsch->harq_ids[frame&2][slot];
...
@@ -299,14 +311,14 @@ int nr_dlsch_encoding(unsigned char *a,
...
@@ -299,14 +311,14 @@ int nr_dlsch_encoding(unsigned char *a,
uint16_t length_dmrs = 1;
uint16_t length_dmrs = 1;
float Coderate = 0.0;
float Coderate = 0.0;
uint8_t Nl = 4;
uint8_t Nl = 4;
*/
/*
/*
uint8_t *channel_input[MAX_NUM_DLSCH_SEGMENTS]; //unsigned char
uint8_t *channel_input[MAX_NUM_DLSCH_SEGMENTS]; //unsigned char
for(j=0;j<MAX_NUM_DLSCH_SEGMENTS;j++) {
for(j=0;j<MAX_NUM_DLSCH_SEGMENTS;j++) {
channel_input[j] = (unsigned char *)malloc16(sizeof(unsigned char) * 68*384);
channel_input[j] = (unsigned char *)malloc16(sizeof(unsigned char) * 68*384);
}
}
*/
*/
/*
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_IN);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_IN);
A = rel15.transport_block_size;
A = rel15.transport_block_size;
...
@@ -320,6 +332,7 @@ int nr_dlsch_encoding(unsigned char *a,
...
@@ -320,6 +332,7 @@ int nr_dlsch_encoding(unsigned char *a,
#ifdef DEBUG_DLSCH_CODING
#ifdef DEBUG_DLSCH_CODING
printf("encoding thinks this is a new packet \n");
printf("encoding thinks this is a new packet \n");
#endif
#endif
*/
/*
/*
int i;
int i;
printf("dlsch (tx): \n");
printf("dlsch (tx): \n");
...
@@ -327,7 +340,7 @@ int nr_dlsch_encoding(unsigned char *a,
...
@@ -327,7 +340,7 @@ int nr_dlsch_encoding(unsigned char *a,
printf("%02x.",a[i]);
printf("%02x.",a[i]);
printf("\n");
printf("\n");
*/
*/
/*
if (A > 3824) {
if (A > 3824) {
// Add 24-bit crc (polynomial A) to payload
// Add 24-bit crc (polynomial A) to payload
crc = crc24a(a,A)>>8;
crc = crc24a(a,A)>>8;
...
@@ -480,6 +493,6 @@ int nr_dlsch_encoding(unsigned char *a,
...
@@ -480,6 +493,6 @@ int nr_dlsch_encoding(unsigned char *a,
}
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_OUT);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_OUT);
*/
return
0
;
return
0
;
}
}
openair1/PHY/defs_gNB.h
View file @
7ce5066f
...
@@ -133,6 +133,8 @@ typedef struct {
...
@@ -133,6 +133,8 @@ typedef struct {
int32_t
*
txdataF
[
NR_MAX_NB_LAYERS
];
int32_t
*
txdataF
[
NR_MAX_NB_LAYERS
];
/// Modulated symbols buffer
/// Modulated symbols buffer
int32_t
*
mod_symbs
[
NR_MAX_NB_CODEWORDS
];
int32_t
*
mod_symbs
[
NR_MAX_NB_CODEWORDS
];
/// Modulated symbols buffer for test
int32_t
*
mod_symbs_test
[
NR_MAX_NB_CODEWORDS
];
/// beamforming weights for UE-spec transmission (antenna ports 5 or 7..14), for each codeword, maximum 4 layers?
/// beamforming weights for UE-spec transmission (antenna ports 5 or 7..14), for each codeword, maximum 4 layers?
int32_t
**
ue_spec_bf_weights
[
NR_MAX_NB_LAYERS
];
int32_t
**
ue_spec_bf_weights
[
NR_MAX_NB_LAYERS
];
/// dl channel estimates (estimated from ul channel estimates)
/// dl channel estimates (estimated from ul channel estimates)
...
@@ -298,8 +300,21 @@ typedef struct{
...
@@ -298,8 +300,21 @@ typedef struct{
//=====//
//=====//
relaying_type_t
r_type
;
relaying_type_t
r_type
;
pthread_attr_t
attr_scrambling
;
pthread_attr_t
attr_scrambling
;
int
q_id
;
}
scrambling_channel
;
}
scrambling_channel
;
typedef
struct
{
pthread_t
pthread_encode
;
pthread_cond_t
cond_encode
;
pthread_mutex_t
mutex_encode
;
pthread_attr_t
attr_encode
;
volatile
int
flag_wait
;
int
id
;
}
dlsch_encoding_ISIP
;
typedef
struct
{
int
seg
;
}
ldpc_encoding_ISIP
;
typedef
struct
{
typedef
struct
{
pthread_t
pthread_modulation
;
pthread_t
pthread_modulation
;
pthread_cond_t
cond_tx
;
pthread_cond_t
cond_tx
;
...
@@ -847,12 +862,22 @@ typedef struct PHY_VARS_gNB_s {
...
@@ -847,12 +862,22 @@ typedef struct PHY_VARS_gNB_s {
int32_t
pusch_stats_bsr
[
NUMBER_OF_UE_MAX
][
10240
];
int32_t
pusch_stats_bsr
[
NUMBER_OF_UE_MAX
][
10240
];
int32_t
pusch_stats_BO
[
NUMBER_OF_UE_MAX
][
10240
];
int32_t
pusch_stats_BO
[
NUMBER_OF_UE_MAX
][
10240
];
scrambling_channel
thread_scrambling
;
scrambling_channel
thread_scrambling
[
NR_MAX_NB_CODEWORDS
]
;
modulation_channel
thread_modulation
;
modulation_channel
thread_modulation
;
volatile
int
complete_modulation
;
volatile
uint8_t
complete_modulation
;
volatile
int
complete_scrambling
;
volatile
uint8_t
complete_scrambling
;
volatile
uint8_t
complete_scrambling_and_modulation
;
uint32_t
scrambled_output
[
NR_MAX_NB_CODEWORDS
][
NR_MAX_PDSCH_ENCODED_LENGTH
>>
5
];
uint32_t
scrambled_output
[
NR_MAX_NB_CODEWORDS
][
NR_MAX_PDSCH_ENCODED_LENGTH
>>
5
];
volatile
int
q_scrambling
[
13
];
uint32_t
scrambled_output_test
[
NR_MAX_NB_CODEWORDS
][
NR_MAX_PDSCH_ENCODED_LENGTH
>>
5
];
volatile
int
q_scrambling
[
NR_MAX_NB_CODEWORDS
];
pthread_mutex_t
complete_scrambling_modulation_mutex
;
//**************************DLSCH ENCODING**************************//
dlsch_encoding_ISIP
thread_encode
[
4
];
ldpc_encoding_ISIP
ldpc_encode
;
volatile
uint8_t
complete_encode
[
4
];
//**************************DLSCH ENCODING**************************//
}
PHY_VARS_gNB
;
}
PHY_VARS_gNB
;
#endif
#endif
openair1/SIMULATION/NR_PHY/dlsim.c
View file @
7ce5066f
This diff is collapsed.
Click to expand it.
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