dual thread for pdsch with pressure test

parent 9a474707
...@@ -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>
......
...@@ -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_
......
...@@ -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_
......
...@@ -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
......
...@@ -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:\nPayload:\n"); printf("PDSCH encoding:\nPayload:\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
......
...@@ -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++){
......
...@@ -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];
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment