基于FPGA的QPSK系统设计

更新时间:2024-06-25 07:22:01 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

QPSK

基于FPGA的QPSK系统设计

一、 实验目的

1、 利用FPGA实现QPSK调制解调电路设计与实现,加深对QPSK

的理性认识,通过实践提高动手能力以及理论联系实际的能力 2、 通过对电路模块的组合使用构成通信系统,加深对通信系统的

认识和理解,进一步体会《通信原理》课程中的理论知识 3、 通过本次试验进一步掌握对Quartus II软件以及VHDL编程语言

的使用

4、 通过本次课程设计的实践提高我们的实践操作能力、提高分析

问题和解决问题的能力

二、 设计任务及要求

利用FPGA实现QPSK调制解调电路设计与实现,用FPGA进行数据处理。实验中给定FPGA模块,D/A转换、A/D转换以及乘法器模块

三、 实验原理

1、FPGA简介

目前以硬件描述语言(Verilog 或 VHDL)所完成的电路设计,可以经过简单的综合与布局,快速的烧录至 FPGA 上进行测试,是现代 IC 设计验证的技术主流。这些可编辑元件可以被用来实现一些基本的逻辑门电路(比如AND、OR、XOR、NOT)或者更复杂一些的组合功能比如解码器或数学方程式。在大多数的FPGA里面,这些可编辑的元件里也包含记忆元件例如触发器(Flip-flop)或者其他更加完

1

QPSK

整的记忆块。

系统设计师可以根据需要通过可编辑的连接把FPGA内部的逻辑块连接起来,就好像一个电路试验板被放在了一个芯片里。一个出厂后的成品FPGA的逻辑块和连接可以按照设计者而改变,所以FPGA可以完成所需要的逻辑功能。

FPGA一般来说比ASIC(专用集成芯片)的速度要慢,无法完成复杂的设计,而且消耗更多的电能。但是他们也有很多的优点比如可以快速成品,可以被修改来改正程序中的错误和更便宜的造价。厂商也可能会提供便宜的但是编辑能力差的FPGA。因为这些芯片有比较差的可编辑能力,所以这些设计的开发是在普通的FPGA上完成的,然后将设计转移到一个类似于ASIC的芯片上。另外一种方法是用CPLD(复杂可编程逻辑器件备)。 本实验中使用的FPGA器件: 核心芯片:EP1C3T144 (ALTERA) 逻辑单元(LE):2910 个

该模块带有一个20MHz 的有源晶体,10MHz 时钟信号由FPGA 的第16 脚输入。FPGA 的可用引脚都被引出,位于模块的边缘,采用2.54mm 间距的接插件。该模块为FPGA 芯片提供了两种编程方式:JTAG 和Active Serial。JTAG 方式使用FPGA 芯片下方的JTAG1 编程接口,适合前期设计调试,逻辑写入FPGA 后可运行,但断电后逻辑不会被保存。Active Serial 方式采用FPGA 芯片上方的AS_CABLE1 编程接口,该方式编程速度较慢,适合系统联调,该方式写入的逻辑会

2

QPSK

被保存在EPCS1 配置芯片中,即使断电,逻辑也不会丢失。

虽然该模块的晶体频率固定为 10MHz,但可通过使用FPGA 内部的锁相环对时钟进行分频或倍频,产生实验需要的时钟频率。 2、乘法器模块 核心芯片:MC1496

该模块中含有两个电路配置相同的乘法器和一个由运算放大器构成的加法器。功能框图如下图所示。

该模块可完成两路中频信号与两路载波信号分别乘,之后相加混合成一路信号的功能。最后一级的加法器除完成加法外,还有两倍的放大作用。

3、D/A转换模块 核心芯片:MC1496

该模块可完成双通道的DA 转换,采用AD7528 作为核心芯片。AD7528 是一款双通道8 位DAC,两个通道共用一组8 位数据总线。该芯片的模拟电压建立时间为400ns。该模块 的功能框图如下图所示。

3

QPSK

4、 A/D 转换模块 核心芯片:TLC5510

模拟信号输入电压峰峰值:3V。

该模块采用 TLC5510 作为核心芯片,可完成双通道的AD 转换,转换采样率最大可达20MSps。在TLC5510 的输入端带有一级缓冲器,详细电路见附图。信号输入过程中,有隔直电容(C1,C5),只有信号的交流成分可被耦合进入缓冲器。缓冲器的直流偏置电压由电位器R29 和R30 确定。使用时,应调整输入信号幅值和缓冲器的直流偏置,使缓冲器的输出信号位于1.2V~4.4V 之间,超出部分不能被正确量化。

4

QPSK

5、 QPSK

QPSK信号有00、01、10、11四种状态。所以,对输入的二进制序列,首先必须分组,每两位码元一组。然后根据组合情况,用载波的四种相位表征它们。QPSK信号实际上是两路正交双边带信号。QPSK信号是两个正交的2PSK信号的合成,所以可仿照2PSK信号的相平解调法,用两个正交的相干载波分别检测A和B两个分量,然后还原成串行二进制数字信号,即可完成QPSK信号的解调。 QPSK的调制方法有两种:相乘电路法和相位选择法

电平 产生 Acos2πfct 二进制信息 载波发生器 串并 转换 90°移向 -Acos2πfct 已调 信号 电平 产生

图1 相乘电路法

5

QPSK

QPSK的解调方法为相干解调法

抽样 判决 载波 恢复 位定时 恢复 并串 变换 90°移向 抽样 判决

相干解调原理框图

四、 设计思路

实验中采用选相法进行调制,将一个周期正弦波的128个采样向量按照一定的频率和顺序由FPGA器件输出,输入到D/A转换模块当中,由D/A转换模块输出正弦波。首先将被调制信号进行串并转换,每两位输入二进制信号为一组,由此组二进制信号的组成选择相位,选择原则如下表所示,这样连续输出的信号就构成了调制信号,调制频率由每组信号所对应的正弦

6

QPSK

波形数目以及 串并转换后信号 00 01 10 11 相位/度 0 90 180 270 采样向量 \\\\FPGA的时钟频率所确定。解调所需的载波信号由同样的方法产生。解调时调制信号与载波信号在乘法器模块中进行相乘(首先要进行电平转换,即使调制信号与载波信号的电平符合乘法器模块的输入要求),将乘法器的输出信号通过集成运放放大后再通过有源低通滤波器进行滤波,滤波信号通过A/D转换模块进行采样,采样信号通过FPGA进行判决,在经过并串转换后即可输出得到解调输出信号。

五、 实验程序及其说明

Libraryieee;

use ieee.std_logic_1164.all; useieee.std_logic_unsigned.all; entity modulation is port(clk: in

std_logic;

std_logic; std_logic;

std_logic;

std_logic_vector(7 downto 0); std_logic; std_logic; std_logic;

----采样信号 ----信号da控----载波da控----采样ad控

mout: out y: out x: in x1,x2: in cs,ab,wr:out 制

cs1,ab1,wr1:out 制

oe,adclk:out 制

dsin,dsin1:out

std_logic_vector(7 downto 0)

7

QPSK

);

end modulation;

architecture a of modulation is constantdivide_period: integer:=30; constant divide_period1: integer:=15; signal cnt,cnt1,cnt2: signal sinclk,sinclk1: signal flag,flag1,flag2: signala,b,c,d:

std_logic_vector(6 downto 0);

std_logic; std_logic; std_logic;

signalpcnt:integer range 0 to 127; signal pcnt1:integer range 0 to 127; signal pcnt2:integer range 0 to 127; signal pcnt3:integer range 0 to 255;

signal pcnt4:integer range 0 to 255; signal c0,c1,c2,c3,c4,c5,c6,c7:std_logic; constant divide_period2: integer:=64; signal load: signalxclk: signal cnt3:

std_logic; std_logic;

integer range 0 to 1;

begin

----------------产生m序列驱动信号----------------- process(clk) variablecnt:integer range 0 to 63; begin ifclk'event and clk='1' then

if(cnt<(divide_period2/2)) then xclk<='1'; cnt:=cnt+1;

elsif(cnt<(divide_period2-1)) then xclk<='0'; cnt:=cnt+1; elsecnt:=0;

end if; end if;

end process;

-------------------产生m序列--------------------- process(xclk)

begin

ifxclk'event and xclk='1'then if cnt3<1 then cnt3<=cnt3+1; load<='1'; else if(load='1')then

8

QPSK

c7<='0';c6<='0';c5<='0';

c4<='0';c3<='0';c2<='0'; c1<='0';c0<='1';mout<=c7; else c1<=c0;c2<=c1;c3<=c2;c4<=c3;

c5<=c4;c6<=c5;c7<=c6;mout<=c7; c0<=c7 xor c4 xor c3 xor c2;

end if; end if;

if cnt3=1 then

load<='0'; end if; end if;

end process;

----------------ad以及da的控制信号设置-------------- cs1<='0'; cs<='0'; oe<='0';

ab<='0';

-----分频得到正弦驱动以及信号da、采样ad驱动时钟---------

process(clk) variablecnt:integer range 0 to 29; begin ifclk'event and clk='1' then

if(cnt<(divide_period/2)) then wr<='1';

sinclk<='1'; adclk<='1'; cnt:=cnt+1;

elsif(cnt<(divide_period-1)) then sinclk<='0';

adclk<='0'; wr<='0';

cnt:=cnt+1; elsecnt:=0; end if;

end if;

end process;

-----------------分频得到载波正弦以及载波da驱动时钟----------------

process(clk)

variablecnt:integer range 0 to 14; begin ifclk'event and clk='1' then

9

QPSK

if(cnt<(divide_period1/2)) then wr1<='1'; sinclk1<='1'; cnt:=cnt+1;

elsif(cnt<(divide_period1-1)) then

sinclk1<='0'; wr1<='0';

cnt:=cnt+1; elsecnt:=0; end if;

end if; end process;

-----------------x信号的串并转换----------------- process(sinclk) begin

ifsinclk'event and sinclk='1' then ifpcnt=31 then a<=x; pcnt<=pcnt+1; elsifpcnt=95 then flag<='1';

pcnt<=pcnt+1; b<=x; else pcnt<=pcnt+1;

flag<='0'; end if;

end if;

end process;

----------------调制选择相位--------------------- process(sinclk) begin

ifsinclk'event and sinclk='1' then if flag='1' then

if b='0' and a='0' then cnt<=\elsif b='0' and a='1' then cnt<=\elsif b='1' and a='0' then cnt<=\elsif b='1' and a='1' then

cnt<=\ end if; elsecnt<=cnt+1;

10

QPSK

end if;

end if;

end process;

----------------信号正弦向量表-------------- process(cnt) begin

casecnt is

when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \

11

QPSK

when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \

12

QPSK

when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \

13

QPSK

when \

when \ when \ when others=>dsin<=\end case;

end process;

-------------------双路采样判决------------------------- process(sinclk) begin

ifsinclk'event and sinclk='1' then if pcnt1=126 then

if x1<=\

c<='0'; d<='0';

flag1<='1';

pcnt1<=pcnt1+1;

elsif x1>=\ c<='0'; d<='1';

flag1<='1';

pcnt1<=pcnt1+1;

elsif x1>=\ c<='1'; d<='0'; flag1<='1'; pcnt1<=pcnt1+1; else

c<='1'; d<='1'; flag1<='1';

pcnt1<=pcnt1+1; end if;

else

pcnt1<=pcnt1+1; end if; end if; end process;

-----------------判决后信号的并串转换----------------- process(sinclk)

begin

ifsinclk'event and sinclk='1' and flag1='1' then if pcnt2<64 then y<=d; pcnt2<=pcnt2+1;

14

QPSK

else

y<=c; pcnt2<=pcnt2+1; end if; end if;

end process;

-------------------载波信号延时后产生----------------- process(sinclk1) begin

if sinclk1'event and sinclk1='1' then if flag2='1' then

if pcnt3<190 then pcnt3<=pcnt3+1; elsif pcnt3=190 then

cnt1<=\pcnt3<=pcnt3+1;

else

pcnt3<=200; cnt1<=cnt1+1; end if; flag2<='0';

elsif flag2='0' then if pcnt4<190 then pcnt4<=pcnt4+1; elsif pcnt4=190 then

cnt2<=\pcnt4<=pcnt4+1;

else

pcnt4<=200; cnt2<=cnt2+1; end if; flag2<='1';

end if; end if;

end process;

------------------双路载波信号、同片da芯片产生------------------ process(cnt1,cnt2) begin

if flag2='0' then ab1<='0'; case cnt1 is

when \when \when \

15

QPSK

when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \

16

QPSK

when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \

17

QPSK

when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \

when others=>dsin1<=\ end case; end if;

if flag2='1' then

ab1<='1'; case cnt2 is when \

18

QPSK

when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \

19

QPSK

when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \

20

QPSK

when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \when \

when others=>dsin1<=\ end case; end if; end process;

end a;

21

QPSK

六、 实验结果及分析

调制信号

调制信号与解调所用的相干载波

m序列信号

22

QPSK

被调制信号与调制信号

解调相干载波

调制信号

23

QPSK

解调乘法器输出信号

由于系统过于庞杂,寄生干扰、噪声干扰非常严重,所以解调乘法器输出信号不是十分理想,解调方案有待进一步改善。

七、 实验体会

通过本次实验,我对《通信原理》课程中的QPSK调制解调等相关理论知识有了更深的体会和理解;进一步熟悉了Quartus II软件、VHDL编程语言的使用;对一些常用芯片知识以及常用电路有了进一步的掌握。

本次实验中遇到了很多问题,发现许多理论知识与实际应用还是有着很大的区别的,仅仅掌握了理论知识是远远不够的,只有知道怎样在实际应用中如何灵活地运用理论知识才能说自己真正地掌握了理论知识。

实验中得到了赵老师不厌其烦的指导,再次要对赵老师表示衷心的感谢。

八、 实验建议

基本实验中所使用的实验系统固然方便,但是却很难从中

24

QPSK

收获更多的知识(仅仅是个人的一点看法)。系统实验真的非常锻炼学生的能力,建议增加实验的课时,适当侧重系统实验。

25

本文来源:https://www.bwwdw.com/article/5wx3.html

Top