私はmodelsimを使用しています。簡単なコードを書きましたが、エラーが発生します。
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity clk_counter is
port(output : out bit;
clk : in bit
);
end clk_counter;
architecture rtl of clk_counter_arch is
signal clock_counter_output_flag: bit;
constant clock_max_count : integer := 20000;
begin
process (clock_counter_output_flag, clk,CLK'event )
variable clock_count : integer := 0;
--constant clock_max_count : integer := 20000;
variable clock_out : bit := 0;
-- wait until CLK'event and CLK='1';
begin
if (CLK'event and CLK='1') then
clock_count := clock_count+1;
if (clock_count = clock_max_count) then
clock_out := 1;
else
clock_out := 0;
end if
end if
clock_counter_output_flag <= clock_out;
end process;
END Architecture;
エラーメッセージ:
# ** Error: (vcom-11) Could not find work.clk_counter_arch.
#
# ** Error: C:/Modeltech_pe_edu_10.4a/examples/work/src/clk_counter(13): VHDL Compiler exiting
エンティティ名はclk_counterであり、clk_counter_archのアーキテクチャrtlを定義しました。したがって、エラーが発生します。clk_counter_archをclk_counterに変更します。
次に、アーキテクチャをendrtlとして終了する必要があります。
また、なぜ2つの追加変数clock_outとclock_counter_output_flagを使用しているのですか?その値をコードの出力として使用する場合は、単に次のように記述します。
if (CLK'event and CLK='1') then
clock_count := clock_count+1;
if (clock_count = clock_max_count) then
output<='1';
else
output <='0';
end if;
end if;
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加