我尝试创建一个2位加法器,在7段显示器上显示结果,但是这段代码:
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity adder is
Port (
input0: in STD_LOGIC_VECTOR(1 DOWNTO 0) := "00";
input1: in STD_LOGIC_VECTOR(1 DOWNTO 0) := "00";
output: out STD_LOGIC_VECTOR(6 DOWNTO 0):= "0000000");
end adder;
architecture Behavioral of adder is
begin
process(input0,input1)
variable sum: integer range 1 to 0 := input0+input1;
begin
if sum = '0' then
output <= b"0111111";
elsif sum = '1' then
output <= b"000110";
elsif sum = b"10" then
output <= b"1011011";
elsif sum = b"11" then
output <= b"1001111";
end if;
end process;
end Behavioral;
创建此错误:
错误(10327):Cyclone2Test.vhd(16)处的VHDL错误:无法确定 运算符“”+“”的定义 - 找到0个可能的定义
为什么?