名称:基于FPGA的16QAM调制VHDL代码Quartus仿真
软件:Quartus
语言:VHDL
代码功能:
16QAM调制过程可以简化为下图,I路Q路分别乘以cos和sin,再相加即得到调制信号。
包含正余弦产生模块、有符号乘法器模块、有符号加法器模块以及编码映射。
FPGA代码Verilog/VHDL代码资源下载:www.hdlcode.com
演示视频:
设计文档:
1. 整体仿真
16QAM调制过程可以简化为下图,I路Q路分别乘以cos和sin,再相加即得到调制信号。
2. DDS模块仿真,用于产生sin和cos
地址sin_address累加,cos_address累加,依次读取ROM里面所存的sin和cos值。输出波形如上图所示。
3. 相乘模块仿真
Dataa信号和datab信号相乘得到result信号。可以看到result的幅值包络与datab有关。
4. 相加模块仿真
相加模块将dataa得值和datab得值相加,得到result得值。result得值即为16QAM调制波形
部分代码展示:
library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.all; use IEEE.std_logic_arith.all; entity QAM is port( clk:in std_logic;--时钟输入 DataIn:in std_logic_vector(3 downto 0);--DDS数据输出 DataOut:out std_logic_vector(12 downto 0)--DDS数据输出 ); end QAM; architecture behave of QAM is signal sin_data:std_logic_vector(9 downto 0); signal cos_data:std_logic_vector(9 downto 0); signal MULT0_data:std_logic_vector(2 downto 0); signal MULT1_data:std_logic_vector(2 downto 0); signal MULT0_result:std_logic_vector(12 downto 0); signal MULT1_result:std_logic_vector(12 downto 0); component DDS is port( clk:in std_logic;--时钟输入 sin_data:out std_logic_vector(9 downto 0);--DDS数据输出 cos_data:out std_logic_vector(9 downto 0)--DDS数据输出 ); end component; component MULT IS PORT ( dataa: IN STD_LOGIC_VECTOR (9 DOWNTO 0); datab: IN STD_LOGIC_VECTOR (2 DOWNTO 0); result: OUT STD_LOGIC_VECTOR (12 DOWNTO 0) ); END component; component add IS PORT ( dataa: IN STD_LOGIC_VECTOR (12 DOWNTO 0); datab: IN STD_LOGIC_VECTOR (12 DOWNTO 0); result: OUT STD_LOGIC_VECTOR (12 DOWNTO 0) ); END component; begin u0: DDS port map(clk=>clk,sin_data=>sin_data,cos_data=>cos_data); u1: MULT port map(dataa=>sin_data,datab=>MULT0_data,result=>MULT0_result); u2: MULT port map(dataa=>cos_data,datab=>MULT1_data,result=>MULT1_result); u3: add port map(dataa=>MULT0_result,datab=>MULT1_result,result=>DataOut); process(DataIn)begin case DataIn is when "0000" => MULT0_data <= "011"; MULT1_data <= "011"; when "0001" => MULT0_data <= "001"; MULT1_data <= "011"; when "0011" => MULT0_data <= "111"; MULT1_data <= "011"; when "0010" => MULT0_data <= "101"; MULT1_data <= "011"; when "0110" => MULT0_data <= "101"; MULT1_data <= "001"; when "0111" => MULT0_data <= "111"; MULT1_data <= "001"; when "0101" => MULT0_data <= "001"; MULT1_data <= "001"; when "0100" => MULT0_data <= "011"; MULT1_data <= "001"; when "1100" => MULT0_data <= "011"; MULT1_data <= "111"; when "1101" => MULT0_data <= "011"; MULT1_data <= "111"; when "1111" => MULT0_data <= "111"; MULT1_data <= "111"; when "1110" =>
点击链接获取代码文件:http://www.hdlcode.com/index.php?m=home&c=View&a=index&aid=615
465