5

次のレポート ステートメントを機能させるのに問題があります。

report "ERROR: instruction address '" & CONV_INTEGER(a(7 downto 2)) & "' out of memory range." severity failure;

aは のタイプですin std_logic_vector(31 downto 0)

私が得ているエラーは次のとおりです。

No feasible entries for infix operator "&".

文字列を出力し、整数値を連結してから、別の文字列を連結したいと考えています。

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

4

1 に答える 1

5

「イメージ」の使用例:

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

entity foo is 
end entity;

architecture fum of foo is
    signal a: std_logic_vector (31 downto 0) := x"deadbeef";
begin
    process (a)
    begin
        report "ERROR: instruction address '" & 
--          CONV_INTEGER(a(7 downto 2)) & 
            INTEGER'IMAGE(to_integer(unsigned (a(7 downto 2)))) &
        "' out of memory range." ;-- severity failure;
    end process;
end architecture;

パッケージnumeric_stdを使用しました。原理は同じですが、変換ルーチンの名前が異なります。

'IMAGE は、型 (この場合は INTEGER) の値の文字列表現を返す事前定義された属性です。

失敗メッセージは、整数を文字列に連結する方法を知っている「&」連結演算子がないため、代わりに整数の文字列イメージを提供したためです。

実行時:

ghdl -r foo
foo.vhdl:13:9:@0ms:(レポート ノート): エラー: 命令アドレス '59' がメモリ範囲外です。

また、ビット 7 から 2 までは、ビット文字列の初期化からの "111011" であり、整数として表されるとたまたま 59 に等しくなります。

于 2015-04-16T18:32:38.053 に答える