16 QAM

Y

yvonnewong

Guest
I am trying to writing a 16 QAM. However, i cannot fix the mapper to
the 4 digit code. It can be compiled but the i and q branches doesn't
have any output. Anyone could help? thx

entity QAM is
port
(
clock : in bit;
flag1 : in bit;
flag2 : in bit;
flag3 : in bit;
flag4 : in bit;
input : in bit;
i : out bit_vector(1 downto 0);
q : out bit_vector(1 downto 0)
);
end QAM;

architecture trial of QAM is
begin
process (input)
variable c1,c2,c3,c4:integer;
begin
if ((flag1= '1') and (input= '1')) then
c1:=1;
elsif ((flag1= '1') and (input= '0')) then
c1:=0;
elsif ((flag2= '1') and (input= '1')) then
c2:=1;
elsif ((flag2= '1') and (input= '0')) then
c2:=0;
elsif ((flag3= '1') and (input= '1')) then
c3:=1;
elsif ((flag3= '1') and (input= '0')) then
c3:=0;
elsif ((flag4= '1') and (input= '1')) then
c4:=1;
if ((c1=1) and (c2=0) and (c3=1) and (c4=1)) then
i<="00"; q<="11";
elsif ((c1=1) and (c2=0) and (c3=1) and (c4=0)) then
i<="00"; q<="10";
elsif ((c1=1) and (c2=1) and (c3=1) and (c4=0)) then
i<="00"; q<="01";
elsif ((c1=1) and (c2=1) and (c3=1) and (c4=1)) then
i<="00"; q<="00";
elsif ((c1=1) and (c2=0) and (c3=0) and (c4=1)) then
i<="01"; q<="11";
elsif ((c1=1) and (c2=0) and (c3=0) and (c4=0)) then
i<="01"; q<="10";
elsif ((c1=1) and (c2=1) and (c3=0) and (c4=0)) then
i<="01"; q<="01";
elsif ((c1=1) and (c2=1) and (c3=0) and (c4=1)) then
i<="01"; q<="00";
elsif ((c1=0) and (c2=0) and (c3=0) and (c4=1)) then
i<="10"; q<="11";
elsif ((c1=0) and (c2=0) and (c3=0) and (c4=0)) then
i<="10"; q<="10";
elsif ((c1=0) and (c2=1) and (c3=0) and (c4=0)) then
i<="10"; q<="01";
elsif ((c1=0) and (c2=1) and (c3=0) and (c4=1)) then
i<="10"; q<="00";
elsif ((c1=0) and (c2=0) and (c3=1) and (c4=1)) then
i<="11"; q<="11";
elsif ((c1=0) and (c2=0) and (c3=1) and (c4=0)) then
i<="11"; q<="10";
elsif ((c1=0) and (c2=1) and (c3=1) and (c4=0)) then
i<="11"; q<="01";
elsif ((c1=0) and (c2=1) and (c3=1) and (c4=1)) then
i<="11"; q<="00";
end if;

elsif ((flag4= '1') and (input= '0')) then
c4:=0;
if ((c1=1) and (c2=0) and (c3=1) and (c4=1)) then
i<="00"; q<="11";
elsif ((c1=1) and (c2=0) and (c3=1) and (c4=0)) then
i<="00"; q<="10";
elsif ((c1=1) and (c2=1) and (c3=1) and (c4=0)) then
i<="00"; q<="01";
elsif ((c1=1) and (c2=1) and (c3=1) and (c4=1)) then
i<="00"; q<="00";
elsif ((c1=1) and (c2=0) and (c3=0) and (c4=1)) then
i<="01"; q<="11";
elsif ((c1=1) and (c2=0) and (c3=0) and (c4=0)) then
i<="01"; q<="10";
elsif ((c1=1) and (c2=1) and (c3=0) and (c4=0)) then
i<="01"; q<="01";
elsif ((c1=1) and (c2=1) and (c3=0) and (c4=1)) then
i<="01"; q<="00";
elsif ((c1=0) and (c2=0) and (c3=0) and (c4=1)) then
i<="10"; q<="11";
elsif ((c1=0) and (c2=0) and (c3=0) and (c4=0)) then
i<="10"; q<="10";
elsif ((c1=0) and (c2=1) and (c3=0) and (c4=0)) then
i<="10"; q<="01";
elsif ((c1=0) and (c2=1) and (c3=0) and (c4=1)) then
i<="10"; q<="00";
elsif ((c1=0) and (c2=0) and (c3=1) and (c4=1)) then
i<="11"; q<="11";
elsif ((c1=0) and (c2=0) and (c3=1) and (c4=0)) then
i<="11"; q<="10";
elsif ((c1=0) and (c2=1) and (c3=1) and (c4=0)) then
i<="11"; q<="01";
elsif ((c1=0) and (c2=1) and (c3=1) and (c4=1)) then
i<="11"; q<="00";
end if;
end if;
end process;
end trial;
 
Hi Yvonne,

Is your sensitivity list complete ?



htwong37@yahoo.com.hk (yvonnewong) wrote in message >news:<3219731d.0402050746.6fd5650b@posting.google.com>...
I am trying to writing a 16 QAM. However, i cannot fix the mapper to
the 4 digit code. It can be compiled but the i and q branches doesn't
have any output. Anyone could help? thx

entity QAM is
port
(
clock : in bit;
flag1 : in bit;
flag2 : in bit;
flag3 : in bit;
flag4 : in bit;
input : in bit;
i : out bit_vector(1 downto 0);
q : out bit_vector(1 downto 0)
);
end QAM;

architecture trial of QAM is
begin
process (input)
variable c1,c2,c3,c4:integer;
begin
if ((flag1= '1') and (input= '1')) then
c1:=1;
elsif ((flag1= '1') and (input= '0')) then
c1:=0;
elsif ((flag2= '1') and (input= '1')) then
c2:=1;
elsif ((flag2= '1') and (input= '0')) then
c2:=0;
elsif ((flag3= '1') and (input= '1')) then
c3:=1;
elsif ((flag3= '1') and (input= '0')) then
c3:=0;
elsif ((flag4= '1') and (input= '1')) then
c4:=1;
if ((c1=1) and (c2=0) and (c3=1) and (c4=1)) then
i<="00"; q<="11";
elsif ((c1=1) and (c2=0) and (c3=1) and (c4=0)) then
i<="00"; q<="10";
elsif ((c1=1) and (c2=1) and (c3=1) and (c4=0)) then
i<="00"; q<="01";
elsif ((c1=1) and (c2=1) and (c3=1) and (c4=1)) then
i<="00"; q<="00";
elsif ((c1=1) and (c2=0) and (c3=0) and (c4=1)) then
i<="01"; q<="11";
elsif ((c1=1) and (c2=0) and (c3=0) and (c4=0)) then
i<="01"; q<="10";
elsif ((c1=1) and (c2=1) and (c3=0) and (c4=0)) then
i<="01"; q<="01";
elsif ((c1=1) and (c2=1) and (c3=0) and (c4=1)) then
i<="01"; q<="00";
elsif ((c1=0) and (c2=0) and (c3=0) and (c4=1)) then
i<="10"; q<="11";
elsif ((c1=0) and (c2=0) and (c3=0) and (c4=0)) then
i<="10"; q<="10";
elsif ((c1=0) and (c2=1) and (c3=0) and (c4=0)) then
i<="10"; q<="01";
elsif ((c1=0) and (c2=1) and (c3=0) and (c4=1)) then
i<="10"; q<="00";
elsif ((c1=0) and (c2=0) and (c3=1) and (c4=1)) then
i<="11"; q<="11";
elsif ((c1=0) and (c2=0) and (c3=1) and (c4=0)) then
i<="11"; q<="10";
elsif ((c1=0) and (c2=1) and (c3=1) and (c4=0)) then
i<="11"; q<="01";
elsif ((c1=0) and (c2=1) and (c3=1) and (c4=1)) then
i<="11"; q<="00";
end if;

elsif ((flag4= '1') and (input= '0')) then
c4:=0;
if ((c1=1) and (c2=0) and (c3=1) and (c4=1)) then
i<="00"; q<="11";
elsif ((c1=1) and (c2=0) and (c3=1) and (c4=0)) then
i<="00"; q<="10";
elsif ((c1=1) and (c2=1) and (c3=1) and (c4=0)) then
i<="00"; q<="01";
elsif ((c1=1) and (c2=1) and (c3=1) and (c4=1)) then
i<="00"; q<="00";
elsif ((c1=1) and (c2=0) and (c3=0) and (c4=1)) then
i<="01"; q<="11";
elsif ((c1=1) and (c2=0) and (c3=0) and (c4=0)) then
i<="01"; q<="10";
elsif ((c1=1) and (c2=1) and (c3=0) and (c4=0)) then
i<="01"; q<="01";
elsif ((c1=1) and (c2=1) and (c3=0) and (c4=1)) then
i<="01"; q<="00";
elsif ((c1=0) and (c2=0) and (c3=0) and (c4=1)) then
i<="10"; q<="11";
elsif ((c1=0) and (c2=0) and (c3=0) and (c4=0)) then
i<="10"; q<="10";
elsif ((c1=0) and (c2=1) and (c3=0) and (c4=0)) then
i<="10"; q<="01";
elsif ((c1=0) and (c2=1) and (c3=0) and (c4=1)) then
i<="10"; q<="00";
elsif ((c1=0) and (c2=0) and (c3=1) and (c4=1)) then
i<="11"; q<="11";
elsif ((c1=0) and (c2=0) and (c3=1) and (c4=0)) then
i<="11"; q<="10";
elsif ((c1=0) and (c2=1) and (c3=1) and (c4=0)) then
i<="11"; q<="01";
elsif ((c1=0) and (c2=1) and (c3=1) and (c4=1)) then
i<="11"; q<="00";
end if;
end if;
end process;
end trial;
 
yvonnewong wrote:
I am trying to writing a 16 QAM. However, i cannot fix the mapper to
the 4 digit code. It can be compiled but the i and q branches doesn't
have any output. Anyone could help? thx
Hi Yvonne,

your curcuit has a clock input, but you dont use it.
So your code will compile to a netlist with only logic and latches
triggered by the flags.
If you want to create clocked flipflops, then inculde a flipflop
template like

process (clock,input)
variable c1,c2,c3,c4: bit;
begin
if clock'event and clock='1' then

(put your code here)

end if;

Also try to partition and simplify your code, for example, first write
the statements to read the input into the variables (which are of type
bit here):

if (flag1= '1') then
c1:= input;
elsif (flag2= '1') then
c2:=input;
elsif (flag3= '1') then
c3:=input;
elsif (flag4= '1') then
c4:=input;
end if;

And then the statements to convert the four bits to the i and q symbol.
For example in your code some of the lines

c4:=0;
if ((c1=1) and (c2=0) and (c3=1) and (c4=1)) then
i<="00"; q<="11";
elsif ((c1=1) and (c2=0) and (c3=1) and (c4=0)) then
i<="00"; q<="10";
elsif ((c1=1) and (c2=1) and (c3=1) and (c4=0)) then
i<="00"; q<="01";
elsif ((c1=1) and (c2=1) and (c3=1) and (c4=1)) then
i<="00"; q<="00";

dont make much sense, since you set c4 to the integer value 0 and try
then if its 1 (c4=1).

This way you can see in simulation which part of your description works
and which not.

I hope this was able to help you a little,

Regards,

Marcus
 

Welcome to EDABoard.com

Sponsor

Back
Top