Skip to content

CLK

실습키트의 50MHz의 클럭을 받아서 원하는 시간으로 LED ON OFF 과정을 수행한다. 코어모듈에 적용된 LED 와 CLK 오실레이터의 입력을 사용한다.

내 사진

PIN 테이블

핀 번호 신호
PIN_T2 clk
PIN_E4 led

VHDL 코드



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

entity clk is
  port (
    clk : in  std_logic;   -- PIN T2, 50MHz
    led   : out std_logic    -- PIN E4 (active-high 가정)
  );
end entity;


architecture rtl of clk is

  signal cnt : integer range 0 to 49_999_999 := 0;
  signal q   : std_logic := '0';

  begin


  process(clk)
  begin
    if rising_edge(clk) then
      if cnt = 49_999_999 / 5 then
        cnt <= 0;
        q   <= not q;  -- 1초마다 토글 (ON 1초, OFF 1초)
      else
        cnt <= cnt + 1;
      end if;
    end if;
  end process;


  led <= q;            -- 보드가 active-low LED라면: led0 <= not q;

end architecture;