dual thread with parameterized pressure test

parent 96009882
......@@ -219,7 +219,7 @@ for (int q=0; q<thread_num_pdsch; q++){
gNB->multi_encoder[q].mod_symbs = mod_symbs[q]; // ==Need to change ==***
}
//Get value for pressure
for (int q=0; q<2; q++){
for (int q=0; q<thread_num_pressure; q++){
//gNB->pressure_test[q].f = harq->f;
gNB->pressure_test[q].encoded_length = encoded_length;
gNB->pressure_test[q].Nid = Nid;
......@@ -228,7 +228,7 @@ for (int q=0; q<2; q++){
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 th=0;th<thread_num_pressure;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));
}
......@@ -258,14 +258,14 @@ clock_gettime(CLOCK_MONOTONIC, &start_ts); //timing
for (int q=0; q<thread_num_pdsch; q++){
pthread_cond_signal(&(gNB->multi_encoder[q].cond_scr_mod));
}
for (int q=0; q<2; q++){
for (int q=0; q<thread_num_pressure; q++){
pthread_cond_signal(&(gNB->pressure_test[q].cond_scr_mod));
}
//Wait threads
for (int q=0; q<thread_num_pdsch; q++){
while(gNB->multi_encoder[q].complete_scr_mod!=1);
}
for (int q=0; q<2; q++){
for (int q=0; q<thread_num_pressure; q++){
while(gNB->pressure_test[q].complete_scr_mod!=1);
}
clock_gettime(CLOCK_MONOTONIC, &end_ts); //timing
......
......@@ -455,14 +455,14 @@ int nr_dlsch_encoding(unsigned char *a, //harq->pdu => dlsch->harq_processes[har
// 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
// }
for(int th=0;th<2;th++){
for(int th=0;th<thread_num_pressure;th++){
for(int j=0;j<MAX_NUM_NR_DLSCH_SEGMENTS/bw_scaling;j++){ // ==Why can not just be MAX_NUM_NR_DLSCH_SEGMENTS ==???
gNB->pressure_test[th].c_test[j]=(uint8_t*)malloc16(8448);//(unsigned char *)malloc16(sizeof(unsigned char) * Kr/8);
gNB->pressure_test[th].d_test[j]=(uint8_t*)malloc16(68*384);//(unsigned char *)malloc16(sizeof(unsigned char) * 68*384);
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++){
for(int th=0;th<thread_num_pressure;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;
......@@ -492,13 +492,13 @@ int nr_dlsch_encoding(unsigned char *a, //harq->pdu => dlsch->harq_processes[har
for(int th=0;th<thread_num_pdsch;th++){
pthread_cond_signal(&(gNB->multi_encoder[th].cond));
}
for(int th=0;th<2;th++){
for(int th=0;th<thread_num_pressure;th++){
pthread_cond_signal(&(gNB->pressure_test[th].cond));
}
for(int th = 0;th<thread_num_pdsch;th++){
while(gNB->multi_encoder[th].complete!=1); // ==check if multi_ldpc_enc done ==
}
for(int th = 0;th<2;th++){
for(int th = 0;th<thread_num_pressure;th++){
while(gNB->pressure_test[th].complete!=1); // ==check if multi_ldpc_enc done ==
}
clock_gettime(CLOCK_MONOTONIC, &end_ts); //timing
......
......@@ -47,6 +47,8 @@
#define MAX_NUM_RU_PER_gNB MAX_NUM_RU_PER_eNB
#define thread_num_pdsch 2 // ==Change thread_num_pdsch here. Don't greater than 2 ==
#define thread_num_pressure 3 // ==Change thread_num_pressure here ==
#define check_time 0 // ==Change if you wnat to check time of threads ==
typedef struct{
/*params of thread*/
......@@ -915,7 +917,7 @@ typedef struct PHY_VARS_gNB_s {
dlsch_encoding_ISIP thread_encode[4];
ldpc_encoding_ISIP ldpc_encode;
multi_ldpc_encoder_gNB multi_encoder[thread_num_pdsch];
multi_ldpc_encoder_gNB pressure_test[2];
multi_ldpc_encoder_gNB pressure_test[thread_num_pressure];
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