VHDL中的if语句 [英] if statement in VHDL

查看:128
本文介绍了VHDL中的if语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 VHDL 中的 if 语句有疑问,请参阅下面的示例;-)

I've got a question about the if statement in VHDL, see the example bellow;-)

   signal SEQ : bit_vector(5 downto 0); 
signal output: bit; 
    -------

     if(SEQ = "000001") and (CNT_RESULT = "111111") then 
       output<= '1';
      CNT_RESET <= '0';
      else output<='0';
    end if;

我得到:if语句是非法的,并且输出"有多个来源.任何想法

and I get : the if statment is illegal and that "output" has multiply sources. any ideas

推荐答案

我认为 if 语句不在进程中?您只能在进程内使用 if 语句.对于流程外的类似功能,您可以使用 when:

I presume the if statement is not inside a process? You can only use if statements inside a process. For similar functionality outside a process, you can use when:

output <= '1' when (SEQ = "000001") and (CNT_RESULT = "111111") else
          '0';

CNT_RESET <= '0' when (SEQ = "000001") and (CNT_RESULT = "111111") else
             '1';

这篇关于VHDL中的if语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆