サーチ…
前書き
まともなプログラミング言語はコメントをサポートしています。 VHDLでは、VHDLコードを理解することは中程度で洗練されていても困難なことが多いため、特に重要です。
一行のコメント
1行のコメントは2つのハイフン( --
)で始まり、行の終わりまで続きます。例:
-- This process models the state register
process(clock, aresetn)
begin
if aresetn = '0' then -- Active low, asynchronous reset
state <= IDLE;
elsif rising_edge(clock) then -- Synchronized on the rising edge of the clock
state <= next_state;
end if;
end process;
区切られたコメント
VHDL 2008以降、コメントは複数の行にまたがることがあります。複数行のコメントは/*
始まり*/
終わります。例:
/* This process models the state register.
It has an active low, asynchronous reset
and is synchronized on the rising edge
of the clock. */
process(clock, aresetn)
begin
if aresetn = '0' then
state <= IDLE;
elsif rising_edge(clock) then
state <= next_state;
end if;
end process;
区切られたコメントは、1行以下でも使用できます。
-- Finally, we decided to skip the reset...
process(clock/*, aresetn*/)
begin
/*if aresetn = '0' then
state <= IDLE;
els*/if rising_edge(clock) then
state <= next_state;
end if;
end process;
ネストされたコメント
コメント(一行または区切り)内で新しいコメント(一行または区切り)を開始することは効果がなく、無視されます。例:
-- This is a single-line comment. This second -- has no special meaning.
-- This is a single-line comment. This /* has no special meaning.
/* This is not a
single-line comment.
And this -- has no
special meaning. */
/* This is not a
single-line comment.
And this second /* has no
special meaning. */
Modified text is an extract of the original Stack Overflow Documentation
ライセンスを受けた CC BY-SA 3.0
所属していない Stack Overflow