jishuqi.txt
来自「电子设计自动化中的计数器的实现程序」· 文本 代码 · 共 39 行
TXT
39 行
三、实验要求
(1)设计一个带有技术允许输入端、复位输入端和进位输出端的10进制计数器。
(2)编制仿真测试文件,并进行功能仿真。
(3)下载并验证计数器功能。
(4)为上述设计建立元件符号
四、VHDL源文件
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity cont2 is
port(res:in bit;
enable:in bit;
clk:in bit;
q:out integer range 0 to 9;
cq:out bit);
end cont2;
architecture num of cont2 is
begin
process(clk)
variable cn:integer range 0 to 255;
begin
if (res='0') then
cn:=0;cq<='0';
else if(clk'event and clk='1') then
if (enable='1' ) then
if(cn=8 ) then cn:=cn+1;cq<='1';
else if(cn=9)then
cn:=0;cq<='0';
else
cn:=cn+1;
end if;
end if;
end if;
end if;
end if;
q<=cn;
end process;
end architecture num;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?