100进制计数器
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
实验课程:EDA 实验
实验地点:第五实验室 实验时间:2012/11/12 班级:通信103班 学号: 102193 姓名:杨险峰
100进制计数器
一、实验目的:
1、设计一个100进制计数器;
2、掌握ISE 软件的综合与设计实现流程;
3、掌握采用ISE 软件进行FPGA 开发的过程以及试验箱的使用方法;
4、了解对设计电路进行功耗分析的方法;
5、了解ISE 软件设计报告中电路资源利用率情况分析;
6、掌握使用VHDL 创建测试文件的方法。
二、实验步骤:
1、启动ISE 集成开发环境,新建一个工程;
2、为工程添加设计源文件;
3、对源文件进行语法检查,并改正错误之处;
4、对设计进行时序仿真,分析设计的正确性;
5、锁定引脚,完成设计实现过程,并在试验箱上连线,利用iMPACT 进行程序下载;
6、在试验箱上验证计数器的功能,观察并记录实验结果;
7、打开report 文件查看资源利用率的情况;
三、实验原理:
输入时钟信号,输出接七段数码管的段码,数码管原理图如下:
四、实验代码:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_unsigned.ALL;
entity counter100 is
port(clk1,clk2:in std_logic;
y:out std_logic_vector(6 downto 0);
Y0 Y1 Y2 Y3 Y4
Y5 Y6 EN
clr en clk Vcc
swgw:out std_logic_vector(1 downto 0)); end counter100;
architecture Behavioral of counter100 is
signal xy:std_logic_vector(1 downto 0);
signal gw:std_logic_vector(3 downto 0) :="0000"; signal sw:std_logic_vector(3 downto 0);
signal w:std_logic_vector(3 downto 0);
signal led:std_logic_vector(6 downto 0);
begin
swgw<=xy;
y<=led;
process(clk1)
begin
if(clk1='1') then
xy<="01";
else
xy<="10";
end if;
end process;
process(clk2)
begin
if(clk2' event and clk2='1') then
if(gw="1001") then
gw<="0000";
else
gw<=gw+'1';
end if;
end if;
end process;
process(clk2)
begin
if(clk2' event and clk2='1') then
if(gw="1001") then
if(sw="1001") then
sw<="0000";
else
sw<=sw+'1';
end if;
end if;
end if;
end process;
process(xy)
begin
if(xy="01") then
w<=gw;
else
w<=sw;
end if;
end process;
with w select
led<="0000110" when "0001", --1
"1011011" when "0010", --2
"1001111" when "0011", --3
"1100110" when "0100", --4
"1101101" when "0101", --5
"1111101" when "0110", --6
"0000111" when "0111", --7
"1111111" when "1000", --8
"1101111" when "1001", --9
"0111111" when others; --0
end Behavioral;
所加激励:
五、实验记录及分析:
仿真激励:
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
use IEEE.STD_LOGIC_unsigned.ALL;
ENTITY counter_tbw IS
END counter_tbw;
ARCHITECTURE behavior OF counter_tbw IS
-- Component Declaration for the Unit Under Test (UUT) COMPONENT counter100
PORT(
clk1 : IN std_logic;
clk2 : IN std_logic;
y : OUT std_logic_vector(6 downto 0);
swgw : OUT std_logic_vector(1 downto 0)
);
END COMPONENT;
--Inputs
signal clk1 : std_logic := '1';