返回该小组首页 回复主题
xuhaowen

xuhaowen

小组等级:     E币:113  (E币换礼)

#1楼主:加一和减一的VHDL代码

文章发表于:2008-01-24 11:41

以下为加一和减一的VHDL代码

library ieee;
   
use ieee.std_logic_1164.all;

entity exer1 is
    port ( a   :in std_logic := '0';
           b   :in std_logic := '0';
           clk :in std_logic;
           c   :inout integer range -100 to 100 := 0);
end entity;

architecture bhv of exer1 is
signal temp : integer range -100 to 100 := 0;
begin
    process (clk,a, b)
       begin
          if clk'event and clk='1' then
           if a = '1' then
             temp <= c + 1;    
          elsif b = '1' then
             temp <= c - 1;
        end if;
    end if;
    end process;
      c<= temp;

end bhv;  

快速回复主题--如果想加入编辑器功能,建议使用 [高级回复]

您目前还不是小组成员,请先加入

回复贴子区

用户名:    您没有注册?

密码:    忘记了密码?

内容:

  • DesignDesign
  • HTMLHTML

浏览该小组的用户还看过...

该小组其它话题

所有小组精华文章