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
96009882
Commit
96009882
authored
May 14, 2020
by
OpInConnect_NCTU Terngyin/NY/GK/KM
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dual thread for pdsch with pressure test
parent
9a474707
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
300 additions
and
208 deletions
+300
-208
common/utils/LOG/vcd_signal_dumper.c
common/utils/LOG/vcd_signal_dumper.c
+0
-10
common/utils/LOG/vcd_signal_dumper.h
common/utils/LOG/vcd_signal_dumper.h
+0
-10
common/utils/T/T_defs.h
common/utils/T/T_defs.h
+0
-10
openair1/PHY/CODING/nrLDPC_encoder/defs.h
openair1/PHY/CODING/nrLDPC_encoder/defs.h
+0
-10
openair1/PHY/NR_TRANSPORT/nr_dlsch.c
openair1/PHY/NR_TRANSPORT/nr_dlsch.c
+43
-12
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
+27
-20
openair1/PHY/defs_gNB.h
openair1/PHY/defs_gNB.h
+7
-10
openair1/SIMULATION/NR_PHY/dlsim.c
openair1/SIMULATION/NR_PHY/dlsim.c
+223
-126
No files found.
common/utils/LOG/vcd_signal_dumper.c
View file @
96009882
...
@@ -31,16 +31,6 @@
...
@@ -31,16 +31,6 @@
* \warning
* \warning
*/
*/
/*!\file vcd_signal_dumper.c
* \brief Add some VCD signals of multi_ldpc_encoder
* \author Terngyin, NY, GK, KM (ISIP)
* \email tyhsu@cs.nctu.edu.tw
* \date 07-04-2020
* \version 1.0
* \note
* \warning
*/
#include <pthread.h>
#include <pthread.h>
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
...
...
common/utils/LOG/vcd_signal_dumper.h
View file @
96009882
...
@@ -32,16 +32,6 @@
...
@@ -32,16 +32,6 @@
* \warning
* \warning
*/
*/
/*!\file vcd_signal_dumper.h
* \brief Add some VCD signals of multi_ldpc_encoder
* \author Terngyin, NY, GK, KM (ISIP)
* \email tyhsu@cs.nctu.edu.tw
* \date 07-04-2020
* \version 1.0
* \note
* \warning
*/
#ifndef VCD_SIGNAL_DUMPER_H_
#ifndef VCD_SIGNAL_DUMPER_H_
#define VCD_SIGNAL_DUMPER_H_
#define VCD_SIGNAL_DUMPER_H_
...
...
common/utils/T/T_defs.h
View file @
96009882
...
@@ -19,16 +19,6 @@
...
@@ -19,16 +19,6 @@
* contact@openairinterface.org
* contact@openairinterface.org
*/
*/
/*!\file T_defs.h
* \brief Update VCD_NUM_FUNCTIONS and VCD_NUM_VARIABLES
* \author Terngyin, NY, GK, KM (ISIP)
* \email tyhsu@cs.nctu.edu.tw
* \date 07-04-2020
* \version 1.0
* \note
* \warning
*/
#ifndef _T_defs_H_
#ifndef _T_defs_H_
#define _T_defs_H_
#define _T_defs_H_
...
...
openair1/PHY/CODING/nrLDPC_encoder/defs.h
View file @
96009882
...
@@ -29,16 +29,6 @@
...
@@ -29,16 +29,6 @@
* \warning
* \warning
*/
*/
/*!\file defs.h
* \brief Declarations of parameters of multi_ldpc_encoder
* \author Terngyin, NY, GK, KM (ISIP)
* \email tyhsu@cs.nctu.edu.tw
* \date 07-04-2020
* \version 1.0
* \note
* \warning
*/
#include "PHY/TOOLS/time_meas.h"
#include "PHY/TOOLS/time_meas.h"
// ==[START]multi_ldpc_encoder
// ==[START]multi_ldpc_encoder
...
...
openair1/PHY/NR_TRANSPORT/nr_dlsch.c
View file @
96009882
...
@@ -30,16 +30,6 @@
...
@@ -30,16 +30,6 @@
* \warning
* \warning
*/
*/
/*!\file PHY/NR_TRANSPORT/dlsch_decoding.c
* \brief Add triggers for parameterized dual thread
* \author Terngyin, NY, GK, KM (OpInConnect_NCTU)
* \email tyhsu@cs.nctu.edu.tw
* \date 01-05-2020
* \version 1.2
* \note
* \warning
*/
//pipeline scrambling and modulation from Ian
//pipeline scrambling and modulation from Ian
#include "PHY/phy_extern.h"
#include "PHY/phy_extern.h"
#include "PHY/defs_gNB.h"
#include "PHY/defs_gNB.h"
...
@@ -124,7 +114,6 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t *dlsch,
...
@@ -124,7 +114,6 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t *dlsch,
//printf("rel15->nb_codewords : %d\n", rel15->nb_codewords);
//printf("rel15->nb_codewords : %d\n", rel15->nb_codewords);
#ifdef DEBUG_DLSCH // ==Show original payload & encoded payload ==***
#ifdef DEBUG_DLSCH // ==Show original payload & encoded payload ==***
printf
(
"PDSCH encoding:
\n
Payload:
\n
"
);
printf
(
"PDSCH encoding:
\n
Payload:
\n
"
);
uint32_t
encoded_length
=
nb_symbols
*
Qm
;
for
(
int
i
=
0
;
i
<
harq
->
B
>>
7
;
i
++
)
{
for
(
int
i
=
0
;
i
<
harq
->
B
>>
7
;
i
++
)
{
for
(
int
j
=
0
;
j
<
16
;
j
++
)
for
(
int
j
=
0
;
j
<
16
;
j
++
)
printf
(
"0x%02x
\t
"
,
harq
->
pdu
[(
i
<<
4
)
+
j
]);
printf
(
"0x%02x
\t
"
,
harq
->
pdu
[(
i
<<
4
)
+
j
]);
...
@@ -219,7 +208,7 @@ uint16_t n_RNTI = (pdcch_params.search_space_type == NFAPI_NR_SEARCH_SPACE_TYPE_
...
@@ -219,7 +208,7 @@ uint16_t n_RNTI = (pdcch_params.search_space_type == NFAPI_NR_SEARCH_SPACE_TYPE_
uint16_t
Nid
=
(
pdcch_params
.
search_space_type
==
NFAPI_NR_SEARCH_SPACE_TYPE_UE_SPECIFIC
)
?
pdcch_params
.
scrambling_id
:
config
->
sch_config
.
physical_cell_id
.
value
;
uint16_t
Nid
=
(
pdcch_params
.
search_space_type
==
NFAPI_NR_SEARCH_SPACE_TYPE_UE_SPECIFIC
)
?
pdcch_params
.
scrambling_id
:
config
->
sch_config
.
physical_cell_id
.
value
;
printf
(
"================[Scr_Mod]================
\n
"
);
printf
(
"================[Scr_Mod]================
\n
"
);
printf
(
" [Movement] [No.] [Round] [Cost time]
\n
"
);
printf
(
" [Movement] [No.] [Round] [Cost time]
\n
"
);
//Get value
//Get value
for dual thread
for
(
int
q
=
0
;
q
<
thread_num_pdsch
;
q
++
){
for
(
int
q
=
0
;
q
<
thread_num_pdsch
;
q
++
){
gNB
->
multi_encoder
[
q
].
f
=
harq
->
f
;
gNB
->
multi_encoder
[
q
].
f
=
harq
->
f
;
gNB
->
multi_encoder
[
q
].
encoded_length
=
encoded_length
;
gNB
->
multi_encoder
[
q
].
encoded_length
=
encoded_length
;
...
@@ -229,16 +218,58 @@ for (int q=0; q<thread_num_pdsch; q++){
...
@@ -229,16 +218,58 @@ for (int q=0; q<thread_num_pdsch; q++){
gNB
->
multi_encoder
[
q
].
Qm
=
Qm
;
gNB
->
multi_encoder
[
q
].
Qm
=
Qm
;
gNB
->
multi_encoder
[
q
].
mod_symbs
=
mod_symbs
[
q
];
// ==Need to change ==***
gNB
->
multi_encoder
[
q
].
mod_symbs
=
mod_symbs
[
q
];
// ==Need to change ==***
}
}
//Get value for pressure
for
(
int
q
=
0
;
q
<
2
;
q
++
){
//gNB->pressure_test[q].f = harq->f;
gNB
->
pressure_test
[
q
].
encoded_length
=
encoded_length
;
gNB
->
pressure_test
[
q
].
Nid
=
Nid
;
gNB
->
pressure_test
[
q
].
n_RNTI
=
n_RNTI
;
//gNB->pressure_test[q].scrambled_output = scrambled_output[q]; // ==Need to change ==***
gNB
->
pressure_test
[
q
].
Qm
=
Qm
;
//gNB->pressure_test[q].mod_symbs = mod_symbs[q]; // ==Need to change ==***
}
for
(
int
th
=
0
;
th
<
2
;
th
++
){
for
(
int
q
=
0
;
q
<
NR_MAX_NB_CODEWORDS
;
q
++
){
gNB
->
pressure_test
[
th
].
mod_symbs_test
[
q
]
=
(
int32_t
*
)
malloc16
(
NR_MAX_PDSCH_ENCODED_LENGTH
*
sizeof
(
int32_t
));
}
for
(
int
i
=
0
;
i
<
encoded_length
>>
3
;
i
++
)
{
for
(
int
j
=
0
;
j
<
8
;
j
++
)
gNB
->
pressure_test
[
th
].
f_test
[(
i
<<
3
)
+
j
]
=
harq
->
f
[(
i
<<
3
)
+
j
];
}
for
(
int
q
=
0
;
q
<
rel15
->
nb_codewords
;
q
++
)
// ==Look out!NR_MAX_NB_CODEWORDS is 2!So we can't let q>2 until spec change
memset
((
void
*
)
gNB
->
pressure_test
[
th
].
scrambled_output_test
[
q
],
0
,
(
encoded_length
>>
5
)
*
sizeof
(
uint32_t
));
}
//Show value for pressure
// printf("\nEncoded payload:\n");
// for (int i=0; i<10; i++) {
// for (int j=0; j<3; j++)
// printf("%d", harq->f[(i<<3)+j]);
// printf("\t");
// }
// printf("\nEncoded payload:\n");
// for (int i=0; i<10; i++) {
// for (int j=0; j<3; j++)
// printf("%d", gNB->pressure_test[0].f_test[(i<<3)+j]);
// printf("\t");
// }
//Awake threads
//Awake threads
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_MULTI_ENC
,
1
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
start_ts
);
//timing
clock_gettime
(
CLOCK_MONOTONIC
,
&
start_ts
);
//timing
for
(
int
q
=
0
;
q
<
thread_num_pdsch
;
q
++
){
for
(
int
q
=
0
;
q
<
thread_num_pdsch
;
q
++
){
pthread_cond_signal
(
&
(
gNB
->
multi_encoder
[
q
].
cond_scr_mod
));
pthread_cond_signal
(
&
(
gNB
->
multi_encoder
[
q
].
cond_scr_mod
));
}
}
for
(
int
q
=
0
;
q
<
2
;
q
++
){
pthread_cond_signal
(
&
(
gNB
->
pressure_test
[
q
].
cond_scr_mod
));
}
//Wait threads
//Wait threads
for
(
int
q
=
0
;
q
<
thread_num_pdsch
;
q
++
){
for
(
int
q
=
0
;
q
<
thread_num_pdsch
;
q
++
){
while
(
gNB
->
multi_encoder
[
q
].
complete_scr_mod
!=
1
);
while
(
gNB
->
multi_encoder
[
q
].
complete_scr_mod
!=
1
);
}
}
for
(
int
q
=
0
;
q
<
2
;
q
++
){
while
(
gNB
->
pressure_test
[
q
].
complete_scr_mod
!=
1
);
}
clock_gettime
(
CLOCK_MONOTONIC
,
&
end_ts
);
//timing
clock_gettime
(
CLOCK_MONOTONIC
,
&
end_ts
);
//timing
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_MULTI_ENC
,
0
);
//printf(" Movement No. Round Cost time \n");
//printf(" Movement No. Round Cost time \n");
printf
(
" Total %.2f usec
\n
"
,
(
end_ts
.
tv_nsec
-
start_ts
.
tv_nsec
)
*
1
.
0
/
1000
);
printf
(
" Total %.2f usec
\n
"
,
(
end_ts
.
tv_nsec
-
start_ts
.
tv_nsec
)
*
1
.
0
/
1000
);
//[END]multi_genetate_pdsch_proc
//[END]multi_genetate_pdsch_proc
...
...
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
View file @
96009882
...
@@ -30,16 +30,6 @@
...
@@ -30,16 +30,6 @@
* \warning
* \warning
*/
*/
/*!\file PHY/NR_TRANSPORT/dlsch_coding.c
* \brief Add triggers for parameterized dual thread
* \author Terngyin, NY, GK, KM (OpInConnect_NCTU)
* \email tyhsu@cs.nctu.edu.tw
* \date 01-05-2020
* \version 1.2
* \note
* \warning
*/
#include "PHY/defs_gNB.h"
#include "PHY/defs_gNB.h"
#include "PHY/phy_extern.h"
#include "PHY/phy_extern.h"
#include "PHY/CODING/coding_extern.h"
#include "PHY/CODING/coding_extern.h"
...
@@ -459,20 +449,28 @@ int nr_dlsch_encoding(unsigned char *a, //harq->pdu => dlsch->harq_processes[har
...
@@ -459,20 +449,28 @@ int nr_dlsch_encoding(unsigned char *a, //harq->pdu => dlsch->harq_processes[har
gNB
->
multi_encoder
[
th
].
BG
=
BG
;
gNB
->
multi_encoder
[
th
].
BG
=
BG
;
gNB
->
multi_encoder
[
th
].
n_segments
=
dlsch
->
harq_processes
[
harq_pid
]
->
C
;
gNB
->
multi_encoder
[
th
].
n_segments
=
dlsch
->
harq_processes
[
harq_pid
]
->
C
;
}
}
/*cpy original data to pressure data*/
/*cpy c to c_test*/
unsigned
char
bw_scaling
=
2
;
// ==Need to change ==***
// unsigned char bw_scaling =2; // ==Need to change ==***
// for(int r=0;r<MAX_NUM_NR_DLSCH_SEGMENTS/bw_scaling;r++){
// for(int r=0;r<MAX_NUM_NR_DLSCH_SEGMENTS/bw_scaling;r++){
// dlsch->harq_processes[i]->c[r] = (uint8_t*)malloc16(8448);
// dlsch->harq_processes[i]->c[r] = (uint8_t*)malloc16(8448);
// dlsch->harq_processes[i]->d[r] = (uint8_t*)malloc16(68*384); //max size for coded output
// dlsch->harq_processes[i]->d[r] = (uint8_t*)malloc16(68*384); //max size for coded output
// }
// }
// for(int th=0;th<thread_num_pdsch;th++){
for
(
int
th
=
0
;
th
<
2
;
th
++
){
// for(int j=0;j<MAX_NUM_NR_DLSCH_SEGMENTS/bw_scaling;j++){ // ==Why can not just be MAX_NUM_NR_DLSCH_SEGMENTS ==???
for
(
int
j
=
0
;
j
<
MAX_NUM_NR_DLSCH_SEGMENTS
/
bw_scaling
;
j
++
){
// ==Why can not just be MAX_NUM_NR_DLSCH_SEGMENTS ==???
// gNB->multi_encoder[th].c_test[j]=(uint8_t*)malloc16(8448);//(unsigned char *)malloc16(sizeof(unsigned char) * Kr/8);
gNB
->
pressure_test
[
th
].
c_test
[
j
]
=
(
uint8_t
*
)
malloc16
(
8448
);
//(unsigned char *)malloc16(sizeof(unsigned char) * Kr/8);
// gNB->multi_encoder[th].d_test[j]=(uint8_t*)malloc16(68*384);//(unsigned char *)malloc16(sizeof(unsigned char) * 68*384);
gNB
->
pressure_test
[
th
].
d_test
[
j
]
=
(
uint8_t
*
)
malloc16
(
68
*
384
);
//(unsigned char *)malloc16(sizeof(unsigned char) * 68*384);
// memcpy(gNB->multi_encoder[th].c_test[j], dlsch->harq_processes[harq_pid]->c[j], 8448); // ==Check 8448 ==***
memcpy
(
gNB
->
pressure_test
[
th
].
c_test
[
j
],
dlsch
->
harq_processes
[
harq_pid
]
->
c
[
j
],
8448
);
// ==Check 8448 ==***
// }
}
// }
}
for
(
int
th
=
0
;
th
<
2
;
th
++
){
//gNB->pressure_test[th].test_input = dlsch->harq_processes[harq_pid]->c;
//gNB->pressure_test[th].channel_input_optim = dlsch->harq_processes[harq_pid]->d;
gNB
->
pressure_test
[
th
].
Zc
=
*
Zc
;
gNB
->
pressure_test
[
th
].
Kb
=
Kb
;
gNB
->
pressure_test
[
th
].
block_length
=
Kr
;
gNB
->
pressure_test
[
th
].
BG
=
BG
;
gNB
->
pressure_test
[
th
].
n_segments
=
dlsch
->
harq_processes
[
harq_pid
]
->
C
;
}
/*Show c_test*/
/*Show c_test*/
// printf("c_test :\n");
// printf("c_test :\n");
// for (int i=0; i<3; i++){
// for (int i=0; i<3; i++){
...
@@ -485,17 +483,26 @@ int nr_dlsch_encoding(unsigned char *a, //harq->pdu => dlsch->harq_processes[har
...
@@ -485,17 +483,26 @@ int nr_dlsch_encoding(unsigned char *a, //harq->pdu => dlsch->harq_processes[har
// printf("/%p\n", &gNB->multi_encoder[0].c_test[0][i]);
// printf("/%p\n", &gNB->multi_encoder[0].c_test[0][i]);
// }
// }
//Awake threads & Wait threads finish
printf
(
"================[Encoder]================
\n
"
);
printf
(
"================[Encoder]================
\n
"
);
printf
(
" [Movement] [No.] [Round] [Cost time]
\n
"
);
printf
(
" [Movement] [No.] [Round] [Cost time]
\n
"
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_MULTI_ENC
,
1
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
start_ts
);
//timing
clock_gettime
(
CLOCK_MONOTONIC
,
&
start_ts
);
//timing
for
(
int
th
=
0
;
th
<
thread_num_pdsch
;
th
++
){
for
(
int
th
=
0
;
th
<
thread_num_pdsch
;
th
++
){
pthread_cond_signal
(
&
(
gNB
->
multi_encoder
[
th
].
cond
));
pthread_cond_signal
(
&
(
gNB
->
multi_encoder
[
th
].
cond
));
}
}
for
(
int
th
=
0
;
th
<
2
;
th
++
){
pthread_cond_signal
(
&
(
gNB
->
pressure_test
[
th
].
cond
));
}
for
(
int
th
=
0
;
th
<
thread_num_pdsch
;
th
++
){
for
(
int
th
=
0
;
th
<
thread_num_pdsch
;
th
++
){
while
(
gNB
->
multi_encoder
[
th
].
complete
!=
1
);
// ==check if multi_ldpc_enc done ==
while
(
gNB
->
multi_encoder
[
th
].
complete
!=
1
);
// ==check if multi_ldpc_enc done ==
}
}
for
(
int
th
=
0
;
th
<
2
;
th
++
){
while
(
gNB
->
pressure_test
[
th
].
complete
!=
1
);
// ==check if multi_ldpc_enc done ==
}
clock_gettime
(
CLOCK_MONOTONIC
,
&
end_ts
);
//timing
clock_gettime
(
CLOCK_MONOTONIC
,
&
end_ts
);
//timing
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_MULTI_ENC
,
0
);
//printf(" Movement No. Round Cost time \n");
//printf(" Movement No. Round Cost time \n");
printf
(
" Total %.2f usec
\n
"
,
(
end_ts
.
tv_nsec
-
start_ts
.
tv_nsec
)
*
1
.
0
/
1000
);
printf
(
" Total %.2f usec
\n
"
,
(
end_ts
.
tv_nsec
-
start_ts
.
tv_nsec
)
*
1
.
0
/
1000
);
// for(int th = 0;th<thread_num_pdsch;th++){
// for(int th = 0;th<thread_num_pdsch;th++){
...
...
openair1/PHY/defs_gNB.h
View file @
96009882
...
@@ -30,16 +30,6 @@
...
@@ -30,16 +30,6 @@
\warning
\warning
*/
*/
/*! \file PHY/defs_gNB.h
* \brief Add thread_num_pdsch to parameterize dual thread
* \author Terngyin, NY, GK, KM (OpInConnect_NCTU)
* \email tyhsu@cs.nctu.edu.tw
* \date 01-05-2020
* \version 1.2
* \note
* \warning
*/
#ifndef __PHY_DEFS_GNB__H__
#ifndef __PHY_DEFS_GNB__H__
#define __PHY_DEFS_GNB__H__
#define __PHY_DEFS_GNB__H__
...
@@ -87,6 +77,12 @@ typedef struct{
...
@@ -87,6 +77,12 @@ typedef struct{
uint16_t
Nid
;
uint16_t
Nid
;
uint16_t
n_RNTI
;
uint16_t
n_RNTI
;
uint8_t
Qm
;
uint8_t
Qm
;
/*pressure test*/
uint8_t
*
c_test
[
MAX_NUM_NR_DLSCH_SEGMENTS
];
uint8_t
*
d_test
[
MAX_NUM_NR_DLSCH_SEGMENTS
];
uint8_t
f_test
[
MAX_NUM_NR_CHANNEL_BITS
]
__attribute__
((
aligned
(
32
)));
int32_t
*
mod_symbs_test
[
NR_MAX_NB_CODEWORDS
];
uint32_t
scrambled_output_test
[
NR_MAX_NB_CODEWORDS
][
NR_MAX_PDSCH_ENCODED_LENGTH
>>
5
];
}
multi_ldpc_encoder_gNB
;
}
multi_ldpc_encoder_gNB
;
typedef
struct
{
typedef
struct
{
...
@@ -919,6 +915,7 @@ typedef struct PHY_VARS_gNB_s {
...
@@ -919,6 +915,7 @@ typedef struct PHY_VARS_gNB_s {
dlsch_encoding_ISIP
thread_encode
[
4
];
dlsch_encoding_ISIP
thread_encode
[
4
];
ldpc_encoding_ISIP
ldpc_encode
;
ldpc_encoding_ISIP
ldpc_encode
;
multi_ldpc_encoder_gNB
multi_encoder
[
thread_num_pdsch
];
multi_ldpc_encoder_gNB
multi_encoder
[
thread_num_pdsch
];
multi_ldpc_encoder_gNB
pressure_test
[
2
];
volatile
uint8_t
complete_encode
[
4
];
volatile
uint8_t
complete_encode
[
4
];
...
...
openair1/SIMULATION/NR_PHY/dlsim.c
View file @
96009882
...
@@ -19,16 +19,6 @@
...
@@ -19,16 +19,6 @@
* contact@openairinterface.org
* contact@openairinterface.org
*/
*/
/*!\file SIMULATION/NR_PHY/dlsim.c
* \brief Parameterize dual thread
* \author Terngyin, NY, GK, KM (OpInConnect_NCTU)
* \email tyhsu@cs.nctu.edu.tw
* \date 01-05-2020
* \version 1.2
* \note
* \warning
*/
#define _GNU_SOURCE
#define _GNU_SOURCE
#include <sched.h>
#include <sched.h>
#include <time.h>
#include <time.h>
...
@@ -298,106 +288,6 @@ static void *dlsch_encoding_proc(void *ptr){
...
@@ -298,106 +288,6 @@ static void *dlsch_encoding_proc(void *ptr){
return
&
encode_status
;
return
&
encode_status
;
}
}
/*! \file openair1/SIMULATION/NR_PHY/dlsim.c
* \brief parameterized dual thread for pdsch
* \author Terngyin Hsu, Sendren Xu, Nungyi Kuo, Kuankai Hsiung, Kaimi Yang (OpInConnect_NCTU)
* \email tyhsu@cs.nctu.edu.tw
* \date 13-05-2020
* \version 2.2
* \note
* \warning
*/
//[START]multi_genetate_pdsch_proc
struct
timespec
start_encoder_ts
[
thread_num_pdsch
],
end_encoder_ts
[
thread_num_pdsch
],
start_perenc_ts
[
thread_num_pdsch
],
end_perenc_ts
[
thread_num_pdsch
];
//int thread_num_pdsch = 2; //Craete 2 threads for temp
// int ifRand = 0;
int
vcd
=
0
;
static
void
*
multi_genetate_pdsch_proc
(
void
*
ptr
){
//ldpc_encoder_optim_8seg_multi(dlsch->harq_processes[harq_pid]->c,dlsch->harq_processes[harq_pid]->d,*Zc,Kb,Kr,BG,dlsch->harq_processes[harq_pid]->C,j,NULL,NULL,NULL,NULL);
//ldpc_encoder_optim_8seg_multi(unsigned char **test_input,unsigned char **channel_input,int Zc,int Kb,short block_length, short BG, int n_segments,unsigned int macro_num, time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput)
multi_ldpc_encoder_gNB
*
test
=
(
multi_ldpc_encoder_gNB
*
)
ptr
;
printf
(
"[READY] : %d
\n
"
,
test
->
id
);
while
(
!
oai_exit
){
while
(
pthread_cond_wait
(
&
(
gNB
->
multi_encoder
[
test
->
id
].
cond
),
&
(
gNB
->
multi_encoder
[
test
->
id
].
mutex
))
!=
0
);
if
(
oai_exit
){
//If oai_exit, KILL this thread!
pthread_mutex_destroy
(
&
gNB
->
multi_encoder
[
test
->
id
].
mutex
);
pthread_mutex_destroy
(
&
gNB
->
multi_encoder
[
test
->
id
].
mutex_scr_mod
);
pthread_join
(
gNB
->
multi_encoder
[
test
->
id
].
pthread
,
NULL
);
return
0
;
}
//Print params of multi_ldpc_enc
// printf("[b]ldpc_encoder_optim_8seg: BG %d, Zc %d, Kb %d, block_length %d, segments %d\n",
// ldpc_enc[test->id].BG,
// ldpc_enc[test->id].Zc,
// ldpc_enc[test->id].Kb,
// ldpc_enc[test->id].block_length,
// ldpc_enc[test->id].n_segments);
int
j_start
,
j_end
;
//Check if our situation((n_segments > 7)&(thread_num_pdsch == 2))
if
((
gNB
->
multi_encoder
[
test
->
id
].
n_segments
>
7
)
&&
(
thread_num_pdsch
==
2
)){
j_start
=
test
->
id
;
j_end
=
j_start
+
1
;
}
else
{
j_start
=
0
;
j_end
=
(
gNB
->
multi_encoder
[
test
->
id
].
n_segments
/
8
+
1
);
}
int
offset
=
test
->
id
>
7
?
7
:
test
->
id
;
//printf("[OFFSET] : %d %d\n", offset, test->id);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_MULTI_ENC_0
+
offset
,
1
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
start_encoder_ts
[
test
->
id
]);
//timing
for
(
int
j
=
j_start
;
j
<
j_end
;
j
++
){
//printf(" Movement No. Round Cost time \n");
printf
(
" Active %d %d
\n
"
,
test
->
id
,
j
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
start_perenc_ts
[
test
->
id
]);
//timing
ldpc_encoder_optim_8seg_multi
(
gNB
->
multi_encoder
[
test
->
id
].
test_input
,
//gNB->multi_encoder[0].c_test,
gNB
->
multi_encoder
[
test
->
id
].
channel_input_optim
,
//gNB->multi_encoder[0].d_test,
gNB
->
multi_encoder
[
test
->
id
].
Zc
,
gNB
->
multi_encoder
[
test
->
id
].
Kb
,
gNB
->
multi_encoder
[
test
->
id
].
block_length
,
gNB
->
multi_encoder
[
test
->
id
].
BG
,
gNB
->
multi_encoder
[
test
->
id
].
n_segments
,
j
,
NULL
,
NULL
,
NULL
,
NULL
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
end_perenc_ts
[
test
->
id
]);
//timing
//printf(" Movement No. Round Cost time \n");
printf
(
" Done %d %d %.2f usec
\n
"
,
test
->
id
,
j
,
(
end_perenc_ts
[
test
->
id
].
tv_nsec
-
start_perenc_ts
[
test
->
id
].
tv_nsec
)
*
1
.
0
/
1000
);
}
clock_gettime
(
CLOCK_MONOTONIC
,
&
end_encoder_ts
[
test
->
id
]);
//timing
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_MULTI_ENC_0
+
offset
,
0
);
printf
(
" All done %d %.2f usec
\n
"
,
test
->
id
,
(
end_encoder_ts
[
test
->
id
].
tv_nsec
-
start_encoder_ts
[
test
->
id
].
tv_nsec
)
*
1
.
0
/
1000
);
gNB
->
multi_encoder
[
test
->
id
].
complete
=
1
;
//==================================================
while
(
pthread_cond_wait
(
&
(
gNB
->
multi_encoder
[
test
->
id
].
cond_scr_mod
),
&
(
gNB
->
multi_encoder
[
test
->
id
].
mutex_scr_mod
))
!=
0
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_MULTI_ENC_0
+
offset
,
1
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
start_encoder_ts
[
test
->
id
]);
//timing
for
(
int
q
=
0
;
q
<
1
;
q
++
){
//Need to change by codewords
printf
(
" Active %d %d
\n
"
,
test
->
id
,
q
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
start_perenc_ts
[
test
->
id
]);
//timing
nr_pdsch_codeword_scrambling
(
gNB
->
multi_encoder
[
test
->
id
].
f
,
gNB
->
multi_encoder
[
test
->
id
].
encoded_length
,
q
,
gNB
->
multi_encoder
[
test
->
id
].
Nid
,
gNB
->
multi_encoder
[
test
->
id
].
n_RNTI
,
gNB
->
multi_encoder
[
test
->
id
].
scrambled_output
);
nr_modulation
(
gNB
->
multi_encoder
[
test
->
id
].
scrambled_output
,
gNB
->
multi_encoder
[
test
->
id
].
encoded_length
,
gNB
->
multi_encoder
[
test
->
id
].
Qm
,
gNB
->
multi_encoder
[
test
->
id
].
mod_symbs
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
end_perenc_ts
[
test
->
id
]);
//timing
//printf(" Movement No. Round Cost time \n");
printf
(
" Done %d %d %.2f usec
\n
"
,
test
->
id
,
q
,
(
end_perenc_ts
[
test
->
id
].
tv_nsec
-
start_perenc_ts
[
test
->
id
].
tv_nsec
)
*
1
.
0
/
1000
);
}
clock_gettime
(
CLOCK_MONOTONIC
,
&
end_encoder_ts
[
test
->
id
]);
//timing
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_MULTI_ENC_0
+
offset
,
0
);
printf
(
" All done %d %.2f usec
\n
"
,
test
->
id
,
(
end_encoder_ts
[
test
->
id
].
tv_nsec
-
start_encoder_ts
[
test
->
id
].
tv_nsec
)
*
1
.
0
/
1000
);
gNB
->
multi_encoder
[
test
->
id
].
complete_scr_mod
=
1
;
}
return
0
;
}
//[END]multi_genetate_pdsch_proc
static
void
*
scrambling_proc
(
void
*
ptr
){
static
void
*
scrambling_proc
(
void
*
ptr
){
scrambling_channel
*
test
=
(
scrambling_channel
*
)
ptr
;
scrambling_channel
*
test
=
(
scrambling_channel
*
)
ptr
;
...
@@ -629,6 +519,184 @@ static void *modulation_proc(void *ptr){
...
@@ -629,6 +519,184 @@ static void *modulation_proc(void *ptr){
return
&
modulation_channel_status
;
return
&
modulation_channel_status
;
}
}
/*! \file openair1/SIMULATION/NR_PHY/dlsim.c
* \brief dual thread for pdsch with pressure test
* \author Terngyin Hsu, Sendren Xu, Nungyi Kuo, Kuankai Hsiung, Kaimi Yang (OpInConnect_NCTU)
* \email tyhsu@cs.nctu.edu.tw
* \date 13-05-2020
* \version 2.3
* \note
* \warning
*/
//[START]multi_genetate_pdsch_proc
struct
timespec
start_encoder_ts
[
thread_num_pdsch
],
end_encoder_ts
[
thread_num_pdsch
],
start_perenc_ts
[
thread_num_pdsch
],
end_perenc_ts
[
thread_num_pdsch
],
start_pressure_ts
[
2
],
end_pressure_ts
[
2
],
start_perpre_ts
[
2
],
end_perpre_ts
[
2
];
//int thread_num_pdsch = 2; //Craete 2 threads for temp
// int ifRand = 0;
int
vcd
=
0
;
static
void
*
multi_genetate_pdsch_proc
(
void
*
ptr
){
//ldpc_encoder_optim_8seg_multi(dlsch->harq_processes[harq_pid]->c,dlsch->harq_processes[harq_pid]->d,*Zc,Kb,Kr,BG,dlsch->harq_processes[harq_pid]->C,j,NULL,NULL,NULL,NULL);
//ldpc_encoder_optim_8seg_multi(unsigned char **test_input,unsigned char **channel_input,int Zc,int Kb,short block_length, short BG, int n_segments,unsigned int macro_num, time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput)
multi_ldpc_encoder_gNB
*
test
=
(
multi_ldpc_encoder_gNB
*
)
ptr
;
printf
(
"[READY] : %d
\n
"
,
test
->
id
);
while
(
!
oai_exit
){
while
(
pthread_cond_wait
(
&
(
gNB
->
multi_encoder
[
test
->
id
].
cond
),
&
(
gNB
->
multi_encoder
[
test
->
id
].
mutex
))
!=
0
);
if
(
oai_exit
){
//If oai_exit, KILL this thread!
pthread_mutex_destroy
(
&
gNB
->
multi_encoder
[
test
->
id
].
mutex
);
pthread_mutex_destroy
(
&
gNB
->
multi_encoder
[
test
->
id
].
mutex_scr_mod
);
pthread_join
(
gNB
->
multi_encoder
[
test
->
id
].
pthread
,
NULL
);
return
0
;
}
//Print params of multi_ldpc_enc
// printf("[b]ldpc_encoder_optim_8seg: BG %d, Zc %d, Kb %d, block_length %d, segments %d\n",
// ldpc_enc[test->id].BG,
// ldpc_enc[test->id].Zc,
// ldpc_enc[test->id].Kb,
// ldpc_enc[test->id].block_length,
// ldpc_enc[test->id].n_segments);
int
j_start
,
j_end
;
//Check if our situation((n_segments > 7)&(thread_num_pdsch == 2))
if
((
gNB
->
multi_encoder
[
test
->
id
].
n_segments
>
7
)
&&
(
thread_num_pdsch
==
2
)){
j_start
=
test
->
id
;
j_end
=
j_start
+
1
;
}
else
{
j_start
=
0
;
j_end
=
(
gNB
->
multi_encoder
[
test
->
id
].
n_segments
/
8
+
1
);
}
int
offset
=
test
->
id
>
7
?
7
:
test
->
id
;
//printf("[OFFSET] : %d %d\n", offset, test->id);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_MULTI_ENC_0
+
offset
,
1
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
start_encoder_ts
[
test
->
id
]);
//timing
for
(
int
j
=
j_start
;
j
<
j_end
;
j
++
){
//printf(" Movement No. Round Cost time \n");
printf
(
" Active %d %d
\n
"
,
test
->
id
,
j
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
start_perenc_ts
[
test
->
id
]);
//timing
ldpc_encoder_optim_8seg_multi
(
gNB
->
multi_encoder
[
test
->
id
].
test_input
,
//gNB->multi_encoder[0].c_test,
gNB
->
multi_encoder
[
test
->
id
].
channel_input_optim
,
//gNB->multi_encoder[0].d_test,
gNB
->
multi_encoder
[
test
->
id
].
Zc
,
gNB
->
multi_encoder
[
test
->
id
].
Kb
,
gNB
->
multi_encoder
[
test
->
id
].
block_length
,
gNB
->
multi_encoder
[
test
->
id
].
BG
,
gNB
->
multi_encoder
[
test
->
id
].
n_segments
,
j
,
NULL
,
NULL
,
NULL
,
NULL
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
end_perenc_ts
[
test
->
id
]);
//timing
//printf(" Movement No. Round Cost time \n");
printf
(
" Done %d %d %.2f usec
\n
"
,
test
->
id
,
j
,
(
end_perenc_ts
[
test
->
id
].
tv_nsec
-
start_perenc_ts
[
test
->
id
].
tv_nsec
)
*
1
.
0
/
1000
);
}
clock_gettime
(
CLOCK_MONOTONIC
,
&
end_encoder_ts
[
test
->
id
]);
//timing
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_MULTI_ENC_0
+
offset
,
0
);
printf
(
" All done %d %.2f usec
\n
"
,
test
->
id
,
(
end_encoder_ts
[
test
->
id
].
tv_nsec
-
start_encoder_ts
[
test
->
id
].
tv_nsec
)
*
1
.
0
/
1000
);
gNB
->
multi_encoder
[
test
->
id
].
complete
=
1
;
//==================================================
while
(
pthread_cond_wait
(
&
(
gNB
->
multi_encoder
[
test
->
id
].
cond_scr_mod
),
&
(
gNB
->
multi_encoder
[
test
->
id
].
mutex_scr_mod
))
!=
0
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_MULTI_ENC_0
+
offset
,
1
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
start_encoder_ts
[
test
->
id
]);
//timing
for
(
int
q
=
0
;
q
<
1
;
q
++
){
//Need to change by codewords
printf
(
" Active %d %d
\n
"
,
test
->
id
,
q
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
start_perenc_ts
[
test
->
id
]);
//timing
nr_pdsch_codeword_scrambling
(
gNB
->
multi_encoder
[
test
->
id
].
f
,
gNB
->
multi_encoder
[
test
->
id
].
encoded_length
,
q
,
gNB
->
multi_encoder
[
test
->
id
].
Nid
,
gNB
->
multi_encoder
[
test
->
id
].
n_RNTI
,
gNB
->
multi_encoder
[
test
->
id
].
scrambled_output
);
nr_modulation
(
gNB
->
multi_encoder
[
test
->
id
].
scrambled_output
,
gNB
->
multi_encoder
[
test
->
id
].
encoded_length
,
gNB
->
multi_encoder
[
test
->
id
].
Qm
,
gNB
->
multi_encoder
[
test
->
id
].
mod_symbs
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
end_perenc_ts
[
test
->
id
]);
//timing
//printf(" Movement No. Round Cost time \n");
printf
(
" Done %d %d %.2f usec
\n
"
,
test
->
id
,
q
,
(
end_perenc_ts
[
test
->
id
].
tv_nsec
-
start_perenc_ts
[
test
->
id
].
tv_nsec
)
*
1
.
0
/
1000
);
}
clock_gettime
(
CLOCK_MONOTONIC
,
&
end_encoder_ts
[
test
->
id
]);
//timing
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_MULTI_ENC_0
+
offset
,
0
);
printf
(
" All done %d %.2f usec
\n
"
,
test
->
id
,
(
end_encoder_ts
[
test
->
id
].
tv_nsec
-
start_encoder_ts
[
test
->
id
].
tv_nsec
)
*
1
.
0
/
1000
);
gNB
->
multi_encoder
[
test
->
id
].
complete_scr_mod
=
1
;
}
return
0
;
}
static
void
*
multi_genetate_pdsch_pressure
(
void
*
ptr
){
//ldpc_encoder_optim_8seg_multi(dlsch->harq_processes[harq_pid]->c,dlsch->harq_processes[harq_pid]->d,*Zc,Kb,Kr,BG,dlsch->harq_processes[harq_pid]->C,j,NULL,NULL,NULL,NULL);
//ldpc_encoder_optim_8seg_multi(unsigned char **test_input,unsigned char **channel_input,int Zc,int Kb,short block_length, short BG, int n_segments,unsigned int macro_num, time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput)
multi_ldpc_encoder_gNB
*
test
=
(
multi_ldpc_encoder_gNB
*
)
ptr
;
printf
(
"[READY] : %d(p)
\n
"
,
test
->
id
);
while
(
!
oai_exit
){
while
(
pthread_cond_wait
(
&
(
gNB
->
pressure_test
[
test
->
id
].
cond
),
&
(
gNB
->
pressure_test
[
test
->
id
].
mutex
))
!=
0
);
if
(
oai_exit
){
//If oai_exit, KILL this thread!
pthread_mutex_destroy
(
&
gNB
->
pressure_test
[
test
->
id
].
mutex
);
pthread_mutex_destroy
(
&
gNB
->
pressure_test
[
test
->
id
].
mutex_scr_mod
);
pthread_join
(
gNB
->
pressure_test
[
test
->
id
].
pthread
,
NULL
);
return
0
;
}
//Print params of multi_ldpc_enc
// printf("[b]ldpc_encoder_optim_8seg: BG %d, Zc %d, Kb %d, block_length %d, segments %d\n",
// ldpc_enc[test->id].BG,
// ldpc_enc[test->id].Zc,
// ldpc_enc[test->id].Kb,
// ldpc_enc[test->id].block_length,
// ldpc_enc[test->id].n_segments);
int
j_start
,
j_end
;
j_start
=
0
;
j_end
=
(
gNB
->
pressure_test
[
test
->
id
].
n_segments
/
8
+
1
);
int
offset
=
test
->
id
+
thread_num_pdsch
;
if
(
offset
>
7
){
offset
=
7
;
}
//printf("[OFFSET] : %d %d\n", offset, test->id);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_MULTI_ENC_0
+
offset
,
1
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
start_pressure_ts
[
test
->
id
]);
//timing
for
(
int
j
=
j_start
;
j
<
j_end
;
j
++
){
printf
(
" Active %d(p) %d
\n
"
,
test
->
id
,
j
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
start_perpre_ts
[
test
->
id
]);
//timing
ldpc_encoder_optim_8seg_multi
(
gNB
->
pressure_test
[
test
->
id
].
c_test
,
gNB
->
pressure_test
[
test
->
id
].
d_test
,
gNB
->
pressure_test
[
test
->
id
].
Zc
,
gNB
->
pressure_test
[
test
->
id
].
Kb
,
gNB
->
pressure_test
[
test
->
id
].
block_length
,
gNB
->
pressure_test
[
test
->
id
].
BG
,
gNB
->
pressure_test
[
test
->
id
].
n_segments
,
j
,
NULL
,
NULL
,
NULL
,
NULL
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
end_perpre_ts
[
test
->
id
]);
//timing
//printf(" Movement No. Round Cost time \n");
printf
(
" Done %d(p) %d %.2f usec
\n
"
,
test
->
id
,
j
,
(
end_perpre_ts
[
test
->
id
].
tv_nsec
-
start_perpre_ts
[
test
->
id
].
tv_nsec
)
*
1
.
0
/
1000
);
}
clock_gettime
(
CLOCK_MONOTONIC
,
&
end_pressure_ts
[
test
->
id
]);
//timing
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_MULTI_ENC_0
+
offset
,
0
);
printf
(
" All done %d(p) %.2f usec
\n
"
,
test
->
id
,
(
end_pressure_ts
[
test
->
id
].
tv_nsec
-
start_pressure_ts
[
test
->
id
].
tv_nsec
)
*
1
.
0
/
1000
);
gNB
->
pressure_test
[
test
->
id
].
complete
=
1
;
//==================================================
while
(
pthread_cond_wait
(
&
(
gNB
->
pressure_test
[
test
->
id
].
cond_scr_mod
),
&
(
gNB
->
pressure_test
[
test
->
id
].
mutex_scr_mod
))
!=
0
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_MULTI_ENC_0
+
offset
,
1
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
start_pressure_ts
[
test
->
id
]);
//timing
for
(
int
q
=
0
;
q
<
1
;
q
++
){
//Need to change by codewords
printf
(
" Active %d(p) %d
\n
"
,
test
->
id
,
q
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
start_perpre_ts
[
test
->
id
]);
//timing
nr_pdsch_codeword_scrambling
(
gNB
->
pressure_test
[
test
->
id
].
f_test
,
gNB
->
pressure_test
[
test
->
id
].
encoded_length
,
q
,
gNB
->
pressure_test
[
test
->
id
].
Nid
,
gNB
->
pressure_test
[
test
->
id
].
n_RNTI
,
gNB
->
pressure_test
[
test
->
id
].
scrambled_output_test
);
nr_modulation
(
gNB
->
pressure_test
[
test
->
id
].
scrambled_output_test
,
gNB
->
pressure_test
[
test
->
id
].
encoded_length
,
gNB
->
pressure_test
[
test
->
id
].
Qm
,
gNB
->
pressure_test
[
test
->
id
].
mod_symbs_test
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
end_perpre_ts
[
test
->
id
]);
//timing
//printf(" Movement No. Round Cost time \n");
printf
(
" Done %d(p) %d %.2f usec
\n
"
,
test
->
id
,
q
,
(
end_perpre_ts
[
test
->
id
].
tv_nsec
-
start_perpre_ts
[
test
->
id
].
tv_nsec
)
*
1
.
0
/
1000
);
}
clock_gettime
(
CLOCK_MONOTONIC
,
&
end_pressure_ts
[
test
->
id
]);
//timing
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_MULTI_ENC_0
+
offset
,
0
);
printf
(
" All done %d(p) %.2f usec
\n
"
,
test
->
id
,
(
end_pressure_ts
[
test
->
id
].
tv_nsec
-
start_pressure_ts
[
test
->
id
].
tv_nsec
)
*
1
.
0
/
1000
);
gNB
->
pressure_test
[
test
->
id
].
complete_scr_mod
=
1
;
}
return
0
;
}
//[END]multi_genetate_pdsch_proc
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
{
char
c
;
char
c
;
...
@@ -1066,6 +1134,20 @@ int main(int argc, char **argv)
...
@@ -1066,6 +1134,20 @@ int main(int argc, char **argv)
// printf("[CREATE] DLSCH ENCODER Thread %d\n", gNB->thread_encode[t].id);
// printf("[CREATE] DLSCH ENCODER Thread %d\n", gNB->thread_encode[t].id);
// }
// }
// for(int aa = 0;aa<1;aa++){
// pthread_attr_init( &gNB->thread_scrambling[aa].attr_scrambling);
// pthread_mutex_init(&(gNB->thread_scrambling[aa].mutex_tx), NULL);
// pthread_cond_init(&(gNB->thread_scrambling[aa].cond_tx), NULL);
// gNB->thread_scrambling[aa].q_id = aa;
// pthread_create(&(gNB->thread_scrambling[aa].pthread_scrambling),&gNB->thread_scrambling[aa].attr_scrambling,scrambling_proc,&gNB->thread_scrambling[aa]);
// printf("[CREATE] scrambling_channel thread[%d] \n",aa);
// }
// pthread_mutex_init( &(gNB->thread_modulation.mutex_tx), NULL);
// pthread_cond_init( &(gNB->thread_modulation.cond_tx), NULL);
// pthread_create(&(gNB->thread_modulation.pthread_modulation),&gNB->thread_modulation.attr_modulation,modulation_proc,&gNB->thread_modulation);
// printf("[CREATE] modulation_channel thread \n");
//[START]multi_genetate_pdsch_proc:create thread
//[START]multi_genetate_pdsch_proc:create thread
for
(
int
th
=
0
;
th
<
thread_num_pdsch
;
th
++
){
for
(
int
th
=
0
;
th
<
thread_num_pdsch
;
th
++
){
pthread_attr_init
(
&
(
gNB
->
multi_encoder
[
th
].
attr
));
pthread_attr_init
(
&
(
gNB
->
multi_encoder
[
th
].
attr
));
...
@@ -1080,21 +1162,21 @@ int main(int argc, char **argv)
...
@@ -1080,21 +1162,21 @@ int main(int argc, char **argv)
pthread_create
(
&
(
gNB
->
multi_encoder
[
th
].
pthread
),
&
(
gNB
->
multi_encoder
[
th
].
attr
),
multi_genetate_pdsch_proc
,
&
(
gNB
->
multi_encoder
[
th
]));
pthread_create
(
&
(
gNB
->
multi_encoder
[
th
].
pthread
),
&
(
gNB
->
multi_encoder
[
th
].
attr
),
multi_genetate_pdsch_proc
,
&
(
gNB
->
multi_encoder
[
th
]));
printf
(
"[CREATE] LDPC encoder thread %d
\n
"
,
gNB
->
multi_encoder
[
th
].
id
);
printf
(
"[CREATE] LDPC encoder thread %d
\n
"
,
gNB
->
multi_encoder
[
th
].
id
);
}
}
for
(
int
th
=
0
;
th
<
2
;
th
++
){
pthread_attr_init
(
&
(
gNB
->
pressure_test
[
th
].
attr
));
pthread_mutex_init
(
&
(
gNB
->
pressure_test
[
th
].
mutex
),
NULL
);
pthread_mutex_init
(
&
(
gNB
->
pressure_test
[
th
].
mutex_scr_mod
),
NULL
);
pthread_cond_init
(
&
(
gNB
->
pressure_test
[
th
].
cond
),
NULL
);
pthread_cond_init
(
&
(
gNB
->
pressure_test
[
th
].
cond_scr_mod
),
NULL
);
gNB
->
pressure_test
[
th
].
id
=
th
;
gNB
->
pressure_test
[
th
].
flag_wait
=
1
;
gNB
->
pressure_test
[
th
].
complete
=
0
;
gNB
->
pressure_test
[
th
].
complete_scr_mod
=
0
;
pthread_create
(
&
(
gNB
->
pressure_test
[
th
].
pthread
),
&
(
gNB
->
pressure_test
[
th
].
attr
),
multi_genetate_pdsch_pressure
,
&
(
gNB
->
pressure_test
[
th
]));
printf
(
"[CREATE] LDPC encoder thread %d(p)
\n
"
,
gNB
->
pressure_test
[
th
].
id
);
}
//[END]multi_genetate_pdsch_proc:create thread
//[END]multi_genetate_pdsch_proc:create thread
// for(int aa = 0;aa<1;aa++){
// pthread_attr_init( &gNB->thread_scrambling[aa].attr_scrambling);
// pthread_mutex_init(&(gNB->thread_scrambling[aa].mutex_tx), NULL);
// pthread_cond_init(&(gNB->thread_scrambling[aa].cond_tx), NULL);
// gNB->thread_scrambling[aa].q_id = aa;
// pthread_create(&(gNB->thread_scrambling[aa].pthread_scrambling),&gNB->thread_scrambling[aa].attr_scrambling,scrambling_proc,&gNB->thread_scrambling[aa]);
// printf("[CREATE] scrambling_channel thread[%d] \n",aa);
// }
// pthread_mutex_init( &(gNB->thread_modulation.mutex_tx), NULL);
// pthread_cond_init( &(gNB->thread_modulation.cond_tx), NULL);
// pthread_create(&(gNB->thread_modulation.pthread_modulation),&gNB->thread_modulation.attr_modulation,modulation_proc,&gNB->thread_modulation);
// printf("[CREATE] modulation_channel thread \n");
init_nr_ue_transport
(
UE
,
0
);
init_nr_ue_transport
(
UE
,
0
);
usleep
(
1000000
);
usleep
(
1000000
);
nr_gold_pbch
(
UE
);
nr_gold_pbch
(
UE
);
...
@@ -1443,11 +1525,26 @@ int main(int argc, char **argv)
...
@@ -1443,11 +1525,26 @@ int main(int argc, char **argv)
}
// NSR
}
// NSR
//[START]Send Kill massage
//[START]Send Kill massage
oai_exit
=
1
;
//
==We should do for threading ==***
oai_exit
=
1
;
//
set oai status oai_exit = 1
printf
(
"Kill them all!
\n
"
);
printf
(
"Kill them all!
\n
"
);
for
(
int
th
=
0
;
th
<
thread_num_pdsch
;
th
++
){
for
(
int
th
=
0
;
th
<
thread_num_pdsch
;
th
++
){
pthread_cond_signal
(
&
(
gNB
->
multi_encoder
[
th
].
cond
));
pthread_cond_signal
(
&
(
gNB
->
multi_encoder
[
th
].
cond
));
}
}
for
(
int
th
=
0
;
th
<
2
;
th
++
){
pthread_cond_signal
(
&
(
gNB
->
pressure_test
[
th
].
cond
));
}
//free memorys
unsigned
char
bw_scaling
=
2
;
// ==Need to change ==***
for
(
int
th
=
0
;
th
<
2
;
th
++
){
for
(
int
j
=
0
;
j
<
MAX_NUM_NR_DLSCH_SEGMENTS
/
bw_scaling
;
j
++
){
free
(
gNB
->
pressure_test
[
th
].
c_test
[
j
]);
free
(
gNB
->
pressure_test
[
th
].
d_test
[
j
]);
}
// ==We have some problom here ==???
// for (int q=0; q<NR_MAX_NB_CODEWORDS; q++){
// free(gNB->pressure_test[th].mod_symbs_test[q]);
// }
}
//[END]Send Kill massage
//[END]Send Kill massage
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