北航FPGA实验报告.docx

上传人:b****1 文档编号:771414 上传时间:2022-10-12 格式:DOCX 页数:26 大小:411.51KB
下载 相关 举报
北航FPGA实验报告.docx_第1页
第1页 / 共26页
北航FPGA实验报告.docx_第2页
第2页 / 共26页
北航FPGA实验报告.docx_第3页
第3页 / 共26页
北航FPGA实验报告.docx_第4页
第4页 / 共26页
北航FPGA实验报告.docx_第5页
第5页 / 共26页
点击查看更多>>
下载资源
资源描述

北航FPGA实验报告.docx

《北航FPGA实验报告.docx》由会员分享,可在线阅读,更多相关《北航FPGA实验报告.docx(26页珍藏版)》请在冰豆网上搜索。

北航FPGA实验报告.docx

北航FPGA实验报告

 

电气技术实践

可编程逻辑器件FPGA应用开发

实验报告

 

姓名

班级

学号

 

2016年12月

 

一、实验目的

1、熟悉使用可编程逻辑器件(Altera公司FPGACyclone系列EP1C6Q)。

2、熟悉使用硬件描述语言VHDL。

3、掌握FPGA集成环境(Altera公司FPGAQuartusII9.0)开发流程。

4、熟悉使用核心目标系统板与接口电路等工作原理及其功能模块绑定信息。

5、熟悉并掌握下载线方式和下载文件的选择。

二、实验要求

1、学习并掌握文本、图形等输入和时序、功能仿真方法。

2、学习并熟悉门电路、组合电路、时序电路等单一模块功能。

3、学习并设计各种不同状态机逻辑功能。

4、学习并设计由单一模块→较多功能模块集成→系统集成方法。

5、学习并选择多种模式显示(发光二极管显示、米字型数码管显示、七段数码管→动态扫描或静态扫描显示、LED点阵显示各种字符和图形或静止或移动等方式、LCD液晶显示各种字符和图形或静止或移动等方式)。

6、根据自已的兴趣和愿望,可从以下给定的实验目录中选取或自已设定功能题目。

7、实验数目没有要求,关键是看质量,是否是自已编写、调试、实现。

三、实验内容

1、按指导书集成开发环境章节操作实现文本编程实例1和图形编程实例2全过程。

2、任选门电路、组合电路、时序电路实验各完成一个其逻辑功能,其实现方案自已规定。

在进行FPGA目标器件输入和输出引脚绑定时,输入引脚绑定高/低电平、单脉冲、各种分频连续脉冲等多种信号,输出引脚可绑定发光二极管、七段数码管、LED点阵等显示模式。

3、在完成1位十进制计数器的基础上,可增加完成2或3等多位十进制计数器逻辑功能并用多位七段数码管来显示。

4、用LED点阵显示任意字符、图形等信息。

四、实验代码及实验结果

1、4位二进制加法计数器

(1)实验代码

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entityerjinzhiis

port(clk,

rst:

instd_logic;

q:

outstd_logic_vector(3downto0));

endentityerjinzhi;

architecturebhvoferjinzhiis

signalq1:

std_logic_vector(3downto0);

begin

process(rst,clk)

begin

if(rst='0')then

q1<="0000";

elsif(clk'eventandclk='1')then

q1<=q1+1;

endif;

endprocess;

q<=q1;

endarchitecturebhv;

(2)管脚分配

(3)实验操作

①输入信号clk时钟→把FPGA_EA2_P6(Pin_P20)用导线与(FRQ_Q211Hz)连接、rst清零→N18(SW-1)、输出信号q3→U12(LED1)、q2→V12(LED2);q1→V15(LED3);q0→W13(LED4)。

②把输入信号rst设为“1”、clk时钟(FRQ_Q211Hz)用导线与(FRQ_Q211Hz)连接。

 

(4)实验现象

输出结果信息为第一、二、三、四个发光二极管按照0000→0001→……→1111循环显示,符合实验要求。

(该实验板上低电平为“1”)

2、半加器

(1)实验原理图

 

(2)管脚分配

(3)实验操作

逻辑分析:

输入信号a、b;输出信号分别为sum(和)、carry(进位)。

逻辑方程:

sum=a⊕b;carry=a*b。

输入信号a→N18(SW-1)、b→M20(SW-2)、输出信号sum(和)→U12(LED1)、carry(进位)→V12(LED2)

(4)实验现象

ⅰ输入信号a、b都为“0”,输出结果信息为两个发光二极管均为“灭”,说明和和进位都为0;ⅱ输入信号a为“1”,b为“0”,输出结果信息为第一个发光二极管“灭”,第二个发光二极管“亮”,说明和为“1”,进位为0;ⅲ输入信号a为“0”,b为“1”,输出结果信息为第一个发光二极管“灭”,第二个发光二极管“亮”。

说明和为“1”,进位为“0”;ⅳ输入信号a、b都为“1”,输出结果信息为第一个发光二极管“亮”第二个发光二极管“灭”,说明和为“0”,进位为“1”.均符合设计要求

3、RS触发器

(1)实验代码

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entityrs_clkis

port(s,r,res:

instd_logic;

q,not_q:

outstd_logic);

endrs_clk;

architecturebehavofrs_clkis

signalsel1,sel2:

std_logic;

begin

process(res,sel1,sel2)

begin

ifres='0'thensel1<='0';

sel2<='1';

elsif(S='1'andR='0')thensel1<='1';

sel2<='0';

elsif(S='0'andR='1')thensel1<='0';

sel2<='1';

elsif(S='0'andR='0')thensel1<=sel1;

sel2<=sel2;

endif;

Q<=sel1;

not_q<=sel2;

endprocess;

endbehav;

(2)管脚分配

 

(3)实验操作

 

(3)实验现象

将实验现象总结为RS触发器特性表,其中X指0或1均可;输入为”1”指SW输入为高,输入为”0”指SW输入为低;输出为”1”指对应LED灯灭(实验台的LED灯为高电平灭),输出为”0”指对应LED灯亮。

CLK触发

输入S

输入R

原来的Q

新的输出Q*

1

0

0

X

保持原状

1

1

0

1

1

1

1

0

0

1

1

0

1

1

0

1

0

1

0

0

1

1

1

X

不定状态

0

X

X

X

保持原状

 

4、数码管十六进制计数器

(1)实验代码

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitymotoris

port(

clk:

instd_logic;

rst:

instd_logic;

sel:

outstd_logic;

q:

outstd_logic_vector(3downto0);

d:

outstd_logic_vector(7downto0)

);

endentity;

architectureb1ofmotoris

signalq1,q2:

std_logic_vector(3downto0);

begin

process(clk,rst)

begin

ifclk'eventandclk='1'then

q1<=q1+1;

q2<="0010";

endif;

endprocess;

q<=q2;

process(q1)

begin

if(rst='1')thensel<='0';

caseq1is

when"0000"=>d<="11111100";

when"0001"=>d<="01100000";

when"0010"=>d<="11011010";

when"0011"=>d<="11110010";

when"0100"=>d<="01100110";

when"0101"=>d<="10110110";

when"0110"=>d<="10111110";

when"0111"=>d<="11100000";

when"1000"=>d<="11111110";

when"1001"=>d<="11110110";

when"1010"=>d<="11101110";

when"1011"=>d<="00111110";

when"1100"=>d<="10011100";

when"1101"=>d<="01111010";

when"1110"=>d<="10011110";

when"1111"=>d<="10001110";

endcase;

endif;

endprocess;

end;

 

(2)管脚分配

(3)实验现象

将CLK接入较低频率,这样可以清晰地观察数码管从0—F(16进制数)的转变,完成一个循环之后,自动重新从0开始显示,进入下一个循环

5、跑马灯

(1)实验代码

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entityledis

port(clk:

instd_logic;

rst:

instd_logic;

q:

outstd_logic_vector(7downto0));

end;

architectureledofledis

constants0:

std_logic_vector(1downto0):

="00";

constants1:

std_logic_vector(1downto0):

="01";

constants2:

std_logic_vector(1downto0):

="10";

constants3:

std_logic_vector(1downto0):

="11";

signalpresent:

std_logic_vector(1downto0);

signalq1:

std_logic_vector(7downto0);

signalcount:

std_logic_vector(3downto0);

begin

process(rst,clk)

begin

if(rst='0')then

present<=s0;

q1<=(others=>'0');

elsif(clk'eventandclk='1')then

casepresentis

whens0=>if(q1="00000000")then

q1<="10000000";

elseif(count="0111")then

count<=(others=>'0');

q1<="00000001";

present<=s1;

elseq1<=q1(0)&q1(7downto1);

count<=count+1;

present<=s0;

endif;

endif;

whens1=>if(count="0111")then

count<=(others=>'0');

q1<="10000001";

present<=s2;

elseq1<=q1(6down

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 解决方案 > 学习计划

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1