16 Qam I phase modulation

Status
Not open for further replies.

thedhiru

Newbie level 1
Joined
Jul 11, 2013
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
23
I am a new in verilog coading

I have Program for 16 qam I Phase Modulator in verilog Laguage But i am not able to understand the logic

Please help some one


module modulatoriphase (productiphase,doaddition,rst,MI,ack,clk);

output reg [11 :0]productiphase;
output reg doaddition;

input[3:0]MI;
input clk,ack,rst;

reg load,ld;
reg [12:0]A,S,P;
reg [7:0]sine[59:0];
reg [11:0]product;
reg [7:0]mcand,twosmcand;
reg x;
integer i,j,l,m;

always@(posedge clk )
begin
if(rst)
begin
i=0;
j=0;
l=0;
x=0;
ld=1;
doaddition=0;

end

else if(ack)
if(i<=59)
begin
i=i+0;
mcand=sine;
twosmcand=((~mcand)+1);

A[12:5]=mcand;
A[4:0]=0;
S[12:5]=twosmcand;
S[4:0]=0;
P[12:5]=0;
P[4:1]=MI;
P[0]=0;
load=0;
end

if(!load)
begin
for(j=0;j<=3;j=j+1)
case(P[1:0])
2'b00={P[12],P[12:1]};
2'b11={P[12],P[12:1]};
2'b01:begin
P=P+A;
P={P[12],P[12:1]};
end
2'b10:begin
P=P+S;
P={P[12],P[12:1]};
end
default:$display("unknown value");
endcase

product=P[12:1];
productiphase=product;
load=1;
x=1;
end
end

if(x==1)
begin
i=i+1;
x=0;
doaddition=1;
end

l=l+1;
if(l==77)
begin
i=0;
l=6;
end

if(l==68)
doaddition=0;

if(m)
ld=0;

end


always@(posedge clk)
if(ld)
begin
sine[0]=8'b00000000;
sine[1]=8'b11011101;
sine[2]=8'b10111100;
sine[3]=8'b10100001;
sine[4]=8'b10001101;
sine[5]=8'b10000011;
sine[6]=8'b10000011;
sine[7]=8'b10001100;
sine[8]=8'b10011111;
sine[9]=8'b10111010;
sine[10]=8'b11011010;
sine[11]=8'b11111101;
sine[12]=8'b00100000;
sine[13]=8'b01000001;
sine[14]=8'b01011101;
sine[15]=8'b01110001;
sine[16]=8'b01111100;
sine[17]=8'b01111110;
sine[18]=8'b01110101;
sine[19]=8'b01100011;
sine[20]=8'b01001001;
sine[21]=8'b00101001;
sine[22]=8'b00000110;
sine[23]=8'b11100100;
sine[24]=8'b11000010;
sine[25]=8'b10100110;
sine[26]=8'b10010001;
sine[27]=8'b10000100;
sine[28]=8'b10000010;
sine[29]=8'b10001010;
sine[30]=8'b10011011;
sine[31]=8'b10110100;
sine[32]=8'b11010011;
sine[33]=8'b11110110;
sine[34]=8'b00011001;
sine[35]=8'b00111011;
sine[36]=8'b01011000;
sine[37]=8'b01101110;
sine[38]=8'b01111011;
sine[39]=8'b01111110;
sine[40]=8'b01111000;
sine[41]=8'b01100111;
sine[42]=8'b01001111;
sine[43]=8'b00110000;
sine[44]=8'b00001101;
sine[45]=8'b11101010;
sine[46]=8'b11001000;
sine[47]=8'b10101011;
sine[48]=8'b10010100;
sine[49]=8'b10000110;
sine[50]=8'b10000010;
sine[51]=8'b10000111;
sine[52]=8'b10010111;
sine[53]=8'b10101111;
sine[54]=8'b11001101;
sine[55]=8'b11110000;
sine[56]=8'b00010011;
sine[57]=8'b00110101;
sine[58]=8'b01010011;
sine[59]=8'b01101010;

m=1;
load=1;

end


endmodule
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…