Search code examples
if-statementvhdl

VHDL Syntax error with very simple if then process


I am trying to make a simple program to turn on an LED when a button is pushed.

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity TurnOn is
Port ( sig : in STD_LOGIC;
       led : out  STD_LOGIC);
end TurnOn;

architecture Behavioral of TurnOn is

(Line 39) process(sig)
begin

if sig = '1' then
led <= '1';
(Line 44) else
led <= '0';

(Line 47)end if;    
end process;
end Behavioral;

I get these errors.

Line 39: Syntax error near "process".
Line 44: Syntax error near "else".
Line 47: Syntax error near "if".

I am new to VHDL so I am assuming that it's something small that I am missing. Been staring at this for about an hour. Thanks for any input.


Solution

  • You forgot the begin statement before your process declaration.

    architecture Behavioral of TurnOn is
    
    begin
    
    process(sig)
    begin