EDA技术CPLD FPGA开发应用简明教程24译码器.docx

上传人:b****5 文档编号:28526878 上传时间:2023-07-18 格式:DOCX 页数:21 大小:326.05KB
下载 相关 举报
EDA技术CPLD FPGA开发应用简明教程24译码器.docx_第1页
第1页 / 共21页
EDA技术CPLD FPGA开发应用简明教程24译码器.docx_第2页
第2页 / 共21页
EDA技术CPLD FPGA开发应用简明教程24译码器.docx_第3页
第3页 / 共21页
EDA技术CPLD FPGA开发应用简明教程24译码器.docx_第4页
第4页 / 共21页
EDA技术CPLD FPGA开发应用简明教程24译码器.docx_第5页
第5页 / 共21页
点击查看更多>>
下载资源
资源描述

EDA技术CPLD FPGA开发应用简明教程24译码器.docx

《EDA技术CPLD FPGA开发应用简明教程24译码器.docx》由会员分享,可在线阅读,更多相关《EDA技术CPLD FPGA开发应用简明教程24译码器.docx(21页珍藏版)》请在冰豆网上搜索。

EDA技术CPLD FPGA开发应用简明教程24译码器.docx

EDA技术CPLDFPGA开发应用简明教程24译码器

内蒙古工业大学信息工程学院

 

实验报告

 

课程名称:

EDA技术与CPLD/FPGA开发应用简明教程

实验类型:

验证性□综合性□设计性■

实验室名称:

信息学院机房

班级:

通信10-1班学号:

姓名:

成绩:

实验日期:

2013年05月17日

 

实验一MAX+PLUSⅡ软件的使用

一、实验目的:

1、学习VHDL语言的基本指令及编程方法。

2、熟悉在PC机上运用MAX+PLUSⅡ软件和EPLD进行电路设计的设计和仿真过程。

二、实验设备:

PC机

三、实验原理

1、软件操作方法见第五章。

2、组合逻辑电路的设计。

(1)原理图输入法。

写出2-4译码器的真值表,根据真值表,从Prim库中调出元件做出电路原理图。

(2)VHDL输入法。

程序应包括库说明语句、实体说明、构造体说明,可用IF语句(还可选用其它语句)语句实现2-4译码器。

3、时序逻辑电路的设计。

(1)原理图输入法。

参照数字逻辑电路中学到的知识,时序逻辑电路的设计分为以下几步:

画出状态转换图;状态分配和化简;列出状态方程和输出方程;选择触发器(例:

选择D触发器,Prim库中的DFF),做电路原理图。

之后按照第五章的步骤进行编译和仿真。

(2)VHDL输入法。

画出状态转换图,用VHDL语言描述该状态机,之后按照第五章的步骤进行编译和仿真。

四、实验内容:

设计一个2-4译码器,并验证其功能。

(1)用原理图输入法设计,并仿真设计结果。

(2)用VHDL语言进行设计,并仿真设计结果。

五、实验报告要求:

1、写出VHDL语言源程序,并画出仿真得到的时序波形图。

程序:

libraryieee;

useieee.std_logic_1164.all;

entitydecoder2_4is

port(a,b,g1,g2a,g2b:

instd_logic;

y:

outstd_logic_vector(3downto0));

enddecoder2_4;

architecturertlOFdecoder2_4is

signalindata:

std_logic_vector(1downto0);

begin

indata<=b&a;

process(indata,g1,g2a,g2b)

begin

if(g1='1'andg2a='0'andg2b='0')then

caseindatais

when"00"=>y<="1110";

when"01"=>y<="1101";

when"10"=>y<="1011";

when"11"=>y<="0111";

whenothers=>y<="XXXX";

endcase;

else

y<="1111";

endif;

endprocess;

endrtl;

2、写出2-4译码器除采用IF语句外,还可采用什么语句实现。

(1)使用条件选择IFELSEIF语句;

(2)使用PROCESS语句;

(3)使用SLL逻辑运算符。

3、写出对设计输入方法的优略心得。

利用EDA开发工具进行组合逻辑电路的设计,采用自顶向下的设计方法,需要注意很多细节性的问题。

本实验就是典型的先总后分的的自顶向下结构设计,符合EDA设计的基本思想,采用了简单的when语句,将所有情况一一罗列即可,但是此设计方法适用于简单的程序,对于复杂程序则使用起来会很繁琐,不建议采用。

 

实验二组合逻辑电路的设计

一、实验目的:

1、掌握用VHDL语言和EPLD进行组合逻辑电路的设计方法。

2、加深对EPLD设计全过程的理解。

3、掌握组合逻辑电路的静态测试方法。

二、实验设备:

1、PC机

2、EDA实验箱(主芯片是ALTERAEPM7128SLC84-15)。

三、实验内容:

用VHDL语言输入法设计一个四舍五入判别电路,其输入为8421BCD码,要求当输入大于或等于5时,判别电路输出为1;反之为0。

四、实验报告要求:

程序清单:

libraryieee;

useieee.std_logic_1164.all;

entityroundis

port(x:

instd_logic_vector(3downto0);

y:

outbit);

endround;

architectureroundingofroundis

Begin

process(x)

Begin

casexis

when"0000"=>y<='0';

when"0001"=>y<='0';

when"0010"=>y<='0';

when"0011"=>y<='0';

when"0100"=>y<='0';

when"0101"=>y<='1';

when"0110"=>y<='1';

when"0111"=>y<='1';

when"1000"=>y<='1';

when"1001"=>y<='1';

whenothers=>null;

endcase;

endprocess;

endrounding;

仿真结果:

  BCD码用二进制数表示十进制数,小于5输出低电平,大于5则输出高电平,产生进位信号,从而仿真结果得到下面的图形。

实验三计数器及时序电路

一、实验目的:

1、了解时序电路的VHDL语言设计方法。

2、了解同步计数器的使用方法。

3、理解时序电路和同步计数器加译码电路的联系,设计任意编码计数器。

二、实验设备:

1、PC机

2、EDA实验箱(主芯片是ALTERAEPM7128SLC84-15)。

三、实验内容:

1、用VHDL语言输入法设计一个同步四位二进制加法计数器和六进制同步计数器。

2、用74LS161两个宏连接成八位二进制同步计数器。

3、用74LS161宏,同时采用清零和置数法组成六进制、十进制和六十进制计数器。

4、设计一个4-7译码器,并验证其功能。

四、实验报告:

1、六进制

程序清单:

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitycount6is

port(clk,clr,en:

instd_logic;

carry:

outstd_logic;

q:

outstd_logic_vector(2downto0));

endcount6;

architecturebehaofcount6is

signalcntout:

std_logic_vector(2downto0);

Begin

q<=cntout;

process(clk)

Begin

ifclk'eventandclk='1'then

ifclr='1'then

cntout<="000";

carry<='0';

elsifen='1'then

ifcntout="101"then

cntout<="000";

carry<='1';

else

cntout<=cntout+'1';

carry<='0';

endif;

endif;

endif;

endprocess;

endbeha;

仿真结果:

2、十进制

程序清单:

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitycount10is

port(clk,clr,en:

instd_logic;

carry:

outstd_logic;

q:

outstd_logic_vector(3downto0));

endcount10;

architecturebehaofcount10is

signalcntout:

std_logic_vector(3downto0);

Begin

q<=cntout;

process(clk)

Begin

ifclk'eventandclk='1'then

ifclr='1'then

cntout<="0000";

carry<='0';

elsifen='1'then

ifcntout="1001"then

cntout<="0000";

carry<='1';

else

cntout<=cntout+'1';

carry<='0';

endif;

endif;

endif;

endprocess;

endbeha;

仿真结果:

3、六十进制

程序清单:

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitycount60is

port(clk,clr,en:

instd_logic;

carry:

outstd_logic;

q:

outstd_logic_vector(6downto0));

endcount60;

architecturebehaofcount60is

componentcount10

port(clk,clr,en:

instd_logic;

carry:

outstd_logic;

q:

outstd_logic_vector(3downto0));

endcomponent;

componentcount6

port(clk,clr,en:

instd_logic;

carry:

outstd_logic;

q:

outstd_logic_vector(2downto0));

endcomponent;

signaltempqa:

std_logic_vector(3downto0);

signaltempqb:

std_logic_vector(2downto0);

signaltempca:

std_logic;

begin

u0:

count10portmap(clk,clr,en,tempca,tempqa);

u1:

count6portmap(clk,clr,tempca,carry,tempqb);

q<=tempqb&tempqa;

endbeha;

仿真结果:

4、4-7译码器

程序清单:

libraryieee;

useieee.std_logic_1164.all;

entitydecoderis

port(input:

instd_logic_vector(3downto0);

output:

outstd_logic_vector(6downto0));

enddecoder;

architecturebehaofdecoderis

begin

process(input)

begin

caseinputis

when"0000"=>output<="0111111";--0

when"0001"=>output<="0000110";--1

when"0010"=>output<="1011011";--2

when"0011"=>output<="1001111";--3

when"0100"=>output<="1100110";--4

when"0101"=>output<="1101101";--5

when"0110"=>output<="1111101";--6

when"0111"=>output<="0000111";--7

when"1000"=>output<="1111111";--8

when"1001"=>output<="1101111";--9

when"1010"=>output<="1110111";--A

when"1011"=>output<="1111100";--b

when"1100"=>output<="0111001";--C

when"1101"=>output<="1011110";--d

when"1110"=>output<="1111001";--E

when"1111"=>output<="1110001";--F

whenothers=>null;

endcase;

endprocess;

endbeha;

仿真结果:

 

实验四扫描驱动显示电路设计(设计性实验)

一、实验目的

1.了解实验箱中8位七段数码管显示模块的工作原理。

2.熟悉VHDL硬件描述语言及设计专用数字集成电路的自顶向下的设计思想。

3.掌握利用CPLD/FPGA设计8位七段数码管扫描显示驱动电路的方法。

二、实验设备

1.计算机(配置为:

P4CPU128M内存);

2.MAX+plusⅡ开发工具软件;

3.EL教学实验箱;

4.万用表;

5.DS5022M型双踪数字示波器;

三、扫描原理

为了减少8位显示信号的接口连接线,实验箱中的数码显示采用扫描显示工作模式。

即8位数码管的七段译码输入(a,b,c,d,e,f,g)是并联在一起的,而每一个数码管是通过一个3位选择sel[2..0]来选定的。

sel与数码管之间是一3-8译码的关系,即sel为“000”时,选中第一个数码管,sel为“001”时,选中时,选中第八个数码管。

四、设计任务

本实验要求在给定子模块程序的基础上,画出设计原理图。

自行编写顶层模块程序,完成扫描显示驱动电路的设计,实现在8个数码管上轮流显示字符0-F的功能。

五、设计要求

1.要求在Max+plusⅡ平台上用VHDL语言编写顶层模块程序,调试、仿真成功后,下载至ALTEREPM7128SLC84-15芯片,再利用外接电路实现以上设计功能。

2.扫描驱动显示电路有2个输入端(clk,reset),14个输出端(a,b,c,d,e,f,g)和(y0,y1,y2,y3,y4,y5,y6,y7),全部为TTL电平,管脚分配任意,如下图所示。

六、实验报告

1.顶层

libraryieee;

useieee.std_logic_1164.all;

entitydispis

port(clk,reset:

instd_logic;

a,b,c,d,e,f,g:

outstd_logic;

y:

outstd_logic_vector(2downto0));

enddisp;

architecturebehaofdispis

componentcounter16

port(clk,clr:

instd_logic;

count:

outstd_logic_vector(3downto0));

endcomponent;

componentdecdisp

port(datain:

instd_logic_vector(3downto0);

a,b,c,d,e,f,g:

outstd_logic);

endcomponent;

componentyima3

port(x:

instd_logic_vector(2downto0);

y:

outstd_logic_vector(2downto0));

endcomponent;

signalcont:

std_logic_vector(3downto0);

signalsel3:

std_logic_vector(2downto0);

begin

d1:

counter16portmap(clk=>clk,clr=>reset,count=>cont);

d2:

decdispportmap(datain=>cont,a=>a,b=>b,c=>c,d=>d,e=>e,f=>f,g=>g);

d3:

yima3portmap(x=>cont(2downto0),y=>y);

endbeha;

2、4-7译码器

libraryieee;

useieee.std_logic_1164.all;

entitydecdispis

port(datain:

instd_logic_vector(3downto0);

a,b,c,d,e,f,g:

outstd_logic);

enddecdisp;

architecturebehaofdecdispis

signaldataout:

std_logic_vector(6downto0);

begin

a<=dataout(6);

b<=dataout(5);

c<=dataout(4);

d<=dataout(3);

e<=dataout

(2);

f<=dataout

(1);

g<=dataout(0);

process(datain)

begin

casedatainis

when"0000"=>

dataout<="1111110";

when"0001"=>

dataout<="0110000";

when"0010"=>

dataout<="1101101";

when"0011"=>

dataout<="1111001";

 

when"0100"=>

dataout<="0110011";

when"0101"=>

dataout<="1011011";

when"0110"=>

dataout<="1011111";

when"0111"=>

dataout<="1110000";

when"1000"=>

dataout<="1111111";

when"1001"=>

dataout<="1111011";

when"1010"=>

dataout<="1110111";

when"1011"=>

dataout<="0011111";

when"1100"=>

dataout<="1001110";

when"1101"=>

dataout<="0111101";

when"1110"=>

dataout<="1001111";

when"1111"=>

dataout<="1000111";

whenothers=>

dataout<="XXXXXXX";

endcase;

endprocess;

endbeha;

2、六进制:

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitycounter16is

port(clk,clr:

instd_logic;

count:

outstd_logic_vector(3downto0);

sel:

outstd_logic_vector(2downto0));

endcounter16;

architecturebehaofcounter16is

signalcnt:

std_logic_vector(3downto0);

begin

process(clk,clr)

begin

ifclr='0'then

cnt<="0000";

elsifclk='1'andclk'eventthen

cnt<=cnt+'1';

endif;

count<=cnt;

sel<=cnt(2downto0);

endprocess;

endbeha;

4、yima3

libraryieee;

useieee.std_logic_1164.all;

entityyima3is

port(x:

instd_logic_vector(2downto0);

y:

outstd_logic_vector(2downto0));

endyima3;

architecturebehaofyima3is

begin

y<=x;

endbeha;

管脚分配图:

仿真结果截图:

心得体会:

随着电子设计技术的发展,EDA工具已成为电子工程师必备的知识之一。

EDA工具的出现和发展,给电子设计自动化带来了翻天覆地的变化,没有EDA工具就无法完成超大规模集成电路的设计,先进的EDA工具已成为进行电子系统设计的前提。

何为EDA呢?

通过我们这次理论课程和实践课程的学习,我们知道EDA(ElectronicsDesignAutomation)是以计算机为工作平台、以硬件描述语言(VHDL)为设计语言、以可编程器件(CPLD/FPGA)为实验载体、以ASIC/SOC芯片为目标器件、进行必要的元件建模和系统仿真的电子产品自动化设计过程。

课程刚开始的时候,对EDA技术很陌生,感到有些茫然不知所措,然后随着学习的深入些才慢慢入门,对其设计的基本思路和原则开始有了一个清晰明了的轮廓。

通过对这门课程相关理论的学习,我掌握了EDA的一些基本的的知识,现代电子产品的性能越来越高,复杂度越来越大,更新步伐也越来越快,我们只有在掌握原有知识理论基础的前提下才能去适应这个社会下微电子技术和电子技术的变革和发展。

通过课程最后的实验,我体会到一些VHDL语言相对于其他编程语言的特点。

在接触VHDL语言之前,我已经学习了C语言、汇编语言,同时去涉猎了JAVA语言,相对于这些语言的学习,VHDL 具有自身明显的特点。

首先仅仅由于VHDL 是作为一种硬件描述语言,我们在学习的过程中就不能单单只在乎程序的正确与否,而同时要了解硬件的结构特征等从而使程序去适配电路,这对我们每个初学者来说是有很大难度的。

这次实验我们完成的任务其实很简单,但我们每个人做的并不完善,我们极少去向老师咨询与硬件电路相关的知识,只是一味的照着给定程序依葫芦画瓢,这样对我们进一步了解EDA的特点以及领略其魅力是有很大不利影响的。

在学习的过程中,我明白了一个道理:

只要全身心的投入到一件事中,并且要有持之以恒的决心,就一定会有收获。

有的人觉得自己做不出来,就网上搜一个了事,但是,放弃一次黑暗中摸索的经历,就放弃了一次成长的机会!

如果你付出了,没有收获。

那只能说,是付出的还不够

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

当前位置:首页 > 经管营销

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

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