IPカタログを使ってカウンターを自動生成する / 下位VHDLをentityで直接実体化する
(テキストとは無関係)
前回はcomponent
宣言してから実体化したが、今回はentity work.コンポーネント名
という形で直接実体化する。このほうがはるかに簡単に思えるが、それぞれ長所・短所があるとの由。動作は前回と同じ。
library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; use work.seven_segment_pkg.all; entity slow_counter is port( reset_n, clock: in std_logic; seven_seg : out std_logic_vector(6 downto 0) ); end; architecture rtl of slow_counter is signal timer_1_sec: std_logic; signal digit : std_logic_vector(3 downto 0); begin c1: entity work.counter_48M port map( aclr => not reset_n, -- リセットはLo有意にした。 clock => clock, cout => timer_1_sec ); c2: entity work.counter_10 port map( aclr => not reset_n, -- リセットはLo有意にした。 cin => timer_1_sec, clock => clock, q => digit ); seven_seg <= int_to_seven_seg(to_integer(unsigned(digit))); end;