16 QAM

Y

yvonnewong

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;
 
W

Wong

Hi Yvonne,

Is your sensitivity list complete ?


(e-mail address removed) (yvonnewong) wrote in message >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;
 
M

Marcus Schaemann

yvonnewong said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top