Exemple #1
0
void test_scrambling(LTE_PHY_PARAMS *lte_phy_params)
{
	std::cout << "Tx scrambling starts" << std::endl;

//	ReadInputFromFiles(lte_phy_params->scramb_in, lte_phy_params->scramb_in_buf_sz, "../testsuite/ScrambleInput");
	GeneRandomInput(lte_phy_params->scramb_in, lte_phy_params->scramb_in_buf_sz, "../testsuite/RandomScrambleInput");

	GenScrambInt(lte_phy_params->scramb_seq_int, lte_phy_params->scramb_in_buf_sz);
	
//	double tstart, tend, ttime;

//	tstart = dtime();

//	for (int i = 0; i < 1; i++) {
	Scrambling(lte_phy_params, lte_phy_params->scramb_in, lte_phy_params->scramb_out);
//	}

//	tend = dtime();
//	ttime = tend - tstart;
//	printf("%fms\n", ttime);
	
	WriteOutputToFiles(lte_phy_params->scramb_out, lte_phy_params->scramb_out_buf_sz, "../testsuite/testScrambleOutput");

	std::cout << "Tx scrambling ends" << std::endl;
}
Exemple #2
0
void test_equalizer_chain_pth(LTE_PHY_PARAMS *lte_phy_params)
{
	double tstart, tend, ttime;
	
	GeneRandomInput((lte_phy_params + 0)->ofdemod_in, (lte_phy_params + 0)->ofdemod_in_buf_sz, "./testsuite/SubCarrierMapInputReal", "./testsuite/SubCarrierMapInputImag");
	GeneRandomInput((lte_phy_params + 1)->ofdemod_in, (lte_phy_params + 1)->ofdemod_in_buf_sz, "./testsuite/SubCarrierMapInputReal", "./testsuite/SubCarrierMapInputImag");
	GeneRandomInput((lte_phy_params + 2)->ofdemod_in, (lte_phy_params + 2)->ofdemod_in_buf_sz, "./testsuite/SubCarrierMapInputReal", "./testsuite/SubCarrierMapInputImag");

	tstart = dtime();
	
	equalizer_chain_pth(lte_phy_params);

	tend = dtime();
	ttime = tend - tstart;
	printf("%.3fms\n", ttime);

	WriteOutputToFiles((lte_phy_params + 0)->eq_out, (lte_phy_params + 0)->eq_out_buf_sz, "./testsuite/testLSCELSEqOutputReal", "./testsuite/testLSCELSEqOutputImag");
	WriteOutputToFiles((lte_phy_params + 1)->eq_out, (lte_phy_params + 1)->eq_out_buf_sz, "./testsuite/testLSCELSEqOutputReal", "./testsuite/testLSCELSEqOutputImag");
	WriteOutputToFiles((lte_phy_params + 2)->eq_out, (lte_phy_params + 2)->eq_out_buf_sz, "./testsuite/testLSCELSEqOutputReal", "./testsuite/testLSCELSEqOutputImag");
}
void rx_rate_matching(LTE_PHY_PARAMS *lte_phy_params)
{
	std::cout << "Rx RateMatching starts" << std::endl;

//	ReadInputFromFiles(lte_phy_params->rdm_in, lte_phy_params->rdm_in_buf_sz, "testTxRateMatchOutput");
	GeneRandomInput(lte_phy_params->rdm_in, lte_phy_params->rdm_in_buf_sz, "RxRateMatchInput");

	RxRateMatching(lte_phy_params->rdm_in, lte_phy_params->rdm_out, lte_phy_params->rdm_hard, lte_phy_params->rdm_out_buf_sz);

	WriteOutputToFiles(lte_phy_params->rdm_out, lte_phy_params->rdm_out_buf_sz, "testRxRateMatchOutput");

	std::cout << "Rx RateMatching ends" << std::endl;
}
Exemple #4
0
void rx_rate_matching(LTE_PHY_PARAMS *lte_phy_params)
{
	std::cout << "Rx RateMatching starts" << std::endl;

	ReadInputFromFiles(lte_phy_params->rdm_in, lte_phy_params->rdm_in_buf_sz, "/root/RateMatching/testsuite/testTxRateMatchOutput");
//	ReadInputFromFiles(rx_rm_in, in_buf_sz, "RxRateMatchInput");

	RxRateMatching(lte_phy_params, lte_phy_params->rdm_in, lte_phy_params->rdm_out, lte_phy_params->rdm_hard);


//	WriteOutputToFiles(lte_phy_params->rdm_out, lte_phy_params->rdm_out_buf_sz, "testRxRateMatchOutput");
	WriteOutputToFiles(lte_phy_params->rdm_out, lte_phy_params->rdm_out_buf_sz, "/root/RateMatching/testsuite/testRxRateMatchOutput");

	std::cout << "Rx RateMatching ends" << std::endl;
}
Exemple #5
0
void test_scrambling(LTE_PHY_PARAMS *lte_phy_params)
{
	std::cout << "Tx scrambling starts" << std::endl;

//	ReadInputFromFiles(lte_phy_params->scramb_in, lte_phy_params->scramb_in_buf_sz, "../testsuite/ScrambleInput");
	GeneRandomInput(lte_phy_params->scramb_in, lte_phy_params->scramb_in_buf_sz, "/root/Scrambling/testsuite/RandomScrambleInput");
//	GeneRandomInput(lte_phy_params->scramb_in, lte_phy_params->scramb_in_buf_sz, "../testsuite/RandomScrambleInput");

	GenScrambInt(lte_phy_params->scramb_seq_int, lte_phy_params->scramb_in_buf_sz);
	Scrambling(lte_phy_params, lte_phy_params->scramb_in, lte_phy_params->scramb_out);

	WriteOutputToFiles(lte_phy_params->scramb_out, lte_phy_params->scramb_out_buf_sz, "/root/Scrambling/testsuite/testScrambleOutput");
//	WriteOutputToFiles(lte_phy_params->scramb_out, lte_phy_params->scramb_out_buf_sz, "../testsuite/testScrambleOutput");

	std::cout << "Tx scrambling ends" << std::endl;
}
Exemple #6
0
void test_descrambling(LTE_PHY_PARAMS *lte_phy_params)
{
	
	std::cout << "Rx descrambling starts" << std::endl;

	float *rx_scramb_in = (float *)malloc(lte_phy_params->descramb_in_buf_sz * sizeof(float));
	float *rx_scramb_out = (float *)malloc(lte_phy_params->descramb_out_buf_sz * sizeof(float));
	int i;

	ReadInputFromFiles(lte_phy_params->descramb_in, lte_phy_params->descramb_in_buf_sz, "/root/Scrambling/testsuite/testScrambleOutput");
//	ReadInputFromFiles(lte_phy_params->descramb_in, lte_phy_params->descramb_in_buf_sz, "../testsuite/testScrambleOutput");
//	ReadInputFromFiles(rx_scramb_in, in_buf_sz, "testScrambleOutput");
	
	for (i = 0; i < lte_phy_params->descramb_in_buf_sz; i++)
	{
		if (lte_phy_params->descramb_in[i] == 0)
			rx_scramb_in[i] = -1.0;
		else
			rx_scramb_in[i] = 1.0;
	 }
	GenScrambInt(lte_phy_params->scramb_seq_int, lte_phy_params->scramb_in_buf_sz);
	Descrambling(lte_phy_params, rx_scramb_in, rx_scramb_out);
	double energy,ttime,tbegin;
	micpower_start();
	tbegin = dtime();
	//	Descrambling(lte_phy_params, lte_phy_params->descramb_in, lte_phy_params->descramb_out);
	for(i = 0;i < 100000; i++)
		Descrambling(lte_phy_params, rx_scramb_in, rx_scramb_out);
	ttime = dtime() - tbegin;
	energy = micpower_finalize();
//	printf("Energy used in %lf\n", energy);
//	printf("whole time is %fms\n", ttime);
	printf("%lf\t%f\t%f\n", energy, ttime, (energy * 1000.0) / ttime);

	for (i = 0; i < lte_phy_params->descramb_out_buf_sz; i++)
	{
		if (rx_scramb_out[i] > 0)
			lte_phy_params->descramb_out[i] = 1.0;
		else
			lte_phy_params->descramb_out[i] = 0.0;
	}
	
	WriteOutputToFiles(lte_phy_params->descramb_out, lte_phy_params->descramb_out_buf_sz, "/root/Scrambling/testsuite/testDescrambleOutput");
//	WriteOutputToFiles(lte_phy_params->descramb_out, lte_phy_params->descramb_out_buf_sz, "../testsuite/testDescrambleOutput");
	
	cout << "Rx descrambling ends" << endl;
}
Exemple #7
0
int main()
{
cout<<"Rx RateMatcher"<<endl;
BSPara BS;
BS.initBSPara();
UserPara User(&BS);
RxRateMatch RxRM(&BS);
//FIFO<float> RxRMIn(1,RxRM.InBufSz);
FIFO<float> RxRMOut(1,RxRM.OutBufSz);
ReadInputFromFiles(RxRM.pInpBuf,(RxRM.InBufSz),"RxRateMatchInput");
//GeneRandomInput(RxRM.pInpBuf,RxRM.InBufSz,"RxRateMatchRandomInput");
//GeneRandomInput(RxRM.pInpBuf,RxRM.InBufSz);
RxRM.RxRateMatching(&RxRMOut);
WriteOutputToFiles(&RxRMOut,(RxRM.OutBufSz),"testRxRateMatchOutput");
//ReadOutput(&RxRMOut,(RxRM.OutBufSz));
return 0;
}
Exemple #8
0
int main()
{
cout<<"Tx RateMatcher"<<endl;
BSPara BS;
BS.initBSPara();
UserPara User(&BS);
TxRateMatch TxRM(&User);
//FIFO<int> TxRMIn(1,TxRM.InBufSz);
FIFO<int> TxRMOut(1,TxRM.OutBufSz);
ReadInputFromFiles(TxRM.pInpBuf,(TxRM.InBufSz),"TxRateMatchInput");
//GeneRandomInput(TxRM.pInpBuf,TxRM.InBufSz,"TxRateMatchRandomInput");
//GeneRandomInput(TxRM.pInpBuf,TxRM.InBufSz);
TxRM.TxRateMatching(&TxRMOut);
WriteOutputToFiles(&TxRMOut,(TxRM.OutBufSz),"testTxRateMatchOutput");
//ReadOutput(&TxRMOut,(TxRM.OutBufSz));
return 0;
}
int main()
{
cout<<"Descrambler"<<endl;
BSPara BS;
BS.initBSPara();
UserPara User(&BS);
Descramble DSCRB(&BS);
//FIFO<float> DSCRBIn(1,DSCRB.InBufSz);
FIFO<float> DSCRBOut(1,DSCRB.OutBufSz);
ReadInputFromFiles(DSCRB.pInpBuf,DSCRB.InBufSz,"DescrambleInput");
//GeneRandomInput(DSCRB.pInpBuf,DSCRB.InBufSz,"DescrambleRandomInput");
//GeneRandomInput(DSCRB.pInpBuf,DSCRB.InBufSz);
DSCRB.Descrambling(&DSCRBOut);
WriteOutputToFiles(&DSCRBOut,(DSCRB.OutBufSz),"testDescrambleOutput");
//WriteOutputToFiles(&DSCRBOut,(DSCRB.OutBufSz),"DescrambleRandomOutput");
//ReadOutput(&DSCRBOut,(DSCRB.OutBufSz));
return 0;
}
int main()
{
cout<<"Scrambler"<<endl;
BSPara BS;
BS.initBSPara();
UserPara User(&BS);
Scramble SCRB(&User);
//FIFO<int> SCRBIn(1,SCRB.InBufSz);
FIFO<int> SCRBOut(1,SCRB.OutBufSz);
ReadInputFromFiles(SCRB.pInpBuf,(SCRB.InBufSz),"ScrambleInput");
//GeneRandomInput(SCRB.pInpBuf,SCRB.InBufSz,"ScrambleRandomInput");
//GeneRandomInput(SCRB.pInpBuf,SCRB.InBufSz);
SCRB.Scrambling(&SCRBOut);
WriteOutputToFiles(&SCRBOut,(SCRB.OutBufSz),"testScrambleOutput");
//WriteOutputToFiles(&SCRBOut,(SCRB.OutBufSz),"ScrambleRandomOutput");
//ReadOutput(&SCRBOut,(SCRB.OutBufSz));
return 0;
}
Exemple #11
0
void test_turbo_encoding(LTE_PHY_PARAMS *lte_phy_params)
{
	std::cout << "Turbo Encoder starts" << std::endl;
	
//	ReadInputFromFiles(lte_phy_params->te_in, lte_phy_params->te_in_buf_sz, "../TurboEncoderInput");
	GeneRandomInput(lte_phy_params->te_in, lte_phy_params->te_in_buf_sz, "../testsuite/TurboEncoderInput");

	/*
	for (int i = 0; i < lte_phy_params->te_in_buf_sz; i++)
		lte_phy_params->te_in[i] = 1;
	*/

	turbo_encoding(lte_phy_params, lte_phy_params->te_in, lte_phy_params->te_out);

	WriteOutputToFiles(lte_phy_params->te_out, lte_phy_params->te_out_buf_sz, "../testsuite/testTurboEncoderOutput");

	std::cout << "Turbo Encoder ends" << std::endl;
}
void test_descrambling(LTE_PHY_PARAMS *lte_phy_params)
{
	std::cout << "Rx descrambling starts" << std::endl;

	float *rx_scramb_in = (float *)malloc(lte_phy_params->descramb_in_buf_sz * sizeof(float));
	float *rx_scramb_out = (float *)malloc(lte_phy_params->descramb_out_buf_sz * sizeof(float));
	int i;

//	ReadInputFromFiles(lte_phy_params->descramb_in, lte_phy_params->descramb_in_buf_sz, "testScrambleOutput");
	GeneRandomInput(lte_phy_params->descramb_in, lte_phy_params->descramb_in_buf_sz, "ScrambleOutput");
//	ReadInputFromFiles(rx_scramb_in, in_buf_sz, "testScrambleOutput");
	
	for (i = 0; i < lte_phy_params->descramb_in_buf_sz; i++)
	{
		if (lte_phy_params->descramb_in[i] == 0)
			rx_scramb_in[i] = -1.0;
		else
			rx_scramb_in[i] = 1.0;
	 }

	
//	Descrambling(lte_phy_params, lte_phy_params->descramb_in, lte_phy_params->descramb_out);
	Descrambling(rx_scramb_in, rx_scramb_out, lte_phy_params->descramb_in_buf_sz);
	
	for (i = 0; i < lte_phy_params->descramb_out_buf_sz; i++)
	{
		if (rx_scramb_out[i] > 0)
			lte_phy_params->descramb_out[i] = 1.0;
		else
			lte_phy_params->descramb_out[i] = 0.0;
	}

	free(rx_scramb_in);
	free(rx_scramb_out);

	WriteOutputToFiles(lte_phy_params->descramb_out, lte_phy_params->descramb_out_buf_sz, "testDescrambleOutput");
	
	cout << "Rx descrambling ends" << endl;

}
Exemple #13
0
void test_descrambling(LTE_PHY_PARAMS *lte_phy_params)
{
	
	std::cout << "Rx descrambling starts" << std::endl;

	float *rx_scramb_in = (float *)malloc(lte_phy_params->descramb_in_buf_sz * sizeof(float));
	float *rx_scramb_out = (float *)malloc(lte_phy_params->descramb_out_buf_sz * sizeof(float));
	int i;

	ReadInputFromFiles(lte_phy_params->descramb_in, lte_phy_params->descramb_in_buf_sz, "../testsuite/testScrambleOutput");
//	ReadInputFromFiles(rx_scramb_in, in_buf_sz, "testScrambleOutput");

	GenScrambInt(lte_phy_params->scramb_seq_int, lte_phy_params->descramb_in_buf_sz);
	
	for (i = 0; i < lte_phy_params->descramb_in_buf_sz; i++)
	{
		if (lte_phy_params->descramb_in[i] == 0)
			rx_scramb_in[i] = -1.0;
		else
			rx_scramb_in[i] = 1.0;
	}

	int n_iters = 1;
	for (i = 0; i < n_iters; i++) {
		Descrambling(lte_phy_params, rx_scramb_in, rx_scramb_out);
	}
	
	for (i = 0; i < lte_phy_params->descramb_out_buf_sz; i++)
	{
		if (rx_scramb_out[i] > 0)
			lte_phy_params->descramb_out[i] = 1.0;
		else
			lte_phy_params->descramb_out[i] = 0.0;
	}

	WriteOutputToFiles(lte_phy_params->descramb_out, lte_phy_params->descramb_out_buf_sz, "../testsuite/testDescrambleOutput");
	
	cout << "Rx descrambling ends" << endl;
}
Exemple #14
0
void tx_rate_matching(LTE_PHY_PARAMS *lte_phy_params)
{
	std::cout << "Tx RateMatching starts" << std::endl;

	//ReadInputFromFiles(lte_phy_params->rm_in, lte_phy_params->rm_in_buf_sz, "../testsuite/RandomTxRateMatchInput");
	GeneRandomInput(lte_phy_params->rm_in, lte_phy_params->rm_in_buf_sz, "/root/RateMatching/testsuite/RandomTxRateMatchInput");
	TxRateMatching(lte_phy_params, lte_phy_params->rm_in, lte_phy_params->rm_out);
	double energy,ttime,tbegin;
	micpower_start();
	tbegin = dtime();
	for(int i=0;i<10000;i++)
		TxRateMatching(lte_phy_params, lte_phy_params->rm_in, lte_phy_params->rm_out);
	ttime = dtime() - tbegin;
	energy = micpower_finalize();
//	printf("Energy used in %lf\n", energy);
//	printf("whole time is %fms\n", ttime);
	printf("%lf\t%f\t%f\n", energy, ttime, (energy * 1000.0) / ttime);
	
	WriteOutputToFiles(lte_phy_params->rm_out, lte_phy_params->rm_out_buf_sz, "/root/RateMatching/testsuite/testTxRateMatchOutput");

	std::cout << "Tx RateMatching ends" << std::endl;
}
Exemple #15
0
void test_turbo_decoding(LTE_PHY_PARAMS *lte_phy_params, int n_log_decoder_iters)
{
	std::cout << "Turbo Decoder starts" << std::endl;
	
	ReadInputFromFiles(lte_phy_params->td_in, lte_phy_params->td_in_buf_sz, "../testsuite/testTurboEncoderOutput");
	
	for (int i = 0; i < lte_phy_params->td_in_buf_sz; i++)
	{
		lte_phy_params->td_in[i] = (1 - 2 * lte_phy_params->td_in[i]);
	}

	double tstart, tend, ttime;
	double n_gflops, gflops;

	tstart = dtime();

	int n_test_iters = 1;
	for (int i = 0; i < n_test_iters; i++)
	{
	turbo_decoding(lte_phy_params, lte_phy_params->td_in, lte_phy_params->td_out, n_log_decoder_iters);
	}

	tend = dtime();
	ttime = tend - tstart;
	n_gflops = n_test_iters * gflop_counter(lte_phy_params);
	gflops = (n_gflops * 10e3) / ttime;
//	printf("%fms\n", ttime);
//	printf("Number of gflops = %lf\n", n_gflops);
//	printf("GFlops = %f\n", gflops);

	for (int i = 0; i < lte_phy_params->td_out_buf_sz; i++)
	{
		lte_phy_params->td_out[i] = (1 - lte_phy_params->td_out[i]) / 2;
	}
	
	WriteOutputToFiles(lte_phy_params->td_out, lte_phy_params->td_out_buf_sz, "../testsuite/testTurboDecoderOutput");
	
	std::cout << "Turbo Decoder ends" << std::endl;
}