1

このエラーは、GHDL が VHDL 2008 をサポートしていないことが原因であると考えています。ff0 D にベクトル din の値を代入すると、27/28 行でエラーが発生します。ポート マップ内からベクトルにインデックスを付ける適切な方法は何ですか?

エラーを回避するために count_temp を作成しましたが、役に立たず、余分な変数を使用したくありません。ありがとう。

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

entity conv_encoder is
    generic (d_width : positive := 16);
    port (
        clk    : in std_logic;
        din    : in std_logic_vector(d_width-1 downto 0);
        ff_set : in std_logic;
        count  : in std_logic_vector(5 downto 0);
        dout   : out std_logic_vector(d_width*2-1 downto 0));
end conv_encoder;

architecture behavioral of conv_encoder is
  component d_ff is
    port ( clk, ff_set, D : in std_logic;
           Q : out std_logic);
  end component;
  signal a, b       : std_logic;
  signal count_temp : integer range 0 to d_width;
  begin
    count_temp <= to_integer(unsigned(count));
    ff0 : d_ff
      port map (clk    => clk,
                ff_set => ff_set,
                D      => din(count_temp),
                -- D      => din(to_integer(unsigned(count))),
                Q      => a);
    ff1 : d_ff
      port map (clk    => clk,
                ff_set => ff_set,
                D      => a,
                Q      => b);
    -- conv encoder is r=1/2 A=111 B=101
  process (clk, ff_set)
  begin
    if (ff_set = '0') then
      if (rising_edge(clk)) then
        dout(count_temp*2)   <= din(count_temp) xor a xor b;
        dout(count_temp*2+1) <= din(count_temp) xor b;
      end if;
    end if;
  end process;
end behavioral;

エラー:

ghdl -a  conv_encoder.vhd
conv_encoder.vhd:28:30: actual must be a static name
ghdl: compilation error
4

1 に答える 1

2

これは、GHDL での VHD2008 サポートの問題ではありません。これを解決するための 2 つの試みは概念的には単純ですが、エラーが示すように、ポートを静的ではないものに接続することはできません。これが平易な英語で意味することは、ポートをいくつかの組み合わせロジックに関連付けることができないということです。さえD => not din(0)許されません。

ここで行うことは、マルチプレクサを含めることです。これは次のように簡単です。

signal selected_din : std_logic;

...

selected_din <= din(count_temp);

D => din(count_temp),次に、行をに置き換えD => selected_din,ます。


あるいは、関数を書くこともできmuxます。その場合、行は次のようになりますD => mux(din, count_temp),dinこの関数は、 の値に基づいて に1 つの要素を返しますcount_temp

@ user1155120 のコメントによると、この「関数」メソッドは、執筆時点で GHDL コンパイラではサポートされていません。

于 2016-08-09T13:59:10.830 に答える