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
lizhongxiao
OpenXG-RAN
Commits
9b371647
Commit
9b371647
authored
May 13, 2020
by
OpInConnect_NCTU Terngyin/NY/GK/KM
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parallel_architecture of 5G NR
parent
f8e4fb35
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
433 additions
and
77 deletions
+433
-77
cmake_targets/build_oai
cmake_targets/build_oai
+2
-1
openair1/PHY/NR_TRANSPORT/nr_dlsch.c
openair1/PHY/NR_TRANSPORT/nr_dlsch.c
+42
-12
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/SCHED_NR/phy_procedures_nr_gNB.c
openair1/SCHED_NR/phy_procedures_nr_gNB.c
+1
-1
openair1/SIMULATION/NR_PHY/dlsim.c
openair1/SIMULATION/NR_PHY/dlsim.c
+341
-54
No files found.
cmake_targets/build_oai
View file @
9b371647
...
...
@@ -661,7 +661,8 @@ function main() {
if
[
"
$SIMUS_PHY
"
=
"1"
]
;
then
echo_info
"Compiling physical unitary tests simulators"
# 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
compilations
\
phy_simulators
$f
\
...
...
openair1/PHY/NR_TRANSPORT/nr_dlsch.c
View file @
9b371647
...
...
@@ -37,7 +37,7 @@
#include "nr_dci.h"
#include "nr_sch_dmrs.h"
#include "PHY/MODULATION/nr_modulation.h"
#define thread_for_scrambling_modulation
//#define DEBUG_DLSCH
//#define DEBUG_DLSCH_MAPPING
...
...
@@ -94,14 +94,17 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t *dlsch,
int16_t
**
tx_layers
=
(
int16_t
**
)
dlsch
->
txdataF
;
int8_t
Wf
[
2
],
Wt
[
2
],
l0
,
l_prime
[
2
],
delta
;
uint16_t
nb_symbols
=
rel15
->
nb_mod_symbols
;
struct
timespec
tt1
,
tt2
,
tt3
,
tt4
,
tt5
;
uint8_t
Qm
=
rel15
->
modulation_order
;
uint32_t
encoded_length
=
nb_symbols
*
Qm
;
printf
(
"encoded_length = %d
\n
"
,
encoded_length
)
;
gNB
->
complete_scrambling_and_modulation
=
0
;
gNB
->
complete_scrambling
=
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;
}
*/
/// CRC, coding, interleaving and rate matching
AssertFatal
(
harq
->
pdu
!=
NULL
,
"harq->pdu is null
\n
"
);
start_meas
(
dlsch_encoding_stats
);
...
...
@@ -109,6 +112,7 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t *dlsch,
stop_meas
(
dlsch_encoding_stats
);
#ifdef DEBUG_DLSCH
printf
(
"PDSCH encoding:
\n
Payload:
\n
"
);
uint32_t
encoded_length
=
nb_symbols
*
Qm
;
for
(
int
i
=
0
;
i
<
harq
->
B
>>
7
;
i
++
)
{
for
(
int
j
=
0
;
j
<
16
;
j
++
)
printf
(
"0x%02x
\t
"
,
harq
->
pdu
[(
i
<<
4
)
+
j
]);
...
...
@@ -122,16 +126,42 @@ for (int i=0; i<encoded_length>>3; i++) {
}
printf
(
"
\n
"
);
#endif
pthread_cond_signal
(
&
gNB
->
thread_modulation
.
cond_tx
);
pthread_cond_signal
(
&
gNB
->
thread_scrambling
.
cond_tx
);
while
(
gNB
->
complete_scrambling
!=
1
);
/*! \file openair1/PHY/NR_TRANSPORT/nr_dlsch.c
* \brief pipeline scrambling and modulaiton
* \author Terng-Yin Hsu, WEI-YING,LIN (OpInConnect_NCTU)
* \email tyhsu@cs.nctu.edu.tw
* \date 07-05-2020
* \version 1.3
* \note
* \warning
*/
#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);
while
(
gNB
->
complete_modulation
!=
1
);
/*
#else
/// scrambling
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
++
)
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
)
?
\
...
...
@@ -173,8 +203,8 @@ for (int i=0; i<nb_symbols>>3; i++) {
printf
(
"
\n
"
);
}
#endif
*/
#endif
/// Layer mapping
nr_layer_mapping
(
mod_symbs
,
rel15
->
nb_layers
,
...
...
@@ -225,7 +255,7 @@ for (int i=0; i<n_dmrs>>4; i++) {
printf
(
"PDSCH resource mapping started (start SC %d
\t
start symbol %d
\t
N_PRB %d
\t
nb_symbols %d)
\n
"
,
start_sc
,
rel15
->
start_symbol
,
rel15
->
n_prb
,
rel15
->
nb_symbols
);
#endif
printf
(
"nb_layers = %d
\n
"
,
rel15
->
nb_layers
);
//
printf("nb_layers = %d\n",rel15->nb_layers);
for
(
int
ap
=
0
;
ap
<
rel15
->
nb_layers
;
ap
++
)
{
// DMRS params for this ap
...
...
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
View file @
9b371647
...
...
@@ -157,6 +157,9 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(unsigned char Kmimo,
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
));
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
*
));
for
(
aa
=
0
;
aa
<
64
;
aa
++
)
{
...
...
@@ -276,7 +279,16 @@ int nr_dlsch_encoding(unsigned char *a,
NR_gNB_DLSCH_t
*
dlsch
,
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 crc=1;
uint8_t harq_pid = dlsch->harq_ids[frame&2][slot];
...
...
@@ -299,14 +311,14 @@ int nr_dlsch_encoding(unsigned char *a,
uint16_t length_dmrs = 1;
float Coderate = 0.0;
uint8_t Nl = 4;
*/
/*
uint8_t *channel_input[MAX_NUM_DLSCH_SEGMENTS]; //unsigned char
for(j=0;j<MAX_NUM_DLSCH_SEGMENTS;j++) {
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);
A = rel15.transport_block_size;
...
...
@@ -320,6 +332,7 @@ int nr_dlsch_encoding(unsigned char *a,
#ifdef DEBUG_DLSCH_CODING
printf("encoding thinks this is a new packet \n");
#endif
*/
/*
int i;
printf("dlsch (tx): \n");
...
...
@@ -327,7 +340,7 @@ int nr_dlsch_encoding(unsigned char *a,
printf("%02x.",a[i]);
printf("\n");
*/
/*
if (A > 3824) {
// Add 24-bit crc (polynomial A) to payload
crc = crc24a(a,A)>>8;
...
...
@@ -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);
*/
return
0
;
}
openair1/PHY/defs_gNB.h
View file @
9b371647
...
...
@@ -133,6 +133,8 @@ typedef struct {
int32_t
*
txdataF
[
NR_MAX_NB_LAYERS
];
/// Modulated symbols buffer
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?
int32_t
**
ue_spec_bf_weights
[
NR_MAX_NB_LAYERS
];
/// dl channel estimates (estimated from ul channel estimates)
...
...
@@ -298,8 +300,21 @@ typedef struct{
//=====//
relaying_type_t
r_type
;
pthread_attr_t
attr_scrambling
;
int
q_id
;
}
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
{
pthread_t
pthread_modulation
;
pthread_cond_t
cond_tx
;
...
...
@@ -847,12 +862,22 @@ typedef struct PHY_VARS_gNB_s {
int32_t
pusch_stats_bsr
[
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
;
volatile
int
complete_modulation
;
volatile
int
complete_scrambling
;
volatile
uint8_t
complete_modulation
;
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
];
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
;
#endif
openair1/SCHED_NR/phy_procedures_nr_gNB.c
View file @
9b371647
...
...
@@ -102,7 +102,7 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot) {
//printf("slots_per_hf = %d\n",slots_per_hf);
n_hf
=
cfg
->
sch_config
.
half_frame_index
.
value
;
struct
timespec
tt1
,
tt2
;
int
result
;
//
int result;
//printf("n_hf = %d\n",n_hf);
// if SSB periodicity is 5ms, they are transmitted in both half frames
if
(
cfg
->
sch_config
.
ssb_periodicity
.
value
==
5
)
{
...
...
openair1/SIMULATION/NR_PHY/dlsim.c
View file @
9b371647
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