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
ZhouShuya
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
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,
...
@@ -272,7 +272,7 @@ int nr_dlsch_encoding(unsigned char *a,
unsigned
int
G
;
unsigned
int
G
;
unsigned
int
crc
=
1
;
unsigned
int
crc
=
1
;
int
i
;
uint8_t
harq_pid
=
dlsch
->
harq_ids
[
slot
];
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
;
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
;
uint16_t
nb_rb
=
rel15
.
n_prb
;
...
@@ -302,7 +302,9 @@ int nr_dlsch_encoding(unsigned char *a,
...
@@ -302,7 +302,9 @@ int nr_dlsch_encoding(unsigned char *a,
A
=
rel15
.
transport_block_size
;
A
=
rel15
.
transport_block_size
;
G
=
nr_get_G
(
nb_rb
,
nb_symb_sch
,
nb_re_dmrs
,
length_dmrs
,
mod_order
,
rel15
.
nb_layers
);
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
);
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
);
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,
...
@@ -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
+
24
;
// dlsch->harq_processes[harq_pid]->b = a;
// dlsch->harq_processes[harq_pid]->b = a;
memcpy
(
dlsch
->
harq_processes
[
harq_pid
]
->
b
,
a
,(
A
/
8
)
+
4
);
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
,
nr_segmentation
(
dlsch
->
harq_processes
[
harq_pid
]
->
b
,
dlsch
->
harq_processes
[
harq_pid
]
->
c
,
dlsch
->
harq_processes
[
harq_pid
]
->
c
,
dlsch
->
harq_processes
[
harq_pid
]
->
B
,
dlsch
->
harq_processes
[
harq_pid
]
->
B
,
...
@@ -351,6 +358,7 @@ int nr_dlsch_encoding(unsigned char *a,
...
@@ -351,6 +358,7 @@ int nr_dlsch_encoding(unsigned char *a,
Kr
=
dlsch
->
harq_processes
[
harq_pid
]
->
K
;
Kr
=
dlsch
->
harq_processes
[
harq_pid
]
->
K
;
Kr_bytes
=
Kr
>>
3
;
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);
//printf("segment Z %d k %d Kr %d BG %d\n", *pz,dlsch->harq_processes[harq_pid]->K,Kr,BG);
//start_meas(te_stats);
//start_meas(te_stats);
...
@@ -388,6 +396,7 @@ int nr_dlsch_encoding(unsigned char *a,
...
@@ -388,6 +396,7 @@ int nr_dlsch_encoding(unsigned char *a,
//stop_meas(te_stats);
//stop_meas(te_stats);
//printf("end ldpc encoder -- output\n");
//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
#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_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
);
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,
...
@@ -429,6 +438,7 @@ int nr_dlsch_encoding(unsigned char *a,
rel15
.
redundancy_version
,
rel15
.
redundancy_version
,
E
);
E
);
#ifdef DEBUG_DLSCH_CODING
#ifdef DEBUG_DLSCH_CODING
for
(
int
i
=
0
;
i
<
16
;
i
++
)
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
);
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,
...
@@ -442,6 +452,7 @@ int nr_dlsch_encoding(unsigned char *a,
dlsch
->
harq_processes
[
harq_pid
]
->
f
+
r_offset
);
dlsch
->
harq_processes
[
harq_pid
]
->
f
+
r_offset
);
//stop_meas(i_stats);
//stop_meas(i_stats);
#ifdef DEBUG_DLSCH_CODING
#ifdef DEBUG_DLSCH_CODING
for
(
int
i
=
0
;
i
<
16
;
i
++
)
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
);
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 @@
...
@@ -38,7 +38,7 @@
#define MAX_NUM_NR_ULSCH_SEGMENTS MAX_NUM_NR_DLSCH_SEGMENTS
#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_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_CHANNEL_BITS (14*273*12*6) // 14 symbols, 273 RB
#define MAX_NUM_NR_RE (14*273*12)
#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,
...
@@ -1006,6 +1006,9 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
uint8_t
is_crnti
,
uint8_t
is_crnti
,
uint8_t
llr8_flag
);
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
,
uint32_t
nr_dlsch_decoding_mthread
(
PHY_VARS_NR_UE
*
phy_vars_ue
,
UE_nr_rxtx_proc_t
*
proc
,
UE_nr_rxtx_proc_t
*
proc
,
int
eNB_id
,
int
eNB_id
,
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h
View file @
3d3f49c5
...
@@ -102,6 +102,8 @@ typedef struct {
...
@@ -102,6 +102,8 @@ typedef struct {
uint16_t
first_rb
;
uint16_t
first_rb
;
/// Current Number of RBs
/// Current Number of RBs
uint16_t
nb_rb
;
uint16_t
nb_rb
;
/// number of layers
uint8_t
Nl
;
/// Last TPC command
/// Last TPC command
uint8_t
TPC
;
uint8_t
TPC
;
/// Transport block size
/// Transport block size
...
@@ -117,17 +119,17 @@ typedef struct {
...
@@ -117,17 +119,17 @@ typedef struct {
/// Redundancy-version of the current sub-frame
/// Redundancy-version of the current sub-frame
uint8_t
rvidx
;
uint8_t
rvidx
;
/// pointer to pdu from MAC interface (TS 36.212 V15.4.0, Sec 5.1 p. 8)
/// 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
/// Pointer to the payload + CRC
uint8_t
*
b
;
uint8_t
*
b
;
/// Pointers to transport block segments
/// Pointers to transport block segments
uint8_t
*
c
[
MAX_NUM_NR_ULSCH_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)
/// 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
uint8_t
e
[
MAX_NUM_NR_CHANNEL_BITS
]
__attribute__
((
aligned
(
32
)));
/// 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
];
/// Rate matching (Interleaving) outputs (TS 36.212 V15.4.0, Sec 5.4.2.2 p. 30)
/// 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
/// Number of code segments
uint32_t
C
;
uint32_t
C
;
/// Number of bits in code segments
/// Number of bits in code segments
...
@@ -162,6 +164,8 @@ typedef struct {
...
@@ -162,6 +164,8 @@ typedef struct {
typedef
struct
{
typedef
struct
{
/// Current Number of Symbols
/// Current Number of Symbols
uint8_t
Nsymb_pusch
;
uint8_t
Nsymb_pusch
;
/// number of DMRS resource elements
uint8_t
nb_re_dmrs
;
/// SRS active flag
/// SRS active flag
uint8_t
srs_active
;
uint8_t
srs_active
;
//#if defined(UPGRADE_RAT_NR)
//#if defined(UPGRADE_RAT_NR)
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c
View file @
3d3f49c5
...
@@ -56,6 +56,11 @@ void free_nr_ue_ulsch(NR_UE_ULSCH_t *ulsch)
...
@@ -56,6 +56,11 @@ void free_nr_ue_ulsch(NR_UE_ULSCH_t *ulsch)
for
(
i
=
0
;
i
<
NR_MAX_ULSCH_HARQ_PROCESSES
;
i
++
)
{
for
(
i
=
0
;
i
<
NR_MAX_ULSCH_HARQ_PROCESSES
;
i
++
)
{
if
(
ulsch
->
harq_processes
[
i
])
{
if
(
ulsch
->
harq_processes
[
i
])
{
if
(
ulsch
->
harq_processes
[
i
]
->
a
)
{
free16
(
ulsch
->
harq_processes
[
i
]
->
a
,
MAX_NR_ULSCH_PAYLOAD_BYTES
);
ulsch
->
harq_processes
[
i
]
->
a
=
NULL
;
}
if
(
ulsch
->
harq_processes
[
i
]
->
b
)
{
if
(
ulsch
->
harq_processes
[
i
]
->
b
)
{
free16
(
ulsch
->
harq_processes
[
i
]
->
b
,
MAX_NR_ULSCH_PAYLOAD_BYTES
);
free16
(
ulsch
->
harq_processes
[
i
]
->
b
,
MAX_NR_ULSCH_PAYLOAD_BYTES
);
ulsch
->
harq_processes
[
i
]
->
b
=
NULL
;
ulsch
->
harq_processes
[
i
]
->
b
=
NULL
;
...
@@ -71,16 +76,6 @@ void free_nr_ue_ulsch(NR_UE_ULSCH_t *ulsch)
...
@@ -71,16 +76,6 @@ void free_nr_ue_ulsch(NR_UE_ULSCH_t *ulsch)
ulsch
->
harq_processes
[
i
]
->
d
[
r
]
=
NULL
;
ulsch
->
harq_processes
[
i
]
->
d
[
r
]
=
NULL
;
}
}
if
(
ulsch
->
harq_processes
[
i
]
->
e
[
r
])
{
free16
(
ulsch
->
harq_processes
[
i
]
->
e
[
r
],
68
*
384
);
ulsch
->
harq_processes
[
i
]
->
e
[
r
]
=
NULL
;
}
if
(
ulsch
->
harq_processes
[
i
]
->
f
[
r
])
{
free16
(
ulsch
->
harq_processes
[
i
]
->
f
[
r
],
68
*
384
);
ulsch
->
harq_processes
[
i
]
->
f
[
r
]
=
NULL
;
}
}
}
free16
(
ulsch
->
harq_processes
[
i
],
sizeof
(
NR_UL_UE_HARQ_t
));
free16
(
ulsch
->
harq_processes
[
i
],
sizeof
(
NR_UL_UE_HARQ_t
));
...
@@ -119,6 +114,9 @@ NR_UE_ULSCH_t *new_nr_ue_ulsch(unsigned char N_RB_UL, int number_of_harq_pids, u
...
@@ -119,6 +114,9 @@ NR_UE_ULSCH_t *new_nr_ue_ulsch(unsigned char N_RB_UL, int number_of_harq_pids, u
ulsch
->
number_harq_processes_for_pusch
=
NR_MAX_ULSCH_HARQ_PROCESSES
;
ulsch
->
number_harq_processes_for_pusch
=
NR_MAX_ULSCH_HARQ_PROCESSES
;
ulsch
->
Mlimit
=
4
;
// maximum harq retransmissions
ulsch
->
Mlimit
=
4
;
// maximum harq retransmissions
//for (i=0; i<10; i++)
//ulsch->harq_ids[i] = 0;
for
(
i
=
0
;
i
<
number_of_harq_pids
;
i
++
)
{
for
(
i
=
0
;
i
<
number_of_harq_pids
;
i
++
)
{
ulsch
->
harq_processes
[
i
]
=
(
NR_UL_UE_HARQ_t
*
)
malloc16
(
sizeof
(
NR_UL_UE_HARQ_t
));
ulsch
->
harq_processes
[
i
]
=
(
NR_UL_UE_HARQ_t
*
)
malloc16
(
sizeof
(
NR_UL_UE_HARQ_t
));
...
@@ -126,8 +124,8 @@ NR_UE_ULSCH_t *new_nr_ue_ulsch(unsigned char N_RB_UL, int number_of_harq_pids, u
...
@@ -126,8 +124,8 @@ NR_UE_ULSCH_t *new_nr_ue_ulsch(unsigned char N_RB_UL, int number_of_harq_pids, u
// printf("ulsch->harq_processes[%d] %p\n",i,ulsch->harq_processes[i]);
// printf("ulsch->harq_processes[%d] %p\n",i,ulsch->harq_processes[i]);
if
(
ulsch
->
harq_processes
[
i
])
{
if
(
ulsch
->
harq_processes
[
i
])
{
memset
(
ulsch
->
harq_processes
[
i
],
0
,
sizeof
(
NR_UL_UE_HARQ_t
));
memset
(
ulsch
->
harq_processes
[
i
],
0
,
sizeof
(
NR_UL_UE_HARQ_t
));
ulsch
->
harq_processes
[
i
]
->
b
=
(
u
nsigned
char
*
)
malloc16
(
MAX_NR_ULSCH_PAYLOAD_BYTES
/
bw_scaling
);
ulsch
->
harq_processes
[
i
]
->
b
=
(
u
int8_t
*
)
malloc16
(
MAX_NR_ULSCH_PAYLOAD_BYTES
/
bw_scaling
);
ulsch
->
harq_processes
[
i
]
->
a
=
(
u
int8_t
*
)
malloc16
(
MAX_NR_ULSCH_PAYLOAD_BYTES
/
bw_scaling
);
ulsch
->
harq_processes
[
i
]
->
a
=
(
u
nsigned
char
*
)
malloc16
(
MAX_NR_ULSCH_PAYLOAD_BYTES
/
bw_scaling
);
if
(
ulsch
->
harq_processes
[
i
]
->
a
)
{
if
(
ulsch
->
harq_processes
[
i
]
->
a
)
{
bzero
(
ulsch
->
harq_processes
[
i
]
->
a
,
MAX_NR_ULSCH_PAYLOAD_BYTES
/
bw_scaling
);
bzero
(
ulsch
->
harq_processes
[
i
]
->
a
,
MAX_NR_ULSCH_PAYLOAD_BYTES
/
bw_scaling
);
...
@@ -137,7 +135,7 @@ NR_UE_ULSCH_t *new_nr_ue_ulsch(unsigned char N_RB_UL, int number_of_harq_pids, u
...
@@ -137,7 +135,7 @@ NR_UE_ULSCH_t *new_nr_ue_ulsch(unsigned char N_RB_UL, int number_of_harq_pids, u
}
}
if
(
ulsch
->
harq_processes
[
i
]
->
b
)
if
(
ulsch
->
harq_processes
[
i
]
->
b
)
memset
(
ulsch
->
harq_processes
[
i
]
->
b
,
0
,
MAX_NR_ULSCH_PAYLOAD_BYTES
/
bw_scaling
);
bzero
(
ulsch
->
harq_processes
[
i
]
->
b
,
MAX_NR_ULSCH_PAYLOAD_BYTES
/
bw_scaling
);
else
{
else
{
LOG_E
(
PHY
,
"Can't get b
\n
"
);
LOG_E
(
PHY
,
"Can't get b
\n
"
);
exit_flag
=
1
;
exit_flag
=
1
;
...
@@ -148,8 +146,7 @@ NR_UE_ULSCH_t *new_nr_ue_ulsch(unsigned char N_RB_UL, int number_of_harq_pids, u
...
@@ -148,8 +146,7 @@ NR_UE_ULSCH_t *new_nr_ue_ulsch(unsigned char N_RB_UL, int number_of_harq_pids, u
// account for filler in first segment and CRCs for multiple segment case
// account for filler in first segment and CRCs for multiple segment case
ulsch
->
harq_processes
[
i
]
->
c
[
r
]
=
(
uint8_t
*
)
malloc16
(
8448
);
ulsch
->
harq_processes
[
i
]
->
c
[
r
]
=
(
uint8_t
*
)
malloc16
(
8448
);
ulsch
->
harq_processes
[
i
]
->
d
[
r
]
=
(
uint8_t
*
)
malloc16
(
68
*
384
);
//max size for coded output
ulsch
->
harq_processes
[
i
]
->
d
[
r
]
=
(
uint8_t
*
)
malloc16
(
68
*
384
);
//max size for coded output
ulsch
->
harq_processes
[
i
]
->
e
[
r
]
=
(
uint8_t
*
)
malloc16
(
68
*
384
);
ulsch
->
harq_processes
[
i
]
->
f
[
r
]
=
(
uint8_t
*
)
malloc16
(
68
*
384
);
if
(
ulsch
->
harq_processes
[
i
]
->
c
[
r
])
{
if
(
ulsch
->
harq_processes
[
i
]
->
c
[
r
])
{
bzero
(
ulsch
->
harq_processes
[
i
]
->
c
[
r
],
8448
);
bzero
(
ulsch
->
harq_processes
[
i
]
->
c
[
r
],
8448
);
}
else
{
}
else
{
...
@@ -162,18 +159,6 @@ NR_UE_ULSCH_t *new_nr_ue_ulsch(unsigned char N_RB_UL, int number_of_harq_pids, u
...
@@ -162,18 +159,6 @@ NR_UE_ULSCH_t *new_nr_ue_ulsch(unsigned char N_RB_UL, int number_of_harq_pids, u
printf
(
"Can't get d
\n
"
);
printf
(
"Can't get d
\n
"
);
exit_flag
=
2
;
exit_flag
=
2
;
}
}
if
(
ulsch
->
harq_processes
[
i
]
->
e
[
r
])
{
bzero
(
ulsch
->
harq_processes
[
i
]
->
e
[
r
],(
68
*
384
));
}
else
{
printf
(
"Can't get e
\n
"
);
exit_flag
=
2
;
}
if
(
ulsch
->
harq_processes
[
i
]
->
f
[
r
])
{
bzero
(
ulsch
->
harq_processes
[
i
]
->
f
[
r
],(
68
*
384
));
}
else
{
printf
(
"Can't get f
\n
"
);
exit_flag
=
2
;
}
}
}
}
}
...
@@ -185,15 +170,13 @@ NR_UE_ULSCH_t *new_nr_ue_ulsch(unsigned char N_RB_UL, int number_of_harq_pids, u
...
@@ -185,15 +170,13 @@ NR_UE_ULSCH_t *new_nr_ue_ulsch(unsigned char N_RB_UL, int number_of_harq_pids, u
}
}
}
}
if
((
abstraction_flag
==
0
)
&&
(
exit_flag
==
0
))
{
if
(
exit_flag
==
0
)
{
for
(
i
=
0
;
i
<
8
;
i
++
)
for
(
i
=
0
;
i
<
number_of_harq_pids
;
i
++
)
{
for
(
j
=
0
;
j
<
96
;
j
++
)
ulsch
->
harq_processes
[
i
]
->
round
=
0
;
for
(
r
=
0
;
r
<
MAX_NUM_NR_ULSCH_SEGMENTS
/
bw_scaling
;
r
++
)
}
ulsch
->
harq_processes
[
i
]
->
d
[
r
][
j
]
=
NR_NULL
;
return
(
ulsch
);
return
(
ulsch
);
}
else
if
(
abstraction_flag
==
1
)
}
return
(
ulsch
);
}
}
LOG_E
(
PHY
,
"new_ue_ulsch exit flag, size of %d , %zu
\n
"
,
exit_flag
,
sizeof
(
LTE_UE_ULSCH_t
));
LOG_E
(
PHY
,
"new_ue_ulsch exit flag, size of %d , %zu
\n
"
,
exit_flag
,
sizeof
(
LTE_UE_ULSCH_t
));
...
@@ -201,4 +184,264 @@ NR_UE_ULSCH_t *new_nr_ue_ulsch(unsigned char N_RB_UL, int number_of_harq_pids, u
...
@@ -201,4 +184,264 @@ NR_UE_ULSCH_t *new_nr_ue_ulsch(unsigned char N_RB_UL, int number_of_harq_pids, u
return
(
NULL
);
return
(
NULL
);
}
}
\ No newline at end of file
int
nr_ulsch_encoding
(
NR_UE_ULSCH_t
*
ulsch
,
NR_DL_FRAME_PARMS
*
frame_parms
)
{
/////////////////////////parameters and variables declaration/////////////////////////
///////////
unsigned
int
G
,
crc
;
uint8_t
harq_pid
;
NR_UL_UE_HARQ_t
*
harq_process
;
uint16_t
nb_rb
;
uint8_t
nb_symb_sch
;
uint32_t
A
,
Z
;
uint32_t
*
pz
;
uint8_t
mod_order
;
uint16_t
Kr
,
r
,
r_offset
,
Kr_bytes
;
uint8_t
*
d_tmp
[
MAX_NUM_DLSCH_SEGMENTS
];
uint8_t
kb
,
BG
;
uint32_t
E
;
uint8_t
Ilbrm
;
uint32_t
Tbslbrm
;
uint8_t
nb_re_dmrs
;
uint16_t
length_dmrs
;
int
i
;
///////////
///////////////////////////////////////////////////////////////////////////////////////
/////////////////////////parameters and variables initialization/////////////////////////
///////////
crc
=
1
;
harq_pid
=
0
;
harq_process
=
ulsch
->
harq_processes
[
harq_pid
];
nb_rb
=
harq_process
->
nb_rb
;
nb_symb_sch
=
harq_process
->
nb_symbols
;
A
=
harq_process
->
TBS
;
pz
=
&
Z
;
mod_order
=
nr_get_Qm
(
harq_process
->
mcs
,
1
);
Kr
=
0
;
r_offset
=
0
;
BG
=
1
;
Ilbrm
=
0
;
Tbslbrm
=
950984
;
//max tbs
nb_re_dmrs
=
ulsch
->
nb_re_dmrs
;
length_dmrs
=
1
;
///////////
/////////////////////////////////////////////////////////////////////////////////////////
/*
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
);
printf
(
"ulsch coding nb_rb %d nb_symb_sch %d nb_re_dmrs %d, length_dmrs %d
\n
"
,
nb_rb
,
nb_symb_sch
,
nb_re_dmrs
,
length_dmrs
);
G
=
nr_get_G
(
nb_rb
,
nb_symb_sch
,
nb_re_dmrs
,
length_dmrs
,
mod_order
,
harq_process
->
Nl
);
LOG_D
(
PHY
,
"dlsch coding A %d G %d mod_order %d
\n
"
,
A
,
G
,
mod_order
);
printf
(
"ulsch 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
,
harq_process
->
Nl
);
// if (harq_process->Ndi == 1) { // this is a new packet
if
(
harq_process
->
round
==
0
)
{
// this is a new packet
#ifdef DEBUG_DLSCH_CODING
printf
(
"encoding thinks this is a new packet
\n
"
);
#endif
///////////////////////// a---->| add CRC |---->b /////////////////////////
///////////
/*
int i;
printf("dlsch (tx): \n");
for (i=0;i<(A>>3);i++)
printf("%02x.",a[i]);
printf("\n");
*/
// Add 24-bit crc (polynomial A) to payload
crc
=
crc24a
(
harq_process
->
a
,
A
)
>>
8
;
harq_process
->
a
[
A
>>
3
]
=
((
uint8_t
*
)
&
crc
)[
2
];
harq_process
->
a
[
1
+
(
A
>>
3
)]
=
((
uint8_t
*
)
&
crc
)[
1
];
harq_process
->
a
[
2
+
(
A
>>
3
)]
=
((
uint8_t
*
)
&
crc
)[
0
];
//printf("CRC %x (A %d)\n",crc,A);
//printf("a0 %d a1 %d a2 %d\n", a[A>>3], a[1+(A>>3)], a[2+(A>>3)]);
harq_process
->
B
=
A
+
24
;
memcpy
(
harq_process
->
b
,
harq_process
->
a
,(
A
/
8
)
+
4
);
//write_output("ulsch_b.m","enc_in0",&harq_process->b[0],(A/8)+4,1,4);
//for(i=0;i<10;i++)
//printf("harq_process->b %d\n", harq_process->b[i]);
///////////
///////////////////////////////////////////////////////////////////////////
///////////////////////// b---->| block segmentation |---->c /////////////////////////
///////////
nr_segmentation
(
harq_process
->
b
,
harq_process
->
c
,
harq_process
->
B
,
&
harq_process
->
C
,
&
harq_process
->
K
,
pz
,
&
harq_process
->
F
);
kb
=
harq_process
->
K
/
(
*
pz
);
if
(
kb
==
22
){
BG
=
1
;
}
else
{
BG
=
2
;
}
Kr
=
harq_process
->
K
;
Kr_bytes
=
Kr
>>
3
;
write_output
(
"ulsch_enc_input0.m"
,
"enc_in0"
,
&
harq_process
->
c
[
0
][
0
],
Kr_bytes
,
1
,
4
);
///////////
/////////////////////////////////////////////////////////////////////////////////////
///////////////////////// c---->| LDCP coding |---->d /////////////////////////
///////////
//printf("segment Z %d kb %d k %d Kr %d BG %d\n", *pz,kb,harq_process->K,Kr,BG);
//start_meas(te_stats);
for
(
r
=
0
;
r
<
harq_process
->
C
;
r
++
)
{
d_tmp
[
r
]
=
&
harq_process
->
d
[
r
][
0
];
//channel_input[r] = &harq_process->d[r][0];
#ifdef DEBUG_DLSCH_CODING
printf
(
"Encoder: B %d F %d
\n
"
,
harq_process
->
B
,
harq_process
->
F
);
printf
(
"start ldpc encoder segment %d/%d
\n
"
,
r
,
harq_process
->
C
);
printf
(
"input %d %d %d %d %d
\n
"
,
harq_process
->
c
[
r
][
0
],
harq_process
->
c
[
r
][
1
],
harq_process
->
c
[
r
][
2
],
harq_process
->
c
[
r
][
3
],
harq_process
->
c
[
r
][
4
]);
for
(
int
cnt
=
0
;
cnt
<
22
*
(
*
pz
)
/
8
;
cnt
++
){
printf
(
"%d "
,
harq_process
->
c
[
r
][
cnt
]);
}
printf
(
"
\n
"
);
#endif
//ldpc_encoder_orig((unsigned char*)harq_process->c[r],harq_process->d[r],Kr,BG,0);
//ldpc_encoder_optim((unsigned char*)harq_process->c[r],(unsigned char*)&harq_process->d[r][0],Kr,BG,NULL,NULL,NULL,NULL);
}
//for (int i=0;i<68*384;i++)
// printf("channel_input[%d]=%d\n",i,channel_input[i]);
/*printf("output %d %d %d %d %d \n", harq_process->d[0][0], harq_process->d[0][1], harq_process->d[r][2],harq_process->d[0][3], harq_process->d[0][4]);
for (int cnt =0 ; cnt < 66*(*pz); cnt ++){
printf("%d \n", harq_process->d[0][cnt]);
}
printf("\n");*/
//ldpc_encoder_optim_8seg(harq_process->c,d_tmp,Kr,BG,harq_process->C,NULL,NULL,NULL,NULL);
ldpc_encoder_optim_8seg
(
harq_process
->
c
,
harq_process
->
d
,
Kr
,
BG
,
harq_process
->
C
,
NULL
,
NULL
,
NULL
,
NULL
);
//stop_meas(te_stats);
//printf("end ldpc encoder -- output\n");
//write_output("ulsch_enc_input0.m","enc_in0",&harq_process->c[0][0],Kr_bytes,1,4);
#ifdef DEBUG_DLSCH_CODING
write_output
(
"ulsch_enc_input0.m"
,
"enc_in0"
,
&
harq_process
->
c
[
0
][
0
],
Kr_bytes
,
1
,
4
);
write_output
(
"ulsch_enc_output0.m"
,
"enc0"
,
&
harq_process
->
d
[
0
][
0
],(
3
*
8
*
Kr_bytes
)
+
12
,
1
,
4
);
#endif
///////////
///////////////////////////////////////////////////////////////////////////////
}
for
(
r
=
0
;
r
<
harq_process
->
C
;
r
++
)
{
// looping over C segments
#ifdef DEBUG_DLSCH_CODING
printf
(
"Rate Matching, Code segment %d (coded bits (G) %d,unpunctured/repeated bits per code segment %d,mod_order %d, nb_rb %d)...
\n
"
,
r
,
G
,
Kr
*
3
,
mod_order
,
nb_rb
);
#endif
//start_meas(rm_stats);
#ifdef DEBUG_DLSCH_CODING
printf
(
"rvidx in encoding = %d
\n
"
,
harq_process
->
rvidx
);
#endif
///////////////////////// d---->| Rate matching bit selection |---->e /////////////////////////
///////////
E
=
nr_get_E
(
G
,
harq_process
->
C
,
mod_order
,
harq_process
->
Nl
,
r
);
nr_rate_matching_ldpc
(
Ilbrm
,
Tbslbrm
,
BG
,
*
pz
,
harq_process
->
d
[
r
],
harq_process
->
e
+
r_offset
,
harq_process
->
C
,
harq_process
->
rvidx
,
E
);
#ifdef DEBUG_DLSCH_CODING
for
(
int
i
=
0
;
i
<
16
;
i
++
)
printf
(
"output ratematching e[%d]= %d r_offset %d
\n
"
,
i
,
harq_process
->
e
[
i
+
r_offset
],
r_offset
);
#endif
///////////
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////// e---->| Rate matching bit interleaving |---->f /////////////////////////
///////////
//stop_meas(rm_stats);
//start_meas(i_stats);
nr_interleaving_ldpc
(
E
,
mod_order
,
harq_process
->
e
+
r_offset
,
harq_process
->
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
,
harq_process
->
f
[
i
+
r_offset
],
r_offset
);
if
(
r
==
harq_process
->
C
-
1
)
write_output
(
"enc_output.m"
,
"enc"
,
harq_process
->
f
,
G
,
1
,
4
);
#endif
r_offset
+=
E
;
///////////
///////////////////////////////////////////////////////////////////////////////////////////////
}
memcpy
(
ulsch
->
g
,
harq_process
->
f
,
G
>>
3
);
// g is the concatenated code block
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING
,
VCD_FUNCTION_OUT
);
return
(
0
);
}
openair1/SIMULATION/NR_PHY/ulschsim.c
View file @
3d3f49c5
...
@@ -122,7 +122,7 @@ char quantize(double D, double x, unsigned char B) {
...
@@ -122,7 +122,7 @@ char quantize(double D, double x, unsigned char B) {
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
char
c
;
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
,
SNR_lin
,
snr0
=
-
2
.
0
,
snr1
=
2
.
0
;
double
snr_step
=
0
.
1
;
double
snr_step
=
0
.
1
;
uint8_t
snr1set
=
0
;
uint8_t
snr1set
=
0
;
...
@@ -438,7 +438,7 @@ int main(int argc, char **argv) {
...
@@ -438,7 +438,7 @@ int main(int argc, char **argv) {
//nr_init_frame_parms_ue(&UE->frame_parms);
//nr_init_frame_parms_ue(&UE->frame_parms);
//init_nr_ue_transport(UE, 0);
//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
++
)
{
for
(
i
=
0
;
i
<
2
;
i
++
)
{
UE
->
dlsch
[
sf
][
0
][
i
]
=
new_nr_ue_dlsch
(
Kmimo
,
8
,
Nsoft
,
5
,
N_RB_DL
,
UE
->
dlsch
[
sf
][
0
][
i
]
=
new_nr_ue_dlsch
(
Kmimo
,
8
,
Nsoft
,
5
,
N_RB_DL
,
0
);
0
);
...
@@ -464,6 +464,9 @@ int main(int argc, char **argv) {
...
@@ -464,6 +464,9 @@ int main(int argc, char **argv) {
unsigned
char
harq_pid
=
0
;
//dlsch->harq_ids[subframe];
unsigned
char
harq_pid
=
0
;
//dlsch->harq_ids[subframe];
NR_gNB_DLSCH_t
*
dlsch
=
gNB
->
dlsch
[
0
][
0
];
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
;
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;
//time_stats_t *rm_stats, *te_stats, *i_stats;
uint8_t
is_crnti
=
0
,
llr8_flag
=
0
;
uint8_t
is_crnti
=
0
,
llr8_flag
=
0
;
unsigned
int
TBS
=
8424
;
unsigned
int
TBS
=
8424
;
...
@@ -474,6 +477,7 @@ int main(int argc, char **argv) {
...
@@ -474,6 +477,7 @@ int main(int argc, char **argv) {
uint8_t
Nl
=
1
;
uint8_t
Nl
=
1
;
uint8_t
rvidx
=
0
;
uint8_t
rvidx
=
0
;
dlsch
->
rnti
=
1
;
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]->mcs = Imcs;
dlsch->harq_processes[0]->rvidx = rvidx;*/
dlsch->harq_processes[0]->rvidx = rvidx;*/
//printf("dlschsim harqid %d nb_rb %d, mscs %d\n",dlsch->harq_ids[subframe],
//printf("dlschsim harqid %d nb_rb %d, mscs %d\n",dlsch->harq_ids[subframe],
...
@@ -497,9 +501,13 @@ int main(int argc, char **argv) {
...
@@ -497,9 +501,13 @@ int main(int argc, char **argv) {
unsigned
char
*
estimated_output_bit
;
unsigned
char
*
estimated_output_bit
;
unsigned
char
*
test_input_bit
;
unsigned
char
*
test_input_bit
;
unsigned
int
errors_bit
=
0
;
unsigned
int
errors_bit
=
0
;
test_input_bit
=
(
unsigned
char
*
)
malloc16
(
sizeof
(
unsigned
char
)
*
16
*
68
*
384
);
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
=
(
unsigned
char
*
)
malloc16
(
sizeof
(
unsigned
char
)
*
16
*
68
*
384
);
estimated_output_bit
=
(
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_UE_DLSCH_t
*
dlsch0_ue
=
UE
->
dlsch
[
0
][
0
][
0
];
NR_DL_UE_HARQ_t
*
harq_process
=
dlsch0_ue
->
harq_processes
[
harq_pid
];
NR_DL_UE_HARQ_t
*
harq_process
=
dlsch0_ue
->
harq_processes
[
harq_pid
];
harq_process
->
mcs
=
Imcs
;
harq_process
->
mcs
=
Imcs
;
...
@@ -516,6 +524,26 @@ int main(int argc, char **argv) {
...
@@ -516,6 +524,26 @@ int main(int argc, char **argv) {
estimated_output
=
harq_process
->
b
;
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
#ifdef DEBUG_DLSCHSIM
for
(
i
=
0
;
i
<
TBS
/
8
;
i
++
)
printf
(
"test_input[i]=%d
\n
"
,
test_input
[
i
]);
for
(
i
=
0
;
i
<
TBS
/
8
;
i
++
)
printf
(
"test_input[i]=%d
\n
"
,
test_input
[
i
]);
#endif
#endif
...
@@ -527,6 +555,7 @@ int main(int argc, char **argv) {
...
@@ -527,6 +555,7 @@ int main(int argc, char **argv) {
// generate signal
// generate signal
if
(
input_fd
==
NULL
)
{
if
(
input_fd
==
NULL
)
{
nr_dlsch_encoding
(
test_input
,
subframe
,
dlsch
,
frame_parms
);
nr_dlsch_encoding
(
test_input
,
subframe
,
dlsch
,
frame_parms
);
nr_ulsch_encoding
(
ulsch
,
frame_parms
);
}
}
for
(
SNR
=
snr0
;
SNR
<
snr1
;
SNR
+=
snr_step
)
{
for
(
SNR
=
snr0
;
SNR
<
snr1
;
SNR
+=
snr_step
)
{
...
@@ -540,10 +569,14 @@ int main(int argc, char **argv) {
...
@@ -540,10 +569,14 @@ int main(int argc, char **argv) {
if
((
i
&
0xf
)
==
0
)
if
((
i
&
0xf
)
==
0
)
printf
(
"
\n
e %d..%d: "
,
i
,
i
+
15
);
printf
(
"
\n
e %d..%d: "
,
i
,
i
+
15
);
#endif
#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
modulated_input
[
i
]
=
1
.
0
;
///sqrt(2); //QPSK
else
else
modulated_input
[
i
]
=
-
1
.
0
;
///sqrt(2);
modulated_input
[
i
]
=
-
1
.
0
;
///sqrt(2);
...
@@ -594,7 +627,7 @@ int main(int argc, char **argv) {
...
@@ -594,7 +627,7 @@ int main(int argc, char **argv) {
errors_bit
=
0
;
errors_bit
=
0
;
for
(
i
=
0
;
i
<
TBS
;
i
++
)
{
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
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
])
{
if
(
estimated_output_bit
[
i
]
!=
test_input_bit
[
i
])
{
...
@@ -653,12 +686,24 @@ int main(int argc, char **argv) {
...
@@ -653,12 +686,24 @@ int main(int argc, char **argv) {
}
}
}*/
}*/
for
(
i
=
0
;
i
<
2
;
i
++
)
{
for
(
i
=
0
;
i
<
2
;
i
++
)
{
printf
(
"gNB %d
\n
"
,
i
);
printf
(
"gNB %d
\n
"
,
i
);
free_gNB_dlsch
(
gNB
->
dlsch
[
0
][
i
]);
printf
(
"UE %d
\n
"
,
i
);
if
(
gNB
->
dlsch
[
0
][
i
])
free_nr_ue_dlsch
(
UE
->
dlsch
[
0
][
0
][
i
]);
free_gNB_dlsch
(
gNB
->
dlsch
[
0
][
i
]);
free_nr_ue_ulsch
(
UE
->
ulsch
[
0
][
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
++
)
{
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