北航电气实验FPGA实验报告_第1页
北航电气实验FPGA实验报告_第2页
北航电气实验FPGA实验报告_第3页
北航电气实验FPGA实验报告_第4页
北航电气实验FPGA实验报告_第5页
已阅读5页,还剩7页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、北京航空航天大学电气实验报告FPGA实验张天130325班 学号:13031220一 实验目的略二 实验要求略三 实验设备略四 实验内容略五 实验实例1. 实例6-1思考题1:输出信号q3q2q1绑定接口电路的七段数码管或米字型数码管或LED点阵显示?答:思考题2:怎样修改成4位二进制减法计数器,具有清零,启动控制功能等?答:思考题3:把计数器修改成2位或更多位十进制计数功能,再用七段数码管进行显示等?答:2. 实例6-2思考题:一位半加器电路采用VHDL语言实验 答: library ieee;use ieee.std_logic_1164.all;use iee.std_logic_uns

2、igned.all;entity halfadd isport (a,b;in std_logicsum,carry; out std_logic)end entity halfadd;architecture halfadd isbeginsum<=a and(not b)+b and (not a);carry<= a and b;end architecture halfadd;六 实验过程我们组做的是一个利用led点阵规律亮灭变化形成字体,并且字体产生变化,形成“自动化”的样子,实现图片如下图:1. 实验分析:实验设计思路:本实验的设计思路是利用led灯的辉光效应,利用逐行

3、扫描,在高频情况下就会显示所有行的亮灯,进而形成汉字,并且有时钟计数程序,当时钟数字达到规定值(本实验为111111111b)时,跳转到下一个状态,显示第二个憨子。每个汉字的颜色由led灯决定,改led矩阵有红绿两种led灯,因此有红绿橙三种颜色显示。2. 实现过程对设计思路的实现并非一帆风顺,最初编写的时候遇到了一些问题。首先,定义输入输出角是个繁琐的事情(需要定义40+次,每次必须手动),另外,在程序编写过程中,也出现了一些逻辑错误,对于错误,我们仔细逐条语句分析,最终解决了错误,解决过程中也加深了对FPGA的语言逻辑及硬件结构的理解。七 .FPGA使用心得在学习FPGA过程中,我获得了很

4、多收获。首先,由于有单片机的基础,上手过程并不是十分复杂,对于输入输出的理解我没有遇到太多阻碍。这次学习也验证了我具有短时间内掌握一款新型的芯片的能力。学习过程中最大的困难就是VDHL语言的编写。我们以前有c语言的基础,不过学习这种新的语言还是花出了不少时间与精力,现在可以说基本掌握的VDHL的基本写法和思路,能运用到需要的程序中来。另外,调试的过程能极强地加大对程序的理解及逻辑的构建,在调试中,逐渐明白了以前不懂的东西,对FPGA的工作原理的理解更加透彻了。不了解的人可能会把FPGA当做一种单片机,但其实,相比于单片机,FPGA是有很多优势的。其无固定的硬件结构使其具有远超单片机的灵活性,另

5、外,它的编程方法可以同步进行多个process使其能同步处理多个进程,因此,它的运算效率大大提高,在当今社会,有很大的利用价值。八 .电气实验总结略附:程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity led isport(clk:in std_logic; rst:in std_logic; com:out std_logic_vector(7 downto 0); red:out std_logic_vector(7 downto 0); green:out std_logic

6、_vector(7 downto 0);end;architecture led of led isconstant s0:std_logic_vector(1 downto 0):="00" constant s1:std_logic_vector(1 downto 0):="01" constant s2:std_logic_vector(1 downto 0):="10" constant s3:std_logic_vector(1 downto 0):="11" signal present:std_log

7、ic_vector(1 downto 0); signal com1:std_logic_vector(7 downto 0);signal red1:std_logic_vector(7 downto 0);signal green1:std_logic_vector(7 downto 0);signal count:std_logic_vector(9 downto 0);signal zi:std_logic_vector(2 downto 0);beginprocess(rst,clk)beginif(rst='0')then-系统初始化 present<=s0;

8、 com1<=(others=>'0');elsif(clk'event and clk='1')then case present is when s0=>if(com1="00000000")then com1<="11111111" red1<="11111111" green1<="11111111" zi<="000" present<=s0; else if(count="1111111

9、11")then count<=(others=>'0'); present<=s1; else case zi is when "000"=> com1<="00001000" red1<="00000001" green1<="00000000" count<=count+1; zi<=zi+1; when "001" => com1<="00111100" red1<=&q

10、uot;00000010" green1<="00000000" count<=count+1; zi<=zi+1; when "010"=> com1<="00100100" red1<="00000100" green1<="00000000" count<=count+1; zi<=zi+1; when "011"=> com1<="00111100" red1<=&q

11、uot;00001000" green1<="00000000" count<=count+1; zi<=zi+1; when "100"=> com1<="00100100" red1<="00010000" green1<="00000000" count<=count+1; zi<=zi+1; when "101"=> com1<="00111100" red1<=&q

12、uot;00100000" green1<="00000000" count<=count+1; zi<=zi+1; when "110"=> com1<="00100100" red1<="01000000" green1<="00000000" count<=count+1; zi<=zi+1; when "111"=> com1<="00111100" red1<=&q

13、uot;10000000" green1<="00000000" count<=count+1; present<=s0; zi<="000" end case; end if; end if; when s1=>if(count="111111111")then -S1模式:从右到左逐个点亮LED count<=(others=>'0'); present<=s2; else present<=s1; case zi is when "000&

14、quot;=> com1<="00100000" red1<="00000001" green1<="00000001" count<=count+1; zi<=zi+1; when "001" => com1<="00100000" red1<="00000010" green1<="00000010" count<=count+1; zi<=zi+1; when "010

15、"=> com1<="00100110" red1<="00000100" green1<="00000100" count<=count+1; zi<=zi+1; when "011"=> com1<="11110000" red1<="00001000" green1<="00001000" count<=count+1; zi<=zi+1; when "100

16、"=> com1<="10101111" red1<="00010000" green1<="00010000" count<=count+1; zi<=zi+1; when "101"=> com1<="10100100" red1<="00100000" green1<="00100000" count<=count+1; zi<=zi+1; when "110

17、"=> com1<="10101010" red1<="01000000" green1<="01000000" count<=count+1; zi<=zi+1; when "111"=> com1<="10101111" red1<="10000000" green1<="10000000" count<=count+1; present<=s0; zi<=&quo

18、t;000" end case; count<=count+1; present<=s1; end if; when s2=>if(count="111111111")then -S2模式:从两边到中间逐个点亮LED count<=(others=>'0'); present<=s3; else case zi is when "000"=> com1<="00011000" red1<="00000000" green1<=&q

19、uot;00000001" count<=count+1; zi<=zi+1; when "001" => com1<="00010100" red1<="00000000" green1<="00000010" count<=count+1; zi<=zi+1; when "010"=> com1<="01010010" red1<="00000000" green1<=&

20、quot;00000100" count<=count+1; zi<=zi+1; when "011"=> com1<="00110011" red1<="00000000" green1<="00001000" count<=count+1; zi<=zi+1; when "100"=> com1<="00010010" red1<="00000000" green1<=&

21、quot;00010000" count<=count+1; zi<=zi+1; when "101"=> com1<="00011010" red1<="00000000" green1<="00100000" count<=count+1; zi<=zi+1; when "110"=> com1<="10010010" red1<="00000000" green1<=&

22、quot;01000000" count<=count+1; zi<=zi+1; when "111"=> com1<="11110010" red1<="00000000" green1<="10000000" count<=count+1; present<=s0; zi<="000" end case; count<=count+1; present<=s2; end if; when s3=>if(coun

23、t="111111111")then count<=(others=>'0'); present<=s0; else present<=s3; case zi is when "000"=> com1<="00000000" red1<="00000001" green1<="00000000" count<=count+1; zi<=zi+1; when "001" => com1<=&

24、quot;01100110" red1<="00000010" green1<="00000000" count<=count+1; zi<=zi+1; when "010"=> com1<="11111111" red1<="00000100" green1<="00000000" count<=count+1; zi<=zi+1; when "011"=> com1<="11111111" red1<="00001000" green1<=&

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论