- 1、本文档共6页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
eda实验七
实验七:8位二进制计数器
实验目的。
(1)掌握ISE9.1软件的基本操作及应用。
(2)掌握8位二进制计数器的工作方式。
(3)掌握位流文件的下载和试验箱的验证。
二、实验步骤。
建立新的项目。
输入VHDL代码(如下所示),存盘。
ISE 会自动创建一个VHDL模块的例子,并且在源代码编辑区内打开。简单的注释、模块和端口定义
已经自动生成,所剩余的工作就是在模块中实现代码。
填入的代码如下:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity counter is
Port ( clk : in STD_LOGIC;
clk1 : in STD_LOGIC;
clr : in STD_LOGIC;
en : in STD_LOGIC;
dir : in STD_LOGIC;
scanout : out STD_LOGIC_VECTOR (1 downto 0);
ledout : out STD_LOGIC_VECTOR (6 downto 0));
end counter;
architecture Behavioral of counter is
signal cnt :STD_LOGIC_VECTOR (7 downto 0);
signal hex :STD_LOGIC_VECTOR (3 downto 0);
signal led :STD_LOGIC_VECTOR (6 downto 0);
signal scan :STD_LOGIC_VECTOR (1 downto 0);
begin
process(clk)
begin
if(clk event and clk=1)then
if clr=1 then
cnt=(others=0);
elsif en=1 then
if dir=1then
cnt=cnt+1;
else
cnt=cnt-1;
end if;
end if;
end if;
end process;
process(clk1,clr)
begin
if clr=1 then scan=00;
elsif(clk1 event and clk1=1)then
if scan=00 or scan=10then scan=01 ;
else scan=scan+1;
end if;
end if;
end process;
scanout=scan;
ledout=not led;
hex=cnt(7 downto 4)when scan=01 else cnt(3 downto 0);
with hex select
led=1111001 when 0001,
0100100 when 0010,
0110000 when 0011,
0011001 when 0100,
0000010 when 0101,
1111000 when 0110,
0000000 when 0111,
0010000 when 1000,
0001000 when 1001,
0000011 when 1010,
1000110 when 1011,
0100001 when 1100,
0000110 when 1101,
0001110 when 1111,
1000000 when others;
end Behavioral;
Source 窗中,选中要编译的源文件,双击处理窗Processes中的Synthesize-XST 。对出错报告语句进行修改,直到successfully。综合完成之后,双击处理窗Processes中的Synthesize-XST下的Source 窗中中Generate` post systhesis simulation Model,综合完成之后,可以通过双击Synthesize-XST中的View RTL Schematic 来查看RTL级结构图,察看综合结构是否按照设计意图来实现电路。双击view Technology s Schemat
文档评论(0)