我收到以下错误: 行15:“if”附近的语法错误。 第4行:由于之前的错误而忽略了单位。VHDL:如果出现语法错误
这可能是一个非常愚蠢的问题,但任何人都可以帮忙吗? :)
library IEEE;
use IEEE.std_logic_1164.all;
entity arithmetic is
port( I1 :in std_logic_vector(12-1 downto 0); -- Operand 1
I2 :in std_logic_vector(8-1 downto 0); -- Operand 2
O :out std_logic_vector(12-1 downto 0); -- Output
C :out std_logic; -- Carry Flag
V :out std_logic; -- Overflow Flag
VALID :out std_logic -- Flag to indicate if the solution is valid or not
);
begin
if ((unsigned(I1)-unsigned(I2)) > unsigned(I1)) and ((unsigned(I1)-unsigned(I2)) > unsigned(I2)) then
C <= '1';
else
C <= '0';
end if;
if I1(x)='1' and signed(std_logic_vector(unsigned(I1)-unsigned(I2)))>0 then --x ist das höchte Bit von I1
V <= '1';
else
V <= '0';
end if;
if unsigned(I1) < unsigned(I2) then
VALID <= '0';
else
VALID <= '1';
end if;
und
O <= std_logic_vector(unsigned(I1)-unsigned(I2));
end arithmetic;
可能重复的[VHDL语法错误附近如果](http://stackoverflow.com/questions/20435228/vhdl-syntaxe-error-near-if) – user1155120
当它完全不同的代码@ user1155120 – Alena
我见过这个问题,它并没有帮助我@ user1155120 – Alena