ジェネリック内の関数 - 2023.2 日本語

Vivado Design Suite ユーザー ガイド: 合成 (UG901)

Document ID
UG901
Release Date
2023-11-01
Version
2023.2 日本語

VHDL-2008 では、エンティティ内で未定義の関数を宣言できます。次に例を示します。

entity bottom is
generic (
function my_func (a,b : unsigned) return unsigned);
port ...
......
end entity bottom;

エンティティのアーキテクチャで次のように記述します。

process(clk) is
begin
if rising_edge(clk) then
y <= my_func(a,b);
end if;
end process;

上記のコードではエンティティ内で my_func 関数が使用されていますが、関数が実行するの処理自体は定義されていません。これは、上位 RTL で bottom をインスタンシエートするときに定義します。

inst_bot1 : bottom
generic map (
my_func => my_func1 )
port map ...

上記のコードでは、VHDL ファイルまたはパッケージ ファイルで宣言されている my_func1 関数をジェネリックの my_func 関数に関連付けています。my_func1 で a および b という 2 つの符号なしの入力が使用されていれば、このコードは機能します。