I am relearning VHDL and have a question about the code below. This is from a tutorial I have been following. When a button is pressed, an LED gets turned on after the person releases their finger from the button. I am confused about the order of execution in the process. Specifically this line: if i_Switch_1 = '0' and r_Switch_1 = '1' then
I have been reading that inside processes the code is executed sequentially, so I do not understand how this gets executed, since they are assigned to the same value right before.
Thanks
library ieee;
use ieee.std_logic_1164.all;
entity Clocked_Logic is
port(
i_Clk : in std_logic;
i_Switch_1 : in std_logic;
o_LED_1 : out std_logic);
end entity Clocked_Logic;
architecture RTL of Clocked_Logic is
signal r_LED_1 : std_logic := '0';
signal r_Switch_1 : std_logic := '0';
begin
p_Register : process (i_Clk) is
begin
if rising_edge(i_Clk) then
r_Switch_1 <= i_Switch_1;
if i_Switch_1 = '0' and r_Switch_1 = '1' then
r_LED_1 <= not r_LED_1;
end if;
end if;
end process p_Register;
o_LED_1 <= r_LED_1;
end architecture RTL;