-- Extension of the VHDL program to turn on the LED -- light. This version turns it ON and OFF continously. -- It has to be properly loaded to the FPGA device. -- Pin assignments for "clk" and "led" signals need -- to be done for this purpose. -- -- Additional library is attached for the unsigned type. LIBRARY ieee; USE ieee.std_logic_1164.ALL; USE ieee.numeric_std.all; -- Entity part is a specification of the circuit interface; -- it tells how the circuit will interact with its environment. ENTITY HelloWorld is PORT (clk: IN std_logic; led: OUT std_logic); END HelloWorld; -- Architecture part is a description of the circuit behavior ARCHITECTURE archOfHelloWorld OF HelloWorld IS -- Declaration part precedes the BEGIN constant CNT_MAX : integer := 20000000; SIGNAL blink : std_logic; SIGNAL cnt : unsigned(24 downto 0); BEGIN -- Executable part starts at the BEGIN -- PROCESS executes whenever its input signal changes PROCESS(clk) BEGIN if rising_edge(clk) then if (cnt = (CNT_MAX - 1)) then -- when the counter reaches maximum cnt <= (others => '0'); -- it is reset to zero blink <= not blink; -- for the led to change the state else cnt <= cnt + 1; -- counting the clk signal pulses end if; end if; END PROCESS; led <= blink; -- turning the led ON and OFF, depending on the value of blink END archOfHelloWorld;