EDA实验报告
班级:姓名:学号:
电子系 一实验名称:带有复位和时钟使能的十进制计数器 二实验分析: 实验步骤: 1建立工作库 2输入设计项目 3保存
4将当前文件设立为为目标文件 5编译 6建立仿真波形 7时序仿真 8保存 9引脚锁定
输入引脚rst锁定54引脚对应K1, en锁定58引脚对应K2, clk锁定1引脚 , 输出引脚cout锁定3引脚对应喇叭 ,cq锁定5,6,7,8引脚对应显示数码管。 10再次编译 11下载 VHDL描述为: library ieee;
use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity cnt10 is
port( clk,rst,en:in std_logic;
cq:out std_logic_vector(3 downto 0); cout:out std_logic); end cnt10;
architecture behav of cnt10 is begin
process(clk,rst,en)
variable cqi:std_logic_vector(3 downto 0); begin
if rst='1' then cqi:=(others=>'0'); elsif clk'event and clk='1' then if en='1' then
if cqi<9 then cqi:=cqi+1; else cqi:=(others=>'0'); end if; end if; end if;
if cqi=9 then cout<='1'; else cout<='0'; end if; cq<=cqi; end process;
end behav; 仿真结果:
三实验结果:
Rst为复位信号,当rst为高电平是计数清0。En为使能信号高电平有效。计数从0到9完成时就会有一个进位。