signal INTRODUCED_SUM : unsigned (5 downto 0):="000000";
signal TOTAL_SUM : unsigned (5 downto 0):="000000";
....
type state_type is (s0,s1,s2,s3); --type of state machine.
signal current_s,next_s: state_type;
begin
process (CLK,RESET)
begin
if (RESET = '1') then
current_s <= s0;
elsif (RISING_EDGE(CLK)) then
current_s <= next_s;
end if;
end process;
prelucrare: process(current_s,BTN1)
begin
case current_s is ...
when s2 =>
if (BTN1 = '1') then
next_s <= s3;
elsif (BTN1 = '0') then
if (SEL = "01") then
INTRODUCED_SUM <= INTRODUCED_SUM + 1;
1euro_COIN <= 1euro_COIN + 1;
TOTAL_SUM <= TOTAL_SUM +1;
elsif (SEL = "10") then
INTRODUCED_SUM <= INTRODUCED_SUM + 5;
5euro_COIN <= 5euro_COIN + 1;
TOTAL_SUM <= TOTAL_SUM +5;
elsif (SEL = "11") then
INTRODUCED_SUM <= INTRODUCED_SUM + 10;
10euro_COIN <= 10euro_COIN + 1;
TOTAL_SUM <= TOTAL_SUM +10;
end if;
next_s <= s2;
end if;