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
常顺宇
OpenXG-RAN
Commits
3d3f49c5
Commit
3d3f49c5
authored
Feb 18, 2019
by
Khalid Ahmed
Committed by
Thomas Schlichter
Mar 07, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nr_ulsch_encoding is implemented and tested
parent
009b195d
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
358 additions
and
52 deletions
+358
-52
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
+12
-1
openair1/PHY/NR_TRANSPORT/nr_transport_common_proto.h
openair1/PHY/NR_TRANSPORT/nr_transport_common_proto.h
+1
-1
openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
+3
-0
openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h
openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h
+9
-5
openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c
openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c
+278
-35
openair1/SIMULATION/NR_PHY/ulschsim.c
openair1/SIMULATION/NR_PHY/ulschsim.c
+55
-10
No files found.
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
View file @
3d3f49c5
...
...
@@ -272,7 +272,7 @@ int nr_dlsch_encoding(unsigned char *a,
unsigned
int
G
;
unsigned
int
crc
=
1
;
int
i
;
uint8_t
harq_pid
=
dlsch
->
harq_ids
[
slot
];
nfapi_nr_dl_config_dlsch_pdu_rel15_t
rel15
=
dlsch
->
harq_processes
[
harq_pid
]
->
dlsch_pdu
.
dlsch_pdu_rel15
;
uint16_t
nb_rb
=
rel15
.
n_prb
;
...
...
@@ -302,7 +302,9 @@ int nr_dlsch_encoding(unsigned char *a,
A
=
rel15
.
transport_block_size
;
G
=
nr_get_G
(
nb_rb
,
nb_symb_sch
,
nb_re_dmrs
,
length_dmrs
,
mod_order
,
rel15
.
nb_layers
);
LOG_D
(
PHY
,
"dlsch coding A %d G %d mod_order %d
\n
"
,
A
,
G
,
mod_order
);
Tbslbrm
=
nr_compute_tbs
(
28
,
nb_rb
,
frame_parms
->
symbols_per_slot
,
0
,
0
,
rel15
.
nb_layers
);
...
...
@@ -328,8 +330,13 @@ int nr_dlsch_encoding(unsigned char *a,
dlsch
->
harq_processes
[
harq_pid
]
->
B
=
A
+
24
;
// dlsch->harq_processes[harq_pid]->b = a;
memcpy
(
dlsch
->
harq_processes
[
harq_pid
]
->
b
,
a
,(
A
/
8
)
+
4
);
//write_output("enc_b.m","enc_in0",&dlsch->harq_processes[harq_pid]->b[0],(A/8)+4,1,4);
//for(i=0;i<10;i++)
//printf("dlsch->harq_processes[harq_pid]->b %d\n", dlsch->harq_processes[harq_pid]->b[i]);
nr_segmentation
(
dlsch
->
harq_processes
[
harq_pid
]
->
b
,
dlsch
->
harq_processes
[
harq_pid
]
->
c
,
dlsch
->
harq_processes
[
harq_pid
]
->
B
,
...
...
@@ -351,6 +358,7 @@ int nr_dlsch_encoding(unsigned char *a,
Kr
=
dlsch
->
harq_processes
[
harq_pid
]
->
K
;
Kr_bytes
=
Kr
>>
3
;
//write_output("enc_input0.m","enc_in0",&dlsch->harq_processes[harq_pid]->c[0][0],Kr_bytes,1,4);
//printf("segment Z %d k %d Kr %d BG %d\n", *pz,dlsch->harq_processes[harq_pid]->K,Kr,BG);
//start_meas(te_stats);
...
...
@@ -388,6 +396,7 @@ int nr_dlsch_encoding(unsigned char *a,
//stop_meas(te_stats);
//printf("end ldpc encoder -- output\n");
//write_output("enc_input0.m","enc_in0",&dlsch->harq_processes[harq_pid]->c[0][0],Kr_bytes,1,4);
#ifdef DEBUG_DLSCH_CODING
write_output
(
"enc_input0.m"
,
"enc_in0"
,
&
dlsch
->
harq_processes
[
harq_pid
]
->
c
[
0
][
0
],
Kr_bytes
,
1
,
4
);
write_output
(
"enc_output0.m"
,
"enc0"
,
&
dlsch
->
harq_processes
[
harq_pid
]
->
d
[
0
][
0
],(
3
*
8
*
Kr_bytes
)
+
12
,
1
,
4
);
...
...
@@ -429,6 +438,7 @@ int nr_dlsch_encoding(unsigned char *a,
rel15
.
redundancy_version
,
E
);
#ifdef DEBUG_DLSCH_CODING
for
(
int
i
=
0
;
i
<
16
;
i
++
)
printf
(
"output ratematching e[%d]= %d r_offset %d
\n
"
,
i
,
dlsch
->
harq_processes
[
harq_pid
]
->
e
[
i
+
r_offset
],
r_offset
);
...
...
@@ -442,6 +452,7 @@ int nr_dlsch_encoding(unsigned char *a,
dlsch
->
harq_processes
[
harq_pid
]
->
f
+
r_offset
);
//stop_meas(i_stats);
#ifdef DEBUG_DLSCH_CODING
for
(
int
i
=
0
;
i
<
16
;
i
++
)
printf
(
"output interleaving f[%d]= %d r_offset %d
\n
"
,
i
,
dlsch
->
harq_processes
[
harq_pid
]
->
f
[
i
+
r_offset
],
r_offset
);
...
...
openair1/PHY/NR_TRANSPORT/nr_transport_common_proto.h
View file @
3d3f49c5
...
...
@@ -38,7 +38,7 @@
#define MAX_NUM_NR_ULSCH_SEGMENTS MAX_NUM_NR_DLSCH_SEGMENTS
#define MAX_NR_DLSCH_PAYLOAD_BYTES (MAX_NUM_NR_DLSCH_SEGMENTS*1056)
#define MAX_NR_ULSCH_PAYLOAD_BYTES (MAX_NUM_NR_
D
LSCH_SEGMENTS*1056)
#define MAX_NR_ULSCH_PAYLOAD_BYTES (MAX_NUM_NR_
U
LSCH_SEGMENTS*1056)
#define MAX_NUM_NR_CHANNEL_BITS (14*273*12*6) // 14 symbols, 273 RB
#define MAX_NUM_NR_RE (14*273*12)
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
View file @
3d3f49c5
...
...
@@ -1006,6 +1006,9 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
uint8_t
is_crnti
,
uint8_t
llr8_flag
);
int
nr_ulsch_encoding
(
NR_UE_ULSCH_t
*
ulsch
,
NR_DL_FRAME_PARMS
*
frame_parms
);
uint32_t
nr_dlsch_decoding_mthread
(
PHY_VARS_NR_UE
*
phy_vars_ue
,
UE_nr_rxtx_proc_t
*
proc
,
int
eNB_id
,
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h
View file @
3d3f49c5
...
...
@@ -102,6 +102,8 @@ typedef struct {
uint16_t
first_rb
;
/// Current Number of RBs
uint16_t
nb_rb
;
/// number of layers
uint8_t
Nl
;
/// Last TPC command
uint8_t
TPC
;
/// Transport block size
...
...
@@ -117,17 +119,17 @@ typedef struct {
/// Redundancy-version of the current sub-frame
uint8_t
rvidx
;
/// pointer to pdu from MAC interface (TS 36.212 V15.4.0, Sec 5.1 p. 8)
u
int8_t
*
a
;
u
nsigned
char
*
a
;
/// Pointer to the payload + CRC
uint8_t
*
b
;
/// Pointers to transport block segments
uint8_t
*
c
[
MAX_NUM_NR_ULSCH_SEGMENTS
];
/// LDPC-code outputs
uint8_t
*
d
[
MAX_NUM_NR_ULSCH_SEGMENTS
];
/// LDPC-code outputs (TS 36.212 V15.4.0, Sec 5.3.2 p. 17)
uint8_t
*
d
[
MAX_NUM_NR_ULSCH_SEGMENTS
];
// 66*Z_c is the maximum LDPC block length. We use 68 for internal manipulation of the buffer
/// Rate matching (Bit selection) outputs (TS 36.212 V15.4.0, Sec 5.4.2.1 p. 28)
uint8_t
*
e
[
MAX_NUM_NR_ULSCH_SEGMENTS
];
uint8_t
e
[
MAX_NUM_NR_CHANNEL_BITS
]
__attribute__
((
aligned
(
32
)));
/// Rate matching (Interleaving) outputs (TS 36.212 V15.4.0, Sec 5.4.2.2 p. 30)
uint8_t
*
f
[
MAX_NUM_NR_ULSCH_SEGMENTS
]
;
uint8_t
f
[
MAX_NUM_NR_CHANNEL_BITS
]
__attribute__
((
aligned
(
32
)))
;
/// Number of code segments
uint32_t
C
;
/// Number of bits in code segments
...
...
@@ -162,6 +164,8 @@ typedef struct {
typedef
struct
{
/// Current Number of Symbols
uint8_t
Nsymb_pusch
;
/// number of DMRS resource elements
uint8_t
nb_re_dmrs
;
/// SRS active flag
uint8_t
srs_active
;
//#if defined(UPGRADE_RAT_NR)
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c
View file @
3d3f49c5
This diff is collapsed.
Click to expand it.
openair1/SIMULATION/NR_PHY/ulschsim.c
View file @
3d3f49c5
...
...
@@ -122,7 +122,7 @@ char quantize(double D, double x, unsigned char B) {
int
main
(
int
argc
,
char
**
argv
)
{
char
c
;
int
i
;
//,j,l,aa;
int
i
,
sf
;
//,j,l,aa;
double
SNR
,
SNR_lin
,
snr0
=
-
2
.
0
,
snr1
=
2
.
0
;
double
snr_step
=
0
.
1
;
uint8_t
snr1set
=
0
;
...
...
@@ -438,7 +438,7 @@ int main(int argc, char **argv) {
//nr_init_frame_parms_ue(&UE->frame_parms);
//init_nr_ue_transport(UE, 0);
for
(
int
sf
=
0
;
sf
<
2
;
sf
++
)
{
for
(
sf
=
0
;
sf
<
2
;
sf
++
)
{
for
(
i
=
0
;
i
<
2
;
i
++
)
{
UE
->
dlsch
[
sf
][
0
][
i
]
=
new_nr_ue_dlsch
(
Kmimo
,
8
,
Nsoft
,
5
,
N_RB_DL
,
0
);
...
...
@@ -464,6 +464,9 @@ int main(int argc, char **argv) {
unsigned
char
harq_pid
=
0
;
//dlsch->harq_ids[subframe];
NR_gNB_DLSCH_t
*
dlsch
=
gNB
->
dlsch
[
0
][
0
];
nfapi_nr_dl_config_dlsch_pdu_rel15_t
*
rel15
=
&
dlsch
->
harq_processes
[
harq_pid
]
->
dlsch_pdu
.
dlsch_pdu_rel15
;
NR_UE_ULSCH_t
*
ulsch
=
UE
->
ulsch
[
0
][
0
][
0
];
//time_stats_t *rm_stats, *te_stats, *i_stats;
uint8_t
is_crnti
=
0
,
llr8_flag
=
0
;
unsigned
int
TBS
=
8424
;
...
...
@@ -474,6 +477,7 @@ int main(int argc, char **argv) {
uint8_t
Nl
=
1
;
uint8_t
rvidx
=
0
;
dlsch
->
rnti
=
1
;
ulsch
->
nb_re_dmrs
=
nb_re_dmrs
;
//[adk] A HOT FIX until cearting nfapi_nr_ul_config_ulsch_pdu_rel15_t
/*dlsch->harq_processes[0]->mcs = Imcs;
dlsch->harq_processes[0]->rvidx = rvidx;*/
//printf("dlschsim harqid %d nb_rb %d, mscs %d\n",dlsch->harq_ids[subframe],
...
...
@@ -497,9 +501,13 @@ int main(int argc, char **argv) {
unsigned
char
*
estimated_output_bit
;
unsigned
char
*
test_input_bit
;
unsigned
int
errors_bit
=
0
;
test_input_bit
=
(
unsigned
char
*
)
malloc16
(
sizeof
(
unsigned
char
)
*
16
*
68
*
384
);
estimated_output
=
(
unsigned
char
*
)
malloc16
(
sizeof
(
unsigned
char
)
*
16
*
68
*
384
);
estimated_output_bit
=
(
unsigned
char
*
)
malloc16
(
sizeof
(
unsigned
char
)
*
16
*
68
*
384
);
NR_UE_DLSCH_t
*
dlsch0_ue
=
UE
->
dlsch
[
0
][
0
][
0
];
NR_DL_UE_HARQ_t
*
harq_process
=
dlsch0_ue
->
harq_processes
[
harq_pid
];
harq_process
->
mcs
=
Imcs
;
...
...
@@ -516,6 +524,26 @@ int main(int argc, char **argv) {
estimated_output
=
harq_process
->
b
;
/////////////////////////[adk] preparing UL harq_process parameters/////////////////////////
///////////
NR_UL_UE_HARQ_t
*
harq_process_ul_ue
=
ulsch
->
harq_processes
[
harq_pid
];
if
(
harq_process_ul_ue
){
harq_process_ul_ue
->
mcs
=
Imcs
;
harq_process_ul_ue
->
Nl
=
Nl
;
harq_process_ul_ue
->
nb_rb
=
nb_rb
;
harq_process_ul_ue
->
nb_symbols
=
nb_symb_sch
;
harq_process_ul_ue
->
rvidx
=
rvidx
;
harq_process_ul_ue
->
TBS
=
TBS
;
harq_process_ul_ue
->
a
=
&
test_input
[
0
];
}
///////////
////////////////////////////////////////////////////////////////////////////////////////////
#ifdef DEBUG_DLSCHSIM
for
(
i
=
0
;
i
<
TBS
/
8
;
i
++
)
printf
(
"test_input[i]=%d
\n
"
,
test_input
[
i
]);
#endif
...
...
@@ -527,6 +555,7 @@ int main(int argc, char **argv) {
// generate signal
if
(
input_fd
==
NULL
)
{
nr_dlsch_encoding
(
test_input
,
subframe
,
dlsch
,
frame_parms
);
nr_ulsch_encoding
(
ulsch
,
frame_parms
);
}
for
(
SNR
=
snr0
;
SNR
<
snr1
;
SNR
+=
snr_step
)
{
...
...
@@ -540,10 +569,14 @@ int main(int argc, char **argv) {
if
((
i
&
0xf
)
==
0
)
printf
(
"
\n
e %d..%d: "
,
i
,
i
+
15
);
#endif
/*
if (i<16){
printf("dlsch_encoder output f[%d] = %d\n",i,dlsch->harq_processes[0]->f[i]);
printf("ulsch_encoder output f[%d] = %d\n",i,ulsch->harq_processes[0]->f[i]);
//if (i<16)
// printf("encoder output f[%d] = %d\n",i,dlsch->harq_processes[0]->f[i]);
if
(
d
lsch
->
harq_processes
[
0
]
->
f
[
i
]
==
0
)
}
*/
if
(
u
lsch
->
harq_processes
[
0
]
->
f
[
i
]
==
0
)
modulated_input
[
i
]
=
1
.
0
;
///sqrt(2); //QPSK
else
modulated_input
[
i
]
=
-
1
.
0
;
///sqrt(2);
...
...
@@ -594,7 +627,7 @@ int main(int argc, char **argv) {
errors_bit
=
0
;
for
(
i
=
0
;
i
<
TBS
;
i
++
)
{
estimated_output_bit
[
i
]
=
(
dlsch0_ue
->
harq_processes
[
0
]
->
b
[
i
/
8
]
&
(
1
<<
(
i
&
7
)))
>>
(
i
&
7
);
estimated_output_bit
[
i
]
=
(
ulsch
->
harq_processes
[
0
]
->
b
[
i
/
8
]
&
(
1
<<
(
i
&
7
)))
>>
(
i
&
7
);
test_input_bit
[
i
]
=
(
test_input
[
i
/
8
]
&
(
1
<<
(
i
&
7
)))
>>
(
i
&
7
);
// Further correct for multiple segments
if
(
estimated_output_bit
[
i
]
!=
test_input_bit
[
i
])
{
...
...
@@ -653,12 +686,24 @@ int main(int argc, char **argv) {
}
}*/
for
(
i
=
0
;
i
<
2
;
i
++
)
{
printf
(
"gNB %d
\n
"
,
i
);
free_gNB_dlsch
(
gNB
->
dlsch
[
0
][
i
]);
printf
(
"UE %d
\n
"
,
i
);
free_nr_ue_dlsch
(
UE
->
dlsch
[
0
][
0
][
i
]);
free_nr_ue_ulsch
(
UE
->
ulsch
[
0
][
0
][
i
]);
if
(
gNB
->
dlsch
[
0
][
i
])
free_gNB_dlsch
(
gNB
->
dlsch
[
0
][
i
]);
for
(
sf
=
0
;
sf
<
2
;
sf
++
)
{
printf
(
"UE %d
\n
"
,
i
);
if
(
UE
->
dlsch
[
sf
][
0
][
i
])
free_nr_ue_dlsch
(
UE
->
dlsch
[
sf
][
0
][
i
]);
if
(
UE
->
ulsch
[
sf
][
0
][
i
])
free_nr_ue_ulsch
(
UE
->
ulsch
[
sf
][
0
][
i
]);
}
}
for
(
i
=
0
;
i
<
2
;
i
++
)
{
...
...
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