这里是我的一个简单的ALU是加减类型不匹配错误,如何解决这个
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
library IEEE;
use IEEE.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
entity alu is
Port (A : in STD_LOGIC_VECTOR (15 downto 0);
B : in STD_LOGIC_VECTOR (15 downto 0);
funct: in STD_LOGIC;
op: in STD_LOGIC_VECTOR (1 downto 0);
Result : out STD_LOGIC_VECTOR (15 downto 0));
end alu;
architecture Behavioral of alu is
begin
process (op, funct)
begin
case op is
when "00" => Result <= A+B;
when "01" => Result <= A-B;
when others => case funct is
when "0" => Result <= A+B;
when "1" => Result <= A-B;
when others => null;
end case;
`end case;
end process;
end Behavioral;
我收到以下错误
ERROR:HDLParsers:800 - "E:/Xilinx Projects/alu/alu.vhd" Line 51. Type of funct is incompatible with type of 0.
ERROR:HDLParsers:800 - "E:/Xilinx Projects/alu/alu.vhd" Line 52. Type of funct is incompatible with type of 1.
ERROR:HDLParsers:163 - "E:/Xilinx Projects/alu/alu.vhd" Line 55. Unexpected symbol read: `.
代码,我知道这事做类型不匹配的'功能'和'结果',但我不知道如何解决它,任何想法?
'0'是一个字符字面量或std_logic字面量。 “0”是一个字符串。这些有不同的类型。 –
另外,在第二个结尾的情况之前有一个严重的重音字符;'。您的代码片段行数不匹配,我们可能会认为是第55行。正如Brian所说,应该将这些“0”和“1”字符串分别更改为字符文字“0”和“1”,并删除严重重音字符你的代码会分析。只有在IEEE Std 1076-2008的VHDL中才有重音符号,用于表示工具指令。 – user1155120
你们是对的,非常感谢您的帮助,严重的口音被误输入了! – alexhilton