1

VHDL モジュールを作成しようとしていますが、if ステートメントに問題があります。おそらくそれはばかげた間違いですが、私は VHDL に非常に慣れていないため、問題を理解できませんでした。これが私のコードです:

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;


entity binary_add is
    port( n1 : in std_logic_vector(3 downto 0);
    n2 : in std_logic_vector(3 downto 0);
    segments : out std_logic_vector(7 downto 0);
    bool : out bit;
    o : out std_logic_vector(3 downto 0);
    DNout : out std_logic_vector(3 downto 0));

end binary_add;

architecture Behavioral of binary_add is
begin

process(n1, n2) 
begin

o <= n1 + n2;

if( o = '1010') then 
bool <= '1';
else
bool <= '0';
end if;

end process;

end Behavioral;

そして、if ステートメントの最初の行から次の答えが得られます。

ERROR:HDLParsers:## - "C:/Xilinx/12.3/ISE_DS/ISE/.../binary_add.vhd" Line ##. parse error, unexpected TICK

私は何を間違っていますか?

4

2 に答える 2

2

マークの回答に従って、最初のエラーを修正しました。

2 番目のエラーは、出力の値を使用できないことです。

if output = "0101";    -- illegal

some_signal <= output; -- illegal

これを解決するには、内部信号 (合計など) を作成する必要があります。次に、内部信号を使用して、それを外部信号に割り当てます。

architecture Behavioral of binary_add is

signal sum : std_logic_vector(3 downto 0);

begin

process(n1, n2, sum) 
begin

sum <= n1 + n2;

if( sum = '1010') then 
bool <= '1';
else
bool <= '0';
end if;

end process;

o <= sum;

end Behavioral;
于 2010-11-03T10:13:42.360 に答える
2

「1010」は「1010」(二重引用符)にする必要があります。文字リテラル (1 文字) には、単一引用符が使用されます。

于 2010-11-02T17:15:38.140 に答える