OpenCores
URL https://opencores.org/ocsvn/processor/processor/trunk

Subversion Repositories processor

[/] [processor/] [web_uploads/] [Cpp2.cpp] - Rev 6

Compare with Previous | Blame | View Log

#include<iostream.h>
 
void main()
{
double bpsk_0[8]= {  0,   0.7071,   1.0000,   0.7071,   0.0000,  -0.7071,  -1.0000,  -0.7071};
double bpsk_1[8]= {0,   -0.7071,   -1.0000,   -0.7071,   -0.0000,    0.7071,    1.0000,    0.7071};
int x[8]={0,0,0,1,1,0,1,1};
int i[4]={1,0,-1,0};
int q[4]={0,1,0,-1};
double temp[8]={0,0,0,0,0,0,0,0};
double temp1[8]={0,0,0,0,0,0,0,0};
double temp3[8]={0,0,0,0,0,0,0,0};
double temp4[8]={0,0,0,0,0,0,0,0};
double sum[8]={0,0,0,0,0,0,0,0};
for (int m=0;m<=7;m++)
{
	if(x[m]==0 && x[m+1]==0)
{
		for(int k=0;k<=7;k++)
		{
		temp[k]=i[0]*bpsk_0[k];
		temp1[k]=q[0]*bpsk_1[k];
		sum[k]=temp[k]+temp1[k];
		cout<<sum[k]<<' ';
		cout<<"\n";
		}
}
	else if (x[m]==0 && x[m+1]==1)
{
		for(int j=0;j<=7;j++)
		{
		temp3[j]=i[1]*bpsk_0[j];
		temp4[j]=q[1]*bpsk_1[j];
		sum[j]=temp3[j]+temp4[j];
		cout<<sum[j]<<' ';
		cout<<"\n";
		}
}
		else if (x[m]==1 && x[m+1]==0)
{
		for(int j=0;j<=7;j++)
		{
		temp3[j]=i[2]*bpsk_0[j];
		temp4[j]=q[2]*bpsk_1[j];
		sum[j]=temp3[j]+temp4[j];
		cout<<sum[j]<<' ';
		cout<<"\n";
		}
}
			else if (x[m]==1 && x[m+1]==1)
{
		for(int j=0;j<=7;j++)
		{
		temp3[j]=i[3]*bpsk_0[j];
		temp4[j]=q[3]*bpsk_1[j];
		sum[j]=temp3[j]+temp4[j];
		cout<<sum[j]<<' ';
		cout<<"\n";
		}
}
m=m+1;
}
}

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.