dfsa的笔记 https://bbs.21ic.com/?589063 [收藏] [复制] [RSS]

日志

VHDL 10进制加法器 进位输出 自动复位 可级联

已有 1083 次阅读2009-10-22 00:57 |系统分类:EDA/PLD

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;


entity counter10 is
 port( clk : in std_logic;
       aout : out std_logic_vector(3 downto 0);
       cout : out std_logic
      );
end;


architecture behav of counter10 is
signal cnt10 : std_logic_vector(3 downto 0):="0000";
begin
aout<=cnt10;
process(clk)
begin
 if clk'event and clk='1' then
 if cnt10="1001" then
  cnt10<="0000";
  cout<='1';
 else
  cnt10<=cnt10+1;
  cout<='0';
 end if;
 end if;
end process;
end;


路过

鸡蛋

鲜花

握手

雷人

评论 (0 个评论)