首页 | 新闻 | 新品 | 文库 | 方案 | 视频 | 下载 | 商城 | 开发板 | 数据中心 | 座谈新版 | 培训 | 工具 | 博客 | 论坛 | 百科 | GEC | 活动 | 主题月 | 电子展
返回列表 回复 发帖

请教quartus6.0的一个程序问题

请教quartus6.0的一个程序问题

我是一个新手,最近我在QUARTUSII6.0用VHDL编程,每次只要程序中含有 + 、-、*、/ ,编译时都会报类似的错误,如下面这个程序:
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
entity adder is
port( in1 : bit_vector;
      in2 : bit_vector;
      cnt1 : bit;
      pout : out bit_vector);
end entity adder;
architecture func of adder is
begin
process(cnt1)
begin
  if(cnt1='1') then pout<=in1 + in2;
  end if;
end process;
end architecture func;

每次编译时总是出现这样的错误提示:
Error (10327): VHDL error at adder.vhd(15): can't determine definition of operator ""+"" -- found 0 possible definitions
Error (10523): Ignored construct func at adder.vhd(11) due to previous errors
如果把程序中的“+”换成“*”或者“-”,编译时会把错误中的operator ""+"" 改成operator ""*""和operator ""-"",请高手指点一下出错的原因。谢谢了

加一个包 use ieee.std_logic_unsigned.all;

可是我加上use ieee.std_logic_unsigned.all;依然不行,即使把

use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;

都加上还是会有同样的错误,我起初想是不是QUARTUSII6.0的什么设置有问题啊,可是我从装上QUARTUSII后从未动过它的任何设置。不知道怎么回事,郁闷

LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
entity adder is
port( in1 : bit_vector;
      in2 : bit_vector;
      cnt1 : bit;
      pout : out bit_vector);
end entity adder;
architecture func of adder is
begin
process(cnt1)
begin
  if(cnt1='1') then pout<=in1 + in2;
  end if;
end process;
end architecture func;

关于这个程序,发表一点愚见:

1.端口声明中只有输出说明了,其他三个没有定义输入/输出状态

2.bit_vector,没有声明宽度

先看到这些

返回列表